summaryrefslogtreecommitdiffstats
path: root/sys/netinet/if_ether.c
diff options
context:
space:
mode:
authorzec <zec@FreeBSD.org>2009-04-06 22:29:41 +0000
committerzec <zec@FreeBSD.org>2009-04-06 22:29:41 +0000
commitc85551e0bc714ce0e1634c2d308b1616c8dd88ca (patch)
tree1b479c98f577a974d301743e3161bc32e49c0e64 /sys/netinet/if_ether.c
parentf28ea657e983e90686b8309747fd1c6ad718135c (diff)
downloadFreeBSD-src-c85551e0bc714ce0e1634c2d308b1616c8dd88ca.zip
FreeBSD-src-c85551e0bc714ce0e1634c2d308b1616c8dd88ca.tar.gz
First pass at separating per-vnet initializer functions
from existing functions for initializing global state. At this stage, the new per-vnet initializer functions are directly called from the existing global initialization code, which should in most cases result in compiler inlining those new functions, hence yielding a near-zero functional change. Modify the existing initializer functions which are invoked via protosw, like ip_init() et. al., to allow them to be invoked multiple times, i.e. per each vnet. Global state, if any, is initialized only if such functions are called within the context of vnet0, which will be determined via the IS_DEFAULT_VNET(curvnet) check (currently always true). While here, V_irtualize a few remaining global UMA zones used by net/netinet/netipsec networking code. While it is not yet clear to me or anybody else whether this is the right thing to do, at this stage this makes the code more readable, and makes it easier to track uncollected UMA-zone-backed objects on vnet removal. In the long run, it's quite possible that some form of shared use of UMA zone pools among multiple vnets should be considered. Bump __FreeBSD_version due to changes in layout of structs vnet_ipfw, vnet_inet and vnet_net. Approved by: julian (mentor)
Diffstat (limited to 'sys/netinet/if_ether.c')
-rw-r--r--sys/netinet/if_ether.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index a918415..3a44f5c 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -111,6 +111,7 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_link_ether_inet, OID_AUTO, proxyall,
"Enable proxy ARP for all suitable requests");
static void arp_init(void);
+static int arp_iattach(const void *);
void arprequest(struct ifnet *,
struct in_addr *, struct in_addr *, u_char *);
static void arpintr(struct mbuf *);
@@ -790,8 +791,8 @@ arp_ifinit2(struct ifnet *ifp, struct ifaddr *ifa, u_char *enaddr)
ifa->ifa_rtrequest = NULL;
}
-static void
-arp_init(void)
+static int
+arp_iattach(const void *unused __unused)
{
INIT_VNET_INET(curvnet);
@@ -800,6 +801,15 @@ arp_init(void)
V_useloopback = 1; /* use loopback interface for local traffic */
V_arp_proxyall = 0;
+ return (0);
+}
+
+static void
+arp_init(void)
+{
+
+ arp_iattach(NULL);
+
arpintrq.ifq_maxlen = 50;
mtx_init(&arpintrq.ifq_mtx, "arp_inq", NULL, MTX_DEF);
netisr_register(NETISR_ARP, arpintr, &arpintrq, 0);
OpenPOWER on IntegriCloud