mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-13 10:02:38 +00:00
if_lagg: Allow lagg interfaces to be used with netmap
Reviewed by: zlei Sponsored by: Zenarmor Sponsored by: OPNsense Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D37436
This commit is contained in:
parent
8bce8d28ab
commit
110ce09c90
@ -351,6 +351,8 @@ nm_os_catch_rx(struct netmap_generic_adapter *gna, int intercept)
|
||||
ret = EBUSY; /* already set */
|
||||
goto out;
|
||||
}
|
||||
|
||||
ifp->if_capenable |= IFCAP_NETMAP;
|
||||
gna->save_if_input = ifp->if_input;
|
||||
ifp->if_input = freebsd_generic_rx_handler;
|
||||
} else {
|
||||
@ -360,6 +362,8 @@ nm_os_catch_rx(struct netmap_generic_adapter *gna, int intercept)
|
||||
ret = EINVAL; /* not saved */
|
||||
goto out;
|
||||
}
|
||||
|
||||
ifp->if_capenable &= ~IFCAP_NETMAP;
|
||||
ifp->if_input = gna->save_if_input;
|
||||
gna->save_if_input = NULL;
|
||||
}
|
||||
|
@ -84,6 +84,10 @@ __FBSDID("$FreeBSD$");
|
||||
extern void nd6_setmtu(struct ifnet *);
|
||||
#endif
|
||||
|
||||
#ifdef DEV_NETMAP
|
||||
MODULE_DEPEND(if_lagg, netmap, 1, 1, 1);
|
||||
#endif
|
||||
|
||||
#define LAGG_SX_INIT(_sc) sx_init(&(_sc)->sc_sx, "if_lagg sx")
|
||||
#define LAGG_SX_DESTROY(_sc) sx_destroy(&(_sc)->sc_sx)
|
||||
#define LAGG_XLOCK(_sc) sx_xlock(&(_sc)->sc_sx)
|
||||
@ -2201,6 +2205,13 @@ lagg_input_ethernet(struct ifnet *ifp, struct mbuf *m)
|
||||
m = NULL;
|
||||
}
|
||||
|
||||
#ifdef DEV_NETMAP
|
||||
if (m != NULL && scifp->if_capenable & IFCAP_NETMAP) {
|
||||
scifp->if_input(scifp, m);
|
||||
m = NULL;
|
||||
}
|
||||
#endif /* DEV_NETMAP */
|
||||
|
||||
NET_EPOCH_EXIT(et);
|
||||
return (m);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user