From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by dpdk.org (Postfix) with ESMTP id 766EFB5B9 for ; Sat, 21 Feb 2015 13:49:51 +0100 (CET) Received: by mail-wi0-f176.google.com with SMTP id h11so8091446wiw.3 for ; Sat, 21 Feb 2015 04:49:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=SuVMkXd0E4FpZskipNIdKwPpjqficn0iNg0wjI1+Iws=; b=e6sdXlLpfQE7ODrYLSFg12aanCtnomP09iADdvTGiReAZmt1Xrh8afBwDqKpjEKTPY 7JTaftC7RHQUf6w1IHenOvA1+OCXNcsnKT8z3k9Hs8s3Wu7xCBmfxBv4LIiF7ssh5LHE Jz4otVRwSCi7cdFHV1K5yWzw4k0fD1Rkki/g/haOyc0m8R3Id2rjUCbbLJKylx6dpS1c C6DV9iB+hnUY/vWhau7hiO0iOUmQ0DX3CDPl8fnq6oEkoJllRvjQ+W6a+S3mUcpSfnH6 ObhNRL+wAqPk+aJgMTRTaxt8beLnbnlBisLaSCK8/4GBEJbmxeF3sHGltXXJcPsGtp+A Ieww== X-Gm-Message-State: ALoCoQnLsJkL3SYSXbrMDNHnMmc01ZCtKERAqxmp7JBkA3zNLYbdX4hzN9FkoMRRzB7cxMYxBBmf MIME-Version: 1.0 X-Received: by 10.194.241.197 with SMTP id wk5mr4606035wjc.44.1424522991240; Sat, 21 Feb 2015 04:49:51 -0800 (PST) Received: by 10.194.185.204 with HTTP; Sat, 21 Feb 2015 04:49:51 -0800 (PST) In-Reply-To: <54E8003C.9080405@igel.co.jp> References: <1424060073-23484-2-git-send-email-mukawa@igel.co.jp> <1424414390-18509-1-git-send-email-mukawa@igel.co.jp> <1424414390-18509-14-git-send-email-mukawa@igel.co.jp> <54E70D38.6090209@igel.co.jp> <54E8003C.9080405@igel.co.jp> Date: Sat, 21 Feb 2015 13:49:51 +0100 Message-ID: From: Maxime Leroy To: Tetsuya Mukawa Content-Type: text/plain; charset=UTF-8 Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v10 13/14] eal/pci: Add rte_eal_dev_attach/detach() functions 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: Sat, 21 Feb 2015 12:49:51 -0000 Hi Tetsuya, On Sat, Feb 21, 2015 at 4:49 AM, Tetsuya Mukawa wrote: > On 2015/02/21 0:20, Maxime Leroy wrote: [...] >> Why you want to add devargs in the devargs_list, if there are no needs >> to store this information ? > > In eal initialization code, virtual device names stored in devargs are > checked not to register a same device name twice. > And each init function of PMD just trust a device name received by eal. > So there is no code in PMD to check whether device name is unique. > I disagree with you. This check is not present in the master branch. You have added this check in your hotplug patchset, in this patch: [PATCH v10 10/14] eal/pci: Add a function to remove the entry of devargs list See: http://dpdk.org/ml/archives/dev/2015-February/013712.html Thus the problem should be already exist without your patches in the master branch. For example according to you, this testpmd command should create 2 devices with the same name: testpmd -c 0xc --vdev eth_pcap0,iface=eth0 --vdev eth_pcap0,iface=eth1 -n 2 -- -i But it's not the case: PMD: Initializing pmd_pcap for eth_pcap0 PMD: Creating pcap-backed ethdev on numa socket 0 PMD: Initializing pmd_pcap for eth_pcap0 PMD: Creating pcap-backed ethdev on numa socket 0 PMD: rte_eth_dev_allocate: Ethernet Device with name eth_pcap0 already allocated! In fact, it's not possible for any PMD_VDEV in the dpdk repo to create 2 devices with the same name. All the virtual device initialization functions use the rte_eth_dev_allocate function. This function prevents to create two ethernet devices with the same name: if (rte_eth_dev_allocated(name) != NULL) { PMD_DEBUG_TRACE("Ethernet Device with name %s already allocated!\n", name); return NULL; } > For example, according to your suggestion, how to prevent below case? > $ ./testpmd -c f -n 1 -- -i > testpmd> port attach eth_pcap0,iface=eth0 > testpmd> port attach eth_pcap0,iface=eth1 > > Also, type below, after doing above. > testpmd> port detach 0 > > Probably port 0 will be "eth_pcap0,iface=eth0". > But uninit code of PMD only receives a device name like 'eth_pcap0'. > (We have 2 'eth_pcap0' devices in PMD.) > > To prevent above case, probably we have 2 options at least. > One is changing init code of all virtual PMDs not to register same > device name. There are no need to change init code of all virtual PMDs to not register the same device name 2 times. Because it's already not possible to create 2 virtual device with the same name. (see my point above) > The other is to use devargs_list in EAL, and call init code of PMD with > a unique device name. Thus there are no needs to use the devargs_list for that. > [..] >> >> But you don't call rte_eal_devargs_add with RTE_DEVTYPE_WHILISTED_PCI >> in rte_eal_dev_attach_pdev ? > > Yes, I don't. > Hotplug functions should not change BLACKLIST and WHITELIST. > So not to touch the list is correct behavior. Yes the correct behaviour for Hotplug functions is to not use the devargs_list for physical and virtual devices ! Regards, Maxime