netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.4.26-pre2] netdevice.h: add netif_msg_init helper
@ 2004-03-08 19:10 Don Fry
  2004-03-09  2:20 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Don Fry @ 2004-03-08 19:10 UTC (permalink / raw)
  To: jgarzik, netdev

Please apply the following patch to 2.4.26-pre2

This patch adds a helper function to initialize the debug bit mask
for use with netif_msg_*.  When the debug_value is out of range
it returns the default_msg_enable_bits.  Tested IA32.

--- orig.linux-2.4.26-pre2/include/linux/netdevice.h	Wed Feb 18 05:36:32 2004
+++ linux-2.4.26-pre2/include/linux/netdevice.h	Mon Mar  8 10:10:23 2004
@@ -732,6 +732,17 @@
 #define netif_msg_hw(p)		((p)->msg_enable & NETIF_MSG_HW)
 #define netif_msg_wol(p)	((p)->msg_enable & NETIF_MSG_WOL)
 
+static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
+{
+	/* use default */
+	if (debug_value < 0 || debug_value >= (sizeof(u32) * 8))
+		return default_msg_enable_bits;
+	if (debug_value == 0)	/* no output */
+		return 0;
+	/* set low N bits */
+	return (1 << debug_value) - 1;
+}
+
 /* Schedule rx intr now? */
 
 static inline int netif_rx_schedule_prep(struct net_device *dev)

-- 
Don Fry
brazilnut@us.ibm.com

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

* Re: [PATCH 2.4.26-pre2] netdevice.h: add netif_msg_init helper
  2004-03-08 19:10 [PATCH 2.4.26-pre2] netdevice.h: add netif_msg_init helper Don Fry
@ 2004-03-09  2:20 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2004-03-09  2:20 UTC (permalink / raw)
  To: Don Fry; +Cc: netdev

Don Fry wrote:
> Please apply the following patch to 2.4.26-pre2
> 
> This patch adds a helper function to initialize the debug bit mask
> for use with netif_msg_*.  When the debug_value is out of range
> it returns the default_msg_enable_bits.  Tested IA32.


Applying to 2.4 and 2.6...  will be after 2.6.4 is released though, 
since this is a new feature and not Release Candidate material.

	Jeff

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

end of thread, other threads:[~2004-03-09  2:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-08 19:10 [PATCH 2.4.26-pre2] netdevice.h: add netif_msg_init helper Don Fry
2004-03-09  2:20 ` Jeff Garzik

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).