svn commit: r361744 - head/sys/dev/virtio/network

Vincenzo Maffione vmaffione at FreeBSD.org
Wed Jun 3 05:09:34 UTC 2020


Author: vmaffione
Date: Wed Jun  3 05:09:33 2020
New Revision: 361744
URL: https://svnweb.freebsd.org/changeset/base/361744

Log:
  netmap: vtnet: honor NM_IRQ_RESCHED
  
  The netmap_rx_irq() function may return NM_IRQ_RESCHED to inform the
  driver that more work is pending, and that netmap expects netmap_rx_irq()
  to be called again as soon as possible.
  This change implements this behaviour in the vtnet driver.
  
  MFC after:	1 week

Modified:
  head/sys/dev/virtio/network/if_vtnet.c

Modified: head/sys/dev/virtio/network/if_vtnet.c
==============================================================================
--- head/sys/dev/virtio/network/if_vtnet.c	Wed Jun  3 05:00:40 2020	(r361743)
+++ head/sys/dev/virtio/network/if_vtnet.c	Wed Jun  3 05:09:33 2020	(r361744)
@@ -1916,6 +1916,9 @@ vtnet_rx_vq_intr(void *xrxq)
 	struct vtnet_rxq *rxq;
 	struct ifnet *ifp;
 	int tries, more;
+#ifdef DEV_NETMAP
+	int nmirq;
+#endif /* DEV_NETMAP */
 
 	rxq = xrxq;
 	sc = rxq->vtnrx_sc;
@@ -1934,8 +1937,13 @@ vtnet_rx_vq_intr(void *xrxq)
 	}
 
 #ifdef DEV_NETMAP
-	if (netmap_rx_irq(ifp, rxq->vtnrx_id, &more) != NM_IRQ_PASS)
+	nmirq = netmap_rx_irq(ifp, rxq->vtnrx_id, &more);
+	if (nmirq != NM_IRQ_PASS) {
+		if (nmirq == NM_IRQ_RESCHED) {
+			taskqueue_enqueue(rxq->vtnrx_tq, &rxq->vtnrx_intrtask);
+		}
 		return;
+	}
 #endif /* DEV_NETMAP */
 
 	VTNET_RXQ_LOCK(rxq);
@@ -1971,10 +1979,23 @@ vtnet_rxq_tq_intr(void *xrxq, int pending)
 	struct vtnet_rxq *rxq;
 	struct ifnet *ifp;
 	int more;
+#ifdef DEV_NETMAP
+	int nmirq;
+#endif /* DEV_NETMAP */
 
 	rxq = xrxq;
 	sc = rxq->vtnrx_sc;
 	ifp = sc->vtnet_ifp;
+
+#ifdef DEV_NETMAP
+	nmirq = netmap_rx_irq(ifp, rxq->vtnrx_id, &more);
+	if (nmirq != NM_IRQ_PASS) {
+		if (nmirq == NM_IRQ_RESCHED) {
+			taskqueue_enqueue(rxq->vtnrx_tq, &rxq->vtnrx_intrtask);
+		}
+		return;
+	}
+#endif /* DEV_NETMAP */
 
 	VTNET_RXQ_LOCK(rxq);
 


More information about the svn-src-head mailing list