kernel: Use the new auto-created sysctl ctx/tree in various drivers.
authorSascha Wildner <saw@online.de>
Fri, 28 Nov 2014 21:16:32 +0000 (22:16 +0100)
committerSascha Wildner <saw@online.de>
Fri, 28 Nov 2014 21:16:32 +0000 (22:16 +0100)
Everywhere where we formerly rolled a hw.fooX.* per-device ctx/tree
ourselves.

This commit switches it to dev.foo.X.*

117 files changed:
share/man/man4/acx.4
share/man/man4/ae.4
share/man/man4/age.4
share/man/man4/ahci.4
share/man/man4/ale.4
share/man/man4/bce.4
share/man/man4/bnx.4
share/man/man4/bwi.4
share/man/man4/em.4
share/man/man4/igb.4
share/man/man4/ix.4
share/man/man4/jme.4
share/man/man4/mfi.4
share/man/man4/mrsas.4
share/man/man4/mxge.4
share/man/man4/nfe.4
share/man/man4/oce.4
share/man/man4/re.4
share/man/man4/ufoma.4
sys/bus/u4b/serial/ufoma.c
sys/dev/disk/ahci/ahci.h
sys/dev/disk/ahci/ahci_dragonfly.c
sys/dev/disk/isp/isp_freebsd.c
sys/dev/disk/isp/isp_freebsd.h
sys/dev/disk/mpt/mpt.c
sys/dev/disk/mpt/mpt.h
sys/dev/disk/mpt/mpt_cam.c
sys/dev/disk/mpt/mpt_raid.c
sys/dev/netif/acx/if_acx.c
sys/dev/netif/acx/if_acxvar.h
sys/dev/netif/ae/if_ae.c
sys/dev/netif/ae/if_aevar.h
sys/dev/netif/age/if_age.c
sys/dev/netif/age/if_agevar.h
sys/dev/netif/alc/if_alc.c
sys/dev/netif/alc/if_alcvar.h
sys/dev/netif/ale/if_ale.c
sys/dev/netif/ale/if_alevar.h
sys/dev/netif/ath/ath/if_ath.c
sys/dev/netif/ath/ath/if_ath_sysctl.c
sys/dev/netif/ath/ath/if_athvar.h
sys/dev/netif/ath/ath_rate/amrr/amrr.c
sys/dev/netif/ath/ath_rate/onoe/onoe.c
sys/dev/netif/ath/ath_rate/sample/sample.c
sys/dev/netif/bce/if_bce.c
sys/dev/netif/bce/if_bcereg.h
sys/dev/netif/bge/if_bge.c
sys/dev/netif/bge/if_bgevar.h
sys/dev/netif/bnx/if_bnx.c
sys/dev/netif/bnx/if_bnxvar.h
sys/dev/netif/bwi/if_bwi.c
sys/dev/netif/bwi/if_bwivar.h
sys/dev/netif/bwn/bwn/if_bwn.c
sys/dev/netif/bwn/bwn/if_bwnvar.h
sys/dev/netif/em/if_em.c
sys/dev/netif/em/if_em.h
sys/dev/netif/emx/if_emx.c
sys/dev/netif/emx/if_emx.h
sys/dev/netif/et/if_et.c
sys/dev/netif/et/if_etvar.h
sys/dev/netif/fxp/if_fxp.c
sys/dev/netif/fxp/if_fxpvar.h
sys/dev/netif/igb/if_igb.c
sys/dev/netif/igb/if_igb.h
sys/dev/netif/iwi/if_iwi.c
sys/dev/netif/iwi/if_iwivar.h
sys/dev/netif/iwl/if_iwl.c
sys/dev/netif/iwl/if_iwlvar.h
sys/dev/netif/iwl/iwl2100.c
sys/dev/netif/iwn/if_iwn.c
sys/dev/netif/iwn/if_iwnvar.h
sys/dev/netif/ix/if_ix.c
sys/dev/netif/ix/if_ix.h
sys/dev/netif/jme/if_jme.c
sys/dev/netif/jme/if_jmevar.h
sys/dev/netif/msk/if_msk.c
sys/dev/netif/msk/if_mskreg.h
sys/dev/netif/mxge/if_mxge.c
sys/dev/netif/mxge/if_mxge_var.h
sys/dev/netif/ndis/if_ndisvar.h
sys/dev/netif/nfe/if_nfe.c
sys/dev/netif/nfe/if_nfevar.h
sys/dev/netif/oce/oce_if.c
sys/dev/netif/oce/oce_if.h
sys/dev/netif/oce/oce_sysctl.c
sys/dev/netif/ral/rt2560.c
sys/dev/netif/ral/rt2560var.h
sys/dev/netif/ral/rt2661.c
sys/dev/netif/ral/rt2661var.h
sys/dev/netif/ral/rt2860.c
sys/dev/netif/ral/rt2860var.h
sys/dev/netif/re/if_re.c
sys/dev/netif/re/if_revar.h
sys/dev/netif/sk/if_sk.c
sys/dev/netif/sk/if_skvar.h
sys/dev/netif/stge/if_stge.c
sys/dev/netif/stge/if_stgevar.h
sys/dev/netif/wi/if_wi.c
sys/dev/netif/wi/if_wivar.h
sys/dev/raid/aac/aac.c
sys/dev/raid/aac/aacvar.h
sys/dev/raid/amr/amr.c
sys/dev/raid/amr/amrvar.h
sys/dev/raid/ciss/ciss.c
sys/dev/raid/ciss/cissvar.h
sys/dev/raid/mfi/mfi.c
sys/dev/raid/mfi/mfivar.h
sys/dev/raid/mrsas/mrsas.c
sys/dev/raid/twa/tw_osl.h
sys/dev/raid/twa/tw_osl_freebsd.c
sys/dev/raid/twe/twe_compat.h
sys/dev/raid/twe/twe_freebsd.c
sys/dev/raid/tws/tws.c
sys/dev/raid/tws/tws.h
sys/dev/virtual/virtio/net/if_vtnet.c
sys/emulation/ndis/kern_ndis.c
sys/emulation/ndis/subr_ndis.c

index 4a92871..2437a8e 100644 (file)
@@ -28,9 +28,7 @@
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $DragonFly: src/share/man/man4/acx.4,v 1.14 2008/07/26 16:25:40 swildner Exp $
-.\"
-.Dd July 26, 2008
+.Dd November 28, 2014
 .Dt ACX 4
 .Os
 .Sh NAME
@@ -72,7 +70,7 @@ For more information on configuring this device, see
 .Xr ifconfig 8 .
 .Ss MIB Variables
 The following per-interface variables are implemented in the
-.Va hw.acx Ns Em X
+.Va dev.acx. Ns Em X
 branch of the
 .Xr sysctl 3
 MIB.
index 099e375..732526c 100644 (file)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/ae.4,v 1.2.2.1.4.1 2009/04/15 03:14:26 kensmith Exp $
 .\"
-.Dd July 13, 2009
+.Dd November 28, 2014
 .Dt AE 4
 .Os
 .Sh NAME
@@ -100,7 +100,7 @@ The
 .Nm
 driver collects a number of useful MAC counter during the work.
 The statistics is available via the
-.Va hw.ae%d.stats
+.Va dev.ae.%d.stats
 .Xr sysctl 8
 tree, where %d corresponds to the controller number.
 .Sh DIAGNOSTICS
index bcc323b..38c75a4 100644 (file)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/age.4,v 1.3 2008/09/18 05:08:17 yongari Exp $
 .\"
-.Dd January 2, 2009
+.Dd November 28, 2014
 .Dt AGE 4
 .Os
 .Sh NAME
@@ -140,11 +140,11 @@ The following variables are available as
 .Xr sysctl 8
 variables:
 .Bl -tag -width "xxxxxx"
-.It Va dev.age%d.int_mod
+.It Va dev.age.%d.int_mod
 Maximum amount of time to delay interrupt processing in units of 2us.
 The accepted range is 0 to 65000, the default is 50 (100us).
 Value 0 completely disables the interrupt moderation.
-.It Va dev.age%d.stats
+.It Va dev.age.%d.stats
 Display lots of useful MAC counters maintained in the driver.
 .El
 .Sh SEE ALSO
index e26b3c7..f04d959 100644 (file)
@@ -14,7 +14,7 @@
 .\" TORTIOUS ACTION, ARISING OUT OF
 .\" PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd April 7, 2012
+.Dd November 28, 2014
 .Dt AHCI 4
 .Os
 .Sh NAME
@@ -99,10 +99,10 @@ hw.ahci.msi.enable=0
 .Ed
 .Sh SYSCTL VARIABLES
 Link power management can be set with the sysctl
-.Va hw.ahci%d.%d.link_pwr_mgmt
+.Va dev.ahci.%d.%d.link_pwr_mgmt
 to 0 for `disabled', 1 for `medium', and 2 for `aggressive'.
 Link power state can be read with the sysctl
-.Va hw.ahci%d.%d.link_pwr_state .
+.Va dev.ahci.%d.%d.link_pwr_state .
 .Sh SEE ALSO
 .Xr intro 4 ,
 .Xr nata 4 ,
index e8063de..7b09ccc 100644 (file)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/ale.4,v 1.2 2008/11/29 18:09:50 brueffer Exp $
 .\"
-.Dd December 31, 2008
+.Dd November 28, 2014
 .Dt ALE 4
 .Os
 .Sh NAME
@@ -108,18 +108,18 @@ Atheros AR8114 PCI Express Fast Ethernet controller
 Atheros AR8121 PCI Express Gigabit Ethernet controller
 .El
 .Sh SYSCTL VARIABLES
-The following variables are available as both
-.Xr sysctl 8
-variables and
-.Xr loader 8
-tunables:
+.\"The following variables are available as both
+.\".Xr sysctl 8
+.\"variables and
+.\".Xr loader 8
+.\"tunables:
 .Bl -tag -width "xxxxxx"
-.It Va dev.ale%d.int_rx_mod
+.It Va dev.ale.%d.int_rx_mod
 Maximum amount of time to delay receive interrupt processing in
 units of 1us.
 The accepted range is 0 to 130000, the default is 30(30us).
 Value 0 completely disables the interrupt moderation.
-.It Va dev.ale%d.int_tx_mod
+.It Va dev.ale.%d.int_tx_mod
 Maximum amount of time to delay transmit interrupt processing in
 units of 1us.
 The accepted range is 0 to 130000, the default is 1000(1ms).
index a673f5a..b01263d 100644 (file)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/bce.4,v 1.7 2007/02/09 18:26:13 brueffer Exp $
 .\"
-.Dd May 30, 2013
+.Dd November 28, 2014
 .Dt BCE 4
 .Os
 .Sh NAME
@@ -274,7 +274,7 @@ Default value is 8.
 .El
 .Sh MIB Variables
 A number of per-interface variables are implemented in the
-.Va hw.bce Ns Em X
+.Va dev.bce. Ns Em X
 branch of the
 .Xr sysctl 3
 MIB.
index cb9a1ae..345c098 100644 (file)
@@ -28,7 +28,7 @@
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd June 16, 2013
+.Dd November 28, 2014
 .Dt BNX 4
 .Os
 .Sh NAME
@@ -281,7 +281,7 @@ enabled and must be less than the power of 2 number of CPUs.
 .El
 .Sh MIB Variables
 A number of per-interface variables are implemented in the
-.Va hw.bnx Ns Em X
+.Va dev.bnx. Ns Em X
 branch of the
 .Xr sysctl 3
 MIB.
index 862d60e..221e0b6 100644 (file)
@@ -28,9 +28,7 @@
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $DragonFly: src/share/man/man4/bwi.4,v 1.10 2008/07/26 16:25:40 swildner Exp $
-.\"
-.Dd July 26, 2008
+.Dd November 28, 2014
 .Dt BWI 4
 .Os
 .Sh NAME
@@ -51,7 +49,7 @@ For more information on configuring this device, see
 .Xr ifconfig 8 .
 .Ss MIB Variables
 The following per-interface variables are implemented in the
-.Va hw.bwi Ns Em X
+.Va dev.bwi. Ns Em X
 branch of the
 .Xr sysctl 3
 MIB.
index cf6f58a..23d790c 100644 (file)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/em.4,v 1.30 2008/10/06 21:55:53 simon Exp $
 .\"
-.Dd September 4, 2013
+.Dd November 28, 2014
 .Dt EM 4
 .Os
 .Sh NAME
@@ -364,9 +364,9 @@ and must be less than the power of 2 number of CPUs.
 .El
 .Sh MIB Variables
 A number of per-interface variables are implemented in the
-.Va hw.emx Ns Em Y
+.Va dev.emx. Ns Em Y
 or
-.Va hw.em Ns Em Y
+.Va dev.em. Ns Em Y
 branch of the
 .Xr sysctl 3
 MIB.
index f59efd8..939db0e 100644 (file)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/igb.4,v 1.2 2010/05/14 20:11:30 marius Exp $
 .\"
-.Dd September 3, 2013
+.Dd November 28, 2014
 .Dt IGB 4
 .Os
 .Sh NAME
@@ -346,7 +346,7 @@ enabled and must be less than the power of 2 number of CPUs.
 .El
 .Sh MIB Variables
 A number of per-interface variables are implemented in the
-.Va hw.igb Ns Em X
+.Va dev.igb. Ns Em X
 branch of the
 .Xr sysctl 3
 MIB.
index 80f48d2..bd8234b 100644 (file)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/ixgbe.4,v 1.2 2008/06/17 21:14:02 brueffer Exp $
 .\"
-.Dd May 11, 2014
+.Dd November 28, 2014
 .Dt IX 4
 .Os
 .Sh NAME
@@ -262,7 +262,7 @@ This behavior can be changed by setting this tunable to 1.
 .El
 .Sh MIB Variables
 A number of per-interface variables are implemented in the
-.Va hw.ix Ns Em X
+.Va dev.ix. Ns Em X
 branch of the
 .Xr sysctl 3
 MIB.
index b45ccc6..0fe6269 100644 (file)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/jme.4,v 1.1 2008/05/27 01:59:17 yongari Exp $
 .\"
-.Dd May 24, 2013
+.Dd November 28, 2014
 .Dt JME 4
 .Os
 .Sh NAME
@@ -199,7 +199,7 @@ The maximum allowed value for this tunable is
 the power of 2 number of CPUs minus one.
 .Ss MIB Variables
 A number of per-interface variables are implemented in the
-.Va hw.jme Ns Em X
+.Va dev.jme. Ns Em X
 branch of the
 .Xr sysctl 3
 MIB.
index 252dbc8..b9b4db5 100644 (file)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/mfi.4,v 1.13 2010/05/12 17:12:38 brueffer Exp $
 .\"
-.Dd July 18, 2014
+.Dd November 28, 2014
 .Dt MFI 4
 .Os
 .Sh NAME
@@ -90,6 +90,10 @@ If the sysctl
 .Va dev.mfi.%d.delete_busy_volumes
 is set to 1,
 then the driver will allow mounted volumes to be removed.
+To not detach the mfid device for a busy volume that is deleted, set the
+sysctl
+.Va dev.mfi.%d.keep_deleted_volumes
+to 1.
 .Sh LOADER TUNABLES
 .Bl -tag -width indent
 .It Va hw.mfi.msi.enable
index 13a8f2b..f88a702 100644 (file)
@@ -34,7 +34,7 @@
 .\"
 .\" $FreeBSD: head/share/man/man4/mrsas.4 267182 2014-06-06 19:00:43Z joel $
 .\"
-.Dd July 18, 2014
+.Dd November 28, 2014
 .Dt MRSAS 4
 .Os
 .Sh NAME
@@ -196,14 +196,14 @@ hw.mrsasX.mrsas_fw_fault_check_delay=NN
 where NN is the fault check delay value in seconds.
 .Pp
 The current number of active I/O commands is shown in the
-.Va hw.mrsasX.fw_outstanding
+.Va dev.mrsas.X.fw_outstanding
 .Xr sysctl 8
 variable.
 .Sh DEBUGGING
 To enable debugging prints from the
 .Nm
 driver, set the
-.Va hw.mrsas.X.debug_level
+.Va dev.mrsas.X.debug_level
 variable, where X is the adapter number, either in
 .Xr loader.conf 5
 or via
index c6edc61..c8c855f 100644 (file)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/mxge.4,v 1.7.4.2.4.1 2009/04/15 03:14:26 kensmith Exp $
 .\"
-.Dd October 27, 2013
+.Dd November 28, 2014
 .Dt MXGE 4
 .Os
 .Sh NAME
@@ -153,7 +153,7 @@ The default value is 1.
 .El
 .Sh MIB Variables
 A number of per-interface variables are implemented in the
-.Va hw.mxge Ns Em X
+.Va dev.mxge. Ns Em X
 branch of the
 .Xr sysctl 3
 MIB.
index b649253..357b63d 100644 (file)
@@ -14,7 +14,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd July 12, 2008
+.Dd November 28, 2014
 .Dt NFE 4
 .Os
 .Sh NAME
@@ -61,7 +61,7 @@ Set 1000Mbps (Gigabit Ethernet) operation (recent models only).
 .El
 .Ss MIB Variables and Loader Tunables
 The following per-interface variables are implemented in the
-.Va hw.nfe Ns Em X
+.Va dev.nfe. Ns Em X
 branch of the
 .Xr sysctl 3
 MIB.
index 80e2eb4..9e0ce47 100644 (file)
@@ -36,7 +36,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/oce.4,v 1.7 2013/07/07 00:30:13 svnexp Exp $
 .\"
-.Dd July 1, 2013
+.Dd November 28, 2014
 .Dt OCE 4
 .Os
 .Sh NAME
@@ -104,7 +104,7 @@ Copy Makefile and UFI file to a directory
 .It
 Execute make & make install
 .It
-sysctl hw.oce<if_id>.fw_upgrade=elxflash
+sysctl dev.oce.<if_id>.fw_upgrade=elxflash
 .It
 Reboot the machine
 .El
index decacf0..4b77443 100644 (file)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 2, 2006
+.Dd November 28, 2014
 .Dt RE 4
 .Os
 .Sh NAME
@@ -142,7 +142,7 @@ driver supports
 .Xr polling 4 .
 .Ss MIB Variables
 A number of per-interface variables are implemented in the
-.Va hw.re Ns Em X
+.Va dev.re. Ns Em X
 branch of the
 .Xr sysctl 3
 MIB.
index 42e2d8c..fe13a6b 100644 (file)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD: head/share/man/man4/ufoma.4 233648 2012-03-29 05:02:12Z eadler $
 .\"
-.Dd March 15, 2014
+.Dd November 28, 2014
 .Dt UFOMA 4
 .Os
 .Sh NAME
@@ -72,34 +72,34 @@ The device is accessed through the
 .Xr ucom 4
 driver which makes it behave like a
 .Xr tty 4 .
-.\".Sh SYSCTLS
-.\"These devices often have a few interface sets and these interfaces
-.\"have their role, sometimes multiplexed.
-.\"These roles are identified with the following sysctl MIBs:
-.\".Bl -tag -width indent
-.\".It Va dev.ucom.%d.supportmode
-.\"The modes which are supported by the interface.
-.\".It Va dev.ucom.%d.currentmode
-.\"Current mode of the interface.
-.\".It Va dev.ucom.%d.openmode
-.\"Mode to transit when the device is open next.
-.\".El
-.\"The modes are as follows:
-.\".Bl -tag -width indent
-.\".It Li modem
-.\"Accepts AT commands and go and pass packet communication data.
-.\".It Li handsfree
-.\"Accepts AT commands but it does not pass data.
-.\".It Li obex
-.\"Accepts OBEX frame which is used to exchange telephone book, etc.
-.\".It Li vendor1 , vendor2
-.\"Vendor specific data may be passed.
-.\".It Li deactivated
-.\"When an interface is recognized by the system but not used, the interface
-.\"will be set to this mode.
-.\".It Li unlinked
-.\"When an interface is not yet negotiated, the interface is in this mode.
-.\".El
+.Sh SYSCTLS
+These devices often have a few interface sets and these interfaces
+have their role, sometimes multiplexed.
+These roles are identified with the following sysctl MIBs:
+.Bl -tag -width indent
+.It Va dev.ucom.%d.supportmode
+The modes which are supported by the interface.
+.It Va dev.ucom.%d.currentmode
+Current mode of the interface.
+.It Va dev.ucom.%d.openmode
+Mode to transit when the device is open next.
+.El
+The modes are as follows:
+.Bl -tag -width indent
+.It Li modem
+Accepts AT commands and go and pass packet communication data.
+.It Li handsfree
+Accepts AT commands but it does not pass data.
+.It Li obex
+Accepts OBEX frame which is used to exchange telephone book, etc.
+.It Li vendor1 , vendor2
+Vendor specific data may be passed.
+.It Li deactivated
+When an interface is recognized by the system but not used, the interface
+will be set to this mode.
+.It Li unlinked
+When an interface is not yet negotiated, the interface is in this mode.
+.El
 .Sh HARDWARE
 Devices supported by the
 .Nm
