Skip to contentSkip to conversation

rtnetlink: Cleanup user notifications for netdev events

PATCH In review David Ahern 2 participants 10 messages Apr 12, 2017 – Apr 13, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover rtnetlink: Cleanup user notifications for netdev events

Vlad's recent patch to add the event type to rtnetlink notifications points out a number of redundant or unnecessary notifications sent to userspace for events that are essentially internal to the kernel. Trim the list to put a dent in the notification storm.

v2
- rebased to top of net-next with IFLA_EVENT patch reverted
- dropped removal NETDEV_CHANGEINFODATA since it is intentionally only to send a message to userspace
- dropped NOTIFY_PEERS since Vlad's says it is needed for macvlans
- add patches to remove NETDEV_CHANGEUPPER and NETDEV_CHANGE_TX_QUEUE_LEN from the event list

David Ahern (8):
rtnetlink: Do not generate notifications for MTU events
rtnetlink: Do not generate notification for UDP_TUNNEL_PUSH_INFO
rtnetlink: Do not generate notifications for CHANGEADDR event
rtnetlink: Do not generate notifications for POST_TYPE_CHANGE event
rtnetlink: Do not generate notifications for PRECHANGEUPPER event
rtnetlink: Do not generate notifications for CHANGELOWERSTATE event
rtnetlink: Do not generate notifications for NETDEV_CHANGEUPPER event
rtnetlink: Do not generate notifications for
NETDEV_CHANGE_TX_QUEUE_LEN event

 net/core/rtnetlink.c | 9 ---------
 1 file changed, 9 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH v2 1/8 rtnetlink: Do not generate notifications for MTU events

Changing MTU on a link currently causes 3 messages to be sent to userspace:

[LINK]11: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1490 qdisc noqueue state UNKNOWN group default

    link/ether f2:52:5c:6d:21:f3 brd ff:ff:ff:ff:ff:ff

[LINK]11: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default

    link/ether f2:52:5c:6d:21:f3 brd ff:ff:ff:ff:ff:ff

[LINK]11: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default

    link/ether f2:52:5c:6d:21:f3 brd ff:ff:ff:ff:ff:ff

Remove the messages sent for PRE_CHANGE_MTU and CHANGE_MTU netdev events.

---
 net/core/rtnetlink.c | 2 --
 1 file changed, 2 deletions(-)
net/core/rtnetlink.c +0 -2
index 58419da7961b..79ab43796b08 100644
@@ -4117,7 +4117,6 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
 
 	switch (event) {
 	case NETDEV_REBOOT:
-	case NETDEV_CHANGEMTU:
 	case NETDEV_CHANGEADDR:
 	case NETDEV_CHANGENAME:
 	case NETDEV_FEAT_CHANGE:
@@ -4126,7 +4125,6 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
 	case NETDEV_NOTIFY_PEERS:
 	case NETDEV_CHANGEUPPER:
 	case NETDEV_RESEND_IGMP:
-	case NETDEV_PRECHANGEMTU:
 	case NETDEV_CHANGEINFODATA:
 	case NETDEV_PRECHANGEUPPER:
 	case NETDEV_CHANGELOWERSTATE:
Signature · 1 line
2.1.4
#2 lore raw

PATCH v2 2/8 rtnetlink: Do not generate notification for UDP_TUNNEL_PUSH_INFO

In reply to David Ahern

NETDEV_UDP_TUNNEL_PUSH_INFO is an internal notifier; nothing userspace can do so don't generate a netlink notification.

---
 net/core/rtnetlink.c | 1 -
 1 file changed, 1 deletion(-)
net/core/rtnetlink.c +0 -1
index 79ab43796b08..58722bf10d50 100644
@@ -4128,7 +4128,6 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
 	case NETDEV_CHANGEINFODATA:
 	case NETDEV_PRECHANGEUPPER:
 	case NETDEV_CHANGELOWERSTATE:
-	case NETDEV_UDP_TUNNEL_PUSH_INFO:
 	case NETDEV_CHANGE_TX_QUEUE_LEN:
 		rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL);
 		break;
Signature · 1 line
2.1.4
#3 lore raw

PATCH v2 3/8 rtnetlink: Do not generate notifications for CHANGEADDR event

In reply to David Ahern

Changing hardware address generates redundant messages:

[LINK]11: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default

    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff

[LINK]11: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default

    link/ether 02:02:02:02:02:02 brd ff:ff:ff:ff:ff:ff

Do not send a notification for the CHANGEADDR notifier.

---
 net/core/rtnetlink.c | 1 -
 1 file changed, 1 deletion(-)
