Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Oct 2019 19:00:27 +0000 (UTC)
From:      Vincenzo Maffione <vmaffione@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354137 - head/sys/dev/netmap
Message-ID:  <201910281900.x9SJ0ROC013394@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <aleksandr.fedorov@itglobal.com>

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
 	}
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910281900.x9SJ0ROC013394>