Commit a4cdd9ff authored by David S. Miller's avatar David S. Miller

Merge branch 'net-remove-rtmsg_ifinfo-used-in-bridge-and-bonding'

Xin Long says:

====================
net: remove rtmsg_ifinfo used in bridge and bonding

It's better to send notifications to userspace by the events in
rtnetlink_event, instead of calling rtmsg_ifinfo directly.

This patcheset is to remove rtmsg_ifinfo called in bonding and
bridge, the notifications can be handled by NETDEV_CHANGEUPPER
and NETDEV_CHANGELOWERSTATE events in rtnetlink_event.

It could also fix some redundant notifications from bonding and
bridge.

v1->v2:
  - post to net-next.git instead of net.git, for it's more like an
    improvement for bonding
v2->v3:
  - add patch 1/4 to remove rtmsg_ifinfo called in add_del_if
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d4588211 ef5201c8
...@@ -1221,22 +1221,17 @@ static int bond_master_upper_dev_link(struct bonding *bond, struct slave *slave, ...@@ -1221,22 +1221,17 @@ static int bond_master_upper_dev_link(struct bonding *bond, struct slave *slave,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
struct netdev_lag_upper_info lag_upper_info; struct netdev_lag_upper_info lag_upper_info;
int err;
lag_upper_info.tx_type = bond_lag_tx_type(bond); lag_upper_info.tx_type = bond_lag_tx_type(bond);
err = netdev_master_upper_dev_link(slave->dev, bond->dev, slave,
&lag_upper_info, extack); return netdev_master_upper_dev_link(slave->dev, bond->dev, slave,
if (err) &lag_upper_info, extack);
return err;
rtmsg_ifinfo(RTM_NEWLINK, slave->dev, IFF_SLAVE, GFP_KERNEL);
return 0;
} }
static void bond_upper_dev_unlink(struct bonding *bond, struct slave *slave) static void bond_upper_dev_unlink(struct bonding *bond, struct slave *slave)
{ {
netdev_upper_dev_unlink(slave->dev, bond->dev); netdev_upper_dev_unlink(slave->dev, bond->dev);
slave->dev->flags &= ~IFF_SLAVE; slave->dev->flags &= ~IFF_SLAVE;
rtmsg_ifinfo(RTM_NEWLINK, slave->dev, IFF_SLAVE, GFP_KERNEL);
} }
static struct slave *bond_alloc_slave(struct bonding *bond) static struct slave *bond_alloc_slave(struct bonding *bond)
......
...@@ -330,7 +330,6 @@ static inline void bond_set_active_slave(struct slave *slave) ...@@ -330,7 +330,6 @@ static inline void bond_set_active_slave(struct slave *slave)
slave->backup = 0; slave->backup = 0;
bond_queue_slave_event(slave); bond_queue_slave_event(slave);
bond_lower_state_changed(slave); bond_lower_state_changed(slave);
rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
} }
} }
...@@ -340,7 +339,6 @@ static inline void bond_set_backup_slave(struct slave *slave) ...@@ -340,7 +339,6 @@ static inline void bond_set_backup_slave(struct slave *slave)
slave->backup = 1; slave->backup = 1;
bond_queue_slave_event(slave); bond_queue_slave_event(slave);
bond_lower_state_changed(slave); bond_lower_state_changed(slave);
rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
} }
} }
...@@ -353,7 +351,6 @@ static inline void bond_set_slave_state(struct slave *slave, ...@@ -353,7 +351,6 @@ static inline void bond_set_slave_state(struct slave *slave,
slave->backup = slave_state; slave->backup = slave_state;
if (notify) { if (notify) {
bond_lower_state_changed(slave); bond_lower_state_changed(slave);
rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
bond_queue_slave_event(slave); bond_queue_slave_event(slave);
slave->should_notify = 0; slave->should_notify = 0;
} else { } else {
...@@ -385,7 +382,6 @@ static inline void bond_slave_state_notify(struct bonding *bond) ...@@ -385,7 +382,6 @@ static inline void bond_slave_state_notify(struct bonding *bond)
bond_for_each_slave(bond, tmp, iter) { bond_for_each_slave(bond, tmp, iter) {
if (tmp->should_notify) { if (tmp->should_notify) {
bond_lower_state_changed(tmp); bond_lower_state_changed(tmp);
rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_ATOMIC);
tmp->should_notify = 0; tmp->should_notify = 0;
} }
} }
......
...@@ -102,9 +102,6 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd) ...@@ -102,9 +102,6 @@ static int add_del_if(struct net_bridge *br, int ifindex, int isadd)
else else
ret = br_del_if(br, dev); ret = br_del_if(br, dev);
if (!ret)
rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_MASTER, GFP_KERNEL);
return ret; return ret;
} }
......
...@@ -2989,7 +2989,6 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned int change, ...@@ -2989,7 +2989,6 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned int change,
{ {
rtmsg_ifinfo_event(type, dev, change, rtnl_get_event(0), flags, NULL); rtmsg_ifinfo_event(type, dev, change, rtnl_get_event(0), flags, NULL);
} }
EXPORT_SYMBOL(rtmsg_ifinfo);
void rtmsg_ifinfo_newnet(int type, struct net_device *dev, unsigned int change, void rtmsg_ifinfo_newnet(int type, struct net_device *dev, unsigned int change,
gfp_t flags, int *new_nsid) gfp_t flags, int *new_nsid)
...@@ -4385,6 +4384,7 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi ...@@ -4385,6 +4384,7 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
case NETDEV_CHANGEUPPER: case NETDEV_CHANGEUPPER:
case NETDEV_RESEND_IGMP: case NETDEV_RESEND_IGMP:
case NETDEV_CHANGEINFODATA: case NETDEV_CHANGEINFODATA:
case NETDEV_CHANGELOWERSTATE:
case NETDEV_CHANGE_TX_QUEUE_LEN: case NETDEV_CHANGE_TX_QUEUE_LEN:
rtmsg_ifinfo_event(RTM_NEWLINK, dev, 0, rtnl_get_event(event), rtmsg_ifinfo_event(RTM_NEWLINK, dev, 0, rtnl_get_event(event),
GFP_KERNEL, NULL); GFP_KERNEL, NULL);
......
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