MCPcopy Create free account
hub / github.com/F-Stack/f-stack / iflib_netmap_register

Function iflib_netmap_register

freebsd/net/iflib.c:796–830  ·  view source on GitHub ↗

* Register/unregister. We are already under netmap lock. * Only called on the first register or the last unregister. */

Source from the content-addressed store, hash-verified

794 * Only called on the first register or the last unregister.
795 */
796static int
797iflib_netmap_register(struct netmap_adapter *na, int onoff)
798{
799 if_t ifp = na->ifp;
800 if_ctx_t ctx = ifp->if_softc;
801 int status;
802
803 CTX_LOCK(ctx);
804 if (!CTX_IS_VF(ctx))
805 IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip);
806
807 iflib_stop(ctx);
808
809 /*
810 * Enable (or disable) netmap flags, and intercept (or restore)
811 * ifp->if_transmit. This is done once the device has been stopped
812 * to prevent race conditions. Also, this must be done after
813 * calling netmap_disable_all_rings() and before calling
814 * netmap_enable_all_rings(), so that these two functions see the
815 * updated state of the NAF_NETMAP_ON bit.
816 */
817 if (onoff) {
818 nm_set_native_flags(na);
819 } else {
820 nm_clear_native_flags(na);
821 }
822
823 iflib_init_locked(ctx);
824 IFDI_CRCSTRIP_SET(ctx, onoff, iflib_crcstrip); // XXX why twice ?
825 status = ifp->if_drv_flags & IFF_DRV_RUNNING ? 0 : 1;
826 if (status)
827 nm_clear_native_flags(na);
828 CTX_UNLOCK(ctx);
829 return (status);
830}
831
832static int
833netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init)

Callers

nothing calls this directly

Calls 2

iflib_stopFunction · 0.85
iflib_init_lockedFunction · 0.85

Tested by

no test coverage detected