patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v2] raw/ifpga: fix ifpga device name format
       [not found] <92007>
@ 2021-04-29  2:33 ` Wei Huang
  2021-04-29  8:23   ` Zhang, Qi Z
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Huang @ 2021-04-29  2:33 UTC (permalink / raw)
  To: dev, rosen.xu, qi.z.zhang; +Cc: stable, tianfei.zhang, ferruh.yigit, Wei Huang

The device name format used in ifpga_rawdev_create() was changed to
"IFPGA:%02x:%02x.%x", but the format used in ifpga_rawdev_destroy()
was left as "IFPGA:%x:%02x.%x", it should be changed synchronously.
To prevent further similar errors, macro "IFPGA_RAWDEV_NAME_FMT" is
defined to replace this format string.

Fixes: 9c006c45d0c5 ("raw/ifpga: scan PCIe BDF device tree")
Cc: stable@dpdk.org

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
v2: define a macro to replace the format string
---
 drivers/raw/ifpga/ifpga_rawdev.c  | 4 ++--
 drivers/raw/ifpga/ifpga_rawdev.h  | 2 ++
 drivers/raw/ifpga/rte_pmd_ifpga.c | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index f2551be821..7ccebfa3fa 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -1448,7 +1448,7 @@ ifpga_rawdev_create(struct rte_pci_device *pci_dev,
 	}
 
 	memset(name, 0, sizeof(name));
-	snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, "IFPGA:%02x:%02x.%x",
+	snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, IFPGA_RAWDEV_NAME_FMT,
 		pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function);
 
 	IFPGA_RAWDEV_PMD_INFO("Init %s on NUMA node %d", name, rte_socket_id());
@@ -1551,7 +1551,7 @@ ifpga_rawdev_destroy(struct rte_pci_device *pci_dev)
 	}
 
 	memset(name, 0, sizeof(name));
-	snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, "IFPGA:%x:%02x.%x",
+	snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, IFPGA_RAWDEV_NAME_FMT,
 		pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function);
 
 	IFPGA_RAWDEV_PMD_INFO("Closing %s on NUMA node %d",
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 9bbe9a4278..61c8366707 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -7,6 +7,8 @@
 
 extern int ifpga_rawdev_logtype;
 
+#define IFPGA_RAWDEV_NAME_FMT "IFPGA:%02x:%02x.%x"
+
 #define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "%s(): " fmt "\n", \
 				__func__, ##args)
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 6e23a2581a..23146432c2 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -34,7 +34,7 @@ rte_pmd_ifpga_get_dev_id(const char *pci_addr, uint16_t *dev_id)
 		return -EINVAL;
 	}
 
-	snprintf(rdev_name, RTE_RAWDEV_NAME_MAX_LEN, "IFPGA:%02x:%02x.%x",
+	snprintf(rdev_name, RTE_RAWDEV_NAME_MAX_LEN, IFPGA_RAWDEV_NAME_FMT,
 		addr.bus, addr.devid, addr.function);
 	rdev = rte_rawdev_pmd_get_named_dev(rdev_name);
 	if (!rdev) {
-- 
2.29.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH v2] raw/ifpga: fix ifpga device name format
  2021-04-29  2:33 ` [dpdk-stable] [PATCH v2] raw/ifpga: fix ifpga device name format Wei Huang
@ 2021-04-29  8:23   ` Zhang, Qi Z
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2021-04-29  8:23 UTC (permalink / raw)
  To: Huang, Wei, dev, Xu, Rosen; +Cc: stable, Zhang, Tianfei, Yigit, Ferruh



> -----Original Message-----
> From: Huang, Wei <wei.huang@intel.com>
> Sent: Thursday, April 29, 2021 10:34 AM
> To: dev@dpdk.org; Xu, Rosen <rosen.xu@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: stable@dpdk.org; Zhang, Tianfei <tianfei.zhang@intel.com>; Yigit, Ferruh
> <ferruh.yigit@intel.com>; Huang, Wei <wei.huang@intel.com>
> Subject: [PATCH v2] raw/ifpga: fix ifpga device name format
> 
> The device name format used in ifpga_rawdev_create() was changed to
> "IFPGA:%02x:%02x.%x", but the format used in ifpga_rawdev_destroy() was
> left as "IFPGA:%x:%02x.%x", it should be changed synchronously.
> To prevent further similar errors, macro "IFPGA_RAWDEV_NAME_FMT" is
> defined to replace this format string.
> 
> Fixes: 9c006c45d0c5 ("raw/ifpga: scan PCIe BDF device tree")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wei Huang <wei.huang@intel.com>
> Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
> Acked-by: Rosen Xu <rosen.xu@intel.com>
> ---
Applied to dpdk-next-net-intel.

Thanks
Qi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-stable] [PATCH v2] raw/ifpga: fix ifpga device name format
@ 2021-04-29  2:26 Wei Huang
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Huang @ 2021-04-29  2:26 UTC (permalink / raw)
  To: dev, rosen.xu, qi.z.zhang; +Cc: stable, tianfei.zhang, ferruh.yigit, Wei Huang

