[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1294046040.4983.60423.camel@seasc0214>
Date: Mon, 3 Jan 2011 10:14:00 +0100
From: Hans Schillstrom <hans.schillstrom@...csson.com>
To: Jan Engelhardt <jengelh@...ozas.de>
CC: "hans@...illstrom.com" <hans@...illstrom.com>,
"horms@...ge.net.au" <horms@...ge.net.au>, "ja@....bg" <ja@....bg>,
"daniel.lezcano@...e.fr" <daniel.lezcano@...e.fr>,
"wensong@...ux-vs.org" <wensong@...ux-vs.org>,
"lvs-devel@...r.kernel.org" <lvs-devel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"netfilter-devel@...r.kernel.org" <netfilter-devel@...r.kernel.org>
Subject: Re: [*v3 PATCH 02/22] IPVS: netns to services part 1
On Sat, 2011-01-01 at 15:57 +0100, Jan Engelhardt wrote:
> 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.
OK, but the debug part will not compile without the ifdef since there is
some symbols that is #ifdef CONFIG_NET_NS.
"&init_net" is faster than the " ? : "
And the rest I guess is obvious.
>
> >@@ -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