The branch main has been updated by jhibbits:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2c2b37ad251d25fb81d6254e29130684fed774ab

commit 2c2b37ad251d25fb81d6254e29130684fed774ab
Author:     Justin Hibbits <[email protected]>
AuthorDate: 2023-01-13 15:43:51 +0000
Commit:     Justin Hibbits <[email protected]>
CommitDate: 2023-01-24 19:36:30 +0000

    ifnet/API: Move struct ifnet definition to a <net/if_private.h>
    
    Hide the ifnet structure definition, no user serviceable parts inside,
    it's a netstack implementation detail.  Include it temporarily in
    <net/if_var.h> until all drivers are updated to use the accessors
    exclusively.
    
    Reviewed by:    glebius
    Sponsored by:   Juniper Networks, Inc.
    Differential Revision: https://reviews.freebsd.org/D38046
---
 sys/net/altq/altq_cbq.c       |   1 +
 sys/net/altq/altq_codel.c     |   1 +
 sys/net/altq/altq_fairq.c     |   1 +
 sys/net/altq/altq_hfsc.c      |   1 +
 sys/net/altq/altq_priq.c      |   1 +
 sys/net/altq/altq_rmclass.c   |   1 +
 sys/net/altq/altq_subr.c      |   1 +
 sys/net/bpf.c                 |   1 +
 sys/net/bridgestp.c           |   1 +
 sys/net/debugnet.c            |   1 +
 sys/net/debugnet_inet.c       |   1 +
 sys/net/ieee8023ad_lacp.c     |   1 +
 sys/net/if.c                  |   1 +
 sys/net/if_bridge.c           |   1 +
 sys/net/if_clone.c            |   1 +
 sys/net/if_dead.c             |   1 +
 sys/net/if_disc.c             |   1 +
 sys/net/if_edsc.c             |   2 +-
 sys/net/if_enc.c              |   1 +
 sys/net/if_epair.c            |   1 +
 sys/net/if_ethersubr.c        |   1 +
 sys/net/if_fwsubr.c           |   1 +
 sys/net/if_gif.c              |   1 +
 sys/net/if_gre.c              |   1 +
 sys/net/if_infiniband.c       |   1 +
 sys/net/if_ipsec.c            |   1 +
 sys/net/if_lagg.c             |   1 +
 sys/net/if_llatbl.c           |   1 +
 sys/net/if_loop.c             |   1 +
 sys/net/if_me.c               |   1 +
 sys/net/if_media.c            |   1 +
 sys/net/if_mib.c              |   1 +
 sys/net/if_ovpn.c             |   1 +
 sys/net/if_private.h          | 198 ++++++++++++++++++++++++++++++++++++++++++
 sys/net/if_stf.c              |   1 +
 sys/net/if_tuntap.c           |   1 +
 sys/net/if_var.h              | 160 +---------------------------------
 sys/net/if_vlan.c             |   1 +
 sys/net/if_vxlan.c            |   1 +
 sys/net/iflib.c               |   1 +
 sys/net/iflib_clone.c         |   1 +
 sys/net/netisr.c              |   1 +
 sys/net/route.c               |   1 +
 sys/net/route/nhgrp_ctl.c     |   1 +
 sys/net/route/nhop_ctl.c      |   1 +
 sys/net/route/route_ctl.c     |   1 +
 sys/net/route/route_ddb.c     |   1 +
 sys/net/route/route_ifaddrs.c |   1 +
 sys/net/route/route_rtentry.c |   1 -
 sys/net/rtsock.c              |   1 +
 50 files changed, 246 insertions(+), 161 deletions(-)

diff --git a/sys/net/altq/altq_cbq.c b/sys/net/altq/altq_cbq.c
index 0e267fcb49e2..86102ebcd537 100644
--- a/sys/net/altq/altq_cbq.c
+++ b/sys/net/altq/altq_cbq.c
@@ -47,6 +47,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <netinet/in.h>
 
 #include <netpfil/pf/pf.h>
diff --git a/sys/net/altq/altq_codel.c b/sys/net/altq/altq_codel.c
index b9950ed94d2b..be16a5aef3e5 100644
--- a/sys/net/altq/altq_codel.c
+++ b/sys/net/altq/altq_codel.c
@@ -53,6 +53,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <netinet/in.h>
 
 #include <netpfil/pf/pf.h>
