netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications
@ 2017-10-17  9:39 Xin Long
  2017-10-17  9:39 ` [PATCH net 1/3] bonding: remove rtmsg_ifinfo called in bond_master_upper_dev_link Xin Long
  2017-10-17  9:59 ` [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications Jiri Pirko
  0 siblings, 2 replies; 9+ messages in thread
From: Xin Long @ 2017-10-17  9:39 UTC (permalink / raw)
  To: network dev; +Cc: davem, Jiri Pirko

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(-)

-- 
2.1.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net 1/3] bonding: remove rtmsg_ifinfo called in bond_master_upper_dev_link
  2017-10-17  9:39 [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications Xin Long
@ 2017-10-17  9:39 ` Xin Long
  2017-10-17  9:39   ` [PATCH net 2/3] rtnetlink: bring NETDEV_CHANGELOWERSTATE event process back to rtnetlink_event Xin Long
  2017-10-17  9:59 ` [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications Jiri Pirko
  1 sibling, 1 reply; 9+ messages in thread
From: Xin Long @ 2017-10-17  9:39 UTC (permalink / raw)
  To: network dev; +Cc: davem, Jiri Pirko

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.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 drivers/net/bonding/bond_main.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c99dc59..ba75014 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -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)
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net 2/3] rtnetlink: bring NETDEV_CHANGELOWERSTATE event process back to rtnetlink_event
  2017-10-17  9:39 ` [PATCH net 1/3] bonding: remove rtmsg_ifinfo called in bond_master_upper_dev_link Xin Long
@ 2017-10-17  9:39   ` Xin Long
  2017-10-17  9:39     ` [PATCH net 3/3] bonding: remove rtmsg_ifinfo called after bond_lower_state_changed Xin Long
  0 siblings, 1 reply; 9+ messages in thread
From: Xin Long @ 2017-10-17  9:39 UTC (permalink / raw)
  To: network dev; +Cc: davem, Jiri Pirko

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.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/core/rtnetlink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 5ace489..24cb403 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -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);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net 3/3] bonding: remove rtmsg_ifinfo called after bond_lower_state_changed
  2017-10-17  9:39   ` [PATCH net 2/3] rtnetlink: bring NETDEV_CHANGELOWERSTATE event process back to rtnetlink_event Xin Long
@ 2017-10-17  9:39     ` Xin Long
  0 siblings, 0 replies; 9+ messages in thread
From: Xin Long @ 2017-10-17  9:39 UTC (permalink / raw)
  To: network dev; +Cc: davem, Jiri Pirko

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.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 include/net/bonding.h | 4 ----
 net/core/rtnetlink.c  | 1 -
 2 files changed, 5 deletions(-)

diff --git a/include/net/bonding.h b/include/net/bonding.h
index b2e6865..1b7631c 100644
--- a/include/net/bonding.h
+++ b/include/net/bonding.h
@@ -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;
 		}
 	}
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 24cb403..1574ab5 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -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,
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications
  2017-10-17  9:39 [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications Xin Long
  2017-10-17  9:39 ` [PATCH net 1/3] bonding: remove rtmsg_ifinfo called in bond_master_upper_dev_link Xin Long
@ 2017-10-17  9:59 ` Jiri Pirko
  2017-10-17 10:28   ` Xin Long
  1 sibling, 1 reply; 9+ messages in thread
From: Jiri Pirko @ 2017-10-17  9:59 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, davem

Tue, Oct 17, 2017 at 11:39:38AM CEST, lucien.xin@gmail.com 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.


>
>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
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications
  2017-10-17  9:59 ` [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications Jiri Pirko
@ 2017-10-17 10:28   ` Xin Long
  2017-10-17 10:38     ` Jiri Pirko
  2017-10-19 12:03     ` David Miller
  0 siblings, 2 replies; 9+ messages in thread
From: Xin Long @ 2017-10-17 10:28 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: network dev, davem

On Tue, Oct 17, 2017 at 5:59 PM, Jiri Pirko <jiri@resnulli.us> wrote:
> Tue, Oct 17, 2017 at 11:39:38AM CEST, lucien.xin@gmail.com 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 ?

>
>
>>
>>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
>>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications
  2017-10-17 10:28   ` Xin Long
@ 2017-10-17 10:38     ` Jiri Pirko
  2017-10-17 10:48       ` Xin Long
  2017-10-19 12:03     ` David Miller
  1 sibling, 1 reply; 9+ messages in thread
From: Jiri Pirko @ 2017-10-17 10:38 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, davem

Tue, Oct 17, 2017 at 12:28:45PM CEST, lucien.xin@gmail.com wrote:
>On Tue, Oct 17, 2017 at 5:59 PM, Jiri Pirko <jiri@resnulli.us> wrote:
>> Tue, Oct 17, 2017 at 11:39:38AM CEST, lucien.xin@gmail.com 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 ?

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.



>
>>
>>
>>>
>>>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
>>>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications
  2017-10-17 10:38     ` Jiri Pirko
@ 2017-10-17 10:48       ` Xin Long
  0 siblings, 0 replies; 9+ messages in thread
From: Xin Long @ 2017-10-17 10:48 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: network dev, davem

On Tue, Oct 17, 2017 at 6:38 PM, Jiri Pirko <jiri@resnulli.us> wrote:
> Tue, Oct 17, 2017 at 12:28:45PM CEST, lucien.xin@gmail.com wrote:
>>On Tue, Oct 17, 2017 at 5:59 PM, Jiri Pirko <jiri@resnulli.us> wrote:
>>> Tue, Oct 17, 2017 at 11:39:38AM CEST, lucien.xin@gmail.com 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 ?
>
> 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.

>
>
>
>>
>>>
>>>
>>>>
>>>>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
>>>>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications
  2017-10-17 10:28   ` Xin Long
  2017-10-17 10:38     ` Jiri Pirko
@ 2017-10-19 12:03     ` David Miller
  1 sibling, 0 replies; 9+ messages in thread
From: David Miller @ 2017-10-19 12:03 UTC (permalink / raw)
  To: lucien.xin; +Cc: jiri, netdev

From: Xin Long <lucien.xin@gmail.com>
Date: Tue, 17 Oct 2017 18:28:45 +0800

> On Tue, Oct 17, 2017 at 5:59 PM, Jiri Pirko <jiri@resnulli.us> wrote:
>> Tue, Oct 17, 2017 at 11:39:38AM CEST, lucien.xin@gmail.com 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 ?

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-10-19 12:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-17  9:39 [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications Xin Long
2017-10-17  9:39 ` [PATCH net 1/3] bonding: remove rtmsg_ifinfo called in bond_master_upper_dev_link Xin Long
2017-10-17  9:39   ` [PATCH net 2/3] rtnetlink: bring NETDEV_CHANGELOWERSTATE event process back to rtnetlink_event Xin Long
2017-10-17  9:39     ` [PATCH net 3/3] bonding: remove rtmsg_ifinfo called after bond_lower_state_changed Xin Long
2017-10-17  9:59 ` [PATCH net 0/3] bonding: void calling rtmsg_ifinfo for netlink notifications Jiri Pirko
2017-10-17 10:28   ` Xin Long
2017-10-17 10:38     ` Jiri Pirko
2017-10-17 10:48       ` Xin Long
2017-10-19 12:03     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).