netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: netdev@vger.kernel.org
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>
Subject: [Patch net-next 1/2] vxlan: call peernet2id() in fdb notification
Date: Thu,  1 Sep 2016 21:53:44 -0700	[thread overview]
Message-ID: <1472792025-14702-2-git-send-email-xiyou.wangcong@gmail.com> (raw)
In-Reply-To: <1472792025-14702-1-git-send-email-xiyou.wangcong@gmail.com>

netns id should be already allocated each time we change
netns, that is, in dev_change_net_namespace() (more precisely
in rtnl_fill_ifinfo()). It is safe to just call peernet2id() here.

Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
 drivers/net/vxlan.c      | 2 +-
 net/core/net_namespace.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index f605a36..9735059 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -287,7 +287,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
 
 	if (!net_eq(dev_net(vxlan->dev), vxlan->net) &&
 	    nla_put_s32(skb, NDA_LINK_NETNSID,
-			peernet2id_alloc(dev_net(vxlan->dev), vxlan->net)))
+			peernet2id(dev_net(vxlan->dev), vxlan->net)))
 		goto nla_put_failure;
 
 	if (send_eth && nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->eth_addr))
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 7a77dca..f3fa435 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -227,7 +227,6 @@ int peernet2id_alloc(struct net *net, struct net *peer)
 		rtnl_net_notifyid(net, RTM_NEWNSID, id);
 	return id;
 }
-EXPORT_SYMBOL(peernet2id_alloc);
 
 /* This function returns, if assigned, the id of a peer netns. */
 int peernet2id(struct net *net, struct net *peer)
@@ -240,6 +239,7 @@ int peernet2id(struct net *net, struct net *peer)
 	spin_unlock_irqrestore(&net->nsid_lock, flags);
 	return id;
 }
+EXPORT_SYMBOL(peernet2id);
 
 /* This function returns true is the peer netns has an id assigned into the
  * current netns.
-- 
2.1.0

  reply	other threads:[~2016-09-02  4:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-02  4:53 [Patch net-next 0/2] net: some minor optimization for netns id Cong Wang
2016-09-02  4:53 ` Cong Wang [this message]
2016-09-02  8:59   ` [Patch net-next 1/2] vxlan: call peernet2id() in fdb notification Nicolas Dichtel
2016-09-02  4:53 ` [Patch net-next 2/2] netns: avoid disabling irq for netns id Cong Wang
2016-09-02  8:12   ` Nicolas Dichtel
2016-09-02 16:39     ` Cong Wang
2016-09-02 17:24       ` Cong Wang
2016-09-04 20:23         ` Nicolas Dichtel
2016-10-19 15:21     ` Elad Raz
2016-10-19 20:07       ` Cong Wang
2017-01-31  6:47         ` Elluru, Krishna Mohan
2017-01-31  6:53           ` Cong Wang
2017-01-31  7:10             ` Elluru, Krishna Mohan
2017-01-31  8:24           ` Nicolas Dichtel
2016-09-04 18:40 ` [Patch net-next 0/2] net: some minor optimization " David Miller

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=1472792025-14702-2-git-send-email-xiyou.wangcong@gmail.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).