From 954dca4c99eb4b2e2dd7b7791a1f1e5ce32b2dea Mon Sep 17 00:00:00 2001 From: Luigi Rizzo Date: Tue, 5 Nov 2013 00:56:07 +0000 Subject: fix a bug when a device has 1 tx (or rx) queue and more than one queue of a different type. Submitted by: Vincenzo Maffione MFC after: 3 days --- sys/dev/netmap/netmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sys/dev/netmap/netmap.c') diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index faa07b8a511d..85d479786fc6 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -2684,7 +2684,7 @@ netmap_poll(struct cdev *dev, int events, struct thread *td) struct netmap_adapter *na; struct ifnet *ifp; struct netmap_kring *kring; - u_int i, check_all, want_tx, want_rx, revents = 0; + u_int i, check_all_tx, check_all_rx, want_tx, want_rx, revents = 0; u_int lim_tx, lim_rx, host_forwarded = 0; struct mbq q = { NULL, NULL, 0 }; void *pwait = dev; /* linux compatibility */ @@ -2759,7 +2759,8 @@ netmap_poll(struct cdev *dev, int events, struct thread *td) * there are pending packets to send. The latter can be disabled * passing NETMAP_NO_TX_POLL in the NIOCREG call. */ - check_all = (priv->np_qlast == NETMAP_HW_RING) && (lim_tx > 1 || lim_rx > 1); + check_all_tx = (priv->np_qlast == NETMAP_HW_RING) && (lim_tx > 1); + check_all_rx = (priv->np_qlast == NETMAP_HW_RING) && (lim_rx > 1); if (priv->np_qlast != NETMAP_HW_RING) { lim_tx = lim_rx = priv->np_qlast; @@ -2833,7 +2834,7 @@ flush_tx: nm_kr_put(kring); } if (want_tx && retry_tx) { - selrecord(td, check_all ? + selrecord(td, check_all_tx ? &na->tx_si : &na->tx_rings[priv->np_qfirst].si); retry_tx = 0; goto flush_tx; @@ -2879,7 +2880,7 @@ do_retry_rx: } if (retry_rx) { retry_rx = 0; - selrecord(td, check_all ? + selrecord(td, check_all_rx ? &na->rx_si : &na->rx_rings[priv->np_qfirst].si); goto do_retry_rx; } -- cgit v1.3