[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1334251927.2497.7.camel@bwh-desktop.uk.solarflarecom.com>
Date: Thu, 12 Apr 2012 18:32:07 +0100
From: Ben Hutchings <bhutchings@...arflare.com>
To: Stephen Hemminger <shemminger@...tta.com>
CC: David Miller <davem@...emloft.net>, <netdev@...r.kernel.org>
Subject: Re: [PATCH 2/4] ipgre: follow state of lower device
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@...tta.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.
> + 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.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists