From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Auke Kok <auke-jan.h.kok@intel.com>
Cc: netdev@vger.kernel.org, jeff@garzik.org, davem@davemloft.net,
arjan@linux.intel.com
Subject: Re: [PATCH 1/2] [RFC] NET: Implement a standard ndev_printk family
Date: Fri, 8 Jun 2007 16:24:15 -0700 [thread overview]
Message-ID: <20070608162415.1481dfec@localhost.localdomain> (raw)
In-Reply-To: <20070608220007.31573.14931.stgit@localhost.localdomain>
>
> +#define ndev_printk(kern_level, netif_level, netdev, format, arg...) \
> + do { if ((netdev)->msg_enable & NETIF_MSG_##netif_level) { \
> + printk(kern_level "%s: " format, \
> + (netdev)->name, ## arg); } } while (0)
Could you make a version that doesn't evaluate the arguments twice?
> +#ifdef DEBUG
> +#define ndev_dbg(level, netdev, format, arg...) \
> + ndev_printk(KERN_DEBUG, level, netdev, format, ## arg)
> +#else
> +#define ndev_dbg(level, netdev, format, arg...) \
> + do { (void)(netdev); } while (0)
> +#endif
> +
> +#define ndev_err(level, netdev, format, arg...) \
> + ndev_printk(KERN_ERR, level, netdev, format, ## arg)
> +#define ndev_info(level, netdev, format, arg...) \
> + ndev_printk(KERN_INFO, level, netdev, format, ## arg)
> +#define ndev_warn(level, netdev, format, arg...) \
> + ndev_printk(KERN_WARNING, level, netdev, format, ## arg)
> +#define ndev_notice(level, netdev, format, arg...) \
> + ndev_printk(KERN_NOTICE, level, netdev, format, ## arg)
> +
> #define netif_msg_drv(p) ((p)->msg_enable & NETIF_MSG_DRV)
> #define netif_msg_probe(p) ((p)->msg_enable & NETIF_MSG_PROBE)
> #define netif_msg_link(p) ((p)->msg_enable & NETIF_MSG_LINK)
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 5a7f20f..e854c09 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3376,6 +3376,16 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name,
> dev->priv = netdev_priv(dev);
>
> dev->get_stats = internal_stats;
> + dev->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK;
> +#ifdef DEBUG
> + /* put these to good use: */
> + dev->msg_enable |= NETIF_MSG_TIMER | NETIF_MSG_IFDOWN |
> + NETIF_MSG_IFUP | NETIF_MSG_RX_ERR |
> + NETIF_MSG_TX_ERR | NETIF_MSG_TX_QUEUED |
> + NETIF_MSG_INTR | NETIF_MSG_TX_DONE |
> + NETIF_MSG_RX_STATUS | NETIF_MSG_PKTDATA |
> + NETIF_MSG_HW | NETIF_MSG_WOL;
> +#endif
Let driver writer choose message enable bits please.
--
Stephen Hemminger <shemminger@linux-foundation.org>
next prev parent reply other threads:[~2007-06-08 23:24 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-08 22:00 [PATCH 1/2] [RFC] NET: Implement a standard ndev_printk family Auke Kok
2007-06-08 22:00 ` [PATCH 2/2] [RFC] NET: Convert several drivers to ndev_printk Auke Kok
2007-06-08 23:24 ` Stephen Hemminger [this message]
2007-06-08 23:42 ` [PATCH 1/2] [RFC] NET: Implement a standard ndev_printk family Kok, Auke
2007-06-09 0:10 ` Stephen Hemminger
2007-06-09 3:06 ` Kok, Auke
2007-06-09 3:18 ` Kok, Auke
2007-06-11 17:30 ` Kok, Auke
2007-06-11 17:50 ` Stephen Hemminger
2007-06-11 18:28 ` Joe Perches
2007-06-11 20:28 ` Kok, Auke
-- strict thread matches above, loose matches on Subject: below --
2007-06-11 21:37 Auke Kok
2007-06-11 21:52 ` Kok, Auke
2007-06-11 21:54 ` Joe Perches
2007-06-11 22:01 ` Kok, Auke
2007-06-11 22:24 ` Joe Perches
2007-06-11 22:00 ` Randy Dunlap
2007-06-11 22:04 ` Kok, Auke
2007-06-11 22:19 ` Stephen Hemminger
2007-06-11 22:43 ` Kok, Auke
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=20070608162415.1481dfec@localhost.localdomain \
--to=shemminger@linux-foundation.org \
--cc=arjan@linux.intel.com \
--cc=auke-jan.h.kok@intel.com \
--cc=davem@davemloft.net \
--cc=jeff@garzik.org \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.