From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57BE6C433E1 for ; Sun, 23 Aug 2020 13:07:07 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 1250B2075B for ; Sun, 23 Aug 2020 13:07:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1250B2075B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 76F961BFD7; Sun, 23 Aug 2020 15:07:05 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id DB5391BE51 for ; Sun, 23 Aug 2020 15:07:02 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from talshn@nvidia.com) with SMTP; 23 Aug 2020 16:07:02 +0300 Received: from nvidia.com (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 07ND71HY007725; Sun, 23 Aug 2020 16:07:01 +0300 From: Tal Shnaiderman To: dev@dpdk.org Cc: thomas@monjalon.net, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com, ranjit.menon@intel.com, navasile@linux.microsoft.com, harini.ramakrishnan@microsoft.com, Tal Shnaiderman , stable@dpdk.org Date: Sun, 23 Aug 2020 16:06:04 +0300 Message-Id: <20200823130604.9992-1-talshn@nvidia.com> X-Mailer: git-send-email 2.16.1.windows.4 Subject: [dpdk-dev] [PATCH] bus/pci: fix hardware ids parsing on Windows 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Tal Shnaiderman Swap subsystem vendor id and subsystem device id. Parse the SPDRP_HARDWAREID string with correct type values. Fixes: b762221ac24 ("bus/pci: support Windows with bifurcated drivers") Cc: stable@dpdk.org Signed-off-by: Tal Shnaiderman --- drivers/bus/pci/windows/pci.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c index 489aa7902a..c80bd55716 100644 --- a/drivers/bus/pci/windows/pci.c +++ b/drivers/bus/pci/windows/pci.c @@ -270,17 +270,18 @@ static int parse_pci_hardware_id(const char *buf, struct rte_pci_id *pci_id) { int ids = 0; - uint16_t vendor_id, device_id, subvendor_id = 0; + uint16_t vendor_id, device_id; + uint32_t subvendor_id = 0; - ids = sscanf_s(buf, "PCI\\VEN_%x&DEV_%x&SUBSYS_%x", &vendor_id, - &device_id, &subvendor_id); + ids = sscanf_s(buf, "PCI\\VEN_%" PRIx16 "&DEV_%" PRIx16 "&SUBSYS_%" + PRIx32, &vendor_id, &device_id, &subvendor_id); if (ids != 3) return -1; pci_id->vendor_id = vendor_id; pci_id->device_id = device_id; - pci_id->subsystem_vendor_id = subvendor_id >> 16; - pci_id->subsystem_device_id = subvendor_id & 0xffff; + pci_id->subsystem_device_id = subvendor_id >> 16; + pci_id->subsystem_vendor_id = subvendor_id & 0xffff; return 0; } -- 2.16.1.windows.4