DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] pci: add rte prefix
@ 2021-03-31 22:34 Thomas Monjalon
  2021-03-31 22:34 ` [dpdk-dev] [PATCH 1/2] pci: rename catch-all ID Thomas Monjalon
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: Thomas Monjalon @ 2021-03-31 22:34 UTC (permalink / raw)
  To: dev

Small namespace cleanups in PCI lib and bus driver.

Thomas Monjalon (2):
  pci: rename catch-all ID
  bus/pci: rename probe/remove operation types

 drivers/bus/pci/pci_common.c  |  8 ++++----
 drivers/bus/pci/rte_bus_pci.h | 20 ++++++++------------
 lib/librte_pci/rte_pci.h      | 12 +++++++-----
 3 files changed, 19 insertions(+), 21 deletions(-)

-- 
2.30.1


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

* [dpdk-dev] [PATCH 1/2] pci: rename catch-all ID
  2021-03-31 22:34 [dpdk-dev] [PATCH 0/2] pci: add rte prefix Thomas Monjalon
@ 2021-03-31 22:34 ` Thomas Monjalon
  2021-04-01  7:58   ` David Marchand
  2021-04-05 10:42   ` Parav Pandit
  2021-03-31 22:34 ` [dpdk-dev] [PATCH 2/2] bus/pci: rename probe/remove operation types Thomas Monjalon
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 19+ messages in thread
From: Thomas Monjalon @ 2021-03-31 22:34 UTC (permalink / raw)
  To: dev; +Cc: Gaetan Rivet

The name of the constant PCI_ANY_ID was missing RTE_ prefix.
It is renamed, and the old name becomes a deprecated alias.

While renaming, the duplicate definitions in rte_bus_pci.h
are removed to keep only those in rte_pci.h.
Note: rte_pci.h is included in rte_bus_pci.h

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/bus/pci/pci_common.c  |  8 ++++----
 drivers/bus/pci/rte_bus_pci.h | 12 ++++--------
 lib/librte_pci/rte_pci.h      | 12 +++++++-----
 3 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 9b8d769287..ee7f966358 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -133,18 +133,18 @@ rte_pci_match(const struct rte_pci_driver *pci_drv,
 	     id_table++) {
 		/* check if device's identifiers match the driver's ones */
 		if (id_table->vendor_id != pci_dev->id.vendor_id &&
-				id_table->vendor_id != PCI_ANY_ID)
+				id_table->vendor_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->device_id != pci_dev->id.device_id &&
-				id_table->device_id != PCI_ANY_ID)
+				id_table->device_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->subsystem_vendor_id !=
 		    pci_dev->id.subsystem_vendor_id &&
-		    id_table->subsystem_vendor_id != PCI_ANY_ID)
+		    id_table->subsystem_vendor_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->subsystem_device_id !=
 		    pci_dev->id.subsystem_device_id &&
-		    id_table->subsystem_device_id != PCI_ANY_ID)
+		    id_table->subsystem_device_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->class_id != pci_dev->id.class_id &&
 				id_table->class_id != RTE_CLASS_ANY_ID)
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 876abddefb..3a092bc6d5 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -91,26 +91,22 @@ struct rte_pci_device {
 
 #define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
 
-/** Any PCI device identifier (vendor, device, ...) */
-#define PCI_ANY_ID (0xffff)
-#define RTE_CLASS_ANY_ID (0xffffff)
-
 #ifdef __cplusplus
 /** C++ macro used to help building up tables of device IDs */
 #define RTE_PCI_DEVICE(vend, dev) \
 	RTE_CLASS_ANY_ID,         \
 	(vend),                   \
 	(dev),                    \
-	PCI_ANY_ID,               \
-	PCI_ANY_ID
+	RTE_PCI_ANY_ID,           \
+	RTE_PCI_ANY_ID
 #else
 /** Macro used to help building up tables of device IDs */
 #define RTE_PCI_DEVICE(vend, dev)          \
 	.class_id = RTE_CLASS_ANY_ID,      \
 	.vendor_id = (vend),               \
 	.device_id = (dev),                \
-	.subsystem_vendor_id = PCI_ANY_ID, \
-	.subsystem_device_id = PCI_ANY_ID
+	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
+	.subsystem_device_id = RTE_PCI_ANY_ID
 #endif
 
 /**
diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h
index f89c7dbbea..ed3196a368 100644
--- a/lib/librte_pci/rte_pci.h
+++ b/lib/librte_pci/rte_pci.h
@@ -78,10 +78,10 @@ extern "C" {
  */
 struct rte_pci_id {
 	uint32_t class_id;            /**< Class ID or RTE_CLASS_ANY_ID. */
-	uint16_t vendor_id;           /**< Vendor ID or PCI_ANY_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. */
+	uint16_t vendor_id;           /**< Vendor ID or RTE_PCI_ANY_ID. */
+	uint16_t device_id;           /**< Device ID or RTE_PCI_ANY_ID. */
+	uint16_t subsystem_vendor_id; /**< Subsystem vendor ID or RTE_PCI_ANY_ID. */
+	uint16_t subsystem_device_id; /**< Subsystem device ID or RTE_PCI_ANY_ID. */
 };
 
 /**
@@ -95,7 +95,9 @@ struct rte_pci_addr {
 };
 
 /** Any PCI device identifier (vendor, device, ...) */
-#define PCI_ANY_ID (0xffff)
+#define RTE_PCI_ANY_ID (0xffff)
+/** @deprecated Replaced with RTE_PCI_ANY_ID */
+#define PCI_ANY_ID RTE_PCI_ANY_ID
 #define RTE_CLASS_ANY_ID (0xffffff)
 
 /**
-- 
2.30.1


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

* [dpdk-dev] [PATCH 2/2] bus/pci: rename probe/remove operation types
  2021-03-31 22:34 [dpdk-dev] [PATCH 0/2] pci: add rte prefix Thomas Monjalon
  2021-03-31 22:34 ` [dpdk-dev] [PATCH 1/2] pci: rename catch-all ID Thomas Monjalon
