Skip to contentSkip to conversation

bonding: void calling rtmsg_ifinfo for netlink notifications

PATCH Superseded Xin Long 3 participants 9 messages Oct 17, 2017 – Oct 19, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Xin Long

author
#0 lore raw

cover bonding: void calling rtmsg_ifinfo for netlink notifications

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, the notifications can be handled by NETDEV_CHANGEUPPER and NETDEV_CHANGELOWERSTATE events in rtnetlink_event.

It could also fix some redundant notifications from bonding.

Xin Long (3):
bonding: remove rtmsg_ifinfo called in bond_master_upper_dev_link
rtnetlink: bring NETDEV_CHANGELOWERSTATE event process back to
rtnetlink_event
bonding: remove rtmsg_ifinfo called after bond_lower_state_changed

 drivers/net/bonding/bond_main.c | 11 +++--------
 include/net/bonding.h           |  4 ----
 net/core/rtnetlink.c            |  2 +-
 3 files changed, 4 insertions(+), 13 deletions(-)
Signature · 1 line
2.1.0
author
#1 lore raw

PATCH 1/3 bonding: remove rtmsg_ifinfo called in bond_master_upper_dev_link

Since commit 42e52bf9e3ae ("net: add netnotifier event for upper device change"), netdev_master_upper_dev_link has generated NETDEV_CHANGEUPPER event which would send a notification to userspace in rtnetlink_event.

There's no need to call rtmsg_ifinfo to send the notification any more. So this patch is to remove it from bond_master_upper_dev_link as well as bond_upper_dev_unlink to avoid the redundant notifications.

---
 drivers/net/bonding/bond_main.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/net/bonding/bond_main.c +3 -8
index c99dc59..ba75014 100644
@@ -1220,22 +1220,17 @@ static enum netdev_lag_tx_type bond_lag_tx_type(struct bonding *bond)
 static int bond_master_upper_dev_link(struct bonding *bond, struct slave *slave)
 {
 	struct netdev_lag_upper_info lag_upper_info;
-	int err;
 
 	lag_upper_info.tx_type = bond_lag_tx_type(bond);
-	err = netdev_master_upper_dev_link(slave->dev, bond->dev, slave,
-					   &lag_upper_info);
-	if (err)
-		return err;
-	rtmsg_ifinfo(RTM_NEWLINK, slave->dev, IFF_SLAVE, GFP_KERNEL);
-	return 0;
+
+	return netdev_master_upper_dev_link(slave->dev, bond->dev, slave,
+					    &lag_upper_info);
 }
 
 static void bond_upper_dev_unlink(struct bonding *bond, struct slave *slave)
 {
 	netdev_upper_dev_unlink(slave->dev, bond->dev);
 	slave->dev->flags &= ~IFF_SLAVE;
-	rtmsg_ifinfo(RTM_NEWLINK, slave->dev, IFF_SLAVE, GFP_KERNEL);
 }
 
 static struct slave *bond_alloc_slave(struct bonding *bond)
Signature · 1 line
2.1.0
author
#2 lore raw

PATCH 2/3 rtnetlink: bring NETDEV_CHANGELOWERSTATE event process back to rtnetlink_event

This patch is to bring NETDEV_CHANGELOWERSTATE event process back to rtnetlink_event so that bonding could use it instead of calling rtmsg_ifinfo to send a notification to userspace after netdev lower state is changed in the later patch.

---
 net/core/rtnetlink.c | 1 +
 1 file changed, 1 insertion(+)
net/core/rtnetlink.c +1 -0
index 5ace489..24cb403 100644
@@ -4292,6 +4292,7 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
 	case NETDEV_CHANGEUPPER:
 	case NETDEV_RESEND_IGMP:
 	case NETDEV_CHANGEINFODATA:
+	case NETDEV_CHANGELOWERSTATE:
 	case NETDEV_CHANGE_TX_QUEUE_LEN:
 		rtmsg_ifinfo_event(RTM_NEWLINK, dev, 0, rtnl_get_event(event),
 				   GFP_KERNEL);
Signature · 1 line
2.1.0
author
#3 lore raw

PATCH 3/3 bonding: remove rtmsg_ifinfo called after bond_lower_state_changed

After the patch 'rtnetlink: bring NETDEV_CHANGELOWERSTATE event process back to rtnetlink_event', bond_lower_state_changed would generate NETDEV_CHANGEUPPER event which would send a notification to userspace in rtnetlink_event.

There's no need to call rtmsg_ifinfo to send the notification any more. So this patch is to remove it from these places after bond_lower_state_changed.

Besides, after this, rtmsg_ifinfo is not needed to be exported.

---
 include/net/bonding.h | 4 ----
 net/core/rtnetlink.c  | 1 -
 2 files changed, 5 deletions(-)
include/net/bonding.h +0 -4
index b2e6865..1b7631c 100644
@@ -330,7 +330,6 @@ static inline void bond_set_active_slave(struct slave *slave)
 		slave->backup = 0;
 		bond_queue_slave_event(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)
 		slave->backup = 1;
 		bond_queue_slave_event(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,
 	slave->backup = slave_state;
 	if (notify) {
 		bond_lower_state_changed(slave);
-		rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
 		bond_queue_slave_event(slave);
 		slave->should_notify = 0;
 	} else {
@@ -385,7 +382,6 @@ static inline void bond_slave_state_notify(struct bonding *bond)
 	bond_for_each_slave(bond, tmp, iter) {
 		if (tmp->should_notify) {
 			bond_lower_state_changed(tmp);
-			rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_ATOMIC);
 			tmp->should_notify = 0;
 		}
 	}
net/core/rtnetlink.c +0 -1
index 24cb403..1574ab5 100644
@@ -2910,7 +2910,6 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned int change,
 {
 	rtmsg_ifinfo_event(type, dev, change, rtnl_get_event(0), flags);
 }
-EXPORT_SYMBOL(rtmsg_ifinfo);
 
 static int nlmsg_populate_fdb_fill(struct sk_buff *skb,
 				   struct net_device *dev,
Signature · 1 line
2.1.0
#4 lore raw
In reply to Xin Long
Quoted 8 lines · Tue, Oct 17, 2017 at 11:39:38AM CEST, [email protected] wrote:

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, the notifications can be handled by NETDEV_CHANGEUPPER and NETDEV_CHANGELOWERSTATE events in rtnetlink_event.

It could also fix some redundant notifications from bonding.

This should go to net-next.

Quoted 15 lines

Xin Long (3):
bonding: remove rtmsg_ifinfo called in bond_master_upper_dev_link
rtnetlink: bring NETDEV_CHANGELOWERSTATE event process back to
rtnetlink_event
bonding: remove rtmsg_ifinfo called after bond_lower_state_changed

drivers/net/bonding/bond_main.c | 11 +++--------
include/net/bonding.h           |  4 ----
net/core/rtnetlink.c            |  2 +-
3 files changed, 4 insertions(+), 13 deletions(-)
Signature · 1 line
2.1.0
author
#5 lore raw
Quoted 11 lines · Jiri Pirko
Quoted 8 lines · Tue, Oct 17, 2017 at 11:39:38AM CEST, [email protected] wrote:

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, the notifications can be handled by NETDEV_CHANGEUPPER and NETDEV_CHANGELOWERSTATE events in rtnetlink_event.

It could also fix some redundant notifications from bonding.

This should go to net-next.

NETDEV_CHANGEUPPER is not yet in rtnetlink_event in net-next tree. patches can only work on net tree by now.

Hi, David, you want me to hold them until the patches for NETDEV_CHANGEUPPER are copied to net-next, or you would apply them to net ?

Quoted 17 lines
Quoted 17 lines

Xin Long (3):
bonding: remove rtmsg_ifinfo called in bond_master_upper_dev_link
rtnetlink: bring NETDEV_CHANGELOWERSTATE event process back to
rtnetlink_event
bonding: remove rtmsg_ifinfo called after bond_lower_state_changed

drivers/net/bonding/bond_main.c | 11 +++--------
include/net/bonding.h           |  4 ----
net/core/rtnetlink.c            |  2 +-
3 files changed, 4 insertions(+), 13 deletions(-)

--
2.1.0

#6 lore raw
Quoted 11 lines · Tue, Oct 17, 2017 at 12:28:45PM CEST, [email protected] wrote:
Quoted 10 lines · Jiri Pirko
Quoted 8 lines · Tue, Oct 17, 2017 at 11:39:38AM CEST, [email protected] wrote:

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, the notifications can be handled by NETDEV_CHANGEUPPER and NETDEV_CHANGELOWERSTATE events in rtnetlink_event.

It could also fix some redundant notifications from bonding.

Quoted 7 lines
Quoted 1 line

This should go to net-next.

NETDEV_CHANGEUPPER is not yet in rtnetlink_event in net-next tree. patches can only work on net tree by now.

Hi, David, you want me to hold them until the patches for NETDEV_CHANGEUPPER are copied to net-next, or you would apply them to net ?

This patchset is not fix right? I see no "Fixes" line. You should wait until the dependency is merged to net-next, rebase, post for net-next.

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

Xin Long (3):
bonding: remove rtmsg_ifinfo called in bond_master_upper_dev_link
rtnetlink: bring NETDEV_CHANGELOWERSTATE event process back to
rtnetlink_event
bonding: remove rtmsg_ifinfo called after bond_lower_state_changed

drivers/net/bonding/bond_main.c | 11 +++--------
include/net/bonding.h           |  4 ----
net/core/rtnetlink.c            |  2 +-
3 files changed, 4 insertions(+), 13 deletions(-)

--
2.1.0

author
#7 lore raw
Quoted 14 lines · Jiri Pirko
Quoted 13 lines · Tue, Oct 17, 2017 at 12:28:45PM CEST, [email protected] wrote:
Quoted 11 lines · Jiri Pirko
Quoted 8 lines · Tue, Oct 17, 2017 at 11:39:38AM CEST, [email protected] wrote:

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, the notifications can be handled by NETDEV_CHANGEUPPER and NETDEV_CHANGELOWERSTATE events in rtnetlink_event.

It could also fix some redundant notifications from bonding.

This should go to net-next.

Quoted 8 lines
Quoted 5 lines

NETDEV_CHANGEUPPER is not yet in rtnetlink_event in net-next tree. patches can only work on net tree by now.

Hi, David, you want me to hold them until the patches for NETDEV_CHANGEUPPER are copied to net-next, or you would apply them to net ?

This patchset is not fix right? I see no "Fixes" line. You should wait until the dependency is merged to net-next, rebase, post for net-next.

Copy, thanks Jiri.

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines

Xin Long (3):
bonding: remove rtmsg_ifinfo called in bond_master_upper_dev_link
rtnetlink: bring NETDEV_CHANGELOWERSTATE event process back to
rtnetlink_event
bonding: remove rtmsg_ifinfo called after bond_lower_state_changed

drivers/net/bonding/bond_main.c | 11 +++--------
include/net/bonding.h           |  4 ----
net/core/rtnetlink.c            |  2 +-
3 files changed, 4 insertions(+), 13 deletions(-)

--
2.1.0

maintainer
#8 lore raw
In reply to Xin Long

From: Xin Long <[email protected]>
Date: Tue, 17 Oct 2017 18:28:45 +0800

Quoted 11 lines · Jiri Pirko
Quoted 10 lines
Quoted 8 lines · Tue, Oct 17, 2017 at 11:39:38AM CEST, [email protected] wrote:

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, the notifications can be handled by NETDEV_CHANGEUPPER and NETDEV_CHANGELOWERSTATE events in rtnetlink_event.

It could also fix some redundant notifications from bonding.

Quoted 7 lines
Quoted 1 line

This should go to net-next.

NETDEV_CHANGEUPPER is not yet in rtnetlink_event in net-next tree. patches can only work on net tree by now.

Hi, David, you want me to hold them until the patches for NETDEV_CHANGEUPPER are copied to net-next, or you would apply them to net ?

Please hold until net is next merged into net-next, thank you.