index 37ebffc..ca79b92 100644 (file)
@@ -168,8 +168,6 @@ struct ufoma_softc {
        struct ucom_softc sc_ucom;
        struct cv sc_cv;
        struct lock sc_lock;
-       struct sysctl_ctx_list sc_sysctl_ctx;
-       struct sysctl_oid *sc_sysctl_tree;
 
        struct usb_xfer *sc_ctrl_xfer[UFOMA_CTRL_ENDPT_MAX];
        struct usb_xfer *sc_bulk_xfer[UFOMA_BULK_ENDPT_MAX];
@@ -371,6 +369,8 @@ ufoma_attach(device_t dev)
        struct ufoma_softc *sc = device_get_softc(dev);
        struct usb_config_descriptor *cd;
        struct usb_interface_descriptor *id;
+       struct sysctl_ctx_list *sctx;
+       struct sysctl_oid *soid;
 
        usb_mcpc_acm_descriptor *mad;
        uint8_t elements;
@@ -454,35 +454,21 @@ ufoma_attach(device_t dev)
        ucom_set_pnpinfo_usb(&sc->sc_super_ucom, dev);
 
        /*Sysctls*/
-       sysctl_ctx_init(&sc->sc_sysctl_ctx);
-       sc->sc_sysctl_tree = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx,
-           SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-           device_get_nameunit(sc->sc_dev), CTLFLAG_RD, 0, "");
-       if (sc->sc_sysctl_tree == NULL) {
-               DPRINTF("can't add sysctl node\n");
-               goto detach;
-       }
+       sctx = device_get_sysctl_ctx(dev);
+       soid = device_get_sysctl_tree(dev);
 
-       SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree),
-                       OID_AUTO, "supportmode",
+       SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "supportmode",
                        CTLFLAG_RD|CTLTYPE_STRING, sc, 0, ufoma_sysctl_support,
                        "A", "Supporting port role");
 
-       SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree),
-                       OID_AUTO, "currentmode",
+       SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "currentmode",
                        CTLFLAG_RD|CTLTYPE_STRING, sc, 0, ufoma_sysctl_current,
                        "A", "Current port role");
 
-       SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree),
-                       OID_AUTO, "openmode",
+       SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "openmode",
                        CTLFLAG_RW|CTLTYPE_STRING, sc, 0, ufoma_sysctl_open,
                        "A", "Mode to transit when port is opened");
-       SYSCTL_ADD_UINT(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree),
-                       OID_AUTO, "comunit",
+       SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "comunit",
                        CTLFLAG_RD, &(sc->sc_super_ucom.sc_unit), 0, 
                        "Unit number as USB serial");
 
@@ -507,7 +493,6 @@ ufoma_detach(device_t dev)
        }
        lockuninit(&sc->sc_lock);
        cv_destroy(&sc->sc_cv);
-       sysctl_ctx_free(&sc->sc_sysctl_ctx);
 
        return (0);
 }
index d801141..64a8be0 100644 (file)
@@ -542,9 +542,6 @@ struct ahci_softc {
        u_int32_t               sc_ccc_ports;
        u_int32_t               sc_ccc_ports_cur;
 #endif
-
-       struct sysctl_ctx_list  sysctl_ctx;
-       struct sysctl_oid       *sysctl_tree;
 };
 #define DEVNAME(_s)            ((_s)->sc_dev.dv_xname)
 
index b1bd17d..8bdd2dc 100644 (file)
@@ -108,8 +108,6 @@ static int
 ahci_attach (device_t dev)
 {
        struct ahci_softc *sc = device_get_softc(dev);
-       char name[16];
-       int error;
 
        sc->sc_ad = ahci_lookup_device(dev);
        if (sc->sc_ad == NULL)
@@ -132,19 +130,7 @@ ahci_attach (device_t dev)
        if (kgetenv("hint.ahci.forcefbss"))
                sc->sc_flags |= AHCI_F_FORCE_FBSS;
 
-       sysctl_ctx_init(&sc->sysctl_ctx);
-       ksnprintf(name, sizeof(name), "%s%d",
-               device_get_name(dev), device_get_unit(dev));
-       sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
-                               SYSCTL_STATIC_CHILDREN(_hw),
-                               OID_AUTO, name, CTLFLAG_RD, 0, "");
-
-       error = sc->sc_ad->ad_attach(dev);
-       if (error) {
-               sysctl_ctx_free(&sc->sysctl_ctx);
-               sc->sysctl_tree = NULL;
-       }
-       return (error);
+       return (sc->sc_ad->ad_attach(dev));
 }
 
 static int
@@ -153,10 +139,6 @@ ahci_detach (device_t dev)
        struct ahci_softc *sc = device_get_softc(dev);
        int error = 0;
 
-       if (sc->sysctl_tree) {
-               sysctl_ctx_free(&sc->sysctl_ctx);
-               sc->sysctl_tree = NULL;
-       }
        if (sc->sc_ad) {
                error = sc->sc_ad->ad_detach(dev);
                sc->sc_ad = NULL;
@@ -257,6 +239,7 @@ ahci_os_hardsleep(int us)
 void
 ahci_os_start_port(struct ahci_port *ap)
 {
+       struct sysctl_oid *soid;
        char name[16];
 
        atomic_set_int(&ap->ap_signal, AP_SIGF_INIT | AP_SIGF_THREAD_SYNC);
@@ -265,8 +248,9 @@ ahci_os_start_port(struct ahci_port *ap)
        lockinit(&ap->ap_sig_lock, "ahport", 0, 0);
        sysctl_ctx_init(&ap->sysctl_ctx);
        ksnprintf(name, sizeof(name), "%d", ap->ap_num);
+       soid = device_get_sysctl_tree(ap->ap_sc->sc_dev);
        ap->sysctl_tree = SYSCTL_ADD_NODE(&ap->sysctl_ctx,
-                               SYSCTL_CHILDREN(ap->ap_sc->sysctl_tree),
+                               SYSCTL_CHILDREN(soid),
                                OID_AUTO, name, CTLFLAG_RD, 0, "");
 
        if ((ap->ap_sc->sc_cap & AHCI_REG_CAP_SALP) &&
index 220e469..45a03a2 100644 (file)
@@ -171,10 +171,12 @@ isp_attach_chan(ispsoftc_t *isp, struct cam_devq *devq, int chan)
                }
 #endif
                if (chan == 0) {
-                       SYSCTL_ADD_QUAD(&isp->isp_sysctl_ctx, SYSCTL_CHILDREN(isp->isp_sysctl_tree), OID_AUTO, "wwnn", CTLFLAG_RD, &FCPARAM(isp, 0)->isp_wwnn, 0, "World Wide Node Name");
-                       SYSCTL_ADD_QUAD(&isp->isp_sysctl_ctx, SYSCTL_CHILDREN(isp->isp_sysctl_tree), OID_AUTO, "wwpn", CTLFLAG_RD, &FCPARAM(isp, 0)->isp_wwpn, 0, "World Wide Port Name");
-                       SYSCTL_ADD_UINT(&isp->isp_sysctl_ctx, SYSCTL_CHILDREN(isp->isp_sysctl_tree), OID_AUTO, "loop_down_limit", CTLFLAG_RW, &ISP_FC_PC(isp, 0)->loop_down_limit, 0, "Loop Down Limit");
-                       SYSCTL_ADD_UINT(&isp->isp_sysctl_ctx, SYSCTL_CHILDREN(isp->isp_sysctl_tree), OID_AUTO, "gone_device_time", CTLFLAG_RW, &ISP_FC_PC(isp, 0)->gone_device_time, 0, "Gone Device Time");
+                       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(isp->isp_osinfo.dev);
+                       struct sysctl_oid *tree = device_get_sysctl_tree(isp->isp_osinfo.dev);
+                       SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "wwnn", CTLFLAG_RD, &FCPARAM(isp, 0)->isp_wwnn, 0, "World Wide Node Name");
+                       SYSCTL_ADD_QUAD(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "wwpn", CTLFLAG_RD, &FCPARAM(isp, 0)->isp_wwpn, 0, "World Wide Port Name");
+                       SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "loop_down_limit", CTLFLAG_RW, &ISP_FC_PC(isp, 0)->loop_down_limit, 0, "Loop Down Limit");
+                       SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "gone_device_time", CTLFLAG_RW, &ISP_FC_PC(isp, 0)->gone_device_time, 0, "Gone Device Time");
                }
        }
        return (0);
@@ -210,14 +212,6 @@ isp_attach(ispsoftc_t *isp)
                return (EIO);
        }
 
-       sysctl_ctx_init(&isp->isp_sysctl_ctx);
-       isp->isp_sysctl_tree = SYSCTL_ADD_NODE(&isp->isp_sysctl_ctx,
-           SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-           device_get_nameunit(isp->isp_dev), CTLFLAG_RD, 0, "");
-       if (isp->isp_sysctl_tree == NULL) {
-               device_printf(isp->isp_dev, "can't add sysctl node\n");
-               return (EINVAL);
-       }
        for (chan = 0; chan < isp->isp_nchan; chan++) {
                if (isp_attach_chan(isp, isp->isp_osinfo.devq, chan)) {
                        goto unwind;
@@ -319,8 +313,6 @@ isp_detach(ispsoftc_t *isp)
        if (isp->isp_osinfo.devq != NULL) {
                isp->isp_osinfo.devq = NULL;
        }
-       if (isp->isp_sysctl_tree != NULL)
-               sysctl_ctx_free(&isp->isp_sysctl_ctx);
        return (0);
 }
 
index b30c166..855217f 100644 (file)
@@ -219,8 +219,6 @@ struct isposinfo {
        struct cdev *           cdev;
        struct intr_config_hook ehook;
        struct cam_devq *       devq;
-       struct sysctl_ctx_list  sysctl_ctx;
-       struct sysctl_oid       *sysctl_tree;
 
        /*
         * Firmware pointer
@@ -586,8 +584,6 @@ default:                                                    \
 #define        SIMQFRZ_TIMED           0x4
 
 #define        isp_dev         isp_osinfo.dev
-#define        isp_sysctl_ctx  isp_osinfo.sysctl_ctx
-#define        isp_sysctl_tree isp_osinfo.sysctl_tree
 
 /*
  * prototypes for isp_pci && isp_freebsd to share
index 3baee2d..a9bbe1b 100644 (file)
@@ -2144,17 +2144,17 @@ mpt_disable_ints(struct mpt_softc *mpt)
 static void
 mpt_sysctl_attach(struct mpt_softc *mpt)
 {
-       SYSCTL_ADD_UINT(&mpt->mpt_sysctl_ctx,
-                      SYSCTL_CHILDREN(mpt->mpt_sysctl_tree), OID_AUTO,
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(mpt->dev);
+       struct sysctl_oid *tree = device_get_sysctl_tree(mpt->dev);
+
+       SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "debug", CTLFLAG_RW, &mpt->verbose, 0,
                       "Debugging/Verbose level");
-       SYSCTL_ADD_UINT(&mpt->mpt_sysctl_ctx,
-                      SYSCTL_CHILDREN(mpt->mpt_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "role", CTLFLAG_RD, &mpt->role, 0,
                       "HBA role");
 #ifdef MPT_TEST_MULTIPATH
-       SYSCTL_ADD_INT(&mpt->mpt_sysctl_ctx,
-                      SYSCTL_CHILDREN(mpt->mpt_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "failure_id", CTLFLAG_RW, &mpt->failure_id, -1,
                       "Next Target to Fail");
 #endif
@@ -2279,14 +2279,6 @@ mpt_core_attach(struct mpt_softc *mpt)
        mpt->failure_id = -1;
 #endif
        mpt->scsi_tgt_handler_id = MPT_HANDLER_ID_NONE;
-       sysctl_ctx_init(&mpt->mpt_sysctl_ctx);
-       mpt->mpt_sysctl_tree = SYSCTL_ADD_NODE(&mpt->mpt_sysctl_ctx,
-           SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-           device_get_nameunit(mpt->dev), CTLFLAG_RD, 0, "");
-       if (mpt->mpt_sysctl_tree == NULL) {
-               device_printf(mpt->dev, "can't add sysctl node\n");
-               return (EINVAL);
-       }
        mpt_sysctl_attach(mpt);
        mpt_lprt(mpt, MPT_PRT_DEBUG, "doorbell req = %s\n",
            mpt_ioc_diag(mpt_read(mpt, MPT_OFFSET_DOORBELL)));
@@ -2373,9 +2365,6 @@ mpt_core_detach(struct mpt_softc *mpt)
        }
 
        mpt_dma_buf_free(mpt);
-
-       if (mpt->mpt_sysctl_tree != NULL)
-               sysctl_ctx_free(&mpt->mpt_sysctl_ctx);
 }
 
 static int
index 45f0670..c469c77 100644 (file)
@@ -736,9 +736,6 @@ struct mpt_softc {
        /* Userland management interface. */
        struct cdev             *cdev;
 
-       struct sysctl_ctx_list          mpt_sysctl_ctx;
-       struct sysctl_oid               *mpt_sysctl_tree;
-
        TAILQ_ENTRY(mpt_softc)  links;
 };
 
index c5d6e81..b8a9104 100644 (file)
@@ -407,6 +407,8 @@ cleanup:
 static int
 mpt_read_config_info_fc(struct mpt_softc *mpt)
 {
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid *tree;
        char *topology = NULL;
        int rv;
 
@@ -465,28 +467,27 @@ mpt_read_config_info_fc(struct mpt_softc *mpt)
            mpt->mpt_fcport_page0.WWPN.Low,
            mpt->mpt_fcport_speed);
        MPT_UNLOCK(mpt);
-       {
-               ksnprintf(mpt->scinfo.fc.wwnn,
-                   sizeof (mpt->scinfo.fc.wwnn), "0x%08x%08x",
-                   mpt->mpt_fcport_page0.WWNN.High,
-                   mpt->mpt_fcport_page0.WWNN.Low);
+       ctx = device_get_sysctl_ctx(mpt->dev);
+       tree = device_get_sysctl_tree(mpt->dev);
 
-               ksnprintf(mpt->scinfo.fc.wwpn,
-                   sizeof (mpt->scinfo.fc.wwpn), "0x%08x%08x",
-                   mpt->mpt_fcport_page0.WWPN.High,
-                   mpt->mpt_fcport_page0.WWPN.Low);
+       ksnprintf(mpt->scinfo.fc.wwnn,
+           sizeof (mpt->scinfo.fc.wwnn), "0x%08x%08x",
+           mpt->mpt_fcport_page0.WWNN.High,
+           mpt->mpt_fcport_page0.WWNN.Low);
 
-               SYSCTL_ADD_STRING(&mpt->mpt_sysctl_ctx,
-                      SYSCTL_CHILDREN(mpt->mpt_sysctl_tree), OID_AUTO,
-                      "wwnn", CTLFLAG_RD, mpt->scinfo.fc.wwnn, 0,
-                      "World Wide Node Name");
+       ksnprintf(mpt->scinfo.fc.wwpn,
+           sizeof (mpt->scinfo.fc.wwpn), "0x%08x%08x",
+           mpt->mpt_fcport_page0.WWPN.High,
+           mpt->mpt_fcport_page0.WWPN.Low);
 
-               SYSCTL_ADD_STRING(&mpt->mpt_sysctl_ctx,
-                      SYSCTL_CHILDREN(mpt->mpt_sysctl_tree), OID_AUTO,
-                      "wwpn", CTLFLAG_RD, mpt->scinfo.fc.wwpn, 0,
-                      "World Wide Port Name");
+       SYSCTL_ADD_STRING(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+              "wwnn", CTLFLAG_RD, mpt->scinfo.fc.wwnn, 0,
+              "World Wide Node Name");
+
+       SYSCTL_ADD_STRING(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
+              "wwpn", CTLFLAG_RD, mpt->scinfo.fc.wwpn, 0,
+              "World Wide Port Name");
 
-       }
        MPT_LOCK(mpt);
        return (0);
 }
index b00738e..f44dee2 100644 (file)
@@ -1828,25 +1828,24 @@ mpt_raid_sysctl_vol_queue_depth(SYSCTL_HANDLER_ARGS)
 static void
 mpt_raid_sysctl_attach(struct mpt_softc *mpt)
 {
-       SYSCTL_ADD_PROC(&mpt->mpt_sysctl_ctx,
-                       SYSCTL_CHILDREN(mpt->mpt_sysctl_tree), OID_AUTO,
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(mpt->dev);
+       struct sysctl_oid *tree = device_get_sysctl_tree(mpt->dev);
+
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                        "vol_member_wce", CTLTYPE_STRING | CTLFLAG_RW, mpt, 0,
                        mpt_raid_sysctl_vol_member_wce, "A",
                        "volume member WCE(On,Off,On-During-Rebuild,NC)");
 
-       SYSCTL_ADD_PROC(&mpt->mpt_sysctl_ctx,
-                       SYSCTL_CHILDREN(mpt->mpt_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                        "vol_queue_depth", CTLTYPE_INT | CTLFLAG_RW, mpt, 0,
                        mpt_raid_sysctl_vol_queue_depth, "I",
                        "default volume queue depth");
 
-       SYSCTL_ADD_PROC(&mpt->mpt_sysctl_ctx,
-                       SYSCTL_CHILDREN(mpt->mpt_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                        "vol_resync_rate", CTLTYPE_INT | CTLFLAG_RW, mpt, 0,
                        mpt_raid_sysctl_vol_resync_rate, "I",
                        "volume resync priority (0 == NC, 1 - 255)");
-       SYSCTL_ADD_UINT(&mpt->mpt_sysctl_ctx,
-                       SYSCTL_CHILDREN(mpt->mpt_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                        "nonoptimal_volumes", CTLFLAG_RD,
                        &mpt->raid_nonopt_volumes, 0,
                        "number of nonoptimal volumes");
index b3ba37b..a28db9c 100644 (file)
@@ -262,6 +262,8 @@ acx_attach(device_t dev)
        struct acx_softc *sc;
        struct ifnet *ifp;
        struct ieee80211com *ic;
+       struct sysctl_ctx_list *sctx;
+       struct sysctl_oid *soid;
        int i, error;
 
        sc = device_get_softc(dev);
@@ -392,47 +394,30 @@ acx_attach(device_t dev)
        sc->sc_scan_dwell = 200;        /* 200 milliseconds */
        sc->sc_calib_intvl = 3 * 60;    /* 3 minutes */
 
-       sysctl_ctx_init(&sc->sc_sysctl_ctx);
-       sc->sc_sysctl_tree = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx,
-                                            SYSCTL_STATIC_CHILDREN(_hw),
-                                            OID_AUTO,
-                                            device_get_nameunit(dev),
-                                            CTLFLAG_RD, 0, "");
-       if (sc->sc_sysctl_tree == NULL) {
-               device_printf(dev, "can't add sysctl node\n");
-               error = ENXIO;
-               goto fail;
-       }
-       SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree),
-                       OID_AUTO, "msdu_lifetime",
-                       CTLTYPE_INT | CTLFLAG_RW,
+       sctx = device_get_sysctl_ctx(dev);
+       soid = device_get_sysctl_tree(dev);
+       SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
+                       "msdu_lifetime", CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, acx_sysctl_msdu_lifetime, "I",
                        "MSDU life time");
-       SYSCTL_ADD_INT(&sc->sc_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                       "long_retry_limit", CTLFLAG_RW,
                       &sc->sc_long_retry_limit, 0, "Long retry limit");
-       SYSCTL_ADD_INT(&sc->sc_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                       "scan_dwell", CTLFLAG_RW,
                       &sc->sc_scan_dwell, 0, "Scan channel dwell time (ms)");
-       SYSCTL_ADD_INT(&sc->sc_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                       "calib_intvl", CTLFLAG_RW,
                       &sc->sc_calib_intvl, 0, "Calibration interval (second)");
 
        /*
         * Nodes for firmware operation
         */
-       SYSCTL_ADD_INT(&sc->sc_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                       "combined_radio_fw", CTLFLAG_RW,
                       &sc->sc_firmware.combined_radio_fw, 0,
                       "Radio and base firmwares are combined");
-       SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree),
-                       OID_AUTO, "free_fw",
+       SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "free_fw",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, acx_sysctl_free_firmware, "I",
                        "Free firmware");
@@ -440,41 +425,32 @@ acx_attach(device_t dev)
        /*
         * Nodes for statistics
         */
