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,
if (arp->op_code == htons(ARPOP_REPLY)) {
/* update rx hash table for this 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:
return RX_HANDLER_ANOTHER;
......@@ -442,8 +442,9 @@ static void rlb_update_client(struct rlb_client_info *client_info)
client_info->slave->dev->dev_addr,
client_info->mac_dst);
if (!skb) {
netdev_err(client_info->slave->bond->dev,
"failed to create an ARP packet\n");
slave_err(client_info->slave->bond->dev,
client_info->slave->dev,
"failed to create an ARP packet\n");
continue;
}
......@@ -667,14 +668,15 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
if (tx_slave)
bond_hw_addr_copy(arp->mac_src, tx_slave->dev->dev_addr,
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)) {
/* Create an entry in the rx_hashtbl for this client as a
* place holder.
* When the arp reply is received the entry will be updated
* 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
* 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)
* updated with their assigned mac.
*/
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;
......@@ -923,9 +926,8 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[],
skb->priority = TC_PRIO_CONTROL;
skb->dev = slave->dev;
netdev_dbg(slave->bond->dev,
"Send learning packet: dev %s mac %pM vlan %d\n",
slave->dev->name, mac_addr, vid);
slave_dbg(slave->bond->dev, slave->dev,
"Send learning packet: mac %pM vlan %d\n", mac_addr, vid);
if (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[],
memcpy(ss.__data, addr, len);
ss.ss_family = dev->type;
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",
dev->name);
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");
return -EOPNOTSUPP;
}
return 0;
......@@ -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,
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->dev->name, free_mac_slave->dev->name);
slave_warn(bond->dev, slave->dev, "the slave hw address is in use by the bond; giving it the hw address of %s\n",
free_mac_slave->dev->name);
} 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->dev->name);
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");
return -EFAULT;
}
......
This diff is collapsed.
......@@ -783,14 +783,12 @@ static int bond_option_active_slave_set(struct bonding *bond,
if (slave_dev) {
if (!netif_is_bond_slave(slave_dev)) {
netdev_err(bond->dev, "Device %s is not bonding slave\n",
slave_dev->name);
slave_err(bond->dev, slave_dev, "Device is not bonding slave\n");
return -EINVAL;
}
if (bond->dev != netdev_master_upper_dev_get(slave_dev)) {
netdev_err(bond->dev, "Device %s is not our slave\n",
slave_dev->name);
slave_err(bond->dev, slave_dev, "Device is not our slave\n");
return -EINVAL;
}
}
......@@ -809,18 +807,15 @@ static int bond_option_active_slave_set(struct bonding *bond,
if (new_active == old_active) {
/* do nothing */
netdev_dbg(bond->dev, "%s is already the current active slave\n",
new_active->dev->name);
slave_dbg(bond->dev, new_active->dev, "is already the current active slave\n");
} else {
if (old_active && (new_active->link == BOND_LINK_UP) &&
bond_slave_is_up(new_active)) {
netdev_dbg(bond->dev, "Setting %s as active slave\n",
new_active->dev->name);
slave_dbg(bond->dev, new_active->dev, "Setting as active slave\n");
bond_change_active_slave(bond, new_active);
} else {
netdev_err(bond->dev, "Could not set %s as active slave; either %s is down or the link is down\n",
new_active->dev->name,
new_active->dev->name);
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);
ret = -EINVAL;
}
}
......@@ -1132,8 +1127,7 @@ static int bond_option_primary_set(struct bonding *bond,
bond_for_each_slave(bond, slave, iter) {
if (strncmp(slave->dev->name, primary, IFNAMSIZ) == 0) {
netdev_dbg(bond->dev, "Setting %s as primary slave\n",
slave->dev->name);
slave_dbg(bond->dev, slave->dev, "Setting as primary slave\n");
rcu_assign_pointer(bond->primary_slave, slave);
strcpy(bond->params.primary, slave->dev->name);
bond->force_primary = true;
......@@ -1150,8 +1144,8 @@ static int bond_option_primary_set(struct bonding *bond,
strncpy(bond->params.primary, primary, IFNAMSIZ);
bond->params.primary[IFNAMSIZ - 1] = 0;
netdev_dbg(bond->dev, "Recording %s as primary, but it has not been enslaved to %s yet\n",
primary, bond->dev->name);
netdev_dbg(bond->dev, "Recording %s as primary, but it has not been enslaved yet\n",
primary);
out:
unblock_netpoll_tx();
......@@ -1378,12 +1372,12 @@ static int bond_option_slaves_set(struct bonding *bond,
switch (command[0]) {
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);
break;
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);
break;
......@@ -1447,7 +1441,7 @@ static int bond_option_ad_actor_system_set(struct bonding *bond,
return 0;
err:
netdev_err(bond->dev, "Invalid MAC address.\n");
netdev_err(bond->dev, "Invalid ad_actor_system MAC address.\n");
return -EINVAL;
}
......
......@@ -38,6 +38,15 @@
#define __long_aligned __attribute__((aligned((sizeof(long)))))
#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)
/* 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