From owner-freebsd-drivers@FreeBSD.ORG Fri Nov 4 04:11:59 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B7FA106564A for ; Fri, 4 Nov 2011 04:11:59 +0000 (UTC) (envelope-from jmg@h2.funkthat.com) Received: from h2.funkthat.com (gate.funkthat.com [70.36.235.232]) by mx1.freebsd.org (Postfix) with ESMTP id 073F38FC1D for ; Fri, 4 Nov 2011 04:11:58 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id pA44Bw5L059663 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 3 Nov 2011 21:11:58 -0700 (PDT) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id pA44Bwgb059662; Thu, 3 Nov 2011 21:11:58 -0700 (PDT) (envelope-from jmg) Date: Thu, 3 Nov 2011 21:11:58 -0700 From: John-Mark Gurney To: Adarsh Joshi Message-ID: <20111104041157.GG25601@funkthat.com> Mail-Followup-To: Adarsh Joshi , "freebsd-drivers@freebsd.org" References: <5E4F49720D0BAD499EE1F01232234BA873C6F1A523@AVEXMB1.qlogic.org> <20111103183637.GD25601@funkthat.com> <5E4F49720D0BAD499EE1F01232234BA873C6F1A540@AVEXMB1.qlogic.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5E4F49720D0BAD499EE1F01232234BA873C6F1A540@AVEXMB1.qlogic.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Thu, 03 Nov 2011 21:11:58 -0700 (PDT) Cc: "freebsd-drivers@freebsd.org" Subject: Re: Is it possible to change the log level of a device driver at runtime? X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2011 04:11:59 -0000 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."