-       SYSCTL_ADD_UQUAD(&sc->sc_sysctl_ctx,
-                        SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UQUAD(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                         "frag_error", CTLFLAG_RW, &sc->sc_stats.err_oth_frag,
                         0, "Fragment errors");
-       SYSCTL_ADD_UQUAD(&sc->sc_sysctl_ctx,
-                        SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UQUAD(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                         "tx_abort", CTLFLAG_RW, &sc->sc_stats.err_abort,
                         0, "TX abortions");
-       SYSCTL_ADD_UQUAD(&sc->sc_sysctl_ctx,
-                        SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UQUAD(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                         "tx_invalid", CTLFLAG_RW, &sc->sc_stats.err_param,
                         0, "Invalid TX param in TX descriptor");
-       SYSCTL_ADD_UQUAD(&sc->sc_sysctl_ctx,
-                        SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UQUAD(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                         "no_wepkey", CTLFLAG_RW, &sc->sc_stats.err_no_wepkey,
                         0, "No WEP key exists");
-       SYSCTL_ADD_UQUAD(&sc->sc_sysctl_ctx,
-                        SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UQUAD(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                         "msdu_timeout", CTLFLAG_RW,
                         &sc->sc_stats.err_msdu_timeout,
                         0, "MSDU timeouts");
-       SYSCTL_ADD_UQUAD(&sc->sc_sysctl_ctx,
-                        SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UQUAD(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                         "ex_txretry", CTLFLAG_RW, &sc->sc_stats.err_ex_retry,
                         0, "Excessive TX retries");
-       SYSCTL_ADD_UQUAD(&sc->sc_sysctl_ctx,
-                        SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UQUAD(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                         "buf_oflow", CTLFLAG_RW, &sc->sc_stats.err_buf_oflow,
                         0, "Buffer overflows");
-       SYSCTL_ADD_UQUAD(&sc->sc_sysctl_ctx,
-                        SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UQUAD(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                         "dma_error", CTLFLAG_RW, &sc->sc_stats.err_dma,
                         0, "DMA errors");
-       SYSCTL_ADD_UQUAD(&sc->sc_sysctl_ctx,
-                        SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UQUAD(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
                         "unkn_error", CTLFLAG_RW, &sc->sc_stats.err_unkn,
                         0, "Unknown errors");
 
@@ -583,9 +559,6 @@ acx_detach(device_t dev)
                ieee80211_ifdetach(ic);
        }
 
-       if (sc->sc_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->sc_sysctl_ctx);
-
        if (sc->sc_irq_res != NULL) {
                bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid,
                                     sc->sc_irq_res);
index deb0c10..31935a3 100644 (file)
@@ -30,8 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
- * $DragonFly: src/sys/dev/netif/acx/if_acxvar.h,v 1.14 2008/06/08 10:06:05 sephe Exp $
  */
 
 #ifndef _IF_ACXVAR_H
@@ -442,9 +440,6 @@ struct acx_softc {
 
        struct acx_stats        sc_stats;       /* statistics */
 
-       struct sysctl_ctx_list  sc_sysctl_ctx;
-       struct sysctl_oid       *sc_sysctl_tree;
-
        /*
         * TX rate control
         */
index 0593530..e453d0d 100644 (file)
@@ -394,18 +394,9 @@ ae_sysctl_node(struct ae_softc *sc)
        unsigned int i;
 
        ae_stats = &sc->stats;
-       sysctl_ctx_init(&sc->ae_sysctl_ctx);
-       sc->ae_sysctl_tree = SYSCTL_ADD_NODE(&sc->ae_sysctl_ctx,
-                               SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-                               device_get_nameunit(sc->ae_dev),
-                               CTLFLAG_RD, 0, "");
-       if (sc->ae_sysctl_tree == NULL) {
-               device_printf(sc->ae_dev, "can't add sysctl node\n");
-               return;
-       }
-       ctx = &sc->ae_sysctl_ctx;
-       root = sc->ae_sysctl_tree;
 
+       ctx = device_get_sysctl_ctx(sc->ae_dev);
+       root = device_get_sysctl_tree(sc->ae_dev);
        stats = SYSCTL_ADD_NODE(ctx, SYSCTL_CHILDREN(root), OID_AUTO, "stats",
            CTLFLAG_RD, NULL, "ae statistics");
        if (stats == NULL) {
@@ -1444,10 +1435,6 @@ ae_detach(device_t dev)
                bus_release_resource(dev, SYS_RES_MEMORY, sc->ae_mem_rid,
                                     sc->ae_mem_res);
        }
-
-       if (sc->ae_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->ae_sysctl_ctx);
-
        ae_dma_free(sc);
 
        return (0);
index f37009c..bd4b9b6 100644 (file)
@@ -152,8 +152,6 @@ struct ae_softc     {
        int                     wd_timer;       /* XXX remove */
 
        struct ae_stats         stats;
-       struct sysctl_ctx_list  ae_sysctl_ctx;
-       struct sysctl_oid       *ae_sysctl_tree;
 };
 
 #define        BUS_ADDR_LO(x)          ((uint64_t) (x) & 0xFFFFFFFF)
index 029b47d..22ab8af 100644 (file)
@@ -691,9 +691,6 @@ age_detach(device_t dev)
                ether_ifdetach(ifp);
        }
 
-       if (sc->age_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->age_sysctl_ctx);
-
        if (sc->age_miibus != NULL)
                device_delete_child(dev, sc->age_miibus);
        bus_generic_detach(dev);
@@ -715,25 +712,15 @@ age_detach(device_t dev)
 static void
 age_sysctl_node(struct age_softc *sc)
 {
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->age_dev);
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->age_dev);
        int error;
 
-       sysctl_ctx_init(&sc->age_sysctl_ctx);
-       sc->age_sysctl_tree = SYSCTL_ADD_NODE(&sc->age_sysctl_ctx,
-                               SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-                               device_get_nameunit(sc->age_dev),
-                               CTLFLAG_RD, 0, "");
-       if (sc->age_sysctl_tree == NULL) {
-               device_printf(sc->age_dev, "can't add sysctl node\n");
-               return;
-       }
-
-       SYSCTL_ADD_PROC(&sc->age_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->age_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "stats", CTLTYPE_INT | CTLFLAG_RW, sc, 0, sysctl_age_stats,
            "I", "Statistics");
 
-       SYSCTL_ADD_PROC(&sc->age_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->age_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "int_mod", CTLTYPE_INT | CTLFLAG_RW, &sc->age_int_mod, 0,
            sysctl_hw_age_int_mod, "I", "age interrupt moderation");
 
index d81132b..5c3dc0f 100644 (file)
@@ -223,9 +223,6 @@ struct age_softc {
        int                     age_max_frame_size;
        int                     age_rr_prod;
        int                     age_tpd_cons;
-
-       struct sysctl_ctx_list  age_sysctl_ctx;
-       struct sysctl_oid       *age_sysctl_tree;
 };
 
 /* Register access macros. */
index 749008b..b5a8148 100644 (file)
@@ -1040,18 +1040,8 @@ alc_sysctl_node(struct alc_softc *sc)
        int error;
 
        stats = &sc->alc_stats;
-       ctx = &sc->alc_sysctl_ctx;
-       sysctl_ctx_init(ctx);
-
-       tree = SYSCTL_ADD_NODE(ctx, SYSCTL_STATIC_CHILDREN(_hw),
-                              OID_AUTO,
-                              device_get_nameunit(sc->alc_dev),
-                              CTLFLAG_RD, 0, "");
-       if (tree == NULL) {
-               device_printf(sc->alc_dev, "can't add sysctl node\n");
-               return;
-       }
-       child = SYSCTL_CHILDREN(tree);
+       ctx = device_get_sysctl_ctx(sc->alc_dev);
+       child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->alc_dev));
 
        SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "int_rx_mod",
            CTLTYPE_INT | CTLFLAG_RW, &sc->alc_int_rx_mod, 0,
index c43bc3b..3edc340 100644 (file)
@@ -242,8 +242,6 @@ struct alc_softc {
        int                     alc_int_rx_mod;
        int                     alc_int_tx_mod;
        int                     alc_buf_size;
-
-       struct sysctl_ctx_list  alc_sysctl_ctx;
 };
 
 /* Register access macros. */
index 359da4d..e74b433 100644 (file)
@@ -665,9 +665,6 @@ ale_detach(device_t dev)
                ether_ifdetach(ifp);
        }
 
-       if (sc->ale_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->ale_sysctl_ctx);
-
        if (sc->ale_miibus != NULL)
                device_delete_child(dev, sc->ale_miibus);
        bus_generic_detach(dev);
@@ -700,19 +697,9 @@ ale_sysctl_node(struct ale_softc *sc)
        struct ale_hw_stats *stats;
        int error;
 
-       sysctl_ctx_init(&sc->ale_sysctl_ctx);
-       sc->ale_sysctl_tree = SYSCTL_ADD_NODE(&sc->ale_sysctl_ctx,
-                               SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-                               device_get_nameunit(sc->ale_dev),
-                               CTLFLAG_RD, 0, "");
-       if (sc->ale_sysctl_tree == NULL) {
-               device_printf(sc->ale_dev, "can't add sysctl node\n");
-               return;
-       }
-
        stats = &sc->ale_stats;
-       ctx = &sc->ale_sysctl_ctx;
-       child = SYSCTL_CHILDREN(sc->ale_sysctl_tree);
+       ctx = device_get_sysctl_ctx(sc->ale_dev);
+       child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ale_dev));
 
        SYSCTL_ADD_PROC(ctx, child, OID_AUTO, "int_rx_mod",
            CTLTYPE_INT | CTLFLAG_RW, &sc->ale_int_rx_mod, 0,
index 5127417..a50e103 100644 (file)
@@ -223,9 +223,6 @@ struct ale_softc {
        int                     ale_int_tx_mod;
        int                     ale_max_frame_size;
        int                     ale_pagesize;
-
-       struct sysctl_ctx_list  ale_sysctl_ctx;
-       struct sysctl_oid       *ale_sysctl_tree;
 };
 
 /* Register access macros. */
index 1c3b320..c80e416 100644 (file)
@@ -481,15 +481,6 @@ ath_attach(u_int16_t devid, struct ath_softc *sc)
 
        sc->sc_rxfifo_state = ATH_RXFIFO_RESET;
 
-       /* prepare sysctl tree for use in sub modules */
-       sysctl_ctx_init(&sc->sc_sysctl_ctx);
-       sc->sc_sysctl_tree = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx,
-               SYSCTL_STATIC_CHILDREN(_hw),
-               OID_AUTO,
-               device_get_nameunit(sc->sc_dev),
-               CTLFLAG_RD, 0, "");
-
-
        ah = ath_hal_attach(devid, sc, sc->sc_st, sc->sc_sh,
            sc->sc_eepromdata, &status);
        if (ah == NULL) {
@@ -1278,11 +1269,6 @@ ath_detach(struct ath_softc *sc)
        if_free(ifp);
        CURVNET_RESTORE();
 
-       if (sc->sc_sysctl_tree) {
-               sysctl_ctx_free(&sc->sc_sysctl_ctx);
-               sc->sc_sysctl_tree = NULL;
-       }
-
        return 0;
 }
 
index 9610128..7bf9f36 100644 (file)
@@ -684,8 +684,8 @@ done:
 static void
 ath_sysctl_alq_attach(struct ath_softc *sc)
 {
-       struct sysctl_oid *tree = sc->sc_sysctl_tree;
-       struct sysctl_ctx_list *ctx = &sc->sc_sysctl_ctx;
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
        struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
 
        tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "alq", CTLFLAG_RD,
@@ -712,8 +712,8 @@ ath_sysctl_alq_attach(struct ath_softc *sc)
 void
 ath_sysctlattach(struct ath_softc *sc)
 {
-       struct sysctl_ctx_list *ctx = &sc->sc_sysctl_ctx;
-       struct sysctl_oid *tree = sc->sc_sysctl_tree;
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
        struct ath_hal *ah = sc->sc_ah;
 
        SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
@@ -926,8 +926,8 @@ ath_sysctl_clearstats(SYSCTL_HANDLER_ARGS)
 static void
 ath_sysctl_stats_attach_rxphyerr(struct ath_softc *sc, struct sysctl_oid_list *parent)
 {
-       struct sysctl_ctx_list *ctx = &sc->sc_sysctl_ctx;
-       struct sysctl_oid *tree = sc->sc_sysctl_tree;
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
        struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
        int i;
        char sn[8];
@@ -944,8 +944,8 @@ static void
 ath_sysctl_stats_attach_intr(struct ath_softc *sc,
     struct sysctl_oid_list *parent)
 {
-       struct sysctl_ctx_list *ctx = &sc->sc_sysctl_ctx;
-       struct sysctl_oid *tree = sc->sc_sysctl_tree;
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
        struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
        int i;
        char sn[8];
@@ -963,8 +963,8 @@ ath_sysctl_stats_attach_intr(struct ath_softc *sc,
 void
 ath_sysctl_stats_attach(struct ath_softc *sc)
 {
-       struct sysctl_oid *tree = sc->sc_sysctl_tree;
-       struct sysctl_ctx_list *ctx = &sc->sc_sysctl_ctx;
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
        struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
  
        /* Create "clear" node */
@@ -1206,8 +1206,8 @@ ath_sysctl_stats_attach(struct ath_softc *sc)
 void
 ath_sysctl_hal_attach(struct ath_softc *sc)
 {
-       struct sysctl_oid *tree = sc->sc_sysctl_tree;
-       struct sysctl_ctx_list *ctx = &sc->sc_sysctl_ctx;
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
        struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
 
        tree = SYSCTL_ADD_NODE(ctx, child, OID_AUTO, "hal", CTLFLAG_RD,
index 643915a..aaa148f 100644 (file)
@@ -547,8 +547,6 @@ struct ath_softc {
        struct ath_stats        sc_stats;       /* interface statistics */
        struct ath_tx_aggr_stats        sc_aggr_stats;
        struct ath_intr_stats   sc_intr_stats;
-       struct sysctl_ctx_list  sc_sysctl_ctx;
-       struct sysctl_oid       *sc_sysctl_tree;
        uint64_t                sc_debug;
        uint64_t                sc_ktrdebug;
        int                     sc_nvaps;       /* # vaps */
index 38b2e08..eeb5e1f 100644 (file)
@@ -427,8 +427,8 @@ ath_rate_fetch_node_stats(struct ath_softc *sc, struct ath_node *an,
 static void
 ath_rate_sysctlattach(struct ath_softc *sc)
 {
-       struct sysctl_ctx_list *ctx = &sc->sc_sysctl_ctx;
-       struct sysctl_oid *tree = sc->sc_sysctl_tree;
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
 
        SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                "rate_interval", CTLFLAG_RW, &ath_rateinterval, 0,
index 5e4d434..8f8e999 100644 (file)
@@ -387,8 +387,8 @@ ath_rate_ctl(void *arg, struct ieee80211_node *ni)
 static void
 ath_rate_sysctlattach(struct ath_softc *sc)
 {
-       struct sysctl_ctx_list *ctx = &sc->sc_sysctl_ctx;
-       struct sysctl_oid *tree = sc->sc_sysctl_tree;
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
 
        SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                "rate_interval", CTLFLAG_RW, &ath_rateinterval, 0,
index a4ef45a..eea27ab 100644 (file)
@@ -1346,8 +1346,8 @@ ath_rate_sysctl_sample_rate(SYSCTL_HANDLER_ARGS)
 static void
 ath_rate_sysctlattach(struct ath_softc *sc, struct sample_softc *ssc)
 {
-       struct sysctl_ctx_list *ctx = &sc->sc_sysctl_ctx;
-       struct sysctl_oid *tree = sc->sc_sysctl_tree;
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
 
        SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "smoothing_rate", CTLTYPE_INT | CTLFLAG_RW, ssc, 0,
index 2fcf804..2c6d673 100644 (file)
@@ -1122,9 +1122,6 @@ bce_detach(device_t dev)
 
        bce_dma_free(sc);
 
-       if (sc->bce_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->bce_sysctl_ctx);
-
        if (sc->serializes != NULL)
                kfree(sc->serializes, M_DEVBUF);
 
@@ -6050,19 +6047,8 @@ bce_add_sysctls(struct bce_softc *sc)
        int i;
 #endif
 
-       sysctl_ctx_init(&sc->bce_sysctl_ctx);
-       sc->bce_sysctl_tree = SYSCTL_ADD_NODE(&sc->bce_sysctl_ctx,
-                                             SYSCTL_STATIC_CHILDREN(_hw),
-                                             OID_AUTO,
-                                             device_get_nameunit(sc->bce_dev),
-                                             CTLFLAG_RD, 0, "");
-       if (sc->bce_sysctl_tree == NULL) {
-               device_printf(sc->bce_dev, "can't add sysctl node\n");
-               return;
-       }
-
-       ctx = &sc->bce_sysctl_ctx;
-       children = SYSCTL_CHILDREN(sc->bce_sysctl_tree);
+       ctx = device_get_sysctl_ctx(sc->bce_dev);
+       children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bce_dev));
 
        SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tx_bds_int",
                        CTLTYPE_INT | CTLFLAG_RW,
index fbcc08a..9fdff3f 100644 (file)
@@ -27,7 +27,6 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/bce/if_bcereg.h,v 1.13 2007/05/16 23:34:11 davidch Exp $
- * $DragonFly: src/sys/dev/netif/bce/if_bcereg.h,v 1.3 2008/06/15 05:14:41 sephe Exp $
  */
 
 #ifndef        _BCE_H_DEFINED
@@ -6085,8 +6084,6 @@ struct bce_softc {
        struct bce_rx_ring      *rx_rings;
 
        int                     bce_if_flags;
-       struct sysctl_ctx_list  bce_sysctl_ctx;
-       struct sysctl_oid       *bce_sysctl_tree;
 
        /* Provides access to hardware statistics through sysctl. */
        uint64_t stat_IfHCInOctets;
index f593d77..573abfd 100644 (file)
@@ -2028,6 +2028,8 @@ bge_attach(device_t dev)
 {
        struct ifnet *ifp;
        struct bge_softc *sc;
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid_list *tree;
        uint32_t hwcfg = 0, misccfg;
        int error = 0, rid, capmask;
        uint8_t ether_addr[ETHER_ADDR_LEN];
@@ -2591,49 +2593,27 @@ again:
                        BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);
        }
 
-       /*
-        * Create sysctl nodes.
-        */
-       sysctl_ctx_init(&sc->bge_sysctl_ctx);
-       sc->bge_sysctl_tree = SYSCTL_ADD_NODE(&sc->bge_sysctl_ctx,
-                                             SYSCTL_STATIC_CHILDREN(_hw),
-                                             OID_AUTO,
-                                             device_get_nameunit(dev),
-                                             CTLFLAG_RD, 0, "");
-       if (sc->bge_sysctl_tree == NULL) {
-               device_printf(dev, "can't add sysctl node\n");
-               error = ENXIO;
-               goto fail;
-       }
+       ctx = device_get_sysctl_ctx(sc->bge_dev);
+       tree = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bge_dev));
 
-       SYSCTL_ADD_PROC(&sc->bge_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->bge_sysctl_tree),
-                       OID_AUTO, "rx_coal_ticks",
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "rx_coal_ticks",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, bge_sysctl_rx_coal_ticks, "I",
                        "Receive coalescing ticks (usec).");
-       SYSCTL_ADD_PROC(&sc->bge_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->bge_sysctl_tree),
-                       OID_AUTO, "tx_coal_ticks",
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "tx_coal_ticks",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, bge_sysctl_tx_coal_ticks, "I",
                        "Transmit coalescing ticks (usec).");
-       SYSCTL_ADD_PROC(&sc->bge_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->bge_sysctl_tree),
-                       OID_AUTO, "rx_coal_bds",
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "rx_coal_bds",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, bge_sysctl_rx_coal_bds, "I",
                        "Receive max coalesced BD count.");
-       SYSCTL_ADD_PROC(&sc->bge_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->bge_sysctl_tree),
-                       OID_AUTO, "tx_coal_bds",
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "tx_coal_bds",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, bge_sysctl_tx_coal_bds, "I",
                        "Transmit max coalesced BD count.");
 
-       SYSCTL_ADD_INT(&sc->bge_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->bge_sysctl_tree),
-                      OID_AUTO, "tx_wreg", CTLFLAG_RW,
+       SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "tx_wreg", CTLFLAG_RW,
                       &sc->bge_tx_wreg, 0,
                       "# of segments before writing to hardware register");
 
@@ -2654,34 +2634,29 @@ again:
                 * consumes a lot of CPU cycles, so leave it off by
                 * default.
                 */
-               SYSCTL_ADD_INT(&sc->bge_sysctl_ctx,
-                              SYSCTL_CHILDREN(sc->bge_sysctl_tree),
-                              OID_AUTO, "force_defrag", CTLFLAG_RW,
+               SYSCTL_ADD_INT(ctx, tree, OID_AUTO,
+                              "force_defrag", CTLFLAG_RW,
                               &sc->bge_force_defrag, 0,
                               "Force defragment on TX path");
        }
        if (sc->bge_flags & BGE_FLAG_STATUS_TAG) {
                if (!BGE_IS_5705_PLUS(sc)) {
-                       SYSCTL_ADD_PROC(&sc->bge_sysctl_ctx,
-                           SYSCTL_CHILDREN(sc->bge_sysctl_tree), OID_AUTO,
+                       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
                            "rx_coal_ticks_int", CTLTYPE_INT | CTLFLAG_RW,
                            sc, 0, bge_sysctl_rx_coal_ticks_int, "I",
                            "Receive coalescing ticks "
                            "during interrupt (usec).");
-                       SYSCTL_ADD_PROC(&sc->bge_sysctl_ctx,
-                           SYSCTL_CHILDREN(sc->bge_sysctl_tree), OID_AUTO,
+                       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
                            "tx_coal_ticks_int", CTLTYPE_INT | CTLFLAG_RW,
                            sc, 0, bge_sysctl_tx_coal_ticks_int, "I",
                            "Transmit coalescing ticks "
                            "during interrupt (usec).");
                }
-               SYSCTL_ADD_PROC(&sc->bge_sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->bge_sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
                    "rx_coal_bds_int", CTLTYPE_INT | CTLFLAG_RW,
                    sc, 0, bge_sysctl_rx_coal_bds_int, "I",
                    "Receive max coalesced BD count during interrupt.");
-               SYSCTL_ADD_PROC(&sc->bge_sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->bge_sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
                    "tx_coal_bds_int", CTLTYPE_INT | CTLFLAG_RW,
                    sc, 0, bge_sysctl_tx_coal_bds_int, "I",
                    "Transmit max coalesced BD count during interrupt.");
@@ -2696,9 +2671,8 @@ again:
 
 #ifdef IFPOLL_ENABLE
        /* Polling setup */
-       ifpoll_compat_setup(&sc->bge_npoll,
-           &sc->bge_sysctl_ctx, sc->bge_sysctl_tree, device_get_unit(dev),
-           ifp->if_serializer);
+       ifpoll_compat_setup(&sc->bge_npoll, ctx, (struct sysctl_oid *)tree,
+           device_get_unit(dev), ifp->if_serializer);
 #endif
 
        if (sc->bge_irq_type == PCI_INTR_TYPE_MSI) {
@@ -2766,9 +2740,6 @@ bge_detach(device_t dev)
                    PCIR_BAR(2), sc->bge_res2);
        }
 
-       if (sc->bge_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->bge_sysctl_ctx);
-
        bge_dma_free(sc);
 
        return 0;
index eff3741..9628eb3 100644 (file)
@@ -31,7 +31,6 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.1.2.16 2004/09/23 20:11:18 ps Exp $
- * $DragonFly: src/sys/dev/netif/bge/if_bgereg.h,v 1.25 2008/10/22 14:24:24 sephe Exp $
  */
 
 #ifndef _IF_BGEVAR_H_
@@ -294,9 +293,6 @@ struct bge_softc {
        int                     bge_link_evt;
        struct callout          bge_stat_timer;
 
-       struct sysctl_ctx_list  bge_sysctl_ctx;
-       struct sysctl_oid       *bge_sysctl_tree;
-
        int                     bge_phyno;
        uint32_t                bge_coal_chg;
 #define BGE_RX_COAL_TICKS_CHG          0x01
index 2191023..c0d9270 100644 (file)
@@ -1836,6 +1836,8 @@ bnx_attach(device_t dev)
        struct ifnet *ifp;
        struct bnx_softc *sc;
        struct bnx_rx_std_ring *std;
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid_list *tree;
        uint32_t hwcfg = 0;
        int error = 0, rid, capmask, i, std_cpuid, std_cpuid_def;
        uint8_t ether_addr[ETHER_ADDR_LEN];
@@ -2325,61 +2327,35 @@ bnx_attach(device_t dev)
                }
        }
 
-       /*
-        * Create sysctl nodes.
-        */
-       sysctl_ctx_init(&sc->bnx_sysctl_ctx);
-       sc->bnx_sysctl_tree = SYSCTL_ADD_NODE(&sc->bnx_sysctl_ctx,
-                                             SYSCTL_STATIC_CHILDREN(_hw),
-                                             OID_AUTO,
-                                             device_get_nameunit(dev),
-                                             CTLFLAG_RD, 0, "");
-       if (sc->bnx_sysctl_tree == NULL) {
-               device_printf(dev, "can't add sysctl node\n");
-               error = ENXIO;
-               goto fail;
-       }
+       ctx = device_get_sysctl_ctx(sc->bnx_dev);
+       tree = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bnx_dev));
 
-       SYSCTL_ADD_INT(&sc->bnx_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, tree, OID_AUTO,
            "rx_rings", CTLFLAG_RD, &sc->bnx_rx_retcnt, 0, "# of RX rings");
-       SYSCTL_ADD_INT(&sc->bnx_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, tree, OID_AUTO,
            "tx_rings", CTLFLAG_RD, &sc->bnx_tx_ringcnt, 0, "# of TX rings");
 
-       SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->bnx_sysctl_tree),
-                       OID_AUTO, "rx_coal_ticks",
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "rx_coal_ticks",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, bnx_sysctl_rx_coal_ticks, "I",
                        "Receive coalescing ticks (usec).");
-       SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->bnx_sysctl_tree),
-                       OID_AUTO, "tx_coal_ticks",
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "tx_coal_ticks",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, bnx_sysctl_tx_coal_ticks, "I",
                        "Transmit coalescing ticks (usec).");
