git: 25c0c8725fbb - stable/14 - vtnet, ptnet: include opt_*.h files early

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Fri, 05 Sep 2025 19:09:17 UTC
The branch stable/14 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=25c0c8725fbb1713543429709077cbb78bac0c51

commit 25c0c8725fbb1713543429709077cbb78bac0c51
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-08-21 15:18:07 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-09-05 19:08:47 +0000

    vtnet, ptnet: include opt_*.h files early
    
    Include opt_inet.h and opt_inet6.h early in the files including
    virtio_net.h, since they use INET and/or INET6.
    While there, remove redundant inclusion of sys/types.h, since it is
    included already by sys/param.h.
    
    There was a discussion to include opt_inet.h and opt_inet6.h also
    in virtio_net.h. glebius suggested to add a mechanism for files
    to check, if required opt_*.h files were included. virtio_net.h
    will be the first consumer of this mechanism.
    
    Reviewed by:            glebius, Peter Lei
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D52046
    
    (cherry picked from commit 3077532b1bb2911d3012ee90bae9d9499c960569)
---
 sys/dev/netmap/if_ptnet.c         | 6 ++----
 sys/dev/virtio/network/if_vtnet.c | 6 +++---
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/sys/dev/netmap/if_ptnet.c b/sys/dev/netmap/if_ptnet.c
index cea62517b2e6..d8995be7f1e9 100644
--- a/sys/dev/netmap/if_ptnet.c
+++ b/sys/dev/netmap/if_ptnet.c
@@ -27,8 +27,9 @@
 /* Driver for ptnet paravirtualized network device. */
 
 #include <sys/cdefs.h>
+#include "opt_inet.h"
+#include "opt_inet6.h"
 
-#include <sys/types.h>
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
@@ -75,9 +76,6 @@
 #include <dev/pci/pcivar.h>
 #include <dev/pci/pcireg.h>
 
-#include "opt_inet.h"
-#include "opt_inet6.h"
-
 #include <sys/selinfo.h>
 #include <net/netmap.h>
 #include <dev/netmap/netmap_kern.h>
diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c
index 479c34b4f2ee..bc31957d492c 100644
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -29,6 +29,9 @@
 /* Driver for VirtIO network devices. */
 
 #include <sys/cdefs.h>
+#include "opt_inet.h"
+#include "opt_inet6.h"
+
 #include <sys/param.h>
 #include <sys/eventhandler.h>
 #include <sys/systm.h>
@@ -83,9 +86,6 @@
 #include <dev/virtio/network/if_vtnetvar.h>
 #include "virtio_if.h"
 
-#include "opt_inet.h"
-#include "opt_inet6.h"
-
 #if defined(INET) || defined(INET6)
 #include <machine/in_cksum.h>
 #endif