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 txeof first, then rxeof for the consistency.



details:   https://anonhg.NetBSD.org/src/rev/e3177e0fe0e6
branches:  trunk
changeset: 368350:e3177e0fe0e6
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Jul 06 06:32:50 2022 +0000

description:
Call txeof first, then rxeof for the consistency.

 There are three functions where the txeof and rxeof are called. The MSI-X
interrupt function and the workqueue function call rxeof first, then rxeof.
For legacy interrupt. rxeof is called first. Modify it to match with other
two.

diffstat:

 sys/dev/pci/if_vmx.c |  12 ++++++------
 sys/dev/pci/if_wm.c  |  49 +++++++++++++++++++++++++------------------------
 2 files changed, 31 insertions(+), 30 deletions(-)

diffs (114 lines):

diff -r 4811b7dcf689 -r e3177e0fe0e6 sys/dev/pci/if_vmx.c
--- a/sys/dev/pci/if_vmx.c      Wed Jul 06 06:31:47 2022 +0000
+++ b/sys/dev/pci/if_vmx.c      Wed Jul 06 06:32:50 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vmx.c,v 1.8 2022/05/24 02:22:47 msaitoh Exp $       */
+/*     $NetBSD: if_vmx.c,v 1.9 2022/07/06 06:32:50 msaitoh Exp $       */
 /*     $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $        */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.8 2022/05/24 02:22:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.9 2022/07/06 06:32:50 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -2522,14 +2522,14 @@
        if (sc->vmx_ds->event != 0)
                vmxnet3_evintr(sc);
 
+       VMXNET3_TXQ_LOCK(txq);
+       txmore = vmxnet3_txq_eof(txq, txlimit);
+       VMXNET3_TXQ_UNLOCK(txq);
+
        VMXNET3_RXQ_LOCK(rxq);
        rxmore = vmxnet3_rxq_eof(rxq, rxlimit);
        VMXNET3_RXQ_UNLOCK(rxq);
 
-       VMXNET3_TXQ_LOCK(txq);
-       txmore = vmxnet3_txq_eof(txq, txlimit);
-       VMXNET3_TXQ_UNLOCK(txq);
-
        if (txmore || rxmore)
                vmxnet3_sched_handle_queue(sc, vmxq);
        else {
diff -r 4811b7dcf689 -r e3177e0fe0e6 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Wed Jul 06 06:31:47 2022 +0000
+++ b/sys/dev/pci/if_wm.c       Wed Jul 06 06:32:50 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.737 2022/07/06 05:49:46 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.738 2022/07/06 06:33:49 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.737 2022/07/06 05:49:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.738 2022/07/06 06:33:49 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9946,6 +9946,29 @@
        if (rndval == 0)
                rndval = icr;
 
+       mutex_enter(txq->txq_lock);
+
+       if (txq->txq_stopping) {
+               mutex_exit(txq->txq_lock);
+               return 1;
+       }
+
+#if defined(WM_DEBUG) || defined(WM_EVENT_COUNTERS)
+       if (icr & ICR_TXDW) {
+               DPRINTF(sc, WM_DEBUG_TX,
+                   ("%s: TX: got TXDW interrupt\n",
+                       device_xname(sc->sc_dev)));
+               WM_Q_EVCNT_INCR(txq, txdw);
+       }
+#endif
+       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);
+
        mutex_enter(rxq->rxq_lock);
 
        if (rxq->rxq_stopping) {
@@ -9974,28 +9997,6 @@
 
        mutex_exit(rxq->rxq_lock);
 
-       mutex_enter(txq->txq_lock);
-
-       if (txq->txq_stopping) {
-               mutex_exit(txq->txq_lock);
-               return 1;
-       }
-
-#if defined(WM_DEBUG) || defined(WM_EVENT_COUNTERS)
-       if (icr & ICR_TXDW) {
-               DPRINTF(sc, WM_DEBUG_TX,
-                   ("%s: TX: got TXDW interrupt\n",
-                       device_xname(sc->sc_dev)));
-               WM_Q_EVCNT_INCR(txq, txdw);
-       }
-#endif
-       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);
 
        if (sc->sc_core_stopping) {



Home | Main Index | Thread Index | Old Index