netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* suggested forcedeth updates....
@ 2003-11-18  4:07 Alexander Zapatka
  2003-11-19 11:48 ` Rask Ingemann Lambertsen
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Zapatka @ 2003-11-18  4:07 UTC (permalink / raw)
  To: netdev

first let me say that forcedeth is a great project!!! i have been using it 
since you have released it and it is awesome....

but about the debuging thing having to change 1 to 0 and recompile is not 
always the easiest thing... so what i did was change the code to look like 
this:

static int debug = 0;
MODULE_PARM(debug,"i");
#if debug
#define dprintk			printk
#else
#define dprintk(x...)		do { } while (0)
#endif

that way you can modprobe/insmod with debug=1 and debuging works... or you 
can just load it, or load it with debug=0 and no debuging info is printed.

just thought it might be a nice addition.
      -o)
      /\\    Message void if penguin violated
     _\_V    Don't mess with the penguin

_________________________________________________________________
Send a QuickGreet with MSN Messenger 
http://www.msnmessenger-download.com/tracking/cdp_games

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: suggested forcedeth updates....
  2003-11-18  4:07 suggested forcedeth updates Alexander Zapatka
@ 2003-11-19 11:48 ` Rask Ingemann Lambertsen
  2003-11-19 14:06   ` Jeff Garzik
  0 siblings, 1 reply; 5+ messages in thread
From: Rask Ingemann Lambertsen @ 2003-11-19 11:48 UTC (permalink / raw)
  To: Alexander Zapatka; +Cc: netdev

On Mon, Nov 17, 2003 at 11:07:15PM -0500, Alexander Zapatka wrote:

> that way you can modprobe/insmod with debug=1 and debuging works... or you 
> can just load it, or load it with debug=0 and no debuging info is printed.
> 
> just thought it might be a nice addition.

Even better would be to use the NETIF_MSG_* flags defined in
linux/netdevice.c and to be able to use ethtool to change the setting at
runtime.

-- 
Regards,
Rask Ingemann Lambertsen

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: suggested forcedeth updates....
  2003-11-19 11:48 ` Rask Ingemann Lambertsen
@ 2003-11-19 14:06   ` Jeff Garzik
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2003-11-19 14:06 UTC (permalink / raw)
  To: Rask Ingemann Lambertsen; +Cc: Alexander Zapatka, netdev

Rask Ingemann Lambertsen wrote:
> On Mon, Nov 17, 2003 at 11:07:15PM -0500, Alexander Zapatka wrote:
> 
> 
>>that way you can modprobe/insmod with debug=1 and debuging works... or you 
>>can just load it, or load it with debug=0 and no debuging info is printed.
>>
>>just thought it might be a nice addition.
> 
> 
> Even better would be to use the NETIF_MSG_* flags defined in
> linux/netdevice.c and to be able to use ethtool to change the setting at
> runtime.


agreed...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: suggested forcedeth updates....
@ 2003-11-19 15:06 Alexander Zapatka
  2003-11-20 17:04 ` Rask Ingemann Lambertsen
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander Zapatka @ 2003-11-19 15:06 UTC (permalink / raw)
  To: rask, jgarzik; +Cc: netdev

thats a great idea!  except i dont know how to implement it in a patch :)  
hope it makes it in to the next version.



      -o)
      /\\    Message void if penguin violated
     _\_V    Don't mess with the penguin






----Original Message Follows----
From: Rask Ingemann Lambertsen <rask@sygehus.dk>
To: Alexander Zapatka <alexzapatka@hotmail.com>
CC: netdev@oss.sgi.com
Subject: Re: suggested forcedeth updates....
Date: Wed, 19 Nov 2003 12:48:45 +0100
MIME-Version: 1.0
Received: from 0x50a14406.albnxx15.adsl-dhcp.tele.dk ([80.161.68.6]) by 
mc7-f27.hotmail.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 19 Nov 2003 
03:51:36 -0800
Received: by 0x50a14406.albnxx15.adsl-dhcp.tele.dk (Postfix, from userid 
500)id A24BC42B3; Wed, 19 Nov 2003 12:48:45 +0100 (CET)
X-Message-Info: JGTYoYF78jH14zHqGtQ8WJps3LyBHhOo
Message-ID: <20031119124845.B7622@sygehus.dk>
References: <BAY2-F101QTmReozTIA0001027c@hotmail.com>
User-Agent: Mutt/1.2.5.1i
In-Reply-To: <BAY2-F101QTmReozTIA0001027c@hotmail.com>; from 
alexzapatka@hotmail.com on Mon, Nov 17, 2003 at 11:07:15PM -0500
Return-Path: rask@sygehus.dk
X-OriginalArrivalTime: 19 Nov 2003 11:51:53.0303 (UTC) 
FILETIME=[864B8E70:01C3AE93]

On Mon, Nov 17, 2003 at 11:07:15PM -0500, Alexander Zapatka wrote:

 > that way you can modprobe/insmod with debug=1 and debuging works... or 
you
 > can just load it, or load it with debug=0 and no debuging info is 
printed.
 >
 > just thought it might be a nice addition.

Even better would be to use the NETIF_MSG_* flags defined in
linux/netdevice.c and to be able to use ethtool to change the setting at
runtime.

--
Regards,
Rask Ingemann Lambertsen

_________________________________________________________________
Say “goodbye” to busy signals and slow downloads with a high-speed Internet 
connection! Prices start at less than $1 a day average.  
https://broadband.msn.com (Prices may vary by service area.)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: suggested forcedeth updates....
  2003-11-19 15:06 Alexander Zapatka
@ 2003-11-20 17:04 ` Rask Ingemann Lambertsen
  0 siblings, 0 replies; 5+ messages in thread
From: Rask Ingemann Lambertsen @ 2003-11-20 17:04 UTC (permalink / raw)
  To: Alexander Zapatka; +Cc: netdev

On Wed, Nov 19, 2003 at 10:06:13AM -0500, Alexander Zapatka wrote:
> thats a great idea!  except i dont know how to implement it in a patch :)  
> hope it makes it in to the next version.

It is fairly simple. In the driver private structure, add a field named
"msg_enable". In the probe function (the one where alloc_etherdev() is
called), set the msg_enable field from the global debug variable. Then,
use the macros from linux/netdevice.h to see if the debug output should be
printed. For example:

void forcedeth_init_one (stuff)
{
	struct forcedeth_private *fp;
	...
	dev = alloc_etherdev (sizeof (struct forcedeth_private));
	...
	fp = dev->priv;
	fp->msg_enable = debug;
	...
	register_netdev (dev);
}

void forcedeth_rx_one (stuff)
{
	struct forcedeth_private *fp = dev->priv;

	if (unlikely (netif_msg_rx_data (fp))) {
		printk_packet_data ();
	}
}

And so on. In some cases you may not have a dev and thus no dev->priv and
need to use the NETIF_MSG_* flags directly, e.g.

	if (debug & NETIF_MSG_HW)
		dump_registers();

but I think that will only happen early in the probe function.

Then there is the ethtool part. This used to involve a lots of ioctl() grot
in every driver that wanted to be ethtool capable, but have a look at the
dev->ethtool_ops patches posted recently, as they should simplify things a lot.

-- 
Regards,
Rask Ingemann Lambertsen

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-11-20 17:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-18  4:07 suggested forcedeth updates Alexander Zapatka
2003-11-19 11:48 ` Rask Ingemann Lambertsen
2003-11-19 14:06   ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2003-11-19 15:06 Alexander Zapatka
2003-11-20 17:04 ` Rask Ingemann Lambertsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).