Module Name:    src
Committed By:   msaitoh
Date:           Thu May 19 02:23:59 UTC 2022

Modified Files:
        src/sys/dev/pci: if_wm.c

Log Message:
Don't set the more flag when there is no packet to process.

 Move the location of the loop limit check next to the DD bit test. This
change prevent from scheduling the next txrx_work that does nothing.


To generate a diff of this commit:
cvs rdiff -u -r1.732 -r1.733 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.732 src/sys/dev/pci/if_wm.c:1.733
--- src/sys/dev/pci/if_wm.c:1.732	Thu May 19 02:22:59 2022
+++ src/sys/dev/pci/if_wm.c	Thu May 19 02:23:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.732 2022/05/19 02:22:59 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.733 2022/05/19 02:23:59 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.732 2022/05/19 02:22:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.733 2022/05/19 02:23:59 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -8968,14 +8968,6 @@ wm_txeof(struct wm_txqueue *txq, u_int l
 	 */
 	for (i = txq->txq_sdirty; txq->txq_sfree != WM_TXQUEUELEN(txq);
 	     i = WM_NEXTTXS(txq, i), txq->txq_sfree++) {
-		if (limit-- == 0) {
-			more = true;
-			DPRINTF(sc, WM_DEBUG_TX,
-			    ("%s: TX: loop limited, job %d is not processed\n",
-				device_xname(sc->sc_dev), i));
-			break;
-		}
-
 		txs = &txq->txq_soft[i];
 
 		DPRINTF(sc, WM_DEBUG_TX, ("%s: TX: checking job %d\n",
@@ -8992,6 +8984,14 @@ wm_txeof(struct wm_txqueue *txq, u_int l
 			break;
 		}
 
+		if (limit-- == 0) {
+			more = true;
+			DPRINTF(sc, WM_DEBUG_TX,
+			    ("%s: TX: loop limited, job %d is not processed\n",
+				device_xname(sc->sc_dev), i));
+			break;
+		}
+
 		count++;
 		DPRINTF(sc, WM_DEBUG_TX,
 		    ("%s: TX: job %d done: descs %d..%d\n",
@@ -9297,14 +9297,6 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 	KASSERT(mutex_owned(rxq->rxq_lock));
 
 	for (i = rxq->rxq_ptr;; i = WM_NEXTRX(i)) {
-		if (limit-- == 0) {
-			more = true;
-			DPRINTF(sc, WM_DEBUG_RX,
-			    ("%s: RX: loop limited, descriptor %d is not processed\n",
-				device_xname(sc->sc_dev), i));
-			break;
-		}
-
 		rxs = &rxq->rxq_soft[i];
 
 		DPRINTF(sc, WM_DEBUG_RX,
@@ -9326,6 +9318,14 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 			break;
 		}
 
+		if (limit-- == 0) {
+			more = true;
+			DPRINTF(sc, WM_DEBUG_RX,
+			    ("%s: RX: loop limited, descriptor %d is not processed\n",
+				device_xname(sc->sc_dev), i));
+			break;
+		}
+
 		count++;
 		if (__predict_false(rxq->rxq_discard)) {
 			DPRINTF(sc, WM_DEBUG_RX,

Reply via email to