Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
src: vmx(4): handled SIOCZIFDATA.
details: https://anonhg.NetBSD.org/src/rev/ad6c9f8b3e5f
branches: trunk
changeset: 318229:ad6c9f8b3e5f
user: nonaka <nonaka%NetBSD.org@localhost>
date: Mon Apr 16 09:10:42 2018 +0000
description:
vmx(4): handled SIOCZIFDATA.
diffstat:
sys/arch/x86/pci/if_vmx.c | 39 +++++++++++++++++++++++++--------------
1 files changed, 25 insertions(+), 14 deletions(-)
diffs (69 lines):
diff -r 56f92b18a47c -r ad6c9f8b3e5f sys/arch/x86/pci/if_vmx.c
--- a/sys/arch/x86/pci/if_vmx.c Mon Apr 16 08:56:08 2018 +0000
+++ b/sys/arch/x86/pci/if_vmx.c Mon Apr 16 09:10:42 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vmx.c,v 1.22 2018/04/16 03:21:43 nonaka Exp $ */
+/* $NetBSD: if_vmx.c,v 1.23 2018/04/16 09:10:42 nonaka 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.22 2018/04/16 03:21:43 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.23 2018/04/16 09:10:42 nonaka Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -2892,27 +2892,38 @@
splx(s);
break;
case SIOCGIFDATA:
+ case SIOCZIFDATA:
ifp->if_ipackets = 0;
ifp->if_iqdrops = 0;
ifp->if_ierrors = 0;
for (int i = 0; i < sc->vmx_nrxqueues; i++) {
- ifp->if_ipackets +=
- sc->vmx_rxq[i].vxrxq_stats.vmrxs_ipackets;
- ifp->if_iqdrops +=
- sc->vmx_rxq[i].vxrxq_stats.vmrxs_iqdrops;
- ifp->if_ierrors +=
- sc->vmx_rxq[i].vxrxq_stats.vmrxs_ierrors;
+ struct vmxnet3_rxqueue *rxq = &sc->vmx_rxq[i];
+
+ VMXNET3_RXQ_LOCK(rxq);
+ ifp->if_ipackets += rxq->vxrxq_stats.vmrxs_ipackets;
+ ifp->if_iqdrops += rxq->vxrxq_stats.vmrxs_iqdrops;
+ ifp->if_ierrors += rxq->vxrxq_stats.vmrxs_ierrors;
+ if (cmd == SIOCZIFDATA) {
+ memset(&rxq->vxrxq_stats, 0,
+ sizeof(rxq->vxrxq_stats));
+ }
+ VMXNET3_RXQ_UNLOCK(rxq);
}
ifp->if_opackets = 0;
ifp->if_obytes = 0;
ifp->if_omcasts = 0;
for (int i = 0; i < sc->vmx_ntxqueues; i++) {
- ifp->if_opackets +=
- sc->vmx_txq[i].vxtxq_stats.vmtxs_opackets;
- ifp->if_obytes +=
- sc->vmx_txq[i].vxtxq_stats.vmtxs_obytes;
- ifp->if_omcasts +=
- sc->vmx_txq[i].vxtxq_stats.vmtxs_omcasts;
+ struct vmxnet3_txqueue *txq = &sc->vmx_txq[i];
+
+ VMXNET3_TXQ_LOCK(txq);
+ ifp->if_opackets += txq->vxtxq_stats.vmtxs_opackets;
+ ifp->if_obytes += txq->vxtxq_stats.vmtxs_obytes;
+ ifp->if_omcasts += txq->vxtxq_stats.vmtxs_omcasts;
+ if (cmd == SIOCZIFDATA) {
+ memset(&txq->vxtxq_stats, 0,
+ sizeof(txq->vxtxq_stats));
+ }
+ VMXNET3_TXQ_UNLOCK(txq);
}
/* FALLTHROUGH */
default:
Home |
Main Index |
Thread Index |
Old Index