Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/pci make vmx(4)'s *_process_limit tunable.



details:   https://anonhg.NetBSD.org/src/rev/16e617747d4e
branches:  trunk
changeset: 962704:16e617747d4e
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Mon Jul 29 10:28:57 2019 +0000

description:
make vmx(4)'s *_process_limit tunable.

diffstat:

 sys/arch/x86/pci/if_vmx.c |  76 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 74 insertions(+), 2 deletions(-)

diffs (125 lines):

diff -r e56e060d1552 -r 16e617747d4e sys/arch/x86/pci/if_vmx.c
--- a/sys/arch/x86/pci/if_vmx.c Mon Jul 29 10:25:30 2019 +0000
+++ b/sys/arch/x86/pci/if_vmx.c Mon Jul 29 10:28:57 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vmx.c,v 1.43 2019/07/29 10:24:18 knakahara Exp $    */
+/*     $NetBSD: if_vmx.c,v 1.44 2019/07/29 10:28:57 knakahara 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.43 2019/07/29 10:24:18 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.44 2019/07/29 10:28:57 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -291,6 +291,8 @@
        u_int vmx_tx_intr_process_limit;
        u_int vmx_rx_process_limit;
        u_int vmx_tx_process_limit;
+
+       struct sysctllog *vmx_sysctllog;
 };
 
 #define VMXNET3_STAT
@@ -337,6 +339,7 @@
 int vmxnet3_setup_legacy_interrupt(struct vmxnet3_softc *);
 void vmxnet3_set_interrupt_idx(struct vmxnet3_softc *);
 int vmxnet3_setup_interrupts(struct vmxnet3_softc *);
+int vmxnet3_setup_sysctl(struct vmxnet3_softc *);
 
 int vmxnet3_init_rxq(struct vmxnet3_softc *, int);
 int vmxnet3_init_txq(struct vmxnet3_softc *, int);
@@ -615,6 +618,10 @@
        if (error)
                return;
 
+       error = vmxnet3_setup_sysctl(sc);
+       if (error)
+               return;
+
        sc->vmx_flags |= VMXNET3_FLAG_ATTACHED;
 }
 
@@ -639,6 +646,8 @@
                if_detach(ifp);
        }
 
+       sysctl_teardown(&sc->vmx_sysctllog);
+
        vmxnet3_free_interrupts(sc);
 
        vmxnet3_free_data(sc);
@@ -1813,6 +1822,69 @@
        return (0);
 }
 
+int
+vmxnet3_setup_sysctl(struct vmxnet3_softc *sc)
+{
+       const char *devname;
+       struct sysctllog **log;
+       const struct sysctlnode *rnode, *rxnode, *txnode;
+       int error;
+
+       log = &sc->vmx_sysctllog;
+       devname = device_xname(sc->vmx_dev);
+
+       error = sysctl_createv(log, 0, NULL, &rnode,
+           0, CTLTYPE_NODE, devname,
+           SYSCTL_DESCR("vmxnet3 information and settings"),
+           NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL);
+       if (error)
+               goto out;
+
+       error = sysctl_createv(log, 0, &rnode, &rxnode,
+           0, CTLTYPE_NODE, "rx",
+           SYSCTL_DESCR("vmxnet3 information and settings for Rx"),
+           NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
+       if (error)
+               goto out;
+       error = sysctl_createv(log, 0, &rxnode, NULL,
+           CTLFLAG_READWRITE, CTLTYPE_INT, "intr_process_limit",
+           SYSCTL_DESCR("max number of Rx packets to process for interrupt processing"),
+           NULL, 0, &sc->vmx_rx_intr_process_limit, 0, CTL_CREATE, CTL_EOL);
+       if (error)
+               goto out;
+       error = sysctl_createv(log, 0, &rxnode, NULL,
+           CTLFLAG_READWRITE, CTLTYPE_INT, "process_limit",
+           SYSCTL_DESCR("max number of Rx packets to process for deferred processing"),
+           NULL, 0, &sc->vmx_rx_process_limit, 0, CTL_CREATE, CTL_EOL);
+       if (error)
+               goto out;
+
+       error = sysctl_createv(log, 0, &rnode, &txnode,
+           0, CTLTYPE_NODE, "tx",
+           SYSCTL_DESCR("vmxnet3 information and settings for Tx"),
+           NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
+       if (error)
+               goto out;
+       error = sysctl_createv(log, 0, &txnode, NULL,
+           CTLFLAG_READWRITE, CTLTYPE_INT, "intr_process_limit",
+           SYSCTL_DESCR("max number of Tx packets to process for interrupt processing"),
+           NULL, 0, &sc->vmx_tx_intr_process_limit, 0, CTL_CREATE, CTL_EOL);
+       if (error)
+               goto out;
+       error = sysctl_createv(log, 0, &txnode, NULL,
+           CTLFLAG_READWRITE, CTLTYPE_INT, "process_limit",
+           SYSCTL_DESCR("max number of Tx packets to process for deferred processing"),
+           NULL, 0, &sc->vmx_tx_process_limit, 0, CTL_CREATE, CTL_EOL);
+
+out:
+       if (error) {
+               aprint_error_dev(sc->vmx_dev,
+                   "unable to create sysctl node\n");
+               sysctl_teardown(log);
+       }
+       return error;
+}
+
 void
 vmxnet3_evintr(struct vmxnet3_softc *sc)
 {



Home | Main Index | Thread Index | Old Index