aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2014-11-07 15:14:10 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2014-11-07 15:14:10 +0000
commit833e8dc5ab711a9485790d950801e32798d55558 (patch)
tree8477b249e14f24c5617bf5ae2aa9e42c46dac3f6 /sys
parentb6e1ad3a3a2f414cc4a67ffcdb92c47e444cdc9f (diff)
downloadsrc-833e8dc5ab711a9485790d950801e32798d55558.tar.gz
src-833e8dc5ab711a9485790d950801e32798d55558.zip
Remove struct arpcom. It is unused by most interface types, that allocate
it, except Ethernet, where it carried ng_ether(4) pointer. For now carry the pointer in if_l2com directly. Sponsored by: Netflix Sponsored by: Nginx, Inc.
Notes
Notes: svn path=/head/; revision=274231
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/hyperv/netvsc/hv_net_vsc.c2
-rw-r--r--sys/dev/hyperv/netvsc/hv_net_vsc.h1
-rw-r--r--sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c4
-rw-r--r--sys/net/if.c2
-rw-r--r--sys/net/if_arp.h14
-rw-r--r--sys/net/if_bridge.c4
-rw-r--r--sys/net/if_ethersubr.c53
-rw-r--r--sys/net/if_fddisubr.c1
-rw-r--r--sys/net/if_iso88025subr.c44
-rw-r--r--sys/netgraph/ng_ether.c2
10 files changed, 13 insertions, 114 deletions
diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.c b/sys/dev/hyperv/netvsc/hv_net_vsc.c
index e96c9675c90b..4e47d838ad2f 100644
--- a/sys/dev/hyperv/netvsc/hv_net_vsc.c
+++ b/sys/dev/hyperv/netvsc/hv_net_vsc.c
@@ -529,7 +529,7 @@ hv_nv_connect_to_vsp(struct hv_device *device)
int ret = 0;
device_t dev = device->device;
hn_softc_t *sc = device_get_softc(dev);
- struct ifnet *ifp = sc->arpcom.ac_ifp;
+ struct ifnet *ifp = sc->hn_ifp;
net_dev = hv_nv_get_outbound_net_device(device);
if (!net_dev) {
diff --git a/sys/dev/hyperv/netvsc/hv_net_vsc.h b/sys/dev/hyperv/netvsc/hv_net_vsc.h
index b9f3a1ee9cb5..bb4c42ca3852 100644
--- a/sys/dev/hyperv/netvsc/hv_net_vsc.h
+++ b/sys/dev/hyperv/netvsc/hv_net_vsc.h
@@ -965,7 +965,6 @@ typedef struct {
*/
typedef struct hn_softc {
struct ifnet *hn_ifp;
- struct arpcom arpcom;
device_t hn_dev;
uint8_t hn_unit;
int hn_carrier;
diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
index b08a1bd720d6..5f45e66bd1ce 100644
--- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
+++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
@@ -255,7 +255,7 @@ netvsc_attach(device_t dev)
sc->hn_dev_obj = device_ctx;
- ifp = sc->hn_ifp = sc->arpcom.ac_ifp = if_alloc(IFT_ETHER);
+ ifp = sc->hn_ifp = if_alloc(IFT_ETHER);
ifp->if_softc = sc;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
@@ -634,8 +634,6 @@ netvsc_recv(struct hv_device *device_ctx, netvsc_packet *packet)
}
ifp = sc->hn_ifp;
-
- ifp = sc->arpcom.ac_ifp;
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
return (0);
diff --git a/sys/net/if.c b/sys/net/if.c
index 980fab1c6772..5b606ebecd9d 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2136,7 +2136,7 @@ do_link_state_change(void *arg, int pending)
(*vlan_link_state_p)(ifp);
if ((ifp->if_type == IFT_ETHER || ifp->if_type == IFT_L2VLAN) &&
- IFP2AC(ifp)->ac_netgraph != NULL)
+ ifp->if_l2com != NULL)
(*ng_ether_link_state_p)(ifp, link_state);
if (ifp->if_carp)
(*carp_linkstate_p)(ifp);
diff --git a/sys/net/if_arp.h b/sys/net/if_arp.h
index 2dd8c32d06c9..7d141f377163 100644
--- a/sys/net/if_arp.h
+++ b/sys/net/if_arp.h
@@ -97,20 +97,6 @@ struct arpreq {
#define ATF_PUBL 0x08 /* publish entry (respond for other host) */
#define ATF_USETRAILERS 0x10 /* has requested trailers */
-#ifdef _KERNEL
-/*
- * Structure shared between the ethernet driver modules and
- * the address resolution code.
- */
-struct arpcom {
- struct ifnet *ac_ifp; /* network-visible interface */
- void *ac_netgraph; /* ng_ether(4) netgraph node info */
-};
-#define IFP2AC(ifp) ((struct arpcom *)(ifp->if_l2com))
-#define AC2IFP(ac) ((ac)->ac_ifp)
-
-#endif /* _KERNEL */
-
struct arpstat {
/* Normal things that happen: */
uint64_t txrequests; /* # of ARP requests sent by this host. */
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 96adb067c2e2..019bbf5ebae5 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -111,7 +111,7 @@ __FBSDID("$FreeBSD$");
#include <net/pfil.h>
#include <net/vnet.h>
-#include <netinet/in.h> /* for struct arpcom */
+#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
#include <netinet/ip.h>
@@ -125,7 +125,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/ip_carp.h>
#endif
#include <machine/in_cksum.h>
-#include <netinet/if_ether.h> /* for struct arpcom */
+#include <netinet/if_ether.h>
#include <net/bridgestp.h>
#include <net/if_bridgevar.h>
#include <net/if_llc.h>
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 87e71b6fd78a..36f952907463 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -119,9 +119,6 @@ static int ether_resolvemulti(struct ifnet *, struct sockaddr **,
static void ether_reassign(struct ifnet *, struct vnet *, char *);
#endif
-/* XXX: should be in an arp support file, not here */
-static MALLOC_DEFINE(M_ARPCOM, "arpcom", "802.* interface internals");
-
#define ETHER_IS_BROADCAST(addr) \
(bcmp(etherbroadcastaddr, (addr), ETHER_ADDR_LEN) == 0)
@@ -330,7 +327,7 @@ ether_output(struct ifnet *ifp, struct mbuf *m,
#endif
/* Handle ng_ether(4) processing, if any */
- if (IFP2AC(ifp)->ac_netgraph != NULL) {
+ if (ifp->if_l2com != NULL) {
KASSERT(ng_ether_output_p != NULL,
("ng_ether_output_p is NULL"));
if ((error = (*ng_ether_output_p)(ifp, &m)) != 0) {
@@ -521,7 +518,7 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m)
M_SETFIB(m, ifp->if_fib);
/* Allow ng_ether(4) to claim this frame. */
- if (IFP2AC(ifp)->ac_netgraph != NULL) {
+ if (ifp->if_l2com != NULL) {
KASSERT(ng_ether_input_p != NULL,
("%s: ng_ether_input_p is NULL", __func__));
m->m_flags &= ~M_PROMISC;
@@ -780,7 +777,7 @@ discard:
* hand the packet to it for last chance processing;
* otherwise dispose of it.
*/
- if (IFP2AC(ifp)->ac_netgraph != NULL) {
+ if (ifp->if_l2com != NULL) {
KASSERT(ng_ether_input_orphan_p != NULL,
("ng_ether_input_orphan_p is NULL"));
/*
@@ -866,7 +863,7 @@ ether_ifdetach(struct ifnet *ifp)
sdl = (struct sockaddr_dl *)(ifp->if_addr->ifa_addr);
uuid_ether_del(LLADDR(sdl));
- if (IFP2AC(ifp)->ac_netgraph != NULL) {
+ if (ifp->if_l2com != NULL) {
KASSERT(ng_ether_detach_p != NULL,
("ng_ether_detach_p is NULL"));
(*ng_ether_detach_p)(ifp);
@@ -881,7 +878,7 @@ void
ether_reassign(struct ifnet *ifp, struct vnet *new_vnet, char *unused __unused)
{
- if (IFP2AC(ifp)->ac_netgraph != NULL) {
+ if (ifp->if_l2com != NULL) {
KASSERT(ng_ether_detach_p != NULL,
("ng_ether_detach_p is NULL"));
(*ng_ether_detach_p)(ifp);
@@ -1092,46 +1089,8 @@ ether_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
}
}
-static void*
-ether_alloc(u_char type, struct ifnet *ifp)
-{
- struct arpcom *ac;
-
- ac = malloc(sizeof(struct arpcom), M_ARPCOM, M_WAITOK | M_ZERO);
- ac->ac_ifp = ifp;
-
- return (ac);
-}
-
-static void
-ether_free(void *com, u_char type)
-{
-
- free(com, M_ARPCOM);
-}
-
-static int
-ether_modevent(module_t mod, int type, void *data)
-{
-
- switch (type) {
- case MOD_LOAD:
- if_register_com_alloc(IFT_ETHER, ether_alloc, ether_free);
- break;
- case MOD_UNLOAD:
- if_deregister_com_alloc(IFT_ETHER);
- break;
- default:
- return EOPNOTSUPP;
- }
-
- return (0);
-}
-
static moduledata_t ether_mod = {
- "ether",
- ether_modevent,
- 0
+ .name = "ether",
};
void
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index 4056396b6a68..da54ebf69fdf 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -92,7 +92,6 @@ static void fddi_input(struct ifnet *ifp, struct mbuf *m);
* Encapsulate a packet of type family for the local net.
* Use trailer local net encapsulation if enough data in first
* packet leaves a multiple of 512 bytes of data in remainder.
- * Assumes that ifp is actually pointer to arpcom structure.
*/
static int
fddi_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c
index b03b70d79797..8e55e8b87697 100644
--- a/sys/net/if_iso88025subr.c
+++ b/sys/net/if_iso88025subr.c
@@ -562,7 +562,6 @@ iso88025_input(ifp, m)
case LLC_TEST_P:
{
struct sockaddr sa;
- struct arpcom *ac;
struct iso88025_sockaddr_data *th2;
int i;
u_char c;
@@ -695,49 +694,8 @@ iso88025_resolvemulti (ifp, llsa, sa)
return (0);
}
-static MALLOC_DEFINE(M_ISO88025, "arpcom", "802.5 interface internals");
-
-static void*
-iso88025_alloc(u_char type, struct ifnet *ifp)
-{
- struct arpcom *ac;
-
- ac = malloc(sizeof(struct arpcom), M_ISO88025, M_WAITOK | M_ZERO);
- ac->ac_ifp = ifp;
-
- return (ac);
-}
-
-static void
-iso88025_free(void *com, u_char type)
-{
-
- free(com, M_ISO88025);
-}
-
-static int
-iso88025_modevent(module_t mod, int type, void *data)
-{
-
- switch (type) {
- case MOD_LOAD:
- if_register_com_alloc(IFT_ISO88025, iso88025_alloc,
- iso88025_free);
- break;
- case MOD_UNLOAD:
- if_deregister_com_alloc(IFT_ISO88025);
- break;
- default:
- return EOPNOTSUPP;
- }
-
- return (0);
-}
-
static moduledata_t iso88025_mod = {
- "iso88025",
- iso88025_modevent,
- 0
+ .name = "iso88025",
};
DECLARE_MODULE(iso88025, iso88025_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
diff --git a/sys/netgraph/ng_ether.c b/sys/netgraph/ng_ether.c
index 55f491a597d1..fcde08c07092 100644
--- a/sys/netgraph/ng_ether.c
+++ b/sys/netgraph/ng_ether.c
@@ -74,7 +74,7 @@
MODULE_VERSION(ng_ether, 1);
-#define IFP2NG(ifp) (IFP2AC((ifp))->ac_netgraph)
+#define IFP2NG(ifp) ((ifp)->if_l2com)
/* Per-node private data */
struct private {