Is it possible to change the log level of a device driver at runtime?

John-Mark Gurney jmg at funkthat.com
Fri Nov 4 04:11:59 UTC 2011


Adarsh Joshi wrote this message on Thu, Nov 03, 2011 at 11:42 -0700:
> The driver is not yet in the tree.
> 
> I am trying to implement the change of debug level at run time. Can you kindly explain how do I do it? ( by setting the sysctl as you mentioned)

There are two different ways...  If you want it to apply to all
instances of your driver, take a look at the SYSCTL(9) manpage...
You'll probably want to use SYSCTL_INT...

If you want it to be on a per device basis, you can use
device_get_sysctl_ctx to get the sysctl context for your driver, and
use SYSCTL_ADD_xxx w/ that context...

If you need to have it set at boot time, include a TUNABLE_INT...

Hope this helps!  And take a look at how other drivers do it... A
driver like sys/dev/e1000/if_em.c has some good examples...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."


More information about the freebsd-drivers mailing list