Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/arch/x86/pci Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/3d5162ddcc23
branches:  netbsd-8
changeset: 434924:3d5162ddcc23
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Apr 16 14:34:43 2018 +0000

description:
Pull up following revision(s) (requested by nonaka in ticket #767):

        sys/arch/x86/pci/if_vmx.c: revision 1.23,1.24

vmx(4): handled SIOCZIFDATA.

vmx(4): compute if_ibytes using rxq->vxrxq_stats.vmrxs_ibytes.

diffstat:

 sys/arch/x86/pci/if_vmx.c |  41 +++++++++++++++++++++++++++--------------
 1 files changed, 27 insertions(+), 14 deletions(-)

diffs (71 lines):

diff -r 9597a5d92870 -r 3d5162ddcc23 sys/arch/x86/pci/if_vmx.c
--- a/sys/arch/x86/pci/if_vmx.c Mon Apr 16 14:31:44 2018 +0000
+++ b/sys/arch/x86/pci/if_vmx.c Mon Apr 16 14:34:43 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vmx.c,v 1.19.6.3 2018/04/16 14:18:53 martin Exp $   */
+/*     $NetBSD: if_vmx.c,v 1.19.6.4 2018/04/16 14:34:43 martin 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.19.6.3 2018/04/16 14:18:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.19.6.4 2018/04/16 14:34:43 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -2892,27 +2892,40 @@
                splx(s);
                break;
        case SIOCGIFDATA:
+       case SIOCZIFDATA:
                ifp->if_ipackets = 0;
+               ifp->if_ibytes = 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_ibytes += rxq->vxrxq_stats.vmrxs_ibytes;
+                       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