diff --git a/sys/net/altq/altq_fairq.c b/sys/net/altq/altq_fairq.c
index b4eeb1ddf9b4..b33543548235 100644
--- a/sys/net/altq/altq_fairq.c
+++ b/sys/net/altq/altq_fairq.c
@@ -104,6 +104,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <netinet/in.h>
 
 #include <netpfil/pf/pf.h>
diff --git a/sys/net/altq/altq_hfsc.c b/sys/net/altq/altq_hfsc.c
index 5551ad1313e4..16b25d215feb 100644
--- a/sys/net/altq/altq_hfsc.c
+++ b/sys/net/altq/altq_hfsc.c
@@ -63,6 +63,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <netinet/in.h>
 
 #include <netpfil/pf/pf.h>
diff --git a/sys/net/altq/altq_priq.c b/sys/net/altq/altq_priq.c
index f0627e2611a7..bb679baa236d 100644
--- a/sys/net/altq/altq_priq.c
+++ b/sys/net/altq/altq_priq.c
@@ -49,6 +49,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <netinet/in.h>
 
 #include <netpfil/pf/pf.h>
diff --git a/sys/net/altq/altq_rmclass.c b/sys/net/altq/altq_rmclass.c
index a9af314cd48a..6e64a0a6f80e 100644
--- a/sys/net/altq/altq_rmclass.c
+++ b/sys/net/altq/altq_rmclass.c
@@ -52,6 +52,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 
 #include <net/altq/if_altq.h>
 #include <net/altq/altq.h>
diff --git a/sys/net/altq/altq_subr.c b/sys/net/altq/altq_subr.c
index deadf4ecc9a9..04ea1bc91e28 100644
--- a/sys/net/altq/altq_subr.c
+++ b/sys/net/altq/altq_subr.c
@@ -46,6 +46,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_dl.h>
 #include <net/if_types.h>
 #include <net/vnet.h>
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 1885f1fd3733..ab733f1d68ec 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_vlan_var.h>
 #include <net/if_dl.h>
 #include <net/bpf.h>
diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c
index cf182d2efe7b..23c035b282f9 100644
--- a/sys/net/bridgestp.c
+++ b/sys/net/bridgestp.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_dl.h>
 #include <net/if_types.h>
 #include <net/if_llc.h>
diff --git a/sys/net/debugnet.c b/sys/net/debugnet.c
index b41d93eca7fe..372801d3d970 100644
--- a/sys/net/debugnet.c
+++ b/sys/net/debugnet.c
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_dl.h>
 #include <net/if_types.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/vnet.h>
 #include <net/route.h>
 #include <net/route/nhop.h>
diff --git a/sys/net/debugnet_inet.c b/sys/net/debugnet_inet.c
index e7449113ba10..bd5195ab86d5 100644
--- a/sys/net/debugnet_inet.c
+++ b/sys/net/debugnet_inet.c
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_dl.h>
 #include <net/if_types.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
diff --git a/sys/net/ieee8023ad_lacp.c b/sys/net/ieee8023ad_lacp.c
index 65b3a337eedc..78345aae68e5 100644
--- a/sys/net/ieee8023ad_lacp.c
+++ b/sys/net/ieee8023ad_lacp.c
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_dl.h>
 #include <net/ethernet.h>
 #include <net/infiniband.h>
diff --git a/sys/net/if.c b/sys/net/if.c
index c7a6cf18d4b7..a18e4f1d8f56 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -86,6 +86,7 @@
 #include <net/if_var.h>
 #include <net/if_media.h>
 #include <net/if_mib.h>
+#include <net/if_private.h>
 #include <net/if_vlan_var.h>
 #include <net/radix.h>
 #include <net/route.h>
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 5c3ce137931c..67d031a65052 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -110,6 +110,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_dl.h>
 #include <net/if_types.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/pfil.h>
 #include <net/vnet.h>
 
diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c
index 8360fb4d1d27..7dcb3c271e42 100644
--- a/sys/net/if_clone.c
+++ b/sys/net/if_clone.c
@@ -46,6 +46,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_clone.h>
 #include <net/radix.h>
 #include <net/route.h>
diff --git a/sys/net/if_dead.c b/sys/net/if_dead.c
index 5721e9490776..8d645c29817b 100644
--- a/sys/net/if_dead.c
+++ b/sys/net/if_dead.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 
 static int
 ifdead_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *sa,
diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c
index 14d544dfd86a..62313415de91 100644
--- a/sys/net/if_disc.c
+++ b/sys/net/if_disc.c
@@ -48,6 +48,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_clone.h>
 #include <net/if_types.h>
 #include <net/route.h>
diff --git a/sys/net/if_edsc.c b/sys/net/if_edsc.c
index 85a8e8cca2d3..8de583713410 100644
--- a/sys/net/if_edsc.c
+++ b/sys/net/if_edsc.c
@@ -50,9 +50,9 @@
 #include <net/ethernet.h>      /* Ethernet related constants and types */
 #include <net/if.h>
 #include <net/if_var.h>                /* basic part of ifnet(9) */
+#include <net/if_private.h>
 #include <net/if_clone.h>      /* network interface cloning */
 #include <net/if_types.h>      /* IFT_ETHER and friends */
-#include <net/if_var.h>                /* kernel-only part of ifnet(9) */
 #include <net/vnet.h>
 
 static const char edscname[] = "edsc";
diff --git a/sys/net/if_enc.c b/sys/net/if_enc.c
index af1d16f11a18..da6ce7a1a815 100644
--- a/sys/net/if_enc.c
+++ b/sys/net/if_enc.c
@@ -50,6 +50,7 @@
 #include <net/if.h>
 #include <net/if_enc.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_clone.h>
 #include <net/if_types.h>
 #include <net/pfil.h>
diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index cbe75de52c0f..81538c0cb157 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_clone.h>
 #include <net/if_media.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/netisr.h>
 #ifdef RSS
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index a42e15dda97a..b3fc71006a35 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -60,6 +60,7 @@
 #include <net/ieee_oui.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_arp.h>
 #include <net/netisr.h>
 #include <net/route.h>
diff --git a/sys/net/if_fwsubr.c b/sys/net/if_fwsubr.c
index 321721737d36..5e5fc7a181e5 100644
--- a/sys/net/if_fwsubr.c
+++ b/sys/net/if_fwsubr.c
@@ -46,6 +46,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/netisr.h>
 #include <net/route.h>
 #include <net/if_llc.h>
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index ea4b80690e50..18160c21411e 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_clone.h>
 #include <net/if_types.h>
 #include <net/netisr.h>
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c
index 5ad452ac38e0..2349a359e12e 100644
--- a/sys/net/if_gre.c
+++ b/sys/net/if_gre.c
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 #include <net/ethernet.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_clone.h>
 #include <net/if_types.h>
 #include <net/netisr.h>
diff --git a/sys/net/if_infiniband.c b/sys/net/if_infiniband.c
index c673b7d30a79..e5830d977e80 100644
--- a/sys/net/if_infiniband.c
+++ b/sys/net/if_infiniband.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include <net/infiniband.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_dl.h>
 #include <net/if_media.h>
 #include <net/if_lagg.h>
diff --git a/sys/net/if_ipsec.c b/sys/net/if_ipsec.c
index a2f690b4cffb..2e0b956f5f99 100644
--- a/sys/net/if_ipsec.c
+++ b/sys/net/if_ipsec.c
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_clone.h>
 #include <net/if_types.h>
 #include <net/bpf.h>
diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c
index 58157e0dff3f..c649a2c3372e 100644
--- a/sys/net/if_lagg.c
+++ b/sys/net/if_lagg.c
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if_media.h>
 #include <net/if_types.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/bpf.h>
 #include <net/route.h>
 #include <net/vnet.h>
diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c
index 68a5ab931ec9..86bf9a0d47db 100644
--- a/sys/net/if_llatbl.c
+++ b/sys/net/if_llatbl.c
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 #include <net/if_dl.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/route/route_ctl.h>
 #include <net/route/route_debug.h>
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c
index f4d34c46f9f0..a483aea8860b 100644
--- a/sys/net/if_loop.c
+++ b/sys/net/if_loop.c
@@ -53,6 +53,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_clone.h>
 #include <net/if_types.h>
 #include <net/netisr.h>
diff --git a/sys/net/if_me.c b/sys/net/if_me.c
index 0f8336067116..2bbb6b15217d 100644
--- a/sys/net/if_me.c
+++ b/sys/net/if_me.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include <net/ethernet.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_clone.h>
 #include <net/if_types.h>
 #include <net/netisr.h>
