diff options
| author | msaitoh <msaitoh@NetBSD.org> | 2022-07-06 06:32:50 +0000 |
|---|---|---|
| committer | msaitoh <msaitoh@NetBSD.org> | 2022-07-06 06:32:50 +0000 |
| commit | 662e6875b9efe3ee366a17c5ae8163b5b9507fbe (patch) | |
| tree | 1bacae7d0c5d4f5ed990123efacdd8669c1ce8db /sys/dev | |
| parent | 09c9f3ab6bd767a9430a9e2494667a2467b86bc1 (diff) | |
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 (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/if_vmx.c | 12 | ||||
| -rw-r--r-- | sys/dev/pci/if_wm.c | 49 |
2 files changed, 31 insertions, 30 deletions
diff --git a/sys/dev/pci/if_vmx.c b/sys/dev/pci/if_vmx.c index 8c0694c4f51..d3850d143dd 100644 --- a/sys/dev/pci/if_vmx.c +++ b/sys/dev/pci/if_vmx.c @@ -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 @@ vmxnet3_legacy_intr(void *xsc) if (sc->vmx_ds->event != 0) vmxnet3_evintr(sc); - 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); + VMXNET3_RXQ_LOCK(rxq); + rxmore = vmxnet3_rxq_eof(rxq, rxlimit); + VMXNET3_RXQ_UNLOCK(rxq); + if (txmore || rxmore) vmxnet3_sched_handle_queue(sc, vmxq); else { diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c index fccf6c2ed98..ec15ee887d1 100644 --- a/sys/dev/pci/if_wm.c +++ b/sys/dev/pci/if_wm.c @@ -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 @@ wm_intr_legacy(void *arg) 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 @@ wm_intr_legacy(void *arg) 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) { |
