svn commit: r362556 - stable/12/sys/net

Vincenzo Maffione vmaffione at FreeBSD.org
Tue Jun 23 20:48:44 UTC 2020


Author: vmaffione
Date: Tue Jun 23 20:48:43 2020
New Revision: 362556
URL: https://svnweb.freebsd.org/changeset/base/362556

Log:
  MFC r361982
  
  iflib: netmap: honor netmap_irx_irq return values
  
  In the receive interrupt routine, always call netmap_rx_irq().
  The latter function will return != NM_IRQ_PASS if netmap is not
  active on that specific receive queue, so that the driver can go
  on with iflib_rxeof(). Note that netmap supports partial opening,
  where only a subset of the RX or TX rings can be open in netmap mode.
  Checking the IFCAP_NETMAP flag is not enough to make sure that the
  queue is indeed in netmap mode.
  Moreover, in case netmap_rx_irq() returns NM_IRQ_RESCHED, it means
  that netmap expects the driver to call netmap_rx_irq() again as soon
  as possible. Currently, this may happen when the device is attached
  to a VALE switch.
  
  Reviewed by:    gallatin
  Differential Revision:  https://reviews.freebsd.org/D25167

Modified:
  stable/12/sys/net/iflib.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/iflib.c
==============================================================================
--- stable/12/sys/net/iflib.c	Tue Jun 23 20:44:05 2020	(r362555)
+++ stable/12/sys/net/iflib.c	Tue Jun 23 20:48:43 2020	(r362556)
@@ -3785,6 +3785,10 @@ _task_fn_rx(void *context)
 	if_ctx_t ctx = rxq->ifr_ctx;
 	uint8_t more;
 	uint16_t budget;
+#ifdef DEV_NETMAP
+	u_int work = 0;
+	int nmirq;
+#endif
 
 #ifdef IFLIB_DIAGNOSTICS
 	rxq->ifr_cpu_exec_count[curcpu]++;
@@ -3793,12 +3797,10 @@ _task_fn_rx(void *context)
 	if (__predict_false(!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)))
 		return;
 #ifdef DEV_NETMAP
-	if (if_getcapenable(ctx->ifc_ifp) & IFCAP_NETMAP) {
-		u_int work = 0;
-		if (netmap_rx_irq(ctx->ifc_ifp, rxq->ifr_id, &work)) {
-			more = 0;
-			goto skip_rxeof;
-		}
+	nmirq = netmap_rx_irq(ctx->ifc_ifp, rxq->ifr_id, &work);
+	if (nmirq != NM_IRQ_PASS) {
+		more = (nmirq == NM_IRQ_RESCHED) ? IFLIB_RXEOF_MORE : 0;
+		goto skip_rxeof;
 	}
 #endif
 	budget = ctx->ifc_sysctl_rx_budget;


More information about the svn-src-all mailing list