Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Call wm_xxeof() only when limit > 0.



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

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

diffstat:

 sys/dev/pci/if_wm.c |  40 ++++++++++++++++++++++++++--------------
 1 files changed, 26 insertions(+), 14 deletions(-)

diffs (85 lines):

diff -r 82b72934bb31 -r a457731a3bca sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Wed May 18 22:35:13 2022 +0000
+++ b/sys/dev/pci/if_wm.c       Thu May 19 02:22:59 2022 +0000
@@ -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_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_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_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_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);



Home | Main Index | Thread Index | Old Index