All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] bonding: add the debugfs interface to see RLB hash table
@ 2010-12-03  7:19 Taku Izumi
  2010-12-03  7:21 ` [PATCH 1/3] bonding: add the debugfs facility to the bonding driver Taku Izumi
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Taku Izumi @ 2010-12-03  7:19 UTC (permalink / raw)
  To: netdev, Jay Vosburgh; +Cc: eric.dumazet, shemminger

Hi Jay,

Thank you for your quick review. I update my patchset according to your comment.
But I didn't take measures against your concern about seq_file. If I come up with
a good idea, I'll correct it.

--
This patchset provides the debugfs facility to the bonding driver and
the interface to see RLB hashtable in it.

 *[PATCH 1/3] bonding: add the debugfs facility to the bonding driver
 *[PATCH 2/3] bonding: migrate some macros from bond_alb.c to bond_alb.h
 *[PATCH 3/3] bonding: add the debugfs interface to see RLB hash table

Best regards,
Taku Izumi


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

* [PATCH 1/3] bonding: add the debugfs facility to the bonding driver
  2010-12-03  7:19 [PATCH v2 0/3] bonding: add the debugfs interface to see RLB hash table Taku Izumi
@ 2010-12-03  7:21 ` Taku Izumi
  2010-12-10  1:17   ` Taku Izumi
  2010-12-03  7:22 ` [PATCH 2/3] bonding: migrate some macros from bond_alb.c to bond_alb.h Taku Izumi
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: Taku Izumi @ 2010-12-03  7:21 UTC (permalink / raw)
  To: netdev, Jay Vosburgh; +Cc: eric.dumazet, shemminger


This patch provides the debugfs facility to the bonding driver.
The "bonding" directory is created in the debugfs root and directories of
each bonding interface (like bond0, bond1...) are created in that.

 # mount -t debugfs none /sys/kernel/debug

 # ls /sys/kernel/debug/bonding
 bond0  bond1

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>

---
 drivers/net/bonding/Makefile       |    2
 drivers/net/bonding/bond_debugfs.c |   92 +++++++++++++++++++++++++++++++++++++
 drivers/net/bonding/bond_main.c    |   10 +++-
 drivers/net/bonding/bonding.h      |    9 +++
 4 files changed, 111 insertions(+), 2 deletions(-)

Index: net-next/drivers/net/bonding/bond_main.c
===================================================================
--- net-next.orig/drivers/net/bonding/bond_main.c
+++ net-next/drivers/net/bonding/bond_main.c
@@ -3507,6 +3507,8 @@ static int bond_event_changename(struct
 	bond_remove_proc_entry(bond);
 	bond_create_proc_entry(bond);

+	bond_debug_reregister(bond);
+
 	return NOTIFY_DONE;
 }

@@ -4789,6 +4791,8 @@ static void bond_uninit(struct net_devic

 	bond_remove_proc_entry(bond);

+	bond_debug_unregister(bond);
+
 	__hw_addr_flush(&bond->mc_list);

 	list_for_each_entry_safe(vlan, tmp, &bond->vlan_list, vlan_list) {
@@ -5191,6 +5195,8 @@ static int bond_init(struct net_device *

 	bond_prepare_sysfs_group(bond);

+	bond_debug_register(bond);
+
 	__hw_addr_init(&bond->mc_list);
 	return 0;
 }
@@ -5312,6 +5318,8 @@ static int __init bonding_init(void)
 	if (res)
 		goto err_link;

+	bond_create_debugfs();
+
 	for (i = 0; i < max_bonds; i++) {
 		res = bond_create(&init_net, NULL);
 		if (res)
@@ -5322,7 +5330,6 @@ static int __init bonding_init(void)
 	if (res)
 		goto err;

-
 	register_netdevice_notifier(&bond_netdev_notifier);
 	register_inetaddr_notifier(&bond_inetaddr_notifier);
 	bond_register_ipv6_notifier();
@@ -5346,6 +5353,7 @@ static void __exit bonding_exit(void)
 	bond_unregister_ipv6_notifier();

 	bond_destroy_sysfs();
+	bond_destroy_debugfs();

 	rtnl_link_unregister(&bond_link_ops);
 	unregister_pernet_subsys(&bond_net_ops);
Index: net-next/drivers/net/bonding/Makefile
===================================================================
--- net-next.orig/drivers/net/bonding/Makefile
+++ net-next/drivers/net/bonding/Makefile
@@ -4,7 +4,7 @@

 obj-$(CONFIG_BONDING) += bonding.o

-bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o
+bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o bond_debugfs.o

 ipv6-$(subst m,y,$(CONFIG_IPV6)) += bond_ipv6.o
 bonding-objs += $(ipv6-y)
Index: net-next/drivers/net/bonding/bond_debugfs.c
===================================================================
--- /dev/null
+++ net-next/drivers/net/bonding/bond_debugfs.c
@@ -0,0 +1,92 @@
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/netdevice.h>
+
+#include "bonding.h"
+
+#ifdef CONFIG_DEBUG_FS
+
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+
+static struct dentry *bonding_debug_root;
+
+void bond_debug_register(struct bonding *bond)
+{
+	if (!bonding_debug_root)
+		return;
+
+	bond->debug_dir =
+		debugfs_create_dir(bond->dev->name, bonding_debug_root);
+
+	if (!bond->debug_dir) {
+		pr_warning("%s: Warning: failed to register to debugfs\n",
+			bond->dev->name);
+		return;
+	}
+}
+
+void bond_debug_unregister(struct bonding *bond)
+{
+	debugfs_remove_recursive(bond->debug_dir);
+}
+
+void bond_debug_reregister(struct bonding *bond)
+{
+	struct dentry *d;
+
+	if (!bonding_debug_root)
+		return;
+
+	d = debugfs_rename(bonding_debug_root, bond->debug_dir,
+			   bonding_debug_root, bond->dev->name);
+	if (d) {
+		bond->debug_dir = d;
+	} else {
+		pr_warning("%s: Warning: failed to reregister, "
+				"so just unregister old one\n",
+				bond->dev->name);
+		bond_debug_unregister(bond);
+	}
+}
+
+void bond_create_debugfs(void)
+{
+	bonding_debug_root = debugfs_create_dir("bonding", NULL);
+
+	if (!bonding_debug_root) {
+		pr_warning("Warning: Cannot create bonding directory"
+				" in debugfs\n");
+	}
+}
+
+void bond_destroy_debugfs(void)
+{
+	debugfs_remove_recursive(bonding_debug_root);
+}
+
+
+#else /* !CONFIG_DEBUG_FS */
+
+void bond_debug_register(struct bonding *bond)
+{
+}
+
+void bond_debug_unregister(struct bonding *bond)
+{
+}
+
+void bond_debug_reregister(struct bonding *bond)
+{
+}
+
+void bond_create_debugfs(void)
+{
+}
+
+void bond_destroy_debugfs(void)
+{
+}
+
+#endif /* CONFIG_DEBUG_FS */
Index: net-next/drivers/net/bonding/bonding.h
===================================================================
--- net-next.orig/drivers/net/bonding/bonding.h
+++ net-next/drivers/net/bonding/bonding.h
@@ -259,6 +259,10 @@ struct bonding {
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 	struct   in6_addr master_ipv6;
 #endif
+#ifdef CONFIG_DEBUG_FS
+	/* debugging suport via debugfs */
+	struct	 dentry *debug_dir;
+#endif /* CONFIG_DEBUG_FS */
 };

 /**
@@ -380,6 +384,11 @@ void bond_select_active_slave(struct bon
 void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
 void bond_register_arp(struct bonding *);
 void bond_unregister_arp(struct bonding *);
+void bond_create_debugfs(void);
+void bond_destroy_debugfs(void);
+void bond_debug_register(struct bonding *bond);
+void bond_debug_unregister(struct bonding *bond);
+void bond_debug_reregister(struct bonding *bond);

 struct bond_net {
 	struct net *		net;	/* Associated network namespace */



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

* [PATCH 2/3] bonding: migrate some macros from bond_alb.c to bond_alb.h
  2010-12-03  7:19 [PATCH v2 0/3] bonding: add the debugfs interface to see RLB hash table Taku Izumi
  2010-12-03  7:21 ` [PATCH 1/3] bonding: add the debugfs facility to the bonding driver Taku Izumi
@ 2010-12-03  7:22 ` Taku Izumi
  2010-12-13  5:03   ` Taku Izumi
  2010-12-03  7:22 ` [PATCH 3/3] bonding: add the debugfs interface to see RLB hash table Taku Izumi
  2010-12-08 20:33 ` [PATCH v2 0/3] " Jay Vosburgh
  3 siblings, 1 reply; 16+ messages in thread
From: Taku Izumi @ 2010-12-03  7:22 UTC (permalink / raw)
  To: netdev, Jay Vosburgh; +Cc: eric.dumazet, shemminger


This patch simply migrates some macros from bond_alb.c to bond_alb.h.


Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>

---
 drivers/net/bonding/bond_alb.c |   36 ------------------------------------
 drivers/net/bonding/bond_alb.h |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 36 deletions(-)

Index: net-next/drivers/net/bonding/bond_alb.c
===================================================================
--- net-next.orig/drivers/net/bonding/bond_alb.c
+++ net-next/drivers/net/bonding/bond_alb.c
@@ -44,42 +44,6 @@
 #include "bond_alb.h"


-#define ALB_TIMER_TICKS_PER_SEC	    10	/* should be a divisor of HZ */
-#define BOND_TLB_REBALANCE_INTERVAL 10	/* In seconds, periodic re-balancing.
-					 * Used for division - never set
-					 * to zero !!!
-					 */
-#define BOND_ALB_LP_INTERVAL	    1	/* In seconds, periodic send of
-					 * learning packets to the switch
-					 */
-
-#define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \
-				  * ALB_TIMER_TICKS_PER_SEC)
-
-#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \
-			   * ALB_TIMER_TICKS_PER_SEC)
-
-#define TLB_HASH_TABLE_SIZE 256	/* The size of the clients hash table.
-				 * Note that this value MUST NOT be smaller
-				 * because the key hash table is BYTE wide !
-				 */
-
-
-#define TLB_NULL_INDEX		0xffffffff
-#define MAX_LP_BURST		3
-
-/* rlb defs */
-#define RLB_HASH_TABLE_SIZE	256
-#define RLB_NULL_INDEX		0xffffffff
-#define RLB_UPDATE_DELAY	2*ALB_TIMER_TICKS_PER_SEC /* 2 seconds */
-#define RLB_ARP_BURST_SIZE	2
-#define RLB_UPDATE_RETRY	3	/* 3-ticks - must be smaller than the rlb
-					 * rebalance interval (5 min).
-					 */
-/* RLB_PROMISC_TIMEOUT = 10 sec equals the time that the current slave is
- * promiscuous after failover
- */
-#define RLB_PROMISC_TIMEOUT	10*ALB_TIMER_TICKS_PER_SEC

 #ifndef __long_aligned
 #define __long_aligned __attribute__((aligned((sizeof(long)))))
Index: net-next/drivers/net/bonding/bond_alb.h
===================================================================
--- net-next.orig/drivers/net/bonding/bond_alb.h
+++ net-next/drivers/net/bonding/bond_alb.h
@@ -31,6 +31,44 @@ struct slave;
 #define BOND_ALB_INFO(bond)   ((bond)->alb_info)
 #define SLAVE_TLB_INFO(slave) ((slave)->tlb_info)

+#define ALB_TIMER_TICKS_PER_SEC	    10	/* should be a divisor of HZ */
+#define BOND_TLB_REBALANCE_INTERVAL 10	/* In seconds, periodic re-balancing.
+					 * Used for division - never set
+					 * to zero !!!
+					 */
+#define BOND_ALB_LP_INTERVAL	    1	/* In seconds, periodic send of
+					 * learning packets to the switch
+					 */
+
+#define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \
+				  * ALB_TIMER_TICKS_PER_SEC)
+
+#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \
+			   * ALB_TIMER_TICKS_PER_SEC)
+
+#define TLB_HASH_TABLE_SIZE 256	/* The size of the clients hash table.
+				 * Note that this value MUST NOT be smaller
+				 * because the key hash table is BYTE wide !
+				 */
+
+
+#define TLB_NULL_INDEX		0xffffffff
+#define MAX_LP_BURST		3
+
+/* rlb defs */
+#define RLB_HASH_TABLE_SIZE	256
+#define RLB_NULL_INDEX		0xffffffff
+#define RLB_UPDATE_DELAY	(2*ALB_TIMER_TICKS_PER_SEC) /* 2 seconds */
+#define RLB_ARP_BURST_SIZE	2
+#define RLB_UPDATE_RETRY	3 /* 3-ticks - must be smaller than the rlb
+				   * rebalance interval (5 min).
+				   */
+/* RLB_PROMISC_TIMEOUT = 10 sec equals the time that the current slave is
+ * promiscuous after failover
+ */
+#define RLB_PROMISC_TIMEOUT	(10*ALB_TIMER_TICKS_PER_SEC)
+
+
 struct tlb_client_info {
 	struct slave *tx_slave;	/* A pointer to slave used for transmiting
 				 * packets to a Client that the Hash function



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

* [PATCH 3/3] bonding: add the debugfs interface to see RLB hash table
  2010-12-03  7:19 [PATCH v2 0/3] bonding: add the debugfs interface to see RLB hash table Taku Izumi
  2010-12-03  7:21 ` [PATCH 1/3] bonding: add the debugfs facility to the bonding driver Taku Izumi
  2010-12-03  7:22 ` [PATCH 2/3] bonding: migrate some macros from bond_alb.c to bond_alb.h Taku Izumi
@ 2010-12-03  7:22 ` Taku Izumi
  2010-12-13  5:04   ` Taku Izumi
  2010-12-08 20:33 ` [PATCH v2 0/3] " Jay Vosburgh
  3 siblings, 1 reply; 16+ messages in thread
From: Taku Izumi @ 2010-12-03  7:22 UTC (permalink / raw)
  To: netdev, Jay Vosburgh; +Cc: eric.dumazet, shemminger


This patch provices the debugfs interface to see RLB hash table
like the following:

# cat /sys/kernel/debug/bonding/bond0/rlb_hash_table
SourceIP        DestinationIP   Destination MAC   DEV
10.124.196.205  10.124.196.205  ff:ff:ff:ff:ff:ff eth4
10.124.196.205  10.124.196.81   00:19:99:XX:XX:XX eth3
10.124.196.205  10.124.196.1    00:21:d8:XX:XX:XX eth0

This is helpful to check if the receive load balancing works as expected.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>

---
 drivers/net/bonding/bond_debugfs.c |   50 +++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

Index: net-next/drivers/net/bonding/bond_debugfs.c
===================================================================
--- net-next.orig/drivers/net/bonding/bond_debugfs.c
+++ net-next/drivers/net/bonding/bond_debugfs.c
@@ -4,6 +4,7 @@
 #include <linux/netdevice.h>

 #include "bonding.h"
+#include "bond_alb.h"

 #ifdef CONFIG_DEBUG_FS

@@ -12,6 +13,52 @@

 static struct dentry *bonding_debug_root;

+/*
+ *  Show RLB hash table
+ */
+static int bond_debug_rlb_hash_show(struct seq_file *m, void *v)
+{
+	struct bonding *bond = m->private;
+	struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
+	struct rlb_client_info *client_info;
+	u32 hash_index;
+
+	if (bond->params.mode != BOND_MODE_ALB)
+		return 0;
+
+	seq_printf(m, "SourceIP        DestinationIP   "
+			"Destination MAC   DEV\n");
+
+	spin_lock_bh(&(BOND_ALB_INFO(bond).rx_hashtbl_lock));
+
+	hash_index = bond_info->rx_hashtbl_head;
+	for (; hash_index != RLB_NULL_INDEX; hash_index = client_info->next) {
+		client_info = &(bond_info->rx_hashtbl[hash_index]);
+		seq_printf(m, "%-15pI4 %-15pI4 %-17pM %s\n",
+			&client_info->ip_src,
+			&client_info->ip_dst,
+			&client_info->mac_dst,
+			client_info->slave->dev->name);
+	}
+
+	spin_unlock_bh(&(BOND_ALB_INFO(bond).rx_hashtbl_lock));
+
+	return 0;
+}
+
+static int bond_debug_rlb_hash_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, bond_debug_rlb_hash_show, inode->i_private);
+}
+
+static const struct file_operations bond_debug_rlb_hash_fops = {
+	.owner		= THIS_MODULE,
+	.open		= bond_debug_rlb_hash_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};
+
 void bond_debug_register(struct bonding *bond)
 {
 	if (!bonding_debug_root)
@@ -25,6 +72,9 @@ void bond_debug_register(struct bonding
 			bond->dev->name);
 		return;
 	}
+
+	debugfs_create_file("rlb_hash_table", 0400, bond->debug_dir,
+				bond, &bond_debug_rlb_hash_fops);
 }

 void bond_debug_unregister(struct bonding *bond)



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

* Re: [PATCH v2 0/3] bonding: add the debugfs interface to see RLB hash table
  2010-12-03  7:19 [PATCH v2 0/3] bonding: add the debugfs interface to see RLB hash table Taku Izumi
                   ` (2 preceding siblings ...)
  2010-12-03  7:22 ` [PATCH 3/3] bonding: add the debugfs interface to see RLB hash table Taku Izumi
@ 2010-12-08 20:33 ` Jay Vosburgh
  2010-12-09 10:43   ` Taku Izumi
  2010-12-10  1:24   ` Taku Izumi
  3 siblings, 2 replies; 16+ messages in thread
From: Jay Vosburgh @ 2010-12-08 20:33 UTC (permalink / raw)
  To: Taku Izumi; +Cc: netdev, eric.dumazet, shemminger

Taku Izumi <izumi.taku@jp.fujitsu.com> wrote:

>Hi Jay,
>
>Thank you for your quick review. I update my patchset according to your comment.
>But I didn't take measures against your concern about seq_file. If I come up with
>a good idea, I'll correct it.
>
>--
>This patchset provides the debugfs facility to the bonding driver and
>the interface to see RLB hashtable in it.
>
> *[PATCH 1/3] bonding: add the debugfs facility to the bonding driver
> *[PATCH 2/3] bonding: migrate some macros from bond_alb.c to bond_alb.h
> *[PATCH 3/3] bonding: add the debugfs interface to see RLB hash table

	After applying your patches to net-next-2.6, I'm seeing the
following crash when executing "rmmod bonding":

BUG: unable to handle kernel paging request at 6b6b6b9f
IP: [<c0201f11>] debugfs_remove_recursive+0x1e/0x11a
*pde = 00000000 
Oops: 0000 [#1] PREEMPT SMP 
last sysfs file: /sys/devices/virtual/net/bond0/flags
Modules linked in: bonding(-) ipv6 mperf microcode loop tg3 e1000 libphy sworks_agp agpgart edd ext3 mbcache jbd pata_serverworks mptspi mptscsih mptbase [last unloaded: speedstep_lib]

Pid: 5237, comm: rmmod Not tainted 2.6.37-rc1-cur+ #11 /eserver xSeries 335 -[8676GBX]-
EIP: 0060:[<c0201f11>] EFLAGS: 00010202 CPU: 2
EIP is at debugfs_remove_recursive+0x1e/0x11a
EAX: 6b6b6b6b EBX: f4d99480 ECX: 00000000 EDX: f3d5a5d4
ESI: f4d99950 EDI: f2d445b8 EBP: f4d03eb8 ESP: f4d03ea8
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process rmmod (pid: 5237, ti=f4d02000 task=f3d5a240 task.ti=f4d02000)
Stack:
 f4d03ec0 f4d99480 f4d99950 f4d99000 f4d03ec0 f801dc05 f4d03ef4 f8015c5b
 c0156ab6 f4d03ed8 c0134ff0 f4d9949c f4d03ee4 c037ec67 f4d99150 f4d03ef4
 f4d99000 f4d03f20 f4d99000 f4d03f08 c030eafe f4d03f20 c0ce4140 f80233a4
Call Trace:
 [<f801dc05>] ? bond_debug_unregister+0xe/0x10 [bonding]
 [<f8015c5b>] ? bond_uninit+0x324/0x36d [bonding]
 [<c0156ab6>] ? trace_hardirqs_on+0xb/0xd
 [<c0134ff0>] ? local_bh_enable_ip+0x97/0xae
 [<c037ec67>] ? _raw_spin_unlock_bh+0x2f/0x32
 [<c030eafe>] ? rollback_registered_many+0x187/0x1fb
 [<c030eb81>] ? unregister_netdevice_many+0xf/0x4d
 [<c0318890>] ? __rtnl_link_unregister+0x56/0x8a
 [<c0318f45>] ? rtnl_link_unregister+0x19/0x21
 [<f801e32d>] ? bonding_exit+0x30/0x3c [bonding]
 [<c0162ddc>] ? sys_delete_module+0x184/0x1dc
 [<c01555fe>] ? put_lock_stats+0xd/0x22
 [<c0155708>] ? lock_release_holdtime+0xf5/0xfa
 [<c01a8fa3>] ? sys_munmap+0x39/0x3f
 [<c037f098>] ? restore_all_notrace+0x0/0x18
 [<c010294c>] ? sysenter_do_call+0x12/0x32
Code: fc ff 89 d8 e8 27 77 fc ff 5b 5e 5d c3 55 89 e5 57 89 c7 56 53 83 ec 04 85 c0 0f 84 01 01 00 00 8b 40 40 85 c0 0f 84 f6 00 00 00 <83> 78 34 00 0f 84 ec 00 00 00 8b 47 34 31 d2 89 fe 05 a4 00 00 
EIP: [<c0201f11>] debugfs_remove_recursive+0x1e/0x11a SS:ESP 0068:f4d03ea8
CR2: 000000006b6b6b9f
---[ end trace e274f539dfd6ed30 ]---

	This happens regardless of activity; e.g., "insmod bonding
mode=balance-alb" followed immediately by "rmmod bonding" generates the
above.

	Any thoughts?

	-J

---
	-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com

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

* Re: [PATCH v2 0/3] bonding: add the debugfs interface to see RLB hash table
  2010-12-08 20:33 ` [PATCH v2 0/3] " Jay Vosburgh
@ 2010-12-09 10:43   ` Taku Izumi
  2010-12-10  1:24   ` Taku Izumi
  1 sibling, 0 replies; 16+ messages in thread
From: Taku Izumi @ 2010-12-09 10:43 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev, eric.dumazet, shemminger

Hi Jay,

> 	After applying your patches to net-next-2.6, I'm seeing the
> following crash when executing "rmmod bonding":
> 
> BUG: unable to handle kernel paging request at 6b6b6b9f
> IP: [<c0201f11>] debugfs_remove_recursive+0x1e/0x11a
> *pde = 00000000
> Oops: 0000 [#1] PREEMPT SMP
> last sysfs file: /sys/devices/virtual/net/bond0/flags
> Modules linked in: bonding(-) ipv6 mperf microcode loop tg3 e1000 libphy sworks_agp agpgart edd ext3 mbcache jbd pata_serverworks mptspi mptscsih mptbase [last unloaded: speedstep_lib]
> 
> Pid: 5237, comm: rmmod Not tainted 2.6.37-rc1-cur+ #11 /eserver xSeries 335 -[8676GBX]-
> EIP: 0060:[<c0201f11>] EFLAGS: 00010202 CPU: 2
> EIP is at debugfs_remove_recursive+0x1e/0x11a
> EAX: 6b6b6b6b EBX: f4d99480 ECX: 00000000 EDX: f3d5a5d4
> ESI: f4d99950 EDI: f2d445b8 EBP: f4d03eb8 ESP: f4d03ea8
>   DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
> Process rmmod (pid: 5237, ti=f4d02000 task=f3d5a240 task.ti=f4d02000)
> Stack:
>   f4d03ec0 f4d99480 f4d99950 f4d99000 f4d03ec0 f801dc05 f4d03ef4 f8015c5b
>   c0156ab6 f4d03ed8 c0134ff0 f4d9949c f4d03ee4 c037ec67 f4d99150 f4d03ef4
>   f4d99000 f4d03f20 f4d99000 f4d03f08 c030eafe f4d03f20 c0ce4140 f80233a4
> Call Trace:
>   [<f801dc05>] ? bond_debug_unregister+0xe/0x10 [bonding]
>   [<f8015c5b>] ? bond_uninit+0x324/0x36d [bonding]
>   [<c0156ab6>] ? trace_hardirqs_on+0xb/0xd
>   [<c0134ff0>] ? local_bh_enable_ip+0x97/0xae
>   [<c037ec67>] ? _raw_spin_unlock_bh+0x2f/0x32
>   [<c030eafe>] ? rollback_registered_many+0x187/0x1fb
>   [<c030eb81>] ? unregister_netdevice_many+0xf/0x4d
>   [<c0318890>] ? __rtnl_link_unregister+0x56/0x8a
>   [<c0318f45>] ? rtnl_link_unregister+0x19/0x21
>   [<f801e32d>] ? bonding_exit+0x30/0x3c [bonding]
>   [<c0162ddc>] ? sys_delete_module+0x184/0x1dc
>   [<c01555fe>] ? put_lock_stats+0xd/0x22
>   [<c0155708>] ? lock_release_holdtime+0xf5/0xfa
>   [<c01a8fa3>] ? sys_munmap+0x39/0x3f
>   [<c037f098>] ? restore_all_notrace+0x0/0x18
>   [<c010294c>] ? sysenter_do_call+0x12/0x32
> Code: fc ff 89 d8 e8 27 77 fc ff 5b 5e 5d c3 55 89 e5 57 89 c7 56 53 83 ec 04 85 c0 0f 84 01 01 00 00 8b 40 40 85 c0 0f 84 f6 00 00 00<83>  78 34 00 0f 84 ec 00 00 00 8b 47 34 31 d2 89 fe 05 a4 00 00
> EIP: [<c0201f11>] debugfs_remove_recursive+0x1e/0x11a SS:ESP 0068:f4d03ea8
> CR2: 000000006b6b6b9f
> ---[ end trace e274f539dfd6ed30 ]---
> 
> 	This happens regardless of activity; e.g., "insmod bonding
> mode=balance-alb" followed immediately by "rmmod bonding" generates the
> above.
> 
> 	Any thoughts?

 Thank you for testing. I could reproduce a similar crash.
 I'm debugging now...

Best regards,
Taku izumi


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

* Re: [PATCH 1/3] bonding: add the debugfs facility to the bonding driver
  2010-12-03  7:21 ` [PATCH 1/3] bonding: add the debugfs facility to the bonding driver Taku Izumi
@ 2010-12-10  1:17   ` Taku Izumi
  2010-12-11  0:21     ` Jay Vosburgh
  0 siblings, 1 reply; 16+ messages in thread
From: Taku Izumi @ 2010-12-10  1:17 UTC (permalink / raw)
  To: netdev, Jay Vosburgh; +Cc: eric.dumazet, shemminger


This patch provides the debugfs facility to the bonding driver.
The "bonding" directory is created in the debugfs root and directories of
each bonding interface (like bond0, bond1...) are created in that.

 # mount -t debugfs none /sys/kernel/debug

 # ls /sys/kernel/debug/bonding
 bond0  bond1

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>

---
 drivers/net/bonding/Makefile       |    2
 drivers/net/bonding/bond_debugfs.c |   96 +++++++++++++++++++++++++++++++++++++
 drivers/net/bonding/bond_main.c    |   10 +++
 drivers/net/bonding/bonding.h      |    9 +++
 4 files changed, 115 insertions(+), 2 deletions(-)

Index: net-next/drivers/net/bonding/bond_main.c
===================================================================
--- net-next.orig/drivers/net/bonding/bond_main.c
+++ net-next/drivers/net/bonding/bond_main.c
@@ -3507,6 +3507,8 @@ static int bond_event_changename(struct
 	bond_remove_proc_entry(bond);
 	bond_create_proc_entry(bond);

+	bond_debug_reregister(bond);
+
 	return NOTIFY_DONE;
 }

@@ -4789,6 +4791,8 @@ static void bond_uninit(struct net_devic

 	bond_remove_proc_entry(bond);

+	bond_debug_unregister(bond);
+
 	__hw_addr_flush(&bond->mc_list);

 	list_for_each_entry_safe(vlan, tmp, &bond->vlan_list, vlan_list) {
@@ -5191,6 +5195,8 @@ static int bond_init(struct net_device *

 	bond_prepare_sysfs_group(bond);

+	bond_debug_register(bond);
+
 	__hw_addr_init(&bond->mc_list);
 	return 0;
 }
@@ -5312,6 +5318,8 @@ static int __init bonding_init(void)
 	if (res)
 		goto err_link;

+	bond_create_debugfs();
+
 	for (i = 0; i < max_bonds; i++) {
 		res = bond_create(&init_net, NULL);
 		if (res)
@@ -5322,7 +5330,6 @@ static int __init bonding_init(void)
 	if (res)
 		goto err;

-
 	register_netdevice_notifier(&bond_netdev_notifier);
 	register_inetaddr_notifier(&bond_inetaddr_notifier);
 	bond_register_ipv6_notifier();
@@ -5346,6 +5353,7 @@ static void __exit bonding_exit(void)
 	bond_unregister_ipv6_notifier();

 	bond_destroy_sysfs();
+	bond_destroy_debugfs();

 	rtnl_link_unregister(&bond_link_ops);
 	unregister_pernet_subsys(&bond_net_ops);
Index: net-next/drivers/net/bonding/Makefile
===================================================================
--- net-next.orig/drivers/net/bonding/Makefile
+++ net-next/drivers/net/bonding/Makefile
@@ -4,7 +4,7 @@

 obj-$(CONFIG_BONDING) += bonding.o

-bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o
+bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o bond_debugfs.o

 ipv6-$(subst m,y,$(CONFIG_IPV6)) += bond_ipv6.o
 bonding-objs += $(ipv6-y)
Index: net-next/drivers/net/bonding/bond_debugfs.c
===================================================================
--- /dev/null
+++ net-next/drivers/net/bonding/bond_debugfs.c
@@ -0,0 +1,96 @@
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/netdevice.h>
+
+#include "bonding.h"
+
+#ifdef CONFIG_DEBUG_FS
+
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+
+static struct dentry *bonding_debug_root;
+
+void bond_debug_register(struct bonding *bond)
+{
+	if (!bonding_debug_root)
+		return;
+
+	bond->debug_dir =
+		debugfs_create_dir(bond->dev->name, bonding_debug_root);
+
+	if (!bond->debug_dir) {
+		pr_warning("%s: Warning: failed to register to debugfs\n",
+			bond->dev->name);
+		return;
+	}
+}
+
+void bond_debug_unregister(struct bonding *bond)
+{
+	if (!bonding_debug_root)
+		return;
+
+	debugfs_remove_recursive(bond->debug_dir);
+}
+
+void bond_debug_reregister(struct bonding *bond)
+{
+	struct dentry *d;
+
+	if (!bonding_debug_root)
+		return;
+
+	d = debugfs_rename(bonding_debug_root, bond->debug_dir,
+			   bonding_debug_root, bond->dev->name);
+	if (d) {
+		bond->debug_dir = d;
+	} else {
+		pr_warning("%s: Warning: failed to reregister, "
+				"so just unregister old one\n",
+				bond->dev->name);
+		bond_debug_unregister(bond);
+	}
+}
+
+void bond_create_debugfs(void)
+{
+	bonding_debug_root = debugfs_create_dir("bonding", NULL);
+
+	if (!bonding_debug_root) {
+		pr_warning("Warning: Cannot create bonding directory"
+				" in debugfs\n");
+	}
+}
+
+void bond_destroy_debugfs(void)
+{
+	debugfs_remove_recursive(bonding_debug_root);
+	bonding_debug_root = NULL;
+}
+
+
+#else /* !CONFIG_DEBUG_FS */
+
+void bond_debug_register(struct bonding *bond)
+{
+}
+
+void bond_debug_unregister(struct bonding *bond)
+{
+}
+
+void bond_debug_reregister(struct bonding *bond)
+{
+}
+
+void bond_create_debugfs(void)
+{
+}
+
+void bond_destroy_debugfs(void)
+{
+}
+
+#endif /* CONFIG_DEBUG_FS */
Index: net-next/drivers/net/bonding/bonding.h
===================================================================
--- net-next.orig/drivers/net/bonding/bonding.h
+++ net-next/drivers/net/bonding/bonding.h
@@ -259,6 +259,10 @@ struct bonding {
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 	struct   in6_addr master_ipv6;
 #endif
+#ifdef CONFIG_DEBUG_FS
+	/* debugging suport via debugfs */
+	struct	 dentry *debug_dir;
+#endif /* CONFIG_DEBUG_FS */
 };

 /**
@@ -380,6 +384,11 @@ void bond_select_active_slave(struct bon
 void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
 void bond_register_arp(struct bonding *);
 void bond_unregister_arp(struct bonding *);
+void bond_create_debugfs(void);
+void bond_destroy_debugfs(void);
+void bond_debug_register(struct bonding *bond);
+void bond_debug_unregister(struct bonding *bond);
+void bond_debug_reregister(struct bonding *bond);

 struct bond_net {
 	struct net *		net;	/* Associated network namespace */



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

* Re: [PATCH v2 0/3] bonding: add the debugfs interface to see RLB hash table
  2010-12-08 20:33 ` [PATCH v2 0/3] " Jay Vosburgh
  2010-12-09 10:43   ` Taku Izumi
@ 2010-12-10  1:24   ` Taku Izumi
  1 sibling, 0 replies; 16+ messages in thread
From: Taku Izumi @ 2010-12-10  1:24 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev, eric.dumazet, shemminger

Hi Jay,

 I updated the patch 1/3. The problem seems to be fixed.
 The problem is not reproduced at least in my test by applying my new patch.
 Could you test again?

Best regards,
Taku Izumi



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

* Re: [PATCH 1/3] bonding: add the debugfs facility to the bonding driver
  2010-12-10  1:17   ` Taku Izumi
@ 2010-12-11  0:21     ` Jay Vosburgh
  2010-12-11  0:23       ` David Miller
  0 siblings, 1 reply; 16+ messages in thread
From: Jay Vosburgh @ 2010-12-11  0:21 UTC (permalink / raw)
  To: Taku Izumi; +Cc: netdev, eric.dumazet, shemminger

Taku Izumi <izumi.taku@jp.fujitsu.com> wrote:

>
>This patch provides the debugfs facility to the bonding driver.
>The "bonding" directory is created in the debugfs root and directories of
>each bonding interface (like bond0, bond1...) are created in that.
>
> # mount -t debugfs none /sys/kernel/debug
>
> # ls /sys/kernel/debug/bonding
> bond0  bond1
>
>Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>

	Tested replacement patch 1 with original patches 2 and 3.  Works
as advertised, no pesky crashes.

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

	-J


>---
> drivers/net/bonding/Makefile       |    2
> drivers/net/bonding/bond_debugfs.c |   96 +++++++++++++++++++++++++++++++++++++
> drivers/net/bonding/bond_main.c    |   10 +++
> drivers/net/bonding/bonding.h      |    9 +++
> 4 files changed, 115 insertions(+), 2 deletions(-)
>
>Index: net-next/drivers/net/bonding/bond_main.c
>===================================================================
>--- net-next.orig/drivers/net/bonding/bond_main.c
>+++ net-next/drivers/net/bonding/bond_main.c
>@@ -3507,6 +3507,8 @@ static int bond_event_changename(struct
> 	bond_remove_proc_entry(bond);
> 	bond_create_proc_entry(bond);
>
>+	bond_debug_reregister(bond);
>+
> 	return NOTIFY_DONE;
> }
>
>@@ -4789,6 +4791,8 @@ static void bond_uninit(struct net_devic
>
> 	bond_remove_proc_entry(bond);
>
>+	bond_debug_unregister(bond);
>+
> 	__hw_addr_flush(&bond->mc_list);
>
> 	list_for_each_entry_safe(vlan, tmp, &bond->vlan_list, vlan_list) {
>@@ -5191,6 +5195,8 @@ static int bond_init(struct net_device *
>
> 	bond_prepare_sysfs_group(bond);
>
>+	bond_debug_register(bond);
>+
> 	__hw_addr_init(&bond->mc_list);
> 	return 0;
> }
>@@ -5312,6 +5318,8 @@ static int __init bonding_init(void)
> 	if (res)
> 		goto err_link;
>
>+	bond_create_debugfs();
>+
> 	for (i = 0; i < max_bonds; i++) {
> 		res = bond_create(&init_net, NULL);
> 		if (res)
>@@ -5322,7 +5330,6 @@ static int __init bonding_init(void)
> 	if (res)
> 		goto err;
>
>-
> 	register_netdevice_notifier(&bond_netdev_notifier);
> 	register_inetaddr_notifier(&bond_inetaddr_notifier);
> 	bond_register_ipv6_notifier();
>@@ -5346,6 +5353,7 @@ static void __exit bonding_exit(void)
> 	bond_unregister_ipv6_notifier();
>
> 	bond_destroy_sysfs();
>+	bond_destroy_debugfs();
>
> 	rtnl_link_unregister(&bond_link_ops);
> 	unregister_pernet_subsys(&bond_net_ops);
>Index: net-next/drivers/net/bonding/Makefile
>===================================================================
>--- net-next.orig/drivers/net/bonding/Makefile
>+++ net-next/drivers/net/bonding/Makefile
>@@ -4,7 +4,7 @@
>
> obj-$(CONFIG_BONDING) += bonding.o
>
>-bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o
>+bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o bond_debugfs.o
>
> ipv6-$(subst m,y,$(CONFIG_IPV6)) += bond_ipv6.o
> bonding-objs += $(ipv6-y)
>Index: net-next/drivers/net/bonding/bond_debugfs.c
>===================================================================
>--- /dev/null
>+++ net-next/drivers/net/bonding/bond_debugfs.c
>@@ -0,0 +1,96 @@
>+#include <linux/kernel.h>
>+#include <linux/module.h>
>+#include <linux/device.h>
>+#include <linux/netdevice.h>
>+
>+#include "bonding.h"
>+
>+#ifdef CONFIG_DEBUG_FS
>+
>+#include <linux/debugfs.h>
>+#include <linux/seq_file.h>
>+
>+static struct dentry *bonding_debug_root;
>+
>+void bond_debug_register(struct bonding *bond)
>+{
>+	if (!bonding_debug_root)
>+		return;
>+
>+	bond->debug_dir =
>+		debugfs_create_dir(bond->dev->name, bonding_debug_root);
>+
>+	if (!bond->debug_dir) {
>+		pr_warning("%s: Warning: failed to register to debugfs\n",
>+			bond->dev->name);
>+		return;
>+	}
>+}
>+
>+void bond_debug_unregister(struct bonding *bond)
>+{
>+	if (!bonding_debug_root)
>+		return;
>+
>+	debugfs_remove_recursive(bond->debug_dir);
>+}
>+
>+void bond_debug_reregister(struct bonding *bond)
>+{
>+	struct dentry *d;
>+
>+	if (!bonding_debug_root)
>+		return;
>+
>+	d = debugfs_rename(bonding_debug_root, bond->debug_dir,
>+			   bonding_debug_root, bond->dev->name);
>+	if (d) {
>+		bond->debug_dir = d;
>+	} else {
>+		pr_warning("%s: Warning: failed to reregister, "
>+				"so just unregister old one\n",
>+				bond->dev->name);
>+		bond_debug_unregister(bond);
>+	}
>+}
>+
>+void bond_create_debugfs(void)
>+{
>+	bonding_debug_root = debugfs_create_dir("bonding", NULL);
>+
>+	if (!bonding_debug_root) {
>+		pr_warning("Warning: Cannot create bonding directory"
>+				" in debugfs\n");
>+	}
>+}
>+
>+void bond_destroy_debugfs(void)
>+{
>+	debugfs_remove_recursive(bonding_debug_root);
>+	bonding_debug_root = NULL;
>+}
>+
>+
>+#else /* !CONFIG_DEBUG_FS */
>+
>+void bond_debug_register(struct bonding *bond)
>+{
>+}
>+
>+void bond_debug_unregister(struct bonding *bond)
>+{
>+}
>+
>+void bond_debug_reregister(struct bonding *bond)
>+{
>+}
>+
>+void bond_create_debugfs(void)
>+{
>+}
>+
>+void bond_destroy_debugfs(void)
>+{
>+}
>+
>+#endif /* CONFIG_DEBUG_FS */
>Index: net-next/drivers/net/bonding/bonding.h
>===================================================================
>--- net-next.orig/drivers/net/bonding/bonding.h
>+++ net-next/drivers/net/bonding/bonding.h
>@@ -259,6 +259,10 @@ struct bonding {
> #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
> 	struct   in6_addr master_ipv6;
> #endif
>+#ifdef CONFIG_DEBUG_FS
>+	/* debugging suport via debugfs */
>+	struct	 dentry *debug_dir;
>+#endif /* CONFIG_DEBUG_FS */
> };
>
> /**
>@@ -380,6 +384,11 @@ void bond_select_active_slave(struct bon
> void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
> void bond_register_arp(struct bonding *);
> void bond_unregister_arp(struct bonding *);
>+void bond_create_debugfs(void);
>+void bond_destroy_debugfs(void);
>+void bond_debug_register(struct bonding *bond);
>+void bond_debug_unregister(struct bonding *bond);
>+void bond_debug_reregister(struct bonding *bond);
>
> struct bond_net {
> 	struct net *		net;	/* Associated network namespace */
>
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/3] bonding: add the debugfs facility to the bonding driver
  2010-12-11  0:21     ` Jay Vosburgh
@ 2010-12-11  0:23       ` David Miller
  2010-12-13  5:09         ` Taku Izumi
  0 siblings, 1 reply; 16+ messages in thread
From: David Miller @ 2010-12-11  0:23 UTC (permalink / raw)
  To: fubar; +Cc: izumi.taku, netdev, eric.dumazet, shemminger

From: Jay Vosburgh <fubar@us.ibm.com>
Date: Fri, 10 Dec 2010 16:21:45 -0800

> Taku Izumi <izumi.taku@jp.fujitsu.com> wrote:
> 
>>
>>This patch provides the debugfs facility to the bonding driver.
>>The "bonding" directory is created in the debugfs root and directories of
>>each bonding interface (like bond0, bond1...) are created in that.
>>
>> # mount -t debugfs none /sys/kernel/debug
>>
>> # ls /sys/kernel/debug/bonding
>> bond0  bond1
>>
>>Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
> 
> 	Tested replacement patch 1 with original patches 2 and 3.  Works
> as advertised, no pesky crashes.
> 
> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

I'll apply this patch #1.  Taku-san, could you please report patch #2
and #3 and remember to include Jay's signoff.

Thanks.

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

* Re: [PATCH 2/3] bonding: migrate some macros from bond_alb.c to bond_alb.h
  2010-12-03  7:22 ` [PATCH 2/3] bonding: migrate some macros from bond_alb.c to bond_alb.h Taku Izumi
@ 2010-12-13  5:03   ` Taku Izumi
  2010-12-16 20:35     ` David Miller
  0 siblings, 1 reply; 16+ messages in thread
From: Taku Izumi @ 2010-12-13  5:03 UTC (permalink / raw)
  To: netdev, Jay Vosburgh, David S. Miller; +Cc: eric.dumazet, shemminger


This patch simply migrates some macros from bond_alb.c to bond_alb.h.


Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

---
 drivers/net/bonding/bond_alb.c |   36 ------------------------------------
 drivers/net/bonding/bond_alb.h |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 36 deletions(-)

Index: net-next/drivers/net/bonding/bond_alb.c
===================================================================
--- net-next.orig/drivers/net/bonding/bond_alb.c
+++ net-next/drivers/net/bonding/bond_alb.c
@@ -44,42 +44,6 @@
 #include "bond_alb.h"


-#define ALB_TIMER_TICKS_PER_SEC	    10	/* should be a divisor of HZ */
-#define BOND_TLB_REBALANCE_INTERVAL 10	/* In seconds, periodic re-balancing.
-					 * Used for division - never set
-					 * to zero !!!
-					 */
-#define BOND_ALB_LP_INTERVAL	    1	/* In seconds, periodic send of
-					 * learning packets to the switch
-					 */
-
-#define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \
-				  * ALB_TIMER_TICKS_PER_SEC)
-
-#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \
-			   * ALB_TIMER_TICKS_PER_SEC)
-
-#define TLB_HASH_TABLE_SIZE 256	/* The size of the clients hash table.
-				 * Note that this value MUST NOT be smaller
-				 * because the key hash table is BYTE wide !
-				 */
-
-
-#define TLB_NULL_INDEX		0xffffffff
-#define MAX_LP_BURST		3
-
-/* rlb defs */
-#define RLB_HASH_TABLE_SIZE	256
-#define RLB_NULL_INDEX		0xffffffff
-#define RLB_UPDATE_DELAY	2*ALB_TIMER_TICKS_PER_SEC /* 2 seconds */
-#define RLB_ARP_BURST_SIZE	2
-#define RLB_UPDATE_RETRY	3	/* 3-ticks - must be smaller than the rlb
-					 * rebalance interval (5 min).
-					 */
-/* RLB_PROMISC_TIMEOUT = 10 sec equals the time that the current slave is
- * promiscuous after failover
- */
-#define RLB_PROMISC_TIMEOUT	10*ALB_TIMER_TICKS_PER_SEC

 #ifndef __long_aligned
 #define __long_aligned __attribute__((aligned((sizeof(long)))))
Index: net-next/drivers/net/bonding/bond_alb.h
===================================================================
--- net-next.orig/drivers/net/bonding/bond_alb.h
+++ net-next/drivers/net/bonding/bond_alb.h
@@ -31,6 +31,44 @@ struct slave;
 #define BOND_ALB_INFO(bond)   ((bond)->alb_info)
 #define SLAVE_TLB_INFO(slave) ((slave)->tlb_info)

+#define ALB_TIMER_TICKS_PER_SEC	    10	/* should be a divisor of HZ */
+#define BOND_TLB_REBALANCE_INTERVAL 10	/* In seconds, periodic re-balancing.
+					 * Used for division - never set
+					 * to zero !!!
+					 */
+#define BOND_ALB_LP_INTERVAL	    1	/* In seconds, periodic send of
+					 * learning packets to the switch
+					 */
+
+#define BOND_TLB_REBALANCE_TICKS (BOND_TLB_REBALANCE_INTERVAL \
+				  * ALB_TIMER_TICKS_PER_SEC)
+
+#define BOND_ALB_LP_TICKS (BOND_ALB_LP_INTERVAL \
+			   * ALB_TIMER_TICKS_PER_SEC)
+
+#define TLB_HASH_TABLE_SIZE 256	/* The size of the clients hash table.
+				 * Note that this value MUST NOT be smaller
+				 * because the key hash table is BYTE wide !
+				 */
+
+
+#define TLB_NULL_INDEX		0xffffffff
+#define MAX_LP_BURST		3
+
+/* rlb defs */
+#define RLB_HASH_TABLE_SIZE	256
+#define RLB_NULL_INDEX		0xffffffff
+#define RLB_UPDATE_DELAY	(2*ALB_TIMER_TICKS_PER_SEC) /* 2 seconds */
+#define RLB_ARP_BURST_SIZE	2
+#define RLB_UPDATE_RETRY	3 /* 3-ticks - must be smaller than the rlb
+				   * rebalance interval (5 min).
+				   */
+/* RLB_PROMISC_TIMEOUT = 10 sec equals the time that the current slave is
+ * promiscuous after failover
+ */
+#define RLB_PROMISC_TIMEOUT	(10*ALB_TIMER_TICKS_PER_SEC)
+
+
 struct tlb_client_info {
 	struct slave *tx_slave;	/* A pointer to slave used for transmiting
 				 * packets to a Client that the Hash function



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

* Re: [PATCH 3/3] bonding: add the debugfs interface to see RLB hash table
  2010-12-03  7:22 ` [PATCH 3/3] bonding: add the debugfs interface to see RLB hash table Taku Izumi
@ 2010-12-13  5:04   ` Taku Izumi
  2010-12-16 20:35     ` David Miller
  0 siblings, 1 reply; 16+ messages in thread
From: Taku Izumi @ 2010-12-13  5:04 UTC (permalink / raw)
  To: netdev, Jay Vosburgh, David S. Miller; +Cc: eric.dumazet, shemminger


This patch provices the debugfs interface to see RLB hash table
like the following:

# cat /sys/kernel/debug/bonding/bond0/rlb_hash_table
SourceIP        DestinationIP   Destination MAC   DEV
10.124.196.205  10.124.196.205  ff:ff:ff:ff:ff:ff eth4
10.124.196.205  10.124.196.81   00:19:99:XX:XX:XX eth3
10.124.196.205  10.124.196.1    00:21:d8:XX:XX:XX eth0

This is helpful to check if the receive load balancing works as expected.

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

---
 drivers/net/bonding/bond_debugfs.c |   50 +++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

Index: net-next/drivers/net/bonding/bond_debugfs.c
===================================================================
--- net-next.orig/drivers/net/bonding/bond_debugfs.c
+++ net-next/drivers/net/bonding/bond_debugfs.c
@@ -4,6 +4,7 @@
 #include <linux/netdevice.h>

 #include "bonding.h"
+#include "bond_alb.h"

 #ifdef CONFIG_DEBUG_FS

@@ -12,6 +13,52 @@

 static struct dentry *bonding_debug_root;

+/*
+ *  Show RLB hash table
+ */
+static int bond_debug_rlb_hash_show(struct seq_file *m, void *v)
+{
+	struct bonding *bond = m->private;
+	struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
+	struct rlb_client_info *client_info;
+	u32 hash_index;
+
+	if (bond->params.mode != BOND_MODE_ALB)
+		return 0;
+
+	seq_printf(m, "SourceIP        DestinationIP   "
+			"Destination MAC   DEV\n");
+
+	spin_lock_bh(&(BOND_ALB_INFO(bond).rx_hashtbl_lock));
+
+	hash_index = bond_info->rx_hashtbl_head;
+	for (; hash_index != RLB_NULL_INDEX; hash_index = client_info->next) {
+		client_info = &(bond_info->rx_hashtbl[hash_index]);
+		seq_printf(m, "%-15pI4 %-15pI4 %-17pM %s\n",
+			&client_info->ip_src,
+			&client_info->ip_dst,
+			&client_info->mac_dst,
+			client_info->slave->dev->name);
+	}
+
+	spin_unlock_bh(&(BOND_ALB_INFO(bond).rx_hashtbl_lock));
+
+	return 0;
+}
+
+static int bond_debug_rlb_hash_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, bond_debug_rlb_hash_show, inode->i_private);
+}
+
+static const struct file_operations bond_debug_rlb_hash_fops = {
+	.owner		= THIS_MODULE,
+	.open		= bond_debug_rlb_hash_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};
+
 void bond_debug_register(struct bonding *bond)
 {
 	if (!bonding_debug_root)
@@ -25,6 +72,9 @@ void bond_debug_register(struct bonding
 			bond->dev->name);
 		return;
 	}
+
+	debugfs_create_file("rlb_hash_table", 0400, bond->debug_dir,
+				bond, &bond_debug_rlb_hash_fops);
 }

 void bond_debug_unregister(struct bonding *bond)



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

* Re: [PATCH 1/3] bonding: add the debugfs facility to the bonding driver
  2010-12-11  0:23       ` David Miller
@ 2010-12-13  5:09         ` Taku Izumi
  2010-12-13  5:15           ` David Miller
  0 siblings, 1 reply; 16+ messages in thread
From: Taku Izumi @ 2010-12-13  5:09 UTC (permalink / raw)
  To: David Miller; +Cc: fubar, netdev, eric.dumazet, shemminger


(2010/12/11 9:23), David Miller wrote:
> From: Jay Vosburgh<fubar@us.ibm.com>
> Date: Fri, 10 Dec 2010 16:21:45 -0800
> 
>> Taku Izumi<izumi.taku@jp.fujitsu.com>  wrote:
>>
>>>
>>> This patch provides the debugfs facility to the bonding driver.
>>> The "bonding" directory is created in the debugfs root and directories of
>>> each bonding interface (like bond0, bond1...) are created in that.
>>>
>>> # mount -t debugfs none /sys/kernel/debug
>>>
>>> # ls /sys/kernel/debug/bonding
>>> bond0  bond1
>>>
>>> Signed-off-by: Taku Izumi<izumi.taku@jp.fujitsu.com>
>>
>> 	Tested replacement patch 1 with original patches 2 and 3.  Works
>> as advertised, no pesky crashes.
>>
>> Signed-off-by: Jay Vosburgh<fubar@us.ibm.com>
> 
> I'll apply this patch #1.  Taku-san, could you please report patch #2
> and #3 and remember to include Jay's signoff.
> 

 I resent the patch #2 and #3 with Jay's signoff.

Best regards,
Taku Izumi



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

* Re: [PATCH 1/3] bonding: add the debugfs facility to the bonding driver
  2010-12-13  5:09         ` Taku Izumi
@ 2010-12-13  5:15           ` David Miller
  0 siblings, 0 replies; 16+ messages in thread
From: David Miller @ 2010-12-13  5:15 UTC (permalink / raw)
  To: izumi.taku; +Cc: fubar, netdev, eric.dumazet, shemminger

From: Taku Izumi <izumi.taku@jp.fujitsu.com>
Date: Mon, 13 Dec 2010 14:09:30 +0900

>  I resent the patch #2 and #3 with Jay's signoff.

Thank you.

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

* Re: [PATCH 2/3] bonding: migrate some macros from bond_alb.c to bond_alb.h
  2010-12-13  5:03   ` Taku Izumi
@ 2010-12-16 20:35     ` David Miller
  0 siblings, 0 replies; 16+ messages in thread
From: David Miller @ 2010-12-16 20:35 UTC (permalink / raw)
  To: izumi.taku; +Cc: netdev, fubar, eric.dumazet, shemminger

From: Taku Izumi <izumi.taku@jp.fujitsu.com>
Date: Mon, 13 Dec 2010 14:03:24 +0900

> 
> This patch simply migrates some macros from bond_alb.c to bond_alb.h.
> 
> 
> Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

Applied.

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

* Re: [PATCH 3/3] bonding: add the debugfs interface to see RLB hash table
  2010-12-13  5:04   ` Taku Izumi
@ 2010-12-16 20:35     ` David Miller
  0 siblings, 0 replies; 16+ messages in thread
From: David Miller @ 2010-12-16 20:35 UTC (permalink / raw)
  To: izumi.taku; +Cc: netdev, fubar, eric.dumazet, shemminger

From: Taku Izumi <izumi.taku@jp.fujitsu.com>
Date: Mon, 13 Dec 2010 14:04:43 +0900

> 
> This patch provices the debugfs interface to see RLB hash table
> like the following:
> 
> # cat /sys/kernel/debug/bonding/bond0/rlb_hash_table
> SourceIP        DestinationIP   Destination MAC   DEV
> 10.124.196.205  10.124.196.205  ff:ff:ff:ff:ff:ff eth4
> 10.124.196.205  10.124.196.81   00:19:99:XX:XX:XX eth3
> 10.124.196.205  10.124.196.1    00:21:d8:XX:XX:XX eth0
> 
> This is helpful to check if the receive load balancing works as expected.
> 
> Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

Applied.

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

end of thread, other threads:[~2010-12-16 20:34 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-03  7:19 [PATCH v2 0/3] bonding: add the debugfs interface to see RLB hash table Taku Izumi
2010-12-03  7:21 ` [PATCH 1/3] bonding: add the debugfs facility to the bonding driver Taku Izumi
2010-12-10  1:17   ` Taku Izumi
2010-12-11  0:21     ` Jay Vosburgh
2010-12-11  0:23       ` David Miller
2010-12-13  5:09         ` Taku Izumi
2010-12-13  5:15           ` David Miller
2010-12-03  7:22 ` [PATCH 2/3] bonding: migrate some macros from bond_alb.c to bond_alb.h Taku Izumi
2010-12-13  5:03   ` Taku Izumi
2010-12-16 20:35     ` David Miller
2010-12-03  7:22 ` [PATCH 3/3] bonding: add the debugfs interface to see RLB hash table Taku Izumi
2010-12-13  5:04   ` Taku Izumi
2010-12-16 20:35     ` David Miller
2010-12-08 20:33 ` [PATCH v2 0/3] " Jay Vosburgh
2010-12-09 10:43   ` Taku Izumi
2010-12-10  1:24   ` Taku Izumi

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.