Commit 7a575f6b authored by David S. Miller's avatar David S. Miller

Merge branch 'bonding-next'

Veaceslav Falico says:

====================
bonding: convert pr_* to netdev_*

Currently bonding uses pr_info/warn/etc. function to print something, while
it's encouraged to use netdev_info/warn/etc. in net/.

This patchset converts them where possible (i.e. where we have a working
net_device). Also, convert pr_ratelimit* to net_() and remove the pr_fmt,
to unify netdev_* and pr_* outputs.
====================

CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: default avatarVeaceslav Falico <vfalico@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a84bc2a9 cb252358
This diff is collapsed.
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
* *
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
...@@ -369,7 +367,7 @@ static int rlb_arp_recv(const struct sk_buff *skb, struct bonding *bond, ...@@ -369,7 +367,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);
pr_debug("Server received an ARP Reply from client\n"); netdev_dbg(bond->dev, "Server received an ARP Reply from client\n");
} }
out: out:
return RX_HANDLER_ANOTHER; return RX_HANDLER_ANOTHER;
...@@ -535,8 +533,8 @@ static void rlb_update_client(struct rlb_client_info *client_info) ...@@ -535,8 +533,8 @@ 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) {
pr_err("%s: Error: failed to create an ARP packet\n", netdev_err(client_info->slave->bond->dev,
client_info->slave->bond->dev->name); "failed to create an ARP packet\n");
continue; continue;
} }
...@@ -545,8 +543,8 @@ static void rlb_update_client(struct rlb_client_info *client_info) ...@@ -545,8 +543,8 @@ static void rlb_update_client(struct rlb_client_info *client_info)
if (client_info->vlan_id) { if (client_info->vlan_id) {
skb = vlan_put_tag(skb, htons(ETH_P_8021Q), client_info->vlan_id); skb = vlan_put_tag(skb, htons(ETH_P_8021Q), client_info->vlan_id);
if (!skb) { if (!skb) {
pr_err("%s: Error: failed to insert VLAN tag\n", netdev_err(client_info->slave->bond->dev,
client_info->slave->bond->dev->name); "failed to insert VLAN tag\n");
continue; continue;
} }
} }
...@@ -630,8 +628,7 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 src_ip) ...@@ -630,8 +628,7 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, __be32 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) {
pr_err("%s: Error: found a client with no channel in the client's hash table\n", netdev_err(bond->dev, "found a client with no channel in the client's hash table\n");
bond->dev->name);
continue; continue;
} }
/*update all clients using this src_ip, that are not assigned /*update all clients using this src_ip, that are not assigned
...@@ -767,7 +764,7 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) ...@@ -767,7 +764,7 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
tx_slave = rlb_choose_channel(skb, bond); tx_slave = rlb_choose_channel(skb, bond);
if (tx_slave) if (tx_slave)
ether_addr_copy(arp->mac_src, tx_slave->dev->dev_addr); ether_addr_copy(arp->mac_src, tx_slave->dev->dev_addr);
pr_debug("Server sent ARP Reply packet\n"); netdev_dbg(bond->dev, "Server sent ARP Reply packet\n");
} 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.
...@@ -787,7 +784,7 @@ static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) ...@@ -787,7 +784,7 @@ 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);
pr_debug("Server sent ARP Request packet\n"); netdev_dbg(bond->dev, "Server sent ARP Request packet\n");
} }
return tx_slave; return tx_slave;
...@@ -1026,8 +1023,7 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[], ...@@ -1026,8 +1023,7 @@ static void alb_send_lp_vid(struct slave *slave, u8 mac_addr[],
if (vid) { if (vid) {
skb = vlan_put_tag(skb, vlan_proto, vid); skb = vlan_put_tag(skb, vlan_proto, vid);
if (!skb) { if (!skb) {
pr_err("%s: Error: failed to insert VLAN tag\n", netdev_err(slave->bond->dev, "failed to insert VLAN tag\n");
slave->bond->dev->name);
return; return;
} }
} }
...@@ -1093,9 +1089,8 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[]) ...@@ -1093,9 +1089,8 @@ static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[])
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)) {
pr_err("%s: Error: dev_set_mac_address of dev %s failed!\n" 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",
"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->bond->dev->name, dev->name);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
return 0; return 0;
...@@ -1269,13 +1264,12 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav ...@@ -1269,13 +1264,12 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
if (free_mac_slave) { if (free_mac_slave) {
alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr); alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr);
pr_warn("%s: Warning: the hw address of slave %s is in use by the bond; giving it the hw address of %s\n", netdev_warn(bond->dev, "the hw address of slave %s is in use by the bond; giving it the hw address of %s\n",
bond->dev->name, slave->dev->name, slave->dev->name, free_mac_slave->dev->name);
free_mac_slave->dev->name);
} else if (has_bond_addr) { } else if (has_bond_addr) {
pr_err("%s: 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", 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",
bond->dev->name, slave->dev->name); slave->dev->name);
return -EFAULT; return -EFAULT;
} }
......
...@@ -69,8 +69,7 @@ void bond_debug_register(struct bonding *bond) ...@@ -69,8 +69,7 @@ void bond_debug_register(struct bonding *bond)
debugfs_create_dir(bond->dev->name, bonding_debug_root); debugfs_create_dir(bond->dev->name, bonding_debug_root);
if (!bond->debug_dir) { if (!bond->debug_dir) {
pr_warn("%s: Warning: failed to register to debugfs\n", netdev_warn(bond->dev, "failed to register to debugfs\n");
bond->dev->name);
return; return;
} }
...@@ -98,8 +97,7 @@ void bond_debug_reregister(struct bonding *bond) ...@@ -98,8 +97,7 @@ void bond_debug_reregister(struct bonding *bond)
if (d) { if (d) {
bond->debug_dir = d; bond->debug_dir = d;
} else { } else {
pr_warn("%s: Warning: failed to reregister, so just unregister old one\n", netdev_warn(bond->dev, "failed to reregister, so just unregister old one\n");
bond->dev->name);
bond_debug_unregister(bond); bond_debug_unregister(bond);
} }
} }
......
This diff is collapsed.
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
* (at your option) any later version. * (at your option) any later version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
...@@ -181,8 +179,7 @@ static int bond_changelink(struct net_device *bond_dev, ...@@ -181,8 +179,7 @@ static int bond_changelink(struct net_device *bond_dev,
int arp_interval = nla_get_u32(data[IFLA_BOND_ARP_INTERVAL]); int arp_interval = nla_get_u32(data[IFLA_BOND_ARP_INTERVAL]);
if (arp_interval && miimon) { if (arp_interval && miimon) {
pr_err("%s: ARP monitoring cannot be used with MII monitoring\n", netdev_err(bond->dev, "ARP monitoring cannot be used with MII monitoring\n");
bond->dev->name);
return -EINVAL; return -EINVAL;
} }
...@@ -207,8 +204,7 @@ static int bond_changelink(struct net_device *bond_dev, ...@@ -207,8 +204,7 @@ static int bond_changelink(struct net_device *bond_dev,
i++; i++;
} }
if (i == 0 && bond->params.arp_interval) if (i == 0 && bond->params.arp_interval)
pr_warn("%s: Removing last arp target with arp_interval on\n", netdev_warn(bond->dev, "Removing last arp target with arp_interval on\n");
bond->dev->name);
if (err) if (err)
return err; return err;
} }
...@@ -216,8 +212,7 @@ static int bond_changelink(struct net_device *bond_dev, ...@@ -216,8 +212,7 @@ static int bond_changelink(struct net_device *bond_dev,
int arp_validate = nla_get_u32(data[IFLA_BOND_ARP_VALIDATE]); int arp_validate = nla_get_u32(data[IFLA_BOND_ARP_VALIDATE]);
if (arp_validate && miimon) { if (arp_validate && miimon) {
pr_err("%s: ARP validating cannot be used with MII monitoring\n", netdev_err(bond->dev, "ARP validating cannot be used with MII monitoring\n");
bond->dev->name);
return -EINVAL; return -EINVAL;
} }
......
This diff is collapsed.
...@@ -252,8 +252,8 @@ void bond_create_proc_entry(struct bonding *bond) ...@@ -252,8 +252,8 @@ void bond_create_proc_entry(struct bonding *bond)
S_IRUGO, bn->proc_dir, S_IRUGO, bn->proc_dir,
&bond_info_fops, bond); &bond_info_fops, bond);
if (bond->proc_entry == NULL) if (bond->proc_entry == NULL)
pr_warn("Warning: Cannot create /proc/net/%s/%s\n", netdev_warn(bond_dev, "Cannot create /proc/net/%s/%s\n",
DRV_NAME, bond_dev->name); DRV_NAME, bond_dev->name);
else else
memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ); memcpy(bond->proc_file_name, bond_dev->name, IFNAMSIZ);
} }
......
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