Commit 90b8b7e7 authored by David S. Miller's avatar David S. Miller

Merge branch 'bonding-clean-up-and-standarize-logging-printks'

Jarod Wilson says:

====================
bonding: clean up and standarize logging printks

This set improves a few somewhat terse bonding debug messages, fixes some
errors in others, and then standarizes the majority of them, using new
slave_* printk macros that wrap around netdev_* to ensure both master
and slave information is provided consistently, where relevant. This set
proves very useful in debugging issues on hosts with multiple bonds.

I've run an array of LNST tests over this set, creating and destroying
quite a few different bonds of the course of testing, fixed the little
gotchas here and there, and everything looks stable and reasonable to me,
but I can't guarantee I've tested every possible message and scenario to
catch every possible "slave could be NULL" case.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 517a772c f887e54c
This diff is collapsed.
...@@ -300,7 +300,7 @@ static int rlb_arp_recv(const struct sk_buff *skb, struct bonding *bond, ...@@ -300,7 +300,7 @@ static int rlb_arp_recv(const struct sk_buff *skb, struct bonding *bond,
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);
netdev_dbg(bond->dev, "Server received an ARP Reply from client\n"); slave_dbg(bond->dev, slave->dev, "Server received an ARP Reply from client\n");
} }
out: out:
return RX_HANDLER_ANOTHER; return RX_HANDLER_ANOTHER;
...@@ -442,8 +442,9 @@ static void rlb_update_client(struct rlb_client_info *client_info) ...@@ -442,8 +442,9 @@ static void rlb_update_client(struct rlb_client_info *client_info)
client_info->slave->dev->dev_addr, client_info->slave->dev->dev_addr,
client_info->mac_dst); client_info->mac_dst);
if (!skb) { if (!skb) {
netdev_err(client_info->slave->bond->dev, slave_err(client_info->slave->bond->dev,
"failed to create an ARP packet\n"); client_info->slave->dev,
"failed to create an ARP packet\n");
continue; continue;
} }
...@@ -667,14 +668,15 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) ...@@ -667,14 +668,15 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
if (tx_slave) if (tx_slave)
bond_hw_addr_copy(arp->mac_src, tx_slave->dev->dev_addr, bond_hw_addr_copy(arp->mac_src, tx_slave->dev->dev_addr,
tx_slave->dev->addr_len); tx_slave->dev->addr_len);
netdev_dbg(bond->dev, "Server sent ARP Reply packet\n"); netdev_dbg(bond->dev, "(slave %s): Server sent ARP Reply packet\n",
tx_slave ? tx_slave->dev->name : "NULL");
} else if (arp->op_code == htons(ARPOP_REQUEST)) { } else if (arp->op_code == 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
* place holder. * place holder.
* When the arp reply is received the entry will be updated * When the arp reply is received the entry will be updated
* with the correct unicast address of the client. * with the correct unicast address of the client.
*/ */
rlb_choose_channel(skb, bond); tx_slave = rlb_choose_channel(skb, bond);
/* The ARP reply packets must be delayed so that /* The ARP reply packets must be delayed so that
* they can cancel out the influence of the ARP request. * they can cancel out the influence of the ARP request.
...@@ -687,7 +689,8 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) ...@@ -687,7 +689,8 @@ static struct slave *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);
netdev_dbg(bond->dev, "Server sent ARP Request packet\n"); netdev_dbg(bond->dev, "(slave %s): Server sent ARP Request packet\n",
tx_slave ? tx_slave->dev->name : "NULL");
} }
return tx_slave; return tx_slave;
...@@ -923,9 +926,8 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[], ...@@ -923,9 +926,8 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[],
skb->priority = TC_PRIO_CONTROL; skb->priority = TC_PRIO_CONTROL;
skb->dev = slave->dev; skb->dev = slave->dev;
netdev_dbg(slave->bond->dev, slave_dbg(slave->bond->dev, slave->dev,
"Send learning packet: dev %s mac %pM vlan %d\n", "Send learning packet: mac %pM vlan %d\n", mac_addr, vid);
slave->dev->name, mac_addr, vid);
if (vid) if (vid)
__vlan_hwaccel_put_tag(skb, vlan_proto, vid); __vlan_hwaccel_put_tag(skb, vlan_proto, vid);
...@@ -1016,8 +1018,7 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[], ...@@ -1016,8 +1018,7 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[],
memcpy(ss.__data, addr, len); memcpy(ss.__data, addr, len);
ss.ss_family = dev->type; ss.ss_family = dev->type;
if (dev_set_mac_address(dev, (struct sockaddr *)&ss, NULL)) { if (dev_set_mac_address(dev, (struct sockaddr *)&ss, NULL)) {
netdev_err(slave->bond->dev, "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", slave_err(slave->bond->dev, dev, "dev_set_mac_address on slave 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 -EOPNOTSUPP;
} }
return 0; return 0;
...@@ -1192,12 +1193,11 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav ...@@ -1192,12 +1193,11 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr, alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr,
free_mac_slave->dev->addr_len); free_mac_slave->dev->addr_len);
netdev_warn(bond->dev, "the hw address of slave %s is in use by the bond; giving it the hw address of %s\n", slave_warn(bond->dev, slave->dev, "the slave hw address is in use by the bond; giving it the hw address of %s\n",
slave->dev->name, free_mac_slave->dev->name); free_mac_slave->dev->name);
} else if (has_bond_addr) { } else if (has_bond_addr) {
netdev_err(bond->dev, "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_err(bond->dev, slave->dev, "the slave hw address 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; return -EFAULT;
} }
......
This diff is collapsed.
...@@ -783,14 +783,12 @@ static int bond_option_active_slave_set(struct bonding *bond, ...@@ -783,14 +783,12 @@ static int bond_option_active_slave_set(struct bonding *bond,
if (slave_dev) { if (slave_dev) {
if (!netif_is_bond_slave(slave_dev)) { if (!netif_is_bond_slave(slave_dev)) {
netdev_err(bond->dev, "Device %s is not bonding slave\n", slave_err(bond->dev, slave_dev, "Device is not bonding slave\n");
slave_dev->name);
return -EINVAL; return -EINVAL;
} }
if (bond->dev != netdev_master_upper_dev_get(slave_dev)) { if (bond->dev != netdev_master_upper_dev_get(slave_dev)) {
netdev_err(bond->dev, "Device %s is not our slave\n", slave_err(bond->dev, slave_dev, "Device is not our slave\n");
slave_dev->name);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -809,18 +807,15 @@ static int bond_option_active_slave_set(struct bonding *bond, ...@@ -809,18 +807,15 @@ static int bond_option_active_slave_set(struct bonding *bond,
if (new_active == old_active) { if (new_active == old_active) {
/* do nothing */ /* do nothing */
netdev_dbg(bond->dev, "%s is already the current active slave\n", slave_dbg(bond->dev, new_active->dev, "is already the current active slave\n");
new_active->dev->name);
} else { } else {
if (old_active && (new_active->link == BOND_LINK_UP) && if (old_active && (new_active->link == BOND_LINK_UP) &&
bond_slave_is_up(new_active)) { bond_slave_is_up(new_active)) {
netdev_dbg(bond->dev, "Setting %s as active slave\n", slave_dbg(bond->dev, new_active->dev, "Setting as active slave\n");
new_active->dev->name);
bond_change_active_slave(bond, new_active); bond_change_active_slave(bond, new_active);
} else { } else {
netdev_err(bond->dev, "Could not set %s as active slave; either %s is down or the link is down\n", slave_err(bond->dev, new_active->dev, "Could not set as active slave; either %s is down or the link is down\n",
new_active->dev->name, new_active->dev->name);
new_active->dev->name);
ret = -EINVAL; ret = -EINVAL;
} }
} }
...@@ -1132,8 +1127,7 @@ static int bond_option_primary_set(struct bonding *bond, ...@@ -1132,8 +1127,7 @@ static int bond_option_primary_set(struct bonding *bond,
bond_for_each_slave(bond, slave, iter) { bond_for_each_slave(bond, slave, iter) {
if (strncmp(slave->dev->name, primary, IFNAMSIZ) == 0) { if (strncmp(slave->dev->name, primary, IFNAMSIZ) == 0) {
netdev_dbg(bond->dev, "Setting %s as primary slave\n", slave_dbg(bond->dev, slave->dev, "Setting as primary slave\n");
slave->dev->name);
rcu_assign_pointer(bond->primary_slave, slave); rcu_assign_pointer(bond->primary_slave, slave);
strcpy(bond->params.primary, slave->dev->name); strcpy(bond->params.primary, slave->dev->name);
bond->force_primary = true; bond->force_primary = true;
...@@ -1150,8 +1144,8 @@ static int bond_option_primary_set(struct bonding *bond, ...@@ -1150,8 +1144,8 @@ static int bond_option_primary_set(struct bonding *bond,
strncpy(bond->params.primary, primary, IFNAMSIZ); strncpy(bond->params.primary, primary, IFNAMSIZ);
bond->params.primary[IFNAMSIZ - 1] = 0; bond->params.primary[IFNAMSIZ - 1] = 0;
netdev_dbg(bond->dev, "Recording %s as primary, but it has not been enslaved to %s yet\n", netdev_dbg(bond->dev, "Recording %s as primary, but it has not been enslaved yet\n",
primary, bond->dev->name); primary);
out: out:
unblock_netpoll_tx(); unblock_netpoll_tx();
...@@ -1378,12 +1372,12 @@ static int bond_option_slaves_set(struct bonding *bond, ...@@ -1378,12 +1372,12 @@ static int bond_option_slaves_set(struct bonding *bond,
switch (command[0]) { switch (command[0]) {
case '+': case '+':
netdev_dbg(bond->dev, "Adding slave %s\n", dev->name); slave_dbg(bond->dev, dev, "Enslaving interface\n");
ret = bond_enslave(bond->dev, dev, NULL); ret = bond_enslave(bond->dev, dev, NULL);
break; break;
case '-': case '-':
netdev_dbg(bond->dev, "Removing slave %s\n", dev->name); slave_dbg(bond->dev, dev, "Releasing interface\n");
ret = bond_release(bond->dev, dev); ret = bond_release(bond->dev, dev);
break; break;
...@@ -1447,7 +1441,7 @@ static int bond_option_ad_actor_system_set(struct bonding *bond, ...@@ -1447,7 +1441,7 @@ static int bond_option_ad_actor_system_set(struct bonding *bond,
return 0; return 0;
err: err:
netdev_err(bond->dev, "Invalid MAC address.\n"); netdev_err(bond->dev, "Invalid ad_actor_system MAC address.\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -38,6 +38,15 @@ ...@@ -38,6 +38,15 @@
#define __long_aligned __attribute__((aligned((sizeof(long))))) #define __long_aligned __attribute__((aligned((sizeof(long)))))
#endif #endif
#define slave_info(bond_dev, slave_dev, fmt, ...) \
netdev_info(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__)
#define slave_warn(bond_dev, slave_dev, fmt, ...) \
netdev_warn(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__)
#define slave_dbg(bond_dev, slave_dev, fmt, ...) \
netdev_dbg(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__)
#define slave_err(bond_dev, slave_dev, fmt, ...) \
netdev_err(bond_dev, "(slave %s): " fmt, (slave_dev)->name, ##__VA_ARGS__)
#define BOND_MODE(bond) ((bond)->params.mode) #define BOND_MODE(bond) ((bond)->params.mode)
/* slave list primitives */ /* slave list primitives */
......
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