Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Create the sysctl variables on module initializa...



details:   https://anonhg.NetBSD.org/src/rev/750104be24a0
branches:  trunk
changeset: 791426:750104be24a0
user:      bad <bad%NetBSD.org@localhost>
date:      Sun Nov 17 22:52:14 2013 +0000

description:
Create the sysctl variables on module initialization.
Create them under hw.ubsec as is hip these days.

diffstat:

 sys/dev/pci/ubsec.c |  54 +++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 44 insertions(+), 10 deletions(-)

diffs (119 lines):

diff -r 5dc3545104b7 -r 750104be24a0 sys/dev/pci/ubsec.c
--- a/sys/dev/pci/ubsec.c       Sun Nov 17 19:22:06 2013 +0000
+++ b/sys/dev/pci/ubsec.c       Sun Nov 17 22:52:14 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ubsec.c,v 1.32 2013/11/17 17:16:25 bad Exp $   */
+/*     $NetBSD: ubsec.c,v 1.33 2013/11/17 22:52:14 bad Exp $   */
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*     $OpenBSD: ubsec.c,v 1.127 2003/06/04 14:04:58 jason Exp $       */
 
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.32 2013/11/17 17:16:25 bad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.33 2013/11/17 22:52:14 bad Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -59,6 +59,7 @@
 #include <sys/device.h>
 #include <sys/module.h>
 #include <sys/queue.h>
+#include <sys/sysctl.h>
 
 #include <opencrypto/cryptodev.h>
 #include <opencrypto/xform.h>
@@ -84,6 +85,7 @@
 static int ubsec_probe(device_t, cfdata_t, void *);
 static void ubsec_attach(device_t, device_t, void *);
 static int  ubsec_detach(device_t, int);
+static int  ubsec_sysctl_init(void);
 static void ubsec_reset_board(struct ubsec_softc *);
 static void ubsec_init_board(struct ubsec_softc *);
 static void ubsec_init_pciregs(struct pci_attach_args *pa);
@@ -161,6 +163,8 @@
 
 struct ubsec_stats ubsecstats;
 
+static struct sysctllog *ubsec_sysctllog;
+
 /*
  * ubsec_maxbatch controls the number of crypto ops to voluntarily
  * collect into one submission to the hardware.  This batching happens
@@ -169,10 +173,6 @@
  * with a ``no delay'' flag.
  */
 static int ubsec_maxbatch = 1;
-#ifdef SYSCTL_INT
-SYSCTL_INT(_kern, OID_AUTO, ubsec_maxbatch, CTLFLAG_RW, &ubsec_maxbatch,
-           0, "Broadcom driver: max ops to batch w/o interrupt");
-#endif
 
 /*
  * ubsec_maxaggr controls the number of crypto ops to submit to the
@@ -182,10 +182,6 @@
  * performance but at the expense of more interrupt processing.
  */
 static int ubsec_maxaggr = 1;
-#ifdef SYSCTL_INT
-SYSCTL_INT(_kern, OID_AUTO, ubsec_maxaggr, CTLFLAG_RW, &ubsec_maxaggr,
-           0, "Broadcom driver: max ops to aggregate under one interrupt");
-#endif
 
 static const struct ubsec_product {
        pci_vendor_id_t         ubsec_vendor;
@@ -540,8 +536,12 @@
                error = config_init_component(cfdriver_ioconf_ubsec,
                    cfattach_ioconf_ubsec, cfdata_ioconf_ubsec);
 #endif
+               if (error == 0)
+                       error = ubsec_sysctl_init();
                return error;
        case MODULE_CMD_FINI:
+               if (ubsec_sysctllog != NULL)
+                       sysctl_teardown(&ubsec_sysctllog);
 #ifdef _MODULE
                error = config_fini_component(cfdriver_ioconf_ubsec,
                    cfattach_ioconf_ubsec, cfdata_ioconf_ubsec);
@@ -552,6 +552,40 @@
        }
 }
 
+static int
+ubsec_sysctl_init(void)
+{
+       const struct sysctlnode *node = NULL;
+
+       ubsec_sysctllog = NULL;
+
+       sysctl_createv(&ubsec_sysctllog, 0, NULL, NULL,
+               CTLFLAG_PERMANENT,
+               CTLTYPE_NODE, "hw", NULL,
+               NULL, 0, NULL, 0,
+               CTL_HW, CTL_EOL);
+       sysctl_createv(&ubsec_sysctllog, 0, NULL, &node,
+               CTLFLAG_PERMANENT,
+               CTLTYPE_NODE, "ubsec", 
+               SYSCTL_DESCR("ubsec opetions"),
+               NULL, 0, NULL, 0,
+               CTL_HW, CTL_CREATE, CTL_EOL);
+       sysctl_createv(&ubsec_sysctllog, 0, &node, NULL,
+               CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
+               CTLTYPE_INT, "maxbatch",
+               SYSCTL_DESCR("max ops to batch w/o interrupt"),
+               NULL, 0, &ubsec_maxbatch, 0,
+               CTL_CREATE, CTL_EOL);
+       sysctl_createv(&ubsec_sysctllog, 0, &node, NULL,
+               CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
+               CTLTYPE_INT, "maxaggr",
+               SYSCTL_DESCR("max ops to aggregate under one interrupt"),
+               NULL, 0, &ubsec_maxaggr, 0,
+               CTL_CREATE, CTL_EOL);
+
+       return 0;
+}
+
 /*
  * UBSEC Interrupt routine
  */



Home | Main Index | Thread Index | Old Index