From: Rask Ingemann Lambertsen <rask@sygehus.dk>
To: Alexander Zapatka <alexzapatka@hotmail.com>
Cc: netdev@oss.sgi.com
Subject: Re: suggested forcedeth updates....
Date: Thu, 20 Nov 2003 18:04:31 +0100 [thread overview]
Message-ID: <20031120180428.B1538@sygehus.dk> (raw)
In-Reply-To: <BAY2-F153s0m7nz605N0001807b@hotmail.com>; from alexzapatka@hotmail.com on Wed, Nov 19, 2003 at 10:06:13AM -0500
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
next prev parent reply other threads:[~2003-11-20 17:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-19 15:06 suggested forcedeth updates Alexander Zapatka
2003-11-20 17:04 ` Rask Ingemann Lambertsen [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-11-18 4:07 Alexander Zapatka
2003-11-19 11:48 ` Rask Ingemann Lambertsen
2003-11-19 14:06 ` Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031120180428.B1538@sygehus.dk \
--to=rask@sygehus.dk \
--cc=alexzapatka@hotmail.com \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).