-       SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->bnx_sysctl_tree),
-                       OID_AUTO, "rx_coal_bds",
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "rx_coal_bds",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, bnx_sysctl_rx_coal_bds, "I",
                        "Receive max coalesced BD count.");
-       SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->bnx_sysctl_tree),
-                       OID_AUTO, "rx_coal_bds_poll",
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "rx_coal_bds_poll",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, bnx_sysctl_rx_coal_bds_poll, "I",
                        "Receive max coalesced BD count in polling.");
-       SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->bnx_sysctl_tree),
-                       OID_AUTO, "tx_coal_bds",
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "tx_coal_bds",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, bnx_sysctl_tx_coal_bds, "I",
                        "Transmit max coalesced BD count.");
-       SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->bnx_sysctl_tree),
-                       OID_AUTO, "tx_coal_bds_poll",
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "tx_coal_bds_poll",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, bnx_sysctl_tx_coal_bds_poll, "I",
                        "Transmit max coalesced BD count in polling.");
@@ -2399,50 +2375,42 @@ bnx_attach(device_t dev)
         * consumes a lot of CPU cycles, so leave it off by
         * default.
         */
-       SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
            "force_defrag", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, bnx_sysctl_force_defrag, "I",
            "Force defragment on TX path");
 
-       SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
            "tx_wreg", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, bnx_sysctl_tx_wreg, "I",
            "# of segments before writing to hardware register");
 
-       SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
            "std_refill", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, bnx_sysctl_std_refill, "I",
            "# of packets received before scheduling standard refilling");
 
-       SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
            "rx_coal_bds_int", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, bnx_sysctl_rx_coal_bds_int, "I",
            "Receive max coalesced BD count during interrupt.");
-       SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
            "tx_coal_bds_int", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, bnx_sysctl_tx_coal_bds_int, "I",
            "Transmit max coalesced BD count during interrupt.");
 
 #ifdef IFPOLL_ENABLE
        if (sc->bnx_flags & BNX_FLAG_RXTX_BUNDLE) {
-               SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
                    "npoll_offset", CTLTYPE_INT | CTLFLAG_RW,
                    sc, 0, bnx_sysctl_npoll_offset, "I",
                    "NPOLLING cpu offset");
        } else {
-               SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
                    "npoll_rxoff", CTLTYPE_INT | CTLFLAG_RW,
                    sc, 0, bnx_sysctl_npoll_rxoff, "I",
                    "NPOLLING RX cpu offset");
-               SYSCTL_ADD_PROC(&sc->bnx_sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_PROC(ctx, tree, OID_AUTO,
                    "npoll_txoff", CTLTYPE_INT | CTLFLAG_RW,
                    sc, 0, bnx_sysctl_npoll_txoff, "I",
                    "NPOLLING TX cpu offset");
@@ -2450,26 +2418,21 @@ bnx_attach(device_t dev)
 #endif
 
 #ifdef BNX_RSS_DEBUG
-       SYSCTL_ADD_INT(&sc->bnx_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, tree, OID_AUTO,
            "std_refill_mask", CTLFLAG_RD,
            &sc->bnx_rx_std_ring.bnx_rx_std_refill, 0, "");
-       SYSCTL_ADD_INT(&sc->bnx_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, tree, OID_AUTO,
            "std_used", CTLFLAG_RD,
            &sc->bnx_rx_std_ring.bnx_rx_std_used, 0, "");
-       SYSCTL_ADD_INT(&sc->bnx_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, tree, OID_AUTO,
            "rss_debug", CTLFLAG_RW, &sc->bnx_rss_debug, 0, "");
        for (i = 0; i < sc->bnx_rx_retcnt; ++i) {
                ksnprintf(desc, sizeof(desc), "rx_pkt%d", i);
-               SYSCTL_ADD_ULONG(&sc->bnx_sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_ULONG(ctx, tree, OID_AUTO,
                    desc, CTLFLAG_RW, &sc->bnx_rx_ret_ring[i].bnx_rx_pkt, "");
 
                ksnprintf(desc, sizeof(desc), "rx_force_sched%d", i);
-               SYSCTL_ADD_ULONG(&sc->bnx_sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_ULONG(ctx, tree, OID_AUTO,
                    desc, CTLFLAG_RW,
                    &sc->bnx_rx_ret_ring[i].bnx_rx_force_sched, "");
        }
@@ -2477,25 +2440,21 @@ bnx_attach(device_t dev)
 #ifdef BNX_TSS_DEBUG
        for (i = 0; i < sc->bnx_tx_ringcnt; ++i) {
                ksnprintf(desc, sizeof(desc), "tx_pkt%d", i);
-               SYSCTL_ADD_ULONG(&sc->bnx_sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_ULONG(ctx, tree, OID_AUTO,
                    desc, CTLFLAG_RW, &sc->bnx_tx_ring[i].bnx_tx_pkt, "");
        }
 #endif
 
-       SYSCTL_ADD_ULONG(&sc->bnx_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_ULONG(ctx, tree, OID_AUTO,
            "norxbds", CTLFLAG_RW, &sc->bnx_norxbds, "");
 
-       SYSCTL_ADD_ULONG(&sc->bnx_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_ULONG(ctx, tree, OID_AUTO,
            "errors", CTLFLAG_RW, &sc->bnx_errors, "");
 
 #ifdef BNX_TSO_DEBUG
        for (i = 0; i < BNX_TSO_NSTATS; ++i) {
                ksnprintf(desc, sizeof(desc), "tso%d", i + 1);
-               SYSCTL_ADD_ULONG(&sc->bnx_sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->bnx_sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_ULONG(ctx, tree, OID_AUTO,
                    desc, CTLFLAG_RW, &sc->bnx_tsosegs[i], "");
        }
 #endif
@@ -2611,9 +2570,6 @@ bnx_detach(device_t dev)
                    PCIR_BAR(2), sc->bnx_res2);
        }
 
-       if (sc->bnx_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->bnx_sysctl_ctx);
-
        bnx_dma_free(sc);
 
        if (sc->bnx_serialize != NULL)
index 8b61306..321ae01 100644 (file)
@@ -31,7 +31,6 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.1.2.16 2004/09/23 20:11:18 ps Exp $
- * $DragonFly: src/sys/dev/netif/bge/if_bgereg.h,v 1.25 2008/10/22 14:24:24 sephe Exp $
  */
 
 #ifndef _IF_BNXVAR_H_
@@ -383,9 +382,6 @@ struct bnx_softc {
        int                     bnx_intr_cnt;
        struct bnx_intr_data    bnx_intr_data[BNX_INTR_MAX];
 
-       struct sysctl_ctx_list  bnx_sysctl_ctx;
-       struct sysctl_oid       *bnx_sysctl_tree;
-
        int                     bnx_phyno;
        uint32_t                bnx_coal_chg;
 #define BNX_RX_COAL_TICKS_CHG          0x01
index 9d75117..62aaa3c 100644 (file)
@@ -532,6 +532,8 @@ bwi_attach(device_t dev)
        struct ifnet *ifp = &ic->ic_if;
        struct bwi_mac *mac;
        struct bwi_phy *phy;
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid_list *tree;
        char ethstr[ETHER_ADDRSTRLEN + 1];
        int i, error;
 
@@ -607,41 +609,26 @@ bwi_attach(device_t dev)
        /*
         * Create sysctl tree
         */
-       sysctl_ctx_init(&sc->sc_sysctl_ctx);
-       sc->sc_sysctl_tree = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx,
-                                            SYSCTL_STATIC_CHILDREN(_hw),
-                                            OID_AUTO,
-                                            device_get_nameunit(dev),
-                                            CTLFLAG_RD, 0, "");
-       if (sc->sc_sysctl_tree == NULL) {
-               device_printf(dev, "can't add sysctl node\n");
-               error = ENXIO;
-               goto fail;
-       }
+       ctx = device_get_sysctl_ctx(sc->bge_dev);
+       tree = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bge_dev));
 
-       SYSCTL_ADD_UINT(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                        "dwell_time", CTLFLAG_RW, &sc->sc_dwell_time, 0,
                        "Channel dwell time during scan (msec)");
-       SYSCTL_ADD_UINT(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                        "fw_version", CTLFLAG_RD, &sc->sc_fw_version, 0,
                        "Firmware version");
-       SYSCTL_ADD_UINT(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                        "led_idle", CTLFLAG_RW, &sc->sc_led_idle, 0,
                        "# ticks before LED enters idle state");
-       SYSCTL_ADD_INT(&sc->sc_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "led_blink", CTLFLAG_RW, &sc->sc_led_blink, 0,
                       "Allow LED to blink");
-       SYSCTL_ADD_INT(&sc->sc_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "txpwr_calib", CTLFLAG_RW, &sc->sc_txpwr_calib, 0,
                       "Enable software TX power calibration");
 #ifdef BWI_DEBUG
-       SYSCTL_ADD_UINT(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                        "debug", CTLFLAG_RW, &sc->sc_debug, 0, "Debug flags");
 #endif
 
@@ -848,9 +835,6 @@ bwi_detach(device_t dev)
                        bwi_mac_detach(&sc->sc_mac[i]);
        }
 
-       if (sc->sc_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->sc_sysctl_ctx);
-
        if (sc->sc_irq_res != NULL) {
                bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid,
                                     sc->sc_irq_res);
index ba679b8..dfe3a60 100644 (file)
@@ -30,8 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
- * $DragonFly: src/sys/dev/netif/bwi/if_bwivar.h,v 1.14 2008/02/15 11:15:38 sephe Exp $
  */
 
 #ifndef _IF_BWIVAR_H
@@ -638,9 +636,6 @@ struct bwi_softc {
 
        void                    (*sc_txeof_status)(struct bwi_softc *);
 
-       struct sysctl_ctx_list  sc_sysctl_ctx;
-       struct sysctl_oid       *sc_sysctl_tree;
-
        struct ieee80211_onoe_param sc_onoe_param;
 
        /*
index 92ba2af..74a95af 100644 (file)
@@ -1134,11 +1134,6 @@ bwn_detach(device_t dev)
        if (sc->bwn_irq_type == PCI_INTR_TYPE_MSI)
                pci_release_msi(dev);
 
-       if (sc->sc_sysctl_tree) {
-               sysctl_ctx_free(&sc->sc_sysctl_ctx);
-               sc->sc_sysctl_tree = NULL;
-       }
-
        wlan_serialize_exit();
        return (0);
 }
@@ -1170,14 +1165,6 @@ bwn_attach_pre(struct bwn_softc *sc)
        if_initname(ifp, device_get_name(sc->sc_dev),
            device_get_unit(sc->sc_dev));
 
-       /* prepare sysctl tree for use in sub modules */
-       sysctl_ctx_init(&sc->sc_sysctl_ctx);
-       sc->sc_sysctl_tree = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx,
-               SYSCTL_STATIC_CHILDREN(_hw),
-               OID_AUTO,
-               device_get_nameunit(sc->sc_dev),
-               CTLFLAG_RD, 0, "");
-
        ifp->if_softc = sc;
        ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
        ifp->if_init = bwn_init;
@@ -14113,8 +14100,8 @@ bwn_sysctl_node(struct bwn_softc *sc)
                return;
        stats = &mac->mac_stats;
 
-       ctx = &sc->sc_sysctl_ctx;
-       tree = sc->sc_sysctl_tree;
+       ctx = device_get_sysctl_ctx(sc->sc_dev);
+       tree = device_get_sysctl_tree(sc->sc_dev);
        SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "linknoise", CTLFLAG_RW, &stats->rts, 0, "Noise level");
        SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
index 63b7466..83f72e6 100644 (file)
@@ -899,8 +899,6 @@ struct bwn_softc {
 #define        BWN_FLAG_ATTACHED               (1 << 0)
 #define        BWN_FLAG_INVALID                (1 << 1)
 #define        BWN_FLAG_NEED_BEACON_TP         (1 << 2)
-       struct sysctl_ctx_list  sc_sysctl_ctx;
-       struct sysctl_oid       *sc_sysctl_tree;
        unsigned                        sc_debug;
 
        struct bwn_mac          *sc_curmac;
index c562249..27b5286 100644 (file)
@@ -783,8 +783,8 @@ em_attach(device_t dev)
 #ifdef IFPOLL_ENABLE
        /* Polling setup */
        ifpoll_compat_setup(&adapter->npoll,
-           &adapter->sysctl_ctx, adapter->sysctl_tree, device_get_unit(dev),
-           ifp->if_serializer);
+           device_get_sysctl_ctx(dev), device_get_sysctl_tree(dev),
+           device_get_unit(dev), ifp->if_serializer);
 #endif
 
        /* Reset the hardware */
@@ -936,10 +936,6 @@ em_detach(device_t dev)
        if (adapter->parent_dtag != NULL)
                bus_dma_tag_destroy(adapter->parent_dtag);
 
-       /* Free sysctl tree */
-       if (adapter->sysctl_tree != NULL)
-               sysctl_ctx_free(&adapter->sysctl_ctx);
-
        if (adapter->mta != NULL)
                kfree(adapter->mta, M_DEVBUF);
 
@@ -4058,53 +4054,42 @@ em_sysctl_stats(SYSCTL_HANDLER_ARGS)
 static void
 em_add_sysctl(struct adapter *adapter)
 {
-       sysctl_ctx_init(&adapter->sysctl_ctx);
-       adapter->sysctl_tree = SYSCTL_ADD_NODE(&adapter->sysctl_ctx,
-                                       SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-                                       device_get_nameunit(adapter->dev),
-                                       CTLFLAG_RD, 0, "");
-       if (adapter->sysctl_tree == NULL) {
-               device_printf(adapter->dev, "can't add sysctl node\n");
-       } else {
-               SYSCTL_ADD_PROC(&adapter->sysctl_ctx,
-                   SYSCTL_CHILDREN(adapter->sysctl_tree),
-                   OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
-                   em_sysctl_debug_info, "I", "Debug Information");
-
-               SYSCTL_ADD_PROC(&adapter->sysctl_ctx,
-                   SYSCTL_CHILDREN(adapter->sysctl_tree),
-                   OID_AUTO, "stats", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
-                   em_sysctl_stats, "I", "Statistics");
-
-               SYSCTL_ADD_INT(&adapter->sysctl_ctx,
-                   SYSCTL_CHILDREN(adapter->sysctl_tree),
-                   OID_AUTO, "rxd", CTLFLAG_RD,
-                   &adapter->num_rx_desc, 0, NULL);
-               SYSCTL_ADD_INT(&adapter->sysctl_ctx,
-                   SYSCTL_CHILDREN(adapter->sysctl_tree),
-                   OID_AUTO, "txd", CTLFLAG_RD,
-                   &adapter->num_tx_desc, 0, NULL);
-
-               if (adapter->hw.mac.type >= e1000_82540) {
-                       SYSCTL_ADD_PROC(&adapter->sysctl_ctx,
-                           SYSCTL_CHILDREN(adapter->sysctl_tree),
-                           OID_AUTO, "int_throttle_ceil",
-                           CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
-                           em_sysctl_int_throttle, "I",
-                           "interrupt throttling rate");
-               }
-               SYSCTL_ADD_PROC(&adapter->sysctl_ctx,
-                   SYSCTL_CHILDREN(adapter->sysctl_tree),
-                   OID_AUTO, "int_tx_nsegs",
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid *tree;
+
+       ctx = device_get_sysctl_ctx(adapter->dev);
+       tree = device_get_sysctl_tree(adapter->dev);
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
+           OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
+           em_sysctl_debug_info, "I", "Debug Information");
+
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
+           OID_AUTO, "stats", CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
+           em_sysctl_stats, "I", "Statistics");
+
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
+           OID_AUTO, "rxd", CTLFLAG_RD,
+           &adapter->num_rx_desc, 0, NULL);
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
+           OID_AUTO, "txd", CTLFLAG_RD,
+           &adapter->num_tx_desc, 0, NULL);
+
+       if (adapter->hw.mac.type >= e1000_82540) {
+               SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
+                   OID_AUTO, "int_throttle_ceil",
                    CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
-                   em_sysctl_int_tx_nsegs, "I",
-                   "# segments per TX interrupt");
-               SYSCTL_ADD_INT(&adapter->sysctl_ctx,
-                   SYSCTL_CHILDREN(adapter->sysctl_tree),
-                   OID_AUTO, "wreg_tx_nsegs", CTLFLAG_RW,
-                   &adapter->tx_wreg_nsegs, 0,
-                   "# segments before write to hardware register");
-       }
+                   em_sysctl_int_throttle, "I",
+                   "interrupt throttling rate");
+       }
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
+           OID_AUTO, "int_tx_nsegs",
+           CTLTYPE_INT|CTLFLAG_RW, adapter, 0,
+           em_sysctl_int_tx_nsegs, "I",
+           "# segments per TX interrupt");
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
+           OID_AUTO, "wreg_tx_nsegs", CTLFLAG_RW,
+           &adapter->tx_wreg_nsegs, 0,
+           "# segments before write to hardware register");
 }
 
 static int
