From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ob0-f179.google.com (mail-ob0-f179.google.com [209.85.214.179]) by dpdk.org (Postfix) with ESMTP id 1791BC3BE for ; Mon, 20 Jul 2015 09:43:59 +0200 (CEST) Received: by obnw1 with SMTP id w1so96942361obn.3 for ; Mon, 20 Jul 2015 00:43:57 -0700 (PDT) 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=L33/oDQ1tbkGNV/ZmLMBqpBycqdisoBBKOw5SPhQMAk=; b=d12+TZOt6Jf0osX9kdJ1ejmt28yJAmpSkkyOzXEMuOQduZwEFBYgfDjEOSMxBJphYq qSqiIyDMVLbbzcSUvtEzizBHKRYxSAKqctwUJ74Z+0autONnal70KzuHOs3vlXvTJoc+ +y93DsXxUJ0MqAN7QiS625erfK4jZzSARUOEfp/F6a7TOZcDYXvVPxT5JLl8zSxqa2Zu LqMH7T5mzYlq/XArco1/bjRkWZmZg5/PuOxx63azTAmw/W69QQ7eTsAmH5RqSaDoCkhO zUB97LgtbpP9RQ3Wg5tDeJzL7Xpj2/5YmTIEdwpiprG2rSjtxzoUa4r6DhjHNgxEq9gu 8yIA== X-Gm-Message-State: ALoCoQmDg7GX+9a8ZMwPLFp6qNRqDHAhNIIewFYEygimE3bokmsVN1TRp21Byw+87eLYgFwqHBuk MIME-Version: 1.0 X-Received: by 10.182.230.70 with SMTP id sw6mr9582092obc.48.1437378237674; Mon, 20 Jul 2015 00:43:57 -0700 (PDT) Received: by 10.76.84.233 with HTTP; Mon, 20 Jul 2015 00:43:57 -0700 (PDT) In-Reply-To: References: Date: Mon, 20 Jul 2015 09:43:57 +0200 Message-ID: From: David Marchand To: Rahul Lakkireddy Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: "dev@dpdk.org" , Felix Marti , Nirranjan Kirubaharan , Kumar Sanghvi Subject: Re: [dpdk-dev] [PATCH v2 1/3] nic_uio: Fix to allow any device to be bound to nic_uio 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, 20 Jul 2015 07:43:59 -0000 Hello Rahul, On Mon, Jul 20, 2015 at 8:41 AM, Rahul Lakkireddy < rahul.lakkireddy@chelsio.com> wrote: > nic_uio requires the pci ids to be present in rte_pci_dev_ids.h in order to > bind the devices to nic_uio. However, it's better to remove this > whitelist of > pci ids, and instead rely on hw.nic_uio.bdfs kenv parameter to allow > binding > any device to nic_uio. > > Suggested-by: David Marchand > Signed-off-by: Rahul Lakkireddy > Signed-off-by: Kumar Sanghvi > Hum, what bothers me is that you do not rely on the same criteria to re-attach the devices to nic_uio. See below. > lib/librte_eal/bsdapp/nic_uio/nic_uio.c | 48 > +++++++++------------------------ > 1 file changed, 13 insertions(+), 35 deletions(-) > > diff --git a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c > b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c > index 2354e84..f868dc8 100644 > --- a/lib/librte_eal/bsdapp/nic_uio/nic_uio.c > +++ b/lib/librte_eal/bsdapp/nic_uio/nic_uio.c > [snip] > @@ -195,11 +177,10 @@ nic_uio_probe (device_t dev) > { > int i; > > - for (i = 0; i < NUM_DEVICES; i++) > - if (pci_get_vendor(dev) == devices[i].vend && > - pci_get_device(dev) == devices[i].dev) { > - > - device_set_desc(dev, "Intel(R) DPDK PCI Device"); > + for (i = 0; i < num_detached; i++) > + if (pci_get_vendor(dev) == > pci_get_vendor(detached_devices[i]) && > + pci_get_device(dev) == > pci_get_device(detached_devices[i])) { > + device_set_desc(dev, "DPDK PCI Device"); > return BUS_PROBE_SPECIFIC; > } > > When going through the probe stuff, the device vendor and type are used as the matching criteria. @@ -256,7 +237,6 @@ static void > nic_uio_load(void) > { > uint32_t bus, device, function; > - int i; > device_t dev; > char bdf_str[256]; > char *token, *remaining; > @@ -295,17 +275,15 @@ nic_uio_load(void) > if (dev == NULL) > continue; > > - for (i = 0; i < NUM_DEVICES; i++) > - if (pci_get_vendor(dev) == devices[i].vend && > - pci_get_device(dev) == > devices[i].dev) { > - if (num_detached < > MAX_DETACHED_DEVICES) { > - > printf("nic_uio_load: detaching and storing dev=%p\n", dev); > - > detached_devices[num_detached++] = dev; > - } else > - > printf("nic_uio_load: reached MAX_DETACHED_DEVICES=%d. dev=%p won't be > reattached\n", > - > MAX_DETACHED_DEVICES, dev); > - device_detach(dev); > - } > + if (num_detached < MAX_DETACHED_DEVICES) { > + printf("nic_uio_load: detaching and storing > dev=%p\n", > + dev); > + detached_devices[num_detached++] = dev; > + } else { > + printf("nic_uio_load: reached > MAX_DETACHED_DEVICES=%d. dev=%p won't be reattached\n", > + MAX_DETACHED_DEVICES, dev); > + } > + device_detach(dev); > } > } > But here at init time, the bdfs informations are used to detach the pci devices. I would say this is safer we have the same criteria in both cases. I think that the pci addresses are the best criteria since this is what the user gives. Don't we have them in the dev pointer ? Btw, with this change, we would then be limited to MAX_DETACHED_DEVICES devices even if 128 pci devices looks quite big enough to me. This part could be reworked (later). -- David Marchand