git: 110ce09c90dc - main - if_lagg: Allow lagg interfaces to be used with netmap
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Jan 2023 15:33:11 UTC
The branch main has been updated by thj: URL: https://cgit.FreeBSD.org/src/commit/?id=110ce09c90dc452fa5669874535e1f3984e166f9 commit 110ce09c90dc452fa5669874535e1f3984e166f9 Author: Tom Jones <thj@FreeBSD.org> AuthorDate: 2023-01-13 15:26:55 +0000 Commit: Tom Jones <thj@FreeBSD.org> CommitDate: 2023-01-13 15:31:58 +0000 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 --- sys/dev/netmap/netmap_freebsd.c | 4 ++++ sys/net/if_lagg.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c index 7a3f2ceacdbb..0f7372e959bb 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -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; } diff --git a/sys/net/if_lagg.c b/sys/net/if_lagg.c index 7c5e0127d7ff..58157e0dff3f 100644 --- a/sys/net/if_lagg.c +++ b/sys/net/if_lagg.c @@ -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); }