@ 2021-03-31 22:34 ` Thomas Monjalon
  2021-04-05  9:15 ` [dpdk-dev] [PATCH v2 0/2] pci: add rte prefix Thomas Monjalon
  2021-04-06 10:28 ` [dpdk-dev] [PATCH v3 " Thomas Monjalon
  3 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2021-03-31 22:34 UTC (permalink / raw)
  To: dev

The names of the prototypes pci_probe_t and pci_remove_t
are missing a prefix rte_.
These function types are simply renamed.

No compatibility break is expected for the applications
because it is considered as an internal name in the driver interface.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/bus/pci/rte_bus_pci.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 3a092bc6d5..64886b4731 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -112,12 +112,12 @@ struct rte_pci_device {
 /**
  * Initialisation function for the driver called during PCI probing.
  */
-typedef int (pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
+typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
 
 /**
  * Uninitialisation function for the driver called during hotplugging.
  */
-typedef int (pci_remove_t)(struct rte_pci_device *);
+typedef int (rte_pci_remove_t)(struct rte_pci_device *);
 
 /**
  * Driver-specific DMA mapping. After a successful call the device
@@ -164,8 +164,8 @@ struct rte_pci_driver {
 	TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
 	struct rte_driver driver;          /**< Inherit core driver. */
 	struct rte_pci_bus *bus;           /**< PCI bus reference. */
-	pci_probe_t *probe;                /**< Device Probe function. */
-	pci_remove_t *remove;              /**< Device Remove function. */
+	rte_pci_probe_t *probe;            /**< Device probe function. */
+	rte_pci_remove_t *remove;          /**< Device remove function. */
 	pci_dma_map_t *dma_map;		   /**< device dma map function. */
 	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
 	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
-- 
2.30.1


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

* Re: [dpdk-dev] [PATCH 1/2] pci: rename catch-all ID
  2021-03-31 22:34 ` [dpdk-dev] [PATCH 1/2] pci: rename catch-all ID Thomas Monjalon
@ 2021-04-01  7:58   ` David Marchand
  2021-04-01  8:15     ` Thomas Monjalon
  2021-04-05 10:42   ` Parav Pandit
  1 sibling, 1 reply; 19+ messages in thread
From: David Marchand @ 2021-04-01  7:58 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Gaetan Rivet

On Thu, Apr 1, 2021 at 12:34 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> @@ -95,7 +95,9 @@ struct rte_pci_addr {
>  };
>
>  /** Any PCI device identifier (vendor, device, ...) */
> -#define PCI_ANY_ID (0xffff)
> +#define RTE_PCI_ANY_ID (0xffff)
> +/** @deprecated Replaced with RTE_PCI_ANY_ID */
> +#define PCI_ANY_ID RTE_PCI_ANY_ID

We may also tag it for applications to notice the deprecation:

#define PCI_ANY_ID RTE_DEPRECATED(PCI_ANY_ID) RTE_PCI_ANY_ID


>  #define RTE_CLASS_ANY_ID (0xffffff)
>
>  /**


-- 
David Marchand


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

* Re: [dpdk-dev] [PATCH 1/2] pci: rename catch-all ID
  2021-04-01  7:58   ` David Marchand
@ 2021-04-01  8:15     ` Thomas Monjalon
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2021-04-01  8:15 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Gaetan Rivet

01/04/2021 09:58, David Marchand:
> On Thu, Apr 1, 2021 at 12:34 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> > @@ -95,7 +95,9 @@ struct rte_pci_addr {
> >  };
> >
> >  /** Any PCI device identifier (vendor, device, ...) */
> > -#define PCI_ANY_ID (0xffff)
> > +#define RTE_PCI_ANY_ID (0xffff)
> > +/** @deprecated Replaced with RTE_PCI_ANY_ID */
> > +#define PCI_ANY_ID RTE_PCI_ANY_ID
> 
> We may also tag it for applications to notice the deprecation:
> 
> #define PCI_ANY_ID RTE_DEPRECATED(PCI_ANY_ID) RTE_PCI_ANY_ID

Yes, I forgot this macro, thanks.




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

* [dpdk-dev] [PATCH v2 0/2] pci: add rte prefix
  2021-03-31 22:34 [dpdk-dev] [PATCH 0/2] pci: add rte prefix Thomas Monjalon
  2021-03-31 22:34 ` [dpdk-dev] [PATCH 1/2] pci: rename catch-all ID Thomas Monjalon
  2021-03-31 22:34 ` [dpdk-dev] [PATCH 2/2] bus/pci: rename probe/remove operation types Thomas Monjalon
@ 2021-04-05  9:15 ` Thomas Monjalon
  2021-04-05  9:15   ` [dpdk-dev] [PATCH v2 1/2] pci: rename catch-all ID Thomas Monjalon
                     ` (2 more replies)
  2021-04-06 10:28 ` [dpdk-dev] [PATCH v3 " Thomas Monjalon
  3 siblings, 3 replies; 19+ messages in thread
From: Thomas Monjalon @ 2021-04-05  9:15 UTC (permalink / raw)
  To: dev

Small namespace cleanups in PCI lib and bus driver.

v2:
   - mark old macro with RTE_DEPRECATED
   - fix common/mlx5

Thomas Monjalon (2):
  pci: rename catch-all ID
  bus/pci: rename probe/remove operation types

 drivers/bus/pci/pci_common.c          |  8 ++++----
 drivers/bus/pci/rte_bus_pci.h         | 20 ++++++++------------
 drivers/common/mlx5/mlx5_common_pci.c |  8 ++++----
 lib/librte_pci/rte_pci.h              | 12 +++++++-----
 4 files changed, 23 insertions(+), 25 deletions(-)

-- 
2.31.1


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

* [dpdk-dev] [PATCH v2 1/2] pci: rename catch-all ID
  2021-04-05  9:15 ` [dpdk-dev] [PATCH v2 0/2] pci: add rte prefix Thomas Monjalon
@ 2021-04-05  9:15   ` Thomas Monjalon
  2021-04-06  6:23     ` Xueming(Steven) Li
  2021-04-05  9:15   ` [dpdk-dev] [PATCH v2 2/2] bus/pci: rename probe/remove operation types Thomas Monjalon
  2021-04-06  8:55   ` [dpdk-dev] [PATCH v2 0/2] pci: add rte prefix David Marchand
  2 siblings, 1 reply; 19+ messages in thread
From: Thomas Monjalon @ 2021-04-05  9:15 UTC (permalink / raw)
  To: dev; +Cc: Matan Azrad, Shahaf Shuler, Viacheslav Ovsiienko, Gaetan Rivet

The name of the constant PCI_ANY_ID was missing RTE_ prefix.
It is renamed, and the old name becomes a deprecated alias.

While renaming, the duplicate definitions in rte_bus_pci.h
are removed to keep only those in rte_pci.h.
Note: rte_pci.h is included in rte_bus_pci.h

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/bus/pci/pci_common.c          |  8 ++++----
 drivers/bus/pci/rte_bus_pci.h         | 12 ++++--------
 drivers/common/mlx5/mlx5_common_pci.c |  8 ++++----
 lib/librte_pci/rte_pci.h              | 12 +++++++-----
 4 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 9b8d769287..ee7f966358 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -133,18 +133,18 @@ rte_pci_match(const struct rte_pci_driver *pci_drv,
 	     id_table++) {
 		/* check if device's identifiers match the driver's ones */
 		if (id_table->vendor_id != pci_dev->id.vendor_id &&
-				id_table->vendor_id != PCI_ANY_ID)
+				id_table->vendor_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->device_id != pci_dev->id.device_id &&
-				id_table->device_id != PCI_ANY_ID)
+				id_table->device_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->subsystem_vendor_id !=
 		    pci_dev->id.subsystem_vendor_id &&
