From: Jiri Pirko <jpirko@redhat.com> Date: Mon, 14 Dec 2009 17:01:25 -0500 Subject: [net] bonding: add debug module option Message-id: <20091214170125.GC2497@psychotron.lab.eng.brq.redhat.com> Patchwork-id: 21923 O-Subject: [RHEL5.5 patch] BZ546624 net: bonding: add debug module option Bugzilla: 546624 RH-Acked-by: Andy Gospodarek <gospo@redhat.com> BZ546624 https://bugzilla.redhat.com/show_bug.cgi?id=546624 Description: Adds the option "debug" which enables the debug messages without a need to recompile the bonding module. Also corrects typo in bond_na_send() (to be compilable) Upstream: This is not upstream. Debug messages upstream can be enabled using CONFIG_DYNAMIC_DEBUG config option. This feature is not available in rhel5. Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=2149427 Test: Booted and tested on x86_64. Jirka Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: Don Zickus <dzickus@redhat.com> diff --git a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt index 3af144b..a4237e0 100644 --- a/Documentation/networking/bonding.txt +++ b/Documentation/networking/bonding.txt @@ -277,6 +277,19 @@ arp_validate This option was added in bonding version 3.1.0. +debug + Enables debug messages. + + Possible values are: + + 0 + + Debug messages are disabled. This is the default. + + 1 + + Debug messages are enabled. + downdelay Specifies the time, in milliseconds, to wait before disabling diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index df81cfe..378910f 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c @@ -20,8 +20,6 @@ * */ -//#define BONDING_DEBUG 1 - #include <linux/skbuff.h> #include <linux/if_ether.h> #include <linux/netdevice.h> diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 61be99b..da87852 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c @@ -20,8 +20,6 @@ * */ -//#define BONDING_DEBUG 1 - #include <linux/skbuff.h> #include <linux/netdevice.h> #include <linux/etherdevice.h> diff --git a/drivers/net/bonding/bond_ipv6.c b/drivers/net/bonding/bond_ipv6.c index 79e7016..914b1dd 100644 --- a/drivers/net/bonding/bond_ipv6.c +++ b/drivers/net/bonding/bond_ipv6.c @@ -20,8 +20,6 @@ * */ -//#define BONDING_DEBUG 1 - #include <linux/types.h> #include <linux/if_vlan.h> #include <net/ipv6.h> @@ -81,7 +79,7 @@ static void bond_na_send(struct net_device *slave_dev, addrconf_addr_solict_mult(daddr, &mcaddr); dprintk("ipv6 na on slave %s: dest %pI6, src %pI6\n", - slave->name, &mcaddr, daddr); + slave_dev->name, &mcaddr, daddr); skb = ndisc_build_skb(slave_dev, &mcaddr, daddr, &icmp6h, daddr, ND_OPT_TARGET_LL_ADDR); diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 23f2617..16485ba 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -31,8 +31,6 @@ * */ -//#define BONDING_DEBUG 1 - #include <linux/kernel.h> #include <linux/module.h> #include <linux/sched.h> @@ -104,6 +102,7 @@ static char *arp_ip_target[BOND_MAX_ARP_TARGETS] = { NULL, }; static char *arp_validate = NULL; static char *fail_over_mac = NULL; struct bond_params bonding_defaults; +int debug = 0; module_param(max_bonds, int, 0); MODULE_PARM_DESC(max_bonds, "Max number of bonded devices"); @@ -150,6 +149,8 @@ module_param(arp_validate, charp, 0); MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes: none (default), active, backup or all"); module_param(fail_over_mac, charp, 0); MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to the same MAC. none (default), active or follow"); +module_param(debug, int, 0); +MODULE_PARM_DESC(debug, "Print debug messages; 0 for off (default), 1 for on"); /*----------------------------- Global variables ----------------------------*/ diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 53c833f..d6bf50f 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -36,7 +36,6 @@ #include <linux/inet.h> #include <linux/rtnetlink.h> -/* #define BONDING_DEBUG 1 */ #include "bonding.h" #define to_class_dev(obj) container_of(obj,struct class_device,kobj) #define to_net_dev(class) container_of(class, struct net_device, class_dev) diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 913380e..1c9c6db 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h @@ -32,13 +32,11 @@ extern struct list_head bond_dev_list; -#ifdef BONDING_DEBUG +extern int debug; + #define dprintk(fmt, args...) \ - printk(KERN_DEBUG \ + if (debug) printk(KERN_DEBUG \ DRV_NAME ": %s() %d: " fmt, __FUNCTION__, __LINE__ , ## args ) -#else -#define dprintk(fmt, args...) -#endif /* BONDING_DEBUG */ #define IS_UP(dev) \ ((((dev)->flags & IFF_UP) == IFF_UP) && \