From: Pascal Mazon Subject: Re: [PATCH 1/6] net/tap: use correct tap name Date: Tue, 31 Jan 2017 15:23:32 +0100 Message-ID: <39a46c11-66c4-d8ed-a2bc-d9421cb4afd0@6wind.com> References: <1485855778-15496-1-git-send-email-pascal.mazon@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: Ferruh Yigit , keith.wiles@intel.com Return-path: Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by dpdk.org (Postfix) with ESMTP id 84E6E2BD1 for ; Tue, 31 Jan 2017 15:25:16 +0100 (CET) Received: by mail-wm0-f51.google.com with SMTP id b65so81489890wmf.0 for ; Tue, 31 Jan 2017 06:25:16 -0800 (PST) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 01/31/2017 02:06 PM, Ferruh Yigit wrote:> On 1/31/2017 9:42 AM, Pascal Mazon wrote: >> dev->data->name contains "net_tap", the device driver name. > > I see what patch does, just as a note to commit log: > > AFAIK, "dev->data->name" is device name, and for this case it is > "net_tap#", like "net_tap0", "net_tap1" ... > > "dev->data_drv_name" is the driver name which is "net_tap" Indeed, dev->data->name is the device name, looking like "net_tap#", with number increasing for each vdev. I'll put the following commit log line if that's ok: dev->data->name contains the device name, e.g. "net_tap0". > >> dev->data->dev_private->name contains the actual iface name, >> e.g. "dtap0". > > Right, I agree this is correct comparing "dev->data->name" > > But the problem is pmd->name is per eth_dev. > > If I read code correct, for multiple queue support, each queue pair will > create a tap device, so each needs a different name. > > So can't just use pmd->name. Need to create a name per queue pair, it > can be combination of pmd->name + "_" + queue_id? Or can keep a name per > queue pair, instead of eth_dev. > > What do you think? Actually that's not exactly how it goes. Adding a queue to a netdevice requires to open("/dev/net/tun") and setting TUNSETIFF (through ioctl) on the resulting fd. That's the important part: queues for a given tap device must set TUNSETIFF with a common ifreq.ifr_name (in our case, pmd->name). This is best explained in the kernel doc, there: [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/tuntap.txt#n108 > >> >> In tun_alloc() especially, we want to use the latter. Otherwise the >> netdevice would be wrongly named "net_tap". Furthermore, creating >> several tap vdev would point to the same netdevice. >> >> In any case, it must to be consistent with the tun_alloc() call in >> eth_dev_tap_create(). >> >> Signed-off-by: Pascal Mazon > <...> > -- Pascal Mazon www.6wind.com