Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Don't set the more flag when there is no packet ...



details:   https://anonhg.NetBSD.org/src/rev/8bb28f7f5562
branches:  trunk
changeset: 366218:8bb28f7f5562
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu May 19 02:23:59 2022 +0000

description:
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.

diffstat:

 sys/dev/pci/if_wm.c |  36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diffs (78 lines):

diff -r a457731a3bca -r 8bb28f7f5562 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Thu May 19 02:22:59 2022 +0000
+++ b/sys/dev/pci/if_wm.c       Thu May 19 02:23:59 2022 +0000
@@ -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 @@
         */
        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 @@
                        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 @@
        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 @@
                        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,



Home | Main Index | Thread Index | Old Index