* [PATCH v3 iproute] ip: Add support for netdev events to monitor
@ 2017-04-04 13:25 Vladislav Yasevich
2017-04-08 22:24 ` David Ahern
0 siblings, 1 reply; 5+ messages in thread
From: Vladislav Yasevich @ 2017-04-04 13:25 UTC (permalink / raw)
To: netdev; +Cc: roopa, dsa, davem, Vladislav Yasevich
Add IFLA_EVENT handling so that event types can be viewed with
'monitor' command. This gives a little more information for why
a given message was receivied.
Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
---
include/linux/if_link.h | 21 +++++++++++++++++++++
ip/ipaddress.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index b0bdbd6..b6d211a 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -157,6 +157,7 @@ enum {
IFLA_GSO_MAX_SIZE,
IFLA_PAD,
IFLA_XDP,
+ IFLA_EVENT,
__IFLA_MAX
};
@@ -890,4 +891,24 @@ enum {
#define IFLA_XDP_MAX (__IFLA_XDP_MAX - 1)
+enum {
+ IFLA_EVENT_UNSPEC,
+ IFLA_EVENT_REBOOT,
+ IFLA_EVENT_CHANGE_MTU,
+ IFLA_EVENT_CHANGE_ADDR,
+ IFLA_EVENT_CHANGE_NAME,
+ IFLA_EVENT_FEAT_CHANGE,
+ IFLA_EVENT_BONDING_FAILOVER,
+ IFLA_EVENT_POST_TYPE_CHANGE,
+ IFLA_EVENT_NOTIFY_PEERS,
+ IFLA_EVENT_CHANGE_UPPER,
+ IFLA_EVENT_RESEND_IGMP,
+ IFLA_EVENT_PRE_CHANGE_MTU,
+ IFLA_EVENT_CHANGE_INFO_DATA,
+ IFLA_EVENT_PRE_CHANGE_UPPER,
+ IFLA_EVENT_CHANGE_LOWER_STATE,
+ IFLA_EVENT_UDP_TUNNEL_PUSH_INFO,
+ IFLA_EVENT_CHANGE_TX_QUEUE_LEN,
+};
+
#endif /* _LINUX_IF_LINK_H */
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index b8d9c7d..ffcfa5e 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -753,6 +753,34 @@ int print_linkinfo_brief(const struct sockaddr_nl *who,
return 0;
}
+static const char *netdev_events[] = {"UNKNOWN",
+ "REBOOT",
+ "CHANGE_MTU",
+ "CHANGE_ADDR",
+ "CHANGE_NAME",
+ "FEATURE_CHANGE",
+ "BONDING_FAILOVER",
+ "POST_TYPE_CHANGE",
+ "NOTIFY_PEERS",
+ "CHANGE_UPPER",
+ "RESEND_IGMP",
+ "PRE_CHANGE_MTU",
+ "CHANGE_INFO_DATA",
+ "PRE_CHANGE_UPPER",
+ "CHANGE_LOWER_STATE",
+ "UDP_TUNNEL_PUSH_INFO",
+ "CHANGE_TXQUEUE_LEN"};
+
+static void print_dev_event(FILE *f, __u32 event)
+{
+ if (event >= ARRAY_SIZE(netdev_events))
+ fprintf(f, "event %d ", event);
+ else {
+ if (event)
+ fprintf(f, "event %s ", netdev_events[event]);
+ }
+}
+
int print_linkinfo(const struct sockaddr_nl *who,
struct nlmsghdr *n, void *arg)
{
@@ -858,6 +886,9 @@ int print_linkinfo(const struct sockaddr_nl *who,
if (filter.showqueue)
print_queuelen(fp, tb);
+ if (tb[IFLA_EVENT])
+ print_dev_event(fp, rta_getattr_u32(tb[IFLA_EVENT]));
+
if (!filter.family || filter.family == AF_PACKET || show_details) {
SPRINT_BUF(b1);
fprintf(fp, "%s", _SL_);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 iproute] ip: Add support for netdev events to monitor
2017-04-04 13:25 [PATCH v3 iproute] ip: Add support for netdev events to monitor Vladislav Yasevich
@ 2017-04-08 22:24 ` David Ahern
2017-04-09 2:33 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2017-04-08 22:24 UTC (permalink / raw)
To: Vladislav Yasevich, netdev; +Cc: roopa, dsa, davem
On 4/4/17 9:25 AM, Vladislav Yasevich wrote:
> Add IFLA_EVENT handling so that event types can be viewed with
> 'monitor' command. This gives a little more information for why
> a given message was receivied.
>
> Signed-off-by: Vladislav Yasevich <vyasevic@redhat.com>
> ---
> include/linux/if_link.h | 21 +++++++++++++++++++++
> ip/ipaddress.c | 31 +++++++++++++++++++++++++++++++
> 2 files changed, 52 insertions(+)
per comments on the email thread about reducing notifications, the
kernel patch for this should be reverted (and hence this iproute2 patch
is not needed) in favor of using a bitmask. Right now there are too many
redundant notifications to userspace.
Vlad: can you look at a bitmask version of IFLA_EVENT that shows what
changed in the newlink message from do_setlink()?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 iproute] ip: Add support for netdev events to monitor
2017-04-08 22:24 ` David Ahern
@ 2017-04-09 2:33 ` David Miller
2017-04-09 2:54 ` David Ahern
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2017-04-09 2:33 UTC (permalink / raw)
To: dsa; +Cc: vyasevic, netdev, roopa
From: David Ahern <dsa@cumulusnetworks.com>
Date: Sat, 8 Apr 2017 18:24:06 -0400
> per comments on the email thread about reducing notifications, the
> kernel patch for this should be reverted (and hence this iproute2 patch
> is not needed) in favor of using a bitmask. Right now there are too many
> redundant notifications to userspace.
I must have missed something in all the discussion, which patch needs
to be reverted from my tree exactly?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 iproute] ip: Add support for netdev events to monitor
2017-04-09 2:33 ` David Miller
@ 2017-04-09 2:54 ` David Ahern
2017-04-09 21:47 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: David Ahern @ 2017-04-09 2:54 UTC (permalink / raw)
To: David Miller; +Cc: vyasevic, netdev, roopa
On 4/8/17 10:33 PM, David Miller wrote:
> From: David Ahern <dsa@cumulusnetworks.com>
> Date: Sat, 8 Apr 2017 18:24:06 -0400
>
>> per comments on the email thread about reducing notifications, the
>> kernel patch for this should be reverted (and hence this iproute2 patch
>> is not needed) in favor of using a bitmask. Right now there are too many
>> redundant notifications to userspace.
>
> I must have missed something in all the discussion, which patch needs
> to be reverted from my tree exactly?
>
Here's the thread:
https://www.spinics.net/lists/netdev/msg429154.html
The comment is that def12888c161 is adding a uapi that leads to way too
many notifications (e.g., on a setlink).
It would be more efficient (read less notifications) to have do_setlink
emit a single message with the IFLA_EVENT (or something else
appropriately named) that indicates what attributes changed. Right now,
a change MTU leads to 3 notifications causing unnecessary churn in
userspace to track what the state of the link is.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 iproute] ip: Add support for netdev events to monitor
2017-04-09 2:54 ` David Ahern
@ 2017-04-09 21:47 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-04-09 21:47 UTC (permalink / raw)
To: dsa; +Cc: vyasevic, netdev, roopa
From: David Ahern <dsa@cumulusnetworks.com>
Date: Sat, 8 Apr 2017 22:54:07 -0400
> On 4/8/17 10:33 PM, David Miller wrote:
>> From: David Ahern <dsa@cumulusnetworks.com>
>> Date: Sat, 8 Apr 2017 18:24:06 -0400
>>
>>> per comments on the email thread about reducing notifications, the
>>> kernel patch for this should be reverted (and hence this iproute2 patch
>>> is not needed) in favor of using a bitmask. Right now there are too many
>>> redundant notifications to userspace.
>>
>> I must have missed something in all the discussion, which patch needs
>> to be reverted from my tree exactly?
>>
>
> Here's the thread:
> https://www.spinics.net/lists/netdev/msg429154.html
>
> The comment is that def12888c161 is adding a uapi that leads to way too
> many notifications (e.g., on a setlink).
>
> It would be more efficient (read less notifications) to have do_setlink
> emit a single message with the IFLA_EVENT (or something else
> appropriately named) that indicates what attributes changed. Right now,
> a change MTU leads to 3 notifications causing unnecessary churn in
> userspace to track what the state of the link is.
Ok, I'll queue up the revert. I guess this means your rtnetlink
patch set is going to need changes or a respin, therefore.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-04-09 21:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-04 13:25 [PATCH v3 iproute] ip: Add support for netdev events to monitor Vladislav Yasevich
2017-04-08 22:24 ` David Ahern
2017-04-09 2:33 ` David Miller
2017-04-09 2:54 ` David Ahern
2017-04-09 21:47 ` 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).