cvs commit: src/sys/pci if_ste.c

M. Warner Losh imp at
Sun Apr 4 18:12:52 PDT 2004

In message: <20040404134458.C2452 at>
            Bruce Evans <bde at> writes:
: Using sysctl in device drivers is bad practice, but fixing this is
: nontrivial.

I'm curious, what makes it bad practice?  Is there a layering
violation?  Is there something else?

I ask because I think that there's support for having both a hw.*
heirarchy to control the global aspects of drivers (which is wide
spread) and dev.* to reflect the dev tree to userland (DES' set of
patches, or similar, have been warmly received on arch@), as well as
provide per-interface tunables and statistics.

: Bugs result from this bad practice even for the new sysctl in if_ste.c:
: - the counter is global but the problem is per-interface.  Sysctls
:   using globals are easy to hack up, but this don't work so well for
:   multiple interfaces.

This is true.

: - accesses to the global counter are not locked.  SE_LOCK() is
:   per-interface.

This is also true.


More information about the cvs-src mailing list