From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 0949C952 for ; Mon, 6 Mar 2017 16:55:11 +0100 (CET) Received: by mail-wm0-f43.google.com with SMTP id n11so68301289wma.0 for ; Mon, 06 Mar 2017 07:55:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=xMMr+agUgKySrNhxvTfAkxDYgMKTrd4lHutCu5z4i8U=; b=0+RM0q33B3hsNrnuCReto3h17myeJu2Oh/ehXZhCGbRznd4QbpOUYvd5yNDWfTTdsW imTlHoyRiyLBv4g+JQFlyJTo4pP+fjs7jTziH/tF+dxhCdjLAuCN8Bel1STMp1C9plhv mH9Q2yPE8GeOpVfdeiMcNe+Vrygb1L9U09i7r4axj9OpO/mx7zV77vunfaywll3HWu1N fsYEGS8wwOgjyLxcUxF7g10pVkynHdkCtUy2ONKxpdg8LPFBtvcgGgCk7q/8r/GrnRqw 1vFBSxsANbThK7+04TU2MEcBh0BfiOcgIBdBUldZrCIZ2xDQJP7rSducmsQ6MYo4kVb3 f3cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=xMMr+agUgKySrNhxvTfAkxDYgMKTrd4lHutCu5z4i8U=; b=S5on5KxHseHCl4R8mXkZ7GQr74bCOi83cNTZzbpKx3Y4961INj6R5kQLAlodK3RQgq fVnFLORzMOD9GBZWOCuDiB/sKPBEHtSRbPonR5HOsEGtpGl9UnrxXxfDH3clA1+KNvCl 2BH6KeNgBzUVpEBo6tpdeyJphPPpeohlPTauQdsZTi/NWp/I9wYp6LJn6A42wNjXy0an TsnIxyeXE1T748N4/7qFmupgUcB9ek/Hc0vAEQXBjwrv+l0k8Kq567QJlmZKaZuQCkUn xJgL7Z19WwleGjzwGa9YkRFNx/T5LlkRbDk+nW9hk+tINXYJzXAGPVDmz/IOehg9Qppm ZUMw== X-Gm-Message-State: AMke39nXQStSaHywlSsb0+pT2Z4F3ufflWQQE9kA06ffqV/lEU6x7I4T/TYmBZ4YSYs2SF26 X-Received: by 10.28.211.200 with SMTP id k191mr13375421wmg.137.1488815711278; Mon, 06 Mar 2017 07:55:11 -0800 (PST) Received: from paques.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id i133sm6963455wmg.26.2017.03.06.07.55.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 07:55:11 -0800 (PST) Date: Mon, 6 Mar 2017 16:55:01 +0100 From: Pascal Mazon To: Ferruh Yigit Cc: keith.wiles@intel.com, dev@dpdk.org Message-ID: <20170306165501.31059907@paques.dev.6wind.com> In-Reply-To: <2bbf94d7-7fe9-410d-438c-41a5560497c2@intel.com> References: <64e79c8c7398e0af093168d614c0ca62dc28377e.1488808159.git.pascal.mazon@6wind.com> <2bbf94d7-7fe9-410d-438c-41a5560497c2@intel.com> Organization: 6WIND X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3] net/tap: fix dev name look-up X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Mar 2017 15:55:12 -0000 On Mon, 6 Mar 2017 15:41:14 +0000 Ferruh Yigit wrote: > On 3/6/2017 3:13 PM, Pascal Mazon wrote: > > Store the device name in dev->data->name, to have symmetrical > > behavior between rte_pmd_tap_probe(name) and > > rte_pmd_tap_remove(name). > > > > The netdevice name (linux interface name) is stored in the name > > field of struct pmd_internals. > > > > snprintf(data->name) has been moved closer to the > > rte_ethdev_allocate() as it should use the same name. > > > > Signed-off-by: Pascal Mazon > > --- > > drivers/net/tap/rte_eth_tap.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/net/tap/rte_eth_tap.c > > b/drivers/net/tap/rte_eth_tap.c index 47a706070652..ece3a5fcc897 > > 100644 --- a/drivers/net/tap/rte_eth_tap.c > > +++ b/drivers/net/tap/rte_eth_tap.c > > @@ -663,7 +663,9 @@ eth_dev_tap_create(const char *name, char > > *tap_name) goto error_exit; > > } > > > > - dev = rte_eth_dev_allocate(tap_name); > > + /* name in allocation and data->name must be consistent */ > > + snprintf(data->name, sizeof(data->name), "%s", name); > > When you use correct name (name) for rte_eth_dev_allocate(), > snprintf() no more required. rte_eth_dev_allocate() already does it > [1]. > > [1] > http://dpdk.org/browse/dpdk/tree/lib/librte_ether/rte_ethdev.c#n230 > I disagree here. What rte_eth_dev_allocate() changes, is the shared automatically-allocated data part, as mentioned in your earlier mail. We didn't yet pass our own manually allocated data to dev. Do you see what I mean? Best regards, Pascal > > + dev = rte_eth_dev_allocate(name); > > if (!dev) { > > RTE_LOG(ERR, PMD, "TAP Unable to allocate device > > struct\n"); goto error_exit; > > @@ -691,7 +693,6 @@ eth_dev_tap_create(const char *name, char > > *tap_name) dev->driver = NULL; > > dev->rx_pkt_burst = pmd_rx_burst; > > dev->tx_pkt_burst = pmd_tx_burst; > > - snprintf(dev->data->name, sizeof(dev->data->name), "%s", > > name); > > /* Presetup the fds to -1 as being not valid */ > > for (i = 0; i < RTE_PMD_TAP_MAX_QUEUES; i++) { > > >