* [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
@ 2016-05-11 6:08 Ziye Yang
2016-05-11 15:21 ` Stephen Hemminger
` (2 more replies)
0 siblings, 3 replies; 23+ messages in thread
From: Ziye Yang @ 2016-05-11 6:08 UTC (permalink / raw)
To: dev
This patch is used to add the class_id (class_code,
subclass_code, programming_interface) support for
pci_device probe. With this patch, it will be
flexible for users to probe a class of devices
by class_id.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 4 ++++
lib/librte_eal/common/eal_common_pci.c | 3 +++
lib/librte_eal/common/include/rte_pci.h | 8 ++++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 9 +++++++++
4 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 2d16d78..6fc9130 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -278,6 +278,10 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
/* get subsystem_device id */
dev->id.subsystem_device_id = conf->pc_subdevice;
+ dev->id.class_id = (conf->pc_class << 16) |
+ (conf->pc_subclass << 8) |
+ (conf->pc_progif);
+
/* TODO: get max_vfs */
dev->max_vfs = 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 3cae4cb..ed792f9 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -162,6 +162,9 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
if (id_table->subsystem_device_id != dev->id.subsystem_device_id &&
id_table->subsystem_device_id != PCI_ANY_ID)
continue;
+ if (id_table->class_id != dev->id.class_id &&
+ id_table->class_id != CLASS_ANY_ID)
+ continue;
struct rte_pci_addr *loc = &dev->addr;
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 8fa2712..fbb3ad9 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -129,6 +129,7 @@ struct rte_pci_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. */
+ uint32_t class_id; /**< Class ID (class, subclass, pi) or CLASS_ANY_ID. */
};
/**
@@ -170,6 +171,7 @@ struct rte_pci_device {
/** Any PCI device identifier (vendor, device, ...) */
#define PCI_ANY_ID (0xffff)
+#define CLASS_ANY_ID (0xffffff)
#ifdef __cplusplus
/** C++ macro used to help building up tables of device IDs */
@@ -177,14 +179,16 @@ struct rte_pci_device {
(vend), \
(dev), \
PCI_ANY_ID, \
- PCI_ANY_ID
+ PCI_ANY_ID, \
+ CLASS_ANY_ID
#else
/** Macro used to help building up tables of device IDs */
#define RTE_PCI_DEVICE(vend, dev) \
.vendor_id = (vend), \
.device_id = (dev), \
.subsystem_vendor_id = PCI_ANY_ID, \
- .subsystem_device_id = PCI_ANY_ID
+ .subsystem_device_id = PCI_ANY_ID, \
+ .class_id = CLASS_ANY_ID
#endif
struct rte_pci_driver;
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index bdc08a0..3a1617c 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -306,6 +306,15 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
}
dev->id.subsystem_device_id = (uint16_t)tmp;
+ /* get class_id */
+ snprintf(filename, sizeof(filename), "%s/class",
+ dirname);
+ if (eal_parse_sysfs_value(filename, &tmp) < 0) {
+ free(dev);
+ return -1;
+ }
+ dev->id.class_id = (uint32_t)tmp && CLASS_ANY_ID;
+
/* get max_vfs */
dev->max_vfs = 0;
snprintf(filename, sizeof(filename), "%s/max_vfs", dirname);
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-05-11 6:08 [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe Ziye Yang
@ 2016-05-11 15:21 ` Stephen Hemminger
2016-05-11 15:34 ` Richardson, Bruce
2016-05-19 10:33 ` Thomas Monjalon
2016-05-19 12:25 ` [dpdk-dev] [PATCH v2] ci: " Ziye Yang
2 siblings, 1 reply; 23+ messages in thread
From: Stephen Hemminger @ 2016-05-11 15:21 UTC (permalink / raw)
To: Ziye Yang; +Cc: dev
On Wed, 11 May 2016 14:08:15 +0800
Ziye Yang <ziye.yang@intel.com> wrote:
> This patch is used to add the class_id (class_code,
> subclass_code, programming_interface) support for
> pci_device probe. With this patch, it will be
> flexible for users to probe a class of devices
> by class_id.
>
> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
I like this, and it is necessary but since rte_pci_id is a visible
data structure it causes ABI breakage.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-05-11 15:21 ` Stephen Hemminger
@ 2016-05-11 15:34 ` Richardson, Bruce
0 siblings, 0 replies; 23+ messages in thread
From: Richardson, Bruce @ 2016-05-11 15:34 UTC (permalink / raw)
To: Stephen Hemminger, Yang, Ziye; +Cc: dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> Sent: Wednesday, May 11, 2016 4:21 PM
> To: Yang, Ziye <ziye.yang@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
>
> On Wed, 11 May 2016 14:08:15 +0800
> Ziye Yang <ziye.yang@intel.com> wrote:
>
> > This patch is used to add the class_id (class_code, subclass_code,
> > programming_interface) support for pci_device probe. With this patch,
> > it will be flexible for users to probe a class of devices by class_id.
> >
> > Signed-off-by: Ziye Yang <ziye.yang@intel.com>
>
> I like this, and it is necessary but since rte_pci_id is a visible data
> structure it causes ABI breakage.
A notice was published for this change in 16.04, so we should be ok ABI-wise.
/Bruce
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-05-11 6:08 [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe Ziye Yang
2016-05-11 15:21 ` Stephen Hemminger
@ 2016-05-19 10:33 ` Thomas Monjalon
2016-05-19 12:18 ` Yang, Ziye
2016-05-19 12:25 ` [dpdk-dev] [PATCH v2] ci: " Ziye Yang
2 siblings, 1 reply; 23+ messages in thread
From: Thomas Monjalon @ 2016-05-19 10:33 UTC (permalink / raw)
To: Ziye Yang; +Cc: dev
2016-05-11 14:08, Ziye Yang:
> This patch is used to add the class_id (class_code,
> subclass_code, programming_interface) support for
> pci_device probe. With this patch, it will be
> flexible for users to probe a class of devices
> by class_id.
>
> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
> ---
> lib/librte_eal/bsdapp/eal/eal_pci.c | 4 ++++
> lib/librte_eal/common/eal_common_pci.c | 3 +++
> lib/librte_eal/common/include/rte_pci.h | 8 ++++++--
> lib/librte_eal/linuxapp/eal/eal_pci.c | 9 +++++++++
> 4 files changed, 22 insertions(+), 2 deletions(-)
Please remove the deprecation notice.
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -129,6 +129,7 @@ struct rte_pci_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. */
> + uint32_t class_id; /**< Class ID (class, subclass, pi) or CLASS_ANY_ID. */
> };
A space is missing.
It would be more logical to put the class_id at the beginning of the struct.
> /** Any PCI device identifier (vendor, device, ...) */
> #define PCI_ANY_ID (0xffff)
> +#define CLASS_ANY_ID (0xffffff)
These constants should be prefixed with RTE_.
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> + /* get class_id */
> + snprintf(filename, sizeof(filename), "%s/class",
> + dirname);
> + if (eal_parse_sysfs_value(filename, &tmp) < 0) {
> + free(dev);
> + return -1;
> + }
> + dev->id.class_id = (uint32_t)tmp && CLASS_ANY_ID;
Should be a bitwise &. Why masking is needed?
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-05-19 10:33 ` Thomas Monjalon
@ 2016-05-19 12:18 ` Yang, Ziye
2016-05-19 12:57 ` Thomas Monjalon
0 siblings, 1 reply; 23+ messages in thread
From: Yang, Ziye @ 2016-05-19 12:18 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
-----Original Message-----
From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
Sent: Thursday, May 19, 2016 6:34 PM
To: Yang, Ziye <ziye.yang@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-05-11 14:08, Ziye Yang:
> This patch is used to add the class_id (class_code, subclass_code,
> programming_interface) support for pci_device probe. With this patch,
> it will be flexible for users to probe a class of devices by class_id.
>
> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
> ---
> lib/librte_eal/bsdapp/eal/eal_pci.c | 4 ++++
> lib/librte_eal/common/eal_common_pci.c | 3 +++
> lib/librte_eal/common/include/rte_pci.h | 8 ++++++--
> lib/librte_eal/linuxapp/eal/eal_pci.c | 9 +++++++++
> 4 files changed, 22 insertions(+), 2 deletions(-)
Please remove the deprecation notice.
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -129,6 +129,7 @@ struct rte_pci_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. */
> + uint32_t class_id; /**< Class ID (class, subclass, pi) or CLASS_ANY_ID. */
> };
A space is missing.
It would be more logical to put the class_id at the beginning of the struct.
> /** Any PCI device identifier (vendor, device, ...) */ #define
> PCI_ANY_ID (0xffff)
> +#define CLASS_ANY_ID (0xffffff)
These constants should be prefixed with RTE_.
[Ziye] suggest for doing another patch to change PCI_ANY_ID to RTE_PCI_ANY_ID since it will affect
Other files.
> --- a/lib/librte_eal/linuxapp/eal/eal_pci.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
> + /* get class_id */
> + snprintf(filename, sizeof(filename), "%s/class",
> + dirname);
> + if (eal_parse_sysfs_value(filename, &tmp) < 0) {
> + free(dev);
> + return -1;
> + }
> + dev->id.class_id = (uint32_t)tmp && CLASS_ANY_ID;
Should be a bitwise &. Why masking is needed?
[Ziye] Only 24bit info is needed.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-05-19 12:18 ` Yang, Ziye
@ 2016-05-19 12:57 ` Thomas Monjalon
2016-05-19 13:14 ` Yang, Ziye
0 siblings, 1 reply; 23+ messages in thread
From: Thomas Monjalon @ 2016-05-19 12:57 UTC (permalink / raw)
To: Yang, Ziye; +Cc: dev
2016-05-19 12:18, Yang, Ziye:
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> 2016-05-11 14:08, Ziye Yang:
> > + dev->id.class_id = (uint32_t)tmp && CLASS_ANY_ID;
>
> Should be a bitwise &. Why masking is needed?
> [Ziye] Only 24bit info is needed.
What are the other bits?
Please put a comment in the code.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-05-19 12:57 ` Thomas Monjalon
@ 2016-05-19 13:14 ` Yang, Ziye
0 siblings, 0 replies; 23+ messages in thread
From: Yang, Ziye @ 2016-05-19 13:14 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
-----Original Message-----
From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
Sent: Thursday, May 19, 2016 8:57 PM
To: Yang, Ziye <ziye.yang@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-05-19 12:18, Yang, Ziye:
> From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com]
> 2016-05-11 14:08, Ziye Yang:
> > + dev->id.class_id = (uint32_t)tmp && CLASS_ANY_ID;
>
> Should be a bitwise &. Why masking is needed?
> [Ziye] Only 24bit info is needed.
What are the other bits?
Please put a comment in the code.
[Ziye] Revision ID is defined in pci spec, classid has 24 bits. And when we read from the system, we will only get class_id, subclass and program interface. I will put the comment
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v2] ci: Add the class_id support in pci probe
2016-05-11 6:08 [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe Ziye Yang
2016-05-11 15:21 ` Stephen Hemminger
2016-05-19 10:33 ` Thomas Monjalon
@ 2016-05-19 12:25 ` Ziye Yang
2016-05-19 13:17 ` [dpdk-dev] [PATCH v3] " Ziye Yang
2 siblings, 1 reply; 23+ messages in thread
From: Ziye Yang @ 2016-05-19 12:25 UTC (permalink / raw)
To: dev
This patch is used to add the class_id (class_code,
subclass_code, programming_interface) support for
pci_device probe. With this patch, it will be
flexible for users to probe a class of devices
by class_id.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 6 ------
lib/librte_eal/bsdapp/eal/eal_pci.c | 5 +++++
lib/librte_eal/common/eal_common_pci.c | 3 +++
lib/librte_eal/common/include/rte_pci.h | 8 ++++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 9 +++++++++
5 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 7d94ba5..28f9c61 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -20,12 +20,6 @@ Deprecation Notices
do not need to care about the kind of devices that are being used, making it
easier to add new buses later.
-* ABI changes are planned for struct rte_pci_id, i.e., add new field ``class``.
- This new added ``class`` field can be used to probe pci device by class
- related info. This change should impact size of struct rte_pci_id and struct
- rte_pci_device. The release 16.04 does not contain these ABI changes, but
- release 16.07 will.
-
* The xstats API and rte_eth_xstats struct will be changed to allow retrieval
of values without any string copies or parsing.
No backwards compatibility is planned, as it would require code duplication
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 2d16d78..7fdd6f1 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -278,6 +278,11 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
/* get subsystem_device id */
dev->id.subsystem_device_id = conf->pc_subdevice;
+ /* get class id */
+ dev->id.class_id = (conf->pc_class << 16) |
+ (conf->pc_subclass << 8) |
+ (conf->pc_progif);
+
/* TODO: get max_vfs */
dev->max_vfs = 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 3cae4cb..6c3117d 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -162,6 +162,9 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
if (id_table->subsystem_device_id != dev->id.subsystem_device_id &&
id_table->subsystem_device_id != PCI_ANY_ID)
continue;
+ if (id_table->class_id != dev->id.class_id &&
+ id_table->class_id != RTE_CLASS_ANY_ID)
+ continue;
struct rte_pci_addr *loc = &dev->addr;
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 8fa2712..c30adaf 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -125,6 +125,7 @@ struct rte_pci_resource {
* table of these IDs for each device that it supports.
*/
struct rte_pci_id {
+ uint32_t class_id; /**< Class ID (class, subclass, pi) 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. */
@@ -170,6 +171,7 @@ struct rte_pci_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 */
@@ -177,14 +179,16 @@ struct rte_pci_device {
(vend), \
(dev), \
PCI_ANY_ID, \
- PCI_ANY_ID
+ PCI_ANY_ID, \
+ RTE_CLASS_ANY_ID
#else
/** Macro used to help building up tables of device IDs */
#define RTE_PCI_DEVICE(vend, dev) \
.vendor_id = (vend), \
.device_id = (dev), \
.subsystem_vendor_id = PCI_ANY_ID, \
- .subsystem_device_id = PCI_ANY_ID
+ .subsystem_device_id = PCI_ANY_ID, \
+ .class_id = RTE_CLASS_ANY_ID
#endif
struct rte_pci_driver;
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index bdc08a0..ff255b4 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -306,6 +306,15 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
}
dev->id.subsystem_device_id = (uint16_t)tmp;
+ /* get class_id */
+ snprintf(filename, sizeof(filename), "%s/class",
+ dirname);
+ if (eal_parse_sysfs_value(filename, &tmp) < 0) {
+ free(dev);
+ return -1;
+ }
+ dev->id.class_id = (uint32_t)tmp & RTE_CLASS_ANY_ID;
+
/* get max_vfs */
dev->max_vfs = 0;
snprintf(filename, sizeof(filename), "%s/max_vfs", dirname);
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v3] ci: Add the class_id support in pci probe
2016-05-19 12:25 ` [dpdk-dev] [PATCH v2] ci: " Ziye Yang
@ 2016-05-19 13:17 ` Ziye Yang
2016-05-24 9:29 ` Thomas Monjalon
2016-05-24 12:50 ` [dpdk-dev] [PATCH v4] Pci: Add the class_id support Ziye Yang
0 siblings, 2 replies; 23+ messages in thread
From: Ziye Yang @ 2016-05-19 13:17 UTC (permalink / raw)
To: dev
This patch is used to add the class_id (class_code,
subclass_code, programming_interface) support for
pci_device probe. With this patch, it will be
flexible for users to probe a class of devices
by class_id.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
---
doc/guides/rel_notes/deprecation.rst | 6 ------
lib/librte_eal/bsdapp/eal/eal_pci.c | 5 +++++
lib/librte_eal/common/eal_common_pci.c | 3 +++
lib/librte_eal/common/include/rte_pci.h | 8 ++++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 10 ++++++++++
5 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 7d94ba5..28f9c61 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -20,12 +20,6 @@ Deprecation Notices
do not need to care about the kind of devices that are being used, making it
easier to add new buses later.
-* ABI changes are planned for struct rte_pci_id, i.e., add new field ``class``.
- This new added ``class`` field can be used to probe pci device by class
- related info. This change should impact size of struct rte_pci_id and struct
- rte_pci_device. The release 16.04 does not contain these ABI changes, but
- release 16.07 will.
-
* The xstats API and rte_eth_xstats struct will be changed to allow retrieval
of values without any string copies or parsing.
No backwards compatibility is planned, as it would require code duplication
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 2d16d78..7fdd6f1 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -278,6 +278,11 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
/* get subsystem_device id */
dev->id.subsystem_device_id = conf->pc_subdevice;
+ /* get class id */
+ dev->id.class_id = (conf->pc_class << 16) |
+ (conf->pc_subclass << 8) |
+ (conf->pc_progif);
+
/* TODO: get max_vfs */
dev->max_vfs = 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 3cae4cb..6c3117d 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -162,6 +162,9 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
if (id_table->subsystem_device_id != dev->id.subsystem_device_id &&
id_table->subsystem_device_id != PCI_ANY_ID)
continue;
+ if (id_table->class_id != dev->id.class_id &&
+ id_table->class_id != RTE_CLASS_ANY_ID)
+ continue;
struct rte_pci_addr *loc = &dev->addr;
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 8fa2712..c30adaf 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -125,6 +125,7 @@ struct rte_pci_resource {
* table of these IDs for each device that it supports.
*/
struct rte_pci_id {
+ uint32_t class_id; /**< Class ID (class, subclass, pi) 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. */
@@ -170,6 +171,7 @@ struct rte_pci_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 */
@@ -177,14 +179,16 @@ struct rte_pci_device {
(vend), \
(dev), \
PCI_ANY_ID, \
- PCI_ANY_ID
+ PCI_ANY_ID, \
+ RTE_CLASS_ANY_ID
#else
/** Macro used to help building up tables of device IDs */
#define RTE_PCI_DEVICE(vend, dev) \
.vendor_id = (vend), \
.device_id = (dev), \
.subsystem_vendor_id = PCI_ANY_ID, \
- .subsystem_device_id = PCI_ANY_ID
+ .subsystem_device_id = PCI_ANY_ID, \
+ .class_id = RTE_CLASS_ANY_ID
#endif
struct rte_pci_driver;
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index bdc08a0..e6f0f13 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -306,6 +306,16 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
}
dev->id.subsystem_device_id = (uint16_t)tmp;
+ /* get class_id */
+ snprintf(filename, sizeof(filename), "%s/class",
+ dirname);
+ if (eal_parse_sysfs_value(filename, &tmp) < 0) {
+ free(dev);
+ return -1;
+ }
+ /* the least 24 bits are valid: class, subclass, program interface */
+ dev->id.class_id = (uint32_t)tmp & RTE_CLASS_ANY_ID;
+
/* get max_vfs */
dev->max_vfs = 0;
snprintf(filename, sizeof(filename), "%s/max_vfs", dirname);
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH v3] ci: Add the class_id support in pci probe
2016-05-19 13:17 ` [dpdk-dev] [PATCH v3] " Ziye Yang
@ 2016-05-24 9:29 ` Thomas Monjalon
2016-05-24 12:50 ` [dpdk-dev] [PATCH v4] Pci: Add the class_id support Ziye Yang
1 sibling, 0 replies; 23+ messages in thread
From: Thomas Monjalon @ 2016-05-24 9:29 UTC (permalink / raw)
To: Ziye Yang; +Cc: dev
Hi Ziye,
Please check the title.
It could be "pci: add class id".
Please try to add a changelog below the 3 dashes when making a new revision.
Other comments below:
2016-05-19 21:17, Ziye Yang:
> --- a/lib/librte_eal/common/include/rte_pci.h
> +++ b/lib/librte_eal/common/include/rte_pci.h
> @@ -125,6 +125,7 @@ struct rte_pci_resource {
> * table of these IDs for each device that it supports.
> */
> struct rte_pci_id {
> + uint32_t class_id; /**< Class ID (class, subclass, pi) 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. */
You moved class_id at the beginning (which looks good)...
> @@ -177,14 +179,16 @@ struct rte_pci_device {
> (vend), \
> (dev), \
> PCI_ANY_ID, \
> - PCI_ANY_ID
> + PCI_ANY_ID, \
> + RTE_CLASS_ANY_ID
> #else
> /** Macro used to help building up tables of device IDs */
> #define RTE_PCI_DEVICE(vend, dev) \
> .vendor_id = (vend), \
> .device_id = (dev), \
> .subsystem_vendor_id = PCI_ANY_ID, \
> - .subsystem_device_id = PCI_ANY_ID
> + .subsystem_device_id = PCI_ANY_ID, \
> + .class_id = RTE_CLASS_ANY_ID
> #endif
... but forgot to move these lines.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH v4] Pci: Add the class_id support
2016-05-19 13:17 ` [dpdk-dev] [PATCH v3] " Ziye Yang
2016-05-24 9:29 ` Thomas Monjalon
@ 2016-05-24 12:50 ` Ziye Yang
2016-06-14 14:52 ` Thomas Monjalon
1 sibling, 1 reply; 23+ messages in thread
From: Ziye Yang @ 2016-05-24 12:50 UTC (permalink / raw)
To: dev
This patch is used to add the class_id (class_code,
subclass_code, programming_interface) support for
pci_device probe. With this patch, it will be
flexible for users to probe a class of devices
by class_id.
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
---
Changes in v4: adjust title name and change RTE_PCI_DEVICE macro
doc/guides/rel_notes/deprecation.rst | 6 ------
lib/librte_eal/bsdapp/eal/eal_pci.c | 5 +++++
lib/librte_eal/common/eal_common_pci.c | 3 +++
lib/librte_eal/common/include/rte_pci.h | 4 ++++
lib/librte_eal/linuxapp/eal/eal_pci.c | 10 ++++++++++
5 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index ad05eba..a300508 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -20,12 +20,6 @@ Deprecation Notices
do not need to care about the kind of devices that are being used, making it
easier to add new buses later.
-* ABI changes are planned for struct rte_pci_id, i.e., add new field ``class``.
- This new added ``class`` field can be used to probe pci device by class
- related info. This change should impact size of struct rte_pci_id and struct
- rte_pci_device. The release 16.04 does not contain these ABI changes, but
- release 16.07 will.
-
* The xstats API and rte_eth_xstats struct will be changed to allow retrieval
of values without any string copies or parsing.
No backwards compatibility is planned, as it would require code duplication
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 2d16d78..7fdd6f1 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -278,6 +278,11 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
/* get subsystem_device id */
dev->id.subsystem_device_id = conf->pc_subdevice;
+ /* get class id */
+ dev->id.class_id = (conf->pc_class << 16) |
+ (conf->pc_subclass << 8) |
+ (conf->pc_progif);
+
/* TODO: get max_vfs */
dev->max_vfs = 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 3cae4cb..6c3117d 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -162,6 +162,9 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
if (id_table->subsystem_device_id != dev->id.subsystem_device_id &&
id_table->subsystem_device_id != PCI_ANY_ID)
continue;
+ if (id_table->class_id != dev->id.class_id &&
+ id_table->class_id != RTE_CLASS_ANY_ID)
+ continue;
struct rte_pci_addr *loc = &dev->addr;
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 8fa2712..debc9ca 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -125,6 +125,7 @@ struct rte_pci_resource {
* table of these IDs for each device that it supports.
*/
struct rte_pci_id {
+ uint32_t class_id; /**< Class ID (class, subclass, pi) 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. */
@@ -170,10 +171,12 @@ struct rte_pci_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, \
@@ -181,6 +184,7 @@ struct rte_pci_device {
#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, \
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index bdc08a0..e6f0f13 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -306,6 +306,16 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
}
dev->id.subsystem_device_id = (uint16_t)tmp;
+ /* get class_id */
+ snprintf(filename, sizeof(filename), "%s/class",
+ dirname);
+ if (eal_parse_sysfs_value(filename, &tmp) < 0) {
+ free(dev);
+ return -1;
+ }
+ /* the least 24 bits are valid: class, subclass, program interface */
+ dev->id.class_id = (uint32_t)tmp & RTE_CLASS_ANY_ID;
+
/* get max_vfs */
dev->max_vfs = 0;
snprintf(filename, sizeof(filename), "%s/max_vfs", dirname);
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH v4] Pci: Add the class_id support
2016-05-24 12:50 ` [dpdk-dev] [PATCH v4] Pci: Add the class_id support Ziye Yang
@ 2016-06-14 14:52 ` Thomas Monjalon
2016-07-06 11:08 ` Ferruh Yigit
0 siblings, 1 reply; 23+ messages in thread
From: Thomas Monjalon @ 2016-06-14 14:52 UTC (permalink / raw)
To: Ziye Yang; +Cc: dev
2016-05-24 20:50, Ziye Yang:
> This patch is used to add the class_id (class_code,
> subclass_code, programming_interface) support for
> pci_device probe. With this patch, it will be
> flexible for users to probe a class of devices
> by class_id.
>
>
> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH v4] Pci: Add the class_id support
2016-06-14 14:52 ` Thomas Monjalon
@ 2016-07-06 11:08 ` Ferruh Yigit
2016-07-07 7:46 ` Thomas Monjalon
0 siblings, 1 reply; 23+ messages in thread
From: Ferruh Yigit @ 2016-07-06 11:08 UTC (permalink / raw)
To: Thomas Monjalon, Ziye Yang; +Cc: dev
On 6/14/2016 3:52 PM, Thomas Monjalon wrote:
> 2016-05-24 20:50, Ziye Yang:
>> This patch is used to add the class_id (class_code,
>> subclass_code, programming_interface) support for
>> pci_device probe. With this patch, it will be
>> flexible for users to probe a class of devices
>> by class_id.
>>
>>
>> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
>
> Applied, thanks
>
Hi Thomas, Ziye,
Is modification in public "struct rte_pci_id" is a ABI break?
If so, it requires eal LIBABIVER increase and release notes update.
Regards,
ferruh
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH v4] Pci: Add the class_id support
2016-07-06 11:08 ` Ferruh Yigit
@ 2016-07-07 7:46 ` Thomas Monjalon
0 siblings, 0 replies; 23+ messages in thread
From: Thomas Monjalon @ 2016-07-07 7:46 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Ziye Yang, dev
2016-07-06 12:08, Ferruh Yigit:
> On 6/14/2016 3:52 PM, Thomas Monjalon wrote:
> > 2016-05-24 20:50, Ziye Yang:
> >> This patch is used to add the class_id (class_code,
> >> subclass_code, programming_interface) support for
> >> pci_device probe. With this patch, it will be
> >> flexible for users to probe a class of devices
> >> by class_id.
> >>
> >>
> >> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
> >
> > Applied, thanks
> >
> Hi Thomas, Ziye,
>
> Is modification in public "struct rte_pci_id" is a ABI break?
> If so, it requires eal LIBABIVER increase and release notes update.
Not really sure. I was thinking that it is used only by drivers
but not by applications.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
@ 2015-12-29 2:53 Ziye Yang
2015-12-31 17:12 ` Stephen Hemminger
0 siblings, 1 reply; 23+ messages in thread
From: Ziye Yang @ 2015-12-29 2:53 UTC (permalink / raw)
To: dev
This patch is used to add the class_id support
for pci_probe since some devices need the class_info
(class_code, subclass_code, programming_interface)
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
---
lib/librte_eal/bsdapp/eal/eal_pci.c | 4 ++++
lib/librte_eal/common/eal_common_pci.c | 3 +++
lib/librte_eal/common/include/rte_pci.h | 8 ++++++--
lib/librte_eal/linuxapp/eal/eal_pci.c | 9 +++++++++
4 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 6c21fbd..3b12ee6 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -273,6 +273,10 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
/* get subsystem_device id */
dev->id.subsystem_device_id = conf->pc_subdevice;
+ dev->id.class_id = (conf->pc_class << 16) |
+ (conf->pc_subclass << 8) |
+ (conf->pc_progif);
+
/* TODO: get max_vfs */
dev->max_vfs = 0;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index dcfe947..6832821 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -162,6 +162,9 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
if (id_table->subsystem_device_id != dev->id.subsystem_device_id &&
id_table->subsystem_device_id != PCI_ANY_ID)
continue;
+ if (id_table->class_id != dev->id.class_id &&
+ id_table->class_id != CLASS_ANY_ID)
+ continue;
struct rte_pci_addr *loc = &dev->addr;
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 334c12e..a538fbe 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -129,6 +129,7 @@ struct rte_pci_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. */
+ uint32_t class_id; /**< Class ID (class, subclass, pi) or CLASS_ANY_ID. */
};
/**
@@ -170,6 +171,7 @@ struct rte_pci_device {
/** Any PCI device identifier (vendor, device, ...) */
#define PCI_ANY_ID (0xffff)
+#define CLASS_ANY_ID (0xffffff)
#ifdef __cplusplus
/** C++ macro used to help building up tables of device IDs */
@@ -177,14 +179,16 @@ struct rte_pci_device {
(vend), \
(dev), \
PCI_ANY_ID, \
- PCI_ANY_ID
+ PCI_ANY_ID, \
+ CLASS_ANY_ID
#else
/** Macro used to help building up tables of device IDs */
#define RTE_PCI_DEVICE(vend, dev) \
.vendor_id = (vend), \
.device_id = (dev), \
.subsystem_vendor_id = PCI_ANY_ID, \
- .subsystem_device_id = PCI_ANY_ID
+ .subsystem_device_id = PCI_ANY_ID, \
+ .class_id = CLASS_ANY_ID
#endif
struct rte_pci_driver;
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index bc5b5be..d9bfc0c 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -306,6 +306,15 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
}
dev->id.subsystem_device_id = (uint16_t)tmp;
+ /* get class_id */
+ snprintf(filename, sizeof(filename), "%s/class",
+ dirname);
+ if (eal_parse_sysfs_value(filename, &tmp) < 0) {
+ free(dev);
+ return -1;
+ }
+ dev->id.class_id = (uint32_t)tmp && CLASS_ANY_ID;
+
/* get max_vfs */
dev->max_vfs = 0;
snprintf(filename, sizeof(filename), "%s/max_vfs", dirname);
--
1.9.3
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2015-12-29 2:53 [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe Ziye Yang
@ 2015-12-31 17:12 ` Stephen Hemminger
2016-01-13 11:55 ` Bruce Richardson
0 siblings, 1 reply; 23+ messages in thread
From: Stephen Hemminger @ 2015-12-31 17:12 UTC (permalink / raw)
To: Ziye Yang; +Cc: dev
On Tue, 29 Dec 2015 10:53:26 +0800
Ziye Yang <ziye.yang@intel.com> wrote:
> This patch is used to add the class_id support
> for pci_probe since some devices need the class_info
> (class_code, subclass_code, programming_interface)
>
> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Since rte_pci is exposed to application this breaks the ABI.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2015-12-31 17:12 ` Stephen Hemminger
@ 2016-01-13 11:55 ` Bruce Richardson
2016-01-13 12:22 ` Panu Matilainen
0 siblings, 1 reply; 23+ messages in thread
From: Bruce Richardson @ 2016-01-13 11:55 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Ziye Yang, dev
On Thu, Dec 31, 2015 at 09:12:14AM -0800, Stephen Hemminger wrote:
> On Tue, 29 Dec 2015 10:53:26 +0800
> Ziye Yang <ziye.yang@intel.com> wrote:
>
> > This patch is used to add the class_id support
> > for pci_probe since some devices need the class_info
> > (class_code, subclass_code, programming_interface)
> >
> > Signed-off-by: Ziye Yang <ziye.yang@intel.com>
>
> Since rte_pci is exposed to application this breaks the ABI.
But applications are not going to be defining rte_pci_ids values internally, are
they? That is for drivers to use. Is this really an ABI breakage for applications that we
need to be concerned about?
/Bruce
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-01-13 11:55 ` Bruce Richardson
@ 2016-01-13 12:22 ` Panu Matilainen
2016-01-28 21:38 ` Thomas Monjalon
0 siblings, 1 reply; 23+ messages in thread
From: Panu Matilainen @ 2016-01-13 12:22 UTC (permalink / raw)
To: Bruce Richardson, Stephen Hemminger; +Cc: Ziye Yang, dev
On 01/13/2016 01:55 PM, Bruce Richardson wrote:
> On Thu, Dec 31, 2015 at 09:12:14AM -0800, Stephen Hemminger wrote:
>> On Tue, 29 Dec 2015 10:53:26 +0800
>> Ziye Yang <ziye.yang@intel.com> wrote:
>>
>>> This patch is used to add the class_id support
>>> for pci_probe since some devices need the class_info
>>> (class_code, subclass_code, programming_interface)
>>>
>>> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
>>
>> Since rte_pci is exposed to application this breaks the ABI.
>
> But applications are not going to be defining rte_pci_ids values internally, are
> they? That is for drivers to use. Is this really an ABI breakage for applications that we
> need to be concerned about?
There might not be applications using it but drivers are ABI consumers
too - think of 3rd party drivers and such.
- Panu -
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-01-13 12:22 ` Panu Matilainen
@ 2016-01-28 21:38 ` Thomas Monjalon
2016-01-29 9:21 ` Panu Matilainen
0 siblings, 1 reply; 23+ messages in thread
From: Thomas Monjalon @ 2016-01-28 21:38 UTC (permalink / raw)
To: Panu Matilainen, Stephen Hemminger; +Cc: dev, Ziye Yang
2016-01-13 14:22, Panu Matilainen:
> On 01/13/2016 01:55 PM, Bruce Richardson wrote:
> > On Thu, Dec 31, 2015 at 09:12:14AM -0800, Stephen Hemminger wrote:
> >> On Tue, 29 Dec 2015 10:53:26 +0800
> >> Ziye Yang <ziye.yang@intel.com> wrote:
> >>
> >>> This patch is used to add the class_id support
> >>> for pci_probe since some devices need the class_info
> >>> (class_code, subclass_code, programming_interface)
> >>>
> >>> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
> >>
> >> Since rte_pci is exposed to application this breaks the ABI.
> >
> > But applications are not going to be defining rte_pci_ids values internally, are
> > they? That is for drivers to use. Is this really an ABI breakage for applications that we
> > need to be concerned about?
>
> There might not be applications using it but drivers are ABI consumers
> too - think of 3rd party drivers and such.
Drivers are not ABI consumers in the sense that ABI means
Application Binary Interface.
We are talking about drivers interface here.
When establishing the ABI policy we were discussing about applications only.
I agree we must allow 3rd party drivers but there is no good reason
to try to upgrade DPDK without upgrading/porting the external drivers.
If someone does not want to release its driver and keep upgrading DPDK,
it is acceptable IMHO to force an upgrade of its driver.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-01-28 21:38 ` Thomas Monjalon
@ 2016-01-29 9:21 ` Panu Matilainen
2016-01-29 9:34 ` Thomas Monjalon
0 siblings, 1 reply; 23+ messages in thread
From: Panu Matilainen @ 2016-01-29 9:21 UTC (permalink / raw)
To: Thomas Monjalon, Stephen Hemminger; +Cc: dev, Ziye Yang
On 01/28/2016 11:38 PM, Thomas Monjalon wrote:
> 2016-01-13 14:22, Panu Matilainen:
>> On 01/13/2016 01:55 PM, Bruce Richardson wrote:
>>> On Thu, Dec 31, 2015 at 09:12:14AM -0800, Stephen Hemminger wrote:
>>>> On Tue, 29 Dec 2015 10:53:26 +0800
>>>> Ziye Yang <ziye.yang@intel.com> wrote:
>>>>
>>>>> This patch is used to add the class_id support
>>>>> for pci_probe since some devices need the class_info
>>>>> (class_code, subclass_code, programming_interface)
>>>>>
>>>>> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
>>>>
>>>> Since rte_pci is exposed to application this breaks the ABI.
>>>
>>> But applications are not going to be defining rte_pci_ids values internally, are
>>> they? That is for drivers to use. Is this really an ABI breakage for applications that we
>>> need to be concerned about?
>>
>> There might not be applications using it but drivers are ABI consumers
>> too - think of 3rd party drivers and such.
>
> Drivers are not ABI consumers in the sense that ABI means
> Application Binary Interface.
> We are talking about drivers interface here.
> When establishing the ABI policy we were discussing about applications only.
Generally speaking an ABI is an interface between two program (or
software if you like) modules, its not specific to "applications".
Looking at http://dpdk.org/doc/guides/contributing/versioning.html I see
it does only talk about applications, but an ABI consumer can also be
another library. A driver calling rte_malloc() is just as much
librte_eal ABI consumer as anything else.
Now, I understand that drivers use and need interface(s) that
applications have no use for or simply cannot use, and those interfaces
could be subject to different policies. As an extreme example, the Linux
kernel has two isolated ABIs, one is the userland system call interface
which is guaranteed to stay forever and the other is kernel module
interface, guarantees nothing at all.
In DPDK the difference is far muddier than that since all the interfaces
live in common, versioned userland DSOs. So if there are two different
interfaces following two different policies, it's all the more important
to clearly document them. One simple way could be using a different
prefix than rte_.
> I agree we must allow 3rd party drivers but there is no good reason
> to try to upgrade DPDK without upgrading/porting the external drivers.
> If someone does not want to release its driver and keep upgrading DPDK,
> it is acceptable IMHO to force an upgrade of its driver.
Note that I've no particular sympathy for 3rd party drivers as such.
What I *do* care about is that breakage is made explicit, as in drivers
built for an incompatible version refuse to load at all, instead of
silently corrupting memory etc.
- Panu -
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-01-29 9:21 ` Panu Matilainen
@ 2016-01-29 9:34 ` Thomas Monjalon
2016-01-29 10:10 ` Panu Matilainen
0 siblings, 1 reply; 23+ messages in thread
From: Thomas Monjalon @ 2016-01-29 9:34 UTC (permalink / raw)
To: Panu Matilainen; +Cc: dev, Ziye Yang
2016-01-29 11:21, Panu Matilainen:
> On 01/28/2016 11:38 PM, Thomas Monjalon wrote:
> > 2016-01-13 14:22, Panu Matilainen:
> >> On 01/13/2016 01:55 PM, Bruce Richardson wrote:
> >>> On Thu, Dec 31, 2015 at 09:12:14AM -0800, Stephen Hemminger wrote:
> >>>> On Tue, 29 Dec 2015 10:53:26 +0800
> >>>> Ziye Yang <ziye.yang@intel.com> wrote:
> >>>>
> >>>>> This patch is used to add the class_id support
> >>>>> for pci_probe since some devices need the class_info
> >>>>> (class_code, subclass_code, programming_interface)
> >>>>>
> >>>>> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
> >>>>
> >>>> Since rte_pci is exposed to application this breaks the ABI.
> >>>
> >>> But applications are not going to be defining rte_pci_ids values internally, are
> >>> they? That is for drivers to use. Is this really an ABI breakage for applications that we
> >>> need to be concerned about?
> >>
> >> There might not be applications using it but drivers are ABI consumers
> >> too - think of 3rd party drivers and such.
> >
> > Drivers are not ABI consumers in the sense that ABI means
> > Application Binary Interface.
> > We are talking about drivers interface here.
> > When establishing the ABI policy we were discussing about applications only.
>
> Generally speaking an ABI is an interface between two program (or
> software if you like) modules, its not specific to "applications".
> Looking at http://dpdk.org/doc/guides/contributing/versioning.html I see
> it does only talk about applications, but an ABI consumer can also be
> another library. A driver calling rte_malloc() is just as much
> librte_eal ABI consumer as anything else.
>
> Now, I understand that drivers use and need interface(s) that
> applications have no use for or simply cannot use, and those interfaces
> could be subject to different policies. As an extreme example, the Linux
> kernel has two isolated ABIs, one is the userland system call interface
> which is guaranteed to stay forever and the other is kernel module
> interface, guarantees nothing at all.
>
> In DPDK the difference is far muddier than that since all the interfaces
> live in common, versioned userland DSOs. So if there are two different
> interfaces following two different policies, it's all the more important
> to clearly document them. One simple way could be using a different
> prefix than rte_.
Good suggestion. Or we can simply have different files with a clear notice
in their headers and in the versioning doc.
It was well split in rte_cryptodev_pmd.h
> > I agree we must allow 3rd party drivers but there is no good reason
> > to try to upgrade DPDK without upgrading/porting the external drivers.
> > If someone does not want to release its driver and keep upgrading DPDK,
> > it is acceptable IMHO to force an upgrade of its driver.
>
> Note that I've no particular sympathy for 3rd party drivers as such.
> What I *do* care about is that breakage is made explicit, as in drivers
> built for an incompatible version refuse to load at all, instead of
> silently corrupting memory etc.
OK I agree.
Anyway the ABI versionning does not cover the structure changes.
What about making a DPDK version check when registering a driver?
So a binary driver would be clearly bound to a DPDK version.
And we should change or remove the .so version which never change for
most of drivers.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-01-29 9:34 ` Thomas Monjalon
@ 2016-01-29 10:10 ` Panu Matilainen
2016-01-29 12:47 ` Panu Matilainen
0 siblings, 1 reply; 23+ messages in thread
From: Panu Matilainen @ 2016-01-29 10:10 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, Ziye Yang
On 01/29/2016 11:34 AM, Thomas Monjalon wrote:
> 2016-01-29 11:21, Panu Matilainen:
>> On 01/28/2016 11:38 PM, Thomas Monjalon wrote:
>>> 2016-01-13 14:22, Panu Matilainen:
>>>> On 01/13/2016 01:55 PM, Bruce Richardson wrote:
>>>>> On Thu, Dec 31, 2015 at 09:12:14AM -0800, Stephen Hemminger wrote:
>>>>>> On Tue, 29 Dec 2015 10:53:26 +0800
>>>>>> Ziye Yang <ziye.yang@intel.com> wrote:
>>>>>>
>>>>>>> This patch is used to add the class_id support
>>>>>>> for pci_probe since some devices need the class_info
>>>>>>> (class_code, subclass_code, programming_interface)
>>>>>>>
>>>>>>> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
>>>>>>
>>>>>> Since rte_pci is exposed to application this breaks the ABI.
>>>>>
>>>>> But applications are not going to be defining rte_pci_ids values internally, are
>>>>> they? That is for drivers to use. Is this really an ABI breakage for applications that we
>>>>> need to be concerned about?
>>>>
>>>> There might not be applications using it but drivers are ABI consumers
>>>> too - think of 3rd party drivers and such.
>>>
>>> Drivers are not ABI consumers in the sense that ABI means
>>> Application Binary Interface.
>>> We are talking about drivers interface here.
>>> When establishing the ABI policy we were discussing about applications only.
>>
>> Generally speaking an ABI is an interface between two program (or
>> software if you like) modules, its not specific to "applications".
>> Looking at http://dpdk.org/doc/guides/contributing/versioning.html I see
>> it does only talk about applications, but an ABI consumer can also be
>> another library. A driver calling rte_malloc() is just as much
>> librte_eal ABI consumer as anything else.
>>
>> Now, I understand that drivers use and need interface(s) that
>> applications have no use for or simply cannot use, and those interfaces
>> could be subject to different policies. As an extreme example, the Linux
>> kernel has two isolated ABIs, one is the userland system call interface
>> which is guaranteed to stay forever and the other is kernel module
>> interface, guarantees nothing at all.
>>
>> In DPDK the difference is far muddier than that since all the interfaces
>> live in common, versioned userland DSOs. So if there are two different
>> interfaces following two different policies, it's all the more important
>> to clearly document them. One simple way could be using a different
>> prefix than rte_.
>
> Good suggestion. Or we can simply have different files with a clear notice
> in their headers and in the versioning doc.
> It was well split in rte_cryptodev_pmd.h
Using separate headers is also good. Optimally both? :)
>>> I agree we must allow 3rd party drivers but there is no good reason
>>> to try to upgrade DPDK without upgrading/porting the external drivers.
>>> If someone does not want to release its driver and keep upgrading DPDK,
>>> it is acceptable IMHO to force an upgrade of its driver.
>>
>> Note that I've no particular sympathy for 3rd party drivers as such.
>> What I *do* care about is that breakage is made explicit, as in drivers
>> built for an incompatible version refuse to load at all, instead of
>> silently corrupting memory etc.
>
> OK I agree.
Cool, the rest is just details then.
> Anyway the ABI versionning does not cover the structure changes.
> What about making a DPDK version check when registering a driver?
> So a binary driver would be clearly bound to a DPDK version.
That's one possibility. Another way to achieve essentially the same is
to make rte_eal_driver_register() symbol version follow the DPDK
version, in which case a driver built for another version will fail at
dlopen() already.
> And we should change or remove the .so version which never change for
> most of drivers.
Yup, so-versioning DSOs which do not offer any ABI is kinda pointless.
- Panu -
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe
2016-01-29 10:10 ` Panu Matilainen
@ 2016-01-29 12:47 ` Panu Matilainen
0 siblings, 0 replies; 23+ messages in thread
From: Panu Matilainen @ 2016-01-29 12:47 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, Ziye Yang
On 01/29/2016 12:10 PM, Panu Matilainen wrote:
> On 01/29/2016 11:34 AM, Thomas Monjalon wrote:
>> 2016-01-29 11:21, Panu Matilainen:
>>> On 01/28/2016 11:38 PM, Thomas Monjalon wrote:
>>>> 2016-01-13 14:22, Panu Matilainen:
>>>>> On 01/13/2016 01:55 PM, Bruce Richardson wrote:
>>>>>> On Thu, Dec 31, 2015 at 09:12:14AM -0800, Stephen Hemminger wrote:
>>>>>>> On Tue, 29 Dec 2015 10:53:26 +0800
>>>>>>> Ziye Yang <ziye.yang@intel.com> wrote:
>>>>>>>
>>>>>>>> This patch is used to add the class_id support
>>>>>>>> for pci_probe since some devices need the class_info
>>>>>>>> (class_code, subclass_code, programming_interface)
>>>>>>>>
>>>>>>>> Signed-off-by: Ziye Yang <ziye.yang@intel.com>
>>>>>>>
>>>>>>> Since rte_pci is exposed to application this breaks the ABI.
>>>>>>
>>>>>> But applications are not going to be defining rte_pci_ids values
>>>>>> internally, are
>>>>>> they? That is for drivers to use. Is this really an ABI breakage
>>>>>> for applications that we
>>>>>> need to be concerned about?
>>>>>
>>>>> There might not be applications using it but drivers are ABI consumers
>>>>> too - think of 3rd party drivers and such.
>>>>
>>>> Drivers are not ABI consumers in the sense that ABI means
>>>> Application Binary Interface.
>>>> We are talking about drivers interface here.
>>>> When establishing the ABI policy we were discussing about
>>>> applications only.
>>>
>>> Generally speaking an ABI is an interface between two program (or
>>> software if you like) modules, its not specific to "applications".
>>> Looking at http://dpdk.org/doc/guides/contributing/versioning.html I see
>>> it does only talk about applications, but an ABI consumer can also be
>>> another library. A driver calling rte_malloc() is just as much
>>> librte_eal ABI consumer as anything else.
>>>
>>> Now, I understand that drivers use and need interface(s) that
>>> applications have no use for or simply cannot use, and those interfaces
>>> could be subject to different policies. As an extreme example, the Linux
>>> kernel has two isolated ABIs, one is the userland system call interface
>>> which is guaranteed to stay forever and the other is kernel module
>>> interface, guarantees nothing at all.
>>>
>>> In DPDK the difference is far muddier than that since all the interfaces
>>> live in common, versioned userland DSOs. So if there are two different
>>> interfaces following two different policies, it's all the more important
>>> to clearly document them. One simple way could be using a different
>>> prefix than rte_.
>>
>> Good suggestion. Or we can simply have different files with a clear
>> notice
>> in their headers and in the versioning doc.
>> It was well split in rte_cryptodev_pmd.h
>
> Using separate headers is also good. Optimally both? :)
>
>>>> I agree we must allow 3rd party drivers but there is no good reason
>>>> to try to upgrade DPDK without upgrading/porting the external drivers.
>>>> If someone does not want to release its driver and keep upgrading DPDK,
>>>> it is acceptable IMHO to force an upgrade of its driver.
>>>
>>> Note that I've no particular sympathy for 3rd party drivers as such.
>>> What I *do* care about is that breakage is made explicit, as in drivers
>>> built for an incompatible version refuse to load at all, instead of
>>> silently corrupting memory etc.
>>
>> OK I agree.
>
> Cool, the rest is just details then.
>
>> Anyway the ABI versionning does not cover the structure changes.
>> What about making a DPDK version check when registering a driver?
>> So a binary driver would be clearly bound to a DPDK version.
>
> That's one possibility. Another way to achieve essentially the same is
> to make rte_eal_driver_register() symbol version follow the DPDK
> version, in which case a driver built for another version will fail at
> dlopen() already.
Thinking about this a bit more, symbol versioning doesn't cut it because
its not always used (static linkakage) and I guess we should cover that too.
Another similar possibility that blocks it at dlopen() level is to munge
the actual function name to carry a version, so it becomes something
like rte_eal_driver_register_v230() and later _v240() etc. AFAICS its
only ever invoked via PMD_REGISTER_DRIVER() so the calling details can
conveniently be hidden there.
- Panu -
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2016-07-07 7:46 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-11 6:08 [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe Ziye Yang
2016-05-11 15:21 ` Stephen Hemminger
2016-05-11 15:34 ` Richardson, Bruce
2016-05-19 10:33 ` Thomas Monjalon
2016-05-19 12:18 ` Yang, Ziye
2016-05-19 12:57 ` Thomas Monjalon
2016-05-19 13:14 ` Yang, Ziye
2016-05-19 12:25 ` [dpdk-dev] [PATCH v2] ci: " Ziye Yang
2016-05-19 13:17 ` [dpdk-dev] [PATCH v3] " Ziye Yang
2016-05-24 9:29 ` Thomas Monjalon
2016-05-24 12:50 ` [dpdk-dev] [PATCH v4] Pci: Add the class_id support Ziye Yang
2016-06-14 14:52 ` Thomas Monjalon
2016-07-06 11:08 ` Ferruh Yigit
2016-07-07 7:46 ` Thomas Monjalon
-- strict thread matches above, loose matches on Subject: below --
2015-12-29 2:53 [dpdk-dev] [PATCH] pci: Add the class_id support in pci probe Ziye Yang
2015-12-31 17:12 ` Stephen Hemminger
2016-01-13 11:55 ` Bruce Richardson
2016-01-13 12:22 ` Panu Matilainen
2016-01-28 21:38 ` Thomas Monjalon
2016-01-29 9:21 ` Panu Matilainen
2016-01-29 9:34 ` Thomas Monjalon
2016-01-29 10:10 ` Panu Matilainen
2016-01-29 12:47 ` Panu Matilainen
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).