DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: "Hemant@freescale.com" <Hemant@freescale.com>,
	 "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] kni: create KNI interface in current network namespace
Date: Mon, 01 Dec 2014 11:42:29 +0100	[thread overview]
Message-ID: <547C4615.7040701@6wind.com> (raw)
In-Reply-To: <BY2PR0301MB0693EA8FA0BDAF0AE6B55F52C27D0@BY2PR0301MB0693.namprd03.prod.outlook.com>

Le 01/12/2014 06:45, Hemant@freescale.com a écrit :
>> 2014-11-21 12:10, Takayuki Usui:
>>> With this patch, KNI interface (e.g. vEth0) is created in the network
>>> namespace where the DPDK application is running.
>>> Otherwise, all interfaces are created in the default namespace in the
>>> host.
>>>
>>> Signed-off-by: Takayuki Usui <takayuki@midokura.com>
>>> ---
>>>   lib/librte_eal/linuxapp/kni/kni_misc.c | 2 ++
>>>   1 file changed, 2 insertions(+)
>>>
>>> diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c
>>> b/lib/librte_eal/linuxapp/kni/kni_misc.c
>>> index ba77776..f4a9965 100644
>>> --- a/lib/librte_eal/linuxapp/kni/kni_misc.c
>>> +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
>>> @@ -354,6 +354,8 @@ kni_ioctl_create(unsigned int ioctl_num, unsigned
>> long ioctl_param)
>>>   		return -EBUSY;
>>>   	}
>>>
>>> +	dev_net_set(net_dev, get_net_ns_by_pid(current->pid));
>>> +
>
> Another way to get it done is by the following. It will be init_net for the root container.
>
> #ifdef CONFIG_NET_NS
> 	net_dev->nd_net = current->nsproxy->net_ns;
> #endif
No. It's always better to use existing helpers, it hides this kind of ifdef and
more importantly, it do the right things (call release_net()/hold_net())!
Reimplemented helpers is error prone.

  reply	other threads:[~2014-12-01 10:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21  3:10 Takayuki Usui
2014-11-26 21:26 ` Thomas Monjalon
2014-12-01  5:45   ` Hemant
2014-12-01 10:42     ` Nicolas Dichtel [this message]
2014-11-27  9:06 ` Nicolas Dichtel
2014-12-02  2:19   ` [dpdk-dev] [PATCH v2] " Takayuki Usui
2014-12-02  9:04     ` Nicolas Dichtel
2014-12-03  1:37       ` [dpdk-dev] [PATCH v3] " Takayuki Usui
2014-12-03 10:51         ` Nicolas Dichtel
2014-12-03 14:01           ` Thomas Monjalon

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=547C4615.7040701@6wind.com \
    --to=nicolas.dichtel@6wind.com \
    --cc=Hemant@freescale.com \
    --cc=dev@dpdk.org \
    /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).