Thread (1 message) 1 message, 1 author, 2003-11-20

Re: suggested forcedeth updates....

From: Rask Ingemann Lambertsen <hidden>
Date: 2003-11-20 17:04:31

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help