diff -Nuarp a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c --- a/drivers/net/bonding/bond_3ad.c Sun Dec 21 16:08:36 2003 +++ b/drivers/net/bonding/bond_3ad.c Sun Dec 21 16:08:37 2003 @@ -49,6 +49,8 @@ * by the slave. */ +//#define BONDING_DEBUG 1 + #include #include #include @@ -392,7 +394,7 @@ static u16 __get_link_speed(struct 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; } @@ -418,12 +420,12 @@ static u8 __get_duplex(struct port *port switch (slave->duplex) { case DUPLEX_FULL: 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; case DUPLEX_HALF: default: 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; } } @@ -1059,7 +1061,7 @@ static void ad_mux_machine(struct port * // check if the state machine was changed 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) { case AD_MUX_DETACHED: __detach_bond_from_agg(port); @@ -1158,7 +1160,7 @@ static void ad_rx_machine(struct lacpdu // check if the State machine was changed or new lacpdu arrived 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) { case AD_RX_INITIALIZE: if (!(port->actor_oper_port_key & AD_DUPLEX_KEY_BITS)) { @@ -1204,7 +1206,7 @@ static void ad_rx_machine(struct lacpdu // detect loopback situation if (!MAC_ADDRESS_COMPARE(&(lacpdu->actor_system), &(port->actor_system))) { // 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); printk(KERN_ERR "Check the configuration to verify that all Adapters " "are connected to 802.3ad compliant switch ports\n"); @@ -1245,7 +1247,7 @@ static void ad_tx_machine(struct port *p __update_lacpdu_from_port(port); // send the lacpdu 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 port->ntt = 0; } @@ -1318,7 +1320,7 @@ static void ad_periodic_machine(struct p // check if the state machine was changed 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) { case AD_NO_PERIODIC: port->sm_periodic_timer_counter = 0; // zero timer @@ -1375,7 +1377,7 @@ static void ad_port_selection_logic(stru port->next_port_in_aggregator=NULL; 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 (!temp_aggregator->lag_ports) { ad_clear_agg(temp_aggregator); @@ -1384,7 +1386,7 @@ static void ad_port_selection_logic(stru } } 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", port->actor_port_number, port->slave->dev->name, port->aggregator->aggregator_identifier); @@ -1417,7 +1419,7 @@ static void ad_port_selection_logic(stru port->next_port_in_aggregator=aggregator->lag_ports; port->aggregator->num_of_ports++; 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 port->sm_vars |= AD_PORT_SELECTED; @@ -1454,9 +1456,9 @@ static void ad_port_selection_logic(stru // mark this port as 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 { - 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); } } @@ -1580,30 +1582,30 @@ static void ad_agg_selection_logic(struc 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->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 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"); } // check if there are more than one aggregator if (num_of_aggs > 1) { - BOND_PRINT_DBG(("Warning: More than one Link Aggregation Group was " - "found in the bond. Only one group will function in the bond")); + dprintk("Warning: More than one Link Aggregation Group was " + "found in the bond. Only one group will function in the bond\n"); } best_aggregator->is_active = 1; - BOND_PRINT_DBG(("LAG %d choosed as the active LAG", best_aggregator->aggregator_identifier)); - BOND_PRINT_DBG(("Agg=%d; Ports=%d; a key=%d; p key=%d; Indiv=%d; Active=%d", + dprintk("LAG %d choosed as the active LAG\n", best_aggregator->aggregator_identifier); + 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->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 if (last_active_aggregator) { @@ -1644,7 +1646,7 @@ static void ad_clear_agg(struct aggregat aggregator->lag_ports = NULL; aggregator->is_active = 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 po static void ad_enable_collecting_distributing(struct port *port) { 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); } } @@ -1742,7 +1744,7 @@ static void ad_enable_collecting_distrib static void ad_disable_collecting_distributing(struct port *port) { 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); } } @@ -1780,7 +1782,7 @@ static void ad_marker_info_send(struct p // send the marker information 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 @@ -1803,7 +1805,7 @@ static void ad_marker_info_received(stru // send the marker response 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 *sl struct aggregator *aggregator; 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; } @@ -1996,11 +1998,11 @@ void bond_3ad_unbind_slave(struct slave // if slave is null, the whole port is not initialized 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; } - 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 */ port->actor_oper_port_state &= ~AD_STATE_AGGREGATION; @@ -2024,10 +2026,10 @@ void bond_3ad_unbind_slave(struct slave // 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))) { - 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) { - 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_agg = 1; } @@ -2057,7 +2059,7 @@ void bond_3ad_unbind_slave(struct slave ad_agg_selection_logic(__get_first_agg(port)); } } 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"); } } 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 } } - 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 temp_aggregator = __get_first_agg(port); for (; temp_aggregator; temp_aggregator = __get_next_agg(temp_aggregator)) { @@ -2137,7 +2139,7 @@ void bond_3ad_state_machine_handler(stru // select the active aggregator for the bond if ((port = __get_first_port(bond))) { 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; } @@ -2149,7 +2151,7 @@ void bond_3ad_state_machine_handler(stru // for each port run the state machines for (port = __get_first_port(bond); port; port = __get_next_port(port)) { 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; } @@ -2194,14 +2196,14 @@ void bond_3ad_rx_indication(struct lacpd port = &(SLAVE_AD_INFO(slave).port); 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; } switch (lacpdu->subtype) { case AD_TYPE_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); break; @@ -2210,17 +2212,17 @@ void bond_3ad_rx_indication(struct lacpd switch (((struct marker *)lacpdu)->tlv_type) { 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); break; 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); break; 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(stru // if slave is null, the whole port is not initialized 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); return; } port->actor_admin_port_key &= ~AD_SPEED_KEY_BITS; 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 // state machines to reinitialize port->sm_vars |= AD_PORT_BEGIN; @@ -2267,14 +2269,14 @@ void bond_3ad_adapter_duplex_changed(str // if slave is null, the whole port is not initialized 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); return; } port->actor_admin_port_key &= ~AD_DUPLEX_KEY_BITS; 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 // state machines to reinitialize port->sm_vars |= AD_PORT_BEGIN; @@ -2295,10 +2297,8 @@ void bond_3ad_handle_link_change(struct // if slave is null, the whole port is not initialized if (!port->slave) { -#ifdef BONDING_DEBUG - printk(KERN_WARNING "bonding: Warning: link status changed for uninitialized port on %s\n", - slave->dev->name); -#endif + printk(KERN_WARNING DRV_NAME ": Warning: link status changed for uninitialized port on %s\n", + slave->dev->name); return; } @@ -2370,7 +2370,7 @@ int bond_3ad_xmit_xor(struct sk_buff *sk } 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); return 0; } @@ -2380,7 +2380,7 @@ int bond_3ad_xmit_xor(struct sk_buff *sk /* check if bond is empty */ 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); read_unlock(&bond->lock); return 0; @@ -2425,7 +2425,7 @@ int bond_3ad_xmit_xor(struct sk_buff *sk slave = slave->prev; 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); read_unlock(&bond->lock); return 0; @@ -2433,7 +2433,7 @@ int bond_3ad_xmit_xor(struct sk_buff *sk } 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); read_unlock(&bond->lock); return 0; @@ -2446,7 +2446,7 @@ int bond_3ad_xmit_xor(struct sk_buff *sk struct aggregator *agg; 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); read_unlock(&bond->lock); return 0; diff -Nuarp a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c --- a/drivers/net/bonding/bond_alb.c Sun Dec 21 16:08:36 2003 +++ b/drivers/net/bonding/bond_alb.c Sun Dec 21 16:08:37 2003 @@ -30,6 +30,8 @@ * handling required for ALB/TLB. */ +//#define BONDING_DEBUG 1 + #include #include #include @@ -212,8 +214,9 @@ tlb_initialize(struct bonding *bond) _lock_tx_hashtbl(bond); if (bond_info->tx_hashtbl != NULL) { - printk (KERN_ERR "%s: TLB hash table is not NULL\n", - bond->device->name); + printk(KERN_ERR DRV_NAME + ": Error: %s: TLB hash table is not NULL\n", + bond->device->name); _unlock_tx_hashtbl(bond); return -1; } @@ -221,8 +224,9 @@ tlb_initialize(struct bonding *bond) size = TLB_HASH_TABLE_SIZE * sizeof(struct tlb_client_info); bond_info->tx_hashtbl = kmalloc(size, GFP_KERNEL); if (bond_info->tx_hashtbl == NULL) { - printk (KERN_ERR "%s: Failed to allocate TLB hash table\n", - bond->device->name); + printk(KERN_ERR DRV_NAME + ": Error: %s: Failed to allocate TLB hash table\n", + bond->device->name); _unlock_tx_hashtbl(bond); return -1; } @@ -306,8 +310,9 @@ tlb_choose_channel(struct bonding *bond, hash_table = bond_info->tx_hashtbl; if (hash_table == NULL) { - printk (KERN_ERR "%s: TLB hash table is NULL\n", - bond->device->name); + printk(KERN_ERR DRV_NAME + ": Error: %s: TLB hash table is NULL\n", + bond->device->name); _unlock_tx_hashtbl(bond); return NULL; } @@ -403,19 +408,19 @@ rlb_arp_recv(struct sk_buff *skb, } if (!arp) { - printk(KERN_ERR "Packet has no ARP data\n"); + dprintk("Packet has no ARP data\n"); goto out; } 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; } if (arp->op_code == htons(ARPOP_REPLY)) { /* update rx hash table for this 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; @@ -653,8 +658,9 @@ rlb_req_update_subnet_clients(struct bon client_info = &(bond_info->rx_hashtbl[hash_index]); if (!client_info->slave) { - printk(KERN_ERR "Bonding: Error: found a client with no" - " channel in the client's hash table\n"); + printk(KERN_ERR DRV_NAME + ": Error: found a client with no channel in " + "the client's hash table\n"); continue; } /*update all clients using this src_ip, that are not assigned @@ -776,7 +782,7 @@ rlb_arp_xmit(struct sk_buff *skb, struct if (tx_slave) { 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)) { /* Create an entry in the rx_hashtbl for this client as a @@ -797,7 +803,7 @@ rlb_arp_xmit(struct sk_buff *skb, struct * updated with their assigned mac. */ 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; @@ -860,8 +866,9 @@ rlb_initialize(struct bonding *bond) _lock_rx_hashtbl(bond); if (bond_info->rx_hashtbl != NULL) { - printk (KERN_ERR "%s: RLB hash table is not NULL\n", - bond->device->name); + printk(KERN_ERR DRV_NAME + ": Error: %s: RLB hash table is not NULL\n", + bond->device->name); _unlock_rx_hashtbl(bond); return -1; } @@ -869,8 +876,9 @@ rlb_initialize(struct bonding *bond) size = RLB_HASH_TABLE_SIZE * sizeof(struct rlb_client_info); bond_info->rx_hashtbl = kmalloc(size, GFP_KERNEL); if (bond_info->rx_hashtbl == NULL) { - printk (KERN_ERR "%s: Failed to allocate" - " RLB hash table\n", bond->device->name); + printk(KERN_ERR DRV_NAME + ": Error: %s: Failed to allocate RLB hash table\n", + bond->device->name); _unlock_rx_hashtbl(bond); return -1; } @@ -969,12 +977,12 @@ alb_set_slave_mac_addr(struct slave *sla memcpy(s_addr.sa_data, addr, dev->addr_len); s_addr.sa_family = dev->type; if (dev->set_mac_address(dev, &s_addr)) { - printk(KERN_DEBUG "bonding: Error: alb_set_slave_mac_addr:" - " dev->set_mac_address of dev %s failed!" - " ALB mode requires that the base driver" - " support setting the hw address also when" - " the network device's interface is open\n", - dev->name); + printk(KERN_ERR DRV_NAME + ": Error: dev->set_mac_address of dev %s failed! ALB " + "mode requires that the base driver support setting " + "the hw address also when the network device's " + "interface is open\n", + dev->name); return -EOPNOTSUPP; } return 0; @@ -1125,9 +1133,10 @@ alb_handle_addr_collision_on_attach(stru /* a slave was found that is using the mac address * of the new slave */ - printk(KERN_ERR "bonding: Warning: the hw address " - "of slave %s is not unique - cannot enslave it!" - , slave->dev->name); + printk(KERN_ERR DRV_NAME + ": Error: the hw address of slave %s is not " + "unique - cannot enslave it!", + slave->dev->name); return -EINVAL; } return 0; @@ -1162,16 +1171,16 @@ alb_handle_addr_collision_on_attach(stru alb_set_slave_mac_addr(slave, tmp_slave1->perm_hwaddr, bond->alb_info.rlb_enabled); - printk(KERN_WARNING "bonding: Warning: the hw address " - "of slave %s is in use by the bond; " - "giving it the hw address of %s\n", + printk(KERN_WARNING DRV_NAME + ": Warning: the hw address of slave %s is in use by " + "the bond; giving it the hw address of %s\n", slave->dev->name, tmp_slave1->dev->name); } else { - printk(KERN_CRIT "bonding: Error: the hw address " - "of slave %s is in use by the bond; " - "couldn't find a slave with a free hw " - "address to give it (this should not have " - "happened)\n", slave->dev->name); + printk(KERN_ERR DRV_NAME + ": Error: the hw address of slave %s is in use by the " + "bond; couldn't find a slave with a free hw address to " + "give it (this should not have happened)\n", + slave->dev->name); return -EFAULT; } diff -Nuarp a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c --- a/drivers/net/bonding/bond_main.c Sun Dec 21 16:08:36 2003 +++ b/drivers/net/bonding/bond_main.c Sun Dec 21 16:08:37 2003 @@ -428,6 +428,8 @@ * Set version to 2.4.1. */ +//#define BONDING_DEBUG 1 + #include #include #include @@ -472,11 +474,6 @@ #include "bond_3ad.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 = DRV_NAME ".c:v" DRV_VERSION " (" DRV_RELDATE ")\n"; @@ -613,15 +610,6 @@ static void reselect_active_interface(st 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) { int i; @@ -722,9 +710,9 @@ bond_detach_slave(bonding_t *bond, slave { if ((bond == NULL) || (slave == NULL) || ((void *)bond == (void *)slave)) { - printk(KERN_ERR - "bond_detach_slave(): trying to detach " - "slave %p from bond %p\n", bond, slave); + printk(KERN_ERR DRV_NAME + ": Error: trying to detach slave %p from bond %p\n", + bond, slave); return slave; } @@ -914,10 +902,7 @@ bond_check_dev_link(struct net_device *d if (etool.data == 1) { return BMSR_LSTATUS; } else { -#ifdef BONDING_DEBUG - printk(KERN_INFO - ":: SIOCETHTOOL shows link down \n"); -#endif + dprintk("SIOCETHTOOL shows link down\n"); return 0; } } @@ -1350,25 +1335,21 @@ static int bond_enslave(struct net_devic bond = (struct bonding *) master_dev->priv; if (slave_dev->do_ioctl == NULL) { - printk(KERN_DEBUG - "Warning : no link monitoring support for %s\n", - slave_dev->name); + printk(KERN_WARNING DRV_NAME + ": Warning : no link monitoring support for %s\n", + slave_dev->name); } /* bond must be initialized by bond_open() before enslaving */ if (!(master_dev->flags & IFF_UP)) { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "Error, master_dev is not up\n"); -#endif + dprintk("Error, master_dev is not up\n"); return -EPERM; } /* already enslaved */ if (master_dev->flags & IFF_SLAVE || slave_dev->flags & IFF_SLAVE) { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "Error, Device was already enslaved\n"); -#endif + dprintk("Error, Device was already enslaved\n"); return -EBUSY; } @@ -1377,19 +1358,19 @@ static int bond_enslave(struct net_devic * slave interface to be closed. */ if ((slave_dev->flags & IFF_UP)) { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "Error, slave_dev is up\n"); -#endif + printk(KERN_ERR DRV_NAME + ": Error: %s is up\n", + slave_dev->name); return -EPERM; } if (slave_dev->set_mac_address == NULL) { - printk(KERN_CRIT - "The slave device you specified does not support" - " setting the MAC address.\n"); - printk(KERN_CRIT - "Your kernel likely does not support slave" - " devices.\n"); + printk(KERN_ERR DRV_NAME + ": Error: The slave device you specified does " + "not support setting the MAC address.\n"); + printk(KERN_ERR + "Your kernel likely does not support slave " + "devices.\n"); return -EOPNOTSUPP; } @@ -1398,18 +1379,19 @@ static int bond_enslave(struct net_devic * slave interface to be open. */ if (!(slave_dev->flags & IFF_UP)) { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "Error, slave_dev is not running\n"); -#endif + printk(KERN_ERR DRV_NAME + ": Error: %s is not running\n", + slave_dev->name); return -EINVAL; } if ((bond_mode == BOND_MODE_8023AD) || (bond_mode == BOND_MODE_TLB) || (bond_mode == BOND_MODE_ALB)) { - printk(KERN_ERR - "bonding: Error: to use %s mode, you must " - "upgrade ifenslave.\n", bond_mode_name()); + printk(KERN_ERR DRV_NAME + ": Error: to use %s mode, you must upgrade " + "ifenslave.\n", + bond_mode_name()); return -EOPNOTSUPP; } } @@ -1440,9 +1422,7 @@ static int bond_enslave(struct net_devic addr.sa_family = slave_dev->type; err = slave_dev->set_mac_address(slave_dev, &addr); if (err) { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "Error %d calling set_mac_address\n", err); -#endif + dprintk("Error %d calling set_mac_address\n", err); goto err_free; } } @@ -1450,18 +1430,14 @@ static int bond_enslave(struct net_devic /* open the slave since the application closed it */ err = dev_open(slave_dev); if (err) { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "Openning slave %s failed\n", slave_dev->name); -#endif + dprintk("Openning slave %s failed\n", slave_dev->name); goto err_restore_mac; } } err = netdev_set_master(slave_dev, master_dev); if (err) { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "Error %d calling netdev_set_master\n", err); -#endif + dprintk("Error %d calling netdev_set_master\n", err); if (app_abi_ver < 1) { goto err_free; } else { @@ -1530,21 +1506,21 @@ static int bond_enslave(struct net_devic * supported); thus, we don't need to change * the messages for netif_carrier. */ - printk(KERN_ERR - "bond_enslave(): MII and ETHTOOL support not " - "available for interface %s, and " - "arp_interval/arp_ip_target module parameters " - "not specified, thus bonding will not detect " - "link failures! see bonding.txt for details.\n", - slave_dev->name); + printk(KERN_WARNING DRV_NAME + ": Warning: MII and ETHTOOL support not " + "available for interface %s, and " + "arp_interval/arp_ip_target module parameters " + "not specified, thus bonding will not detect " + "link failures! see bonding.txt for details.\n", + slave_dev->name); } else if (link_reporting == -1) { - /* unable get link status using mii/ethtool */ - printk(KERN_WARNING - "bond_enslave: can't get link status from " + /* unable get link status using mii/ethtool */ + printk(KERN_WARNING DRV_NAME + ": Warning: can't get link status from " "interface %s; the network driver associated " - "with this interface does not support " - "MII or ETHTOOL link status reporting, thus " - "miimon has no effect on this interface.\n", + "with this interface does not support MII or " + "ETHTOOL link status reporting, thus miimon " + "has no effect on this interface.\n", slave_dev->name); } } @@ -1553,41 +1529,36 @@ static int bond_enslave(struct net_devic if ((miimon <= 0) || (bond_check_dev_link(slave_dev, 0) == BMSR_LSTATUS)) { if (updelay) { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "Initial state of slave_dev is " - "BOND_LINK_BACK\n"); -#endif + dprintk("Initial state of slave_dev is " + "BOND_LINK_BACK\n"); new_slave->link = BOND_LINK_BACK; new_slave->delay = updelay; } else { -#ifdef BONDING_DEBUG - printk(KERN_DEBUG "Initial state of slave_dev is " + dprintk("Initial state of slave_dev is " "BOND_LINK_UP\n"); -#endif new_slave->link = BOND_LINK_UP; } new_slave->jiffies = jiffies; } else { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "Initial state of slave_dev is " + dprintk("Initial state of slave_dev is " "BOND_LINK_DOWN\n"); -#endif new_slave->link = BOND_LINK_DOWN; } if (bond_update_speed_duplex(new_slave) && (new_slave->link != BOND_LINK_DOWN)) { - printk(KERN_WARNING - "bond_enslave(): failed to get speed/duplex from %s, " - "speed forced to 100Mbps, duplex forced to Full.\n", + printk(KERN_WARNING DRV_NAME + ": Warning: failed to get speed/duplex from %s, speed " + "forced to 100Mbps, duplex forced to Full.\n", new_slave->dev->name); if (bond_mode == BOND_MODE_8023AD) { printk(KERN_WARNING - "Operation of 802.3ad mode requires ETHTOOL support " - "in base driver for proper aggregator selection.\n"); + "Operation of 802.3ad mode requires ETHTOOL " + "support in base driver for proper aggregator " + "selection.\n"); } } @@ -1602,17 +1573,13 @@ static int bond_enslave(struct net_devic if (((bond->current_slave == NULL) || (bond->current_slave->dev->flags & IFF_NOARP)) && (new_slave->link != BOND_LINK_DOWN)) { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "This is the first active slave\n"); -#endif + dprintk("This is the first active slave\n"); /* first slave or no active slave yet, and this link is OK, so make this interface the active one */ change_active_interface(bond, new_slave); } else { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "This is just a backup slave\n"); -#endif + dprintk("This is just a backup slave\n"); bond_set_slave_inactive_flags(new_slave); } if (((struct in_device *)slave_dev->ip_ptr) != NULL) { @@ -1667,9 +1634,7 @@ static int bond_enslave(struct net_devic } } } else { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "This slave is always active in trunk mode\n"); -#endif + dprintk("This slave is always active in trunk mode\n"); /* always active in trunk mode */ new_slave->state = BOND_STATE_ACTIVE; @@ -1694,15 +1659,11 @@ static int bond_enslave(struct net_devic int ndx = 0; for (ndx = 0; ndx < slave_dev->addr_len; ndx++) { -#ifdef BONDING_DEBUG - printk(KERN_DEBUG - "Checking ndx=%d of master_dev->dev_addr\n", ndx); -#endif + dprintk("Checking ndx=%d of master_dev->dev_addr\n", + ndx); if (master_dev->dev_addr[ndx] != 0) { -#ifdef BONDING_DEBUG - printk(KERN_DEBUG - "Found non-zero byte at ndx=%d\n", ndx); -#endif + dprintk("Found non-zero byte at ndx=%d\n", + ndx); break; } } @@ -1711,20 +1672,19 @@ static int bond_enslave(struct net_devic * We got all the way through the address and it was * all 0's. */ -#ifdef BONDING_DEBUG - printk(KERN_DEBUG "%s doesn't have a MAC address yet. ", - master_dev->name); - printk(KERN_DEBUG "Going to give assign it from %s.\n", - slave_dev->name); -#endif + dprintk("%s doesn't have a MAC address yet. ", + master_dev->name); + dprintk("Going to give assign it from %s.\n", + slave_dev->name); bond_sethwaddr(master_dev, slave_dev); } } - printk (KERN_INFO "%s: enslaving %s as a%s interface with a%s link.\n", - master_dev->name, slave_dev->name, - new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup", - new_slave->link != BOND_LINK_DOWN ? "n up" : " down"); + printk(KERN_INFO DRV_NAME + ": %s: enslaving %s as a%s interface with a%s link.\n", + master_dev->name, slave_dev->name, + new_slave->state == BOND_STATE_ACTIVE ? "n active" : " backup", + new_slave->link != BOND_LINK_DOWN ? "n up" : " down"); /* enslave is successful */ return 0; @@ -1889,11 +1849,11 @@ static void change_active_interface(stru if (new) { if (new->link == BOND_LINK_BACK) { if (USES_PRIMARY(bond_mode)) { - printk (KERN_INFO - "%s: making interface %s the new " - "active one %d ms earlier.\n", - bond->device->name, new->dev->name, - (updelay - new->delay) * miimon); + printk(KERN_INFO DRV_NAME + ": %s: making interface %s the new " + "active one %d ms earlier.\n", + bond->device->name, new->dev->name, + (updelay - new->delay) * miimon); } new->delay = 0; @@ -1910,9 +1870,10 @@ static void change_active_interface(stru } } else { if (USES_PRIMARY(bond_mode)) { - printk (KERN_INFO - "%s: making interface %s the new active one.\n", - bond->device->name, new->dev->name); + printk(KERN_INFO DRV_NAME + ": %s: making interface %s the new " + "active one.\n", + bond->device->name, new->dev->name); } } } @@ -1987,7 +1948,9 @@ static int bond_release(struct net_devic /* master already enslaved, or slave not enslaved, or no slave for this master */ 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; } @@ -2001,11 +1964,12 @@ static int bond_release(struct net_devic our_slave->perm_hwaddr, ETH_ALEN); if (!mac_addr_differ && (bond->slave_cnt > 1)) { - printk(KERN_WARNING "WARNING: the permanent HWaddr of %s " - "- %02X:%02X:%02X:%02X:%02X:%02X - " - "is still in use by %s. Set the HWaddr " - "of %s to a different address " - "to avoid conflicts.\n", + printk(KERN_WARNING DRV_NAME + ": Warning: the permanent HWaddr of %s " + "- %02X:%02X:%02X:%02X:%02X:%02X - is " + "still in use by %s. Set the HWaddr of " + "%s to a different address to avoid " + "conflicts.\n", slave->name, our_slave->perm_hwaddr[0], our_slave->perm_hwaddr[1], @@ -2025,10 +1989,12 @@ static int bond_release(struct net_devic bond_3ad_unbind_slave(our_slave); } - printk (KERN_INFO "%s: releasing %s interface %s\n", - master->name, - (our_slave->state == BOND_STATE_ACTIVE) ? "active" : "backup", - slave->name); + printk(KERN_INFO DRV_NAME + ": %s: releasing %s interface %s\n", + master->name, + (our_slave->state == BOND_STATE_ACTIVE) + ? "active" : "backup", + slave->name); /* release the slave from its bond */ bond_detach_slave(bond, our_slave); @@ -2043,9 +2009,10 @@ static int bond_release(struct net_devic } if (bond->current_slave == NULL) { - printk(KERN_INFO - "%s: now running without any active interface !\n", - master->name); + printk(KERN_INFO DRV_NAME + ": %s: now running without any active " + "interface !\n", + master->name); } if ((bond_mode == BOND_MODE_TLB) || @@ -2065,7 +2032,9 @@ static int bond_release(struct net_devic if (our_slave == (slave_t *)bond) { /* 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; } @@ -2227,7 +2196,9 @@ static int bond_release_all(struct net_d */ 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: write_unlock_bh(&bond->lock); @@ -2278,19 +2249,20 @@ static void bond_mii_monitor(struct net_ slave->link_failure_count++; } if (downdelay > 0) { - printk (KERN_INFO - "%s: link status down for %sinterface " - "%s, disabling it in %d ms.\n", - master->name, - IS_UP(dev) - ? ((bond_mode == BOND_MODE_ACTIVEBACKUP) - ? ((slave == oldcurrent) - ? "active " : "backup ") - : "") - : "idle ", - dev->name, - downdelay * miimon); - } + printk(KERN_INFO DRV_NAME + ": %s: link status down for %s " + "interface %s, disabling it in " + "%d ms.\n", + master->name, + IS_UP(dev) + ? ((bond_mode == BOND_MODE_ACTIVEBACKUP) + ? ((slave == oldcurrent) + ? "active " : "backup ") + : "") + : "idle ", + dev->name, + downdelay * miimon); + } } /* no break ! fall through the BOND_LINK_FAIL test to ensure proper action to be taken @@ -2309,11 +2281,12 @@ static void bond_mii_monitor(struct net_ bond_set_slave_inactive_flags(slave); } - printk(KERN_INFO - "%s: link status definitely down " - "for interface %s, disabling it", - master->name, - dev->name); + printk(KERN_INFO DRV_NAME + ": %s: link status definitely " + "down for interface %s, " + "disabling it", + master->name, + dev->name); /* notify ad that the link status has changed */ if (bond_mode == BOND_MODE_8023AD) { @@ -2337,12 +2310,12 @@ static void bond_mii_monitor(struct net_ /* link up again */ slave->link = BOND_LINK_UP; slave->jiffies = jiffies; - printk(KERN_INFO - "%s: link status up again after %d ms " - "for interface %s.\n", - master->name, - (downdelay - slave->delay) * miimon, - dev->name); + printk(KERN_INFO DRV_NAME + ": %s: link status up again after %d " + "ms for interface %s.\n", + master->name, + (downdelay - slave->delay) * miimon, + dev->name); } break; case BOND_LINK_DOWN: /* the link was down */ @@ -2356,12 +2329,13 @@ static void bond_mii_monitor(struct net_ if (updelay > 0) { /* if updelay == 0, no need to advertise about a 0 ms delay */ - printk (KERN_INFO - "%s: link status up for interface" - " %s, enabling it in %d ms.\n", - master->name, - dev->name, - updelay * miimon); + printk(KERN_INFO DRV_NAME + ": %s: link status up for " + "interface %s, enabling it " + "in %d ms.\n", + master->name, + dev->name, + updelay * miimon); } } /* no break ! fall through the BOND_LINK_BACK state in @@ -2371,12 +2345,12 @@ static void bond_mii_monitor(struct net_ if (link_state != BMSR_LSTATUS) { /* link down again */ slave->link = BOND_LINK_DOWN; - printk(KERN_INFO - "%s: link status down again after %d ms " - "for interface %s.\n", - master->name, - (updelay - slave->delay) * miimon, - dev->name); + printk(KERN_INFO DRV_NAME + ": %s: link status down again after %d " + "ms for interface %s.\n", + master->name, + (updelay - slave->delay) * miimon, + dev->name); } else { /* link stays up */ if (slave->delay == 0) { @@ -2396,11 +2370,11 @@ static void bond_mii_monitor(struct net_ slave->state = BOND_STATE_BACKUP; } - printk(KERN_INFO - "%s: link status definitely up " - "for interface %s.\n", - master->name, - dev->name); + printk(KERN_INFO DRV_NAME + ": %s: link status definitely " + "up for interface %s.\n", + master->name, + dev->name); /* notify ad that the link status has changed */ if (bond_mode == BOND_MODE_8023AD) { @@ -2441,9 +2415,10 @@ static void bond_mii_monitor(struct net_ reselect_active_interface(bond); if (oldcurrent && !bond->current_slave) { - printk(KERN_INFO - "%s: now running without any active interface !\n", - master->name); + printk(KERN_INFO DRV_NAME + ": %s: now running without any active " + "interface !\n", + master->name); } write_unlock(&bond->ptrlock); @@ -2522,17 +2497,17 @@ static void loadbalance_arp_monitor(stru * is closed. */ if (oldcurrent == NULL) { - printk(KERN_INFO - "%s: link status definitely up " - "for interface %s, ", - master->name, - slave->dev->name); + printk(KERN_INFO DRV_NAME + ": %s: link status definitely " + "up for interface %s, ", + master->name, + slave->dev->name); do_failover = 1; } else { - printk(KERN_INFO - "%s: interface %s is now up\n", - master->name, - slave->dev->name); + printk(KERN_INFO DRV_NAME + ": %s: interface %s is now up\n", + master->name, + slave->dev->name); } } } else { @@ -2551,8 +2526,8 @@ static void loadbalance_arp_monitor(stru if (slave->link_failure_count < UINT_MAX) { slave->link_failure_count++; } - printk(KERN_INFO - "%s: interface %s is now down.\n", + printk(KERN_INFO DRV_NAME + ": %s: interface %s is now down.\n", master->name, slave->dev->name); @@ -2579,9 +2554,10 @@ static void loadbalance_arp_monitor(stru reselect_active_interface(bond); if (oldcurrent && !bond->current_slave) { - printk(KERN_INFO - "%s: now running without any active interface !\n", - master->name); + printk(KERN_INFO DRV_NAME + ": %s: now running without any active " + "interface !\n", + master->name); } write_unlock(&bond->ptrlock); @@ -2661,17 +2637,17 @@ static void activebackup_arp_monitor(str } if (slave == bond->current_slave) { - printk(KERN_INFO - "%s: %s is up and now the " - "active interface\n", - master->name, - slave->dev->name); + printk(KERN_INFO DRV_NAME + ": %s: %s is up and now the " + "active interface\n", + master->name, + slave->dev->name); } else { - printk(KERN_INFO - "%s: backup interface %s is " - "now up\n", - master->name, - slave->dev->name); + printk(KERN_INFO DRV_NAME + ": %s: backup interface %s is " + "now up\n", + master->name, + slave->dev->name); } write_unlock(&bond->ptrlock); @@ -2698,10 +2674,10 @@ static void activebackup_arp_monitor(str slave->link_failure_count++; } bond_set_slave_inactive_flags(slave); - printk(KERN_INFO - "%s: backup interface %s is now down\n", - master->name, - slave->dev->name); + printk(KERN_INFO DRV_NAME + ": %s: backup interface %s is now down\n", + master->name, + slave->dev->name); } else { read_unlock(&bond->ptrlock); } @@ -2732,8 +2708,9 @@ static void activebackup_arp_monitor(str if (slave->link_failure_count < UINT_MAX) { slave->link_failure_count++; } - printk(KERN_INFO "%s: link status down for " - "active interface %s, disabling it", + printk(KERN_INFO DRV_NAME + ": %s: link status down for active interface " + "%s, disabling it", master->name, slave->dev->name); write_lock(&bond->ptrlock); @@ -2749,8 +2726,8 @@ static void activebackup_arp_monitor(str (bond->primary_slave != slave) && (bond->primary_slave->link == BOND_LINK_UP)) { /* at this point, slave is the current_slave */ - printk(KERN_INFO - "%s: changing from interface %s to primary " + printk(KERN_INFO DRV_NAME + ": %s: changing from interface %s to primary " "interface %s\n", master->name, slave->dev->name, @@ -2815,11 +2792,11 @@ static void activebackup_arp_monitor(str } bond_set_slave_inactive_flags(slave); - printk(KERN_INFO - "%s: backup interface " - "%s is now down.\n", - master->name, - slave->dev->name); + printk(KERN_INFO DRV_NAME + ": %s: backup interface %s is " + "now down.\n", + master->name, + slave->dev->name); } } while ((slave = slave->next) != bond->current_arp_slave->next); @@ -2832,11 +2809,9 @@ static void activebackup_arp_monitor(str static int bond_sethwaddr(struct net_device *master, struct net_device *slave) { -#ifdef BONDING_DEBUG - printk(KERN_CRIT "bond_sethwaddr: master=%x\n", (unsigned int)master); - printk(KERN_CRIT "bond_sethwaddr: slave=%x\n", (unsigned int)slave); - printk(KERN_CRIT "bond_sethwaddr: slave->addr_len=%d\n", slave->addr_len); -#endif + dprintk("master=%p\n", master); + dprintk("slave=%p\n", slave); + dprintk("slave->addr_len=%d\n", slave->addr_len); memcpy(master->dev_addr, slave->dev_addr, slave->addr_len); return 0; } @@ -2914,9 +2889,9 @@ static int bond_ethtool_ioctl(struct net new_abi_ver = simple_strtoul(info.fw_version, &endptr, 0); if (*endptr) { - printk(KERN_ERR - "bonding: Error: got invalid ABI" - " version from application\n"); + printk(KERN_ERR DRV_NAME + ": Error: got invalid ABI " + "version from application\n"); return -EINVAL; } @@ -2952,10 +2927,8 @@ static int bond_ioctl(struct net_device int prev_abi_ver = orig_app_abi_ver; int ret = 0; -#ifdef BONDING_DEBUG - printk(KERN_INFO "bond_ioctl: master=%s, cmd=%d\n", + dprintk("bond_ioctl: master=%s, cmd=%d\n", master_dev->name, cmd); -#endif switch (cmd) { case SIOCETHTOOL: @@ -3021,24 +2994,22 @@ static int bond_ioctl(struct net_device orig_app_abi_ver = app_abi_ver; } else if (orig_app_abi_ver != app_abi_ver) { - printk(KERN_ERR - "bonding: Error: already using ifenslave ABI " - "version %d; to upgrade ifenslave to version %d, " - "you must first reload bonding.\n", + printk(KERN_ERR DRV_NAME + ": Error: already using ifenslave ABI version %d; to " + "upgrade ifenslave to version %d, you must first " + "reload bonding.\n", orig_app_abi_ver, app_abi_ver); return -EINVAL; } slave_dev = dev_get_by_name(ifr->ifr_slave); -#ifdef BONDING_DEBUG - printk(KERN_INFO "slave_dev=%x: \n", (unsigned int)slave_dev); - printk(KERN_INFO "slave_dev->name=%s: \n", slave_dev->name); -#endif + dprintk("slave_dev=%p: \n", slave_dev); if (slave_dev == NULL) { ret = -ENODEV; } else { + dprintk("slave_dev->name=%s: \n", slave_dev->name); switch (cmd) { case BOND_ENSLAVE_OLD: case SIOCBONDENSLAVE: @@ -3119,7 +3090,9 @@ static int bond_xmit_broadcast(struct sk if (device_we_should_send_to) { struct sk_buff *skb2; 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; } @@ -3309,9 +3282,7 @@ static int bond_xmit_activebackup(struct } /* no suitable interface, frame not sent */ -#ifdef BONDING_DEBUG - printk(KERN_INFO "There was no suitable interface, so we don't transmit\n"); -#endif + dprintk("There was no suitable interface, so we don't transmit\n"); dev_kfree_skb(skb); read_unlock(&bond->lock); return 0; @@ -3552,9 +3523,9 @@ static int bond_create_proc_info(struct S_IRUGO, bond_proc_dir); if (bond->bond_proc_file == NULL) { - printk(KERN_WARNING - "%s: Cannot create /proc/net/bonding/%s\n", - dev->name, dev->name); + printk(KERN_WARNING DRV_NAME + ": Warning: Cannot create /proc/net/bonding/%s\n", + dev->name); } else { bond->bond_proc_file->data = bond; bond->bond_proc_file->proc_fops = &bond_info_fops; @@ -3647,8 +3618,7 @@ bond_set_mac_address(struct net_device * struct slave *slave; int error; - dprintk(KERN_INFO "bond_set_mac_address %p %s\n", dev, - dev->name); + dprintk("bond=%p, name=%s\n", bond, (bond_dev ? bond_dev->name : "None")); if (!is_valid_ether_addr(sa->sa_data)) { return -EADDRNOTAVAIL; @@ -3656,12 +3626,10 @@ bond_set_mac_address(struct net_device * for (slave = bond->prev; slave != (struct slave *)bond; slave = slave->prev) { - dprintk(KERN_INFO "bond_set_mac: slave %p %s\n", slave, - slave->dev->name); + dprintk("slave %p %s\n", slave, slave->dev->name); if (slave->dev->set_mac_address == NULL) { error = -EOPNOTSUPP; - dprintk(KERN_INFO "bond_set_mac EOPNOTSUPP %s\n", - slave->dev->name); + dprintk("EOPNOTSUPP %s\n", slave->dev->name); goto unwind; } @@ -3673,8 +3641,7 @@ bond_set_mac_address(struct net_device * * breakage anyway until ARP finish * updating, so... */ - dprintk(KERN_INFO "bond_set_mac err %d %s\n", - error, slave->dev->name); + dprintk("err %d %s\n", error, slave->dev->name); goto unwind; } } @@ -3693,9 +3660,8 @@ unwind: tmp_error = slave->dev->set_mac_address(slave->dev, &tmp_sa); if (tmp_error) { - dprintk(KERN_INFO "bond_set_mac_address: " - "unwind err %d dev %s\n", - tmp_error, slave->dev->name); + dprintk("unwind err %d dev %s\n", tmp_error, + slave->dev->name); } } @@ -3712,10 +3678,12 @@ bond_change_mtu(struct net_device *dev, slave_t *slave; 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; 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); if (slave->dev->change_mtu) { error = slave->dev->change_mtu(slave->dev, newmtu); @@ -3733,8 +3701,7 @@ bond_change_mtu(struct net_device *dev, * means changing their mtu from timer context, which * is probably not a good idea. */ - dprintk(KERN_INFO "bond_change_mtu err %d %s\n", - error, slave->dev->name); + dprintk("err %d %s\n", error, slave->dev->name); goto unwind; } } @@ -3862,8 +3829,7 @@ static int bond_netdev_event(struct noti unsigned short flags; int res = NOTIFY_DONE; - dprintk(KERN_INFO "bond_netdev_event n_b %p ev %lx ptr %p\n", - this, event, ptr); + dprintk("n_b %p ev %lx ptr %p\n", this, event, ptr); flags = event_dev->flags & (IFF_MASTER | IFF_SLAVE); switch (flags) { @@ -3928,9 +3894,8 @@ static int __init bond_init(struct net_d struct bonding *bond; int count; -#ifdef BONDING_DEBUG - printk (KERN_INFO "Begin bond_init for %s\n", dev->name); -#endif + dprintk("Begin bond_init for %s\n", dev->name); + bond = dev->priv; /* initialize rwlocks */ @@ -3968,7 +3933,9 @@ static int __init bond_init(struct net_d dev->set_mac_address = bond_alb_set_mac_address; break; 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; } @@ -3984,7 +3951,7 @@ static int __init bond_init(struct net_d dev->accept_fastpath = bond_accept_fastpath; #endif - printk(KERN_INFO "%s registered with", dev->name); + printk(KERN_INFO DRV_NAME ": %s registered with", dev->name); if (miimon > 0) { printk(" MII link monitoring set to %d ms", miimon); updelay /= miimon; @@ -3994,12 +3961,12 @@ static int __init bond_init(struct net_d } 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) { - printk(" ARP monitoring set to %d ms with %d target(s):", - arp_interval, arp_ip_count); + printk(" ARP monitoring set to %d ms with %d target(s):", + arp_interval, arp_ip_count); for (count=0 ; count INT_MAX) { - printk(KERN_WARNING - "bonding_init(): max_bonds (%d) not in range %d-%d, " - "so it was reset to BOND_DEFAULT_MAX_BONDS (%d)", + printk(KERN_WARNING DRV_NAME + ": Warning: max_bonds (%d) not in range %d-%d, so it " + "was reset to BOND_DEFAULT_MAX_BONDS (%d)", max_bonds, 1, INT_MAX, BOND_DEFAULT_MAX_BONDS); max_bonds = BOND_DEFAULT_MAX_BONDS; } if (miimon < 0) { - printk(KERN_WARNING - "bonding_init(): miimon module parameter (%d), " + printk(KERN_WARNING DRV_NAME + ": Warning: miimon module parameter (%d), " "not in range 0-%d, so it was reset to %d\n", miimon, INT_MAX, BOND_LINK_MON_INTERV); miimon = BOND_LINK_MON_INTERV; } if (updelay < 0) { - printk(KERN_WARNING - "bonding_init(): updelay module parameter (%d), " + printk(KERN_WARNING DRV_NAME + ": Warning: updelay module parameter (%d), " "not in range 0-%d, so it was reset to 0\n", updelay, INT_MAX); updelay = 0; } if (downdelay < 0) { - printk(KERN_WARNING - "bonding_init(): downdelay module parameter (%d), " + printk(KERN_WARNING DRV_NAME + ": Warning: downdelay module parameter (%d), " "not in range 0-%d, so it was reset to 0\n", downdelay, INT_MAX); downdelay = 0; @@ -4133,27 +4099,28 @@ static int __init bonding_init(void) /* reset values for 802.3ad */ if (bond_mode == BOND_MODE_8023AD) { if (arp_interval != 0) { - printk(KERN_WARNING "bonding_init(): ARP monitoring" - "can't be used simultaneously with 802.3ad, " - "disabling ARP monitoring\n"); + printk(KERN_WARNING DRV_NAME + ": Warning: ARP monitoring can't be used " + "simultaneously with 802.3ad, disabling ARP " + "monitoring\n"); arp_interval = 0; } if (miimon == 0) { - printk(KERN_ERR - "bonding_init(): miimon must be specified, " - "otherwise bonding will not detect link failure, " - "speed and duplex which are essential " - "for 802.3ad operation\n"); - printk(KERN_ERR "Forcing miimon to 100msec\n"); + printk(KERN_WARNING DRV_NAME + ": Warning: miimon must be specified, " + "otherwise bonding will not detect link " + "failure, speed and duplex which are " + "essential for 802.3ad operation\n"); + printk(KERN_WARNING "Forcing miimon to 100msec\n"); miimon = 100; } if (multicast_mode != BOND_MULTICAST_ALL) { - printk(KERN_ERR - "bonding_init(): Multicast mode must " - "be set to ALL for 802.3ad\n"); - printk(KERN_ERR "Forcing Multicast mode to ALL\n"); + printk(KERN_WARNING DRV_NAME + ": Warning: Multicast mode must be set to ALL " + "for 802.3ad\n"); + printk(KERN_WARNING "Forcing Multicast mode to ALL\n"); multicast_mode = BOND_MULTICAST_ALL; } } @@ -4162,30 +4129,33 @@ static int __init bonding_init(void) if ((bond_mode == BOND_MODE_TLB) || (bond_mode == BOND_MODE_ALB)) { if (miimon == 0) { - printk(KERN_ERR - "bonding_init(): miimon must be specified, " - "otherwise bonding will not detect link failure " - "and link speed which are essential " + printk(KERN_WARNING DRV_NAME + ": Warning: miimon must be specified, " + "otherwise bonding will not detect link " + "failure and link speed which are essential " "for TLB/ALB load balancing\n"); - printk(KERN_ERR "Forcing miimon to 100msec\n"); + printk(KERN_WARNING "Forcing miimon to 100msec\n"); miimon = 100; } if (multicast_mode != BOND_MULTICAST_ACTIVE) { - printk(KERN_ERR - "bonding_init(): Multicast mode must " - "be set to ACTIVE for TLB/ALB\n"); - printk(KERN_ERR "Forcing Multicast mode to ACTIVE\n"); + printk(KERN_WARNING DRV_NAME + ": Warning: Multicast mode must be set to " + "ACTIVE for TLB/ALB\n"); + printk(KERN_WARNING "Forcing Multicast mode to " + "ACTIVE\n"); multicast_mode = BOND_MULTICAST_ACTIVE; } } if (bond_mode == BOND_MODE_ALB) { - printk(KERN_INFO - "In ALB mode you might experience client disconnections" - " upon reconnection of a link if the bonding module" - " updelay parameter (%d msec) is incompatible with the" - " forwarding delay time of the switch\n", updelay); + printk(KERN_NOTICE DRV_NAME + ": In ALB mode you might experience client " + "disconnections upon reconnection of a link if the " + "bonding module updelay parameter (%d msec) is " + "incompatible with the forwarding delay time of the " + "switch\n", + updelay); } if (miimon == 0) { @@ -4193,21 +4163,21 @@ static int __init bonding_init(void) /* just warn the user the up/down delay will have * no effect since miimon is zero... */ - printk(KERN_WARNING - "bonding_init(): miimon module parameter not " - "set and updelay (%d) or downdelay (%d) module " + printk(KERN_WARNING DRV_NAME + ": Warning: miimon module parameter not set " + "and updelay (%d) or downdelay (%d) module " "parameter is set; updelay and downdelay have " "no effect unless miimon is set\n", - updelay, downdelay); + updelay, downdelay); } } else { /* don't allow arp monitoring */ if (arp_interval != 0) { - printk(KERN_WARNING - "bonding_init(): miimon (%d) and arp_interval " - "(%d) can't be used simultaneously, " - "disabling ARP monitoring\n", - miimon, arp_interval); + printk(KERN_WARNING DRV_NAME + ": Warning: miimon (%d) and arp_interval (%d) " + "can't be used simultaneously, disabling ARP " + "monitoring\n", + miimon, arp_interval); arp_interval = 0; } @@ -4215,29 +4185,28 @@ static int __init bonding_init(void) /* updelay will be rounded in bond_init() when it * is divided by miimon, we just inform user here */ - printk(KERN_WARNING - "bonding_init(): updelay (%d) is not a multiple " + printk(KERN_WARNING DRV_NAME + ": Warning: updelay (%d) is not a multiple " "of miimon (%d), updelay rounded to %d ms\n", - updelay, miimon, (updelay / miimon) * miimon); + updelay, miimon, (updelay / miimon) * miimon); } if ((downdelay % miimon) != 0) { /* downdelay will be rounded in bond_init() when it * is divided by miimon, we just inform user here */ - printk(KERN_WARNING - "bonding_init(): downdelay (%d) is not a " - "multiple of miimon (%d), downdelay rounded " - "to %d ms\n", - downdelay, miimon, + printk(KERN_WARNING DRV_NAME + ": Warning: downdelay (%d) is not a multiple " + "of miimon (%d), downdelay rounded to %d ms\n", + downdelay, miimon, (downdelay / miimon) * miimon); } } if (arp_interval < 0) { - printk(KERN_WARNING - "bonding_init(): arp_interval module parameter (%d), " - "not in range 0-%d, so it was reset to %d\n", + printk(KERN_WARNING DRV_NAME + ": Warning: arp_interval module parameter (%d) " + ", not in range 0-%d, so it was reset to %d\n", arp_interval, INT_MAX, BOND_LINK_ARP_INTERV); arp_interval = BOND_LINK_ARP_INTERV; } @@ -4248,12 +4217,11 @@ static int __init bonding_init(void) /* not complete check, but should be good enough to catch mistakes */ if (!isdigit(arp_ip_target[arp_ip_count][0])) { - printk(KERN_WARNING - "bonding_init(): bad arp_ip_target module " - "parameter (%s), ARP monitoring will not be " - "performed\n", - arp_ip_target[arp_ip_count]); - arp_interval = 0; + printk(KERN_WARNING DRV_NAME + ": Warning: bad arp_ip_target module parameter " + "(%s), ARP monitoring will not be performed\n", + arp_ip_target[arp_ip_count]); + arp_interval = 0; } else { u32 ip = in_aton(arp_ip_target[arp_ip_count]); arp_target[arp_ip_count] = ip; @@ -4263,9 +4231,9 @@ static int __init bonding_init(void) if ( (arp_interval > 0) && (arp_ip_count==0)) { /* don't allow arping if no arp_ip_target given... */ - printk(KERN_WARNING - "bonding_init(): arp_interval module parameter " - "(%d) specified without providing an arp_ip_target " + printk(KERN_WARNING DRV_NAME + ": Warning: arp_interval module parameter (%d) " + "specified without providing an arp_ip_target " "parameter, arp_interval was reset to 0\n", arp_interval); arp_interval = 0; @@ -4275,20 +4243,20 @@ static int __init bonding_init(void) /* miimon and arp_interval not set, we need one so things * work as expected, see bonding.txt for details */ - printk(KERN_ERR - "bonding_init(): either miimon or " - "arp_interval and arp_ip_target module parameters " - "must be specified, otherwise bonding will not detect " - "link failures! see bonding.txt for details.\n"); + printk(KERN_WARNING DRV_NAME + ": Warning: either miimon or arp_interval and " + "arp_ip_target module parameters must be specified, " + "otherwise bonding will not detect link failures! see " + "bonding.txt for details.\n"); } if ((primary != NULL) && !USES_PRIMARY(bond_mode)) { /* currently, using a primary only makes sense * in active backup, TLB or ALB modes */ - printk(KERN_WARNING - "bonding_init(): %s primary device specified but has " - "no effect in %s mode\n", + printk(KERN_WARNING DRV_NAME + ": Warning: %s primary device specified but has no " + "effect in %s mode\n", primary, bond_mode_name()); primary = NULL; } diff -Nuarp a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h --- a/drivers/net/bonding/bonding.h Sun Dec 21 16:08:36 2003 +++ b/drivers/net/bonding/bonding.h Sun Dec 21 16:08:37 2003 @@ -32,18 +32,17 @@ #include "bond_3ad.h" #include "bond_alb.h" -#ifdef BONDING_DEBUG - -// use this like so: BOND_PRINT_DBG(("foo = %d, bar = %d", foo, bar)); -#define BOND_PRINT_DBG(X) \ -do { \ - printk(KERN_DEBUG "%s (%d)", __FUNCTION__, __LINE__); \ - printk X; \ - printk("\n"); \ -} while(0) +#define DRV_VERSION "2.4.1" +#define DRV_RELDATE "September 15, 2003" +#define DRV_NAME "bonding" +#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver" +#ifdef BONDING_DEBUG +#define dprintk(fmt, args...) \ + printk(KERN_DEBUG \ + DRV_NAME ": %s() %d: " fmt, __FUNCTION__, __LINE__ , ## args ) #else -#define BOND_PRINT_DBG(X) +#define dprintk(fmt, args...) #endif /* BONDING_DEBUG */ #define IS_UP(dev) ((((dev)->flags & (IFF_UP)) == (IFF_UP)) && \