patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Tal Shnaiderman <talshn@nvidia.com>
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 <talshn@mellanox.com>,
	stable@dpdk.org
Subject: [dpdk-stable] [PATCH] bus/pci: fix hardware ids parsing on Windows
Date: Sun, 23 Aug 2020 16:06:04 +0300	[thread overview]
Message-ID: <20200823130604.9992-1-talshn@nvidia.com> (raw)

From: Tal Shnaiderman <talshn@mellanox.com>

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 <talshn@mellanox.com>
---
 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


             reply	other threads:[~2020-08-23 13:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-23 13:06 Tal Shnaiderman [this message]
2020-09-09 23:15 ` Narcisa Ana Maria Vasile
2020-09-11  0:06   ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200823130604.9992-1-talshn@nvidia.com \
    --to=talshn@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=harini.ramakrishnan@microsoft.com \
    --cc=navasile@linux.microsoft.com \
    --cc=pallavi.kadam@intel.com \
    --cc=ranjit.menon@intel.com \
    --cc=stable@dpdk.org \
    --cc=talshn@mellanox.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).