Author: vmaffione
Date: Mon Oct 28 19:00:27 2019
New Revision: 354137
URL: https://svnweb.freebsd.org/changeset/base/354137

Log:
  netmap: enter NET_EPOCH on generic txsync
  
  After r353292, netmap generic adapter on if_vlan interfaces panics on
  asserting the NET_EPOCH. In more detail, this happens when
  nm_os_generic_xmit_frame() is called, that is in the generic txsync
  routine.
  Fix the issue by entering the NET_EPOCH during the generic txsync.
  We amortize the cost of entering/exiting over a whole batch of
  transmissions.
  
  PR:           241489
  Reported by:  Aleksandr Fedorov <[email protected]>

Modified:
  head/sys/dev/netmap/netmap_generic.c

Modified: head/sys/dev/netmap/netmap_generic.c
==============================================================================
--- head/sys/dev/netmap/netmap_generic.c        Mon Oct 28 18:37:32 2019        
(r354136)
+++ head/sys/dev/netmap/netmap_generic.c        Mon Oct 28 19:00:27 2019        
(r354137)
@@ -669,7 +669,12 @@ generic_netmap_txsync(struct netmap_kring *kring, int 
        if (nm_i != head) {     /* we have new packets to send */
                struct nm_os_gen_arg a;
                u_int event = -1;
+#ifdef __FreeBSD__
+               struct epoch_tracker et;
 
+               NET_EPOCH_ENTER(et);
+#endif
+
                if (gna->txqdisc && nm_kr_txempty(kring)) {
                        /* In txqdisc mode, we ask for a delayed notification,
                         * but only when cur == hwtail, which means that the
@@ -776,6 +781,10 @@ generic_netmap_txsync(struct netmap_kring *kring, int 
                /* Update hwcur to the next slot to transmit. Here nm_i
                 * is not necessarily head, we could break early. */
                kring->nr_hwcur = nm_i;
+
+#ifdef __FreeBSD__
+               NET_EPOCH_EXIT(et);
+#endif
        }
 
        /*
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to