* [patch net-next] net: add netnotifier event for upper device change
@ 2013-05-25 14:12 Jiri Pirko
2013-05-26 6:14 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Jiri Pirko @ 2013-05-25 14:12 UTC (permalink / raw)
To: netdev; +Cc: davem, edumazet, alexander.h.duyck, xiyou.wangcong
Now when upper device is changed, event is not propagated via RT Netlink
to userspace. Userspace might never now about the change. Fix this by
adding upper-device-change notifier event.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
include/linux/netdevice.h | 1 +
net/core/dev.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0ebd63a..ea7b6bc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1593,6 +1593,7 @@ struct packet_offload {
#define NETDEV_RELEASE 0x0012
#define NETDEV_NOTIFY_PEERS 0x0013
#define NETDEV_JOIN 0x0014
+#define NETDEV_CHANGEUPPER 0x0015
extern int register_netdevice_notifier(struct notifier_block *nb);
extern int unregister_netdevice_notifier(struct notifier_block *nb);
diff --git a/net/core/dev.c b/net/core/dev.c
index 7229bc3..50c02de 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4411,7 +4411,7 @@ static int __netdev_upper_dev_link(struct net_device *dev,
else
list_add_tail_rcu(&upper->list, &dev->upper_dev_list);
dev_hold(upper_dev);
-
+ call_netdevice_notifiers(NETDEV_CHANGEUPPER, dev);
return 0;
}
@@ -4471,6 +4471,7 @@ void netdev_upper_dev_unlink(struct net_device *dev,
list_del_rcu(&upper->list);
dev_put(upper_dev);
kfree_rcu(upper, rcu);
+ call_netdevice_notifiers(NETDEV_CHANGEUPPER, dev);
}
EXPORT_SYMBOL(netdev_upper_dev_unlink);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [patch net-next] net: add netnotifier event for upper device change
2013-05-25 14:12 [patch net-next] net: add netnotifier event for upper device change Jiri Pirko
@ 2013-05-26 6:14 ` David Miller
2013-05-26 7:10 ` Jiri Pirko
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2013-05-26 6:14 UTC (permalink / raw)
To: jiri; +Cc: netdev, edumazet, alexander.h.duyck, xiyou.wangcong
From: Jiri Pirko <jiri@resnulli.us>
Date: Sat, 25 May 2013 16:12:10 +0200
> Now when upper device is changed, event is not propagated via RT Netlink
> to userspace. Userspace might never now about the change. Fix this by
> adding upper-device-change notifier event.
>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Looks good, applied, thanks Jiri.
If someone is looking for a useful project, switching networking over to
a more typed notifier system would be a worthwhile improvement.
It's hard to right now to communicate what changed beyond "action X
happened to this object, you have to check to see exactly how it
changed"
This came up recently with the IFF_NOARP stuff.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch net-next] net: add netnotifier event for upper device change
2013-05-26 6:14 ` David Miller
@ 2013-05-26 7:10 ` Jiri Pirko
2013-05-26 7:37 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Jiri Pirko @ 2013-05-26 7:10 UTC (permalink / raw)
To: David Miller; +Cc: netdev, edumazet, alexander.h.duyck, xiyou.wangcong
Sun, May 26, 2013 at 08:14:13AM CEST, davem@davemloft.net wrote:
>From: Jiri Pirko <jiri@resnulli.us>
>Date: Sat, 25 May 2013 16:12:10 +0200
>
>> Now when upper device is changed, event is not propagated via RT Netlink
>> to userspace. Userspace might never now about the change. Fix this by
>> adding upper-device-change notifier event.
>>
>> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>
>Looks good, applied, thanks Jiri.
>
>If someone is looking for a useful project, switching networking over to
>a more typed notifier system would be a worthwhile improvement.
>
>It's hard to right now to communicate what changed beyond "action X
>happened to this object, you have to check to see exactly how it
>changed"
Hmm. Do you have something particular in mind? My first thought was
passing some union instead of NETDEV_* numbers.
>
>This came up recently with the IFF_NOARP stuff.
Can you point me to the discussion?
Thanks
Jiri
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch net-next] net: add netnotifier event for upper device change
2013-05-26 7:10 ` Jiri Pirko
@ 2013-05-26 7:37 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-05-26 7:37 UTC (permalink / raw)
To: jiri; +Cc: netdev, edumazet, alexander.h.duyck, xiyou.wangcong
From: Jiri Pirko <jiri@resnulli.us>
Date: Sun, 26 May 2013 09:10:39 +0200
> Sun, May 26, 2013 at 08:14:13AM CEST, davem@davemloft.net wrote:
>>If someone is looking for a useful project, switching networking over to
>>a more typed notifier system would be a worthwhile improvement.
>>
>>It's hard to right now to communicate what changed beyond "action X
>>happened to this object, you have to check to see exactly how it
>>changed"
>
> Hmm. Do you have something particular in mind? My first thought was
> passing some union instead of NETDEV_* numbers.
Part of the problem is that notifiers are untyped.
So you can say "NETDEV_* means struct foo" but nothing in the C
typing system will enforce this, so errors are inevitable.
Perhaps one level of encapsulation will help:
static inline call_netdevice_feat_change(struct net_device *dev,
netdev_features_t old,
netdev_features_t new)
{
struct netdevice_feat_change_info info;
info.dev = dev;
info.old = old;
info.new = new;
call_netdevice_notifiers(NETDEV_FEAT_CHANGE, &info);
}
>>This came up recently with the IFF_NOARP stuff.
>
> Can you point me to the discussion?
It's in this patchwork thread:
http://patchwork.ozlabs.org/patch/245256/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-26 7:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-25 14:12 [patch net-next] net: add netnotifier event for upper device change Jiri Pirko
2013-05-26 6:14 ` David Miller
2013-05-26 7:10 ` Jiri Pirko
2013-05-26 7:37 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox