Commit 7987c426 authored by Shmulik Hen's avatar Shmulik Hen Committed by Jeff Garzik

[PATCH] bonding cleanup 2.6 - Consolidate prints

Convert all debug prints to use the dprintk macro and consolidate
format of all prints (e.g. "bonding: Error: ...").
parent f307b1c9
...@@ -49,6 +49,8 @@ ...@@ -49,6 +49,8 @@
* by the slave. * by the slave.
*/ */
//#define BONDING_DEBUG 1
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
...@@ -392,7 +394,7 @@ static u16 __get_link_speed(struct port *port) ...@@ -392,7 +394,7 @@ static u16 __get_link_speed(struct port *port)
} }
} }
BOND_PRINT_DBG(("Port %d Received link speed %d update from adapter", port->actor_port_number, speed)); dprintk("Port %d Received link speed %d update from adapter\n", port->actor_port_number, speed);
return speed; return speed;
} }
...@@ -418,12 +420,12 @@ static u8 __get_duplex(struct port *port) ...@@ -418,12 +420,12 @@ static u8 __get_duplex(struct port *port)
switch (slave->duplex) { switch (slave->duplex) {
case DUPLEX_FULL: case DUPLEX_FULL:
retval=0x1; retval=0x1;
BOND_PRINT_DBG(("Port %d Received status full duplex update from adapter", port->actor_port_number)); dprintk("Port %d Received status full duplex update from adapter\n", port->actor_port_number);
break; break;
case DUPLEX_HALF: case DUPLEX_HALF:
default: default:
retval=0x0; retval=0x0;
BOND_PRINT_DBG(("Port %d Received status NOT full duplex update from adapter", port->actor_port_number)); dprintk("Port %d Received status NOT full duplex update from adapter\n", port->actor_port_number);
break; break;
} }
} }
...@@ -1059,7 +1061,7 @@ static void ad_mux_machine(struct port *port) ...@@ -1059,7 +1061,7 @@ static void ad_mux_machine(struct port *port)
// check if the state machine was changed // check if the state machine was changed
if (port->sm_mux_state != last_state) { if (port->sm_mux_state != last_state) {
BOND_PRINT_DBG(("Mux Machine: Port=%d, Last State=%d, Curr State=%d", port->actor_port_number, last_state, port->sm_mux_state)); dprintk("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) { switch (port->sm_mux_state) {
case AD_MUX_DETACHED: case AD_MUX_DETACHED:
__detach_bond_from_agg(port); __detach_bond_from_agg(port);
...@@ -1158,7 +1160,7 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) ...@@ -1158,7 +1160,7 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
// check if the State machine was changed or new lacpdu arrived // check if the State machine was changed or new lacpdu arrived
if ((port->sm_rx_state != last_state) || (lacpdu)) { if ((port->sm_rx_state != last_state) || (lacpdu)) {
BOND_PRINT_DBG(("Rx Machine: Port=%d, Last State=%d, Curr State=%d", port->actor_port_number, last_state, port->sm_rx_state)); dprintk("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) { switch (port->sm_rx_state) {
case AD_RX_INITIALIZE: case AD_RX_INITIALIZE:
if (!(port->actor_oper_port_key & AD_DUPLEX_KEY_BITS)) { if (!(port->actor_oper_port_key & AD_DUPLEX_KEY_BITS)) {
...@@ -1204,7 +1206,7 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) ...@@ -1204,7 +1206,7 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port)
// detect loopback situation // detect loopback situation
if (!MAC_ADDRESS_COMPARE(&(lacpdu->actor_system), &(port->actor_system))) { if (!MAC_ADDRESS_COMPARE(&(lacpdu->actor_system), &(port->actor_system))) {
// INFO_RECEIVED_LOOPBACK_FRAMES // INFO_RECEIVED_LOOPBACK_FRAMES
printk(KERN_ERR "bonding: An illegal loopback occurred on adapter (%s)\n", printk(KERN_ERR DRV_NAME ": An illegal loopback occurred on adapter (%s)\n",
port->slave->dev->name); port->slave->dev->name);
printk(KERN_ERR "Check the configuration to verify that all Adapters " printk(KERN_ERR "Check the configuration to verify that all Adapters "
"are connected to 802.3ad compliant switch ports\n"); "are connected to 802.3ad compliant switch ports\n");
...@@ -1245,7 +1247,7 @@ static void ad_tx_machine(struct port *port) ...@@ -1245,7 +1247,7 @@ static void ad_tx_machine(struct port *port)
__update_lacpdu_from_port(port); __update_lacpdu_from_port(port);
// send the lacpdu // send the lacpdu
if (ad_lacpdu_send(port) >= 0) { if (ad_lacpdu_send(port) >= 0) {
BOND_PRINT_DBG(("Sent LACPDU on port %d", port->actor_port_number)); dprintk("Sent LACPDU on port %d\n", port->actor_port_number);
// mark ntt as false, so it will not be sent again until demanded // mark ntt as false, so it will not be sent again until demanded
port->ntt = 0; port->ntt = 0;
} }
...@@ -1318,7 +1320,7 @@ static void ad_periodic_machine(struct port *port) ...@@ -1318,7 +1320,7 @@ static void ad_periodic_machine(struct port *port)
// check if the state machine was changed // check if the state machine was changed
if (port->sm_periodic_state != last_state) { if (port->sm_periodic_state != last_state) {
BOND_PRINT_DBG(("Periodic Machine: Port=%d, Last State=%d, Curr State=%d", port->actor_port_number, last_state, port->sm_periodic_state)); dprintk("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) { switch (port->sm_periodic_state) {
case AD_NO_PERIODIC: case AD_NO_PERIODIC:
port->sm_periodic_timer_counter = 0; // zero timer port->sm_periodic_timer_counter = 0; // zero timer
...@@ -1375,7 +1377,7 @@ static void ad_port_selection_logic(struct port *port) ...@@ -1375,7 +1377,7 @@ static void ad_port_selection_logic(struct port *port)
port->next_port_in_aggregator=NULL; port->next_port_in_aggregator=NULL;
port->actor_port_aggregator_identifier=0; port->actor_port_aggregator_identifier=0;
BOND_PRINT_DBG(("Port %d left LAG %d", port->actor_port_number, temp_aggregator->aggregator_identifier)); dprintk("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 the aggregator is empty, clear its parameters, and set it ready to be attached
if (!temp_aggregator->lag_ports) { if (!temp_aggregator->lag_ports) {
ad_clear_agg(temp_aggregator); ad_clear_agg(temp_aggregator);
...@@ -1384,7 +1386,7 @@ static void ad_port_selection_logic(struct port *port) ...@@ -1384,7 +1386,7 @@ static void ad_port_selection_logic(struct port *port)
} }
} }
if (!curr_port) { // meaning: the port was related to an aggregator but was not on the aggregator port list if (!curr_port) { // meaning: the port was related to an aggregator but was not on the aggregator port list
printk(KERN_WARNING "bonding: Warning: Port %d (on %s) was " printk(KERN_WARNING DRV_NAME ": Warning: Port %d (on %s) was "
"related to aggregator %d but was not on its port list\n", "related to aggregator %d but was not on its port list\n",
port->actor_port_number, port->slave->dev->name, port->actor_port_number, port->slave->dev->name,
port->aggregator->aggregator_identifier); port->aggregator->aggregator_identifier);
...@@ -1417,7 +1419,7 @@ static void ad_port_selection_logic(struct port *port) ...@@ -1417,7 +1419,7 @@ static void ad_port_selection_logic(struct port *port)
port->next_port_in_aggregator=aggregator->lag_ports; port->next_port_in_aggregator=aggregator->lag_ports;
port->aggregator->num_of_ports++; port->aggregator->num_of_ports++;
aggregator->lag_ports=port; aggregator->lag_ports=port;
BOND_PRINT_DBG(("Port %d joined LAG %d(existing LAG)", port->actor_port_number, port->aggregator->aggregator_identifier)); dprintk("Port %d joined LAG %d(existing LAG)\n", port->actor_port_number, port->aggregator->aggregator_identifier);
// mark this port as selected // mark this port as selected
port->sm_vars |= AD_PORT_SELECTED; port->sm_vars |= AD_PORT_SELECTED;
...@@ -1454,9 +1456,9 @@ static void ad_port_selection_logic(struct port *port) ...@@ -1454,9 +1456,9 @@ static void ad_port_selection_logic(struct port *port)
// mark this port as selected // mark this port as selected
port->sm_vars |= AD_PORT_SELECTED; port->sm_vars |= AD_PORT_SELECTED;
BOND_PRINT_DBG(("Port %d joined LAG %d(new LAG)", port->actor_port_number, port->aggregator->aggregator_identifier)); dprintk("Port %d joined LAG %d(new LAG)\n", port->actor_port_number, port->aggregator->aggregator_identifier);
} else { } else {
printk(KERN_ERR "bonding: Port %d (on %s) did not find a suitable aggregator\n", printk(KERN_ERR DRV_NAME ": Port %d (on %s) did not find a suitable aggregator\n",
port->actor_port_number, port->slave->dev->name); port->actor_port_number, port->slave->dev->name);
} }
} }
...@@ -1580,30 +1582,30 @@ static void ad_agg_selection_logic(struct aggregator *aggregator) ...@@ -1580,30 +1582,30 @@ static void ad_agg_selection_logic(struct aggregator *aggregator)
aggregator; aggregator;
aggregator = __get_next_agg(aggregator)) { aggregator = __get_next_agg(aggregator)) {
BOND_PRINT_DBG(("Agg=%d; Ports=%d; a key=%d; p key=%d; Indiv=%d; Active=%d", dprintk("Agg=%d; Ports=%d; a key=%d; p key=%d; Indiv=%d; Active=%d\n",
aggregator->aggregator_identifier, aggregator->num_of_ports, aggregator->aggregator_identifier, aggregator->num_of_ports,
aggregator->actor_oper_aggregator_key, aggregator->partner_oper_aggregator_key, aggregator->actor_oper_aggregator_key, aggregator->partner_oper_aggregator_key,
aggregator->is_individual, aggregator->is_active)); aggregator->is_individual, aggregator->is_active);
} }
// check if any partner replys // check if any partner replys
if (best_aggregator->is_individual) { if (best_aggregator->is_individual) {
printk(KERN_WARNING "bonding: Warning: No 802.3ad response from the link partner " printk(KERN_WARNING DRV_NAME ": Warning: No 802.3ad response from the link partner "
"for any adapters in the bond\n"); "for any adapters in the bond\n");
} }
// check if there are more than one aggregator // check if there are more than one aggregator
if (num_of_aggs > 1) { if (num_of_aggs > 1) {
BOND_PRINT_DBG(("Warning: More than one Link Aggregation Group was " dprintk("Warning: More than one Link Aggregation Group was "
"found in the bond. Only one group will function in the bond")); "found in the bond. Only one group will function in the bond\n");
} }
best_aggregator->is_active = 1; best_aggregator->is_active = 1;
BOND_PRINT_DBG(("LAG %d choosed as the active LAG", best_aggregator->aggregator_identifier)); dprintk("LAG %d choosed as the active LAG\n", best_aggregator->aggregator_identifier);
BOND_PRINT_DBG(("Agg=%d; Ports=%d; a key=%d; p key=%d; Indiv=%d; Active=%d", dprintk("Agg=%d; Ports=%d; a key=%d; p key=%d; Indiv=%d; Active=%d\n",
best_aggregator->aggregator_identifier, best_aggregator->num_of_ports, best_aggregator->aggregator_identifier, best_aggregator->num_of_ports,
best_aggregator->actor_oper_aggregator_key, best_aggregator->partner_oper_aggregator_key, best_aggregator->actor_oper_aggregator_key, best_aggregator->partner_oper_aggregator_key,
best_aggregator->is_individual, best_aggregator->is_active)); best_aggregator->is_individual, best_aggregator->is_active);
// disable the ports that were related to the former active_aggregator // disable the ports that were related to the former active_aggregator
if (last_active_aggregator) { if (last_active_aggregator) {
...@@ -1644,7 +1646,7 @@ static void ad_clear_agg(struct aggregator *aggregator) ...@@ -1644,7 +1646,7 @@ static void ad_clear_agg(struct aggregator *aggregator)
aggregator->lag_ports = NULL; aggregator->lag_ports = NULL;
aggregator->is_active = 0; aggregator->is_active = 0;
aggregator->num_of_ports = 0; aggregator->num_of_ports = 0;
BOND_PRINT_DBG(("LAG %d was cleared", aggregator->aggregator_identifier)); dprintk("LAG %d was cleared\n", aggregator->aggregator_identifier);
} }
} }
...@@ -1729,7 +1731,7 @@ static void ad_initialize_port(struct port *port, int lacp_fast) ...@@ -1729,7 +1731,7 @@ static void ad_initialize_port(struct port *port, int lacp_fast)
static void ad_enable_collecting_distributing(struct port *port) static void ad_enable_collecting_distributing(struct port *port)
{ {
if (port->aggregator->is_active) { if (port->aggregator->is_active) {
BOND_PRINT_DBG(("Enabling port %d(LAG %d)", port->actor_port_number, port->aggregator->aggregator_identifier)); dprintk("Enabling port %d(LAG %d)\n", port->actor_port_number, port->aggregator->aggregator_identifier);
__enable_port(port); __enable_port(port);
} }
} }
...@@ -1742,7 +1744,7 @@ static void ad_enable_collecting_distributing(struct port *port) ...@@ -1742,7 +1744,7 @@ static void ad_enable_collecting_distributing(struct port *port)
static void ad_disable_collecting_distributing(struct port *port) static void ad_disable_collecting_distributing(struct port *port)
{ {
if (port->aggregator && MAC_ADDRESS_COMPARE(&(port->aggregator->partner_system), &(null_mac_addr))) { if (port->aggregator && MAC_ADDRESS_COMPARE(&(port->aggregator->partner_system), &(null_mac_addr))) {
BOND_PRINT_DBG(("Disabling port %d(LAG %d)", port->actor_port_number, port->aggregator->aggregator_identifier)); dprintk("Disabling port %d(LAG %d)\n", port->actor_port_number, port->aggregator->aggregator_identifier);
__disable_port(port); __disable_port(port);
} }
} }
...@@ -1780,7 +1782,7 @@ static void ad_marker_info_send(struct port *port) ...@@ -1780,7 +1782,7 @@ static void ad_marker_info_send(struct port *port)
// send the marker information // send the marker information
if (ad_marker_send(port, &marker) >= 0) { if (ad_marker_send(port, &marker) >= 0) {
BOND_PRINT_DBG(("Sent Marker Information on port %d", port->actor_port_number)); dprintk("Sent Marker Information on port %d\n", port->actor_port_number);
} }
} }
#endif #endif
...@@ -1803,7 +1805,7 @@ static void ad_marker_info_received(struct marker *marker_info,struct port *port ...@@ -1803,7 +1805,7 @@ static void ad_marker_info_received(struct marker *marker_info,struct port *port
// send the marker response // send the marker response
if (ad_marker_send(port, &marker) >= 0) { if (ad_marker_send(port, &marker) >= 0) {
BOND_PRINT_DBG(("Sent Marker Response on port %d", port->actor_port_number)); dprintk("Sent Marker Response on port %d\n", port->actor_port_number);
} }
} }
...@@ -1921,7 +1923,7 @@ int bond_3ad_bind_slave(struct slave *slave) ...@@ -1921,7 +1923,7 @@ int bond_3ad_bind_slave(struct slave *slave)
struct aggregator *aggregator; struct aggregator *aggregator;
if (bond == NULL) { if (bond == NULL) {
printk(KERN_CRIT "The slave %s is not attached to its bond\n", slave->dev->name); printk(KERN_ERR "The slave %s is not attached to its bond\n", slave->dev->name);
return -1; return -1;
} }
...@@ -1996,11 +1998,11 @@ void bond_3ad_unbind_slave(struct slave *slave) ...@@ -1996,11 +1998,11 @@ void bond_3ad_unbind_slave(struct slave *slave)
// if slave is null, the whole port is not initialized // if slave is null, the whole port is not initialized
if (!port->slave) { if (!port->slave) {
printk(KERN_WARNING "bonding: Trying to unbind an uninitialized port on %s\n", slave->dev->name); printk(KERN_WARNING DRV_NAME ": Trying to unbind an uninitialized port on %s\n", slave->dev->name);
return; return;
} }
BOND_PRINT_DBG(("Unbinding Link Aggregation Group %d", aggregator->aggregator_identifier)); dprintk("Unbinding Link Aggregation Group %d\n", aggregator->aggregator_identifier);
/* Tell the partner that this port is not suitable for aggregation */ /* Tell the partner that this port is not suitable for aggregation */
port->actor_oper_port_state &= ~AD_STATE_AGGREGATION; port->actor_oper_port_state &= ~AD_STATE_AGGREGATION;
...@@ -2024,10 +2026,10 @@ void bond_3ad_unbind_slave(struct slave *slave) ...@@ -2024,10 +2026,10 @@ void bond_3ad_unbind_slave(struct slave *slave)
// if new aggregator found, copy the aggregator's parameters // if new aggregator found, copy the aggregator's parameters
// and connect the related lag_ports to the new aggregator // 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))) { if ((new_aggregator) && ((!new_aggregator->lag_ports) || ((new_aggregator->lag_ports == port) && !new_aggregator->lag_ports->next_port_in_aggregator))) {
BOND_PRINT_DBG(("Some port(s) related to LAG %d - replaceing with LAG %d", aggregator->aggregator_identifier, new_aggregator->aggregator_identifier)); dprintk("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) { if ((new_aggregator->lag_ports == port) && new_aggregator->is_active) {
printk(KERN_INFO "bonding: Removing an active aggregator\n"); printk(KERN_INFO DRV_NAME ": Removing an active aggregator\n");
// select new active aggregator // select new active aggregator
select_new_active_agg = 1; select_new_active_agg = 1;
} }
...@@ -2057,7 +2059,7 @@ void bond_3ad_unbind_slave(struct slave *slave) ...@@ -2057,7 +2059,7 @@ void bond_3ad_unbind_slave(struct slave *slave)
ad_agg_selection_logic(__get_first_agg(port)); ad_agg_selection_logic(__get_first_agg(port));
} }
} else { } else {
printk(KERN_WARNING "bonding: Warning: unbinding aggregator, " printk(KERN_WARNING DRV_NAME ": Warning: unbinding aggregator, "
"and could not find a new aggregator for its ports\n"); "and could not find a new aggregator for its ports\n");
} }
} else { // in case that the only port related to this aggregator is the one we want to remove } else { // in case that the only port related to this aggregator is the one we want to remove
...@@ -2072,7 +2074,7 @@ void bond_3ad_unbind_slave(struct slave *slave) ...@@ -2072,7 +2074,7 @@ void bond_3ad_unbind_slave(struct slave *slave)
} }
} }
BOND_PRINT_DBG(("Unbinding port %d", port->actor_port_number)); dprintk("Unbinding port %d\n", port->actor_port_number);
// find the aggregator that this port is connected to // find the aggregator that this port is connected to
temp_aggregator = __get_first_agg(port); temp_aggregator = __get_first_agg(port);
for (; temp_aggregator; temp_aggregator = __get_next_agg(temp_aggregator)) { for (; temp_aggregator; temp_aggregator = __get_next_agg(temp_aggregator)) {
...@@ -2137,7 +2139,7 @@ void bond_3ad_state_machine_handler(struct bonding *bond) ...@@ -2137,7 +2139,7 @@ void bond_3ad_state_machine_handler(struct bonding *bond)
// select the active aggregator for the bond // select the active aggregator for the bond
if ((port = __get_first_port(bond))) { if ((port = __get_first_port(bond))) {
if (!port->slave) { if (!port->slave) {
printk(KERN_WARNING "bonding: Warning: bond's first port is uninitialized\n"); printk(KERN_WARNING DRV_NAME ": Warning: bond's first port is uninitialized\n");
goto end; goto end;
} }
...@@ -2149,7 +2151,7 @@ void bond_3ad_state_machine_handler(struct bonding *bond) ...@@ -2149,7 +2151,7 @@ void bond_3ad_state_machine_handler(struct bonding *bond)
// for each port run the state machines // for each port run the state machines
for (port = __get_first_port(bond); port; port = __get_next_port(port)) { for (port = __get_first_port(bond); port; port = __get_next_port(port)) {
if (!port->slave) { if (!port->slave) {
printk(KERN_WARNING "bonding: Warning: Found an uninitialized port\n"); printk(KERN_WARNING DRV_NAME ": Warning: Found an uninitialized port\n");
goto end; goto end;
} }
...@@ -2194,14 +2196,14 @@ void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u16 leng ...@@ -2194,14 +2196,14 @@ void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u16 leng
port = &(SLAVE_AD_INFO(slave).port); port = &(SLAVE_AD_INFO(slave).port);
if (!port->slave) { if (!port->slave) {
printk(KERN_WARNING "bonding: Warning: port of slave %s is uninitialized\n", slave->dev->name); printk(KERN_WARNING DRV_NAME ": Warning: port of slave %s is uninitialized\n", slave->dev->name);
return; return;
} }
switch (lacpdu->subtype) { switch (lacpdu->subtype) {
case AD_TYPE_LACPDU: case AD_TYPE_LACPDU:
__ntohs_lacpdu(lacpdu); __ntohs_lacpdu(lacpdu);
BOND_PRINT_DBG(("Received LACPDU on port %d", port->actor_port_number)); dprintk("Received LACPDU on port %d\n", port->actor_port_number);
ad_rx_machine(lacpdu, port); ad_rx_machine(lacpdu, port);
break; break;
...@@ -2210,17 +2212,17 @@ void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u16 leng ...@@ -2210,17 +2212,17 @@ void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u16 leng
switch (((struct marker *)lacpdu)->tlv_type) { switch (((struct marker *)lacpdu)->tlv_type) {
case AD_MARKER_INFORMATION_SUBTYPE: case AD_MARKER_INFORMATION_SUBTYPE:
BOND_PRINT_DBG(("Received Marker Information on port %d", port->actor_port_number)); dprintk("Received Marker Information on port %d\n", port->actor_port_number);
ad_marker_info_received((struct marker *)lacpdu, port); ad_marker_info_received((struct marker *)lacpdu, port);
break; break;
case AD_MARKER_RESPONSE_SUBTYPE: case AD_MARKER_RESPONSE_SUBTYPE:
BOND_PRINT_DBG(("Received Marker Response on port %d", port->actor_port_number)); dprintk("Received Marker Response on port %d\n", port->actor_port_number);
ad_marker_response_received((struct marker *)lacpdu, port); ad_marker_response_received((struct marker *)lacpdu, port);
break; break;
default: default:
BOND_PRINT_DBG(("Received an unknown Marker subtype on slot %d", port->actor_port_number)); dprintk("Received an unknown Marker subtype on slot %d\n", port->actor_port_number);
} }
} }
} }
...@@ -2240,14 +2242,14 @@ void bond_3ad_adapter_speed_changed(struct slave *slave) ...@@ -2240,14 +2242,14 @@ void bond_3ad_adapter_speed_changed(struct slave *slave)
// if slave is null, the whole port is not initialized // if slave is null, the whole port is not initialized
if (!port->slave) { if (!port->slave) {
printk(KERN_WARNING "bonding: Warning: speed changed for uninitialized port on %s\n", printk(KERN_WARNING DRV_NAME ": Warning: speed changed for uninitialized port on %s\n",
slave->dev->name); slave->dev->name);
return; return;
} }
port->actor_admin_port_key &= ~AD_SPEED_KEY_BITS; port->actor_admin_port_key &= ~AD_SPEED_KEY_BITS;
port->actor_oper_port_key=port->actor_admin_port_key |= (__get_link_speed(port) << 1); port->actor_oper_port_key=port->actor_admin_port_key |= (__get_link_speed(port) << 1);
BOND_PRINT_DBG(("Port %d changed speed", port->actor_port_number)); dprintk("Port %d changed speed\n", port->actor_port_number);
// there is no need to reselect a new aggregator, just signal the // there is no need to reselect a new aggregator, just signal the
// state machines to reinitialize // state machines to reinitialize
port->sm_vars |= AD_PORT_BEGIN; port->sm_vars |= AD_PORT_BEGIN;
...@@ -2267,14 +2269,14 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave) ...@@ -2267,14 +2269,14 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave)
// if slave is null, the whole port is not initialized // if slave is null, the whole port is not initialized
if (!port->slave) { if (!port->slave) {
printk(KERN_WARNING "bonding: Warning: duplex changed for uninitialized port on %s\n", printk(KERN_WARNING DRV_NAME ": Warning: duplex changed for uninitialized port on %s\n",
slave->dev->name); slave->dev->name);
return; return;
} }
port->actor_admin_port_key &= ~AD_DUPLEX_KEY_BITS; port->actor_admin_port_key &= ~AD_DUPLEX_KEY_BITS;
port->actor_oper_port_key=port->actor_admin_port_key |= __get_duplex(port); port->actor_oper_port_key=port->actor_admin_port_key |= __get_duplex(port);
BOND_PRINT_DBG(("Port %d changed duplex", port->actor_port_number)); dprintk("Port %d changed duplex\n", port->actor_port_number);
// there is no need to reselect a new aggregator, just signal the // there is no need to reselect a new aggregator, just signal the
// state machines to reinitialize // state machines to reinitialize
port->sm_vars |= AD_PORT_BEGIN; port->sm_vars |= AD_PORT_BEGIN;
...@@ -2295,10 +2297,8 @@ void bond_3ad_handle_link_change(struct slave *slave, char link) ...@@ -2295,10 +2297,8 @@ void bond_3ad_handle_link_change(struct slave *slave, char link)
// if slave is null, the whole port is not initialized // if slave is null, the whole port is not initialized
if (!port->slave) { if (!port->slave) {
#ifdef BONDING_DEBUG printk(KERN_WARNING DRV_NAME ": Warning: link status changed for uninitialized port on %s\n",
printk(KERN_WARNING "bonding: Warning: link status changed for uninitialized port on %s\n", slave->dev->name);
slave->dev->name);
#endif
return; return;
} }
...@@ -2370,7 +2370,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) ...@@ -2370,7 +2370,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
} }
if (bond == NULL) { if (bond == NULL) {
printk(KERN_CRIT "bonding: Error: bond is NULL on device %s\n", dev->name); printk(KERN_ERR DRV_NAME ": Error: bond is NULL on device %s\n", dev->name);
dev_kfree_skb(skb); dev_kfree_skb(skb);
return 0; return 0;
} }
...@@ -2380,7 +2380,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) ...@@ -2380,7 +2380,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
/* check if bond is empty */ /* check if bond is empty */
if ((slave == (struct slave *) bond) || (bond->slave_cnt == 0)) { if ((slave == (struct slave *) bond) || (bond->slave_cnt == 0)) {
printk(KERN_DEBUG "ERROR: bond is empty\n"); printk(KERN_DEBUG DRV_NAME ": Error: bond is empty\n");
dev_kfree_skb(skb); dev_kfree_skb(skb);
read_unlock(&bond->lock); read_unlock(&bond->lock);
return 0; return 0;
...@@ -2425,7 +2425,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) ...@@ -2425,7 +2425,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
slave = slave->prev; slave = slave->prev;
if (slave == NULL) { if (slave == NULL) {
printk(KERN_ERR "bonding: Error: slave is NULL\n"); printk(KERN_ERR DRV_NAME ": Error: slave is NULL\n");
dev_kfree_skb(skb); dev_kfree_skb(skb);
read_unlock(&bond->lock); read_unlock(&bond->lock);
return 0; return 0;
...@@ -2433,7 +2433,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) ...@@ -2433,7 +2433,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
} }
if (slave == (slave_t *)bond) { if (slave == (slave_t *)bond) {
printk(KERN_ERR "bonding: Error: Couldn't find a slave to tx on for aggregator ID %d\n", agg_id); printk(KERN_ERR DRV_NAME ": Error: Couldn't find a slave to tx on for aggregator ID %d\n", agg_id);
dev_kfree_skb(skb); dev_kfree_skb(skb);
read_unlock(&bond->lock); read_unlock(&bond->lock);
return 0; return 0;
...@@ -2446,7 +2446,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev) ...@@ -2446,7 +2446,7 @@ int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev)
struct aggregator *agg; struct aggregator *agg;
if (slave == NULL) { if (slave == NULL) {
printk(KERN_ERR "bonding: Error: slave is NULL\n"); printk(KERN_ERR DRV_NAME ": Error: slave is NULL\n");
dev_kfree_skb(skb); dev_kfree_skb(skb);
read_unlock(&bond->lock); read_unlock(&bond->lock);
return 0; return 0;
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
* handling required for ALB/TLB. * handling required for ALB/TLB.
*/ */
//#define BONDING_DEBUG 1
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
...@@ -212,8 +214,9 @@ tlb_initialize(struct bonding *bond) ...@@ -212,8 +214,9 @@ tlb_initialize(struct bonding *bond)
_lock_tx_hashtbl(bond); _lock_tx_hashtbl(bond);
if (bond_info->tx_hashtbl != NULL) { if (bond_info->tx_hashtbl != NULL) {
printk (KERN_ERR "%s: TLB hash table is not NULL\n", printk(KERN_ERR DRV_NAME
bond->device->name); ": Error: %s: TLB hash table is not NULL\n",
bond->device->name);
_unlock_tx_hashtbl(bond); _unlock_tx_hashtbl(bond);
return -1; return -1;
} }
...@@ -221,8 +224,9 @@ tlb_initialize(struct bonding *bond) ...@@ -221,8 +224,9 @@ tlb_initialize(struct bonding *bond)
size = TLB_HASH_TABLE_SIZE * sizeof(struct tlb_client_info); size = TLB_HASH_TABLE_SIZE * sizeof(struct tlb_client_info);
bond_info->tx_hashtbl = kmalloc(size, GFP_KERNEL); bond_info->tx_hashtbl = kmalloc(size, GFP_KERNEL);
if (bond_info->tx_hashtbl == NULL) { if (bond_info->tx_hashtbl == NULL) {
printk (KERN_ERR "%s: Failed to allocate TLB hash table\n", printk(KERN_ERR DRV_NAME
bond->device->name); ": Error: %s: Failed to allocate TLB hash table\n",
bond->device->name);
_unlock_tx_hashtbl(bond); _unlock_tx_hashtbl(bond);
return -1; return -1;
} }
...@@ -306,8 +310,9 @@ tlb_choose_channel(struct bonding *bond, u32 hash_index, u32 skb_len) ...@@ -306,8 +310,9 @@ tlb_choose_channel(struct bonding *bond, u32 hash_index, u32 skb_len)
hash_table = bond_info->tx_hashtbl; hash_table = bond_info->tx_hashtbl;
if (hash_table == NULL) { if (hash_table == NULL) {
printk (KERN_ERR "%s: TLB hash table is NULL\n", printk(KERN_ERR DRV_NAME
bond->device->name); ": Error: %s: TLB hash table is NULL\n",
bond->device->name);
_unlock_tx_hashtbl(bond); _unlock_tx_hashtbl(bond);
return NULL; return NULL;
} }
...@@ -403,19 +408,19 @@ rlb_arp_recv(struct sk_buff *skb, ...@@ -403,19 +408,19 @@ rlb_arp_recv(struct sk_buff *skb,
} }
if (!arp) { if (!arp) {
printk(KERN_ERR "Packet has no ARP data\n"); dprintk("Packet has no ARP data\n");
goto out; goto out;
} }
if (skb->len < sizeof(struct arp_pkt)) { if (skb->len < sizeof(struct arp_pkt)) {
printk(KERN_ERR "Packet is too small to be an ARP\n"); dprintk("Packet is too small to be an ARP\n");
goto out; goto out;
} }
if (arp->op_code == htons(ARPOP_REPLY)) { if (arp->op_code == htons(ARPOP_REPLY)) {
/* update rx hash table for this ARP */ /* update rx hash table for this ARP */
rlb_update_entry_from_arp(bond, arp); rlb_update_entry_from_arp(bond, arp);
BOND_PRINT_DBG(("Server received an ARP Reply from client")); dprintk("Server received an ARP Reply from client\n");
} }
ret = NET_RX_SUCCESS; ret = NET_RX_SUCCESS;
...@@ -653,8 +658,9 @@ rlb_req_update_subnet_clients(struct bonding *bond, u32 src_ip) ...@@ -653,8 +658,9 @@ rlb_req_update_subnet_clients(struct bonding *bond, u32 src_ip)
client_info = &(bond_info->rx_hashtbl[hash_index]); client_info = &(bond_info->rx_hashtbl[hash_index]);
if (!client_info->slave) { if (!client_info->slave) {
printk(KERN_ERR "Bonding: Error: found a client with no" printk(KERN_ERR DRV_NAME
" channel in the client's hash table\n"); ": Error: found a client with no channel in "
"the client's hash table\n");
continue; continue;
} }
/*update all clients using this src_ip, that are not assigned /*update all clients using this src_ip, that are not assigned
...@@ -776,7 +782,7 @@ rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) ...@@ -776,7 +782,7 @@ rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
if (tx_slave) { if (tx_slave) {
memcpy(arp->mac_src,tx_slave->dev->dev_addr, ETH_ALEN); memcpy(arp->mac_src,tx_slave->dev->dev_addr, ETH_ALEN);
} }
BOND_PRINT_DBG(("Server sent ARP Reply packet")); dprintk("Server sent ARP Reply packet\n");
} else if (arp->op_code == __constant_htons(ARPOP_REQUEST)) { } else if (arp->op_code == __constant_htons(ARPOP_REQUEST)) {
/* Create an entry in the rx_hashtbl for this client as a /* Create an entry in the rx_hashtbl for this client as a
...@@ -797,7 +803,7 @@ rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) ...@@ -797,7 +803,7 @@ rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
* updated with their assigned mac. * updated with their assigned mac.
*/ */
rlb_req_update_subnet_clients(bond, arp->ip_src); rlb_req_update_subnet_clients(bond, arp->ip_src);
BOND_PRINT_DBG(("Server sent ARP Request packet")); dprintk("Server sent ARP Request packet\n");
} }
return tx_slave; return tx_slave;
...@@ -860,8 +866,9 @@ rlb_initialize(struct bonding *bond) ...@@ -860,8 +866,9 @@ rlb_initialize(struct bonding *bond)
_lock_rx_hashtbl(bond); _lock_rx_hashtbl(bond);
if (bond_info->rx_hashtbl != NULL) { if (bond_info->rx_hashtbl != NULL) {
printk (KERN_ERR "%s: RLB hash table is not NULL\n", printk(KERN_ERR DRV_NAME
bond->device->name); ": Error: %s: RLB hash table is not NULL\n",
bond->device->name);
_unlock_rx_hashtbl(bond); _unlock_rx_hashtbl(bond);
return -1; return -1;
} }
...@@ -869,8 +876,9 @@ rlb_initialize(struct bonding *bond) ...@@ -869,8 +876,9 @@ rlb_initialize(struct bonding *bond)
size = RLB_HASH_TABLE_SIZE * sizeof(struct rlb_client_info); size = RLB_HASH_TABLE_SIZE * sizeof(struct rlb_client_info);
bond_info->rx_hashtbl = kmalloc(size, GFP_KERNEL); bond_info->rx_hashtbl = kmalloc(size, GFP_KERNEL);
if (bond_info->rx_hashtbl == NULL) { if (bond_info->rx_hashtbl == NULL) {
printk (KERN_ERR "%s: Failed to allocate" printk(KERN_ERR DRV_NAME
" RLB hash table\n", bond->device->name); ": Error: %s: Failed to allocate RLB hash table\n",
bond->device->name);
_unlock_rx_hashtbl(bond); _unlock_rx_hashtbl(bond);
return -1; return -1;
} }
...@@ -968,12 +976,12 @@ alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw) ...@@ -968,12 +976,12 @@ alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw)
memcpy(s_addr.sa_data, addr, dev->addr_len); memcpy(s_addr.sa_data, addr, dev->addr_len);
s_addr.sa_family = dev->type; s_addr.sa_family = dev->type;
if (dev->set_mac_address(dev, &s_addr)) { if (dev->set_mac_address(dev, &s_addr)) {
printk(KERN_DEBUG "bonding: Error: alb_set_slave_mac_addr:" printk(KERN_ERR DRV_NAME
" dev->set_mac_address of dev %s failed!" ": Error: dev->set_mac_address of dev %s failed! ALB "
" ALB mode requires that the base driver" "mode requires that the base driver support setting "
" support setting the hw address also when" "the hw address also when the network device's "
" the network device's interface is open\n", "interface is open\n",
dev->name); dev->name);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
return 0; return 0;
...@@ -1124,9 +1132,10 @@ alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave) ...@@ -1124,9 +1132,10 @@ alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave)
/* a slave was found that is using the mac address /* a slave was found that is using the mac address
* of the new slave * of the new slave
*/ */
printk(KERN_ERR "bonding: Warning: the hw address " printk(KERN_ERR DRV_NAME
"of slave %s is not unique - cannot enslave it!" ": Error: the hw address of slave %s is not "
, slave->dev->name); "unique - cannot enslave it!",
slave->dev->name);
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -1161,16 +1170,16 @@ alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave) ...@@ -1161,16 +1170,16 @@ alb_handle_addr_collision_on_attach(struct bonding *bond, struct slave *slave)
alb_set_slave_mac_addr(slave, tmp_slave1->perm_hwaddr, alb_set_slave_mac_addr(slave, tmp_slave1->perm_hwaddr,
bond->alb_info.rlb_enabled); bond->alb_info.rlb_enabled);
printk(KERN_WARNING "bonding: Warning: the hw address " printk(KERN_WARNING DRV_NAME
"of slave %s is in use by the bond; " ": Warning: the hw address of slave %s is in use by "
"giving it the hw address of %s\n", "the bond; giving it the hw address of %s\n",
slave->dev->name, tmp_slave1->dev->name); slave->dev->name, tmp_slave1->dev->name);
} else { } else {
printk(KERN_CRIT "bonding: Error: the hw address " printk(KERN_ERR DRV_NAME
"of slave %s is in use by the bond; " ": Error: the hw address of slave %s is in use by the "
"couldn't find a slave with a free hw " "bond; couldn't find a slave with a free hw address to "
"address to give it (this should not have " "give it (this should not have happened)\n",
"happened)\n", slave->dev->name); slave->dev->name);
return -EFAULT; return -EFAULT;
} }
......
...@@ -428,6 +428,8 @@ ...@@ -428,6 +428,8 @@
* Set version to 2.4.1. * Set version to 2.4.1.
*/ */
//#define BONDING_DEBUG 1
#include <linux/config.h> #include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -472,11 +474,6 @@ ...@@ -472,11 +474,6 @@
#include "bond_3ad.h" #include "bond_3ad.h"
#include "bond_alb.h" #include "bond_alb.h"
#define DRV_VERSION "2.4.1"
#define DRV_RELDATE "September 15, 2003"
#define DRV_NAME "bonding"
#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"
static const char *version = static const char *version =
DRV_NAME ".c:v" DRV_VERSION " (" DRV_RELDATE ")\n"; DRV_NAME ".c:v" DRV_VERSION " (" DRV_RELDATE ")\n";
...@@ -613,15 +610,6 @@ static void reselect_active_interface(struct bonding *bond); ...@@ -613,15 +610,6 @@ static void reselect_active_interface(struct bonding *bond);
static struct slave *find_best_interface(struct bonding *bond); static struct slave *find_best_interface(struct bonding *bond);
/* #define BONDING_DEBUG 1 */
#ifdef BONDING_DEBUG
#define dprintk(x...) printk(x...)
#else /* BONDING_DEBUG */
#define dprintk(x...) do {} while (0)
#endif /* BONDING_DEBUG */
/* several macros */
static void arp_send_all(slave_t *slave) static void arp_send_all(slave_t *slave)
{ {
int i; int i;
...@@ -722,9 +710,9 @@ bond_detach_slave(bonding_t *bond, slave_t *slave) ...@@ -722,9 +710,9 @@ bond_detach_slave(bonding_t *bond, slave_t *slave)
{ {
if ((bond == NULL) || (slave == NULL) || if ((bond == NULL) || (slave == NULL) ||
((void *)bond == (void *)slave)) { ((void *)bond == (void *)slave)) {
printk(KERN_ERR printk(KERN_ERR DRV_NAME
"bond_detach_slave(): trying to detach " ": Error: trying to detach slave %p from bond %p\n",
"slave %p from bond %p\n", bond, slave); bond, slave);
return slave; return slave;
} }
...@@ -914,10 +902,7 @@ bond_check_dev_link(struct net_device *dev, int reporting) ...@@ -914,10 +902,7 @@ bond_check_dev_link(struct net_device *dev, int reporting)
if (etool.data == 1) { if (etool.data == 1) {
return BMSR_LSTATUS; return BMSR_LSTATUS;
} else { } else {
#ifdef BONDING_DEBUG dprintk("SIOCETHTOOL shows link down\n");
printk(KERN_INFO
":: SIOCETHTOOL shows link down \n");
#endif
return 0; return 0;
} }
} }
...@@ -1349,25 +1334,21 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -1349,25 +1334,21 @@ static int bond_enslave(struct net_device *master_dev,
bond = (struct bonding *) master_dev->priv; bond = (struct bonding *) master_dev->priv;
if (slave_dev->do_ioctl == NULL) { if (slave_dev->do_ioctl == NULL) {
printk(KERN_DEBUG printk(KERN_WARNING DRV_NAME
"Warning : no link monitoring support for %s\n", ": Warning : no link monitoring support for %s\n",
slave_dev->name); slave_dev->name);
} }
/* bond must be initialized by bond_open() before enslaving */ /* bond must be initialized by bond_open() before enslaving */
if (!(master_dev->flags & IFF_UP)) { if (!(master_dev->flags & IFF_UP)) {
#ifdef BONDING_DEBUG dprintk("Error, master_dev is not up\n");
printk(KERN_CRIT "Error, master_dev is not up\n");
#endif
return -EPERM; return -EPERM;
} }
/* already enslaved */ /* already enslaved */
if (master_dev->flags & IFF_SLAVE || slave_dev->flags & IFF_SLAVE) { if (master_dev->flags & IFF_SLAVE || slave_dev->flags & IFF_SLAVE) {
#ifdef BONDING_DEBUG dprintk("Error, Device was already enslaved\n");
printk(KERN_CRIT "Error, Device was already enslaved\n");
#endif
return -EBUSY; return -EBUSY;
} }
...@@ -1376,19 +1357,19 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -1376,19 +1357,19 @@ static int bond_enslave(struct net_device *master_dev,
* slave interface to be closed. * slave interface to be closed.
*/ */
if ((slave_dev->flags & IFF_UP)) { if ((slave_dev->flags & IFF_UP)) {
#ifdef BONDING_DEBUG printk(KERN_ERR DRV_NAME
printk(KERN_CRIT "Error, slave_dev is up\n"); ": Error: %s is up\n",
#endif slave_dev->name);
return -EPERM; return -EPERM;
} }
if (slave_dev->set_mac_address == NULL) { if (slave_dev->set_mac_address == NULL) {
printk(KERN_CRIT printk(KERN_ERR DRV_NAME
"The slave device you specified does not support" ": Error: The slave device you specified does "
" setting the MAC address.\n"); "not support setting the MAC address.\n");
printk(KERN_CRIT printk(KERN_ERR
"Your kernel likely does not support slave" "Your kernel likely does not support slave "
" devices.\n"); "devices.\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -1397,18 +1378,19 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -1397,18 +1378,19 @@ static int bond_enslave(struct net_device *master_dev,
* slave interface to be open. * slave interface to be open.
*/ */
if (!(slave_dev->flags & IFF_UP)) { if (!(slave_dev->flags & IFF_UP)) {
#ifdef BONDING_DEBUG printk(KERN_ERR DRV_NAME
printk(KERN_CRIT "Error, slave_dev is not running\n"); ": Error: %s is not running\n",
#endif slave_dev->name);
return -EINVAL; return -EINVAL;
} }
if ((bond_mode == BOND_MODE_8023AD) || if ((bond_mode == BOND_MODE_8023AD) ||
(bond_mode == BOND_MODE_TLB) || (bond_mode == BOND_MODE_TLB) ||
(bond_mode == BOND_MODE_ALB)) { (bond_mode == BOND_MODE_ALB)) {
printk(KERN_ERR printk(KERN_ERR DRV_NAME
"bonding: Error: to use %s mode, you must " ": Error: to use %s mode, you must upgrade "
"upgrade ifenslave.\n", bond_mode_name()); "ifenslave.\n",
bond_mode_name());
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
} }
...@@ -1439,9 +1421,7 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -1439,9 +1421,7 @@ static int bond_enslave(struct net_device *master_dev,
addr.sa_family = slave_dev->type; addr.sa_family = slave_dev->type;
err = slave_dev->set_mac_address(slave_dev, &addr); err = slave_dev->set_mac_address(slave_dev, &addr);
if (err) { if (err) {
#ifdef BONDING_DEBUG dprintk("Error %d calling set_mac_address\n", err);
printk(KERN_CRIT "Error %d calling set_mac_address\n", err);
#endif
goto err_free; goto err_free;
} }
} }
...@@ -1449,18 +1429,14 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -1449,18 +1429,14 @@ static int bond_enslave(struct net_device *master_dev,
/* open the slave since the application closed it */ /* open the slave since the application closed it */
err = dev_open(slave_dev); err = dev_open(slave_dev);
if (err) { if (err) {
#ifdef BONDING_DEBUG dprintk("Openning slave %s failed\n", slave_dev->name);
printk(KERN_CRIT "Openning slave %s failed\n", slave_dev->name);
#endif
goto err_restore_mac; goto err_restore_mac;
} }
} }
err = netdev_set_master(slave_dev, master_dev); err = netdev_set_master(slave_dev, master_dev);
if (err) { if (err) {
#ifdef BONDING_DEBUG dprintk("Error %d calling netdev_set_master\n", err);
printk(KERN_CRIT "Error %d calling netdev_set_master\n", err);
#endif
if (app_abi_ver < 1) { if (app_abi_ver < 1) {
goto err_free; goto err_free;
} else { } else {
...@@ -1529,21 +1505,21 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -1529,21 +1505,21 @@ static int bond_enslave(struct net_device *master_dev,
* supported); thus, we don't need to change * supported); thus, we don't need to change
* the messages for netif_carrier. * the messages for netif_carrier.
*/ */
printk(KERN_ERR printk(KERN_WARNING DRV_NAME
"bond_enslave(): MII and ETHTOOL support not " ": Warning: MII and ETHTOOL support not "
"available for interface %s, and " "available for interface %s, and "
"arp_interval/arp_ip_target module parameters " "arp_interval/arp_ip_target module parameters "
"not specified, thus bonding will not detect " "not specified, thus bonding will not detect "
"link failures! see bonding.txt for details.\n", "link failures! see bonding.txt for details.\n",
slave_dev->name); slave_dev->name);
} else if (link_reporting == -1) { } else if (link_reporting == -1) {
/* unable get link status using mii/ethtool */ /* unable get link status using mii/ethtool */
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bond_enslave: can't get link status from " ": Warning: can't get link status from "
"interface %s; the network driver associated " "interface %s; the network driver associated "
"with this interface does not support " "with this interface does not support MII or "
"MII or ETHTOOL link status reporting, thus " "ETHTOOL link status reporting, thus miimon "
"miimon has no effect on this interface.\n", "has no effect on this interface.\n",
slave_dev->name); slave_dev->name);
} }
} }
...@@ -1552,41 +1528,36 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -1552,41 +1528,36 @@ static int bond_enslave(struct net_device *master_dev,
if ((miimon <= 0) || if ((miimon <= 0) ||
(bond_check_dev_link(slave_dev, 0) == BMSR_LSTATUS)) { (bond_check_dev_link(slave_dev, 0) == BMSR_LSTATUS)) {
if (updelay) { if (updelay) {
#ifdef BONDING_DEBUG dprintk("Initial state of slave_dev is "
printk(KERN_CRIT "Initial state of slave_dev is " "BOND_LINK_BACK\n");
"BOND_LINK_BACK\n");
#endif
new_slave->link = BOND_LINK_BACK; new_slave->link = BOND_LINK_BACK;
new_slave->delay = updelay; new_slave->delay = updelay;
} }
else { else {
#ifdef BONDING_DEBUG dprintk("Initial state of slave_dev is "
printk(KERN_DEBUG "Initial state of slave_dev is "
"BOND_LINK_UP\n"); "BOND_LINK_UP\n");
#endif
new_slave->link = BOND_LINK_UP; new_slave->link = BOND_LINK_UP;
} }
new_slave->jiffies = jiffies; new_slave->jiffies = jiffies;
} }
else { else {
#ifdef BONDING_DEBUG dprintk("Initial state of slave_dev is "
printk(KERN_CRIT "Initial state of slave_dev is "
"BOND_LINK_DOWN\n"); "BOND_LINK_DOWN\n");
#endif
new_slave->link = BOND_LINK_DOWN; new_slave->link = BOND_LINK_DOWN;
} }
if (bond_update_speed_duplex(new_slave) && if (bond_update_speed_duplex(new_slave) &&
(new_slave->link != BOND_LINK_DOWN)) { (new_slave->link != BOND_LINK_DOWN)) {
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bond_enslave(): failed to get speed/duplex from %s, " ": Warning: failed to get speed/duplex from %s, speed "
"speed forced to 100Mbps, duplex forced to Full.\n", "forced to 100Mbps, duplex forced to Full.\n",
new_slave->dev->name); new_slave->dev->name);
if (bond_mode == BOND_MODE_8023AD) { if (bond_mode == BOND_MODE_8023AD) {
printk(KERN_WARNING printk(KERN_WARNING
"Operation of 802.3ad mode requires ETHTOOL support " "Operation of 802.3ad mode requires ETHTOOL "
"in base driver for proper aggregator selection.\n"); "support in base driver for proper aggregator "
"selection.\n");
} }
} }
...@@ -1601,17 +1572,13 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -1601,17 +1572,13 @@ static int bond_enslave(struct net_device *master_dev,
if (((bond->current_slave == NULL) if (((bond->current_slave == NULL)
|| (bond->current_slave->dev->flags & IFF_NOARP)) || (bond->current_slave->dev->flags & IFF_NOARP))
&& (new_slave->link != BOND_LINK_DOWN)) { && (new_slave->link != BOND_LINK_DOWN)) {
#ifdef BONDING_DEBUG dprintk("This is the first active slave\n");
printk(KERN_CRIT "This is the first active slave\n");
#endif
/* first slave or no active slave yet, and this link /* first slave or no active slave yet, and this link
is OK, so make this interface the active one */ is OK, so make this interface the active one */
change_active_interface(bond, new_slave); change_active_interface(bond, new_slave);
} }
else { else {
#ifdef BONDING_DEBUG dprintk("This is just a backup slave\n");
printk(KERN_CRIT "This is just a backup slave\n");
#endif
bond_set_slave_inactive_flags(new_slave); bond_set_slave_inactive_flags(new_slave);
} }
if (((struct in_device *)slave_dev->ip_ptr) != NULL) { if (((struct in_device *)slave_dev->ip_ptr) != NULL) {
...@@ -1666,9 +1633,7 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -1666,9 +1633,7 @@ static int bond_enslave(struct net_device *master_dev,
} }
} }
} else { } else {
#ifdef BONDING_DEBUG dprintk("This slave is always active in trunk mode\n");
printk(KERN_CRIT "This slave is always active in trunk mode\n");
#endif
/* always active in trunk mode */ /* always active in trunk mode */
new_slave->state = BOND_STATE_ACTIVE; new_slave->state = BOND_STATE_ACTIVE;
...@@ -1693,15 +1658,11 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -1693,15 +1658,11 @@ static int bond_enslave(struct net_device *master_dev,
int ndx = 0; int ndx = 0;
for (ndx = 0; ndx < slave_dev->addr_len; ndx++) { for (ndx = 0; ndx < slave_dev->addr_len; ndx++) {
#ifdef BONDING_DEBUG dprintk("Checking ndx=%d of master_dev->dev_addr\n",
printk(KERN_DEBUG ndx);
"Checking ndx=%d of master_dev->dev_addr\n", ndx);
#endif
if (master_dev->dev_addr[ndx] != 0) { if (master_dev->dev_addr[ndx] != 0) {
#ifdef BONDING_DEBUG dprintk("Found non-zero byte at ndx=%d\n",
printk(KERN_DEBUG ndx);
"Found non-zero byte at ndx=%d\n", ndx);
#endif
break; break;
} }
} }
...@@ -1710,20 +1671,19 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -1710,20 +1671,19 @@ static int bond_enslave(struct net_device *master_dev,
* We got all the way through the address and it was * We got all the way through the address and it was
* all 0's. * all 0's.
*/ */
#ifdef BONDING_DEBUG dprintk("%s doesn't have a MAC address yet. ",
printk(KERN_DEBUG "%s doesn't have a MAC address yet. ", master_dev->name);
master_dev->name); dprintk("Going to give assign it from %s.\n",
printk(KERN_DEBUG "Going to give assign it from %s.\n", slave_dev->name);
slave_dev->name);
#endif
bond_sethwaddr(master_dev, slave_dev); bond_sethwaddr(master_dev, slave_dev);
} }
} }
printk (KERN_INFO "%s: enslaving %s as a%s interface with a%s link.\n", printk(KERN_INFO DRV_NAME
master_dev->name, slave_dev->name, ": %s: enslaving %s as a%s interface with a%s link.\n",
new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup", master_dev->name, slave_dev->name,
new_slave->link != BOND_LINK_DOWN ? "n up" : " down"); new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup",
new_slave->link != BOND_LINK_DOWN ? "n up" : " down");
/* enslave is successful */ /* enslave is successful */
return 0; return 0;
...@@ -1888,11 +1848,11 @@ static void change_active_interface(struct bonding *bond, struct slave *new) ...@@ -1888,11 +1848,11 @@ static void change_active_interface(struct bonding *bond, struct slave *new)
if (new) { if (new) {
if (new->link == BOND_LINK_BACK) { if (new->link == BOND_LINK_BACK) {
if (USES_PRIMARY(bond_mode)) { if (USES_PRIMARY(bond_mode)) {
printk (KERN_INFO printk(KERN_INFO DRV_NAME
"%s: making interface %s the new " ": %s: making interface %s the new "
"active one %d ms earlier.\n", "active one %d ms earlier.\n",
bond->device->name, new->dev->name, bond->device->name, new->dev->name,
(updelay - new->delay) * miimon); (updelay - new->delay) * miimon);
} }
new->delay = 0; new->delay = 0;
...@@ -1909,9 +1869,10 @@ static void change_active_interface(struct bonding *bond, struct slave *new) ...@@ -1909,9 +1869,10 @@ static void change_active_interface(struct bonding *bond, struct slave *new)
} }
} else { } else {
if (USES_PRIMARY(bond_mode)) { if (USES_PRIMARY(bond_mode)) {
printk (KERN_INFO printk(KERN_INFO DRV_NAME
"%s: making interface %s the new active one.\n", ": %s: making interface %s the new "
bond->device->name, new->dev->name); "active one.\n",
bond->device->name, new->dev->name);
} }
} }
} }
...@@ -1986,7 +1947,9 @@ static int bond_release(struct net_device *master, struct net_device *slave) ...@@ -1986,7 +1947,9 @@ static int bond_release(struct net_device *master, struct net_device *slave)
/* master already enslaved, or slave not enslaved, /* master already enslaved, or slave not enslaved,
or no slave for this master */ or no slave for this master */
if ((master->flags & IFF_SLAVE) || !(slave->flags & IFF_SLAVE)) { if ((master->flags & IFF_SLAVE) || !(slave->flags & IFF_SLAVE)) {
printk (KERN_DEBUG "%s: cannot release %s.\n", master->name, slave->name); printk(KERN_ERR DRV_NAME
": Error: %s: cannot release %s.\n",
master->name, slave->name);
return -EINVAL; return -EINVAL;
} }
...@@ -2000,11 +1963,12 @@ static int bond_release(struct net_device *master, struct net_device *slave) ...@@ -2000,11 +1963,12 @@ static int bond_release(struct net_device *master, struct net_device *slave)
our_slave->perm_hwaddr, our_slave->perm_hwaddr,
ETH_ALEN); ETH_ALEN);
if (!mac_addr_differ && (bond->slave_cnt > 1)) { if (!mac_addr_differ && (bond->slave_cnt > 1)) {
printk(KERN_WARNING "WARNING: the permanent HWaddr of %s " printk(KERN_WARNING DRV_NAME
"- %02X:%02X:%02X:%02X:%02X:%02X - " ": Warning: the permanent HWaddr of %s "
"is still in use by %s. Set the HWaddr " "- %02X:%02X:%02X:%02X:%02X:%02X - is "
"of %s to a different address " "still in use by %s. Set the HWaddr of "
"to avoid conflicts.\n", "%s to a different address to avoid "
"conflicts.\n",
slave->name, slave->name,
our_slave->perm_hwaddr[0], our_slave->perm_hwaddr[0],
our_slave->perm_hwaddr[1], our_slave->perm_hwaddr[1],
...@@ -2024,10 +1988,12 @@ static int bond_release(struct net_device *master, struct net_device *slave) ...@@ -2024,10 +1988,12 @@ static int bond_release(struct net_device *master, struct net_device *slave)
bond_3ad_unbind_slave(our_slave); bond_3ad_unbind_slave(our_slave);
} }
printk (KERN_INFO "%s: releasing %s interface %s\n", printk(KERN_INFO DRV_NAME
master->name, ": %s: releasing %s interface %s\n",
(our_slave->state == BOND_STATE_ACTIVE) ? "active" : "backup", master->name,
slave->name); (our_slave->state == BOND_STATE_ACTIVE)
? "active" : "backup",
slave->name);
/* release the slave from its bond */ /* release the slave from its bond */
bond_detach_slave(bond, our_slave); bond_detach_slave(bond, our_slave);
...@@ -2042,9 +2008,10 @@ static int bond_release(struct net_device *master, struct net_device *slave) ...@@ -2042,9 +2008,10 @@ static int bond_release(struct net_device *master, struct net_device *slave)
} }
if (bond->current_slave == NULL) { if (bond->current_slave == NULL) {
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: now running without any active interface !\n", ": %s: now running without any active "
master->name); "interface !\n",
master->name);
} }
if ((bond_mode == BOND_MODE_TLB) || if ((bond_mode == BOND_MODE_TLB) ||
...@@ -2064,7 +2031,9 @@ static int bond_release(struct net_device *master, struct net_device *slave) ...@@ -2064,7 +2031,9 @@ static int bond_release(struct net_device *master, struct net_device *slave)
if (our_slave == (slave_t *)bond) { if (our_slave == (slave_t *)bond) {
/* if we get here, it's because the device was not found */ /* if we get here, it's because the device was not found */
printk (KERN_INFO "%s: %s not enslaved\n", master->name, slave->name); printk(KERN_INFO DRV_NAME
": %s: %s not enslaved\n",
master->name, slave->name);
return -EINVAL; return -EINVAL;
} }
...@@ -2226,7 +2195,9 @@ static int bond_release_all(struct net_device *master) ...@@ -2226,7 +2195,9 @@ static int bond_release_all(struct net_device *master)
*/ */
memset(master->dev_addr, 0, master->addr_len); memset(master->dev_addr, 0, master->addr_len);
printk (KERN_INFO "%s: released all slaves\n", master->name); printk(KERN_INFO DRV_NAME
": %s: released all slaves\n",
master->name);
out: out:
write_unlock_bh(&bond->lock); write_unlock_bh(&bond->lock);
...@@ -2277,19 +2248,20 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -2277,19 +2248,20 @@ static void bond_mii_monitor(struct net_device *master)
slave->link_failure_count++; slave->link_failure_count++;
} }
if (downdelay > 0) { if (downdelay > 0) {
printk (KERN_INFO printk(KERN_INFO DRV_NAME
"%s: link status down for %sinterface " ": %s: link status down for %s "
"%s, disabling it in %d ms.\n", "interface %s, disabling it in "
master->name, "%d ms.\n",
IS_UP(dev) master->name,
? ((bond_mode == BOND_MODE_ACTIVEBACKUP) IS_UP(dev)
? ((slave == oldcurrent) ? ((bond_mode == BOND_MODE_ACTIVEBACKUP)
? "active " : "backup ") ? ((slave == oldcurrent)
: "") ? "active " : "backup ")
: "idle ", : "")
dev->name, : "idle ",
downdelay * miimon); dev->name,
} downdelay * miimon);
}
} }
/* no break ! fall through the BOND_LINK_FAIL test to /* no break ! fall through the BOND_LINK_FAIL test to
ensure proper action to be taken ensure proper action to be taken
...@@ -2308,11 +2280,12 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -2308,11 +2280,12 @@ static void bond_mii_monitor(struct net_device *master)
bond_set_slave_inactive_flags(slave); bond_set_slave_inactive_flags(slave);
} }
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: link status definitely down " ": %s: link status definitely "
"for interface %s, disabling it", "down for interface %s, "
master->name, "disabling it",
dev->name); master->name,
dev->name);
/* notify ad that the link status has changed */ /* notify ad that the link status has changed */
if (bond_mode == BOND_MODE_8023AD) { if (bond_mode == BOND_MODE_8023AD) {
...@@ -2336,12 +2309,12 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -2336,12 +2309,12 @@ static void bond_mii_monitor(struct net_device *master)
/* link up again */ /* link up again */
slave->link = BOND_LINK_UP; slave->link = BOND_LINK_UP;
slave->jiffies = jiffies; slave->jiffies = jiffies;
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: link status up again after %d ms " ": %s: link status up again after %d "
"for interface %s.\n", "ms for interface %s.\n",
master->name, master->name,
(downdelay - slave->delay) * miimon, (downdelay - slave->delay) * miimon,
dev->name); dev->name);
} }
break; break;
case BOND_LINK_DOWN: /* the link was down */ case BOND_LINK_DOWN: /* the link was down */
...@@ -2355,12 +2328,13 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -2355,12 +2328,13 @@ static void bond_mii_monitor(struct net_device *master)
if (updelay > 0) { if (updelay > 0) {
/* if updelay == 0, no need to /* if updelay == 0, no need to
advertise about a 0 ms delay */ advertise about a 0 ms delay */
printk (KERN_INFO printk(KERN_INFO DRV_NAME
"%s: link status up for interface" ": %s: link status up for "
" %s, enabling it in %d ms.\n", "interface %s, enabling it "
master->name, "in %d ms.\n",
dev->name, master->name,
updelay * miimon); dev->name,
updelay * miimon);
} }
} }
/* no break ! fall through the BOND_LINK_BACK state in /* no break ! fall through the BOND_LINK_BACK state in
...@@ -2370,12 +2344,12 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -2370,12 +2344,12 @@ static void bond_mii_monitor(struct net_device *master)
if (link_state != BMSR_LSTATUS) { if (link_state != BMSR_LSTATUS) {
/* link down again */ /* link down again */
slave->link = BOND_LINK_DOWN; slave->link = BOND_LINK_DOWN;
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: link status down again after %d ms " ": %s: link status down again after %d "
"for interface %s.\n", "ms for interface %s.\n",
master->name, master->name,
(updelay - slave->delay) * miimon, (updelay - slave->delay) * miimon,
dev->name); dev->name);
} else { } else {
/* link stays up */ /* link stays up */
if (slave->delay == 0) { if (slave->delay == 0) {
...@@ -2395,11 +2369,11 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -2395,11 +2369,11 @@ static void bond_mii_monitor(struct net_device *master)
slave->state = BOND_STATE_BACKUP; slave->state = BOND_STATE_BACKUP;
} }
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: link status definitely up " ": %s: link status definitely "
"for interface %s.\n", "up for interface %s.\n",
master->name, master->name,
dev->name); dev->name);
/* notify ad that the link status has changed */ /* notify ad that the link status has changed */
if (bond_mode == BOND_MODE_8023AD) { if (bond_mode == BOND_MODE_8023AD) {
...@@ -2440,9 +2414,10 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -2440,9 +2414,10 @@ static void bond_mii_monitor(struct net_device *master)
reselect_active_interface(bond); reselect_active_interface(bond);
if (oldcurrent && !bond->current_slave) { if (oldcurrent && !bond->current_slave) {
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: now running without any active interface !\n", ": %s: now running without any active "
master->name); "interface !\n",
master->name);
} }
write_unlock(&bond->ptrlock); write_unlock(&bond->ptrlock);
...@@ -2521,17 +2496,17 @@ static void loadbalance_arp_monitor(struct net_device *master) ...@@ -2521,17 +2496,17 @@ static void loadbalance_arp_monitor(struct net_device *master)
* is closed. * is closed.
*/ */
if (oldcurrent == NULL) { if (oldcurrent == NULL) {
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: link status definitely up " ": %s: link status definitely "
"for interface %s, ", "up for interface %s, ",
master->name, master->name,
slave->dev->name); slave->dev->name);
do_failover = 1; do_failover = 1;
} else { } else {
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: interface %s is now up\n", ": %s: interface %s is now up\n",
master->name, master->name,
slave->dev->name); slave->dev->name);
} }
} }
} else { } else {
...@@ -2550,8 +2525,8 @@ static void loadbalance_arp_monitor(struct net_device *master) ...@@ -2550,8 +2525,8 @@ static void loadbalance_arp_monitor(struct net_device *master)
if (slave->link_failure_count < UINT_MAX) { if (slave->link_failure_count < UINT_MAX) {
slave->link_failure_count++; slave->link_failure_count++;
} }
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: interface %s is now down.\n", ": %s: interface %s is now down.\n",
master->name, master->name,
slave->dev->name); slave->dev->name);
...@@ -2578,9 +2553,10 @@ static void loadbalance_arp_monitor(struct net_device *master) ...@@ -2578,9 +2553,10 @@ static void loadbalance_arp_monitor(struct net_device *master)
reselect_active_interface(bond); reselect_active_interface(bond);
if (oldcurrent && !bond->current_slave) { if (oldcurrent && !bond->current_slave) {
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: now running without any active interface !\n", ": %s: now running without any active "
master->name); "interface !\n",
master->name);
} }
write_unlock(&bond->ptrlock); write_unlock(&bond->ptrlock);
...@@ -2660,17 +2636,17 @@ static void activebackup_arp_monitor(struct net_device *master) ...@@ -2660,17 +2636,17 @@ static void activebackup_arp_monitor(struct net_device *master)
} }
if (slave == bond->current_slave) { if (slave == bond->current_slave) {
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: %s is up and now the " ": %s: %s is up and now the "
"active interface\n", "active interface\n",
master->name, master->name,
slave->dev->name); slave->dev->name);
} else { } else {
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: backup interface %s is " ": %s: backup interface %s is "
"now up\n", "now up\n",
master->name, master->name,
slave->dev->name); slave->dev->name);
} }
write_unlock(&bond->ptrlock); write_unlock(&bond->ptrlock);
...@@ -2697,10 +2673,10 @@ static void activebackup_arp_monitor(struct net_device *master) ...@@ -2697,10 +2673,10 @@ static void activebackup_arp_monitor(struct net_device *master)
slave->link_failure_count++; slave->link_failure_count++;
} }
bond_set_slave_inactive_flags(slave); bond_set_slave_inactive_flags(slave);
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: backup interface %s is now down\n", ": %s: backup interface %s is now down\n",
master->name, master->name,
slave->dev->name); slave->dev->name);
} else { } else {
read_unlock(&bond->ptrlock); read_unlock(&bond->ptrlock);
} }
...@@ -2731,8 +2707,9 @@ static void activebackup_arp_monitor(struct net_device *master) ...@@ -2731,8 +2707,9 @@ static void activebackup_arp_monitor(struct net_device *master)
if (slave->link_failure_count < UINT_MAX) { if (slave->link_failure_count < UINT_MAX) {
slave->link_failure_count++; slave->link_failure_count++;
} }
printk(KERN_INFO "%s: link status down for " printk(KERN_INFO DRV_NAME
"active interface %s, disabling it", ": %s: link status down for active interface "
"%s, disabling it",
master->name, master->name,
slave->dev->name); slave->dev->name);
write_lock(&bond->ptrlock); write_lock(&bond->ptrlock);
...@@ -2748,8 +2725,8 @@ static void activebackup_arp_monitor(struct net_device *master) ...@@ -2748,8 +2725,8 @@ static void activebackup_arp_monitor(struct net_device *master)
(bond->primary_slave != slave) && (bond->primary_slave != slave) &&
(bond->primary_slave->link == BOND_LINK_UP)) { (bond->primary_slave->link == BOND_LINK_UP)) {
/* at this point, slave is the current_slave */ /* at this point, slave is the current_slave */
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: changing from interface %s to primary " ": %s: changing from interface %s to primary "
"interface %s\n", "interface %s\n",
master->name, master->name,
slave->dev->name, slave->dev->name,
...@@ -2814,11 +2791,11 @@ static void activebackup_arp_monitor(struct net_device *master) ...@@ -2814,11 +2791,11 @@ static void activebackup_arp_monitor(struct net_device *master)
} }
bond_set_slave_inactive_flags(slave); bond_set_slave_inactive_flags(slave);
printk(KERN_INFO printk(KERN_INFO DRV_NAME
"%s: backup interface " ": %s: backup interface %s is "
"%s is now down.\n", "now down.\n",
master->name, master->name,
slave->dev->name); slave->dev->name);
} }
} while ((slave = slave->next) != } while ((slave = slave->next) !=
bond->current_arp_slave->next); bond->current_arp_slave->next);
...@@ -2831,11 +2808,9 @@ static void activebackup_arp_monitor(struct net_device *master) ...@@ -2831,11 +2808,9 @@ static void activebackup_arp_monitor(struct net_device *master)
static int bond_sethwaddr(struct net_device *master, struct net_device *slave) static int bond_sethwaddr(struct net_device *master, struct net_device *slave)
{ {
#ifdef BONDING_DEBUG dprintk("master=%p\n", master);
printk(KERN_CRIT "bond_sethwaddr: master=%x\n", (unsigned int)master); dprintk("slave=%p\n", slave);
printk(KERN_CRIT "bond_sethwaddr: slave=%x\n", (unsigned int)slave); dprintk("slave->addr_len=%d\n", slave->addr_len);
printk(KERN_CRIT "bond_sethwaddr: slave->addr_len=%d\n", slave->addr_len);
#endif
memcpy(master->dev_addr, slave->dev_addr, slave->addr_len); memcpy(master->dev_addr, slave->dev_addr, slave->addr_len);
return 0; return 0;
} }
...@@ -2913,9 +2888,9 @@ static int bond_ethtool_ioctl(struct net_device *master_dev, struct ifreq *ifr) ...@@ -2913,9 +2888,9 @@ static int bond_ethtool_ioctl(struct net_device *master_dev, struct ifreq *ifr)
new_abi_ver = simple_strtoul(info.fw_version, new_abi_ver = simple_strtoul(info.fw_version,
&endptr, 0); &endptr, 0);
if (*endptr) { if (*endptr) {
printk(KERN_ERR printk(KERN_ERR DRV_NAME
"bonding: Error: got invalid ABI" ": Error: got invalid ABI "
" version from application\n"); "version from application\n");
return -EINVAL; return -EINVAL;
} }
...@@ -2951,10 +2926,8 @@ static int bond_ioctl(struct net_device *master_dev, struct ifreq *ifr, int cmd) ...@@ -2951,10 +2926,8 @@ static int bond_ioctl(struct net_device *master_dev, struct ifreq *ifr, int cmd)
int prev_abi_ver = orig_app_abi_ver; int prev_abi_ver = orig_app_abi_ver;
int ret = 0; int ret = 0;
#ifdef BONDING_DEBUG dprintk("bond_ioctl: master=%s, cmd=%d\n",
printk(KERN_INFO "bond_ioctl: master=%s, cmd=%d\n",
master_dev->name, cmd); master_dev->name, cmd);
#endif
switch (cmd) { switch (cmd) {
case SIOCETHTOOL: case SIOCETHTOOL:
...@@ -3020,24 +2993,22 @@ static int bond_ioctl(struct net_device *master_dev, struct ifreq *ifr, int cmd) ...@@ -3020,24 +2993,22 @@ static int bond_ioctl(struct net_device *master_dev, struct ifreq *ifr, int cmd)
orig_app_abi_ver = app_abi_ver; orig_app_abi_ver = app_abi_ver;
} else if (orig_app_abi_ver != app_abi_ver) { } else if (orig_app_abi_ver != app_abi_ver) {
printk(KERN_ERR printk(KERN_ERR DRV_NAME
"bonding: Error: already using ifenslave ABI " ": Error: already using ifenslave ABI version %d; to "
"version %d; to upgrade ifenslave to version %d, " "upgrade ifenslave to version %d, you must first "
"you must first reload bonding.\n", "reload bonding.\n",
orig_app_abi_ver, app_abi_ver); orig_app_abi_ver, app_abi_ver);
return -EINVAL; return -EINVAL;
} }
slave_dev = dev_get_by_name(ifr->ifr_slave); slave_dev = dev_get_by_name(ifr->ifr_slave);
#ifdef BONDING_DEBUG dprintk("slave_dev=%p: \n", slave_dev);
printk(KERN_INFO "slave_dev=%x: \n", (unsigned int)slave_dev);
printk(KERN_INFO "slave_dev->name=%s: \n", slave_dev->name);
#endif
if (slave_dev == NULL) { if (slave_dev == NULL) {
ret = -ENODEV; ret = -ENODEV;
} else { } else {
dprintk("slave_dev->name=%s: \n", slave_dev->name);
switch (cmd) { switch (cmd) {
case BOND_ENSLAVE_OLD: case BOND_ENSLAVE_OLD:
case SIOCBONDENSLAVE: case SIOCBONDENSLAVE:
...@@ -3118,7 +3089,9 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *dev) ...@@ -3118,7 +3089,9 @@ static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *dev)
if (device_we_should_send_to) { if (device_we_should_send_to) {
struct sk_buff *skb2; struct sk_buff *skb2;
if ((skb2 = skb_clone(skb, GFP_ATOMIC)) == NULL) { if ((skb2 = skb_clone(skb, GFP_ATOMIC)) == NULL) {
printk(KERN_ERR "bond_xmit_broadcast: skb_clone() failed\n"); printk(KERN_ERR DRV_NAME
": Error: bond_xmit_broadcast(): "
"skb_clone() failed\n");
continue; continue;
} }
...@@ -3308,9 +3281,7 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *dev) ...@@ -3308,9 +3281,7 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *dev)
} }
/* no suitable interface, frame not sent */ /* no suitable interface, frame not sent */
#ifdef BONDING_DEBUG dprintk("There was no suitable interface, so we don't transmit\n");
printk(KERN_INFO "There was no suitable interface, so we don't transmit\n");
#endif
dev_kfree_skb(skb); dev_kfree_skb(skb);
read_unlock(&bond->lock); read_unlock(&bond->lock);
return 0; return 0;
...@@ -3551,9 +3522,9 @@ static int bond_create_proc_info(struct bonding *bond) ...@@ -3551,9 +3522,9 @@ static int bond_create_proc_info(struct bonding *bond)
S_IRUGO, S_IRUGO,
bond_proc_dir); bond_proc_dir);
if (bond->bond_proc_file == NULL) { if (bond->bond_proc_file == NULL) {
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"%s: Cannot create /proc/net/bonding/%s\n", ": Warning: Cannot create /proc/net/bonding/%s\n",
dev->name, dev->name); dev->name);
} else { } else {
bond->bond_proc_file->data = bond; bond->bond_proc_file->data = bond;
bond->bond_proc_file->proc_fops = &bond_info_fops; bond->bond_proc_file->proc_fops = &bond_info_fops;
...@@ -3646,8 +3617,7 @@ bond_set_mac_address(struct net_device *dev, void *addr) ...@@ -3646,8 +3617,7 @@ bond_set_mac_address(struct net_device *dev, void *addr)
struct slave *slave; struct slave *slave;
int error; int error;
dprintk(KERN_INFO "bond_set_mac_address %p %s\n", dev, dprintk("bond=%p, name=%s\n", bond, (bond_dev ? bond_dev->name : "None"));
dev->name);
if (!is_valid_ether_addr(sa->sa_data)) { if (!is_valid_ether_addr(sa->sa_data)) {
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
...@@ -3655,12 +3625,10 @@ bond_set_mac_address(struct net_device *dev, void *addr) ...@@ -3655,12 +3625,10 @@ bond_set_mac_address(struct net_device *dev, void *addr)
for (slave = bond->prev; slave != (struct slave *)bond; for (slave = bond->prev; slave != (struct slave *)bond;
slave = slave->prev) { slave = slave->prev) {
dprintk(KERN_INFO "bond_set_mac: slave %p %s\n", slave, dprintk("slave %p %s\n", slave, slave->dev->name);
slave->dev->name);
if (slave->dev->set_mac_address == NULL) { if (slave->dev->set_mac_address == NULL) {
error = -EOPNOTSUPP; error = -EOPNOTSUPP;
dprintk(KERN_INFO "bond_set_mac EOPNOTSUPP %s\n", dprintk("EOPNOTSUPP %s\n", slave->dev->name);
slave->dev->name);
goto unwind; goto unwind;
} }
...@@ -3672,8 +3640,7 @@ bond_set_mac_address(struct net_device *dev, void *addr) ...@@ -3672,8 +3640,7 @@ bond_set_mac_address(struct net_device *dev, void *addr)
* breakage anyway until ARP finish * breakage anyway until ARP finish
* updating, so... * updating, so...
*/ */
dprintk(KERN_INFO "bond_set_mac err %d %s\n", dprintk("err %d %s\n", error, slave->dev->name);
error, slave->dev->name);
goto unwind; goto unwind;
} }
} }
...@@ -3692,9 +3659,8 @@ bond_set_mac_address(struct net_device *dev, void *addr) ...@@ -3692,9 +3659,8 @@ bond_set_mac_address(struct net_device *dev, void *addr)
tmp_error = slave->dev->set_mac_address(slave->dev, &tmp_sa); tmp_error = slave->dev->set_mac_address(slave->dev, &tmp_sa);
if (tmp_error) { if (tmp_error) {
dprintk(KERN_INFO "bond_set_mac_address: " dprintk("unwind err %d dev %s\n", tmp_error,
"unwind err %d dev %s\n", slave->dev->name);
tmp_error, slave->dev->name);
} }
} }
...@@ -3711,10 +3677,12 @@ bond_change_mtu(struct net_device *dev, int newmtu) ...@@ -3711,10 +3677,12 @@ bond_change_mtu(struct net_device *dev, int newmtu)
slave_t *slave; slave_t *slave;
int error; int error;
dprintk(KERN_INFO "CM: b %p nm %d\n", bond, newmtu); dprintk("bond=%p, name=%s, new_mtu=%d\n", bond,
(bond_dev ? bond_dev->name : "None"), new_mtu);
for (slave = bond->prev; slave != (slave_t *)bond; for (slave = bond->prev; slave != (slave_t *)bond;
slave = slave->prev) { slave = slave->prev) {
dprintk(KERN_INFO "CM: s %p s->p %p c_m %p\n", slave, dprintk("s %p s->p %p c_m %p\n", slave,
slave->prev, slave->dev->change_mtu); slave->prev, slave->dev->change_mtu);
if (slave->dev->change_mtu) { if (slave->dev->change_mtu) {
error = slave->dev->change_mtu(slave->dev, newmtu); error = slave->dev->change_mtu(slave->dev, newmtu);
...@@ -3732,8 +3700,7 @@ bond_change_mtu(struct net_device *dev, int newmtu) ...@@ -3732,8 +3700,7 @@ bond_change_mtu(struct net_device *dev, int newmtu)
* means changing their mtu from timer context, which * means changing their mtu from timer context, which
* is probably not a good idea. * is probably not a good idea.
*/ */
dprintk(KERN_INFO "bond_change_mtu err %d %s\n", dprintk("err %d %s\n", error, slave->dev->name);
error, slave->dev->name);
goto unwind; goto unwind;
} }
} }
...@@ -3861,8 +3828,7 @@ static int bond_netdev_event(struct notifier_block *this, unsigned long event, v ...@@ -3861,8 +3828,7 @@ static int bond_netdev_event(struct notifier_block *this, unsigned long event, v
unsigned short flags; unsigned short flags;
int res = NOTIFY_DONE; int res = NOTIFY_DONE;
dprintk(KERN_INFO "bond_netdev_event n_b %p ev %lx ptr %p\n", dprintk("n_b %p ev %lx ptr %p\n", this, event, ptr);
this, event, ptr);
flags = event_dev->flags & (IFF_MASTER | IFF_SLAVE); flags = event_dev->flags & (IFF_MASTER | IFF_SLAVE);
switch (flags) { switch (flags) {
...@@ -3926,9 +3892,8 @@ static int __init bond_init(struct net_device *dev) ...@@ -3926,9 +3892,8 @@ static int __init bond_init(struct net_device *dev)
struct bonding *bond; struct bonding *bond;
int count; int count;
#ifdef BONDING_DEBUG dprintk("Begin bond_init for %s\n", dev->name);
printk (KERN_INFO "Begin bond_init for %s\n", dev->name);
#endif
bond = dev->priv; bond = dev->priv;
/* initialize rwlocks */ /* initialize rwlocks */
...@@ -3966,7 +3931,9 @@ static int __init bond_init(struct net_device *dev) ...@@ -3966,7 +3931,9 @@ static int __init bond_init(struct net_device *dev)
dev->set_mac_address = bond_alb_set_mac_address; dev->set_mac_address = bond_alb_set_mac_address;
break; break;
default: default:
printk(KERN_ERR "Unknown bonding mode %d\n", bond_mode); printk(KERN_ERR DRV_NAME
": Error: Unknown bonding mode %d\n",
bond_mode);
return -EINVAL; return -EINVAL;
} }
...@@ -3982,7 +3949,7 @@ static int __init bond_init(struct net_device *dev) ...@@ -3982,7 +3949,7 @@ static int __init bond_init(struct net_device *dev)
dev->accept_fastpath = bond_accept_fastpath; dev->accept_fastpath = bond_accept_fastpath;
#endif #endif
printk(KERN_INFO "%s registered with", dev->name); printk(KERN_INFO DRV_NAME ": %s registered with", dev->name);
if (miimon > 0) { if (miimon > 0) {
printk(" MII link monitoring set to %d ms", miimon); printk(" MII link monitoring set to %d ms", miimon);
updelay /= miimon; updelay /= miimon;
...@@ -3992,12 +3959,12 @@ static int __init bond_init(struct net_device *dev) ...@@ -3992,12 +3959,12 @@ static int __init bond_init(struct net_device *dev)
} }
printk(", in %s mode.\n", bond_mode_name()); printk(", in %s mode.\n", bond_mode_name());
printk(KERN_INFO "%s registered with", dev->name); printk(KERN_INFO DRV_NAME ": %s registered with", dev->name);
if (arp_interval > 0) { if (arp_interval > 0) {
printk(" ARP monitoring set to %d ms with %d target(s):", printk(" ARP monitoring set to %d ms with %d target(s):",
arp_interval, arp_ip_count); arp_interval, arp_ip_count);
for (count=0 ; count<arp_ip_count ; count++) for (count=0 ; count<arp_ip_count ; count++)
printk (" %s", arp_ip_target[count]); printk(" %s", arp_ip_target[count]);
printk("\n"); printk("\n");
} else { } else {
printk("out ARP monitoring\n"); printk("out ARP monitoring\n");
...@@ -4057,8 +4024,8 @@ static int __init bonding_init(void) ...@@ -4057,8 +4024,8 @@ static int __init bonding_init(void)
if (mode) { if (mode) {
bond_mode = bond_parse_parm(mode, bond_mode_tbl); bond_mode = bond_parse_parm(mode, bond_mode_tbl);
if (bond_mode == -1) { if (bond_mode == -1) {
printk(KERN_WARNING printk(KERN_ERR DRV_NAME
"bonding_init(): Invalid bonding mode \"%s\"\n", ": Error: Invalid bonding mode \"%s\"\n",
mode == NULL ? "NULL" : mode); mode == NULL ? "NULL" : mode);
return -EINVAL; return -EINVAL;
} }
...@@ -4073,8 +4040,8 @@ static int __init bonding_init(void) ...@@ -4073,8 +4040,8 @@ static int __init bonding_init(void)
if (multicast) { if (multicast) {
multicast_mode = bond_parse_parm(multicast, bond_mc_tbl); multicast_mode = bond_parse_parm(multicast, bond_mc_tbl);
if (multicast_mode == -1) { if (multicast_mode == -1) {
printk(KERN_WARNING printk(KERN_ERR DRV_NAME
"bonding_init(): Invalid multicast mode \"%s\"\n", ": Error: Invalid multicast mode \"%s\"\n",
multicast == NULL ? "NULL" : multicast); multicast == NULL ? "NULL" : multicast);
return -EINVAL; return -EINVAL;
} }
...@@ -4082,15 +4049,14 @@ static int __init bonding_init(void) ...@@ -4082,15 +4049,14 @@ static int __init bonding_init(void)
if (lacp_rate) { if (lacp_rate) {
if (bond_mode != BOND_MODE_8023AD) { if (bond_mode != BOND_MODE_8023AD) {
printk(KERN_WARNING printk(KERN_INFO DRV_NAME
"lacp_rate param is irrelevant in mode %s\n", ": lacp_rate param is irrelevant in mode %s\n",
bond_mode_name()); bond_mode_name());
} else { } else {
lacp_fast = bond_parse_parm(lacp_rate, bond_lacp_tbl); lacp_fast = bond_parse_parm(lacp_rate, bond_lacp_tbl);
if (lacp_fast == -1) { if (lacp_fast == -1) {
printk(KERN_WARNING printk(KERN_ERR DRV_NAME
"bonding_init(): Invalid lacp rate " ": Error: Invalid lacp rate \"%s\"\n",
"\"%s\"\n",
lacp_rate == NULL ? "NULL" : lacp_rate); lacp_rate == NULL ? "NULL" : lacp_rate);
return -EINVAL; return -EINVAL;
...@@ -4099,32 +4065,32 @@ static int __init bonding_init(void) ...@@ -4099,32 +4065,32 @@ static int __init bonding_init(void)
} }
if (max_bonds < 1 || max_bonds > INT_MAX) { if (max_bonds < 1 || max_bonds > INT_MAX) {
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bonding_init(): max_bonds (%d) not in range %d-%d, " ": Warning: max_bonds (%d) not in range %d-%d, so it "
"so it was reset to BOND_DEFAULT_MAX_BONDS (%d)", "was reset to BOND_DEFAULT_MAX_BONDS (%d)",
max_bonds, 1, INT_MAX, BOND_DEFAULT_MAX_BONDS); max_bonds, 1, INT_MAX, BOND_DEFAULT_MAX_BONDS);
max_bonds = BOND_DEFAULT_MAX_BONDS; max_bonds = BOND_DEFAULT_MAX_BONDS;
} }
if (miimon < 0) { if (miimon < 0) {
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bonding_init(): miimon module parameter (%d), " ": Warning: miimon module parameter (%d), "
"not in range 0-%d, so it was reset to %d\n", "not in range 0-%d, so it was reset to %d\n",
miimon, INT_MAX, BOND_LINK_MON_INTERV); miimon, INT_MAX, BOND_LINK_MON_INTERV);
miimon = BOND_LINK_MON_INTERV; miimon = BOND_LINK_MON_INTERV;
} }
if (updelay < 0) { if (updelay < 0) {
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bonding_init(): updelay module parameter (%d), " ": Warning: updelay module parameter (%d), "
"not in range 0-%d, so it was reset to 0\n", "not in range 0-%d, so it was reset to 0\n",
updelay, INT_MAX); updelay, INT_MAX);
updelay = 0; updelay = 0;
} }
if (downdelay < 0) { if (downdelay < 0) {
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bonding_init(): downdelay module parameter (%d), " ": Warning: downdelay module parameter (%d), "
"not in range 0-%d, so it was reset to 0\n", "not in range 0-%d, so it was reset to 0\n",
downdelay, INT_MAX); downdelay, INT_MAX);
downdelay = 0; downdelay = 0;
...@@ -4133,27 +4099,28 @@ static int __init bonding_init(void) ...@@ -4133,27 +4099,28 @@ static int __init bonding_init(void)
/* reset values for 802.3ad */ /* reset values for 802.3ad */
if (bond_mode == BOND_MODE_8023AD) { if (bond_mode == BOND_MODE_8023AD) {
if (arp_interval != 0) { if (arp_interval != 0) {
printk(KERN_WARNING "bonding_init(): ARP monitoring" printk(KERN_WARNING DRV_NAME
"can't be used simultaneously with 802.3ad, " ": Warning: ARP monitoring can't be used "
"disabling ARP monitoring\n"); "simultaneously with 802.3ad, disabling ARP "
"monitoring\n");
arp_interval = 0; arp_interval = 0;
} }
if (miimon == 0) { if (miimon == 0) {
printk(KERN_ERR printk(KERN_WARNING DRV_NAME
"bonding_init(): miimon must be specified, " ": Warning: miimon must be specified, "
"otherwise bonding will not detect link failure, " "otherwise bonding will not detect link "
"speed and duplex which are essential " "failure, speed and duplex which are "
"for 802.3ad operation\n"); "essential for 802.3ad operation\n");
printk(KERN_ERR "Forcing miimon to 100msec\n"); printk(KERN_WARNING "Forcing miimon to 100msec\n");
miimon = 100; miimon = 100;
} }
if (multicast_mode != BOND_MULTICAST_ALL) { if (multicast_mode != BOND_MULTICAST_ALL) {
printk(KERN_ERR printk(KERN_WARNING DRV_NAME
"bonding_init(): Multicast mode must " ": Warning: Multicast mode must be set to ALL "
"be set to ALL for 802.3ad\n"); "for 802.3ad\n");
printk(KERN_ERR "Forcing Multicast mode to ALL\n"); printk(KERN_WARNING "Forcing Multicast mode to ALL\n");
multicast_mode = BOND_MULTICAST_ALL; multicast_mode = BOND_MULTICAST_ALL;
} }
} }
...@@ -4162,30 +4129,33 @@ static int __init bonding_init(void) ...@@ -4162,30 +4129,33 @@ static int __init bonding_init(void)
if ((bond_mode == BOND_MODE_TLB) || if ((bond_mode == BOND_MODE_TLB) ||
(bond_mode == BOND_MODE_ALB)) { (bond_mode == BOND_MODE_ALB)) {
if (miimon == 0) { if (miimon == 0) {
printk(KERN_ERR printk(KERN_WARNING DRV_NAME
"bonding_init(): miimon must be specified, " ": Warning: miimon must be specified, "
"otherwise bonding will not detect link failure " "otherwise bonding will not detect link "
"and link speed which are essential " "failure and link speed which are essential "
"for TLB/ALB load balancing\n"); "for TLB/ALB load balancing\n");
printk(KERN_ERR "Forcing miimon to 100msec\n"); printk(KERN_WARNING "Forcing miimon to 100msec\n");
miimon = 100; miimon = 100;
} }
if (multicast_mode != BOND_MULTICAST_ACTIVE) { if (multicast_mode != BOND_MULTICAST_ACTIVE) {
printk(KERN_ERR printk(KERN_WARNING DRV_NAME
"bonding_init(): Multicast mode must " ": Warning: Multicast mode must be set to "
"be set to ACTIVE for TLB/ALB\n"); "ACTIVE for TLB/ALB\n");
printk(KERN_ERR "Forcing Multicast mode to ACTIVE\n"); printk(KERN_WARNING "Forcing Multicast mode to "
"ACTIVE\n");
multicast_mode = BOND_MULTICAST_ACTIVE; multicast_mode = BOND_MULTICAST_ACTIVE;
} }
} }
if (bond_mode == BOND_MODE_ALB) { if (bond_mode == BOND_MODE_ALB) {
printk(KERN_INFO printk(KERN_NOTICE DRV_NAME
"In ALB mode you might experience client disconnections" ": In ALB mode you might experience client "
" upon reconnection of a link if the bonding module" "disconnections upon reconnection of a link if the "
" updelay parameter (%d msec) is incompatible with the" "bonding module updelay parameter (%d msec) is "
" forwarding delay time of the switch\n", updelay); "incompatible with the forwarding delay time of the "
"switch\n",
updelay);
} }
if (miimon == 0) { if (miimon == 0) {
...@@ -4193,21 +4163,21 @@ static int __init bonding_init(void) ...@@ -4193,21 +4163,21 @@ static int __init bonding_init(void)
/* just warn the user the up/down delay will have /* just warn the user the up/down delay will have
* no effect since miimon is zero... * no effect since miimon is zero...
*/ */
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bonding_init(): miimon module parameter not " ": Warning: miimon module parameter not set "
"set and updelay (%d) or downdelay (%d) module " "and updelay (%d) or downdelay (%d) module "
"parameter is set; updelay and downdelay have " "parameter is set; updelay and downdelay have "
"no effect unless miimon is set\n", "no effect unless miimon is set\n",
updelay, downdelay); updelay, downdelay);
} }
} else { } else {
/* don't allow arp monitoring */ /* don't allow arp monitoring */
if (arp_interval != 0) { if (arp_interval != 0) {
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bonding_init(): miimon (%d) and arp_interval " ": Warning: miimon (%d) and arp_interval (%d) "
"(%d) can't be used simultaneously, " "can't be used simultaneously, disabling ARP "
"disabling ARP monitoring\n", "monitoring\n",
miimon, arp_interval); miimon, arp_interval);
arp_interval = 0; arp_interval = 0;
} }
...@@ -4215,29 +4185,28 @@ static int __init bonding_init(void) ...@@ -4215,29 +4185,28 @@ static int __init bonding_init(void)
/* updelay will be rounded in bond_init() when it /* updelay will be rounded in bond_init() when it
* is divided by miimon, we just inform user here * is divided by miimon, we just inform user here
*/ */
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bonding_init(): updelay (%d) is not a multiple " ": Warning: updelay (%d) is not a multiple "
"of miimon (%d), updelay rounded to %d ms\n", "of miimon (%d), updelay rounded to %d ms\n",
updelay, miimon, (updelay / miimon) * miimon); updelay, miimon, (updelay / miimon) * miimon);
} }
if ((downdelay % miimon) != 0) { if ((downdelay % miimon) != 0) {
/* downdelay will be rounded in bond_init() when it /* downdelay will be rounded in bond_init() when it
* is divided by miimon, we just inform user here * is divided by miimon, we just inform user here
*/ */
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bonding_init(): downdelay (%d) is not a " ": Warning: downdelay (%d) is not a multiple "
"multiple of miimon (%d), downdelay rounded " "of miimon (%d), downdelay rounded to %d ms\n",
"to %d ms\n", downdelay, miimon,
downdelay, miimon,
(downdelay / miimon) * miimon); (downdelay / miimon) * miimon);
} }
} }
if (arp_interval < 0) { if (arp_interval < 0) {
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bonding_init(): arp_interval module parameter (%d), " ": Warning: arp_interval module parameter (%d) "
"not in range 0-%d, so it was reset to %d\n", ", not in range 0-%d, so it was reset to %d\n",
arp_interval, INT_MAX, BOND_LINK_ARP_INTERV); arp_interval, INT_MAX, BOND_LINK_ARP_INTERV);
arp_interval = BOND_LINK_ARP_INTERV; arp_interval = BOND_LINK_ARP_INTERV;
} }
...@@ -4248,12 +4217,11 @@ static int __init bonding_init(void) ...@@ -4248,12 +4217,11 @@ static int __init bonding_init(void)
/* not complete check, but should be good enough to /* not complete check, but should be good enough to
catch mistakes */ catch mistakes */
if (!isdigit(arp_ip_target[arp_ip_count][0])) { if (!isdigit(arp_ip_target[arp_ip_count][0])) {
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bonding_init(): bad arp_ip_target module " ": Warning: bad arp_ip_target module parameter "
"parameter (%s), ARP monitoring will not be " "(%s), ARP monitoring will not be performed\n",
"performed\n", arp_ip_target[arp_ip_count]);
arp_ip_target[arp_ip_count]); arp_interval = 0;
arp_interval = 0;
} else { } else {
u32 ip = in_aton(arp_ip_target[arp_ip_count]); u32 ip = in_aton(arp_ip_target[arp_ip_count]);
arp_target[arp_ip_count] = ip; arp_target[arp_ip_count] = ip;
...@@ -4263,9 +4231,9 @@ static int __init bonding_init(void) ...@@ -4263,9 +4231,9 @@ static int __init bonding_init(void)
if ( (arp_interval > 0) && (arp_ip_count==0)) { if ( (arp_interval > 0) && (arp_ip_count==0)) {
/* don't allow arping if no arp_ip_target given... */ /* don't allow arping if no arp_ip_target given... */
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bonding_init(): arp_interval module parameter " ": Warning: arp_interval module parameter (%d) "
"(%d) specified without providing an arp_ip_target " "specified without providing an arp_ip_target "
"parameter, arp_interval was reset to 0\n", "parameter, arp_interval was reset to 0\n",
arp_interval); arp_interval);
arp_interval = 0; arp_interval = 0;
...@@ -4275,20 +4243,20 @@ static int __init bonding_init(void) ...@@ -4275,20 +4243,20 @@ static int __init bonding_init(void)
/* miimon and arp_interval not set, we need one so things /* miimon and arp_interval not set, we need one so things
* work as expected, see bonding.txt for details * work as expected, see bonding.txt for details
*/ */
printk(KERN_ERR printk(KERN_WARNING DRV_NAME
"bonding_init(): either miimon or " ": Warning: either miimon or arp_interval and "
"arp_interval and arp_ip_target module parameters " "arp_ip_target module parameters must be specified, "
"must be specified, otherwise bonding will not detect " "otherwise bonding will not detect link failures! see "
"link failures! see bonding.txt for details.\n"); "bonding.txt for details.\n");
} }
if ((primary != NULL) && !USES_PRIMARY(bond_mode)) { if ((primary != NULL) && !USES_PRIMARY(bond_mode)) {
/* currently, using a primary only makes sense /* currently, using a primary only makes sense
* in active backup, TLB or ALB modes * in active backup, TLB or ALB modes
*/ */
printk(KERN_WARNING printk(KERN_WARNING DRV_NAME
"bonding_init(): %s primary device specified but has " ": Warning: %s primary device specified but has no "
"no effect in %s mode\n", "effect in %s mode\n",
primary, bond_mode_name()); primary, bond_mode_name());
primary = NULL; primary = NULL;
} }
......
...@@ -32,18 +32,17 @@ ...@@ -32,18 +32,17 @@
#include "bond_3ad.h" #include "bond_3ad.h"
#include "bond_alb.h" #include "bond_alb.h"
#ifdef BONDING_DEBUG #define DRV_VERSION "2.4.1"
#define DRV_RELDATE "September 15, 2003"
// use this like so: BOND_PRINT_DBG(("foo = %d, bar = %d", foo, bar)); #define DRV_NAME "bonding"
#define BOND_PRINT_DBG(X) \ #define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"
do { \
printk(KERN_DEBUG "%s (%d)", __FUNCTION__, __LINE__); \
printk X; \
printk("\n"); \
} while(0)
#ifdef BONDING_DEBUG
#define dprintk(fmt, args...) \
printk(KERN_DEBUG \
DRV_NAME ": %s() %d: " fmt, __FUNCTION__, __LINE__ , ## args )
#else #else
#define BOND_PRINT_DBG(X) #define dprintk(fmt, args...)
#endif /* BONDING_DEBUG */ #endif /* BONDING_DEBUG */
#define IS_UP(dev) ((((dev)->flags & (IFF_UP)) == (IFF_UP)) && \ #define IS_UP(dev) ((((dev)->flags & (IFF_UP)) == (IFF_UP)) && \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment