DPDK patches and discussions
 help / color / mirror / Atom feed
From: Daniel Verkamp <daniel.verkamp@intel.com>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Daniel Verkamp <daniel.verkamp@intel.com>
Subject: [dpdk-dev] [PATCH v2] pci: pad vendor and device ID to 4 digits
Date: Fri, 23 Jun 2017 11:20:32 -0700	[thread overview]
Message-ID: <20170623182032.28734-1-daniel.verkamp@intel.com> (raw)
In-Reply-To: <20170623172941.14423-1-daniel.verkamp@intel.com>

Some PCI vendor and device IDs have leading zeros.

Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
---

v2: added #define for format string, use %.4 style and PRIx16

 lib/librte_eal/common/eal_common_pci.c  | 8 ++++----
 lib/librte_eal/common/include/rte_pci.h | 3 +++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 78b097e..7924509 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -203,8 +203,8 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
 		return 1;
 	}
 
-	RTE_LOG(INFO, EAL, "  probe driver: %x:%x %s\n", dev->id.vendor_id,
-		dev->id.device_id, dr->driver.name);
+	RTE_LOG(INFO, EAL, "  probe driver: " PCI_ID_PRI_FMT " %s\n",
+		dev->id.vendor_id, dev->id.device_id, dr->driver.name);
 
 	if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
 		/* map resources for devices that use igb_uio */
@@ -253,8 +253,8 @@ rte_pci_detach_dev(struct rte_pci_device *dev)
 			loc->domain, loc->bus, loc->devid,
 			loc->function, dev->device.numa_node);
 
-	RTE_LOG(DEBUG, EAL, "  remove driver: %x:%x %s\n", dev->id.vendor_id,
-			dev->id.device_id, dr->driver.name);
+	RTE_LOG(DEBUG, EAL, "  remove driver: " PCI_ID_PRI_FMT " %s\n",
+			dev->id.vendor_id, dev->id.device_id, dr->driver.name);
 
 	if (dr->remove && (dr->remove(dev) < 0))
 		return -1;	/* negative value is an error */
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 0284a62..66edccb 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -68,6 +68,9 @@ const char *pci_get_sysfs_path(void);
 /** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */
 #define PCI_SHORT_PRI_FMT "%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8
 
+/** Formatting string for PCI vendor and device ID: Ex: 1234:5678 */
+#define PCI_ID_PRI_FMT "%.4" PRIx16 ":%.4" PRIx16
+
 /** Nb. of values in PCI device identifier format string. */
 #define PCI_FMT_NVAL 4
 
-- 
2.9.4

  parent reply	other threads:[~2017-06-23 18:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23 17:29 [dpdk-dev] [PATCH] " Daniel Verkamp
2017-06-23 17:44 ` Stephen Hemminger
2017-06-23 18:20 ` Daniel Verkamp [this message]
2017-07-05 13:16   ` [dpdk-dev] [PATCH v2] " 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=20170623182032.28734-1-daniel.verkamp@intel.com \
    --to=daniel.verkamp@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /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).