The device name format used in ifpga_rawdev_create() was changed to
"IFPGA:%02x:%02x.%x", but the format used in ifpga_rawdev_destroy()
was left as "IFPGA:%x:%02x.%x", it should be changed synchronously.
To prevent further similar errors, macro "IFPGA_RAWDEV_NAME_FMT" is
defined to replace this format string.

Fixes: 9c006c45d0c5 ("raw/ifpga: scan PCIe BDF device tree")
Cc: stable@dpdk.org

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
---
v2: define a macro to replace the format string
---
 drivers/raw/ifpga/ifpga_rawdev.c  | 4 ++--
 drivers/raw/ifpga/ifpga_rawdev.h  | 2 ++
 drivers/raw/ifpga/rte_pmd_ifpga.c | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index f2551be821..7ccebfa3fa 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -1448,7 +1448,7 @@ ifpga_rawdev_create(struct rte_pci_device *pci_dev,
 	}
 
 	memset(name, 0, sizeof(name));
-	snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, "IFPGA:%02x:%02x.%x",
+	snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, IFPGA_RAWDEV_NAME_FMT,
 		pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function);
 
 	IFPGA_RAWDEV_PMD_INFO("Init %s on NUMA node %d", name, rte_socket_id());
@@ -1551,7 +1551,7 @@ ifpga_rawdev_destroy(struct rte_pci_device *pci_dev)
 	}
 
 	memset(name, 0, sizeof(name));
-	snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, "IFPGA:%x:%02x.%x",
+	snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, IFPGA_RAWDEV_NAME_FMT,
 		pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function);
 
 	IFPGA_RAWDEV_PMD_INFO("Closing %s on NUMA node %d",
diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h
index 9bbe9a4278..61c8366707 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.h
+++ b/drivers/raw/ifpga/ifpga_rawdev.h
@@ -7,6 +7,8 @@
 
 extern int ifpga_rawdev_logtype;
 
+#define IFPGA_RAWDEV_NAME_FMT "IFPGA:%02x:%02x.%x"
+
 #define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "%s(): " fmt "\n", \
 				__func__, ##args)
diff --git a/drivers/raw/ifpga/rte_pmd_ifpga.c b/drivers/raw/ifpga/rte_pmd_ifpga.c
index 6e23a2581a..23146432c2 100644
--- a/drivers/raw/ifpga/rte_pmd_ifpga.c
+++ b/drivers/raw/ifpga/rte_pmd_ifpga.c
@@ -34,7 +34,7 @@ rte_pmd_ifpga_get_dev_id(const char *pci_addr, uint16_t *dev_id)
 		return -EINVAL;
 	}
 
-	snprintf(rdev_name, RTE_RAWDEV_NAME_MAX_LEN, "IFPGA:%02x:%02x.%x",
+	snprintf(rdev_name, RTE_RAWDEV_NAME_MAX_LEN, IFPGA_RAWDEV_NAME_FMT,
 		addr.bus, addr.devid, addr.function);
 	rdev = rte_rawdev_pmd_get_named_dev(rdev_name);
 	if (!rdev) {
-- 
2.29.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-29  8:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <92007>
2021-04-29  2:33 ` [dpdk-stable] [PATCH v2] raw/ifpga: fix ifpga device name format Wei Huang
2021-04-29  8:23   ` Zhang, Qi Z
2021-04-29  2:26 Wei Huang

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git