net/core/rtnetlink.c +0 -1
index 58722bf10d50..574f9b79919a 100644
@@ -4117,7 +4117,6 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
 
 	switch (event) {
 	case NETDEV_REBOOT:
-	case NETDEV_CHANGEADDR:
 	case NETDEV_CHANGENAME:
 	case NETDEV_FEAT_CHANGE:
 	case NETDEV_BONDING_FAILOVER:
Signature · 1 line
2.1.4
#4 lore raw

PATCH v2 4/8 rtnetlink: Do not generate notifications for POST_TYPE_CHANGE event

In reply to David Ahern

Changing the master device for a link generates many messages; the one generated for POST_TYPE_CHANGE is redundant:

[LINK]11: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue master br1 state UNKNOWN group default

    link/ether 02:02:02:02:02:03 brd ff:ff:ff:ff:ff:ff
[LINK]11: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue master br1 state UNKNOWN group default
    link/ether 02:02:02:02:02:03 brd ff:ff:ff:ff:ff:ff

Remove POST_TYPE_CHANGE from the list of notifiers that generate notifications.

---
 net/core/rtnetlink.c | 1 -
 1 file changed, 1 deletion(-)
net/core/rtnetlink.c +0 -1
index 574f9b79919a..8cfb9e3c1f6e 100644
@@ -4120,7 +4120,6 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
 	case NETDEV_CHANGENAME:
 	case NETDEV_FEAT_CHANGE:
 	case NETDEV_BONDING_FAILOVER:
-	case NETDEV_POST_TYPE_CHANGE:
 	case NETDEV_NOTIFY_PEERS:
 	case NETDEV_CHANGEUPPER:
 	case NETDEV_RESEND_IGMP:
Signature · 1 line
2.1.4
#5 lore raw

PATCH v2 5/8 rtnetlink: Do not generate notifications for PRECHANGEUPPER event

In reply to David Ahern

PRECHANGEUPPER is an internal event; do not generate userspace notifications.

---
 net/core/rtnetlink.c | 1 -
 1 file changed, 1 deletion(-)
net/core/rtnetlink.c +0 -1
index 8cfb9e3c1f6e..10df445bb818 100644
@@ -4124,7 +4124,6 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
 	case NETDEV_CHANGEUPPER:
 	case NETDEV_RESEND_IGMP:
 	case NETDEV_CHANGEINFODATA:
-	case NETDEV_PRECHANGEUPPER:
 	case NETDEV_CHANGELOWERSTATE:
 	case NETDEV_CHANGE_TX_QUEUE_LEN:
 		rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL);
Signature · 1 line
2.1.4
#6 lore raw

PATCH v2 6/8 rtnetlink: Do not generate notifications for CHANGELOWERSTATE event

In reply to David Ahern

CHANGELOWERSTATE is an internal event; do not generate userspace notifications.

---
 net/core/rtnetlink.c | 1 -
 1 file changed, 1 deletion(-)
net/core/rtnetlink.c +0 -1
index 10df445bb818..b70e915be66d 100644
@@ -4124,7 +4124,6 @@ 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(RTM_NEWLINK, dev, 0, GFP_KERNEL);
 		break;
Signature · 1 line
2.1.4
#7 lore raw

PATCH v2 7/8 rtnetlink: Do not generate notifications for NETDEV_CHANGEUPPER event

In reply to David Ahern

NETDEV_CHANGEUPPER is an internal event; do not generate userspace notifications.

---
 net/core/rtnetlink.c | 1 -
 1 file changed, 1 deletion(-)
net/core/rtnetlink.c +0 -1
index b70e915be66d..ef93f6c983f3 100644
@@ -4121,7 +4121,6 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
 	case NETDEV_FEAT_CHANGE:
 	case NETDEV_BONDING_FAILOVER:
 	case NETDEV_NOTIFY_PEERS:
-	case NETDEV_CHANGEUPPER:
 	case NETDEV_RESEND_IGMP:
 	case NETDEV_CHANGEINFODATA:
 	case NETDEV_CHANGE_TX_QUEUE_LEN:
Signature · 1 line
2.1.4
#8 lore raw

PATCH v2 8/8 rtnetlink: Do not generate notifications for NETDEV_CHANGE_TX_QUEUE_LEN event

In reply to David Ahern

Changing tx queue length generates identical messages:

[LINK]22: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
link/ether 02:04:f4:b7:5c:d2 brd ff:ff:ff:ff:ff:ff promiscuity 0
dummy numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
[LINK]22: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default
link/ether 02:04:f4:b7:5c:d2 brd ff:ff:ff:ff:ff:ff promiscuity 0
dummy numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535

Remove NETDEV_CHANGE_TX_QUEUE_LEN from the list of notifiers that generate notifications.

---
 net/core/rtnetlink.c | 1 -
 1 file changed, 1 deletion(-)
net/core/rtnetlink.c +0 -1
index ef93f6c983f3..c138b6b75e59 100644
@@ -4123,7 +4123,6 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
 	case NETDEV_NOTIFY_PEERS:
 	case NETDEV_RESEND_IGMP:
 	case NETDEV_CHANGEINFODATA:
-	case NETDEV_CHANGE_TX_QUEUE_LEN:
 		rtmsg_ifinfo(RTM_NEWLINK, dev, 0, GFP_KERNEL);
 		break;
 	default:
Signature · 1 line
2.1.4
maintainer
#9 lore raw
In reply to David Ahern

From: David Ahern <[email protected]>
Date: Tue, 11 Apr 2017 17:02:39 -0700

Quoted 5 lines

Vlad's recent patch to add the event type to rtnetlink notifications points out a number of redundant or unnecessary notifications sent to userspace for events that are essentially internal to the kernel. Trim the list to put a dent in the notification storm.

Quoted 7 lines

v2
- rebased to top of net-next with IFLA_EVENT patch reverted
- dropped removal NETDEV_CHANGEINFODATA since it is intentionally only to send a message to userspace
- dropped NOTIFY_PEERS since Vlad's says it is needed for macvlans
- add patches to remove NETDEV_CHANGEUPPER and NETDEV_CHANGE_TX_QUEUE_LEN from the event list

Series applied, thanks David.