From: Eldad Zack <eldad@fogrefinery.com>
To: netdev@vger.kernel.org
Cc: Eldad Zack <eldad@fogrefinery.com>
Subject: [PATCH 8/8] 8021q/vlan: process NETDEV_GOING_DOWN
Date: Mon, 25 Jun 2012 20:28:20 +0200 [thread overview]
Message-ID: <1340648900-6547-9-git-send-email-eldad@fogrefinery.com> (raw)
In-Reply-To: <1340648900-6547-1-git-send-email-eldad@fogrefinery.com>
In the current flow, when you take down a physical device that has
VLANs configured on it, the NETDEV_GOING_DOWN notification will be
sent too late, i.e., no data can be sent to the wire anymore.
static int __dev_close_many(struct list_head *head)
{
...
list_for_each_entry(dev, head, unreg_list) {
call_netdevice_notifiers(NETDEV_GOING_DOWN, dev);
...
}
...
list_for_each_entry(dev, head, unreg_list) {
if (ops->ndo_stop)
ops->ndo_stop(dev);
}
...
}
static int dev_close_many(struct list_head *head)
{
...
__dev_close_many(head);
list_for_each_entry(dev, head, unreg_list) {
rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_UP|IFF_RUNNING);
call_netdevice_notifiers(NETDEV_DOWN, dev);
}
}
In a setup like this: eth0 with VLANs 2, 3 the flow would be:
eth0 - NETDEV_GOING_DOWN
ndo_stop is called on the device
eth0.2 - NETDEV_GOING_DOWN
eth0.2 - NETDEV_DOWN
eth0.3 - NETDEV_GOING_DOWN
eth0.3 - NETDEV_DOWN
eth0 - NETDEV_DOWN
If instead NETDEV_GOING_DOWN is processed, the flow would be:
eth0.2 - NETDEV_GOING_DOWN
eth0.2 - NETDEV_DOWN
eth0.3 - NETDEV_GOING_DOWN
eth0.3 - NETDEV_DOWN
eth0 - NETDEV_GOING_DOWN
eth0 - NETDEV_DOWN
ndo_stop is called on the device
Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
---
net/8021q/vlan.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 6089f0c..fd87ecc 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -402,6 +402,12 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
break;
+ case NETDEV_GOING_DOWN: /* NETDEV_DOWN */
+ /* If the parent device is going down it will call ndo_stop after
+ * it sends out NETDEV_GOING_DOWN but before sending out NETDEV_DOWN,
+ * The effect of which is, that no data can be sent anymore
+ * by the time the VLAN device sends out its NETDEV_GOING_DOWN.
+ */
case NETDEV_DOWN:
/* Put all VLANs for this dev in the down state too. */
for (i = 0; i < VLAN_N_VID; i++) {
--
1.7.10
next prev parent reply other threads:[~2012-06-25 18:29 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-25 18:28 [PATCH RFC 0/8] LLDP implementation for Linux Eldad Zack
2012-06-25 18:28 ` [PATCH 1/8] if_ether.h: Add LLDP ethertype Eldad Zack
2012-06-25 18:48 ` Eldad Zack
2012-06-25 18:28 ` [PATCH 2/8] LLDP: Header Eldad Zack
2012-06-25 18:28 ` [PATCH 3/8] LLDP: Sysctl interface Eldad Zack
2012-06-25 18:28 ` [PATCH 4/8] LLDP: PDU-handling routines Eldad Zack
2012-06-25 18:28 ` [PATCH 5/8] LLDP: Output routines Eldad Zack
2012-06-25 18:28 ` [PATCH 6/8] LLDP: Core routines Eldad Zack
2012-06-25 18:28 ` [PATCH 7/8] LLDP: Kconfig and Makefile Eldad Zack
2012-06-25 18:28 ` Eldad Zack [this message]
2012-06-25 18:33 ` [PATCH RFC 0/8] LLDP implementation for Linux Eldad Zack
2012-06-25 18:54 ` Stephen Hemminger
2012-06-25 20:05 ` Eldad Zack
2012-06-25 19:00 ` John Fastabend
2012-06-25 20:21 ` Eldad Zack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1340648900-6547-9-git-send-email-eldad@fogrefinery.com \
--to=eldad@fogrefinery.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.