From: Stephen Hemminger <shemminger@vyatta•com>
To: Ben Hutchings <bhutchings@solarflare•com>
Cc: David Miller <davem@davemloft•net>, <netdev@vger•kernel.org>
Subject: Re: [PATCH 2/4] ipgre: follow state of lower device
Date: Thu, 12 Apr 2012 10:38:25 -0700 [thread overview]
Message-ID: <20120412103825.74ff915a@s6510.linuxnetplumber.net> (raw)
In-Reply-To: <1334251927.2497.7.camel@bwh-desktop.uk.solarflarecom.com>
On Thu, 12 Apr 2012 18:32:07 +0100
Ben Hutchings <bhutchings@solarflare•com> wrote:
> On Thu, 2012-04-12 at 09:31 -0700, Stephen Hemminger wrote:
>
> > GRE tunnels like other layered devices should propogate
> > carrier and RFC2863 state from lower device to tunnel.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>
> >
> > --- a/net/ipv4/ip_gre.c 2012-04-12 08:07:39.508107847 -0700
> > +++ b/net/ipv4/ip_gre.c 2012-04-12 08:10:14.177499183 -0700
> [...]
> > @@ -1732,6 +1734,36 @@ static struct rtnl_link_ops ipgre_tap_op
> > .fill_info = ipgre_fill_info,
> > };
> >
> > +/* If lower device changes state, reflect that to the tunnel. */
> > +static int ipgre_notify(struct notifier_block *unused,
> > + unsigned long event, void *ptr)
> > +{
> > + struct net_device *dev = ptr;
> > + struct net *net = dev_net(dev);
> > + struct ipgre_net *ign = net_generic(net, ipgre_net_id);
> > + unsigned int prio, h;
> > + struct ip_tunnel *t;
> > +
> > + if (event == NETDEV_CHANGE)
> > + return NOTIFY_DONE;
>
> Surely we should handle NETDEV_UP, NETDEV_CHANGE, NETDEV_DOWN here? Not
> everything other than NETDEV_CHANGE.
yes, up and down needed as well.
> > + for (prio = 0; prio < 4; prio++)
> > + for (h = 0; h < HASH_SIZE; h++) {
> > + for (t = rtnl_dereference(ign->tunnels[prio][h]);
> > + t; t = rtnl_dereference(t->next)) {
> > + if (dev->ifindex != t->dev->iflink)
> > + continue;
> > + netif_stacked_transfer_operstate(dev, t->dev);
> > + }
> > + }
> [...]
>
> This seems potentially very inefficient.
Yes, but there is no list of tunnels per device.
next prev parent reply other threads:[~2012-04-12 17:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-12 16:31 [PATCH 0/4] Tunneling related patches Stephen Hemminger
2012-04-12 16:31 ` [PATCH 1/4] tunnel: implement 64 bits statistics Stephen Hemminger
2012-04-14 18:51 ` David Miller
2012-04-12 16:31 ` [PATCH 2/4] ipgre: follow state of lower device Stephen Hemminger
2012-04-12 17:32 ` Ben Hutchings
2012-04-12 17:38 ` Stephen Hemminger [this message]
2012-04-14 18:53 ` David Miller
2012-04-15 2:56 ` Stephen Hemminger
2012-05-03 22:40 ` Stephen Hemminger
2012-05-04 23:34 ` Christian Benvenuti (benve)
2012-04-12 16:31 ` [PATCH 3/4] sit: " Stephen Hemminger
2012-04-12 16:31 ` [PATCH 4/4] ipip: " Stephen Hemminger
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=20120412103825.74ff915a@s6510.linuxnetplumber.net \
--to=shemminger@vyatta$(echo .)com \
--cc=bhutchings@solarflare$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox