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.
This commit is contained in:
parent
b6e1ad3a3a
commit
833e8dc5ab
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=274231
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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. */
|
||||
|
@ -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>
|
||||
|
@ -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 @@ ether_demux(struct ifnet *ifp, struct mbuf *m)
|
||||
* 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
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user