From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id DFB061518 for ; Thu, 27 Nov 2014 10:06:09 +0100 (CET) Received: by mail-wg0-f51.google.com with SMTP id k14so5789724wgh.38 for ; Thu, 27 Nov 2014 01:06:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:reply-to:organization :user-agent:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=wP+TitrJdXdALNNu7o55tNJYlnSTdxmwwkTsec+rM4w=; b=O+gubTYSMmkFV9vZQQkN3Qzj22uLtDDNaDT3YXxaVLVyS81LnV3GbnARanlbWdhLp8 jKu8e10Y+9kfqj4q450s7JhMMEmRN3oMuXmMlf5D9fmTWeuQqyTUTzRUYG00AAhRQAqo Am9TRqz4gcLPB/ZL7oxEkXZJVvxwns+gyUiHTXh+sCPkwyjW54CaArKvb4WwqxDJpNJ2 i16sUYZuduzo3/yf0HSRZSaQq60FtQ4CqieLrxQaNvUW8di/oDCtPfnQqGuhhV0XFh/B 3+gj6IkGEqaxjFlBoWLOKieWqq6s7ApNg2F4Of9HnxiZIvtSADY1SeZcEs32mwmrlmTL C09g== X-Gm-Message-State: ALoCoQlnej5vleodNosdv/8FIC6MZHjBt8EsKJk7iGQp8c+A9Jxzz7VOtDc7B9bo46O0Ahk3h3/1 X-Received: by 10.180.99.105 with SMTP id ep9mr49781181wib.82.1417079169728; Thu, 27 Nov 2014 01:06:09 -0800 (PST) Received: from [10.16.0.164] (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id vm8sm9801212wjc.6.2014.11.27.01.06.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Nov 2014 01:06:08 -0800 (PST) Message-ID: <5476E97D.5040304@6wind.com> Date: Thu, 27 Nov 2014 10:06:05 +0100 From: Nicolas Dichtel Organization: 6WIND User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Takayuki Usui , dev@dpdk.org References: <1416539426-20684-1-git-send-email-takayuki@midokura.com> In-Reply-To: <1416539426-20684-1-git-send-email-takayuki@midokura.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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 Reply-To: nicolas.dichtel@6wind.com List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2014 09:06:10 -0000 Le 21/11/2014 04:10, Takayuki Usui a écrit : > 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)); You should test the returned value and release the refcnt. net = get_net_ns_by_pid(current->pid) if (IS_ERR(net)) ... put_net(net); > + > kni = netdev_priv(net_dev); > > kni->net_dev = net_dev; >