git: 1e01c7ed6281 - stable/13 - netmap: get rid of save_if_input for emulated adapters
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 28 Mar 2023 21:58:40 UTC
The branch stable/13 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=1e01c7ed628161e1eb46dfb97b3a8c74dbb7e8db commit 1e01c7ed628161e1eb46dfb97b3a8c74dbb7e8db Author: Vincenzo Maffione <vmaffione@FreeBSD.org> AuthorDate: 2023-03-14 21:59:23 +0000 Commit: Vincenzo Maffione <vmaffione@FreeBSD.org> CommitDate: 2023-03-28 21:58:26 +0000 netmap: get rid of save_if_input for emulated adapters The save_if_input function pointer was meant to save the previous value of ifp->if_input before replacing it with the emulated adapter hook. However, the same pointer value is already stored in the if_input field of the netmap_adapter struct, to be used for host TX ring processing. Reuse the netmap_adapter if_input field to simplify the code and save some space. MFC after: 14 days (cherry picked from commit 6c9fe357435db6408ec6b01221b9ff9e7e9b0ff1) --- sys/dev/netmap/netmap_freebsd.c | 20 ++------------------ sys/dev/netmap/netmap_kern.h | 3 --- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c index b9055d589df1..19708406dc93 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -327,9 +327,7 @@ freebsd_generic_rx_handler(struct ifnet *ifp, struct mbuf *m) stolen = generic_rx_handler(ifp, m); if (!stolen) { - struct netmap_generic_adapter *gna = - (struct netmap_generic_adapter *)NA(ifp); - gna->save_if_input(ifp, m); + NA(ifp)->if_input(ifp, m); } } @@ -346,24 +344,10 @@ nm_os_catch_rx(struct netmap_generic_adapter *gna, int intercept) nm_os_ifnet_lock(); if (intercept) { - if (gna->save_if_input) { - nm_prerr("RX on %s already intercepted", na->name); - ret = EBUSY; /* already set */ - goto out; - } - gna->save_if_input = ifp->if_input; ifp->if_input = freebsd_generic_rx_handler; } else { - if (!gna->save_if_input) { - nm_prerr("Failed to undo RX intercept on %s", - na->name); - ret = EINVAL; /* not saved */ - goto out; - } - ifp->if_input = gna->save_if_input; - gna->save_if_input = NULL; + ifp->if_input = na->if_input; } -out: nm_os_ifnet_unlock(); return ret; diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index 195b5de7a502..237b2b39047a 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -987,11 +987,8 @@ struct netmap_generic_adapter { /* emulated device */ struct netmap_adapter *prev; /* Emulated netmap adapters support: - * - save_if_input saves the if_input hook (FreeBSD); * - mit implements rx interrupt mitigation; */ - void (*save_if_input)(struct ifnet *, struct mbuf *); - struct nm_generic_mit *mit; #ifdef linux netdev_tx_t (*save_start_xmit)(struct mbuf *, struct ifnet *);