[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 1 Jan 2011 15:57:29 +0100 (CET)
From: Jan Engelhardt <jengelh@...ozas.de>
To: hans@...illstrom.com
cc: horms@...ge.net.au, ja@....bg, daniel.lezcano@...e.fr,
wensong@...ux-vs.org, lvs-devel@...r.kernel.org,
netdev@...r.kernel.org, netfilter-devel@...r.kernel.org,
Hans Schillstrom <hans.schillstrom@...csson.com>
Subject: Re: [*v3 PATCH 02/22] IPVS: netns to services part 1
On Thursday 2010-12-30 11:50, hans@...illstrom.com wrote:
>+/*
>+ * Get net ptr from skb in traffic cases
>+ * use skb_sknet when call is from userland (ioctl or netlink)
>+ */
>+static inline struct net *skb_net(struct sk_buff *skb) {
>+#ifdef CONFIG_NET_NS
>+#ifdef CONFIG_IP_VS_DEBUG
>+ /*
>+ * This is used for debug only.
>+ * Start with the most likely hit
>+ * End with BUG
>+ */
>+ if (likely(skb->dev && skb->dev->nd_net))
>+ return dev_net(skb->dev);
>+ if (skb_dst(skb)->dev)
>+ return dev_net(skb_dst(skb)->dev);
>+ WARN(skb->sk,"Maybe skb_sknet should be used instead in %s() line:%d\n",
>+ __func__, __LINE__);
>+ if (likely(skb->sk && skb->sk->sk_net))
>+ return sock_net(skb->sk);
>+ pr_err("There is no net ptr to find in the skb in %s() line:%d\n",
>+ __func__, __LINE__);
>+ BUG();
>+#else
>+ return dev_net(skb->dev ? : skb_dst(skb)->dev);
>+#endif
>+#else
>+ return &init_net;
>+#endif
>+}
Whether NETNS is disabled or not, dev_net(skb->dev) can be used in either case,
so the extra return &init_net case is not really required AFAICS.
>@@ -3446,43 +3471,48 @@ static struct pernet_operations ipvs_control_ops = {
>- smp_wmb();
>+
>+ smp_wmb(); /* Do wee really need it now ? */
not "whee" :)
--
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