netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/7] [RFC] bonding updates to net-next-2.6
@ 2008-12-09 20:07 holger
  2008-12-09 20:07 ` [patch 1/7] bonding: add and use bond_is_lb() holger
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: holger @ 2008-12-09 20:07 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev

Hi Jay,

these are some patches against the bonding code in net-next-2.6.
I hope you find them usefull.

As you requested previously I tried to make bond_start_xmit() use a
function table instead of the switch statement, but with some unexpected
results which I'm currently analyzing.  I therefore leave it as-is.

Thanks for your previous feedback.

 /holger



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

* [patch 1/7] bonding: add and use bond_is_lb()
  2008-12-09 20:07 [patch 0/7] [RFC] bonding updates to net-next-2.6 holger
@ 2008-12-09 20:07 ` holger
  2008-12-10  7:07   ` David Miller
  2008-12-09 20:07 ` [patch 2/7] bonding: use table for mode names holger
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: holger @ 2008-12-09 20:07 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev

[-- Attachment #1: bonding-add-n-use-bond_is_lb.diff --]
[-- Type: text/plain, Size: 3900 bytes --]

Introduce and use bond_is_lb(), it is usefull to shorten the repetitive
check for either ALB or TLB mode.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Index: bonding-2.6-out/drivers/net/bonding/bond_main.c
===================================================================
--- bonding-2.6-out.orig/drivers/net/bonding/bond_main.c	2008-12-09 20:42:55.000000000 +0100
+++ bonding-2.6-out/drivers/net/bonding/bond_main.c	2008-12-09 20:44:21.000000000 +0100
@@ -294,10 +294,8 @@
 		if (vlan->vlan_id == vlan_id) {
 			list_del(&vlan->vlan_list);
 
-			if ((bond->params.mode == BOND_MODE_TLB) ||
-			    (bond->params.mode == BOND_MODE_ALB)) {
+			if (bond_is_lb(bond))
 				bond_alb_clear_vlan(bond, vlan_id);
-			}
 
 			dprintk("removed VLAN ID %d from bond %s\n", vlan_id,
 				bond->dev->name);
@@ -1174,10 +1172,8 @@
 				bond_3ad_handle_link_change(new_active, BOND_LINK_UP);
 			}
 
-			if ((bond->params.mode == BOND_MODE_TLB) ||
-			    (bond->params.mode == BOND_MODE_ALB)) {
+			if (bond_is_lb(bond))
 				bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP);
-			}
 		} else {
 			if (USES_PRIMARY(bond->params.mode)) {
 				printk(KERN_INFO DRV_NAME
@@ -1192,8 +1188,7 @@
 		bond_mc_swap(bond, new_active, old_active);
 	}
 
-	if ((bond->params.mode == BOND_MODE_TLB) ||
-	    (bond->params.mode == BOND_MODE_ALB)) {
+	if (bond_is_lb(bond)) {
 		bond_alb_handle_active_change(bond, new_active);
 		if (old_active)
 			bond_set_slave_inactive_flags(old_active);
@@ -1554,8 +1549,7 @@
 	new_slave->dev = slave_dev;
 	slave_dev->priv_flags |= IFF_BONDING;
 
-	if ((bond->params.mode == BOND_MODE_TLB) ||
-	    (bond->params.mode == BOND_MODE_ALB)) {
+	if (bond_is_lb(bond)) {
 		/* bond_alb_init_slave() must be called before all other stages since
 		 * it might fail and we do not want to have to undo everything
 		 */
@@ -1871,8 +1865,7 @@
 		bond_change_active_slave(bond, NULL);
 	}
 
-	if ((bond->params.mode == BOND_MODE_TLB) ||
-	    (bond->params.mode == BOND_MODE_ALB)) {
+	if (bond_is_lb(bond)) {
 		/* Must be called only after the slave has been
 		 * detached from the list and the curr_active_slave
 		 * has been cleared (if our_slave == old_current),
@@ -2061,8 +2054,7 @@
 		 */
 		write_unlock_bh(&bond->lock);
 
-		if ((bond->params.mode == BOND_MODE_TLB) ||
-		    (bond->params.mode == BOND_MODE_ALB)) {
+		if (bond_is_lb(bond)) {
 			/* must be called only after the slave
 			 * has been detached from the list
 			 */
@@ -2389,8 +2381,7 @@
 			if (bond->params.mode == BOND_MODE_8023AD)
 				bond_3ad_handle_link_change(slave, BOND_LINK_UP);
 
-			if ((bond->params.mode == BOND_MODE_TLB) ||
-			    (bond->params.mode == BOND_MODE_ALB))
+			if (bond_is_lb(bond))
 				bond_alb_handle_link_change(bond, slave,
 							    BOND_LINK_UP);
 
@@ -3796,8 +3787,7 @@
 
 	bond->kill_timers = 0;
 
-	if ((bond->params.mode == BOND_MODE_TLB) ||
-	    (bond->params.mode == BOND_MODE_ALB)) {
+	if (bond_is_lb(bond)) {
 		/* bond_alb_initialize must be called before the timer
 		 * is started.
 		 */
@@ -3882,8 +3872,7 @@
 	}
 
 
-	if ((bond->params.mode == BOND_MODE_TLB) ||
-	    (bond->params.mode == BOND_MODE_ALB)) {
+	if (bond_is_lb(bond)) {
 		/* Must be called only after all
 		 * slaves have been released
 		 */
Index: bonding-2.6-out/drivers/net/bonding/bonding.h
===================================================================
--- bonding-2.6-out.orig/drivers/net/bonding/bonding.h	2008-12-09 20:42:55.000000000 +0100
+++ bonding-2.6-out/drivers/net/bonding/bonding.h	2008-12-09 20:44:21.000000000 +0100
@@ -260,6 +260,12 @@
 	return (struct bonding *)netdev_priv(slave->dev->master);
 }
 
+static inline bool bond_is_lb(const struct bonding *bond)
+{
+	return bond->params.mode == BOND_MODE_TLB
+		|| bond->params.mode == BOND_MODE_ALB;
+}
+
 #define BOND_FOM_NONE			0
 #define BOND_FOM_ACTIVE			1
 #define BOND_FOM_FOLLOW			2

-- 

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

* [patch 2/7] bonding: use table for mode names
  2008-12-09 20:07 [patch 0/7] [RFC] bonding updates to net-next-2.6 holger
  2008-12-09 20:07 ` [patch 1/7] bonding: add and use bond_is_lb() holger
@ 2008-12-09 20:07 ` holger
  2008-12-10  7:08   ` David Miller
  2008-12-09 20:07 ` [patch 3/7] bonding: fix compile error if debug enabled holger
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: holger @ 2008-12-09 20:07 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev

[-- Attachment #1: bonding-use-table-for-3ad-mode-names.diff --]
[-- Type: text/plain, Size: 1879 bytes --]

Use a small array in bond_mode_name() for the names, thus saving some
space:

before

    text     data      bss      dec    hex filename
   57736     9372      344    67452  1077c drivers/net/bonding/bonding.ko

after
    text     data      bss      dec    hex filename
   57441     9372      344    67157  10655 drivers/net/bonding/bonding.ko

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Index: bonding-2.6/drivers/net/bonding/bond_main.c
===================================================================
--- bonding-2.6.orig/drivers/net/bonding/bond_main.c	2008-12-08 20:55:52.000000000 +0100
+++ bonding-2.6/drivers/net/bonding/bond_main.c	2008-12-08 22:16:02.000000000 +0100
@@ -219,24 +219,20 @@
 
 static const char *bond_mode_name(int mode)
 {
-	switch (mode) {
-	case BOND_MODE_ROUNDROBIN :
-		return "load balancing (round-robin)";
-	case BOND_MODE_ACTIVEBACKUP :
-		return "fault-tolerance (active-backup)";
-	case BOND_MODE_XOR :
-		return "load balancing (xor)";
-	case BOND_MODE_BROADCAST :
-		return "fault-tolerance (broadcast)";
-	case BOND_MODE_8023AD:
-		return "IEEE 802.3ad Dynamic link aggregation";
-	case BOND_MODE_TLB:
-		return "transmit load balancing";
-	case BOND_MODE_ALB:
-		return "adaptive load balancing";
-	default:
+	static const char *names[] = {
+		[BOND_MODE_ROUNDROBIN] = "load balancing (round-robin)",
+		[BOND_MODE_ACTIVEBACKUP] = "fault-tolerance (active-backup)",
+		[BOND_MODE_XOR] = "load balancing (xor)",
+		[BOND_MODE_BROADCAST] = "fault-tolerance (broadcast)",
+		[BOND_MODE_8023AD]= "IEEE 802.3ad Dynamic link aggregation",
+		[BOND_MODE_TLB] = "transmit load balancing",
+		[BOND_MODE_ALB] = "adaptive load balancing",
+	};
+
+	if (mode < 0 || mode > BOND_MODE_ALB)
 		return "unknown";
-	}
+
+	return names[mode];
 }
 
 /*---------------------------------- VLAN -----------------------------------*/

-- 

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

* [patch 3/7] bonding: fix compile error if debug enabled
  2008-12-09 20:07 [patch 0/7] [RFC] bonding updates to net-next-2.6 holger
  2008-12-09 20:07 ` [patch 1/7] bonding: add and use bond_is_lb() holger
  2008-12-09 20:07 ` [patch 2/7] bonding: use table for mode names holger
@ 2008-12-09 20:07 ` holger
  2008-12-10  7:09   ` David Miller
  2008-12-09 20:07 ` [patch 4/7] bonding: use pr_debug instead of own macros holger
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: holger @ 2008-12-09 20:07 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev

[-- Attachment #1: bonding-fix-compile-error-in-debug-output.diff --]
[-- Type: text/plain, Size: 1053 bytes --]

This is what I get if debug is enabled:

drivers/net/bonding/bond_ipv6.c: In function 'bond_na_send':
drivers/net/bonding/bond_ipv6.c:75: error: 'slave' undeclared (first use in this function)
drivers/net/bonding/bond_ipv6.c:75: error: (Each undeclared identifier is reported only once
drivers/net/bonding/bond_ipv6.c:75: error: for each function it appears in.)

This patch fixes that.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Index: bonding-2.6/drivers/net/bonding/bond_ipv6.c
===================================================================
--- bonding-2.6.orig/drivers/net/bonding/bond_ipv6.c	2008-12-05 23:13:47.000000000 +0100
+++ bonding-2.6/drivers/net/bonding/bond_ipv6.c	2008-12-05 23:13:59.000000000 +0100
@@ -75,7 +75,7 @@
 	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);

-- 

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

* [patch 4/7] bonding: use pr_debug instead of own macros
  2008-12-09 20:07 [patch 0/7] [RFC] bonding updates to net-next-2.6 holger
                   ` (2 preceding siblings ...)
  2008-12-09 20:07 ` [patch 3/7] bonding: fix compile error if debug enabled holger
@ 2008-12-09 20:07 ` holger
  2008-12-10  7:09   ` David Miller
  2008-12-09 20:07 ` [patch 5/7] bonding: remove duplicate declarations holger
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 15+ messages in thread
From: holger @ 2008-12-09 20:07 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev

[-- Attachment #1: bonding-use-pr_debug.diff --]
[-- Type: text/plain, Size: 26272 bytes --]

Use pr_debug() instead of own macros.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Index: bonding-2.6/drivers/net/bonding/bonding.h
===================================================================
--- bonding-2.6.orig/drivers/net/bonding/bonding.h	2008-12-08 22:59:59.000000000 +0100
+++ bonding-2.6/drivers/net/bonding/bonding.h	2008-12-08 23:02:38.000000000 +0100
@@ -32,14 +32,6 @@
 
 extern struct list_head bond_dev_list;
 
-#ifdef BONDING_DEBUG
-#define dprintk(fmt, args...) \
-	printk(KERN_DEBUG     \
-	       DRV_NAME ": %s() %d: " fmt, __func__, __LINE__ , ## args )
-#else
-#define dprintk(fmt, args...)
-#endif /* BONDING_DEBUG */
-
 #define IS_UP(dev)					   \
 	      ((((dev)->flags & IFF_UP) == IFF_UP)	&& \
 	       netif_running(dev)			&& \
Index: bonding-2.6/drivers/net/bonding/bond_3ad.c
===================================================================
--- bonding-2.6.orig/drivers/net/bonding/bond_3ad.c	2008-12-08 22:42:32.000000000 +0100
+++ bonding-2.6/drivers/net/bonding/bond_3ad.c	2008-12-08 23:02:38.000000000 +0100
@@ -20,8 +20,6 @@
  *
  */
 
-//#define BONDING_DEBUG 1
-
 #include <linux/skbuff.h>
 #include <linux/if_ether.h>
 #include <linux/netdevice.h>
@@ -381,7 +379,7 @@
 		}
 	}
 
-	dprintk("Port %d Received link speed %d update from adapter\n", port->actor_port_number, speed);
+	pr_debug("Port %d Received link speed %d update from adapter\n", port->actor_port_number, speed);
 	return speed;
 }
 
@@ -407,12 +405,12 @@
 		switch (slave->duplex) {
 		case DUPLEX_FULL:
 			retval=0x1;
-			dprintk("Port %d Received status full duplex update from adapter\n", port->actor_port_number);
+			pr_debug("Port %d Received status full duplex update from adapter\n", port->actor_port_number);
 			break;
 		case DUPLEX_HALF:
 		default:
 			retval=0x0;
-			dprintk("Port %d Received status NOT full duplex update from adapter\n", port->actor_port_number);
+			pr_debug("Port %d Received status NOT full duplex update from adapter\n", port->actor_port_number);
 			break;
 		}
 	}
@@ -1019,7 +1017,7 @@
 
 	// check if the state machine was changed
 	if (port->sm_mux_state != last_state) {
-		dprintk("Mux Machine: Port=%d, Last State=%d, Curr State=%d\n", port->actor_port_number, last_state, port->sm_mux_state);
+		pr_debug("Mux Machine: Port=%d, Last State=%d, Curr State=%d\n", port->actor_port_number, last_state, port->sm_mux_state);
 		switch (port->sm_mux_state) {
 		case AD_MUX_DETACHED:
 			__detach_bond_from_agg(port);
@@ -1118,7 +1116,7 @@
 
 	// check if the State machine was changed or new lacpdu arrived
 	if ((port->sm_rx_state != last_state) || (lacpdu)) {
-		dprintk("Rx Machine: Port=%d, Last State=%d, Curr State=%d\n", port->actor_port_number, last_state, port->sm_rx_state);
+		pr_debug("Rx Machine: Port=%d, Last State=%d, Curr State=%d\n", port->actor_port_number, last_state, port->sm_rx_state);
 		switch (port->sm_rx_state) {
 		case AD_RX_INITIALIZE:
 			if (!(port->actor_oper_port_key & AD_DUPLEX_KEY_BITS)) {
@@ -1205,7 +1203,7 @@
 			__update_lacpdu_from_port(port);
 			// send the lacpdu
 			if (ad_lacpdu_send(port) >= 0) {
-				dprintk("Sent LACPDU on port %d\n", port->actor_port_number);
+				pr_debug("Sent LACPDU on port %d\n", port->actor_port_number);
 				// mark ntt as false, so it will not be sent again until demanded
 				port->ntt = 0;
 			}
@@ -1278,7 +1276,7 @@
 
 	// check if the state machine was changed
 	if (port->sm_periodic_state != last_state) {
-		dprintk("Periodic Machine: Port=%d, Last State=%d, Curr State=%d\n", port->actor_port_number, last_state, port->sm_periodic_state);
+		pr_debug("Periodic Machine: Port=%d, Last State=%d, Curr State=%d\n", port->actor_port_number, last_state, port->sm_periodic_state);
 		switch (port->sm_periodic_state) {
 		case AD_NO_PERIODIC:
 			port->sm_periodic_timer_counter = 0;	   // zero timer
@@ -1335,7 +1333,7 @@
 				port->next_port_in_aggregator=NULL;
 				port->actor_port_aggregator_identifier=0;
 
-				dprintk("Port %d left LAG %d\n", port->actor_port_number, temp_aggregator->aggregator_identifier);
+				pr_debug("Port %d left LAG %d\n", port->actor_port_number, temp_aggregator->aggregator_identifier);
 				// if the aggregator is empty, clear its parameters, and set it ready to be attached
 				if (!temp_aggregator->lag_ports) {
 					ad_clear_agg(temp_aggregator);
@@ -1378,7 +1376,7 @@
 			port->next_port_in_aggregator=aggregator->lag_ports;
 			port->aggregator->num_of_ports++;
 			aggregator->lag_ports=port;
-			dprintk("Port %d joined LAG %d(existing LAG)\n", port->actor_port_number, port->aggregator->aggregator_identifier);
+			pr_debug("Port %d joined LAG %d(existing LAG)\n", port->actor_port_number, port->aggregator->aggregator_identifier);
 
 			// mark this port as selected
 			port->sm_vars |= AD_PORT_SELECTED;
@@ -1415,7 +1413,7 @@
 			// mark this port as selected
 			port->sm_vars |= AD_PORT_SELECTED;
 
-			dprintk("Port %d joined LAG %d(new LAG)\n", port->actor_port_number, port->aggregator->aggregator_identifier);
+			pr_debug("Port %d joined LAG %d(new LAG)\n", port->actor_port_number, port->aggregator->aggregator_identifier);
 		} else {
 			printk(KERN_ERR DRV_NAME ": %s: Port %d (on %s) did not find a suitable aggregator\n",
 			       port->slave->dev->master->name,
@@ -1574,19 +1572,19 @@
 
 	// if there is new best aggregator, activate it
 	if (best) {
-		dprintk("best Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n",
+		pr_debug("best Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n",
 		       best->aggregator_identifier, best->num_of_ports,
 		       best->actor_oper_aggregator_key,
 		       best->partner_oper_aggregator_key,
 		       best->is_individual, best->is_active);
-		dprintk("best ports %p slave %p %s\n",
+		pr_debug("best ports %p slave %p %s\n",
 		       best->lag_ports, best->slave,
 		       best->slave ? best->slave->dev->name : "NULL");
 
 		for (agg = __get_first_agg(best->lag_ports); agg;
 		     agg = __get_next_agg(agg)) {
 
-			dprintk("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n",
+			pr_debug("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n",
 				agg->aggregator_identifier, agg->num_of_ports,
 				agg->actor_oper_aggregator_key,
 				agg->partner_oper_aggregator_key,
@@ -1602,9 +1600,9 @@
 		}
 
 		best->is_active = 1;
-		dprintk("LAG %d chosen as the active LAG\n",
+		pr_debug("LAG %d chosen as the active LAG\n",
 			best->aggregator_identifier);
-		dprintk("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n",
+		pr_debug("Agg=%d; P=%d; a k=%d; p k=%d; Ind=%d; Act=%d\n",
 			best->aggregator_identifier, best->num_of_ports,
 			best->actor_oper_aggregator_key,
 			best->partner_oper_aggregator_key,
@@ -1662,7 +1660,7 @@
 		aggregator->lag_ports = NULL;
 		aggregator->is_active = 0;
 		aggregator->num_of_ports = 0;
-		dprintk("LAG %d was cleared\n", aggregator->aggregator_identifier);
+		pr_debug("LAG %d was cleared\n", aggregator->aggregator_identifier);
 	}
 }
 
@@ -1747,7 +1745,7 @@
 static void ad_enable_collecting_distributing(struct port *port)
 {
 	if (port->aggregator->is_active) {
-		dprintk("Enabling port %d(LAG %d)\n", port->actor_port_number, port->aggregator->aggregator_identifier);
+		pr_debug("Enabling port %d(LAG %d)\n", port->actor_port_number, port->aggregator->aggregator_identifier);
 		__enable_port(port);
 	}
 }
@@ -1760,7 +1758,7 @@
 static void ad_disable_collecting_distributing(struct port *port)
 {
 	if (port->aggregator && MAC_ADDRESS_COMPARE(&(port->aggregator->partner_system), &(null_mac_addr))) {
-		dprintk("Disabling port %d(LAG %d)\n", port->actor_port_number, port->aggregator->aggregator_identifier);
+		pr_debug("Disabling port %d(LAG %d)\n", port->actor_port_number, port->aggregator->aggregator_identifier);
 		__disable_port(port);
 	}
 }
@@ -1798,7 +1796,7 @@
 
 	// send the marker information
 	if (ad_marker_send(port, &marker) >= 0) {
-		dprintk("Sent Marker Information on port %d\n", port->actor_port_number);
+		pr_debug("Sent Marker Information on port %d\n", port->actor_port_number);
 	}
 }
 #endif
@@ -1822,7 +1820,7 @@
 	// send the marker response
 
 	if (ad_marker_send(port, &marker) >= 0) {
-		dprintk("Sent Marker Response on port %d\n", port->actor_port_number);
+		pr_debug("Sent Marker Response on port %d\n", port->actor_port_number);
 	}
 }
 
@@ -2036,7 +2034,7 @@
 		return;
 	}
 
-	dprintk("Unbinding Link Aggregation Group %d\n", aggregator->aggregator_identifier);
+	pr_debug("Unbinding Link Aggregation Group %d\n", aggregator->aggregator_identifier);
 
 	/* Tell the partner that this port is not suitable for aggregation */
 	port->actor_oper_port_state &= ~AD_STATE_AGGREGATION;
@@ -2060,7 +2058,7 @@
 			// if new aggregator found, copy the aggregator's parameters
 			// and connect the related lag_ports to the new aggregator
 			if ((new_aggregator) && ((!new_aggregator->lag_ports) || ((new_aggregator->lag_ports == port) && !new_aggregator->lag_ports->next_port_in_aggregator))) {
-				dprintk("Some port(s) related to LAG %d - replaceing with LAG %d\n", aggregator->aggregator_identifier, new_aggregator->aggregator_identifier);
+				pr_debug("Some port(s) related to LAG %d - replaceing with LAG %d\n", aggregator->aggregator_identifier, new_aggregator->aggregator_identifier);
 
 				if ((new_aggregator->lag_ports == port) && new_aggregator->is_active) {
 					printk(KERN_INFO DRV_NAME ": %s: Removing an active aggregator\n",
@@ -2111,7 +2109,7 @@
 		}
 	}
 
-	dprintk("Unbinding port %d\n", port->actor_port_number);
+	pr_debug("Unbinding port %d\n", port->actor_port_number);
 	// find the aggregator that this port is connected to
 	temp_aggregator = __get_first_agg(port);
 	for (; temp_aggregator; temp_aggregator = __get_next_agg(temp_aggregator)) {
@@ -2242,7 +2240,7 @@
 
 		switch (lacpdu->subtype) {
 		case AD_TYPE_LACPDU:
-			dprintk("Received LACPDU on port %d\n", port->actor_port_number);
+			pr_debug("Received LACPDU on port %d\n", port->actor_port_number);
 			ad_rx_machine(lacpdu, port);
 			break;
 
@@ -2251,17 +2249,17 @@
 
 			switch (((struct bond_marker *)lacpdu)->tlv_type) {
 			case AD_MARKER_INFORMATION_SUBTYPE:
-				dprintk("Received Marker Information on port %d\n", port->actor_port_number);
+				pr_debug("Received Marker Information on port %d\n", port->actor_port_number);
 				ad_marker_info_received((struct bond_marker *)lacpdu, port);
 				break;
 
 			case AD_MARKER_RESPONSE_SUBTYPE:
-				dprintk("Received Marker Response on port %d\n", port->actor_port_number);
+				pr_debug("Received Marker Response on port %d\n", port->actor_port_number);
 				ad_marker_response_received((struct bond_marker *)lacpdu, port);
 				break;
 
 			default:
-				dprintk("Received an unknown Marker subtype on slot %d\n", port->actor_port_number);
+				pr_debug("Received an unknown Marker subtype on slot %d\n", port->actor_port_number);
 			}
 		}
 	}
@@ -2289,7 +2287,7 @@
 
 	port->actor_admin_port_key &= ~AD_SPEED_KEY_BITS;
 	port->actor_oper_port_key=port->actor_admin_port_key |= (__get_link_speed(port) << 1);
-	dprintk("Port %d changed speed\n", port->actor_port_number);
+	pr_debug("Port %d changed speed\n", port->actor_port_number);
 	// there is no need to reselect a new aggregator, just signal the
 	// state machines to reinitialize
 	port->sm_vars |= AD_PORT_BEGIN;
@@ -2317,7 +2315,7 @@
 
 	port->actor_admin_port_key &= ~AD_DUPLEX_KEY_BITS;
 	port->actor_oper_port_key=port->actor_admin_port_key |= __get_duplex(port);
-	dprintk("Port %d changed duplex\n", port->actor_port_number);
+	pr_debug("Port %d changed duplex\n", port->actor_port_number);
 	// there is no need to reselect a new aggregator, just signal the
 	// state machines to reinitialize
 	port->sm_vars |= AD_PORT_BEGIN;
Index: bonding-2.6/drivers/net/bonding/bond_alb.c
===================================================================
--- bonding-2.6.orig/drivers/net/bonding/bond_alb.c	2008-12-08 22:42:32.000000000 +0100
+++ bonding-2.6/drivers/net/bonding/bond_alb.c	2008-12-08 23:00:01.000000000 +0100
@@ -20,8 +20,6 @@
  *
  */
 
-//#define BONDING_DEBUG 1
-
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
@@ -361,12 +359,12 @@
 		goto out;
 
 	if (!arp) {
-		dprintk("Packet has no ARP data\n");
+		pr_debug("Packet has no ARP data\n");
 		goto out;
 	}
 
 	if (skb->len < sizeof(struct arp_pkt)) {
-		dprintk("Packet is too small to be an ARP\n");
+		pr_debug("Packet is too small to be an ARP\n");
 		goto out;
 	}
 
@@ -376,7 +374,7 @@
 		       bond_dev->name);
 		bond = netdev_priv(bond_dev);
 		rlb_update_entry_from_arp(bond, arp);
-		dprintk("Server received an ARP Reply from client\n");
+		pr_debug("Server received an ARP Reply from client\n");
 	}
 
 	res = NET_RX_SUCCESS;
@@ -730,7 +728,7 @@
 		if (tx_slave) {
 			memcpy(arp->mac_src,tx_slave->dev->dev_addr, ETH_ALEN);
 		}
-		dprintk("Server sent ARP Reply packet\n");
+		pr_debug("Server sent ARP Reply packet\n");
 	} else if (arp->op_code == htons(ARPOP_REQUEST)) {
 		/* Create an entry in the rx_hashtbl for this client as a
 		 * place holder.
@@ -750,7 +748,7 @@
 		 * updated with their assigned mac.
 		 */
 		rlb_req_update_subnet_clients(bond, arp->ip_src);
-		dprintk("Server sent ARP Request packet\n");
+		pr_debug("Server sent ARP Request packet\n");
 	}
 
 	return tx_slave;
Index: bonding-2.6/drivers/net/bonding/bond_ipv6.c
===================================================================
--- bonding-2.6.orig/drivers/net/bonding/bond_ipv6.c	2008-12-08 23:00:01.000000000 +0100
+++ bonding-2.6/drivers/net/bonding/bond_ipv6.c	2008-12-08 23:00:01.000000000 +0100
@@ -20,8 +20,6 @@
  *
  */
 
-//#define BONDING_DEBUG 1
-
 #include <linux/types.h>
 #include <linux/if_vlan.h>
 #include <net/ipv6.h>
@@ -74,7 +72,7 @@
 
 	addrconf_addr_solict_mult(daddr, &mcaddr);
 
-	dprintk("ipv6 na on slave %s: dest %pI6, src %pI6\n",
+	pr_debug("ipv6 na on slave %s: dest %pI6, src %pI6\n",
 	       slave_dev->name, &mcaddr, daddr);
 
 	skb = ndisc_build_skb(slave_dev, &mcaddr, daddr, &icmp6h, daddr,
@@ -110,7 +108,7 @@
 	struct inet6_dev *idev;
 	int is_router;
 
-	dprintk("bond_send_unsol_na: bond %s slave %s\n", bond->dev->name,
+	pr_debug("bond_send_unsol_na: bond %s slave %s\n", bond->dev->name,
 				slave ? slave->dev->name : "NULL");
 
 	if (!slave || !bond->send_unsol_na ||
Index: bonding-2.6/drivers/net/bonding/bond_main.c
===================================================================
--- bonding-2.6.orig/drivers/net/bonding/bond_main.c	2008-12-08 23:00:01.000000000 +0100
+++ bonding-2.6/drivers/net/bonding/bond_main.c	2008-12-08 23:02:38.000000000 +0100
@@ -31,8 +31,6 @@
  *
  */
 
-//#define BONDING_DEBUG 1
-
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/types.h>
@@ -248,7 +246,7 @@
 {
 	struct vlan_entry *vlan;
 
-	dprintk("bond: %s, vlan id %d\n",
+	pr_debug("bond: %s, vlan id %d\n",
 		(bond ? bond->dev->name: "None"), vlan_id);
 
 	vlan = kzalloc(sizeof(struct vlan_entry), GFP_KERNEL);
@@ -265,7 +263,7 @@
 
 	write_unlock_bh(&bond->lock);
 
-	dprintk("added VLAN ID %d on bond %s\n", vlan_id, bond->dev->name);
+	pr_debug("added VLAN ID %d on bond %s\n", vlan_id, bond->dev->name);
 
 	return 0;
 }
@@ -282,7 +280,7 @@
 	struct vlan_entry *vlan;
 	int res = -ENODEV;
 
-	dprintk("bond: %s, vlan id %d\n", bond->dev->name, vlan_id);
+	pr_debug("bond: %s, vlan id %d\n", bond->dev->name, vlan_id);
 
 	write_lock_bh(&bond->lock);
 
@@ -293,7 +291,7 @@
 			if (bond_is_lb(bond))
 				bond_alb_clear_vlan(bond, vlan_id);
 
-			dprintk("removed VLAN ID %d from bond %s\n", vlan_id,
+			pr_debug("removed VLAN ID %d from bond %s\n", vlan_id,
 				bond->dev->name);
 
 			kfree(vlan);
@@ -313,7 +311,7 @@
 		}
 	}
 
-	dprintk("couldn't find VLAN ID %d in bond %s\n", vlan_id,
+	pr_debug("couldn't find VLAN ID %d in bond %s\n", vlan_id,
 		bond->dev->name);
 
 out:
@@ -337,13 +335,13 @@
 
 	bond_for_each_slave(bond, slave, i) {
 		if (slave->dev->features & NETIF_F_VLAN_CHALLENGED) {
-			dprintk("found VLAN challenged slave - %s\n",
+			pr_debug("found VLAN challenged slave - %s\n",
 				slave->dev->name);
 			return 1;
 		}
 	}
 
-	dprintk("no VLAN challenged slaves found\n");
+	pr_debug("no VLAN challenged slaves found\n");
 	return 0;
 }
 
@@ -1319,9 +1317,9 @@
 static int bond_sethwaddr(struct net_device *bond_dev,
 			  struct net_device *slave_dev)
 {
-	dprintk("bond_dev=%p\n", bond_dev);
-	dprintk("slave_dev=%p\n", slave_dev);
-	dprintk("slave_dev->addr_len=%d\n", slave_dev->addr_len);
+	pr_debug("bond_dev=%p\n", bond_dev);
+	pr_debug("slave_dev=%p\n", slave_dev);
+	pr_debug("slave_dev->addr_len=%d\n", slave_dev->addr_len);
 	memcpy(bond_dev->dev_addr, slave_dev->dev_addr, slave_dev->addr_len);
 	return 0;
 }
@@ -1412,14 +1410,14 @@
 
 	/* already enslaved */
 	if (slave_dev->flags & IFF_SLAVE) {
-		dprintk("Error, Device was already enslaved\n");
+		pr_debug("Error, Device was already enslaved\n");
 		return -EBUSY;
 	}
 
 	/* vlan challenged mutual exclusion */
 	/* no need to lock since we're protected by rtnl_lock */
 	if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) {
-		dprintk("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name);
+		pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name);
 		if (!list_empty(&bond->vlan_list)) {
 			printk(KERN_ERR DRV_NAME
 			       ": %s: Error: cannot enslave VLAN "
@@ -1437,7 +1435,7 @@
 			bond_dev->features |= NETIF_F_VLAN_CHALLENGED;
 		}
 	} else {
-		dprintk("%s: ! NETIF_F_VLAN_CHALLENGED\n", slave_dev->name);
+		pr_debug("%s: ! NETIF_F_VLAN_CHALLENGED\n", slave_dev->name);
 		if (bond->slave_cnt == 0) {
 			/* First slave, and it is not VLAN challenged,
 			 * so remove the block of adding VLANs over the bond.
@@ -1525,20 +1523,20 @@
 		addr.sa_family = slave_dev->type;
 		res = dev_set_mac_address(slave_dev, &addr);
 		if (res) {
-			dprintk("Error %d calling set_mac_address\n", res);
+			pr_debug("Error %d calling set_mac_address\n", res);
 			goto err_free;
 		}
 	}
 
 	res = netdev_set_master(slave_dev, bond_dev);
 	if (res) {
-		dprintk("Error %d calling netdev_set_master\n", res);
+		pr_debug("Error %d calling netdev_set_master\n", res);
 		goto err_restore_mac;
 	}
 	/* open the slave since the application closed it */
 	res = dev_open(slave_dev);
 	if (res) {
-		dprintk("Openning slave %s failed\n", slave_dev->name);
+		pr_debug("Openning slave %s failed\n", slave_dev->name);
 		goto err_unset_master;
 	}
 
@@ -1643,18 +1641,18 @@
 	if (!bond->params.miimon ||
 	    (bond_check_dev_link(bond, slave_dev, 0) == BMSR_LSTATUS)) {
 		if (bond->params.updelay) {
-			dprintk("Initial state of slave_dev is "
+			pr_debug("Initial state of slave_dev is "
 				"BOND_LINK_BACK\n");
 			new_slave->link  = BOND_LINK_BACK;
 			new_slave->delay = bond->params.updelay;
 		} else {
-			dprintk("Initial state of slave_dev is "
+			pr_debug("Initial state of slave_dev is "
 				"BOND_LINK_UP\n");
 			new_slave->link  = BOND_LINK_UP;
 		}
 		new_slave->jiffies = jiffies;
 	} else {
-		dprintk("Initial state of slave_dev is "
+		pr_debug("Initial state of slave_dev is "
 			"BOND_LINK_DOWN\n");
 		new_slave->link  = BOND_LINK_DOWN;
 	}
@@ -1715,7 +1713,7 @@
 		bond_set_slave_inactive_flags(new_slave);
 		break;
 	default:
-		dprintk("This slave is always active in trunk mode\n");
+		pr_debug("This slave is always active in trunk mode\n");
 
 		/* always active in trunk mode */
 		new_slave->state = BOND_STATE_ACTIVE;
@@ -2536,7 +2534,7 @@
 {
 	struct sk_buff *skb;
 
-	dprintk("arp %d on slave %s: dst %x src %x vid %d\n", arp_op,
+	pr_debug("arp %d on slave %s: dst %x src %x vid %d\n", arp_op,
 	       slave_dev->name, dest_ip, src_ip, vlan_id);
 	       
 	skb = arp_create(arp_op, ETH_P_ARP, dest_ip, slave_dev, src_ip,
@@ -2569,9 +2567,9 @@
 	for (i = 0; (i < BOND_MAX_ARP_TARGETS); i++) {
 		if (!targets[i])
 			continue;
-		dprintk("basa: target %x\n", targets[i]);
+		pr_debug("basa: target %x\n", targets[i]);
 		if (list_empty(&bond->vlan_list)) {
-			dprintk("basa: empty vlan: arp_send\n");
+			pr_debug("basa: empty vlan: arp_send\n");
 			bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
 				      bond->master_ip, 0);
 			continue;
@@ -2601,7 +2599,7 @@
 		 */
 		if (rt->u.dst.dev == bond->dev) {
 			ip_rt_put(rt);
-			dprintk("basa: rtdev == bond->dev: arp_send\n");
+			pr_debug("basa: rtdev == bond->dev: arp_send\n");
 			bond_arp_send(slave->dev, ARPOP_REQUEST, targets[i],
 				      bond->master_ip, 0);
 			continue;
@@ -2612,7 +2610,7 @@
 			vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
 			if (vlan_dev == rt->u.dst.dev) {
 				vlan_id = vlan->vlan_id;
-				dprintk("basa: vlan match on %s %d\n",
+				pr_debug("basa: vlan match on %s %d\n",
 				       vlan_dev->name, vlan_id);
 				break;
 			}
@@ -2647,7 +2645,7 @@
 	struct vlan_entry *vlan;
 	struct net_device *vlan_dev;
 
-	dprintk("bond_send_grat_arp: bond %s slave %s\n", bond->dev->name,
+	pr_debug("bond_send_grat_arp: bond %s slave %s\n", bond->dev->name,
 				slave ? slave->dev->name : "NULL");
 
 	if (!slave || !bond->send_grat_arp ||
@@ -2677,7 +2675,7 @@
 
 	targets = bond->params.arp_targets;
 	for (i = 0; (i < BOND_MAX_ARP_TARGETS) && targets[i]; i++) {
-		dprintk("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n",
+		pr_debug("bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n",
 			&sip, &tip, i, &targets[i], bond_has_this_ip(bond, tip));
 		if (sip == targets[i]) {
 			if (bond_has_this_ip(bond, tip))
@@ -2704,7 +2702,7 @@
 	bond = netdev_priv(dev);
 	read_lock(&bond->lock);
 
-	dprintk("bond_arp_rcv: bond %s skb->dev %s orig_dev %s\n",
+	pr_debug("bond_arp_rcv: bond %s skb->dev %s orig_dev %s\n",
 		bond->dev->name, skb->dev ? skb->dev->name : "NULL",
 		orig_dev ? orig_dev->name : "NULL");
 
@@ -2730,7 +2728,7 @@
 	arp_ptr += 4 + dev->addr_len;
 	memcpy(&tip, arp_ptr, 4);
 
-	dprintk("bond_arp_rcv: %s %s/%d av %d sv %d sip %pI4 tip %pI4\n",
+	pr_debug("bond_arp_rcv: %s %s/%d av %d sv %d sip %pI4 tip %pI4\n",
 		bond->dev->name, slave->dev->name, slave->state,
 		bond->params.arp_validate, slave_do_arp_validate(bond, slave),
 		&sip, &tip);
@@ -3595,7 +3593,7 @@
 	if (dev_net(event_dev) != &init_net)
 		return NOTIFY_DONE;
 
-	dprintk("event_dev: %s, event: %lx\n",
+	pr_debug("event_dev: %s, event: %lx\n",
 		(event_dev ? event_dev->name : "None"),
 		event);
 
@@ -3603,12 +3601,12 @@
 		return NOTIFY_DONE;
 
 	if (event_dev->flags & IFF_MASTER) {
-		dprintk("IFF_MASTER\n");
+		pr_debug("IFF_MASTER\n");
 		return bond_master_netdev_event(event, event_dev);
 	}
 
 	if (event_dev->flags & IFF_SLAVE) {
-		dprintk("IFF_SLAVE\n");
+		pr_debug("IFF_SLAVE\n");
 		return bond_slave_netdev_event(event, event_dev);
 	}
 
@@ -3937,7 +3935,7 @@
 	struct mii_ioctl_data *mii = NULL;
 	int res = 0;
 
-	dprintk("bond_ioctl: master=%s, cmd=%d\n",
+	pr_debug("bond_ioctl: master=%s, cmd=%d\n",
 		bond_dev->name, cmd);
 
 	switch (cmd) {
@@ -4015,12 +4013,12 @@
 	down_write(&(bonding_rwsem));
 	slave_dev = dev_get_by_name(&init_net, ifr->ifr_slave);
 
-	dprintk("slave_dev=%p: \n", slave_dev);
+	pr_debug("slave_dev=%p: \n", slave_dev);
 
 	if (!slave_dev) {
 		res = -ENODEV;
 	} else {
-		dprintk("slave_dev->name=%s: \n", slave_dev->name);
+		pr_debug("slave_dev->name=%s: \n", slave_dev->name);
 		switch (cmd) {
 		case BOND_ENSLAVE_OLD:
 		case SIOCBONDENSLAVE:
@@ -4131,7 +4129,7 @@
 	int res = 0;
 	int i;
 
-	dprintk("bond=%p, name=%s, new_mtu=%d\n", bond,
+	pr_debug("bond=%p, name=%s, new_mtu=%d\n", bond,
 		(bond_dev ? bond_dev->name : "None"), new_mtu);
 
 	/* Can't hold bond->lock with bh disabled here since
@@ -4150,7 +4148,7 @@
 	 */
 
 	bond_for_each_slave(bond, slave, i) {
-		dprintk("s %p s->p %p c_m %p\n", slave,
+		pr_debug("s %p s->p %p c_m %p\n", slave,
 			slave->prev, slave->dev->change_mtu);
 
 		res = dev_set_mtu(slave->dev, new_mtu);
@@ -4164,7 +4162,7 @@
 			 * means changing their mtu from timer context, which
 			 * is probably not a good idea.
 			 */
-			dprintk("err %d %s\n", res, slave->dev->name);
+			pr_debug("err %d %s\n", res, slave->dev->name);
 			goto unwind;
 		}
 	}
@@ -4181,7 +4179,7 @@
 
 		tmp_res = dev_set_mtu(slave->dev, bond_dev->mtu);
 		if (tmp_res) {
-			dprintk("unwind err %d dev %s\n", tmp_res,
+			pr_debug("unwind err %d dev %s\n", tmp_res,
 				slave->dev->name);
 		}
 	}
@@ -4208,7 +4206,7 @@
 		return bond_alb_set_mac_address(bond_dev, addr);
 
 
-	dprintk("bond=%p, name=%s\n", bond, (bond_dev ? bond_dev->name : "None"));
+	pr_debug("bond=%p, name=%s\n", bond, (bond_dev ? bond_dev->name : "None"));
 
 	/*
 	 * If fail_over_mac is set to active, do nothing and return
@@ -4238,11 +4236,11 @@
 
 	bond_for_each_slave(bond, slave, i) {
 		const struct net_device_ops *slave_ops = slave->dev->netdev_ops;
-		dprintk("slave %p %s\n", slave, slave->dev->name);
+		pr_debug("slave %p %s\n", slave, slave->dev->name);
 
 		if (slave_ops->ndo_set_mac_address == NULL) {
 			res = -EOPNOTSUPP;
-			dprintk("EOPNOTSUPP %s\n", slave->dev->name);
+			pr_debug("EOPNOTSUPP %s\n", slave->dev->name);
 			goto unwind;
 		}
 
@@ -4254,7 +4252,7 @@
 			 * breakage anyway until ARP finish
 			 * updating, so...
 			 */
-			dprintk("err %d %s\n", res, slave->dev->name);
+			pr_debug("err %d %s\n", res, slave->dev->name);
 			goto unwind;
 		}
 	}
@@ -4274,7 +4272,7 @@
 
 		tmp_res = dev_set_mac_address(slave->dev, &tmp_sa);
 		if (tmp_res) {
-			dprintk("unwind err %d dev %s\n", tmp_res,
+			pr_debug("unwind err %d dev %s\n", tmp_res,
 				slave->dev->name);
 		}
 	}
@@ -4593,7 +4591,7 @@
 {
 	struct bonding *bond = netdev_priv(bond_dev);
 
-	dprintk("Begin bond_init for %s\n", bond_dev->name);
+	pr_debug("Begin bond_init for %s\n", bond_dev->name);
 
 	/* initialize rwlocks */
 	rwlock_init(&bond->lock);
Index: bonding-2.6/drivers/net/bonding/bond_sysfs.c
===================================================================
--- bonding-2.6.orig/drivers/net/bonding/bond_sysfs.c	2008-12-08 22:42:32.000000000 +0100
+++ bonding-2.6/drivers/net/bonding/bond_sysfs.c	2008-12-08 23:02:38.000000000 +0100
@@ -36,8 +36,8 @@
 #include <linux/rtnetlink.h>
 #include <net/net_namespace.h>
 
-/* #define BONDING_DEBUG 1 */
 #include "bonding.h"
+
 #define to_dev(obj)	container_of(obj,struct device,kobj)
 #define to_bond(cd)	((struct bonding *)(netdev_priv(to_net_dev(cd))))
 

-- 

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

* [patch 5/7] bonding: remove duplicate declarations
  2008-12-09 20:07 [patch 0/7] [RFC] bonding updates to net-next-2.6 holger
                   ` (3 preceding siblings ...)
  2008-12-09 20:07 ` [patch 4/7] bonding: use pr_debug instead of own macros holger
@ 2008-12-09 20:07 ` holger
  2008-12-10  7:09   ` David Miller
  2008-12-09 20:07 ` [patch 6/7] bonding: make tbl argument to bond_parse_parm() const holger
  2008-12-09 20:07 ` [patch 7/7] bonding: turn all bond_parm_tbls const holger
  6 siblings, 1 reply; 15+ messages in thread
From: holger @ 2008-12-09 20:07 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev

[-- Attachment #1: bonding-remove-duplicate-declarations.diff --]
[-- Type: text/plain, Size: 1039 bytes --]

Remove some declarations from bonding.c as they are declared in bonding.h
already.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Index: bonding-2.6/drivers/net/bonding/bond_sysfs.c
===================================================================
--- bonding-2.6.orig/drivers/net/bonding/bond_sysfs.c	2008-12-05 23:21:10.000000000 +0100
+++ bonding-2.6/drivers/net/bonding/bond_sysfs.c	2008-12-05 23:23:12.000000000 +0100
@@ -43,15 +43,8 @@
 
 /*---------------------------- Declarations -------------------------------*/
 
-
-extern struct list_head bond_dev_list;
 extern struct bond_params bonding_defaults;
-extern struct bond_parm_tbl bond_mode_tbl[];
-extern struct bond_parm_tbl bond_lacp_tbl[];
 extern struct bond_parm_tbl ad_select_tbl[];
-extern struct bond_parm_tbl xmit_hashtype_tbl[];
-extern struct bond_parm_tbl arp_validate_tbl[];
-extern struct bond_parm_tbl fail_over_mac_tbl[];
 
 static int expected_refcount = -1;
 /*--------------------------- Data Structures -----------------------------*/

-- 

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

* [patch 6/7] bonding: make tbl argument to bond_parse_parm() const
  2008-12-09 20:07 [patch 0/7] [RFC] bonding updates to net-next-2.6 holger
                   ` (4 preceding siblings ...)
  2008-12-09 20:07 ` [patch 5/7] bonding: remove duplicate declarations holger
@ 2008-12-09 20:07 ` holger
  2008-12-10  7:10   ` David Miller
  2008-12-09 20:07 ` [patch 7/7] bonding: turn all bond_parm_tbls const holger
  6 siblings, 1 reply; 15+ messages in thread
From: holger @ 2008-12-09 20:07 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev

[-- Attachment #1: bonding-make-arg-const.diff --]
[-- Type: text/plain, Size: 1770 bytes --]

bond_parse_parm() parses a parameter table for a particular value and
is therefore not modifying the table at all.  Therefore make the 2nd
argument const, thus allowing to make the tables const later.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Index: bonding-2.6-out/drivers/net/bonding/bond_main.c
===================================================================
--- bonding-2.6-out.orig/drivers/net/bonding/bond_main.c	2008-12-08 22:52:57.000000000 +0100
+++ bonding-2.6-out/drivers/net/bonding/bond_main.c	2008-12-08 22:53:12.000000000 +0100
@@ -4723,7 +4723,7 @@
  * some mode names are substrings of other names, and calls from sysfs
  * may have whitespace in the name (trailing newlines, for example).
  */
-int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl)
+int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl)
 {
 	int mode = -1, i, rv;
 	char *p, modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, };
Index: bonding-2.6-out/drivers/net/bonding/bonding.h
===================================================================
--- bonding-2.6-out.orig/drivers/net/bonding/bonding.h	2008-12-08 22:52:57.000000000 +0100
+++ bonding-2.6-out/drivers/net/bonding/bonding.h	2008-12-08 22:53:12.000000000 +0100
@@ -337,7 +337,7 @@
 void bond_loadbalance_arp_mon(struct work_struct *);
 void bond_activebackup_arp_mon(struct work_struct *);
 void bond_set_mode_ops(struct bonding *bond, int mode);
-int bond_parse_parm(const char *mode_arg, struct bond_parm_tbl *tbl);
+int bond_parse_parm(const char *mode_arg, const struct bond_parm_tbl *tbl);
 void bond_select_active_slave(struct bonding *bond);
 void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
 void bond_register_arp(struct bonding *);

-- 

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

* [patch 7/7] bonding: turn all bond_parm_tbls const
  2008-12-09 20:07 [patch 0/7] [RFC] bonding updates to net-next-2.6 holger
                   ` (5 preceding siblings ...)
  2008-12-09 20:07 ` [patch 6/7] bonding: make tbl argument to bond_parse_parm() const holger
@ 2008-12-09 20:07 ` holger
  2008-12-10  7:10   ` David Miller
  6 siblings, 1 reply; 15+ messages in thread
From: holger @ 2008-12-09 20:07 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: netdev

[-- Attachment #1: bonding-make-bond_parm_tbls-const.diff --]
[-- Type: text/plain, Size: 2591 bytes --]

Turn all bond_parm_tbls const.

Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Index: bonding-2.6-out/drivers/net/bonding/bond_main.c
===================================================================
--- bonding-2.6-out.orig/drivers/net/bonding/bond_main.c	2008-12-09 20:56:11.000000000 +0100
+++ bonding-2.6-out/drivers/net/bonding/bond_main.c	2008-12-09 20:57:14.000000000 +0100
@@ -162,13 +162,13 @@
 static int lacp_fast	= 0;
 
 
-struct bond_parm_tbl bond_lacp_tbl[] = {
+const struct bond_parm_tbl bond_lacp_tbl[] = {
 {	"slow",		AD_LACP_SLOW},
 {	"fast",		AD_LACP_FAST},
 {	NULL,		-1},
 };
 
-struct bond_parm_tbl bond_mode_tbl[] = {
+const struct bond_parm_tbl bond_mode_tbl[] = {
 {	"balance-rr",		BOND_MODE_ROUNDROBIN},
 {	"active-backup",	BOND_MODE_ACTIVEBACKUP},
 {	"balance-xor",		BOND_MODE_XOR},
@@ -179,14 +179,14 @@
 {	NULL,			-1},
 };
 
-struct bond_parm_tbl xmit_hashtype_tbl[] = {
+const struct bond_parm_tbl xmit_hashtype_tbl[] = {
 {	"layer2",		BOND_XMIT_POLICY_LAYER2},
 {	"layer3+4",		BOND_XMIT_POLICY_LAYER34},
 {	"layer2+3",		BOND_XMIT_POLICY_LAYER23},
 {	NULL,			-1},
 };
 
-struct bond_parm_tbl arp_validate_tbl[] = {
+const struct bond_parm_tbl arp_validate_tbl[] = {
 {	"none",			BOND_ARP_VALIDATE_NONE},
 {	"active",		BOND_ARP_VALIDATE_ACTIVE},
 {	"backup",		BOND_ARP_VALIDATE_BACKUP},
@@ -194,7 +194,7 @@
 {	NULL,			-1},
 };
 
-struct bond_parm_tbl fail_over_mac_tbl[] = {
+const struct bond_parm_tbl fail_over_mac_tbl[] = {
 {	"none",			BOND_FOM_NONE},
 {	"active",		BOND_FOM_ACTIVE},
 {	"follow",		BOND_FOM_FOLLOW},
Index: bonding-2.6-out/drivers/net/bonding/bonding.h
===================================================================
--- bonding-2.6-out.orig/drivers/net/bonding/bonding.h	2008-12-09 20:56:11.000000000 +0100
+++ bonding-2.6-out/drivers/net/bonding/bonding.h	2008-12-09 20:57:14.000000000 +0100
@@ -345,11 +345,11 @@
 
 /* exported from bond_main.c */
 extern struct list_head bond_dev_list;
-extern struct bond_parm_tbl bond_lacp_tbl[];
-extern struct bond_parm_tbl bond_mode_tbl[];
-extern struct bond_parm_tbl xmit_hashtype_tbl[];
-extern struct bond_parm_tbl arp_validate_tbl[];
-extern struct bond_parm_tbl fail_over_mac_tbl[];
+extern const struct bond_parm_tbl bond_lacp_tbl[];
+extern const struct bond_parm_tbl bond_mode_tbl[];
+extern const struct bond_parm_tbl xmit_hashtype_tbl[];
+extern const struct bond_parm_tbl arp_validate_tbl[];
+extern const struct bond_parm_tbl fail_over_mac_tbl[];
 
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 void bond_send_unsolicited_na(struct bonding *bond);

-- 

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

* Re: [patch 1/7] bonding: add and use bond_is_lb()
  2008-12-09 20:07 ` [patch 1/7] bonding: add and use bond_is_lb() holger
@ 2008-12-10  7:07   ` David Miller
  0 siblings, 0 replies; 15+ messages in thread
From: David Miller @ 2008-12-10  7:07 UTC (permalink / raw)
  To: holger; +Cc: fubar, netdev

From: holger@eitzenberger.org
Date: Tue, 09 Dec 2008 21:07:51 +0100

> Introduce and use bond_is_lb(), it is usefull to shorten the repetitive
> check for either ALB or TLB mode.
> 
> Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Applied.

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

* Re: [patch 2/7] bonding: use table for mode names
  2008-12-09 20:07 ` [patch 2/7] bonding: use table for mode names holger
@ 2008-12-10  7:08   ` David Miller
  0 siblings, 0 replies; 15+ messages in thread
From: David Miller @ 2008-12-10  7:08 UTC (permalink / raw)
  To: holger; +Cc: fubar, netdev

From: holger@eitzenberger.org
Date: Tue, 09 Dec 2008 21:07:52 +0100

> Use a small array in bond_mode_name() for the names, thus saving some
> space:
> 
> before
> 
>     text     data      bss      dec    hex filename
>    57736     9372      344    67452  1077c drivers/net/bonding/bonding.ko
> 
> after
>     text     data      bss      dec    hex filename
>    57441     9372      344    67157  10655 drivers/net/bonding/bonding.ko
> 
> Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Applied.

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

* Re: [patch 3/7] bonding: fix compile error if debug enabled
  2008-12-09 20:07 ` [patch 3/7] bonding: fix compile error if debug enabled holger
@ 2008-12-10  7:09   ` David Miller
  0 siblings, 0 replies; 15+ messages in thread
From: David Miller @ 2008-12-10  7:09 UTC (permalink / raw)
  To: holger; +Cc: fubar, netdev

From: holger@eitzenberger.org
Date: Tue, 09 Dec 2008 21:07:53 +0100

> This is what I get if debug is enabled:
> 
> drivers/net/bonding/bond_ipv6.c: In function 'bond_na_send':
> drivers/net/bonding/bond_ipv6.c:75: error: 'slave' undeclared (first use in this function)
> drivers/net/bonding/bond_ipv6.c:75: error: (Each undeclared identifier is reported only once
> drivers/net/bonding/bond_ipv6.c:75: error: for each function it appears in.)
> 
> This patch fixes that.
> 
> Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Applied.

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

* Re: [patch 4/7] bonding: use pr_debug instead of own macros
  2008-12-09 20:07 ` [patch 4/7] bonding: use pr_debug instead of own macros holger
@ 2008-12-10  7:09   ` David Miller
  0 siblings, 0 replies; 15+ messages in thread
From: David Miller @ 2008-12-10  7:09 UTC (permalink / raw)
  To: holger; +Cc: fubar, netdev

From: holger@eitzenberger.org
Date: Tue, 09 Dec 2008 21:07:54 +0100

> Use pr_debug() instead of own macros.
> 
> Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Applied.

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

* Re: [patch 5/7] bonding: remove duplicate declarations
  2008-12-09 20:07 ` [patch 5/7] bonding: remove duplicate declarations holger
@ 2008-12-10  7:09   ` David Miller
  0 siblings, 0 replies; 15+ messages in thread
From: David Miller @ 2008-12-10  7:09 UTC (permalink / raw)
  To: holger; +Cc: fubar, netdev

From: holger@eitzenberger.org
Date: Tue, 09 Dec 2008 21:07:55 +0100

> Remove some declarations from bonding.c as they are declared in bonding.h
> already.
> 
> Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Applied.

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

* Re: [patch 6/7] bonding: make tbl argument to bond_parse_parm() const
  2008-12-09 20:07 ` [patch 6/7] bonding: make tbl argument to bond_parse_parm() const holger
@ 2008-12-10  7:10   ` David Miller
  0 siblings, 0 replies; 15+ messages in thread
From: David Miller @ 2008-12-10  7:10 UTC (permalink / raw)
  To: holger; +Cc: fubar, netdev

From: holger@eitzenberger.org
Date: Tue, 09 Dec 2008 21:07:56 +0100

> bond_parse_parm() parses a parameter table for a particular value and
> is therefore not modifying the table at all.  Therefore make the 2nd
> argument const, thus allowing to make the tables const later.
> 
> Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Applied.

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

* Re: [patch 7/7] bonding: turn all bond_parm_tbls const
  2008-12-09 20:07 ` [patch 7/7] bonding: turn all bond_parm_tbls const holger
@ 2008-12-10  7:10   ` David Miller
  0 siblings, 0 replies; 15+ messages in thread
From: David Miller @ 2008-12-10  7:10 UTC (permalink / raw)
  To: holger; +Cc: fubar, netdev

From: holger@eitzenberger.org
Date: Tue, 09 Dec 2008 21:07:57 +0100

> Turn all bond_parm_tbls const.
> 
> Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>

Also applied, thanks a lot Holger!

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

end of thread, other threads:[~2008-12-10  7:10 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 20:07 [patch 0/7] [RFC] bonding updates to net-next-2.6 holger
2008-12-09 20:07 ` [patch 1/7] bonding: add and use bond_is_lb() holger
2008-12-10  7:07   ` David Miller
2008-12-09 20:07 ` [patch 2/7] bonding: use table for mode names holger
2008-12-10  7:08   ` David Miller
2008-12-09 20:07 ` [patch 3/7] bonding: fix compile error if debug enabled holger
2008-12-10  7:09   ` David Miller
2008-12-09 20:07 ` [patch 4/7] bonding: use pr_debug instead of own macros holger
2008-12-10  7:09   ` David Miller
2008-12-09 20:07 ` [patch 5/7] bonding: remove duplicate declarations holger
2008-12-10  7:09   ` David Miller
2008-12-09 20:07 ` [patch 6/7] bonding: make tbl argument to bond_parse_parm() const holger
2008-12-10  7:10   ` David Miller
2008-12-09 20:07 ` [patch 7/7] bonding: turn all bond_parm_tbls const holger
2008-12-10  7:10   ` David Miller

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