mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
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 6c9fe35743)
This commit is contained in:
parent
cc92d78fa5
commit
04e19283fe
2 changed files with 2 additions and 23 deletions
|
|
@ -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,28 +344,12 @@ 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;
|
||||
}
|
||||
|
||||
ifp->if_capenable |= IFCAP_NETMAP;
|
||||
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_capenable &= ~IFCAP_NETMAP;
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -990,11 +990,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 *);
|
||||
|
|
|
|||
Loading…
Reference in a new issue