-		    id_table->subsystem_vendor_id != PCI_ANY_ID)
+		    id_table->subsystem_vendor_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->subsystem_device_id !=
 		    pci_dev->id.subsystem_device_id &&
-		    id_table->subsystem_device_id != PCI_ANY_ID)
+		    id_table->subsystem_device_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->class_id != pci_dev->id.class_id &&
 				id_table->class_id != RTE_CLASS_ANY_ID)
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 876abddefb..3a092bc6d5 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -91,26 +91,22 @@ struct rte_pci_device {
 
 #define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
 
-/** Any PCI device identifier (vendor, device, ...) */
-#define PCI_ANY_ID (0xffff)
-#define RTE_CLASS_ANY_ID (0xffffff)
-
 #ifdef __cplusplus
 /** C++ macro used to help building up tables of device IDs */
 #define RTE_PCI_DEVICE(vend, dev) \
 	RTE_CLASS_ANY_ID,         \
 	(vend),                   \
 	(dev),                    \
-	PCI_ANY_ID,               \
-	PCI_ANY_ID
+	RTE_PCI_ANY_ID,           \
+	RTE_PCI_ANY_ID
 #else
 /** Macro used to help building up tables of device IDs */
 #define RTE_PCI_DEVICE(vend, dev)          \
 	.class_id = RTE_CLASS_ANY_ID,      \
 	.vendor_id = (vend),               \
 	.device_id = (dev),                \
-	.subsystem_vendor_id = PCI_ANY_ID, \
-	.subsystem_device_id = PCI_ANY_ID
+	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
+	.subsystem_device_id = RTE_PCI_ANY_ID
 #endif
 
 /**
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index a7f541a90c..9689ca86fc 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -142,18 +142,18 @@ mlx5_bus_match(const struct mlx5_pci_driver *drv,
 	     id_table++) {
 		/* Check if device's ids match the class driver's ids. */
 		if (id_table->vendor_id != pci_dev->id.vendor_id &&
-		    id_table->vendor_id != PCI_ANY_ID)
+		    id_table->vendor_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->device_id != pci_dev->id.device_id &&
-		    id_table->device_id != PCI_ANY_ID)
+		    id_table->device_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->subsystem_vendor_id !=
 		    pci_dev->id.subsystem_vendor_id &&
-		    id_table->subsystem_vendor_id != PCI_ANY_ID)
+		    id_table->subsystem_vendor_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->subsystem_device_id !=
 		    pci_dev->id.subsystem_device_id &&
-		    id_table->subsystem_device_id != PCI_ANY_ID)
+		    id_table->subsystem_device_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->class_id != pci_dev->id.class_id &&
 		    id_table->class_id != RTE_CLASS_ANY_ID)
diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h
index f89c7dbbea..a8f8e404a9 100644
--- a/lib/librte_pci/rte_pci.h
+++ b/lib/librte_pci/rte_pci.h
@@ -78,10 +78,10 @@ extern "C" {
  */
 struct rte_pci_id {
 	uint32_t class_id;            /**< Class ID or RTE_CLASS_ANY_ID. */
-	uint16_t vendor_id;           /**< Vendor ID or PCI_ANY_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. */
+	uint16_t vendor_id;           /**< Vendor ID or RTE_PCI_ANY_ID. */
+	uint16_t device_id;           /**< Device ID or RTE_PCI_ANY_ID. */
+	uint16_t subsystem_vendor_id; /**< Subsystem vendor ID or RTE_PCI_ANY_ID. */
+	uint16_t subsystem_device_id; /**< Subsystem device ID or RTE_PCI_ANY_ID. */
 };
 
 /**
@@ -95,7 +95,9 @@ struct rte_pci_addr {
 };
 
 /** Any PCI device identifier (vendor, device, ...) */
-#define PCI_ANY_ID (0xffff)
+#define RTE_PCI_ANY_ID (0xffff)
+/** @deprecated Replaced with RTE_PCI_ANY_ID */
+#define PCI_ANY_ID RTE_DEPRECATED(PCI_ANY_ID) RTE_PCI_ANY_ID
 #define RTE_CLASS_ANY_ID (0xffffff)
 
 /**
-- 
2.31.1


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

* [dpdk-dev] [PATCH v2 2/2] bus/pci: rename probe/remove operation types
  2021-04-05  9:15 ` [dpdk-dev] [PATCH v2 0/2] pci: add rte prefix Thomas Monjalon
  2021-04-05  9:15   ` [dpdk-dev] [PATCH v2 1/2] pci: rename catch-all ID Thomas Monjalon
@ 2021-04-05  9:15   ` Thomas Monjalon
  2021-04-06  6:32     ` Xueming(Steven) Li
  2021-04-06  8:55   ` [dpdk-dev] [PATCH v2 0/2] pci: add rte prefix David Marchand
  2 siblings, 1 reply; 19+ messages in thread
From: Thomas Monjalon @ 2021-04-05  9:15 UTC (permalink / raw)
  To: dev

The names of the prototypes pci_probe_t and pci_remove_t
are missing a prefix rte_.
These function types are simply renamed.

No compatibility break is expected for the applications
because it is considered as an internal name in the driver interface.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/bus/pci/rte_bus_pci.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 3a092bc6d5..64886b4731 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -112,12 +112,12 @@ struct rte_pci_device {
 /**
  * Initialisation function for the driver called during PCI probing.
  */
-typedef int (pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
+typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
 
 /**
  * Uninitialisation function for the driver called during hotplugging.
  */
-typedef int (pci_remove_t)(struct rte_pci_device *);
+typedef int (rte_pci_remove_t)(struct rte_pci_device *);
 
 /**
  * Driver-specific DMA mapping. After a successful call the device
@@ -164,8 +164,8 @@ struct rte_pci_driver {
 	TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
 	struct rte_driver driver;          /**< Inherit core driver. */
 	struct rte_pci_bus *bus;           /**< PCI bus reference. */
-	pci_probe_t *probe;                /**< Device Probe function. */
-	pci_remove_t *remove;              /**< Device Remove function. */
+	rte_pci_probe_t *probe;            /**< Device probe function. */
+	rte_pci_remove_t *remove;          /**< Device remove function. */
 	pci_dma_map_t *dma_map;		   /**< device dma map function. */
 	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
 	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
-- 
2.31.1


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

* Re: [dpdk-dev] [PATCH 1/2] pci: rename catch-all ID
  2021-03-31 22:34 ` [dpdk-dev] [PATCH 1/2] pci: rename catch-all ID Thomas Monjalon
  2021-04-01  7:58   ` David Marchand
@ 2021-04-05 10:42   ` Parav Pandit
  1 sibling, 0 replies; 19+ messages in thread
From: Parav Pandit @ 2021-04-05 10:42 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon, dev; +Cc: Gaetan Rivet



> From: dev <dev-bounces@dpdk.org> On Behalf Of Thomas Monjalon
> Sent: Thursday, April 1, 2021 4:04 AM
> 
> The name of the constant PCI_ANY_ID was missing RTE_ prefix.
> It is renamed, and the old name becomes a deprecated alias.
> 
> While renaming, the duplicate definitions in rte_bus_pci.h are removed to
> keep only those in rte_pci.h.
> Note: rte_pci.h is included in rte_bus_pci.h
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  drivers/bus/pci/pci_common.c  |  8 ++++----  drivers/bus/pci/rte_bus_pci.h |
> 12 ++++--------
>  lib/librte_pci/rte_pci.h      | 12 +++++++-----
>  3 files changed, 15 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
> index 9b8d769287..ee7f966358 100644
> --- a/drivers/bus/pci/pci_common.c
> +++ b/drivers/bus/pci/pci_common.c
> @@ -133,18 +133,18 @@ rte_pci_match(const struct rte_pci_driver
> *pci_drv,
>  	     id_table++) {
>  		/* check if device's identifiers match the driver's ones */
>  		if (id_table->vendor_id != pci_dev->id.vendor_id &&
> -				id_table->vendor_id != PCI_ANY_ID)
> +				id_table->vendor_id != RTE_PCI_ANY_ID)
>  			continue;
>  		if (id_table->device_id != pci_dev->id.device_id &&
> -				id_table->device_id != PCI_ANY_ID)
> +				id_table->device_id != RTE_PCI_ANY_ID)
>  			continue;
>  		if (id_table->subsystem_vendor_id !=
>  		    pci_dev->id.subsystem_vendor_id &&
> -		    id_table->subsystem_vendor_id != PCI_ANY_ID)
> +		    id_table->subsystem_vendor_id != RTE_PCI_ANY_ID)
>  			continue;
>  		if (id_table->subsystem_device_id !=
>  		    pci_dev->id.subsystem_device_id &&
> -		    id_table->subsystem_device_id != PCI_ANY_ID)
> +		    id_table->subsystem_device_id != RTE_PCI_ANY_ID)
>  			continue;
>  		if (id_table->class_id != pci_dev->id.class_id &&
>  				id_table->class_id != RTE_CLASS_ANY_ID) diff
> --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index
> 876abddefb..3a092bc6d5 100644
> --- a/drivers/bus/pci/rte_bus_pci.h
> +++ b/drivers/bus/pci/rte_bus_pci.h
> @@ -91,26 +91,22 @@ struct rte_pci_device {
> 
>  #define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)-
> >device)
> 
> -/** Any PCI device identifier (vendor, device, ...) */ -#define PCI_ANY_ID
> (0xffff) -#define RTE_CLASS_ANY_ID (0xffffff)
> -
>  #ifdef __cplusplus
>  /** C++ macro used to help building up tables of device IDs */  #define
> RTE_PCI_DEVICE(vend, dev) \
>  	RTE_CLASS_ANY_ID,         \
>  	(vend),                   \
>  	(dev),                    \
> -	PCI_ANY_ID,               \
> -	PCI_ANY_ID
> +	RTE_PCI_ANY_ID,           \
> +	RTE_PCI_ANY_ID
>  #else
>  /** Macro used to help building up tables of device IDs */
>  #define RTE_PCI_DEVICE(vend, dev)          \
>  	.class_id = RTE_CLASS_ANY_ID,      \
>  	.vendor_id = (vend),               \
>  	.device_id = (dev),                \
> -	.subsystem_vendor_id = PCI_ANY_ID, \
> -	.subsystem_device_id = PCI_ANY_ID
> +	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
> +	.subsystem_device_id = RTE_PCI_ANY_ID
>  #endif
> 
>  /**
> diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h index
> f89c7dbbea..ed3196a368 100644
> --- a/lib/librte_pci/rte_pci.h
> +++ b/lib/librte_pci/rte_pci.h
> @@ -78,10 +78,10 @@ extern "C" {
>   */
>  struct rte_pci_id {
>  	uint32_t class_id;            /**< Class ID or RTE_CLASS_ANY_ID. */
> -	uint16_t vendor_id;           /**< Vendor ID or PCI_ANY_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. */
> +	uint16_t vendor_id;           /**< Vendor ID or RTE_PCI_ANY_ID. */
> +	uint16_t device_id;           /**< Device ID or RTE_PCI_ANY_ID. */
> +	uint16_t subsystem_vendor_id; /**< Subsystem vendor ID or
> RTE_PCI_ANY_ID. */
> +	uint16_t subsystem_device_id; /**< Subsystem device ID or
> +RTE_PCI_ANY_ID. */
>  };
> 
>  /**
> @@ -95,7 +95,9 @@ struct rte_pci_addr {
>  };
> 
>  /** Any PCI device identifier (vendor, device, ...) */ -#define PCI_ANY_ID
> (0xffff)
> +#define RTE_PCI_ANY_ID (0xffff)
> +/** @deprecated Replaced with RTE_PCI_ANY_ID */ #define PCI_ANY_ID
> +RTE_PCI_ANY_ID
>  #define RTE_CLASS_ANY_ID (0xffffff)
> 
>  /**
> --
> 2.30.1

Reviewed-by: Parav Pandit <parav@nvidia.com>


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

* Re: [dpdk-dev] [PATCH v2 1/2] pci: rename catch-all ID
  2021-04-05  9:15   ` [dpdk-dev] [PATCH v2 1/2] pci: rename catch-all ID Thomas Monjalon
@ 2021-04-06  6:23     ` Xueming(Steven) Li
  2021-04-06  9:33       ` Thomas Monjalon
  0 siblings, 1 reply; 19+ messages in thread
From: Xueming(Steven) Li @ 2021-04-06  6:23 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon, dev
  Cc: Matan Azrad, Shahaf Shuler, Slava Ovsiienko, Gaetan Rivet


>-----Original Message-----
>From: dev <dev-bounces@dpdk.org> On Behalf Of Thomas Monjalon
>Sent: Monday, April 5, 2021 5:15 PM
>To: dev@dpdk.org
>Cc: Matan Azrad <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>; Gaetan
>Rivet <grive@u256.net>
>Subject: [dpdk-dev] [PATCH v2 1/2] pci: rename catch-all ID
>
>The name of the constant PCI_ANY_ID was missing RTE_ prefix.
>It is renamed, and the old name becomes a deprecated alias.
>
>While renaming, the duplicate definitions in rte_bus_pci.h are removed to keep only those in rte_pci.h.
>Note: rte_pci.h is included in rte_bus_pci.h
>
>Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>---
> drivers/bus/pci/pci_common.c          |  8 ++++----
> drivers/bus/pci/rte_bus_pci.h         | 12 ++++--------
> drivers/common/mlx5/mlx5_common_pci.c |  8 ++++----
> lib/librte_pci/rte_pci.h              | 12 +++++++-----
> 4 files changed, 19 insertions(+), 21 deletions(-)
>
>diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index 9b8d769287..ee7f966358 100644
>--- a/drivers/bus/pci/pci_common.c
>+++ b/drivers/bus/pci/pci_common.c
>@@ -133,18 +133,18 @@ rte_pci_match(const struct rte_pci_driver *pci_drv,
> 	     id_table++) {
> 		/* check if device's identifiers match the driver's ones */
> 		if (id_table->vendor_id != pci_dev->id.vendor_id &&
>-				id_table->vendor_id != PCI_ANY_ID)
>+				id_table->vendor_id != RTE_PCI_ANY_ID)
> 			continue;
> 		if (id_table->device_id != pci_dev->id.device_id &&
>-				id_table->device_id != PCI_ANY_ID)
>+				id_table->device_id != RTE_PCI_ANY_ID)
> 			continue;
> 		if (id_table->subsystem_vendor_id !=
> 		    pci_dev->id.subsystem_vendor_id &&
>-		    id_table->subsystem_vendor_id != PCI_ANY_ID)
>+		    id_table->subsystem_vendor_id != RTE_PCI_ANY_ID)
> 			continue;
> 		if (id_table->subsystem_device_id !=
> 		    pci_dev->id.subsystem_device_id &&
>-		    id_table->subsystem_device_id != PCI_ANY_ID)
>+		    id_table->subsystem_device_id != RTE_PCI_ANY_ID)
> 			continue;
> 		if (id_table->class_id != pci_dev->id.class_id &&
> 				id_table->class_id != RTE_CLASS_ANY_ID) diff --git a/drivers/bus/pci/rte_bus_pci.h
>b/drivers/bus/pci/rte_bus_pci.h index 876abddefb..3a092bc6d5 100644
>--- a/drivers/bus/pci/rte_bus_pci.h
>+++ b/drivers/bus/pci/rte_bus_pci.h
>@@ -91,26 +91,22 @@ struct rte_pci_device {
>
> #define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
>
>-/** Any PCI device identifier (vendor, device, ...) */ -#define PCI_ANY_ID (0xffff) -#define RTE_CLASS_ANY_ID (0xffffff)
>-
> #ifdef __cplusplus
> /** C++ macro used to help building up tables of device IDs */  #define RTE_PCI_DEVICE(vend, dev) \
> 	RTE_CLASS_ANY_ID,         \
> 	(vend),                   \
> 	(dev),                    \
>-	PCI_ANY_ID,               \
>-	PCI_ANY_ID
>+	RTE_PCI_ANY_ID,           \
>+	RTE_PCI_ANY_ID
> #else
> /** Macro used to help building up tables of device IDs */
> #define RTE_PCI_DEVICE(vend, dev)          \
> 	.class_id = RTE_CLASS_ANY_ID,      \
> 	.vendor_id = (vend),               \
> 	.device_id = (dev),                \
>-	.subsystem_vendor_id = PCI_ANY_ID, \
>-	.subsystem_device_id = PCI_ANY_ID
>+	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
>+	.subsystem_device_id = RTE_PCI_ANY_ID
> #endif
>
> /**
>diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
>index a7f541a90c..9689ca86fc 100644
>--- a/drivers/common/mlx5/mlx5_common_pci.c
>+++ b/drivers/common/mlx5/mlx5_common_pci.c
>@@ -142,18 +142,18 @@ mlx5_bus_match(const struct mlx5_pci_driver *drv,
> 	     id_table++) {
> 		/* Check if device's ids match the class driver's ids. */
> 		if (id_table->vendor_id != pci_dev->id.vendor_id &&
>-		    id_table->vendor_id != PCI_ANY_ID)
>+		    id_table->vendor_id != RTE_PCI_ANY_ID)
> 			continue;
> 		if (id_table->device_id != pci_dev->id.device_id &&
>-		    id_table->device_id != PCI_ANY_ID)
>+		    id_table->device_id != RTE_PCI_ANY_ID)
> 			continue;
> 		if (id_table->subsystem_vendor_id !=
> 		    pci_dev->id.subsystem_vendor_id &&
>-		    id_table->subsystem_vendor_id != PCI_ANY_ID)
>+		    id_table->subsystem_vendor_id != RTE_PCI_ANY_ID)
> 			continue;
> 		if (id_table->subsystem_device_id !=
> 		    pci_dev->id.subsystem_device_id &&
>-		    id_table->subsystem_device_id != PCI_ANY_ID)
>+		    id_table->subsystem_device_id != RTE_PCI_ANY_ID)
> 			continue;
> 		if (id_table->class_id != pci_dev->id.class_id &&
> 		    id_table->class_id != RTE_CLASS_ANY_ID) diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h index
>f89c7dbbea..a8f8e404a9 100644
>--- a/lib/librte_pci/rte_pci.h
>+++ b/lib/librte_pci/rte_pci.h
>@@ -78,10 +78,10 @@ extern "C" {
>  */
> struct rte_pci_id {
> 	uint32_t class_id;            /**< Class ID or RTE_CLASS_ANY_ID. */
>-	uint16_t vendor_id;           /**< Vendor ID or PCI_ANY_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. */
>+	uint16_t vendor_id;           /**< Vendor ID or RTE_PCI_ANY_ID. */
>+	uint16_t device_id;           /**< Device ID or RTE_PCI_ANY_ID. */
>+	uint16_t subsystem_vendor_id; /**< Subsystem vendor ID or RTE_PCI_ANY_ID. */
>+	uint16_t subsystem_device_id; /**< Subsystem device ID or +RTE_PCI_ANY_ID. */

Line length exceeds 80 chars.

> };
>
> /**
>@@ -95,7 +95,9 @@ struct rte_pci_addr {
> };
>
> /** Any PCI device identifier (vendor, device, ...) */ -#define PCI_ANY_ID (0xffff)
>+#define RTE_PCI_ANY_ID (0xffff)
>+/** @deprecated Replaced with RTE_PCI_ANY_ID */ #define PCI_ANY_ID
>+RTE_DEPRECATED(PCI_ANY_ID) RTE_PCI_ANY_ID
> #define RTE_CLASS_ANY_ID (0xffffff)
>
> /**
>--
>2.31.1


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

* Re: [dpdk-dev] [PATCH v2 2/2] bus/pci: rename probe/remove operation types
  2021-04-05  9:15   ` [dpdk-dev] [PATCH v2 2/2] bus/pci: rename probe/remove operation types Thomas Monjalon
@ 2021-04-06  6:32     ` Xueming(Steven) Li
  2021-04-06  9:38       ` Thomas Monjalon
  0 siblings, 1 reply; 19+ messages in thread
From: Xueming(Steven) Li @ 2021-04-06  6:32 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon, dev; +Cc: Xueming(Steven) Li


>-----Original Message-----
>From: dev <dev-bounces@dpdk.org> On Behalf Of Thomas Monjalon
>Sent: Monday, April 5, 2021 5:15 PM
>To: dev@dpdk.org
>Subject: [dpdk-dev] [PATCH v2 2/2] bus/pci: rename probe/remove operation types
>
>The names of the prototypes pci_probe_t and pci_remove_t are missing a prefix rte_.
>These function types are simply renamed.
>
>No compatibility break is expected for the applications because it is considered as an internal name in the driver interface.

No long line warning with checkpatch?

Besides this,
Reviewed-by: Xueming Li <xuemingl@nvidia.com>

>
>Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
>---
> drivers/bus/pci/rte_bus_pci.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h index 3a092bc6d5..64886b4731 100644
>--- a/drivers/bus/pci/rte_bus_pci.h
>+++ b/drivers/bus/pci/rte_bus_pci.h
>@@ -112,12 +112,12 @@ struct rte_pci_device {
> /**
>  * Initialisation function for the driver called during PCI probing.
>  */
>-typedef int (pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
>+typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct
>+rte_pci_device *);
>
> /**
>  * Uninitialisation function for the driver called during hotplugging.
>  */
>-typedef int (pci_remove_t)(struct rte_pci_device *);
>+typedef int (rte_pci_remove_t)(struct rte_pci_device *);
>
> /**
>  * Driver-specific DMA mapping. After a successful call the device @@ -164,8 +164,8 @@ struct rte_pci_driver {
> 	TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
> 	struct rte_driver driver;          /**< Inherit core driver. */
> 	struct rte_pci_bus *bus;           /**< PCI bus reference. */
>-	pci_probe_t *probe;                /**< Device Probe function. */
>-	pci_remove_t *remove;              /**< Device Remove function. */
>+	rte_pci_probe_t *probe;            /**< Device probe function. */
>+	rte_pci_remove_t *remove;          /**< Device remove function. */
> 	pci_dma_map_t *dma_map;		   /**< device dma map function. */
> 	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
> 	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
>--
>2.31.1


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

* Re: [dpdk-dev] [PATCH v2 0/2] pci: add rte prefix
  2021-04-05  9:15 ` [dpdk-dev] [PATCH v2 0/2] pci: add rte prefix Thomas Monjalon
  2021-04-05  9:15   ` [dpdk-dev] [PATCH v2 1/2] pci: rename catch-all ID Thomas Monjalon
  2021-04-05  9:15   ` [dpdk-dev] [PATCH v2 2/2] bus/pci: rename probe/remove operation types Thomas Monjalon
@ 2021-04-06  8:55   ` David Marchand
  2 siblings, 0 replies; 19+ messages in thread
From: David Marchand @ 2021-04-06  8:55 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

On Mon, Apr 5, 2021 at 11:15 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> Small namespace cleanups in PCI lib and bus driver.
>
> v2:
>    - mark old macro with RTE_DEPRECATED
>    - fix common/mlx5
>
> Thomas Monjalon (2):
>   pci: rename catch-all ID
>   bus/pci: rename probe/remove operation types

The first patch needs a release notes update (wrt to the API change).
The rest lgtm.

For the series,
Reviewed-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


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

* Re: [dpdk-dev] [PATCH v2 1/2] pci: rename catch-all ID
  2021-04-06  6:23     ` Xueming(Steven) Li
@ 2021-04-06  9:33       ` Thomas Monjalon
  0 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2021-04-06  9:33 UTC (permalink / raw)
  To: Xueming(Steven) Li
  Cc: dev, Matan Azrad, Shahaf Shuler, Slava Ovsiienko, Gaetan Rivet

06/04/2021 08:23, Xueming(Steven) Li:
> From: Thomas Monjalon
> > struct rte_pci_id {
> > 	uint32_t class_id;            /**< Class ID or RTE_CLASS_ANY_ID. */
> >-	uint16_t vendor_id;           /**< Vendor ID or PCI_ANY_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. */
> >+	uint16_t vendor_id;           /**< Vendor ID or RTE_PCI_ANY_ID. */
> >+	uint16_t device_id;           /**< Device ID or RTE_PCI_ANY_ID. */
> >+	uint16_t subsystem_vendor_id; /**< Subsystem vendor ID or RTE_PCI_ANY_ID. */
> >+	uint16_t subsystem_device_id; /**< Subsystem device ID or +RTE_PCI_ANY_ID. */
> 
> Line length exceeds 80 chars.

It's tolerated until 100 chars, especially for comments.




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

* Re: [dpdk-dev] [PATCH v2 2/2] bus/pci: rename probe/remove operation types
  2021-04-06  6:32     ` Xueming(Steven) Li
@ 2021-04-06  9:38       ` Thomas Monjalon
  2021-04-06 10:51         ` Xueming(Steven) Li
  0 siblings, 1 reply; 19+ messages in thread
From: Thomas Monjalon @ 2021-04-06  9:38 UTC (permalink / raw)
  To: Xueming(Steven) Li; +Cc: dev

06/04/2021 08:32, Xueming(Steven) Li:
> From: Thomas Monjalon
> >
> >The names of the prototypes pci_probe_t and pci_remove_t are missing a prefix rte_.
> >These function types are simply renamed.
> >
> >No compatibility break is expected for the applications because it is considered as an internal name in the driver interface.
> 
> No long line warning with checkpatch?

No, this is your mail client which makes this line so long.
Please check config of your mail client (or use a real one :)

Note: the quoted lines should be prefixed with "> " (with a space)



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

* [dpdk-dev] [PATCH v3 0/2] pci: add rte prefix
  2021-03-31 22:34 [dpdk-dev] [PATCH 0/2] pci: add rte prefix Thomas Monjalon
                   ` (2 preceding siblings ...)
  2021-04-05  9:15 ` [dpdk-dev] [PATCH v2 0/2] pci: add rte prefix Thomas Monjalon
@ 2021-04-06 10:28 ` Thomas Monjalon
  2021-04-06 10:28   ` [dpdk-dev] [PATCH v3 1/2] pci: rename catch-all ID Thomas Monjalon
                     ` (2 more replies)
  3 siblings, 3 replies; 19+ messages in thread
From: Thomas Monjalon @ 2021-04-06 10:28 UTC (permalink / raw)
  To: dev

Small namespace cleanups in PCI lib and bus driver.

v3:
   - add API change to release notes
v2:
   - mark old macro with RTE_DEPRECATED
   - fix common/mlx5

Thomas Monjalon (2):
  pci: rename catch-all ID
  bus/pci: rename probe/remove operation types

 doc/guides/rel_notes/release_21_05.rst |  3 +++
 drivers/bus/pci/pci_common.c           |  8 ++++----
 drivers/bus/pci/rte_bus_pci.h          | 20 ++++++++------------
 drivers/common/mlx5/mlx5_common_pci.c  |  8 ++++----
 lib/librte_pci/rte_pci.h               | 12 +++++++-----
 5 files changed, 26 insertions(+), 25 deletions(-)

-- 
2.31.1


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

* [dpdk-dev] [PATCH v3 1/2] pci: rename catch-all ID
  2021-04-06 10:28 ` [dpdk-dev] [PATCH v3 " Thomas Monjalon
@ 2021-04-06 10:28   ` Thomas Monjalon
  2021-04-06 10:28   ` [dpdk-dev] [PATCH v3 2/2] bus/pci: rename probe/remove operation types Thomas Monjalon
  2021-04-06 13:04   ` [dpdk-dev] [PATCH v3 0/2] pci: add rte prefix Thomas Monjalon
  2 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2021-04-06 10:28 UTC (permalink / raw)
  To: dev
  Cc: Parav Pandit, David Marchand, Matan Azrad, Shahaf Shuler,
	Viacheslav Ovsiienko, Gaetan Rivet

The name of the constant PCI_ANY_ID was missing RTE_ prefix.
It is renamed, and the old name becomes a deprecated alias.

While renaming, the duplicate definitions in rte_bus_pci.h
are removed to keep only those in rte_pci.h.
Note: rte_pci.h is included in rte_bus_pci.h

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Parav Pandit <parav@nvidia.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/rel_notes/release_21_05.rst |  3 +++
 drivers/bus/pci/pci_common.c           |  8 ++++----
 drivers/bus/pci/rte_bus_pci.h          | 12 ++++--------
 drivers/common/mlx5/mlx5_common_pci.c  |  8 ++++----
 lib/librte_pci/rte_pci.h               | 12 +++++++-----
 5 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 19cec62c73..61b6575949 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -159,6 +159,9 @@ API Changes
   from ``rte_thread_tls_*`` to ``rte_thread_*`` to avoid naming redundancy
   and confusion with the transport layer security term.
 
+* pci: The value ``PCI_ANY_ID`` is marked as deprecated,
+  and can be replaced with ``RTE_PCI_ANY_ID``.
+
 
 ABI Changes
 -----------
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 9b8d769287..ee7f966358 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -133,18 +133,18 @@ rte_pci_match(const struct rte_pci_driver *pci_drv,
 	     id_table++) {
 		/* check if device's identifiers match the driver's ones */
 		if (id_table->vendor_id != pci_dev->id.vendor_id &&
-				id_table->vendor_id != PCI_ANY_ID)
+				id_table->vendor_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->device_id != pci_dev->id.device_id &&
-				id_table->device_id != PCI_ANY_ID)
+				id_table->device_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->subsystem_vendor_id !=
 		    pci_dev->id.subsystem_vendor_id &&
-		    id_table->subsystem_vendor_id != PCI_ANY_ID)
+		    id_table->subsystem_vendor_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->subsystem_device_id !=
 		    pci_dev->id.subsystem_device_id &&
-		    id_table->subsystem_device_id != PCI_ANY_ID)
+		    id_table->subsystem_device_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->class_id != pci_dev->id.class_id &&
 				id_table->class_id != RTE_CLASS_ANY_ID)
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 876abddefb..3a092bc6d5 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -91,26 +91,22 @@ struct rte_pci_device {
 
 #define RTE_ETH_DEV_TO_PCI(eth_dev)	RTE_DEV_TO_PCI((eth_dev)->device)
 
-/** Any PCI device identifier (vendor, device, ...) */
-#define PCI_ANY_ID (0xffff)
-#define RTE_CLASS_ANY_ID (0xffffff)
-
 #ifdef __cplusplus
 /** C++ macro used to help building up tables of device IDs */
 #define RTE_PCI_DEVICE(vend, dev) \
 	RTE_CLASS_ANY_ID,         \
 	(vend),                   \
 	(dev),                    \
-	PCI_ANY_ID,               \
-	PCI_ANY_ID
+	RTE_PCI_ANY_ID,           \
+	RTE_PCI_ANY_ID
 #else
 /** Macro used to help building up tables of device IDs */
 #define RTE_PCI_DEVICE(vend, dev)          \
 	.class_id = RTE_CLASS_ANY_ID,      \
 	.vendor_id = (vend),               \
 	.device_id = (dev),                \
-	.subsystem_vendor_id = PCI_ANY_ID, \
-	.subsystem_device_id = PCI_ANY_ID
+	.subsystem_vendor_id = RTE_PCI_ANY_ID, \
+	.subsystem_device_id = RTE_PCI_ANY_ID
 #endif
 
 /**
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index a7f541a90c..9689ca86fc 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -142,18 +142,18 @@ mlx5_bus_match(const struct mlx5_pci_driver *drv,
 	     id_table++) {
 		/* Check if device's ids match the class driver's ids. */
 		if (id_table->vendor_id != pci_dev->id.vendor_id &&
-		    id_table->vendor_id != PCI_ANY_ID)
+		    id_table->vendor_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->device_id != pci_dev->id.device_id &&
-		    id_table->device_id != PCI_ANY_ID)
+		    id_table->device_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->subsystem_vendor_id !=
 		    pci_dev->id.subsystem_vendor_id &&
