LVS
lvs-devel
Google
 
Web LinuxVirtualServer.org

Re: [*v3 PATCH 02/22] IPVS: netns to services part 1

To: Jan Engelhardt <jengelh@xxxxxxxxxx>
Subject: Re: [*v3 PATCH 02/22] IPVS: netns to services part 1
Cc: "hans@xxxxxxxxxxxxxxx" <hans@xxxxxxxxxxxxxxx>, "horms@xxxxxxxxxxxx" <horms@xxxxxxxxxxxx>, "ja@xxxxxx" <ja@xxxxxx>, "daniel.lezcano@xxxxxxx" <daniel.lezcano@xxxxxxx>, "wensong@xxxxxxxxxxxx" <wensong@xxxxxxxxxxxx>, "lvs-devel@xxxxxxxxxxxxxxx" <lvs-devel@xxxxxxxxxxxxxxx>, "netdev@xxxxxxxxxxxxxxx" <netdev@xxxxxxxxxxxxxxx>, "netfilter-devel@xxxxxxxxxxxxxxx" <netfilter-devel@xxxxxxxxxxxxxxx>
From: Hans Schillstrom <hans.schillstrom@xxxxxxxxxxxx>
Date: Mon, 3 Jan 2011 10:14:00 +0100
On Sat, 2011-01-01 at 15:57 +0100, Jan Engelhardt wrote:
> On Thursday 2010-12-30 11:50, hans@xxxxxxxxxxxxxxx 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 lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

<Prev in Thread] Current Thread [Next in Thread>