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
This diff is collapsed.
...@@ -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;
} }
......
This diff is collapsed.
...@@ -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