index a453142..912ea32 100644 (file)
@@ -407,10 +407,6 @@ struct adapter {
        unsigned long           tx_irq;
        unsigned long           link_irq;
 
-       /* sysctl tree glue */
-       struct sysctl_ctx_list  sysctl_ctx;
-       struct sysctl_oid       *sysctl_tree;
-
        /* 82547 workaround */
        uint32_t                tx_fifo_size;
        uint32_t                tx_fifo_head;
index 7b02ef0..d3e59d2 100644 (file)
@@ -931,10 +931,6 @@ emx_detach(device_t dev)
 
        emx_dma_free(sc);
 
-       /* Free sysctl tree */
-       if (sc->sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->sysctl_ctx);
-
        if (sc->mta != NULL)
                kfree(sc->mta, M_DEVBUF);
 
@@ -3629,76 +3625,69 @@ emx_sysctl_stats(SYSCTL_HANDLER_ARGS)
 static void
 emx_add_sysctl(struct emx_softc *sc)
 {
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid *tree;
 #if defined(EMX_RSS_DEBUG) || defined(EMX_TSS_DEBUG)
        char pkt_desc[32];
        int i;
 #endif
 
-       sysctl_ctx_init(&sc->sysctl_ctx);
-       sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
-                               SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-                               device_get_nameunit(sc->dev),
-                               CTLFLAG_RD, 0, "");
-       if (sc->sysctl_tree == NULL) {
-               device_printf(sc->dev, "can't add sysctl node\n");
-               return;
-       }
-
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       ctx = device_get_sysctl_ctx(sc->dev);
+       tree = device_get_sysctl_tree(sc->dev);
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                        OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, sc, 0,
                        emx_sysctl_debug_info, "I", "Debug Information");
 
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                        OID_AUTO, "stats", CTLTYPE_INT|CTLFLAG_RW, sc, 0,
                        emx_sysctl_stats, "I", "Statistics");
 
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "rxd", CTLFLAG_RD, &sc->rx_data[0].num_rx_desc, 0,
            "# of RX descs");
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "txd", CTLFLAG_RD, &sc->tx_data[0].num_tx_desc, 0,
            "# of TX descs");
 
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "int_throttle_ceil", CTLTYPE_INT|CTLFLAG_RW, sc, 0,
            emx_sysctl_int_throttle, "I", "interrupt throttling rate");
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "tx_intr_nsegs", CTLTYPE_INT|CTLFLAG_RW, sc, 0,
            emx_sysctl_tx_intr_nsegs, "I", "# segments per TX interrupt");
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "tx_wreg_nsegs", CTLTYPE_INT|CTLFLAG_RW, sc, 0,
            emx_sysctl_tx_wreg_nsegs, "I",
            "# segments sent before write to hardware register");
 
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "rx_ring_cnt", CTLFLAG_RD, &sc->rx_ring_cnt, 0,
            "# of RX rings");
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "tx_ring_cnt", CTLFLAG_RD, &sc->tx_ring_cnt, 0,
            "# of TX rings");
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "tx_ring_inuse", CTLFLAG_RD, &sc->tx_ring_inuse, 0,
            "# of TX rings used");
 
 #ifdef IFPOLL_ENABLE
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                        OID_AUTO, "npoll_rxoff", CTLTYPE_INT|CTLFLAG_RW,
                        sc, 0, emx_sysctl_npoll_rxoff, "I",
                        "NPOLLING RX cpu offset");
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                        OID_AUTO, "npoll_txoff", CTLTYPE_INT|CTLFLAG_RW,
                        sc, 0, emx_sysctl_npoll_txoff, "I",
                        "NPOLLING TX cpu offset");
 #endif
 
 #ifdef EMX_RSS_DEBUG
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
                       OID_AUTO, "rss_debug", CTLFLAG_RW, &sc->rss_debug,
                       0, "RSS debug level");
        for (i = 0; i < sc->rx_ring_cnt; ++i) {
                ksnprintf(pkt_desc, sizeof(pkt_desc), "rx%d_pkt", i);
-               SYSCTL_ADD_ULONG(&sc->sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                    pkt_desc, CTLFLAG_RW, &sc->rx_data[i].rx_pkts,
                    "RXed packets");
        }
@@ -3706,8 +3695,7 @@ emx_add_sysctl(struct emx_softc *sc)
 #ifdef EMX_TSS_DEBUG
        for (i = 0; i < sc->tx_ring_cnt; ++i) {
                ksnprintf(pkt_desc, sizeof(pkt_desc), "tx%d_pkt", i);
-               SYSCTL_ADD_ULONG(&sc->sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                    pkt_desc, CTLFLAG_RW, &sc->tx_data[i].tx_pkts,
                    "TXed packets");
        }
index 1da9b4e..05c5e71 100644 (file)
@@ -395,10 +395,6 @@ struct emx_softc {
        /* Misc stats maintained by the driver */
        unsigned long           rx_overruns;
 
-       /* sysctl tree glue */
-       struct sysctl_ctx_list  sysctl_ctx;
-       struct sysctl_oid       *sysctl_tree;
-
        struct e1000_hw_stats   stats;
 };
 
index 06f2125..55a2f11 100644 (file)
@@ -234,6 +234,8 @@ et_attach(device_t dev)
 {
        struct et_softc *sc = device_get_softc(dev);
        struct ifnet *ifp = &sc->arpcom.ac_if;
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid *tree;
        uint8_t eaddr[ETHER_ADDR_LEN];
        int error;
        u_int irq_flags;
@@ -298,34 +300,20 @@ et_attach(device_t dev)
        /*
         * Create sysctl tree
         */
-       sysctl_ctx_init(&sc->sc_sysctl_ctx);
-       sc->sc_sysctl_tree = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx,
-                                            SYSCTL_STATIC_CHILDREN(_hw),
-                                            OID_AUTO,
-                                            device_get_nameunit(dev),
-                                            CTLFLAG_RD, 0, "");
-       if (sc->sc_sysctl_tree == NULL) {
-               device_printf(dev, "can't add sysctl node\n");
-               error = ENXIO;
-               goto fail;
-       }
-
-       SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree),
+       ctx = device_get_sysctl_ctx(dev);
+       tree = device_get_sysctl_tree(dev);
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                        OID_AUTO, "rx_intr_npkts", CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, et_sysctl_rx_intr_npkts, "I",
                        "RX IM, # packets per RX interrupt");
-       SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                        OID_AUTO, "rx_intr_delay", CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, et_sysctl_rx_intr_delay, "I",
                        "RX IM, RX interrupt delay (x10 usec)");
-       SYSCTL_ADD_INT(&sc->sc_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "tx_intr_nsegs", CTLFLAG_RW, &sc->sc_tx_intr_nsegs, 0,
                       "TX IM, # segments per TX interrupt");
-       SYSCTL_ADD_UINT(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UINT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                        "timer", CTLFLAG_RW, &sc->sc_timer, 0,
                        "TX timer");
 
@@ -401,9 +389,6 @@ et_detach(device_t dev)
                ether_ifdetach(ifp);
        }
 
-       if (sc->sc_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->sc_sysctl_ctx);
-
        if (sc->sc_miibus != NULL)
                device_delete_child(dev, sc->sc_miibus);
        bus_generic_detach(dev);
index 4be67ae..acb6fb7 100644 (file)
@@ -30,8 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
- * $DragonFly: src/sys/dev/netif/et/if_etvar.h,v 1.4 2007/10/23 14:28:42 sephe Exp $
  */
 
 #ifndef _IF_ETVAR_H
@@ -248,9 +246,6 @@ struct et_softc {
        uint32_t                sc_tx;
        uint32_t                sc_tx_intr;
 
-       struct sysctl_ctx_list  sc_sysctl_ctx;
-       struct sysctl_oid       *sc_sysctl_tree;
-
        /*
         * Sysctl variables
         */
index dac0bb6..934dcbb 100644 (file)
@@ -394,12 +394,13 @@ fxp_attach(device_t dev)
        int error = 0;
        struct fxp_softc *sc = device_get_softc(dev);
        struct ifnet *ifp;
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid *tree;
        u_int32_t val;
        u_int16_t data;
        int i, rid, m1, m2, prefer_iomap;
 
        callout_init(&sc->fxp_stat_timer);
-       sysctl_ctx_init(&sc->sysctl_ctx);
 
        /*
         * Enable bus mastering. Enable memory space too, in case
@@ -504,16 +505,13 @@ fxp_attach(device_t dev)
        /*
         * Create the sysctl tree
         */
-       sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
-           SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-           device_get_nameunit(dev), CTLFLAG_RD, 0, "");
-       if (sc->sysctl_tree == NULL)
-               goto fail;
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       ctx = device_get_sysctl_ctx(dev);
+       tree = device_get_sysctl_tree(dev);
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "int_delay", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_PRISON,
            &sc->tunable_int_delay, 0, &sysctl_hw_fxp_int_delay, "I",
            "FXP driver receive interrupt microcode bundling delay");
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "bundle_max", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_PRISON,
            &sc->tunable_bundle_max, 0, &sysctl_hw_fxp_bundle_max, "I",
            "FXP driver receive interrupt microcode bundle size limit");
@@ -662,9 +660,8 @@ fxp_attach(device_t dev)
        ether_ifattach(ifp, sc->arpcom.ac_enaddr, NULL);
 
 #ifdef IFPOLL_ENABLE
-       ifpoll_compat_setup(&sc->fxp_npoll,
-           &sc->sysctl_ctx, sc->sysctl_tree, device_get_unit(dev),
-           ifp->if_serializer);
+       ifpoll_compat_setup(&sc->fxp_npoll, ctx, (struct sysctl_oid *)tree,
+           device_get_unit(dev), ifp->if_serializer);
 #endif
 
        /*
@@ -727,8 +724,6 @@ fxp_release(device_t dev)
                bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
        if (sc->mem)
                bus_release_resource(dev, sc->rtp, sc->rgd, sc->mem);
-
-        sysctl_ctx_free(&sc->sysctl_ctx);
 }
 
 /*
index c93ca87..bf9d281 100644 (file)
@@ -25,7 +25,6 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/fxp/if_fxpvar.h,v 1.17.2.6 2002/11/13 20:58:31 iedowse Exp $
- * $DragonFly: src/sys/dev/netif/fxp/if_fxpvar.h,v 1.9 2008/06/15 10:41:00 sephe Exp $
  */
 
 /*
@@ -117,8 +116,6 @@ struct fxp_softc {
        struct ifmedia sc_media;        /* media information */
        struct ifpoll_compat fxp_npoll; /* polling */
        device_t miibus;
-       struct sysctl_ctx_list sysctl_ctx;
-       struct sysctl_oid *sysctl_tree;
        int tunable_int_delay;          /* interrupt delay value for ucode */
        int tunable_bundle_max;         /* max # frames per interrupt (ucode) */
        int eeprom_size;                /* size of serial EEPROM */
index 8e8ccb1..10f3923 100644 (file)
@@ -732,9 +732,6 @@ igb_detach(device_t dev)
        }
        bus_generic_detach(dev);
 
-       if (sc->sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->sysctl_ctx);
-
        igb_free_intr(sc);
 
        if (sc->msix_mem_res != NULL) {
@@ -1625,38 +1622,32 @@ igb_setup_ifp(struct igb_softc *sc)
 static void
 igb_add_sysctl(struct igb_softc *sc)
 {
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid *tree;
        char node[32];
        int i;
 
-       sysctl_ctx_init(&sc->sysctl_ctx);
-       sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
-           SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-           device_get_nameunit(sc->dev), CTLFLAG_RD, 0, "");
-       if (sc->sysctl_tree == NULL) {
-               device_printf(sc->dev, "can't add sysctl node\n");
-               return;
-       }
-
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       ctx = device_get_sysctl_ctx(sc->dev);
+       tree = device_get_sysctl_tree(sc->dev);
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "rxr", CTLFLAG_RD, &sc->rx_ring_cnt, 0, "# of RX rings");
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "rxr_inuse", CTLFLAG_RD, &sc->rx_ring_inuse, 0,
            "# of RX rings used");
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "txr", CTLFLAG_RD, &sc->tx_ring_cnt, 0, "# of TX rings");
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "txr_inuse", CTLFLAG_RD, &sc->tx_ring_inuse, 0,
            "# of TX rings used");
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "rxd", CTLFLAG_RD, &sc->rx_rings[0].num_rx_desc, 0,
            "# of RX descs");
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "txd", CTLFLAG_RD, &sc->tx_rings[0].num_tx_desc, 0,
            "# of TX descs");
 
        if (sc->intr_type != PCI_INTR_TYPE_MSIX) {
-               SYSCTL_ADD_PROC(&sc->sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->sysctl_tree),
+               SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                    OID_AUTO, "intr_rate", CTLTYPE_INT | CTLFLAG_RW,
                    sc, 0, igb_sysctl_intr_rate, "I", "interrupt rate");
        } else {
@@ -1664,54 +1655,53 @@ igb_add_sysctl(struct igb_softc *sc)
                        struct igb_msix_data *msix = &sc->msix_data[i];
 
                        ksnprintf(node, sizeof(node), "msix%d_rate", i);
-                       SYSCTL_ADD_PROC(&sc->sysctl_ctx,
-                           SYSCTL_CHILDREN(sc->sysctl_tree),
+                       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                            OID_AUTO, node, CTLTYPE_INT | CTLFLAG_RW,
                            msix, 0, igb_sysctl_msix_rate, "I",
                            msix->msix_rate_desc);
                }
        }
 
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "tx_intr_nsegs", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, igb_sysctl_tx_intr_nsegs, "I",
            "# of segments per TX interrupt");
 
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "tx_wreg_nsegs", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, igb_sysctl_tx_wreg_nsegs, "I",
            "# of segments sent before write to hardware register");
 
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "rx_wreg_nsegs", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, igb_sysctl_rx_wreg_nsegs, "I",
            "# of segments received before write to hardware register");
 
 #ifdef IFPOLL_ENABLE
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "npoll_rxoff", CTLTYPE_INT|CTLFLAG_RW,
            sc, 0, igb_sysctl_npoll_rxoff, "I", "NPOLLING RX cpu offset");
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "npoll_txoff", CTLTYPE_INT|CTLFLAG_RW,
            sc, 0, igb_sysctl_npoll_txoff, "I", "NPOLLING TX cpu offset");
 #endif
 
 #ifdef IGB_RSS_DEBUG
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "rss_debug", CTLFLAG_RW, &sc->rss_debug, 0,
            "RSS debug level");
        for (i = 0; i < sc->rx_ring_cnt; ++i) {
                ksnprintf(node, sizeof(node), "rx%d_pkt", i);
-               SYSCTL_ADD_ULONG(&sc->sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, node,
+               SYSCTL_ADD_ULONG(ctx,
+                   SYSCTL_CHILDREN(tree), OID_AUTO, node,
                    CTLFLAG_RW, &sc->rx_rings[i].rx_packets, "RXed packets");
        }
 #endif
 #ifdef IGB_TSS_DEBUG
        for  (i = 0; i < sc->tx_ring_cnt; ++i) {
                ksnprintf(node, sizeof(node), "tx%d_pkt", i);
-               SYSCTL_ADD_ULONG(&sc->sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, node,
+               SYSCTL_ADD_ULONG(ctx,
+                   SYSCTL_CHILDREN(tree), OID_AUTO, node,
                    CTLFLAG_RW, &sc->tx_rings[i].tx_packets, "TXed packets");
        }
 #endif
index 1be6cd0..34359e6 100644 (file)
@@ -396,10 +396,6 @@ struct igb_softc {
        u_long                  packet_buf_alloc_rx;
        u_long                  packet_buf_alloc_tx;
 
-       /* sysctl tree glue */
-       struct sysctl_ctx_list  sysctl_ctx;
-       struct sysctl_oid       *sysctl_tree;
-
        void                    *stats;
 
        int                     msix_mem_rid;
index 6e42fe5..02f0512 100644 (file)
@@ -492,9 +492,6 @@ iwi_detach(device_t dev)
 
        devfs_clone_bitmap_uninit(&sc->sc_unr);
 
-       if (sc->sc_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->sc_sysctl_ctx);
-
        if_free(ifp);
 
        wlan_serialize_exit();
@@ -3289,19 +3286,8 @@ iwi_sysctlattach(struct iwi_softc *sc)
        struct sysctl_ctx_list *ctx;
        struct sysctl_oid *tree;
 
-       ctx = &sc->sc_sysctl_ctx;
-       sysctl_ctx_init(ctx);
-
-       tree = SYSCTL_ADD_NODE(ctx, SYSCTL_STATIC_CHILDREN(_hw),
-                              OID_AUTO,
-                              device_get_nameunit(sc->sc_dev),
-                              CTLFLAG_RD, 0, "");
-       if (tree == NULL) {
-               device_printf(sc->sc_dev, "can't add sysctl node\n");
-               return;
-       }
-
-       sc->sc_sysctl_tree = tree;
+       ctx = device_get_sysctl_ctx(sc->sc_dev);
+       tree = device_get_sysctl_tree(sc->sc_dev);
 
        SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "radio",
            CTLTYPE_INT | CTLFLAG_RD, sc, 0, iwi_sysctl_radio, "I",
@@ -3474,8 +3460,8 @@ iwi_sysctl_softled(SYSCTL_HANDLER_ARGS)
 static void
 iwi_ledattach(struct iwi_softc *sc)
 {
-       struct sysctl_ctx_list *ctx = &sc->sc_sysctl_ctx;
-       struct sysctl_oid *tree = sc->sc_sysctl_tree;
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
 
        sc->sc_blinking = 0;
        sc->sc_ledstate = 1;
index 51d9f78..98412cf 100644 (file)
@@ -216,9 +216,6 @@ struct iwi_softc {
 
        struct iwi_rx_radiotap_header sc_rxtap;
        struct iwi_tx_radiotap_header sc_txtap;
-
-       struct sysctl_ctx_list  sc_sysctl_ctx;
-       struct sysctl_oid       *sc_sysctl_tree;
 };
 
 #define        IWI_STATE_BEGIN(_sc, _state)    do {                    \
index 35d7af9..2cf3384 100644 (file)
@@ -210,21 +210,6 @@ iwl_attach(device_t dev)
                goto back;
        }
 
-       /*
-        * Create sysctl tree
-        */
-       sysctl_ctx_init(&iwl->iwl_sysctl_ctx);
-       iwl->iwl_sysctl_tree = SYSCTL_ADD_NODE(&iwl->iwl_sysctl_ctx,
-                                              SYSCTL_STATIC_CHILDREN(_hw),
-                                              OID_AUTO,
-                                              device_get_nameunit(dev),
-                                              CTLFLAG_RD, 0, "");
-       if (iwl->iwl_sysctl_tree == NULL) {
-               device_printf(dev, "can't add sysctl node\n");
-               error = ENXIO;
-               goto back;
-       }
-
        /*
         * Device specific attach
         */
@@ -243,9 +228,6 @@ iwl_detach(device_t dev)
 
        sc->sc_info->detach(dev);
 
-       if (iwl->iwl_sysctl_tree != NULL)
-               sysctl_ctx_free(&iwl->iwl_sysctl_ctx);
-
        if (iwl->iwl_irq_res != NULL) {
                bus_release_resource(dev, SYS_RES_IRQ, iwl->iwl_irq_rid,
                                     iwl->iwl_irq_res);
index 39d2460..e620be8 100644 (file)
@@ -30,8 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
- * $DragonFly: src/sys/dev/netif/iwl/if_iwlvar.h,v 1.1 2008/03/05 14:10:39 sephe Exp $
  */
 
 #ifndef _IF_IWLVAR_H
@@ -66,9 +64,6 @@ struct iwlcom {
        struct resource         *iwl_irq_res;
        void                    *iwl_irq_handle;
 
-       struct sysctl_ctx_list  iwl_sysctl_ctx;
-       struct sysctl_oid       *iwl_sysctl_tree;
-
        int                     iwl_tx_timer;
 
        struct lwkt_port        iwl_reply_port;
index ce64d3a..539601f 100644 (file)
@@ -366,8 +366,8 @@ iwl2100_attach(device_t dev)
        callout_init(&sc->sc_reinit);
 
        /* Add sysctl node */
-       SYSCTL_ADD_UINT(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev),
+                       SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
                        "debug", CTLFLAG_RW, &sc->sc_debug, 0, "debug flags");
 
        if (bootverbose)
index c319857..dc0e8a2 100644 (file)
@@ -427,14 +427,6 @@ iwn_pci_attach(device_t dev)
                goto fail;
        }
 
-       /* prepare sysctl tree for use in sub modules */
-       sysctl_ctx_init(&sc->sc_sysctl_ctx);
-       sc->sc_sysctl_tree = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx,
-               SYSCTL_STATIC_CHILDREN(_hw),
-               OID_AUTO,
-               device_get_nameunit(sc->sc_dev),
-               CTLFLAG_RD, 0, "");
-
 #ifdef IWN_DEBUG
        error = resource_int_value(device_get_name(sc->sc_dev),
            device_get_unit(sc->sc_dev), "debug", &(sc->sc_debug));
@@ -1343,8 +1335,8 @@ iwn_sysctlattach(struct iwn_softc *sc)
        struct sysctl_ctx_list *ctx;
        struct sysctl_oid *tree;
 
-       ctx = &sc->sc_sysctl_ctx;
-       tree = sc->sc_sysctl_tree;
+       ctx = device_get_sysctl_ctx(sc->sc_dev);
+       tree = device_get_sysctl_tree(sc->sc_dev);
 
        if (tree) {
                device_printf(sc->sc_dev, "can't add sysctl node\n");
@@ -1433,9 +1425,6 @@ iwn_pci_detach(device_t dev)
                ieee80211_ifdetach(ic);
        }
 
-       /* cleanup sysctl nodes */
-       sysctl_ctx_free(&sc->sc_sysctl_ctx);
-
        /* Uninstall interrupt handler. */
        if (sc->irq != NULL) {
                bus_teardown_intr(dev, sc->irq, sc->sc_ih);
index 753dadd..aaad7e9 100644 (file)
@@ -430,6 +430,4 @@ struct iwn_softc {
 
        /* For specific params */
        const struct iwn_base_params *base_params;
-       struct sysctl_ctx_list  sc_sysctl_ctx;
-       struct sysctl_oid       *sc_sysctl_tree;
 };
index fe1eabc..6cfaa0e 100644 (file)
@@ -558,9 +558,6 @@ ix_detach(device_t dev)
        ifmedia_removeall(&sc->media);
        bus_generic_detach(dev);
 
-       if (sc->sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->sysctl_ctx);
-
        ix_free_intr(sc);
 
        if (sc->msix_mem_res != NULL) {
@@ -3977,56 +3974,49 @@ ix_newbuf(struct ix_rx_ring *rxr, int i, boolean_t wait)
 static void
 ix_add_sysctl(struct ix_softc *sc)
 {
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->dev);
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->dev);
 #ifdef IX_RSS_DEBUG
        char node[32];
        int i;
 #endif
 
-       sysctl_ctx_init(&sc->sysctl_ctx);
-       sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
-           SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-           device_get_nameunit(sc->dev), CTLFLAG_RD, 0, "");
-       if (sc->sysctl_tree == NULL) {
-               device_printf(sc->dev, "can't add sysctl node\n");
-               return;
-       }
-
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "rxr", CTLFLAG_RD, &sc->rx_ring_cnt, 0, "# of RX rings");
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "rxr_inuse", CTLFLAG_RD, &sc->rx_ring_inuse, 0,
            "# of RX rings used");
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "txr", CTLFLAG_RD, &sc->tx_ring_cnt, 0, "# of TX rings");
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "txr_inuse", CTLFLAG_RD, &sc->tx_ring_inuse, 0,
            "# of TX rings used");
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "rxd", CTLTYPE_INT | CTLFLAG_RD,
            sc, 0, ix_sysctl_rxd, "I",
            "# of RX descs");
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "txd", CTLTYPE_INT | CTLFLAG_RD,
            sc, 0, ix_sysctl_txd, "I",
            "# of TX descs");
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "tx_wreg_nsegs", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, ix_sysctl_tx_wreg_nsegs, "I",
            "# of segments sent before write to hardware register");
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "rx_wreg_nsegs", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, ix_sysctl_rx_wreg_nsegs, "I",
            "# of received segments sent before write to hardware register");
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "tx_intr_nsegs", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, ix_sysctl_tx_intr_nsegs, "I",
            "# of segments per TX interrupt");
 
 #ifdef IFPOLL_ENABLE
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "npoll_rxoff", CTLTYPE_INT|CTLFLAG_RW,
            sc, 0, ix_sysctl_npoll_rxoff, "I", "NPOLLING RX cpu offset");
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "npoll_txoff", CTLTYPE_INT|CTLFLAG_RW,
            sc, 0, ix_sysctl_npoll_txoff, "I", "NPOLLING TX cpu offset");
 #endif
@@ -4045,18 +4035,18 @@ do { \
 #undef IX_ADD_INTR_RATE_SYSCTL
 
 #ifdef IX_RSS_DEBUG
-       SYSCTL_ADD_INT(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "rss_debug", CTLFLAG_RW, &sc->rss_debug, 0,
            "RSS debug level");
        for (i = 0; i < sc->rx_ring_cnt; ++i) {
                ksnprintf(node, sizeof(node), "rx%d_pkt", i);
-               SYSCTL_ADD_ULONG(&sc->sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, node,
+               SYSCTL_ADD_ULONG(ctx,
+                   SYSCTL_CHILDREN(tree), OID_AUTO, node,
                    CTLFLAG_RW, &sc->rx_rings[i].rx_pkts, "RXed packets");
        }
 #endif
 
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "flowctrl", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, ix_sysctl_flowctrl, "I",
            "flow control, 0 - off, 1 - rx pause, 2 - tx pause, 3 - full");
@@ -4067,7 +4057,7 @@ do { \
         * advertised speed list to only a certain value, this
         * supports 1G on 82599 devices, and 100Mb on X540.
         */
-       SYSCTL_ADD_PROC(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
            OID_AUTO, "advspeed", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, ix_sysctl_advspeed, "I",
            "advertised link speed, "
@@ -4272,8 +4262,8 @@ ix_add_intr_rate_sysctl(struct ix_softc *sc, int use,
 
        for (i = 0; i < sc->intr_cnt; ++i) {
                if (sc->intr_data[i].intr_use == use) {
-                       SYSCTL_ADD_PROC(&sc->sysctl_ctx,
-                           SYSCTL_CHILDREN(sc->sysctl_tree),
+                       SYSCTL_ADD_PROC(device_get_sysctl_ctx(sc->dev),
+                           SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)),
                            OID_AUTO, name, CTLTYPE_INT | CTLFLAG_RW,
                            sc, 0, handler, "I", desc);
                        break;
index 9d854cb..c077080 100644 (file)
@@ -320,10 +320,6 @@ struct ix_softc {
        int                     intr_cnt;
        struct ix_intr_data     *intr_data;
 
-       /* sysctl tree glue */
-       struct sysctl_ctx_list  sysctl_ctx;
-       struct sysctl_oid       *sysctl_tree;
-
        device_t                dev;
        bus_dma_tag_t           parent_tag;
        struct ifmedia          media;
index e737436..acc6d07 100644 (file)
@@ -1123,9 +1123,6 @@ jme_detach(device_t dev)
                ether_ifdetach(ifp);
        }
 
-       if (sc->jme_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->jme_sysctl_ctx);
-
        if (sc->jme_miibus != NULL)
                device_delete_child(dev, sc->jme_miibus);
        bus_generic_detach(dev);
@@ -1145,64 +1142,49 @@ jme_detach(device_t dev)
 static void
 jme_sysctl_node(struct jme_softc *sc)
 {
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid *tree;
 #ifdef JME_RSS_DEBUG
        int r;
 #endif
 
-       sysctl_ctx_init(&sc->jme_sysctl_ctx);
-       sc->jme_sysctl_tree = SYSCTL_ADD_NODE(&sc->jme_sysctl_ctx,
-                               SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-                               device_get_nameunit(sc->jme_dev),
-                               CTLFLAG_RD, 0, "");
-       if (sc->jme_sysctl_tree == NULL) {
-               device_printf(sc->jme_dev, "can't add sysctl node\n");
-               return;
-       }
-
-       SYSCTL_ADD_PROC(&sc->jme_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+       ctx = device_get_sysctl_ctx(sc->jme_dev);
+       tree = device_get_sysctl_tree(sc->jme_dev);
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "tx_coal_to", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, jme_sysctl_tx_coal_to, "I", "jme tx coalescing timeout");
 
-       SYSCTL_ADD_PROC(&sc->jme_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "tx_coal_pkt", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, jme_sysctl_tx_coal_pkt, "I", "jme tx coalescing packet");
 
-       SYSCTL_ADD_PROC(&sc->jme_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "rx_coal_to", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, jme_sysctl_rx_coal_to, "I", "jme rx coalescing timeout");
 
-       SYSCTL_ADD_PROC(&sc->jme_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "rx_coal_pkt", CTLTYPE_INT | CTLFLAG_RW,
            sc, 0, jme_sysctl_rx_coal_pkt, "I", "jme rx coalescing packet");
 
-       SYSCTL_ADD_INT(&sc->jme_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "rx_desc_count", CTLFLAG_RD,
                       &sc->jme_cdata.jme_rx_data[0].jme_rx_desc_cnt,
                       0, "RX desc count");
-       SYSCTL_ADD_INT(&sc->jme_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "tx_desc_count", CTLFLAG_RD,
                       &sc->jme_cdata.jme_tx_data.jme_tx_desc_cnt,
                       0, "TX desc count");
-       SYSCTL_ADD_INT(&sc->jme_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "rx_ring_count", CTLFLAG_RD,
                       &sc->jme_cdata.jme_rx_ring_cnt,
                       0, "RX ring count");
-       SYSCTL_ADD_INT(&sc->jme_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "tx_wreg", CTLFLAG_RW,
                       &sc->jme_cdata.jme_tx_data.jme_tx_wreg, 0,
                       "# of segments before writing to hardware register");
 
 #ifdef JME_RSS_DEBUG
-       SYSCTL_ADD_INT(&sc->jme_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "rss_debug", CTLFLAG_RW, &sc->jme_rss_debug,
                       0, "RSS debug level");
        for (r = 0; r < sc->jme_cdata.jme_rx_ring_cnt; ++r) {
@@ -1210,15 +1192,13 @@ jme_sysctl_node(struct jme_softc *sc)
 
                ksnprintf(rx_ring_desc, sizeof(rx_ring_desc),
                    "rx_ring%d_pkt", r);
-               SYSCTL_ADD_ULONG(&sc->jme_sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                    rx_ring_desc, CTLFLAG_RW,
                    &sc->jme_cdata.jme_rx_data[r].jme_rx_pkt, "RXed packets");
 
                ksnprintf(rx_ring_desc, sizeof(rx_ring_desc),
                    "rx_ring%d_emp", r);
-               SYSCTL_ADD_ULONG(&sc->jme_sysctl_ctx,
-                   SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+               SYSCTL_ADD_ULONG(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                    rx_ring_desc, CTLFLAG_RW,
                    &sc->jme_cdata.jme_rx_data[r].jme_rx_emp,
                    "# of time RX ring empty");
@@ -1226,12 +1206,10 @@ jme_sysctl_node(struct jme_softc *sc)
 #endif
 
 #ifdef IFPOLL_ENABLE
-       SYSCTL_ADD_PROC(&sc->jme_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "npoll_rxoff", CTLTYPE_INT|CTLFLAG_RW, sc, 0,
            jme_sysctl_npoll_rxoff, "I", "NPOLLING RX cpu offset");
-       SYSCTL_ADD_PROC(&sc->jme_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->jme_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "npoll_txoff", CTLTYPE_INT|CTLFLAG_RW, sc, 0,
            jme_sysctl_npoll_txoff, "I", "NPOLLING TX cpu offset");
 #endif
index 249e498..f826572 100644 (file)
@@ -25,7 +25,6 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/jme/if_jmevar.h,v 1.1 2008/05/27 01:42:01 yongari Exp $
- * $DragonFly: src/sys/dev/netif/jme/if_jmevar.h,v 1.8 2008/11/26 11:55:18 sephe Exp $
  */
 
 #ifndef        _IF_JMEVAR_H
@@ -291,9 +290,6 @@ struct jme_softc {
        uint32_t                jme_txcsr;
        uint32_t                jme_rxcsr;
 
-       struct sysctl_ctx_list  jme_sysctl_ctx;
-       struct sysctl_oid       *jme_sysctl_tree;
-
        /*
         * Sysctl variables
         */
index c3d0892..38480b1 100644 (file)
@@ -1478,6 +1478,8 @@ static int
 mskc_attach(device_t dev)
 {
        struct msk_softc *sc;
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid *tree;
        int error, *port, cpuid;
        u_int irq_flags;
 
@@ -1586,38 +1588,23 @@ mskc_attach(device_t dev)
        /*
         * Create sysctl tree
         */
-       sysctl_ctx_init(&sc->msk_sysctl_ctx);
-       sc->msk_sysctl_tree = SYSCTL_ADD_NODE(&sc->msk_sysctl_ctx,
-                                             SYSCTL_STATIC_CHILDREN(_hw),
-                                             OID_AUTO,
-                                             device_get_nameunit(dev),
-                                             CTLFLAG_RD, 0, "");
-       if (sc->msk_sysctl_tree == NULL) {
-               device_printf(dev, "can't add sysctl node\n");
-               error = ENXIO;
-               goto fail;
-       }
-
-       SYSCTL_ADD_PROC(&sc->msk_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->msk_sysctl_tree),
+       ctx = device_get_sysctl_ctx(dev);
+       tree = device_get_sysctl_tree(dev);
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                        OID_AUTO, "process_limit", CTLTYPE_INT | CTLFLAG_RW,
                        &sc->msk_process_limit, 0, mskc_sysctl_proc_limit,
                        "I", "max number of Rx events to process");
-       SYSCTL_ADD_PROC(&sc->msk_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->msk_sysctl_tree),
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                        OID_AUTO, "intr_rate", CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, mskc_sysctl_intr_rate,
                        "I", "max number of interrupt per second");
-       SYSCTL_ADD_INT(&sc->msk_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->msk_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "defrag_avoided", CTLFLAG_RW, &sc->msk_defrag_avoided,
                       0, "# of avoided m_defrag on TX path");
-       SYSCTL_ADD_INT(&sc->msk_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->msk_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "leading_copied", CTLFLAG_RW, &sc->msk_leading_copied,
                       0, "# of leading copies on TX path");
-       SYSCTL_ADD_INT(&sc->msk_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->msk_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "trailing_copied", CTLFLAG_RW, &sc->msk_trailing_copied,
                       0, "# of trailing copies on TX path");
 
@@ -1842,9 +1829,6 @@ mskc_detach(device_t dev)
                                     sc->msk_res);
        }
 
-       if (sc->msk_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->msk_sysctl_ctx);
-
        return (0);
 }
 
index 553e670..c4402d2 100644 (file)
@@ -94,7 +94,6 @@
  */
 
 /* $FreeBSD: src/sys/dev/msk/if_mskreg.h,v 1.11 2007/12/05 09:41:58 remko Exp $ */
-/* $DragonFly: src/sys/dev/netif/msk/if_mskreg.h,v 1.4 2008/06/17 11:00:13 sephe Exp $ */
 
 /*
  * SysKonnect PCI vendor ID
@@ -2487,9 +2486,6 @@ struct msk_softc {
        int                     msk_stat_cons;
        struct lwkt_serialize   msk_serializer;
 
-       struct sysctl_ctx_list  msk_sysctl_ctx;
-       struct sysctl_oid       *msk_sysctl_tree;
-
        /*
         * Sysctl variables
         */
index 816aedb..209c5a9 100644 (file)
@@ -1393,11 +1393,6 @@ mxge_rem_sysctls(mxge_softc_t *sc)
                sysctl_ctx_free(&sc->slice_sysctl_ctx);
                sc->slice_sysctl_tree = NULL;
        }
-
-       if (sc->sysctl_tree != NULL) {
-               sysctl_ctx_free(&sc->sysctl_ctx);
-               sc->sysctl_tree = NULL;
-       }
 }
 
 static void
@@ -1410,16 +1405,8 @@ mxge_add_sysctls(mxge_softc_t *sc)
        int slice;
        char slice_num[8];
 
-       ctx = &sc->sysctl_ctx;
-       sysctl_ctx_init(ctx);
-       sc->sysctl_tree = SYSCTL_ADD_NODE(ctx, SYSCTL_STATIC_CHILDREN(_hw),
-           OID_AUTO, device_get_nameunit(sc->dev), CTLFLAG_RD, 0, "");
-       if (sc->sysctl_tree == NULL) {
-               device_printf(sc->dev, "can't add sysctl node\n");
-               return;
-       }
-
-       children = SYSCTL_CHILDREN(sc->sysctl_tree);
+       ctx = device_get_sysctl_ctx(sc->dev);
+       children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev));
        fw = sc->ss[0].fw_stats;
 
        /*
index 6f1d08f..0c271e5 100644 (file)
@@ -180,8 +180,6 @@ struct mxge_softc {
        struct callout co_hdl;
        u_long opackets;                /* saved ifnet.opackets */
        u_long ipackets;                /* saved ifnet.ipackets */
-       struct sysctl_ctx_list sysctl_ctx;
-       struct sysctl_oid *sysctl_tree;
        struct sysctl_oid *slice_sysctl_tree;
        struct sysctl_ctx_list slice_sysctl_ctx;
        uint8_t mac_addr[6];            /* eeprom mac address */
index 8840b77..5413427 100644 (file)
@@ -199,8 +199,6 @@ struct ndis_softc {
        int                     ndis_if_flags;
        int                     ndis_skip;
 
-       struct sysctl_ctx_list  ndis_ctx;
-       struct sysctl_oid       *ndis_tree;
        int                     ndis_devidx;
        interface_type          ndis_iftype;
        driver_object           *ndis_dobj;
index 89a08a2..b67cf8c 100644 (file)
@@ -460,6 +460,8 @@ nfe_attach(device_t dev)
 {
        struct nfe_softc *sc = device_get_softc(dev);
        struct ifnet *ifp = &sc->arpcom.ac_if;
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid *tree;
        uint8_t eaddr[ETHER_ADDR_LEN];
        bus_addr_t lowaddr;
        int error;
@@ -577,33 +579,20 @@ nfe_attach(device_t dev)
        /*
         * Create sysctl tree
         */
-       sysctl_ctx_init(&sc->sc_sysctl_ctx);
-       sc->sc_sysctl_tree = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx,
-                                            SYSCTL_STATIC_CHILDREN(_hw),
-                                            OID_AUTO,
-                                            device_get_nameunit(dev),
-                                            CTLFLAG_RD, 0, "");
-       if (sc->sc_sysctl_tree == NULL) {
-               device_printf(dev, "can't add sysctl node\n");
-               error = ENXIO;
-               goto fail;
-       }
-       SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sc_sysctl_tree),
+       ctx = device_get_sysctl_ctx(dev);
+       tree = device_get_sysctl_tree(dev);
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                        OID_AUTO, "imtimer", CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, nfe_sysctl_imtime, "I",
                        "Interrupt moderation time (usec).  "
                        "0 to disable interrupt moderation.");
-       SYSCTL_ADD_INT(&sc->sc_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "rx_ring_count", CTLFLAG_RD, &sc->sc_rx_ring_count,
                       0, "RX ring count");
-       SYSCTL_ADD_INT(&sc->sc_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "tx_ring_count", CTLFLAG_RD, &sc->sc_tx_ring_count,
                       0, "TX ring count");
-       SYSCTL_ADD_INT(&sc->sc_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "debug", CTLFLAG_RW, &sc->sc_debug,
                       0, "control debugging printfs");
 
@@ -649,9 +638,8 @@ nfe_attach(device_t dev)
        ifq_set_cpuid(&ifp->if_snd, rman_get_cpuid(sc->sc_irq_res));
 
 #ifdef IFPOLL_ENABLE
-       ifpoll_compat_setup(&sc->sc_npoll,
-           &sc->sc_sysctl_ctx, sc->sc_sysctl_tree, device_get_unit(dev),
-           ifp->if_serializer);
+       ifpoll_compat_setup(&sc->sc_npoll, ctx, (struct sysctl_oid *)tree,
+           device_get_unit(dev), ifp->if_serializer);
 #endif
 
        error = bus_setup_intr(dev, sc->sc_irq_res, INTR_MPSAFE, nfe_intr, sc,
@@ -688,9 +676,6 @@ nfe_detach(device_t dev)
                device_delete_child(dev, sc->sc_miibus);
        bus_generic_detach(dev);
 
-       if (sc->sc_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->sc_sysctl_ctx);
-
        if (sc->sc_irq_res != NULL) {
                bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid,
                                     sc->sc_irq_res);
index f439b3d..aea33ef 100644 (file)
@@ -1,5 +1,4 @@
 /*     $OpenBSD: if_nfevar.h,v 1.11 2006/02/19 13:57:02 damien Exp $   */
-/*     $DragonFly: src/sys/dev/netif/nfe/if_nfevar.h,v 1.13 2008/07/12 11:44:17 sephe Exp $    */
 
 /*
  * Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org>
@@ -122,8 +121,6 @@ struct nfe_softc {
        int                     sc_rx_ring_count;
        int                     sc_tx_ring_count;
        int                     sc_debug;
-       struct sysctl_ctx_list  sc_sysctl_ctx;
-       struct sysctl_oid       *sc_sysctl_tree;
 
        struct lwkt_serialize   sc_jbuf_serializer;
 };
index 7ed844f..b6e0f65 100644 (file)
@@ -282,15 +282,6 @@ oce_attach(device_t dev)
        if (rc)
                goto vlan_free;
 
-       sysctl_ctx_init(&sc->sysctl_ctx);
-       sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
-           SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-           device_get_nameunit(sc->dev), CTLFLAG_RD, 0, "");
-       if (sc->sysctl_tree == NULL) {
-               device_printf(sc->dev, "cannot add sysctl tree node\n");
-               rc = ENXIO;
-               goto vlan_free;
-       }
        oce_add_sysctls(sc);
 
        callout_init_mp(&sc->timer);
@@ -351,8 +342,6 @@ oce_detach(device_t dev)
        oce_hw_shutdown(sc);
 
        bus_generic_detach(dev);
-
-       sysctl_ctx_free(&sc->sysctl_ctx);
        return 0;
 }
 
index 6eefc8b..af663eb 100644 (file)
@@ -886,9 +886,6 @@ typedef struct oce_softc {
        uint16_t qnqid;
        uint16_t pvid;
 
-       struct sysctl_ctx_list sysctl_ctx;
-       struct sysctl_oid *sysctl_tree;
-
 } OCE_SOFTC, *POCE_SOFTC;
 
 
index 3c3b597..740b52f 100644 (file)
@@ -69,8 +69,8 @@ void
 oce_add_sysctls(POCE_SOFTC sc)
 {
 
-       struct sysctl_ctx_list *ctx = &sc->sysctl_ctx;
-       struct sysctl_oid *tree = sc->sysctl_tree;
+       struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->dev);
+       struct sysctl_oid *tree = device_get_sysctl_tree(sc->dev);
        struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
        struct sysctl_oid *stats_node;
 
index 912870c..3c4da86 100644 (file)
@@ -319,17 +319,8 @@ rt2560_attach(device_t dev, int id)
        /*
         * Add a few sysctl knobs.
         */
-       ctx = &sc->sc_sysctl_ctx;
-       sysctl_ctx_init(ctx);
-       tree = SYSCTL_ADD_NODE(ctx, SYSCTL_STATIC_CHILDREN(_hw),
-                               OID_AUTO,
-                               device_get_nameunit(sc->sc_dev),
-                               CTLFLAG_RD, 0, "");
-        if (tree == NULL) {
-                device_printf(sc->sc_dev, "can't add sysctl node\n");
-                goto fail6;
-        }
-
+       ctx = device_get_sysctl_ctx(sc->sc_dev);
+       tree = device_get_sysctl_tree(sc->sc_dev);
 #ifdef RAL_DEBUG
        SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "debug", CTLFLAG_RW, &sc->sc_debug, 0, "debug msgs");
index 48fcf64..24b22ab 100644 (file)
@@ -154,8 +154,6 @@ struct rt2560_softc {
 #define RT2560_F_PRIO_OACTIVE  0x2
 #define RT2560_F_DATA_OACTIVE  0x4
        int                     sc_flags;
-
-       struct sysctl_ctx_list  sc_sysctl_ctx;
 };
 
 int    rt2560_attach(device_t, int);
index 685f053..1b5fdf4 100644 (file)
@@ -321,16 +321,8 @@ rt2661_attach(device_t dev, int id)
            &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap),
                RT2661_RX_RADIOTAP_PRESENT);
 
-       ctx = &sc->sc_sysctl_ctx;
-       sysctl_ctx_init(ctx);
-       tree = SYSCTL_ADD_NODE(ctx, SYSCTL_STATIC_CHILDREN(_hw),
-                              OID_AUTO,
-                              device_get_nameunit(sc->sc_dev),
-                              CTLFLAG_RD, 0, "");
-       if (tree == NULL) {
-               device_printf(sc->sc_dev, "can't add sysctl node\n");
-               return 0;
-       }
+       ctx = device_get_sysctl_ctx(sc->sc_dev);
+       tree = device_get_sysctl_tree(sc->sc_dev);
 #ifdef RAL_DEBUG
        SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "debug", CTLFLAG_RW, &sc->sc_debug, 0, "debug msgs");
index 3006ee0..e1589f1 100644 (file)
@@ -158,8 +158,6 @@ struct rt2661_softc {
        int                             sc_rxtap_len;
        struct rt2661_tx_radiotap_header sc_txtap;
        int                             sc_txtap_len;
-
-       struct sysctl_ctx_list  sc_sysctl_ctx;
 };
 
 int    rt2661_attach(device_t, int);
index 9981cea..7ab53ab 100644 (file)
@@ -357,16 +357,8 @@ rt2860_attach(device_t dev, int id)
            &sc->sc_rxtap.wr_ihdr, sizeof(sc->sc_rxtap),
                RT2860_RX_RADIOTAP_PRESENT);
 
-       ctx = &sc->sc_sysctl_ctx;
-       sysctl_ctx_init(ctx);
-       tree = SYSCTL_ADD_NODE(ctx, SYSCTL_STATIC_CHILDREN(_hw),
-                              OID_AUTO,
-                              device_get_nameunit(sc->sc_dev),
-                              CTLFLAG_RD, 0, "");
-       if (tree == NULL) {
-               device_printf(sc->sc_dev, "can't add sysctl node\n");
-               return 0;
-       }
+       ctx = device_get_sysctl_ctx(sc->sc_dev);
+       tree = device_get_sysctl_tree(sc->sc_dev);
 #ifdef RAL_DEBUG
        SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "debug", CTLFLAG_RW, &sc->sc_debug, 0, "debug msgs");
index e94d269..5e993c4 100644 (file)
@@ -194,8 +194,6 @@ struct rt2860_softc {
        int                             sc_rxtap_len;
        struct rt2860_tx_radiotap_header sc_txtap;
        int                             sc_txtap_len;
-
-       struct sysctl_ctx_list  sc_sysctl_ctx;
 };
 
 int    rt2860_attach(device_t, int);
index a30f944..8df2e73 100644 (file)
@@ -1336,6 +1336,8 @@ re_attach(device_t dev)
 {
        struct re_softc *sc = device_get_softc(dev);
        struct ifnet *ifp;
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid *tree;
        uint8_t eaddr[ETHER_ADDR_LEN];
        int error = 0, qlen, msi_enable;
        u_int irq_flags;
@@ -1377,49 +1379,32 @@ re_attach(device_t dev)
        }
        re_config_imtype(sc, sc->re_imtype);
 
-       sysctl_ctx_init(&sc->re_sysctl_ctx);
-       sc->re_sysctl_tree = SYSCTL_ADD_NODE(&sc->re_sysctl_ctx,
-                                            SYSCTL_STATIC_CHILDREN(_hw),
-                                            OID_AUTO,
-                                            device_get_nameunit(dev),
-                                            CTLFLAG_RD, 0, "");
-       if (sc->re_sysctl_tree == NULL) {
-               device_printf(dev, "can't add sysctl node\n");
-               error = ENXIO;
-               goto fail;
-       }
-       SYSCTL_ADD_INT(&sc->re_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->re_sysctl_tree), OID_AUTO,
+       ctx = device_get_sysctl_ctx(dev);
+       tree = device_get_sysctl_tree(dev);
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "rx_desc_count", CTLFLAG_RD, &sc->re_rx_desc_cnt,
                       0, "RX desc count");
-       SYSCTL_ADD_INT(&sc->re_sysctl_ctx,
-                      SYSCTL_CHILDREN(sc->re_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                       "tx_desc_count", CTLFLAG_RD, &sc->re_tx_desc_cnt,
                       0, "TX desc count");
-       SYSCTL_ADD_PROC(&sc->re_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->re_sysctl_tree),
-                       OID_AUTO, "sim_time",
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "sim_time",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, re_sysctl_simtime, "I",
                        "Simulated interrupt moderation time (usec).");
-       SYSCTL_ADD_PROC(&sc->re_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->re_sysctl_tree),
-                       OID_AUTO, "imtype",
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "imtype",
                        CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, re_sysctl_imtype, "I",
                        "Interrupt moderation type -- "
                        "0:disable, 1:simulated, "
                        "2:hardware(if supported)");
        if (sc->re_caps & RE_C_HWIM) {
-               SYSCTL_ADD_PROC(&sc->re_sysctl_ctx,
-                               SYSCTL_CHILDREN(sc->re_sysctl_tree),
+               SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                                OID_AUTO, "hw_rxtime",
                                CTLTYPE_INT | CTLFLAG_RW,
                                sc, 0, re_sysctl_rxtime, "I",
                                "Hardware interrupt moderation time "
                                "(unit: 25usec).");
-               SYSCTL_ADD_PROC(&sc->re_sysctl_ctx,
-                               SYSCTL_CHILDREN(sc->re_sysctl_tree),
+               SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree),
                                OID_AUTO, "hw_txtime",
                                CTLTYPE_INT | CTLFLAG_RW,
                                sc, 0, re_sysctl_txtime, "I",
@@ -1645,9 +1630,8 @@ re_attach(device_t dev)
        ifq_set_cpuid(&ifp->if_snd, rman_get_cpuid(sc->re_irq));
 
 #ifdef IFPOLL_ENABLE
-       ifpoll_compat_setup(&sc->re_npoll,
-           &sc->re_sysctl_ctx, sc->re_sysctl_tree, device_get_unit(dev),
-           ifp->if_serializer);
+       ifpoll_compat_setup(&sc->re_npoll, ctx, (struct sysctl_oid *)tree,
+           device_get_unit(dev), ifp->if_serializer);
 #endif
 
 #ifdef RE_DIAG
@@ -1712,9 +1696,6 @@ re_detach(device_t dev)
                device_delete_child(dev, sc->re_miibus);
        bus_generic_detach(dev);
 
-       if (sc->re_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->re_sysctl_ctx);
-
        if (sc->re_irq)
                bus_release_resource(dev, SYS_RES_IRQ, sc->re_irq_rid,
                                     sc->re_irq);
index 5c83fa6..bf36c2e 100644 (file)
@@ -33,7 +33,6 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/pci/if_rlreg.h,v 1.42 2004/05/24 19:39:23 jhb Exp $
- * $DragonFly: src/sys/dev/netif/re/if_revar.h,v 1.31 2008/10/21 12:31:01 sephe Exp $
  */
 
 #define RE_RX_DESC_CNT_8139CP  64
@@ -164,8 +163,6 @@ struct re_softc {
        int                     re_if_flags;    /* saved ifnet.if_flags */
 
        u_long                  re_hwassist;
-       struct sysctl_ctx_list  re_sysctl_ctx;
-       struct sysctl_oid       *re_sysctl_tree;
        uint16_t                re_intrs;
        uint16_t                re_tx_ack;
        uint16_t                re_rx_ack;
index 8282fa0..4f237b5 100644 (file)
@@ -1481,19 +1481,8 @@ skc_attach(device_t dev)
        /*
         * Create sysctl nodes.
         */
-       sysctl_ctx_init(&sc->sk_sysctl_ctx);
-       sc->sk_sysctl_tree = SYSCTL_ADD_NODE(&sc->sk_sysctl_ctx,
-                                            SYSCTL_STATIC_CHILDREN(_hw),
-                                            OID_AUTO,
-                                            device_get_nameunit(dev),
-                                            CTLFLAG_RD, 0, "");
-       if (sc->sk_sysctl_tree == NULL) {
-               device_printf(dev, "can't add sysctl node\n");
-               error = ENXIO;
-               goto fail;
-       }
-       SYSCTL_ADD_PROC(&sc->sk_sysctl_ctx,
-                       SYSCTL_CHILDREN(sc->sk_sysctl_tree),
+       SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+                       SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
                        OID_AUTO, "imtime", CTLTYPE_INT | CTLFLAG_RW,
                        sc, 0, skc_sysctl_imtime, "I",
                        "Interrupt moderation time (usec).");
@@ -1607,9 +1596,6 @@ skc_detach(device_t dev)
                                     sc->sk_res);
        }
 
-       if (sc->sk_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->sk_sysctl_ctx);
-
        return 0;
 }
 
index b222cc1..7df244d 100644 (file)
@@ -66,7 +66,6 @@
  * $FreeBSD: /c/ncvs/src/sys/pci/if_skreg.h,v 1.9 2000/04/22 02:16:37 wpaul Exp $
  * $NetBSD: if_skvar.h,v 1.6 2005/05/30 04:35:22 christos Exp $
  * $OpenBSD: if_skvar.h,v 1.2 2005/12/22 20:54:47 brad Exp $
- * $DragonFly: src/sys/dev/netif/sk/if_skvar.h,v 1.4 2007/12/14 11:37:11 sephe Exp $
  */
 
 /*
@@ -177,8 +176,6 @@ struct sk_softc {
        uint32_t                sk_intrmask;
        uint32_t                sk_imtimer_ticks;
        int                     sk_imtime;
-       struct sysctl_ctx_list  sk_sysctl_ctx;
-       struct sysctl_oid       *sk_sysctl_tree;
        struct lwkt_serialize   sk_serializer;
        struct sk_if_softc      *sk_if[2];
        device_t                sk_devs[2];
index f430a7a..3a36181 100644 (file)
@@ -570,6 +570,8 @@ stge_attach(device_t dev)
 {
        struct stge_softc *sc;
        struct ifnet *ifp;
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid *tree;
        uint8_t enaddr[ETHER_ADDR_LEN];
        int error, i;
        uint16_t cmd;
@@ -653,25 +655,13 @@ stge_attach(device_t dev)
        sc->sc_rxint_nframe = STGE_RXINT_NFRAME_DEFAULT;
        sc->sc_rxint_dmawait = STGE_RXINT_DMAWAIT_DEFAULT;
 
-       sysctl_ctx_init(&sc->sc_sysctl_ctx);
-       sc->sc_sysctl_tree = SYSCTL_ADD_NODE(&sc->sc_sysctl_ctx,
-                                            SYSCTL_STATIC_CHILDREN(_hw),
-                                            OID_AUTO,
-                                            device_get_nameunit(dev),
-                                            CTLFLAG_RD, 0, "");
-       if (sc->sc_sysctl_tree == NULL) {
-               device_printf(dev, "can't add sysctl node\n");
-               error = ENXIO;
-               goto fail;
-       }
-
-       SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       ctx = device_get_sysctl_ctx(dev);
+       tree = device_get_sysctl_tree(dev);
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "rxint_nframe", CTLTYPE_INT|CTLFLAG_RW, &sc->sc_rxint_nframe, 0,
            sysctl_hw_stge_rxint_nframe, "I", "stge rx interrupt nframe");
 
-       SYSCTL_ADD_PROC(&sc->sc_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->sc_sysctl_tree), OID_AUTO,
+       SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
            "rxint_dmawait", CTLTYPE_INT|CTLFLAG_RW, &sc->sc_rxint_dmawait, 0,
            sysctl_hw_stge_rxint_dmawait, "I", "stge rx interrupt dmawait");
 
@@ -765,9 +755,8 @@ stge_attach(device_t dev)
        ether_ifattach(ifp, enaddr, NULL);
 
 #ifdef IFPOLL_ENABLE
-       ifpoll_compat_setup(&sc->sc_npoll,
-           &sc->sc_sysctl_ctx, sc->sc_sysctl_tree, device_get_unit(dev),
-           ifp->if_serializer);
+       ifpoll_compat_setup(&sc->sc_npoll, ctx, (struct sysctl_oid *)tree,
+           device_get_unit(dev), ifp->if_serializer);
 #endif
 
        /* VLAN capability setup */
@@ -837,9 +826,6 @@ stge_detach(device_t dev)
                ether_ifdetach(ifp);
        }
 
-       if (sc->sc_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->sc_sysctl_ctx);
-
        if (sc->sc_miibus != NULL)
                device_delete_child(dev, sc->sc_miibus);
        bus_generic_detach(dev);
index d7181e0..8a44bfb 100644 (file)
@@ -1,6 +1,5 @@
 /*     $NetBSD: if_stgereg.h,v 1.3 2003/02/10 21:10:07 christos Exp $  */
 /*     $FreeBSD: src/sys/dev/stge/if_stgereg.h,v 1.1 2006/07/25 00:37:09 yongari Exp $ */
-/*     $DragonFly: src/sys/dev/netif/stge/if_stgevar.h,v 1.1 2006/11/16 13:43:55 sephe Exp $   */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -153,8 +152,6 @@ struct stge_softc {
        int                     sc_suspended;
        int                     sc_detach;
 
-       struct sysctl_ctx_list  sc_sysctl_ctx;
-       struct sysctl_oid       *sc_sysctl_tree;
        int                     sc_rxint_nframe;
        int                     sc_rxint_dmawait;
        int                     sc_nerr;
index e6e130c..8ce6b3f 100644 (file)
@@ -282,17 +282,8 @@ wi_attach(device_t dev)
        }
 
        /* Export info about the device via sysctl */
-       sctx = &sc->sc_sysctl_ctx;
-        sysctl_ctx_init(sctx);
-        soid = SYSCTL_ADD_NODE(sctx, SYSCTL_STATIC_CHILDREN(_hw),
-                               OID_AUTO,
-                               device_get_nameunit(sc->sc_dev),
-                               CTLFLAG_RD, 0, "");
-       if (soid == NULL) {
-               device_printf(sc->sc_dev, "can't add sysctl node\n");
-               return ENXIO;
-       }
-
+       sctx = device_get_sysctl_ctx(sc->sc_dev);
+       soid = device_get_sysctl_tree(sc->sc_dev);
        SYSCTL_ADD_STRING(sctx, SYSCTL_CHILDREN(soid), OID_AUTO,
            "firmware_type", CTLFLAG_RD,
            wi_firmware_names[sc->sc_firmware_type], 0,
index 71fb8f6..f5efc6a 100644 (file)
@@ -142,8 +142,6 @@ struct wi_softc     {
 
        struct wi_tx_radiotap_header sc_tx_th;
        struct wi_rx_radiotap_header sc_rx_th;
-
-       struct sysctl_ctx_list  sc_sysctl_ctx;
 };
 
 /* maximum consecutive false change-of-BSSID indications */
index 2997d33..ef9dd95 100644 (file)
@@ -292,16 +292,8 @@ aac_attach(struct aac_softc *sc)
        /*
         * Add sysctls.
         */
-       sysctl_ctx_init(&sc->aac_sysctl_ctx);
-       sc->aac_sysctl_tree = SYSCTL_ADD_NODE(&sc->aac_sysctl_ctx,
-           SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-           device_get_nameunit(sc->aac_dev), CTLFLAG_RD, 0, "");
-       if (sc->aac_sysctl_tree == NULL) {
-               device_printf(sc->aac_dev, "can't add sysctl node\n");
-               return (EINVAL);
-       }
-       SYSCTL_ADD_INT(&sc->aac_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->aac_sysctl_tree),
+       SYSCTL_ADD_INT(device_get_sysctl_ctx(sc->aac_dev),
+           SYSCTL_CHILDREN(device_get_sysctl_tree(sc->aac_dev)),
            OID_AUTO, "firmware_build", CTLFLAG_RD,
            &sc->aac_revision.buildNumber, 0,
            "firmware build number");
@@ -658,8 +650,6 @@ aac_free(struct aac_softc *sc)
                bus_release_resource(sc->aac_dev, SYS_RES_MEMORY,
                    rman_get_rid(sc->aac_regs_res1), sc->aac_regs_res1);
        dev_ops_remove_minor(&aac_ops, device_get_unit(sc->aac_dev));
-
-       sysctl_ctx_free(&sc->aac_sysctl_ctx);
 }
 
 /*
index 3284a0c..57791f5 100644 (file)
@@ -381,9 +381,6 @@ struct aac_softc
                                                         * task */
        struct intr_config_hook aac_ich;
 
-       struct sysctl_ctx_list  aac_sysctl_ctx;
-       struct sysctl_oid       *aac_sysctl_tree;
-
        /* management interface */
        struct cdev *aac_dev_t;
        struct lock             aac_aifq_lock;
index 7483fe5..2d2ac44 100644 (file)
@@ -242,14 +242,6 @@ amr_attach(struct amr_softc *sc)
     /*
      * Setup sysctls.
      */
-    sysctl_ctx_init(&sc->amr_sysctl_ctx);
-    sc->amr_sysctl_tree = SYSCTL_ADD_NODE(&sc->amr_sysctl_ctx,
-       SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-       device_get_nameunit(sc->amr_dev), CTLFLAG_RD, 0, "");
-    if (sc->amr_sysctl_tree == NULL) {
-       device_printf(sc->amr_dev, "can't add sysctl node\n");
-       return (EINVAL);
-    }
     amr_init_sysctl(sc);
 
     /*
@@ -354,21 +346,19 @@ amr_startup(void *arg)
 static void
 amr_init_sysctl(struct amr_softc *sc)
 {
+    struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->amr_dev);
+    struct sysctl_oid *tree = device_get_sysctl_tree(sc->amr_dev);
 
-    SYSCTL_ADD_INT(&sc->amr_sysctl_ctx,
-       SYSCTL_CHILDREN(sc->amr_sysctl_tree),
+    SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
        OID_AUTO, "allow_volume_configure", CTLFLAG_RW, &sc->amr_allow_vol_config, 0,
        "");
-    SYSCTL_ADD_INT(&sc->amr_sysctl_ctx,
-       SYSCTL_CHILDREN(sc->amr_sysctl_tree),
+    SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
        OID_AUTO, "nextslot", CTLFLAG_RD, &sc->amr_nextslot, 0,
        "");
-    SYSCTL_ADD_INT(&sc->amr_sysctl_ctx,
-       SYSCTL_CHILDREN(sc->amr_sysctl_tree),
+    SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
        OID_AUTO, "busyslots", CTLFLAG_RD, &sc->amr_busyslots, 0,
        "");
-    SYSCTL_ADD_INT(&sc->amr_sysctl_ctx,
-       SYSCTL_CHILDREN(sc->amr_sysctl_tree),
+    SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree),
        OID_AUTO, "maxio", CTLFLAG_RD, &sc->amr_maxio, 0,
        "");
 }
@@ -405,9 +395,6 @@ amr_free(struct amr_softc *sc)
        mtx_destroy(&sc->amr_list_lock);
 #endif
 
-    if (sc->amr_sysctl_tree != NULL)
-           sysctl_ctx_free(&sc->amr_sysctl_ctx);
-
     lockuninit(&sc->amr_hw_lock);
     lockuninit(&sc->amr_list_lock);
 }
index 7062eef..0638255 100644 (file)
@@ -242,9 +242,6 @@ struct amr_softc
     struct cdev                        *amr_dev_t;
     struct lock                        amr_list_lock;
 
-    struct sysctl_ctx_list     amr_sysctl_ctx;
-    struct sysctl_oid          *amr_sysctl_tree;
-
     /* controller type-specific support */
     int                                amr_type;
 #define AMR_TYPE_QUARTZ                (1<<0)
index 0981b3e..1118441 100644 (file)
@@ -559,12 +559,8 @@ ciss_shutdown(device_t dev)
 static void
 ciss_init_sysctl(struct ciss_softc *sc)
 {
-    sysctl_ctx_init(&sc->ciss_sysctl_ctx);
-    sc->ciss_sysctl_tree = SYSCTL_ADD_NODE(&sc->ciss_sysctl_ctx,
-       SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-       device_get_nameunit(sc->ciss_dev), CTLFLAG_RD, 0, "");
-    SYSCTL_ADD_INT(&sc->ciss_sysctl_ctx,
-       SYSCTL_CHILDREN(sc->ciss_sysctl_tree),
+    SYSCTL_ADD_INT(device_get_sysctl_ctx(sc->ciss_dev),
+       SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ciss_dev)),
        OID_AUTO, "soft_reset", CTLFLAG_RW, &sc->ciss_soft_reset, 0, "");
 }
 
@@ -1979,8 +1975,6 @@ ciss_free(struct ciss_softc *sc)
 
     if (sc->ciss_controllers)
        kfree(sc->ciss_controllers, CISS_MALLOC_CLASS);
-
-    sysctl_ctx_free(&sc->ciss_sysctl_ctx);
 }
 
 /************************************************************************
index 6a873ab..807769a 100644 (file)
@@ -239,9 +239,6 @@ struct ciss_softc
 
     int                                ciss_soft_reset;
 
-    struct sysctl_ctx_list     ciss_sysctl_ctx;
-    struct sysctl_oid          *ciss_sysctl_tree;
-
     int                                ciss_flags;
 #define CISS_FLAG_NOTIFY_OK    (1<<0)          /* notify command running OK */
 #define CISS_FLAG_CONTROL_OPEN (1<<1)          /* control device is open */
index b525355..afcc2cf 100644 (file)
@@ -732,20 +732,12 @@ mfi_attach(struct mfi_softc *sc)
                make_dev_alias(sc->mfi_cdev, "megaraid_sas_ioctl_node");
        if (sc->mfi_cdev != NULL)
                sc->mfi_cdev->si_drv1 = sc;
-       sysctl_ctx_init(&sc->mfi_sysctl_ctx);
-       sc->mfi_sysctl_tree = SYSCTL_ADD_NODE(&sc->mfi_sysctl_ctx,
-           SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-           device_get_nameunit(sc->mfi_dev), CTLFLAG_RD, 0, "");
-       if (sc->mfi_sysctl_tree == NULL) {
-               device_printf(sc->mfi_dev, "can't add sysctl node\n");
-               return (EINVAL);
-       }
-       SYSCTL_ADD_INT(&sc->mfi_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->mfi_sysctl_tree),
+       SYSCTL_ADD_INT(device_get_sysctl_ctx(sc->mfi_dev),
+           SYSCTL_CHILDREN(device_get_sysctl_tree(sc->mfi_dev)),
            OID_AUTO, "delete_busy_volumes", CTLFLAG_RW,
            &sc->mfi_delete_busy_volumes, 0, "Allow removal of busy volumes");
-       SYSCTL_ADD_INT(&sc->mfi_sysctl_ctx,
-           SYSCTL_CHILDREN(sc->mfi_sysctl_tree),
+       SYSCTL_ADD_INT(device_get_sysctl_ctx(sc->mfi_dev),
+           SYSCTL_CHILDREN(device_get_sysctl_tree(sc->mfi_dev)),
            OID_AUTO, "keep_deleted_volumes", CTLFLAG_RW,
            &sc->mfi_keep_deleted_volumes, 0,
            "Don't detach the mfid device for a busy volume that is deleted");
@@ -1194,9 +1186,6 @@ mfi_free(struct mfi_softc *sc)
        if (sc->mfi_parent_dmat != NULL)
                bus_dma_tag_destroy(sc->mfi_parent_dmat);
 
-       if (sc->mfi_sysctl_tree != NULL)
-               sysctl_ctx_free(&sc->mfi_sysctl_ctx);
-
 #if 0 /* XXX swildner: not sure if we need something like mtx_initialized() */
        if (mtx_initialized(&sc->mfi_io_lock))
 #endif
index 18eb7d7..db64f58 100644 (file)
@@ -305,9 +305,6 @@ struct mfi_softc {
        struct lock                     mfi_io_lock;
        struct lock                     mfi_config_lock;
 
-       struct sysctl_ctx_list          mfi_sysctl_ctx;
-       struct sysctl_oid               *mfi_sysctl_tree;
-
        /* Controller type specific interfaces */
        void    (*mfi_enable_intr)(struct mfi_softc *sc);
        void    (*mfi_disable_intr)(struct mfi_softc *sc);
index 1c6051a..44ac371 100644 (file)
@@ -380,13 +380,11 @@ mrsas_setup_sysctl(struct mrsas_softc *sc)
        device_get_unit(sc->mrsas_dev));
     ksnprintf(tmpstr2, sizeof(tmpstr2), "mrsas%d", device_get_unit(sc->mrsas_dev));
 
-#if 0
     sysctl_ctx = device_get_sysctl_ctx(sc->mrsas_dev);
     if (sysctl_ctx != NULL)
         sysctl_tree = device_get_sysctl_tree(sc->mrsas_dev);
 
     if (sysctl_tree == NULL) {
-#endif
         sysctl_ctx_init(&sc->sysctl_ctx);
         sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
             SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO, tmpstr2,
@@ -395,9 +393,7 @@ mrsas_setup_sysctl(struct mrsas_softc *sc)
              return;
         sysctl_ctx = &sc->sysctl_ctx;
         sysctl_tree = sc->sysctl_tree;
-#if 0
     }
-#endif
     SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
         OID_AUTO, "disable_ocr", CTLFLAG_RW, &sc->disableOnlineCtrlReset, 0,
         "Disable the use of OCR");
index 2ddf123..16d71cf 100644 (file)
@@ -173,9 +173,6 @@ struct twa_softc {
        TW_INT32                irq_type;       /* interrupt type */
        TW_VOID                 *intr_handle;   /* interrupt handle */
 
-       struct sysctl_ctx_list  sysctl_ctxt;    /* sysctl context */
-       struct sysctl_oid       *sysctl_tree;   /* sysctl oid */
-
        struct cam_sim          *sim;   /* sim for this controller */
        struct cam_path         *path;  /* peripheral, path, tgt, lun
                                        associated with this controller */
index 4c5f1ab..fdd68c8 100644 (file)
@@ -312,20 +312,8 @@ twa_attach(device_t dev)
        sc->sim_lock = &(sc->sim_lock_handle);
        lockinit(sc->sim_lock, "tw_osl_sim_lock", 0, LK_CANRECURSE);
 
-       sysctl_ctx_init(&sc->sysctl_ctxt);
-       sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctxt,
-               SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-               device_get_nameunit(dev), CTLFLAG_RD, 0, "");
-       if (sc->sysctl_tree == NULL) {
-               tw_osli_printf(sc, "error = %d",
-                       TW_CL_SEVERITY_ERROR_STRING,
-                       TW_CL_MESSAGE_SOURCE_FREEBSD_DRIVER,
-                       0x2000,
-                       "Cannot add sysctl tree node",
-                       ENXIO);
-               return(ENXIO);
-       }
-       SYSCTL_ADD_STRING(&sc->sysctl_ctxt, SYSCTL_CHILDREN(sc->sysctl_tree),
+       SYSCTL_ADD_STRING(device_get_sysctl_ctx(dev),
+               SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
                OID_AUTO, "driver_version", CTLFLAG_RD,
                TW_OSL_DRIVER_VERSION_STRING, 0, "TWA driver version");
 
@@ -794,11 +782,6 @@ tw_osli_free_resources(struct twa_softc *sc)
        if (sc->ctrl_dev != NULL)
                destroy_dev(sc->ctrl_dev);
        dev_ops_remove_minor(&twa_ops, device_get_unit(sc->bus_dev));
-
-       if ((error = sysctl_ctx_free(&sc->sysctl_ctxt)))
-               tw_osli_dbg_dprintf(1, sc,
-                       "sysctl_ctx_free returned %d", error);
-
 }
 
 
index 16f931c..d99b837 100644 (file)
@@ -80,8 +80,6 @@
     void                       *twe_cmd;               /* command structures */        \
     void                       *twe_immediate;         /* immediate commands */        \
     bus_dmamap_t               twe_immediate_map;                                      \
-    struct sysctl_ctx_list     sysctl_ctx;                                             \
-    struct sysctl_oid          *sysctl_tree;                                           \
     struct lock                        twe_io_lock;                                            \
     struct lock                        twe_config_lock;
 
index 95f436e..693915b 100644 (file)
@@ -196,15 +196,8 @@ twe_attach(device_t dev)
     lockinit(&sc->twe_io_lock, "twe I/O", 0, LK_CANRECURSE);
     lockinit(&sc->twe_config_lock, "twe config", 0, LK_CANRECURSE);
 
-    sysctl_ctx_init(&sc->sysctl_ctx);
-    sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
-       SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-       device_get_nameunit(dev), CTLFLAG_RD, 0, "");
-    if (sc->sysctl_tree == NULL) {
-       twe_printf(sc, "cannot add sysctl tree node\n");
-       return (ENXIO);
-    }
-    SYSCTL_ADD_STRING(&sc->sysctl_ctx, SYSCTL_CHILDREN(sc->sysctl_tree),
+    SYSCTL_ADD_STRING(device_get_sysctl_ctx(dev),
+       SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
        OID_AUTO, "driver_version", CTLFLAG_RD, TWE_DRIVER_VERSION_STRING, 0,
        "TWE driver version");
 
@@ -423,7 +416,6 @@ twe_free(struct twe_softc *sc)
        destroy_dev(sc->twe_dev_t);
     dev_ops_remove_minor(&twe_ops, device_get_unit(sc->twe_dev));
 
-    sysctl_ctx_free(&sc->sysctl_ctx);
     lockuninit(&sc->twe_config_lock);
     lockuninit(&sc->twe_io_lock);
 }
index b4f75b7..a7fb718 100644 (file)
@@ -208,17 +208,8 @@ tws_attach(device_t dev)
 #if _BYTE_ORDER == _BIG_ENDIAN
     TWS_TRACE(sc, "BIG endian", 0, 0);
 #endif
-    /* sysctl context setup */
-    sysctl_ctx_init(&sc->tws_clist);
-    sc->tws_oidp = SYSCTL_ADD_NODE(&sc->tws_clist,
-                                   SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-                                   device_get_nameunit(dev),
-                                   CTLFLAG_RD, 0, "");
-    if ( sc->tws_oidp == NULL ) {
-        tws_log(sc, SYSCTL_TREE_NODE_ADD);
-        goto attach_fail_1;
-    }
-    SYSCTL_ADD_STRING(&sc->tws_clist, SYSCTL_CHILDREN(sc->tws_oidp),
+    SYSCTL_ADD_STRING(device_get_sysctl_ctx(dev),
+                     SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
                       OID_AUTO, "driver_version", CTLFLAG_RD,
                       TWS_DRIVER_VERSION_STRING, 0, "TWS driver version");
 
@@ -345,7 +336,6 @@ attach_fail_1:
     lockuninit(&sc->sim_lock);
     lockuninit(&sc->gen_lock);
     lockuninit(&sc->io_lock);
-    sysctl_ctx_free(&sc->tws_clist);
     return (ENXIO);
 }
 
@@ -414,7 +404,6 @@ tws_detach(device_t dev)
     lockuninit(&sc->io_lock);
     destroy_dev(sc->tws_cdev);
     dev_ops_remove_minor(&tws_ops, device_get_unit(sc->tws_dev));
-    sysctl_ctx_free(&sc->tws_clist);
     return (0);
 }
 
index 0e27be1..b385450 100644 (file)
@@ -219,8 +219,6 @@ struct tws_softc {
     u_int32_t   subdevice_id;             /* device id */
     u_int8_t    tws_state;                /* driver state */
     u_int8_t    tws_prev_state;           /* driver prev state */
-    struct sysctl_ctx_list tws_clist;     /* sysctl context */
-    struct sysctl_oid *tws_oidp;          /* sysctl context */
     struct resource *reg_res;             /* register interface window */
     struct resource *mfa_res;             /* mfa interface window */
     int reg_res_id;                       /* register resource id */
index ab1e386..7277c1d 100644 (file)
@@ -128,9 +128,6 @@ struct vtnet_softc {
 
        struct vtnet_statistics vtnet_stats;
 
-       struct sysctl_ctx_list  vtnet_sysctl_ctx;
-       struct sysctl_oid       *vtnet_sysctl_tree;
-
        struct callout          vtnet_tick_ch;
 
        eventhandler_tag        vtnet_vlan_attach;
@@ -2607,77 +2604,65 @@ vtnet_add_statistics(struct vtnet_softc *sc)
 {
        device_t dev;
        struct vtnet_statistics *stats;
-        //struct sysctl_ctx_list *ctx;
-       //struct sysctl_oid *tree;
-       //struct sysctl_oid_list *child;
-       int error = 0;
+       struct sysctl_ctx_list *ctx;
+       struct sysctl_oid *tree;
+       struct sysctl_oid_list *child;
 
        dev = sc->vtnet_dev;
        stats = &sc->vtnet_stats;
-       sysctl_ctx_init(&sc->vtnet_sysctl_ctx);
-       sc->vtnet_sysctl_tree = SYSCTL_ADD_NODE(&sc->vtnet_sysctl_ctx,
-                                               SYSCTL_STATIC_CHILDREN(_hw),
-                                               OID_AUTO,
-                                               device_get_nameunit(dev),
-                                               CTLFLAG_RD, 0, "");
-
-       if (sc->vtnet_sysctl_tree == NULL) {
-               device_printf(dev, "can't add sysctl node\n");
-               error = ENXIO;
-       }
-
-
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx,
-                        SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO,
-                        "mbuf_alloc_failed", CTLFLAG_RD, &stats->mbuf_alloc_failed,
-                        "Mbuf cluster allocation failures");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx,
-                        SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO,
-                        "rx_frame_too_large", CTLFLAG_RD, &stats->rx_frame_too_large,
-                        "Received frame larger than the mbuf chain");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx,SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "rx_enq_replacement_failed",
+       ctx = device_get_sysctl_ctx(dev);
+       tree = device_get_sysctl_tree(dev);
+       child = SYSCTL_CHILDREN(tree);
+
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "mbuf_alloc_failed",
+           CTLFLAG_RD, &stats->mbuf_alloc_failed,
+           "Mbuf cluster allocation failures");
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_frame_too_large",
+           CTLFLAG_RD, &stats->rx_frame_too_large,
+           "Received frame larger than the mbuf chain");
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_enq_replacement_failed",
            CTLFLAG_RD, &stats->rx_enq_replacement_failed,
            "Enqueuing the replacement receive mbuf failed");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "rx_mergeable_failed",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_mergeable_failed",
            CTLFLAG_RD, &stats->rx_mergeable_failed,
            "Mergeable buffers receive failures");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "rx_csum_bad_ethtype",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_csum_bad_ethtype",
            CTLFLAG_RD, &stats->rx_csum_bad_ethtype,
            "Received checksum offloaded buffer with unsupported "
            "Ethernet type");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "rx_csum_bad_start",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_csum_bad_start",
            CTLFLAG_RD, &stats->rx_csum_bad_start,
            "Received checksum offloaded buffer with incorrect start offset");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "rx_csum_bad_ipproto",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_csum_bad_ipproto",
            CTLFLAG_RD, &stats->rx_csum_bad_ipproto,
            "Received checksum offloaded buffer with incorrect IP protocol");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "rx_csum_bad_offset",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_csum_bad_offset",
            CTLFLAG_RD, &stats->rx_csum_bad_offset,
            "Received checksum offloaded buffer with incorrect offset");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "rx_csum_failed",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_csum_failed",
            CTLFLAG_RD, &stats->rx_csum_failed,
            "Received buffer checksum offload failed");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "rx_csum_offloaded",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_csum_offloaded",
            CTLFLAG_RD, &stats->rx_csum_offloaded,
            "Received buffer checksum offload succeeded");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "rx_task_rescheduled",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "rx_task_rescheduled",
            CTLFLAG_RD, &stats->rx_task_rescheduled,
            "Times the receive interrupt task rescheduled itself");
 
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "tx_csum_offloaded",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_csum_offloaded",
            CTLFLAG_RD, &stats->tx_csum_offloaded,
            "Offloaded checksum of transmitted buffer");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "tx_tso_offloaded",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_tso_offloaded",
            CTLFLAG_RD, &stats->tx_tso_offloaded,
            "Segmentation offload of transmitted buffer");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "tx_csum_bad_ethtype",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_csum_bad_ethtype",
            CTLFLAG_RD, &stats->tx_csum_bad_ethtype,
            "Aborted transmit of checksum offloaded buffer with unknown "
            "Ethernet type");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "tx_tso_bad_ethtype",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_tso_bad_ethtype",
            CTLFLAG_RD, &stats->tx_tso_bad_ethtype,
            "Aborted transmit of TSO buffer with unknown Ethernet type");
-       SYSCTL_ADD_ULONG(&sc->vtnet_sysctl_ctx, SYSCTL_CHILDREN(sc->vtnet_sysctl_tree), OID_AUTO, "tx_task_rescheduled",
+       SYSCTL_ADD_ULONG(ctx, child, OID_AUTO, "tx_task_rescheduled",
            CTLFLAG_RD, &stats->tx_task_rescheduled,
            "Times the transmit interrupt task rescheduled itself");
 }
index f5c72a2..5143334 100644 (file)
@@ -272,13 +272,6 @@ ndis_create_sysctls(void *arg)
 
        TAILQ_INIT(&sc->ndis_cfglist_head);
 
-       /* Create the sysctl tree. */
-
-       sc->ndis_tree = SYSCTL_ADD_NODE(&sc->ndis_ctx,
-           SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
-           device_get_nameunit(sc->ndis_dev), CTLFLAG_RD, 0,
-           device_get_desc(sc->ndis_dev));
-
        /* Add the driver-specific registry keys. */
 
        while(1) {
@@ -293,7 +286,7 @@ ndis_create_sysctls(void *arg)
                /* See if we already have a sysctl with this name */
 
                oidp = NULL;
-               TAILQ_FOREACH(e, &sc->ndis_ctx, link) {
+               TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
                        oidp = e->entry;
                        if (strcasecmp(oidp->oid_name, vals->nc_cfgkey) == 0)
                                break;
@@ -373,7 +366,8 @@ ndis_add_sysctl(void *arg, char *key, char *desc, char *val, int flag)
        TAILQ_INSERT_TAIL(&sc->ndis_cfglist_head, cfg, link);
 
        cfg->ndis_oid =
-       SYSCTL_ADD_STRING(&sc->ndis_ctx, SYSCTL_CHILDREN(sc->ndis_tree),
+           SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev),
+           SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)),
            OID_AUTO, cfg->ndis_cfg.nc_cfgkey, flag,
            cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val),
            cfg->ndis_cfg.nc_cfgdesc);
@@ -397,7 +391,7 @@ ndis_flush_sysctls(void *arg)
 
        sc = arg;
 
-       clist = &sc->ndis_ctx;
+       clist = device_get_sysctl_ctx(sc->ndis_dev);
 
        while (!TAILQ_EMPTY(&sc->ndis_cfglist_head)) {
                cfg = TAILQ_FIRST(&sc->ndis_cfglist_head);
index abbeafc..26ccd71 100644 (file)
@@ -599,7 +599,7 @@ NdisReadConfiguration(ndis_status *status, ndis_config_parm **parm,
         * See if registry key is already in a list of known keys
         * included with the driver.
         */
-       TAILQ_FOREACH(e, &sc->ndis_ctx, link) {
+       TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
                oidp = e->entry;
                if (strcasecmp(oidp->oid_name, keystr) == 0) {
                        if (strcmp((char *)oidp->oid_arg1, "UNSET") == 0) {
@@ -696,7 +696,7 @@ NdisWriteConfiguration(ndis_status *status, ndis_handle cfg,
 
        /* See if the key already exists. */
 
-       TAILQ_FOREACH(e, &sc->ndis_ctx, link) {
+       TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
                oidp = e->entry;
                if (strcasecmp(oidp->oid_name, keystr) == 0) {
                        /* Found it, set the value. */