-		    id_table->subsystem_vendor_id != PCI_ANY_ID)
+		    id_table->subsystem_vendor_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->subsystem_device_id !=
 		    pci_dev->id.subsystem_device_id &&
-		    id_table->subsystem_device_id != PCI_ANY_ID)
+		    id_table->subsystem_device_id != RTE_PCI_ANY_ID)
 			continue;
 		if (id_table->class_id != pci_dev->id.class_id &&
 		    id_table->class_id != RTE_CLASS_ANY_ID)
diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h
index f89c7dbbea..a8f8e404a9 100644
--- a/lib/librte_pci/rte_pci.h
+++ b/lib/librte_pci/rte_pci.h
@@ -78,10 +78,10 @@ extern "C" {
  */
 struct rte_pci_id {
 	uint32_t class_id;            /**< Class ID or RTE_CLASS_ANY_ID. */
-	uint16_t vendor_id;           /**< Vendor ID or PCI_ANY_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. */
+	uint16_t vendor_id;           /**< Vendor ID or RTE_PCI_ANY_ID. */
+	uint16_t device_id;           /**< Device ID or RTE_PCI_ANY_ID. */
+	uint16_t subsystem_vendor_id; /**< Subsystem vendor ID or RTE_PCI_ANY_ID. */
+	uint16_t subsystem_device_id; /**< Subsystem device ID or RTE_PCI_ANY_ID. */
 };
 
 /**
@@ -95,7 +95,9 @@ struct rte_pci_addr {
 };
 
 /** Any PCI device identifier (vendor, device, ...) */
-#define PCI_ANY_ID (0xffff)
+#define RTE_PCI_ANY_ID (0xffff)
+/** @deprecated Replaced with RTE_PCI_ANY_ID */
+#define PCI_ANY_ID RTE_DEPRECATED(PCI_ANY_ID) RTE_PCI_ANY_ID
 #define RTE_CLASS_ANY_ID (0xffffff)
 
 /**
-- 
2.31.1


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

* [dpdk-dev] [PATCH v3 2/2] bus/pci: rename probe/remove operation types
  2021-04-06 10:28 ` [dpdk-dev] [PATCH v3 " Thomas Monjalon
  2021-04-06 10:28   ` [dpdk-dev] [PATCH v3 1/2] pci: rename catch-all ID Thomas Monjalon
@ 2021-04-06 10:28   ` Thomas Monjalon
  2021-04-06 13:04   ` [dpdk-dev] [PATCH v3 0/2] pci: add rte prefix Thomas Monjalon
  2 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2021-04-06 10:28 UTC (permalink / raw)
  To: dev; +Cc: Xueming Li, David Marchand

The names of the prototypes pci_probe_t and pci_remove_t
are missing a prefix rte_.
These function types are simply renamed.

No compatibility break is expected for the applications
because it is considered as an internal name in the driver interface.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/pci/rte_bus_pci.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 3a092bc6d5..64886b4731 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -112,12 +112,12 @@ struct rte_pci_device {
 /**
  * Initialisation function for the driver called during PCI probing.
  */
-typedef int (pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
+typedef int (rte_pci_probe_t)(struct rte_pci_driver *, struct rte_pci_device *);
 
 /**
  * Uninitialisation function for the driver called during hotplugging.
  */
-typedef int (pci_remove_t)(struct rte_pci_device *);
+typedef int (rte_pci_remove_t)(struct rte_pci_device *);
 
 /**
  * Driver-specific DMA mapping. After a successful call the device
@@ -164,8 +164,8 @@ struct rte_pci_driver {
 	TAILQ_ENTRY(rte_pci_driver) next;  /**< Next in list. */
 	struct rte_driver driver;          /**< Inherit core driver. */
 	struct rte_pci_bus *bus;           /**< PCI bus reference. */
-	pci_probe_t *probe;                /**< Device Probe function. */
-	pci_remove_t *remove;              /**< Device Remove function. */
+	rte_pci_probe_t *probe;            /**< Device probe function. */
+	rte_pci_remove_t *remove;          /**< Device remove function. */
 	pci_dma_map_t *dma_map;		   /**< device dma map function. */
 	pci_dma_unmap_t *dma_unmap;	   /**< device dma unmap function. */
 	const struct rte_pci_id *id_table; /**< ID table, NULL terminated. */
-- 
2.31.1


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

* Re: [dpdk-dev] [PATCH v2 2/2] bus/pci: rename probe/remove operation types
  2021-04-06  9:38       ` Thomas Monjalon
@ 2021-04-06 10:51         ` Xueming(Steven) Li
  0 siblings, 0 replies; 19+ messages in thread
From: Xueming(Steven) Li @ 2021-04-06 10:51 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon; +Cc: dev



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Tuesday, April 6, 2021 5:39 PM
> To: Xueming(Steven) Li <xuemingl@nvidia.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 2/2] bus/pci: rename probe/remove operation types
> 
> 06/04/2021 08:32, Xueming(Steven) Li:
> > From: Thomas Monjalon
> > >
> > >The names of the prototypes pci_probe_t and pci_remove_t are missing a prefix rte_.
> > >These function types are simply renamed.
> > >
> > >No compatibility break is expected for the applications because it is considered as an internal name in the driver interface.
> >
> > No long line warning with checkpatch?
> 
> No, this is your mail client which makes this line so long.
> Please check config of your mail client (or use a real one :)

Strange, this never happen before with Outlook.

> 
> Note: the quoted lines should be prefixed with "> " (with a space)
> 
Thanks.

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

* Re: [dpdk-dev] [PATCH v3 0/2] pci: add rte prefix
  2021-04-06 10:28 ` [dpdk-dev] [PATCH v3 " Thomas Monjalon
  2021-04-06 10:28   ` [dpdk-dev] [PATCH v3 1/2] pci: rename catch-all ID Thomas Monjalon
  2021-04-06 10:28   ` [dpdk-dev] [PATCH v3 2/2] bus/pci: rename probe/remove operation types Thomas Monjalon
@ 2021-04-06 13:04   ` Thomas Monjalon
  2 siblings, 0 replies; 19+ messages in thread
From: Thomas Monjalon @ 2021-04-06 13:04 UTC (permalink / raw)
  To: dev

> Thomas Monjalon (2):
>   pci: rename catch-all ID
>   bus/pci: rename probe/remove operation types

Applied




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

end of thread, other threads:[~2021-04-06 13:04 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31 22:34 [dpdk-dev] [PATCH 0/2] pci: add rte prefix Thomas Monjalon
2021-03-31 22:34 ` [dpdk-dev] [PATCH 1/2] pci: rename catch-all ID Thomas Monjalon
2021-04-01  7:58   ` David Marchand
2021-04-01  8:15     ` Thomas Monjalon
2021-04-05 10:42   ` Parav Pandit
2021-03-31 22:34 ` [dpdk-dev] [PATCH 2/2] bus/pci: rename probe/remove operation types Thomas Monjalon
2021-04-05  9:15 ` [dpdk-dev] [PATCH v2 0/2] pci: add rte prefix Thomas Monjalon
2021-04-05  9:15   ` [dpdk-dev] [PATCH v2 1/2] pci: rename catch-all ID Thomas Monjalon
2021-04-06  6:23     ` Xueming(Steven) Li
2021-04-06  9:33       ` Thomas Monjalon
2021-04-05  9:15   ` [dpdk-dev] [PATCH v2 2/2] bus/pci: rename probe/remove operation types Thomas Monjalon
2021-04-06  6:32     ` Xueming(Steven) Li
2021-04-06  9:38       ` Thomas Monjalon
2021-04-06 10:51         ` Xueming(Steven) Li
2021-04-06  8:55   ` [dpdk-dev] [PATCH v2 0/2] pci: add rte prefix David Marchand
2021-04-06 10:28 ` [dpdk-dev] [PATCH v3 " Thomas Monjalon
2021-04-06 10:28   ` [dpdk-dev] [PATCH v3 1/2] pci: rename catch-all ID Thomas Monjalon
2021-04-06 10:28   ` [dpdk-dev] [PATCH v3 2/2] bus/pci: rename probe/remove operation types Thomas Monjalon
2021-04-06 13:04   ` [dpdk-dev] [PATCH v3 0/2] pci: add rte prefix Thomas Monjalon

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).