From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] pci: Add the class_id support in pci probe Date: Thu, 19 May 2016 12:33:47 +0200 Message-ID: <1727235.C3RSOGSy8E@xps13> References: <1462946895-49958-1-git-send-email-ziye.yang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Ziye Yang Return-path: Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id 06A2F9614 for ; Thu, 19 May 2016 12:33:55 +0200 (CEST) Received: by mail-wm0-f52.google.com with SMTP id r12so73640071wme.0 for ; Thu, 19 May 2016 03:33:55 -0700 (PDT) In-Reply-To: <1462946895-49958-1-git-send-email-ziye.yang@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 2016-05-11 14:08, Ziye Yang: > This patch is used to add the class_id (class_code, > subclass_code, programming_interface) support for > pci_device probe. With this patch, it will be > flexible for users to probe a class of devices > by class_id. > > Signed-off-by: Ziye Yang > --- > lib/librte_eal/bsdapp/eal/eal_pci.c | 4 ++++ > lib/librte_eal/common/eal_common_pci.c | 3 +++ > lib/librte_eal/common/include/rte_pci.h | 8 ++++++-- > lib/librte_eal/linuxapp/eal/eal_pci.c | 9 +++++++++ > 4 files changed, 22 insertions(+), 2 deletions(-) Please remove the deprecation notice. > --- a/lib/librte_eal/common/include/rte_pci.h > +++ b/lib/librte_eal/common/include/rte_pci.h > @@ -129,6 +129,7 @@ struct rte_pci_id { > uint16_t device_id; /**< Device ID or PCI_ANY_ID. */ > uint16_t subsystem_vendor_id; /**< Subsystem vendor ID or PCI_ANY_ID. */ > uint16_t subsystem_device_id; /**< Subsystem device ID or PCI_ANY_ID. */ > + uint32_t class_id; /**< Class ID (class, subclass, pi) or CLASS_ANY_ID. */ > }; A space is missing. It would be more logical to put the class_id at the beginning of the struct. > /** Any PCI device identifier (vendor, device, ...) */ > #define PCI_ANY_ID (0xffff) > +#define CLASS_ANY_ID (0xffffff) These constants should be prefixed with RTE_. > --- a/lib/librte_eal/linuxapp/eal/eal_pci.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c > + /* get class_id */ > + snprintf(filename, sizeof(filename), "%s/class", > + dirname); > + if (eal_parse_sysfs_value(filename, &tmp) < 0) { > + free(dev); > + return -1; > + } > + dev->id.class_id = (uint32_t)tmp && CLASS_ANY_ID; Should be a bitwise &. Why masking is needed?