diff --git a/sys/net/if_media.c b/sys/net/if_media.c
index 4100aaab9521..441c7258a473 100644
--- a/sys/net/if_media.c
+++ b/sys/net/if_media.c
@@ -75,6 +75,7 @@ static struct ifmedia_entry *ifmedia_match(struct ifmedia 
*ifm,
 
 #ifdef IFMEDIA_DEBUG
 #include <net/if_var.h>
+#include <net/if_private.h>
 int    ifmedia_debug = 0;
 SYSCTL_INT(_debug, OID_AUTO, ifmedia, CTLFLAG_RW, &ifmedia_debug,
            0, "if_media debugging msgs");
diff --git a/sys/net/if_mib.c b/sys/net/if_mib.c
index abf983a02c79..603ee72c10a4 100644
--- a/sys/net/if_mib.c
+++ b/sys/net/if_mib.c
@@ -38,6 +38,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_mib.h>
 #include <net/vnet.h>
 
diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c
index fa69e5277f75..169a17ec6083 100644
--- a/sys/net/if_ovpn.c
+++ b/sys/net/if_ovpn.c
@@ -57,6 +57,7 @@
 #include <net/if_clone.h>
 #include <net/if_types.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/netisr.h>
 #include <net/route/nhop.h>
 
diff --git a/sys/net/if_private.h b/sys/net/if_private.h
new file mode 100644
index 000000000000..70212e79d077
--- /dev/null
+++ b/sys/net/if_private.h
@@ -0,0 +1,198 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     From: @(#)if.h  8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef        _NET_IF_PRIVATE_H_
+#define        _NET_IF_PRIVATE_H_
+
+#ifdef _KERNEL
+/*
+ * Structure defining a network interface.
+ */
+struct ifnet {
+       /* General book keeping of interface lists. */
+       CK_STAILQ_ENTRY(ifnet) if_link;         /* all struct ifnets are 
chained (CK_) */
+       LIST_ENTRY(ifnet) if_clones;    /* interfaces of a cloner */
+       CK_STAILQ_HEAD(, ifg_list) if_groups; /* linked list of groups per if 
(CK_) */
+                                       /* protected by if_addr_lock */
+       u_char  if_alloctype;           /* if_type at time of allocation */
+       uint8_t if_numa_domain;         /* NUMA domain of device */
+       /* Driver and protocol specific information that remains stable. */
+       void    *if_softc;              /* pointer to driver state */
+       void    *if_llsoftc;            /* link layer softc */
+       void    *if_l2com;              /* pointer to protocol bits */
+       const char *if_dname;           /* driver name */
+       int     if_dunit;               /* unit or IF_DUNIT_NONE */
+       u_short if_index;               /* numeric abbreviation for this if  */
+       u_short if_idxgen;              /* ... and its generation count */
+       char    if_xname[IFNAMSIZ];     /* external name (name + unit) */
+       char    *if_description;        /* interface description */
+
+       /* Variable fields that are touched by the stack and drivers. */
+       int     if_flags;               /* up/down, broadcast, etc. */
+       int     if_drv_flags;           /* driver-managed status flags */
+       int     if_capabilities;        /* interface features & capabilities */
+       int     if_capabilities2;       /* part 2 */
+       int     if_capenable;           /* enabled features & capabilities */
+       int     if_capenable2;          /* part 2 */
+       void    *if_linkmib;            /* link-type-specific MIB data */
+       size_t  if_linkmiblen;          /* length of above data */
+       u_int   if_refcount;            /* reference count */
+
+       /* These fields are shared with struct if_data. */
+       uint8_t         if_type;        /* ethernet, tokenring, etc */
+       uint8_t         if_addrlen;     /* media address length */
+       uint8_t         if_hdrlen;      /* media header length */
+       uint8_t         if_link_state;  /* current link state */
+       uint32_t        if_mtu;         /* maximum transmission unit */
+       uint32_t        if_metric;      /* routing metric (external only) */
+       uint64_t        if_baudrate;    /* linespeed */
+       uint64_t        if_hwassist;    /* HW offload capabilities, see IFCAP */
+       time_t          if_epoch;       /* uptime at attach or stat reset */
+       struct timeval  if_lastchange;  /* time of last administrative change */
+
+       struct  ifaltq if_snd;          /* output queue (includes altq) */
+       struct  task if_linktask;       /* task for link change events */
+       struct  task if_addmultitask;   /* task for SIOCADDMULTI */
+
+       /* Addresses of different protocol families assigned to this if. */
+       struct mtx if_addr_lock;        /* lock to protect address lists */
+               /*
+                * if_addrhead is the list of all addresses associated to
+                * an interface.
+                * Some code in the kernel assumes that first element
+                * of the list has type AF_LINK, and contains sockaddr_dl
+                * addresses which store the link-level address and the name
+                * of the interface.
+                * However, access to the AF_LINK address through this
+                * field is deprecated. Use if_addr instead.
+                */
+       struct  ifaddrhead if_addrhead; /* linked list of addresses per if */
+       struct  ifmultihead if_multiaddrs; /* multicast addresses configured */
+       int     if_amcount;             /* number of all-multicast requests */
+       struct  ifaddr  *if_addr;       /* pointer to link-level address */
+       void    *if_hw_addr;            /* hardware link-level address */
+       const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */
+       struct  mtx if_afdata_lock;
+       void    *if_afdata[AF_MAX];
+       int     if_afdata_initialized;
+
+       /* Additional features hung off the interface. */
+       u_int   if_fib;                 /* interface FIB */
+       struct  vnet *if_vnet;          /* pointer to network stack instance */
+       struct  vnet *if_home_vnet;     /* where this ifnet originates from */
+       struct  ifvlantrunk *if_vlantrunk; /* pointer to 802.1q data */
+       struct  bpf_if *if_bpf;         /* packet filter structure */
+       int     if_pcount;              /* number of promiscuous listeners */
+       void    *if_bridge;             /* bridge glue */
+       void    *if_lagg;               /* lagg glue */
+       void    *if_pf_kif;             /* pf glue */
+       struct  carp_if *if_carp;       /* carp interface structure */
+       struct  label *if_label;        /* interface MAC label */
+       struct  netmap_adapter *if_netmap; /* netmap(4) softc */
+
+       /* Various procedures of the layer2 encapsulation and drivers. */
+       if_output_fn_t if_output;       /* output routine (enqueue) */
+       if_input_fn_t if_input;         /* input routine (from h/w driver) */
+       struct mbuf *(*if_bridge_input)(struct ifnet *, struct mbuf *);
+       int     (*if_bridge_output)(struct ifnet *, struct mbuf *, struct 
sockaddr *,
+                   struct rtentry *);
+       void (*if_bridge_linkstate)(struct ifnet *ifp);
+       if_start_fn_t   if_start;       /* initiate output routine */
+       if_ioctl_fn_t   if_ioctl;       /* ioctl routine */
+       if_init_fn_t    if_init;        /* Init routine */
+       int     (*if_resolvemulti)      /* validate/resolve multicast */
+               (struct ifnet *, struct sockaddr **, struct sockaddr *);
+       if_qflush_fn_t  if_qflush;      /* flush any queue */
+       if_transmit_fn_t if_transmit;   /* initiate output routine */
+
+       void    (*if_reassign)          /* reassign to vnet routine */
+               (struct ifnet *, struct vnet *, char *);
+       if_get_counter_t if_get_counter; /* get counter values */
+       int     (*if_requestencap)      /* make link header from request */
+               (struct ifnet *, struct if_encap_req *);
+
+       /* Statistics. */
+       counter_u64_t   if_counters[IFCOUNTERS];
+
+       /* Stuff that's only temporary and doesn't belong here. */
+
+       /*
+        * Network adapter TSO limits:
+        * ===========================
+        *
+        * If the "if_hw_tsomax" field is zero the maximum segment
+        * length limit does not apply. If the "if_hw_tsomaxsegcount"
+        * or the "if_hw_tsomaxsegsize" field is zero the TSO segment
+        * count limit does not apply. If all three fields are zero,
+        * there is no TSO limit.
+        *
+        * NOTE: The TSO limits should reflect the values used in the
+        * BUSDMA tag a network adapter is using to load a mbuf chain
+        * for transmission. The TCP/IP network stack will subtract
+        * space for all linklevel and protocol level headers and
+        * ensure that the full mbuf chain passed to the network
+        * adapter fits within the given limits.
+        */
+       u_int   if_hw_tsomax;           /* TSO maximum size in bytes */
+       u_int   if_hw_tsomaxsegcount;   /* TSO maximum segment count */
+       u_int   if_hw_tsomaxsegsize;    /* TSO maximum segment size in bytes */
+
+       /*
+        * Network adapter send tag support:
+        */
+       if_snd_tag_alloc_t *if_snd_tag_alloc;
+
+       /* Ratelimit (packet pacing) */
+       if_ratelimit_query_t *if_ratelimit_query;
+       if_ratelimit_setup_t *if_ratelimit_setup;
+
+       /* Ethernet PCP */
+       uint8_t if_pcp;
+
+       /*
+        * Debugnet (Netdump) hooks to be called while in db/panic.
+        */
+       struct debugnet_methods *if_debugnet_methods;
+       struct epoch_context    if_epoch_ctx;
+
+       /*
+        * Spare fields to be added before branching a stable branch, so
+        * that structure can be enhanced without changing the kernel
+        * binary interface.
+        */
+       int     if_ispare[4];           /* general use */
+};
+
+#endif /* _KERNEL */
+
+#endif /* _NET_IF_PRIVATE_H_ */
diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c
index 9a469a82c34c..afc7b446fca7 100644
--- a/sys/net/if_stf.c
+++ b/sys/net/if_stf.c
@@ -100,6 +100,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_clone.h>
 #include <net/route.h>
 #include <net/route/nhop.h>
diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c
index 8328f9f94442..7e4f47746e23 100644
--- a/sys/net/if_tuntap.c
+++ b/sys/net/if_tuntap.c
@@ -83,6 +83,7 @@
 #include <net/if_clone.h>
 #include <net/if_dl.h>
 #include <net/if_media.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/if_vlan_var.h>
 #include <net/netisr.h>
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index afb58578e96b..831c609b3e2c 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -316,165 +316,6 @@ struct if_ratelimit_query_results {
 typedef void (if_ratelimit_query_t)(struct ifnet *,
     struct if_ratelimit_query_results *);
 typedef int (if_ratelimit_setup_t)(struct ifnet *, uint64_t, uint32_t);
-
-/*
- * Structure defining a network interface.
- */
-struct ifnet {
-       /* General book keeping of interface lists. */
-       CK_STAILQ_ENTRY(ifnet) if_link;         /* all struct ifnets are 
chained (CK_) */
-       LIST_ENTRY(ifnet) if_clones;    /* interfaces of a cloner */
-       CK_STAILQ_HEAD(, ifg_list) if_groups; /* linked list of groups per if 
(CK_) */
-                                       /* protected by if_addr_lock */
-       u_char  if_alloctype;           /* if_type at time of allocation */
-       uint8_t if_numa_domain;         /* NUMA domain of device */
-       /* Driver and protocol specific information that remains stable. */
-       void    *if_softc;              /* pointer to driver state */
-       void    *if_llsoftc;            /* link layer softc */
-       void    *if_l2com;              /* pointer to protocol bits */
-       const char *if_dname;           /* driver name */
-       int     if_dunit;               /* unit or IF_DUNIT_NONE */
-       u_short if_index;               /* numeric abbreviation for this if  */
-       u_short if_idxgen;              /* ... and its generation count */
-       char    if_xname[IFNAMSIZ];     /* external name (name + unit) */
-       char    *if_description;        /* interface description */
-
-       /* Variable fields that are touched by the stack and drivers. */
-       int     if_flags;               /* up/down, broadcast, etc. */
-       int     if_drv_flags;           /* driver-managed status flags */
-       int     if_capabilities;        /* interface features & capabilities */
-       int     if_capabilities2;       /* part 2 */
-       int     if_capenable;           /* enabled features & capabilities */
-       int     if_capenable2;          /* part 2 */
-       void    *if_linkmib;            /* link-type-specific MIB data */
-       size_t  if_linkmiblen;          /* length of above data */
-       u_int   if_refcount;            /* reference count */
-
-       /* These fields are shared with struct if_data. */
-       uint8_t         if_type;        /* ethernet, tokenring, etc */
-       uint8_t         if_addrlen;     /* media address length */
-       uint8_t         if_hdrlen;      /* media header length */
-       uint8_t         if_link_state;  /* current link state */
-       uint32_t        if_mtu;         /* maximum transmission unit */
-       uint32_t        if_metric;      /* routing metric (external only) */
-       uint64_t        if_baudrate;    /* linespeed */
-       uint64_t        if_hwassist;    /* HW offload capabilities, see IFCAP */
-       time_t          if_epoch;       /* uptime at attach or stat reset */
-       struct timeval  if_lastchange;  /* time of last administrative change */
-
-       struct  ifaltq if_snd;          /* output queue (includes altq) */
-       struct  task if_linktask;       /* task for link change events */
-       struct  task if_addmultitask;   /* task for SIOCADDMULTI */
-
-       /* Addresses of different protocol families assigned to this if. */
-       struct mtx if_addr_lock;        /* lock to protect address lists */
-               /*
-                * if_addrhead is the list of all addresses associated to
-                * an interface.
-                * Some code in the kernel assumes that first element
-                * of the list has type AF_LINK, and contains sockaddr_dl
-                * addresses which store the link-level address and the name
-                * of the interface.
-                * However, access to the AF_LINK address through this
-                * field is deprecated. Use if_addr instead.
-                */
-       struct  ifaddrhead if_addrhead; /* linked list of addresses per if */
-       struct  ifmultihead if_multiaddrs; /* multicast addresses configured */
-       int     if_amcount;             /* number of all-multicast requests */
-       struct  ifaddr  *if_addr;       /* pointer to link-level address */
-       void    *if_hw_addr;            /* hardware link-level address */
-       const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */
-       struct  mtx if_afdata_lock;
-       void    *if_afdata[AF_MAX];
-       int     if_afdata_initialized;
-
-       /* Additional features hung off the interface. */
-       u_int   if_fib;                 /* interface FIB */
-       struct  vnet *if_vnet;          /* pointer to network stack instance */
-       struct  vnet *if_home_vnet;     /* where this ifnet originates from */
-       struct  ifvlantrunk *if_vlantrunk; /* pointer to 802.1q data */
-       struct  bpf_if *if_bpf;         /* packet filter structure */
-       int     if_pcount;              /* number of promiscuous listeners */
-       void    *if_bridge;             /* bridge glue */
-       void    *if_lagg;               /* lagg glue */
-       void    *if_pf_kif;             /* pf glue */
-       struct  carp_if *if_carp;       /* carp interface structure */
-       struct  label *if_label;        /* interface MAC label */
-       struct  netmap_adapter *if_netmap; /* netmap(4) softc */
-
-       /* Various procedures of the layer2 encapsulation and drivers. */
-       if_output_fn_t if_output;       /* output routine (enqueue) */
-       if_input_fn_t if_input;         /* input routine (from h/w driver) */
-       struct mbuf *(*if_bridge_input)(struct ifnet *, struct mbuf *);
-       int     (*if_bridge_output)(struct ifnet *, struct mbuf *, struct 
sockaddr *,
-                   struct rtentry *);
-       void (*if_bridge_linkstate)(struct ifnet *ifp);
-       if_start_fn_t   if_start;       /* initiate output routine */
-       if_ioctl_fn_t   if_ioctl;       /* ioctl routine */
-       if_init_fn_t    if_init;        /* Init routine */
-       int     (*if_resolvemulti)      /* validate/resolve multicast */
-               (struct ifnet *, struct sockaddr **, struct sockaddr *);
-       if_qflush_fn_t  if_qflush;      /* flush any queue */
-       if_transmit_fn_t if_transmit;   /* initiate output routine */
-
-       void    (*if_reassign)          /* reassign to vnet routine */
-               (struct ifnet *, struct vnet *, char *);
-       if_get_counter_t if_get_counter; /* get counter values */
-       int     (*if_requestencap)      /* make link header from request */
-               (struct ifnet *, struct if_encap_req *);
-
-       /* Statistics. */
-       counter_u64_t   if_counters[IFCOUNTERS];
-
-       /* Stuff that's only temporary and doesn't belong here. */
-
-       /*
-        * Network adapter TSO limits:
-        * ===========================
-        *
-        * If the "if_hw_tsomax" field is zero the maximum segment
-        * length limit does not apply. If the "if_hw_tsomaxsegcount"
-        * or the "if_hw_tsomaxsegsize" field is zero the TSO segment
-        * count limit does not apply. If all three fields are zero,
-        * there is no TSO limit.
-        *
-        * NOTE: The TSO limits should reflect the values used in the
-        * BUSDMA tag a network adapter is using to load a mbuf chain
-        * for transmission. The TCP/IP network stack will subtract
-        * space for all linklevel and protocol level headers and
-        * ensure that the full mbuf chain passed to the network
-        * adapter fits within the given limits.
-        */
-       u_int   if_hw_tsomax;           /* TSO maximum size in bytes */
-       u_int   if_hw_tsomaxsegcount;   /* TSO maximum segment count */
-       u_int   if_hw_tsomaxsegsize;    /* TSO maximum segment size in bytes */
-
-       /*
-        * Network adapter send tag support:
-        */
-       if_snd_tag_alloc_t *if_snd_tag_alloc;
-
-       /* Ratelimit (packet pacing) */
-       if_ratelimit_query_t *if_ratelimit_query;
-       if_ratelimit_setup_t *if_ratelimit_setup;
-
-       /* Ethernet PCP */
-       uint8_t if_pcp;
-
-       /*
-        * Debugnet (Netdump) hooks to be called while in db/panic.
-        */
-       struct debugnet_methods *if_debugnet_methods;
-       struct epoch_context    if_epoch_ctx;
-
-       /*
-        * Spare fields to be added before branching a stable branch, so
-        * that structure can be enhanced without changing the kernel
-        * binary interface.
-        */
-       int     if_ispare[4];           /* general use */
-};
-
 #define        IF_NODOM        255
 /*
  * Locks for address lists on the network interface.
@@ -834,6 +675,7 @@ int    ether_poll_deregister(if_t ifp);
 
 #endif /* _KERNEL */
 
+#include <net/if_private.h>    /* XXX: temporary until drivers converted. */
 #include <net/ifq.h>   /* XXXAO: temporary unconditional include */
 
 #endif /* !_NET_IF_VAR_H_ */
diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c
index 6a2d1bfb3fd1..d908d97b6e6d 100644
--- a/sys/net/if_vlan.c
+++ b/sys/net/if_vlan.c
@@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
 #include <net/ethernet.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_clone.h>
 #include <net/if_dl.h>
 #include <net/if_types.h>
diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c
index 27ad2ec08335..45a24f2b75eb 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include <net/ethernet.h>
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_clone.h>
 #include <net/if_dl.h>
 #include <net/if_media.h>
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 3b743caa34e0..5f202b120005 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/if_media.h>
 #include <net/bpf.h>
diff --git a/sys/net/iflib_clone.c b/sys/net/iflib_clone.c
index 89d37a586f8d..32ec0119d33b 100644
--- a/sys/net/iflib_clone.c
+++ b/sys/net/iflib_clone.c
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_types.h>
 #include <net/if_media.h>
 #include <net/if_clone.h>
diff --git a/sys/net/netisr.c b/sys/net/netisr.c
index 9898e0b18caf..e5ec57a7263d 100644
--- a/sys/net/netisr.c
+++ b/sys/net/netisr.c
@@ -93,6 +93,7 @@ __FBSDID("$FreeBSD$");
 #define        _WANT_NETISR_INTERNAL   /* Enable definitions from 
netisr_internal.h */
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/netisr.h>
 #include <net/netisr_internal.h>
 #include <net/vnet.h>
diff --git a/sys/net/route.c b/sys/net/route.c
index 0d6227a515f7..1373b0986876 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -59,6 +59,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_dl.h>
 #include <net/route.h>
 #include <net/route/route_ctl.h>
diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c
index b829b1125597..1aba9d6bea28 100644
--- a/sys/net/route/nhgrp_ctl.c
+++ b/sys/net/route/nhgrp_ctl.c
@@ -44,6 +44,7 @@
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/route.h>
 #include <net/route/route_ctl.h>
 #include <net/route/route_var.h>
diff --git a/sys/net/route/nhop_ctl.c b/sys/net/route/nhop_ctl.c
index d042d9519f6b..15d4ec394187 100644
--- a/sys/net/route/nhop_ctl.c
+++ b/sys/net/route/nhop_ctl.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_dl.h>
 #include <net/route.h>
 #include <net/route/route_ctl.h>
diff --git a/sys/net/route/route_ctl.c b/sys/net/route/route_ctl.c
index eaabe901b3cb..fd374b468b7c 100644
--- a/sys/net/route/route_ctl.c
+++ b/sys/net/route/route_ctl.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 
 #include <net/if.h>
 #include <net/if_var.h>
+#include <net/if_private.h>
 #include <net/if_dl.h>
 #include <net/vnet.h>
 #include <net/route.h>
diff --git a/sys/net/route/route_ddb.c b/sys/net/route/route_ddb.c
*** 47 LINES SKIPPED ***

Reply via email to