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

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

Log Message:
Call wm_xxeof() only when limit > 0.

 It's not required to call wm_xxeof() when limit == 0. It means that
all xxeof processing will be done by softint or workqueue. Currently,
wm_xxeof() returns quickly before checking the descriptor head when
limit == 0 and return with ture to set the more flag.


To generate a diff of this commit:
cvs rdiff -u -r1.731 -r1.732 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.731 src/sys/dev/pci/if_wm.c:1.732
--- src/sys/dev/pci/if_wm.c:1.731	Tue May 17 00:02:57 2022
+++ src/sys/dev/pci/if_wm.c	Thu May 19 02:22:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.731 2022/05/17 00:02:57 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.732 2022/05/19 02:22: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.731 2022/05/17 00:02:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.732 2022/05/19 02:22:59 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9958,14 +9958,18 @@ wm_intr_legacy(void *arg)
 		WM_Q_EVCNT_INCR(rxq, intr);
 	}
 #endif
-	/*
-	 * wm_rxeof() does *not* call upper layer functions directly,
-	 * as if_percpuq_enqueue() just call softint_schedule().
-	 * So, we can call wm_rxeof() in interrupt context.
-	 */
-	more = wm_rxeof(rxq, rxlimit);
+	if (rxlimit > 0) {
+		/*
+		 * wm_rxeof() does *not* call upper layer functions directly,
+		 * as if_percpuq_enqueue() just call softint_schedule().
+		 * So, we can call wm_rxeof() in interrupt context.
+		 */
+		more = wm_rxeof(rxq, rxlimit);
+	} else
+		more = true;
 
 	mutex_exit(rxq->rxq_lock);
+
 	mutex_enter(txq->txq_lock);
 
 	if (txq->txq_stopping) {
@@ -9981,10 +9985,12 @@ wm_intr_legacy(void *arg)
 		WM_Q_EVCNT_INCR(txq, txdw);
 	}
 #endif
-	more |= wm_txeof(txq, txlimit);
-	if (!IF_IS_EMPTY(&ifp->if_snd))
+	if (txlimit > 0) {
+		more |= wm_txeof(txq, txlimit);
+		if (!IF_IS_EMPTY(&ifp->if_snd))
+			more = true;
+	} else
 		more = true;
-
 	mutex_exit(txq->txq_lock);
 	WM_CORE_LOCK(sc);
 
@@ -10096,8 +10102,11 @@ wm_txrxintr_msix(void *arg)
 	}
 
 	WM_Q_EVCNT_INCR(txq, txdw);
-	txmore = wm_txeof(txq, txlimit);
-	/* wm_deferred start() is done in wm_handle_queue(). */
+	if (txlimit > 0) {
+		txmore = wm_txeof(txq, txlimit);
+		/* wm_deferred start() is done in wm_handle_queue(). */
+	} else
+		txmore = true;
 	mutex_exit(txq->txq_lock);
 
 	DPRINTF(sc, WM_DEBUG_RX,
@@ -10110,7 +10119,10 @@ wm_txrxintr_msix(void *arg)
 	}
 
 	WM_Q_EVCNT_INCR(rxq, intr);
-	rxmore = wm_rxeof(rxq, rxlimit);
+	if (rxlimit > 0) {
+		rxmore = wm_rxeof(rxq, rxlimit);
+	} else
+		rxmore = true;
 	mutex_exit(rxq->rxq_lock);
 
 	wm_itrs_writereg(sc, wmq);

Reply via email to