From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0130.outbound.protection.outlook.com [65.55.169.130]) by dpdk.org (Postfix) with ESMTP id 639592A9 for ; Mon, 1 Dec 2014 06:45:41 +0100 (CET) Received: from BY2PR0301MB0693.namprd03.prod.outlook.com (25.160.63.148) by BY2PR0301MB0696.namprd03.prod.outlook.com (25.160.63.150) with Microsoft SMTP Server (TLS) id 15.1.26.15; Mon, 1 Dec 2014 05:45:39 +0000 Received: from BY2PR0301MB0693.namprd03.prod.outlook.com ([25.160.63.148]) by BY2PR0301MB0693.namprd03.prod.outlook.com ([25.160.63.148]) with mapi id 15.01.0026.003; Mon, 1 Dec 2014 05:45:39 +0000 From: "Hemant@freescale.com" To: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] kni: create KNI interface in current network namespace Thread-Index: AQHQBTi7SQVADfi4OkOTu1WfC+5VcZxzdNMAgAbUI5A= Date: Mon, 1 Dec 2014 05:45:39 +0000 Message-ID: References: <1416539426-20684-1-git-send-email-takayuki@midokura.com> <4920841.6YLj9k6iQh@xps13> In-Reply-To: <4920841.6YLj9k6iQh@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.88.169.1] x-microsoft-antispam: BCL:0;PCL:0;RULEID:;SRVR:BY2PR0301MB0696; x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:; SRVR:BY2PR0301MB0696; x-forefront-prvs: 0412A98A59 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(189002)(377424004)(199003)(51704005)(87936001)(77096004)(74316001)(122556002)(2501002)(99396003)(20776003)(64706001)(21056001)(66066001)(450100001)(62966003)(77156002)(2656002)(92566001)(92726001)(54206007)(106356001)(95666004)(106116001)(33656002)(105586002)(107046002)(97736003)(120916001)(2351001)(76576001)(99286002)(107886001)(40100003)(101416001)(110136001)(50986999)(76176999)(54356999)(46102003)(54606007)(86362001)(19580395003)(19580405001)(4396001)(31966008)(80792004); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR0301MB0696; H:BY2PR0301MB0693.namprd03.prod.outlook.com; FPR:; SPF:None; MLV:sfv; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: freescale.com Subject: Re: [dpdk-dev] [PATCH] kni: create KNI interface in current network namespace X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2014 05:45:41 -0000 > 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 > > --- > > 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 =3D current->nsproxy->net_ns;=20 #endif > > kni =3D netdev_priv(net_dev); > > > > kni->net_dev =3D net_dev;