Move PCI away from the EAL
Subsystems (5)
PATCH v7 11/25 pci: avoid inlining functions
In reply to Gaetan RivetParsing operations should not happen in performance critical sections. Headers should not propose implementations unless duly required.
--- lib/librte_eal/common/eal_common_pci.c | 68 ++++++++++++++++++++++++++++++++ lib/librte_eal/common/include/rte_pci.h | 69 +++------------------------------ lib/librte_eal/rte_eal_version.map | 4 ++ 3 files changed, 78 insertions(+), 63 deletions(-)
lib/librte_eal/common/eal_common_pci.c +68 -0
@@ -87,6 +87,74 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)return NULL ; } +/* Macro used by pci addr parsing functions. **/ +#define GET_PCIADDR_FIELD (in, fd, lim, dlm) \ +do { \ + unsigned long val; \ + char *end; \ + errno = 0; \ + val = strtoul((in), &end, 16); \ + if (errno != 0 || end[0] != (dlm) || val > (lim)) \ + return -EINVAL; \ + (fd) = (typeof (fd))val; \ + (in) = end + 1; \ +} while(0) + + +int +eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr) +{ + dev_addr->domain =0 ; +GET_PCIADDR_FIELD (input, dev_addr->bus,UINT8_MAX ,':' ); +GET_PCIADDR_FIELD (input, dev_addr->devid,UINT8_MAX ,'.' ); +GET_PCIADDR_FIELD (input, dev_addr->function,UINT8_MAX ,0 ); +return 0 ; +} + +int +eal_parse_pci_DomBDF (const char *input,struct rte_pci_addr *dev_addr) +{ +GET_PCIADDR_FIELD (input, dev_addr->domain,UINT16_MAX ,':' ); +GET_PCIADDR_FIELD (input, dev_addr->bus,UINT8_MAX ,':' ); +GET_PCIADDR_FIELD (input, dev_addr->devid,UINT8_MAX ,'.' ); +GET_PCIADDR_FIELD (input, dev_addr->function,UINT8_MAX ,0 ); +return 0 ; +} + +#undef GET_PCIADDR_FIELD + +void +rte_pci_device_name (const struct rte_pci_addr *addr, +char *output,size_t size) +{ +RTE_VERIFY (size >=PCI_PRI_STR_SIZE ); +RTE_VERIFY (snprintf (output, size,PCI_PRI_FMT , + addr->domain, addr->bus, + addr->devid, addr->function) >=0 ); +} + +int +rte_eal_compare_pci_addr (const struct rte_pci_addr *addr, +const struct rte_pci_addr *addr2) +{ +uint64_t dev_addr, dev_addr2; + +if ((addr ==NULL ) || (addr2 ==NULL )) +return -1 ; + + dev_addr = ((uint64_t )addr->domain <<24 ) | + (addr->bus <<16 ) | (addr->devid <<8 ) | addr->function; + dev_addr2 = ((uint64_t )addr2->domain <<24 ) | + (addr2->bus <<16 ) | (addr2->devid <<8 ) | addr2->function; + +if (dev_addr > dev_addr2) +return 1 ; +else if (dev_addr < dev_addr2) +return -1 ; +else +return 0 ; +} +void pci_name_set (struct rte_pci_device *dev) {
lib/librte_eal/common/include/rte_pci.h +6 -63
100 lines not on this page · raw message
lib/librte_eal/rte_eal_version.map +4 -0
@@ -241,8 +241,11 @@ EXPERIMENTAL { DPDK_17.11 { global: + eal_parse_pci_BDF; + eal_parse_pci_DomBDF; rte_eal_create_uio_dev; rte_bus_get_iommu_class; + rte_eal_compare_pci_addr; rte_eal_has_pci; rte_eal_iova_mode; rte_eal_mbuf_default_mempool_ops;
@@ -250,6 +253,7 @@ DPDK_17.11 { rte_eal_vfio_intr_mode; rte_lcore_has_role; rte_memcpy_ptr; + rte_pci_device_name; rte_pci_get_iommu_class; rte_pci_match; vfio_enable;
Signature · 1 line
2.1.4
PATCH v7 12/25 pci: avoid over-complicated macro
In reply to Gaetan RivetUsing a macro helps writing the code to the detriment of the reader in this case. This is backward. Write once, read many.
The few LOCs gained is not worth the opacity of the implementation.
--- lib/librte_eal/common/eal_common_pci.c | 67 +++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 21 deletions(-)
lib/librte_eal/common/eal_common_pci.c +46 -21
@@ -87,42 +87,67 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)return NULL ; } -/* Macro used by pci addr parsing functions. **/ -#define GET_PCIADDR_FIELD (in, fd, lim, dlm) \ -do { \ - unsigned long val; \ - char *end; \ - errno = 0; \ - val = strtoul((in), &end, 16); \ - if (errno != 0 || end[0] != (dlm) || val > (lim)) \ - return -EINVAL; \ - (fd) = (typeof (fd))val; \ - (in) = end + 1; \ -} while(0) +static inline const char * +get_u8_pciaddr_field (const char *in,void *_u8,char dlm) +{ +unsigned long val; +uint8_t *u8 = _u8; +char *end; + + errno =0 ; + val =strtoul (in, &end,16 ); +if (errno !=0 || end[0 ] != dlm || val >UINT8_MAX ) { + errno = errno ? errno :EINVAL ; +return NULL ; + } + *u8 = (uint8_t )val; +return end +1 ; +}int eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr) { +const char *in = input; + dev_addr->domain =0 ; -GET_PCIADDR_FIELD (input, dev_addr->bus,UINT8_MAX ,':' ); -GET_PCIADDR_FIELD (input, dev_addr->devid,UINT8_MAX ,'.' ); -GET_PCIADDR_FIELD (input, dev_addr->function,UINT8_MAX ,0 ); + in =get_u8_pciaddr_field (in, &dev_addr->bus,':' ); +if (in ==NULL ) +return -EINVAL ; + in =get_u8_pciaddr_field (in, &dev_addr->devid,'.' ); +if (in ==NULL ) +return -EINVAL ; + in =get_u8_pciaddr_field (in, &dev_addr->function,'\0' ); +if (in ==NULL ) +return -EINVAL ;return 0 ; }int eal_parse_pci_DomBDF (const char *input,struct rte_pci_addr *dev_addr) { -GET_PCIADDR_FIELD (input, dev_addr->domain,UINT16_MAX ,':' ); -GET_PCIADDR_FIELD (input, dev_addr->bus,UINT8_MAX ,':' ); -GET_PCIADDR_FIELD (input, dev_addr->devid,UINT8_MAX ,'.' ); -GET_PCIADDR_FIELD (input, dev_addr->function,UINT8_MAX ,0 ); +const char *in = input; +unsigned long val; +char *end; + + errno =0 ; + val =strtoul (in, &end,16 ); +if (errno !=0 || end[0 ] !=':' || val >UINT16_MAX ) +return -EINVAL ; + dev_addr->domain = (uint16_t )val; + in = end +1 ; + in =get_u8_pciaddr_field (in, &dev_addr->bus,':' ); +if (in ==NULL ) +return -EINVAL ; + in =get_u8_pciaddr_field (in, &dev_addr->devid,'.' ); +if (in ==NULL ) +return -EINVAL ; + in =get_u8_pciaddr_field (in, &dev_addr->function,'\0' ); +if (in ==NULL ) +return -EINVAL ;return 0 ; } -#undef GET_PCIADDR_FIELD -void rte_pci_device_name (const struct rte_pci_addr *addr,char *output,size_t size)
Signature · 1 line
2.1.4
PATCH v7 13/25 pci: deprecate misnamed functions
In reply to Gaetan RivetRename misnamed functions and describe the change in a deprecation notice.
--- doc/guides/rel_notes/deprecation.rst | 9 +++++++ lib/librte_eal/common/eal_common_pci.c | 27 ++++++++++++++++--- lib/librte_eal/common/include/rte_pci.h | 47 +++++++++++++++++++++++++++++++++ lib/librte_eal/rte_eal_version.map | 3 +++ 4 files changed, 82 insertions(+), 4 deletions(-)
doc/guides/rel_notes/deprecation.rst +9 -0
@@ -84,3 +84,12 @@ Deprecation Notices * librte_meter: The API will change to accommodate configuration profiles. Most of the API functions will have an additional opaque parameter. + +* pci: Several exposed functions are misnamed. + The following functions are deprecated starting from v17.11 and are replaced: + + - ``eal_parse_pci_BDF`` replaced by ``rte_pci_bdf_parse`` + - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_dbdf_parse`` + - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` + + The functions are only renamed. Their behavior is not affected.
lib/librte_eal/common/eal_common_pci.c +23 -4
@@ -106,7 +106,7 @@ get_u8_pciaddr_field(const char *in, void *_u8, char dlm)int -eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr) +rte_pci_bdf_parse (const char *input,struct rte_pci_addr *dev_addr) {const char *in = input;
@@ -124,7 +124,13 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr) }int -eal_parse_pci_DomBDF (const char *input,struct rte_pci_addr *dev_addr) +eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr) +{ +return rte_pci_bdf_parse (input, dev_addr); +} + +int +rte_pci_dbdf_parse (const char *input,struct rte_pci_addr *dev_addr) {const char *in = input;unsigned long val;
@@ -148,6 +154,12 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)return 0 ; } +int +eal_parse_pci_DomBDF (const char *input,struct rte_pci_addr *dev_addr) +{ +return rte_pci_dbdf_parse (input, dev_addr); +} +void rte_pci_device_name (const struct rte_pci_addr *addr,char *output,size_t size)
@@ -159,8 +171,8 @@ rte_pci_device_name(const struct rte_pci_addr *addr, }int -rte_eal_compare_pci_addr (const struct rte_pci_addr *addr, -const struct rte_pci_addr *addr2) +rte_pci_addr_cmp (const struct rte_pci_addr *addr, +const struct rte_pci_addr *addr2) {uint64_t dev_addr, dev_addr2;
@@ -180,6 +192,13 @@ rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,return 0 ; } +int +rte_eal_compare_pci_addr (const struct rte_pci_addr *addr, +const struct rte_pci_addr *addr2) +{ +return rte_pci_addr_cmp (addr, addr2); +} +void pci_name_set (struct rte_pci_device *dev) {
lib/librte_eal/common/include/rte_pci.h +47 -0
65 lines not on this page · raw message
lib/librte_eal/rte_eal_version.map +3 -0
@@ -253,6 +253,9 @@ DPDK_17.11 { rte_eal_vfio_intr_mode; rte_lcore_has_role; rte_memcpy_ptr; + rte_pci_addr_cmp; + rte_pci_bdf_parse; + rte_pci_dbdf_parse; rte_pci_device_name; rte_pci_get_iommu_class; rte_pci_match;
Signature · 1 line
2.1.4
PATCH v7 14/25 pci: introduce PCI address parsing function
In reply to Gaetan RivetA new single function that is able to parse all currently supported format:
* Domain-Bus-Device-Function
* Bus-Device-Function
--- lib/librte_eal/common/eal_common_pci.c | 9 +++++++++ lib/librte_eal/common/include/rte_pci.h | 14 ++++++++++++++ lib/librte_eal/rte_eal_version.map | 1 + 3 files changed, 24 insertions(+)
lib/librte_eal/common/eal_common_pci.c +9 -0
@@ -199,6 +199,15 @@ rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,return rte_pci_addr_cmp (addr, addr2); } +int +rte_pci_addr_parse (const char *str,struct rte_pci_addr *addr) +{ +if (rte_pci_bdf_parse (str, addr) ==0 || +rte_pci_dbdf_parse (str, addr) ==0 ) +return 0 ; +return -1 ; +} +void pci_name_set (struct rte_pci_device *dev) {
lib/librte_eal/common/include/rte_pci.h +14 -0
@@ -347,6 +347,20 @@ int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr, const struct rte_pci_addr *addr2);/** +* Utility function to parse a string into a PCI location. +* +* @param str +* The string to parse +* @param addr +* The reference to the structure where the location +* is stored. +* @return +* 0 on success +* <0 otherwise +*/ +int rte_pci_addr_parse (const char *str,struct rte_pci_addr *addr); + +/** * Scan the content of the PCI bus, and the devices in the devices * list *
lib/librte_eal/rte_eal_version.map +1 -0
@@ -254,6 +254,7 @@ DPDK_17.11 { rte_lcore_has_role; rte_memcpy_ptr; rte_pci_addr_cmp; + rte_pci_addr_parse; rte_pci_bdf_parse; rte_pci_dbdf_parse; rte_pci_device_name;
Signature · 1 line
2.1.4
PATCH v7 15/25 pci: make specialized parsing functions private
In reply to Gaetan RivetDo not expose the minute implementations of PCI parsing. This leaves only the all-purpose rte_pci_addr_parse, which is simpler to use.
--- doc/guides/rel_notes/deprecation.rst | 6 ++---- lib/librte_eal/common/eal_common_pci.c | 4 ++-- lib/librte_eal/common/include/rte_pci.h | 29 ----------------------------- lib/librte_eal/rte_eal_version.map | 2 -- 4 files changed, 4 insertions(+), 37 deletions(-)
doc/guides/rel_notes/deprecation.rst +2 -4
@@ -88,8 +88,6 @@ Deprecation Notices * pci: Several exposed functions are misnamed. The following functions are deprecated starting from v17.11 and are replaced: - - ``eal_parse_pci_BDF`` replaced by ``rte_pci_bdf_parse`` - - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_dbdf_parse`` + - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse`` + - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_addr_parse`` - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` - - The functions are only renamed. Their behavior is not affected.
lib/librte_eal/common/eal_common_pci.c +2 -2
@@ -105,7 +105,7 @@ get_u8_pciaddr_field(const char *in, void *_u8, char dlm) } -int +static int rte_pci_bdf_parse (const char *input,struct rte_pci_addr *dev_addr) {const char *in = input;
@@ -129,7 +129,7 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)return rte_pci_bdf_parse (input, dev_addr); } -int +static int rte_pci_dbdf_parse (const char *input,struct rte_pci_addr *dev_addr) {const char *in = input;
lib/librte_eal/common/include/rte_pci.h +0 -29
@@ -241,21 +241,6 @@ struct mapped_pci_resource {TAILQ_HEAD (mapped_pci_res_list, mapped_pci_resource);/** -* Utility function to produce a PCI Bus-Device-Function value -* given a string representation. Assumes that the BDF is provided without -* a domain prefix (i.e. domain returned is always 0) -* -* @param input -* The input string to be parsed. Should have the format XX:XX.X -* @param dev_addr -* The PCI Bus-Device-Function address to be returned. Domain will always be -* returned as 0 -* @return -* 0 on success, negative on error. -*/ -int rte_pci_bdf_parse (const char *input,struct rte_pci_addr *dev_addr); - -/** * @deprecated * Utility function to produce a PCI Bus-Device-Function value * given a string representation. Assumes that the BDF is provided without
@@ -272,20 +257,6 @@ int rte_pci_bdf_parse(const char *input, struct rte_pci_addr *dev_addr);int eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr);/** -* Utility function to produce a PCI Bus-Device-Function value -* given a string representation. Assumes that the BDF is provided including -* a domain prefix. -* -* @param input -* The input string to be parsed. Should have the format XXXX:XX:XX.X -* @param dev_addr -* The PCI Bus-Device-Function address to be returned -* @return -* 0 on success, negative on error. -*/ -int rte_pci_dbdf_parse (const char *input,struct rte_pci_addr *dev_addr); - -/** * @deprecated * Utility function to produce a PCI Bus-Device-Function value * given a string representation. Assumes that the BDF is provided including
lib/librte_eal/rte_eal_version.map +0 -2
@@ -255,8 +255,6 @@ DPDK_17.11 { rte_memcpy_ptr; rte_pci_addr_cmp; rte_pci_addr_parse; - rte_pci_bdf_parse; - rte_pci_dbdf_parse; rte_pci_device_name; rte_pci_get_iommu_class; rte_pci_match;
Signature · 1 line
2.1.4
PATCH v7 16/25 pci: use new PCI addr comparison function
In reply to Gaetan Rivet--- lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +- lib/librte_eal/common/eal_common_pci.c | 8 ++++---- lib/librte_eal/common/eal_common_pci_uio.c | 4 ++-- lib/librte_eal/linuxapp/eal/eal_pci.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-)
lib/librte_eal/bsdapp/eal/eal_pci.c +1 -1
@@ -323,7 +323,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)int ret; TAILQ_FOREACH(dev2, &rte_pci_bus.device_list, next) { - ret =rte_eal_compare_pci_addr (&dev->addr, &dev2->addr); + ret =rte_pci_addr_cmp (&dev->addr, &dev2->addr);if (ret >0 )continue ;else if (ret <0 ) {
lib/librte_eal/common/eal_common_pci.c +4 -4
@@ -81,7 +81,7 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)if (devargs->bus != pbus)continue ; devargs->bus->parse (devargs->name, &addr); -if (!rte_eal_compare_pci_addr (&dev->addr, &addr)) +if (!rte_pci_addr_cmp (&dev->addr, &addr))return devargs; }return NULL ;
@@ -194,7 +194,7 @@ rte_pci_addr_cmp(const struct rte_pci_addr *addr,int rte_eal_compare_pci_addr (const struct rte_pci_addr *addr, -const struct rte_pci_addr *addr2) +const struct rte_pci_addr *addr2) {return rte_pci_addr_cmp (addr, addr2); }
@@ -463,7 +463,7 @@ rte_pci_probe_one(const struct rte_pci_addr *addr) goto err_return;FOREACH_DEVICE_ON_PCIBUS (dev) { -if (rte_eal_compare_pci_addr (&dev->addr, addr)) +if (rte_pci_addr_cmp (&dev->addr, addr))continue ; ret =pci_probe_all_drivers (dev);
@@ -493,7 +493,7 @@ rte_pci_detach(const struct rte_pci_addr *addr)return -1 ;FOREACH_DEVICE_ON_PCIBUS (dev) { -if (rte_eal_compare_pci_addr (&dev->addr, addr)) +if (rte_pci_addr_cmp (&dev->addr, addr))continue ; ret =rte_pci_detach_dev (dev);
lib/librte_eal/common/eal_common_pci_uio.c +2 -2
@@ -61,7 +61,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev) TAILQ_FOREACH(uio_res, uio_res_list, next) {/* skip this element if it doesn't match our PCI address */ -if (rte_eal_compare_pci_addr (&uio_res->pci_addr, &dev->addr)) +if (rte_pci_addr_cmp (&uio_res->pci_addr, &dev->addr))continue ;for (i =0 ; i != uio_res->nb_maps; i++) {
@@ -187,7 +187,7 @@ pci_uio_find_resource(struct rte_pci_device *dev) TAILQ_FOREACH(uio_res, uio_res_list, next) {/* skip this element if it doesn't match our PCI address */ -if (!rte_eal_compare_pci_addr (&uio_res->pci_addr, &dev->addr)) +if (!rte_pci_addr_cmp (&uio_res->pci_addr, &dev->addr))return uio_res; }return NULL ;
lib/librte_eal/linuxapp/eal/eal_pci.c +1 -1
@@ -363,7 +363,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)int ret; TAILQ_FOREACH(dev2, &rte_pci_bus.device_list, next) { - ret =rte_eal_compare_pci_addr (&dev->addr, &dev2->addr); + ret =rte_pci_addr_cmp (&dev->addr, &dev2->addr);if (ret >0 )continue ;
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +2 -2
@@ -576,8 +576,8 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)/* if we're in a secondary process, just find our tailq entry */ TAILQ_FOREACH(vfio_res, vfio_res_list, next) { -if (rte_eal_compare_pci_addr (&vfio_res->pci_addr, - &dev->addr)) +if (rte_pci_addr_cmp (&vfio_res->pci_addr, + &dev->addr))continue ;break ; }
Signature · 1 line
2.1.4
PATCH v7 17/25 pci: use new PCI addr parsing function
In reply to Gaetan Rivet--- lib/librte_eal/common/eal_common_pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
lib/librte_eal/common/eal_common_pci.c +1 -2
@@ -595,8 +595,7 @@ pci_parse(const char *name, void *addr)struct rte_pci_addr pci_addr;bool parse; - parse = (eal_parse_pci_BDF (name, &pci_addr) ==0 || -eal_parse_pci_DomBDF (name, &pci_addr) ==0 ); + parse = (rte_pci_addr_parse (name, &pci_addr) ==0 );if (parse && addr !=NULL ) *out = pci_addr;return parse == false;
Signature · 1 line
2.1.4
PATCH v7 18/25 pci: do not expose private functions
In reply to Gaetan Rivetmake the functions
+ rte_pci_detach
+ rte_pci_probe
+ rte_pci_probe_one
+ rte_pci_scan
private as there is no point in using them outside of the rte_bus framework.
--- lib/librte_eal/common/eal_private.h | 49 +++++++++++++++++++++++++++++++++ lib/librte_eal/common/include/rte_pci.h | 49 --------------------------------- lib/librte_eal/rte_eal_version.map | 4 --- 3 files changed, 49 insertions(+), 53 deletions(-)
lib/librte_eal/common/eal_private.h +49 -0
@@ -114,6 +114,55 @@ struct rte_pci_driver;struct rte_pci_device ;/** +* Probe the PCI bus +* +* @return +* - 0 on success. +* - !0 on error. +*/ +int +rte_pci_probe (void ); + +/** +* Scan the content of the PCI bus, and the devices in the devices +* list +* +* @return +* 0 on success, negative on error +*/ +int rte_pci_scan (void ); + +/** +* Probe the single PCI device. +* +* Scan the content of the PCI bus, and find the pci device specified by pci +* address, then call the probe() function for registered driver that has a +* matching entry in its id_table for discovered device. +* +* @param addr +* The PCI Bus-Device-Function address to probe. +* @return +* - 0 on success. +* - Negative on error. +*/ +int rte_pci_probe_one (const struct rte_pci_addr *addr); + +/** +* Close the single PCI device. +* +* Scan the content of the PCI bus, and find the pci device specified by pci +* address, then call the remove() function for registered driver that has a +* matching entry in its id_table for discovered device. +* +* @param addr +* The PCI Bus-Device-Function address to close. +* @return +* - 0 on success. +* - Negative on error. +*/ +int rte_pci_detach (const struct rte_pci_addr *addr); + +/** * Find the name of a PCI device. */ void pci_name_set (struct rte_pci_device *dev);
lib/librte_eal/common/include/rte_pci.h +0 -49
61 lines not on this page · raw message
lib/librte_eal/rte_eal_version.map +0 -4
@@ -166,18 +166,14 @@ DPDK_17.05 { rte_log_set_global_level; rte_log_set_level; rte_log_set_level_regexp; - rte_pci_detach; rte_pci_dump; rte_pci_ioport_map; rte_pci_ioport_read; rte_pci_ioport_unmap; rte_pci_ioport_write; rte_pci_map_device; - rte_pci_probe; - rte_pci_probe_one; rte_pci_read_config; rte_pci_register; - rte_pci_scan; rte_pci_unmap_device; rte_pci_unregister; rte_pci_write_config;
Signature · 1 line
2.1.4
PATCH v7 19/25 pci: do not expose PCI match function
In reply to Gaetan RivetThis function is private to the PCI bus.
--- lib/librte_eal/common/eal_private.h | 15 +++++++++++++++ lib/librte_eal/common/include/rte_pci.h | 16 ---------------- lib/librte_eal/rte_eal_version.map | 1 - 3 files changed, 15 insertions(+), 17 deletions(-)
lib/librte_eal/common/eal_private.h +15 -0
@@ -290,6 +290,21 @@ void pci_uio_free_resource(struct rte_pci_device *dev,int pci_uio_map_resource_by_index (struct rte_pci_device *dev,int res_idx,struct mapped_pci_resource *uio_res,int map_idx); +/* +* Match the PCI Driver and Device using the ID Table +* +* @param pci_drv +* PCI driver from which ID table would be extracted +* @param pci_dev +* PCI device to match against the driver +* @return +* 1 for successful match +* 0 for unsuccessful match +*/ +int +rte_pci_match (const struct rte_pci_driver *pci_drv, +const struct rte_pci_device *pci_dev); +/** * Init tail queues for non-EAL library structures. This is to allow * the rings, mempools, etc. lists to be shared among multiple processes
lib/librte_eal/common/include/rte_pci.h +0 -16
@@ -331,22 +331,6 @@ int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,*/ int rte_pci_addr_parse (const char *str,struct rte_pci_addr *addr); -/* -* Match the PCI Driver and Device using the ID Table -* -* @param pci_drv -* PCI driver from which ID table would be extracted -* @param pci_dev -* PCI device to match against the driver -* @return -* 1 for successful match -* 0 for unsuccessful match -*/ -int -rte_pci_match (const struct rte_pci_driver *pci_drv, -const struct rte_pci_device *pci_dev); - -/** * Get iommu class of PCI devices on the bus. * And return their preferred iova mapping mode.
lib/librte_eal/rte_eal_version.map +0 -1
@@ -253,7 +253,6 @@ DPDK_17.11 { rte_pci_addr_parse; rte_pci_device_name; rte_pci_get_iommu_class; - rte_pci_match; vfio_enable; vfio_is_enabled; vfio_noiommu_is_enabled;
Signature · 1 line
2.1.4
PATCH v7 20/25 pci: do not expose IOVA mode getter
In reply to Gaetan Rivet--- lib/librte_eal/common/eal_private.h | 10 ++++++++++ lib/librte_eal/common/include/rte_pci.h | 10 ---------- lib/librte_eal/rte_eal_version.map | 1 - 3 files changed, 10 insertions(+), 11 deletions(-)
lib/librte_eal/common/eal_private.h +10 -0
@@ -306,6 +306,16 @@ rte_pci_match(const struct rte_pci_driver *pci_drv, const struct rte_pci_device *pci_dev);/** +* Get iommu class of PCI devices on the bus. +* And return their preferred iova mapping mode. +* +* @return +* - enum rte_iova_mode. +*/ +enum rte_iova_mode +rte_pci_get_iommu_class (void ); + +/** * Init tail queues for non-EAL library structures. This is to allow * the rings, mempools, etc. lists to be shared among multiple processes *
lib/librte_eal/common/include/rte_pci.h +0 -10
@@ -332,16 +332,6 @@ int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,int rte_pci_addr_parse (const char *str,struct rte_pci_addr *addr);/** -* Get iommu class of PCI devices on the bus. -* And return their preferred iova mapping mode. -* -* @return -* - enum rte_iova_mode. -*/ -enum rte_iova_mode -rte_pci_get_iommu_class (void ); - -/** * Map the PCI device resources in user space virtual memory address * * Note that driver should not call this function when flag
lib/librte_eal/rte_eal_version.map +0 -1
@@ -252,7 +252,6 @@ DPDK_17.11 { rte_pci_addr_cmp; rte_pci_addr_parse; rte_pci_device_name; - rte_pci_get_iommu_class; vfio_enable; vfio_is_enabled; vfio_noiommu_is_enabled;
Signature · 1 line
2.1.4
PATCH v7 21/25 pci: use EAL exposed configuration
In reply to Gaetan Rivet--- lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 18 +++++++++++------- 4 files changed, 14 insertions(+), 10 deletions(-)
lib/librte_eal/bsdapp/eal/eal_pci.c +1 -1
@@ -368,7 +368,7 @@ rte_pci_scan(void) };/* for debug purposes, PCI can be disabled */ -if (internal_config.no_pci) +if (!rte_eal_has_pci ())return 0 ; fd =open ("/dev/pci" ,O_RDONLY );
lib/librte_eal/linuxapp/eal/eal_pci.c +1 -1
@@ -457,7 +457,7 @@ rte_pci_scan(void)struct rte_pci_addr addr;/* for debug purposes, PCI can be disabled */ -if (internal_config.no_pci) +if (!rte_eal_has_pci ())return 0 ;#ifdef VFIO_PRESENT
lib/librte_eal/linuxapp/eal/eal_pci_uio.c +1 -1
@@ -214,7 +214,7 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,return -1 ;/* create uio device if we've been asked to */ -if (internal_config.create_uio_dev && create && +if (rte_eal_create_uio_dev () && create &&pci_mknod_uio_dev (dstbuf, uio_num) <0 )RTE_LOG (WARNING ,EAL ,"Cannot create /dev/uio%u\n" , uio_num);
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +11 -7
@@ -209,14 +209,18 @@ static int pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) { int i, ret, intr_idx; +enum rte_intr_mode intr_mode;/* default to invalid index */ intr_idx =VFIO_PCI_NUM_IRQS ; +/* Get default / configured intr_mode */ + intr_mode =rte_eal_vfio_intr_mode (); +/* get interrupt type from internal config (MSI-X by default, can be * overridden from the command line */ -switch (internal_config.vfio_intr_mode) { +switch (intr_mode) {case RTE_INTR_MODE_MSIX : intr_idx =VFIO_PCI_MSIX_IRQ_INDEX ;break ;
@@ -240,7 +244,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)int fd =-1 ;/* skip interrupt modes we don't want */ -if (internal_config.vfio_intr_mode !=RTE_INTR_MODE_NONE && +if (intr_mode !=RTE_INTR_MODE_NONE && i != intr_idx)continue ;
@@ -256,7 +260,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)/* if this vector cannot be used with eventfd, fail if we explicitly * specified interrupt type, otherwise continue */ if ((irq.flags &VFIO_IRQ_INFO_EVENTFD ) ==0 ) { -if (internal_config.vfio_intr_mode !=RTE_INTR_MODE_NONE ) { +if (intr_mode !=RTE_INTR_MODE_NONE ) {RTE_LOG (ERR ,EAL ," interrupt vector does not support eventfd!\n" );return -1 ;
@@ -277,15 +281,15 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)switch (i) {case VFIO_PCI_MSIX_IRQ_INDEX : - internal_config.vfio_intr_mode =RTE_INTR_MODE_MSIX ; + intr_mode =RTE_INTR_MODE_MSIX ; dev->intr_handle.type =RTE_INTR_HANDLE_VFIO_MSIX ;break ;case VFIO_PCI_MSI_IRQ_INDEX : - internal_config.vfio_intr_mode =RTE_INTR_MODE_MSI ; + intr_mode =RTE_INTR_MODE_MSI ; dev->intr_handle.type =RTE_INTR_HANDLE_VFIO_MSI ;break ;case VFIO_PCI_INTX_IRQ_INDEX : - internal_config.vfio_intr_mode =RTE_INTR_MODE_LEGACY ; + intr_mode =RTE_INTR_MODE_LEGACY ; dev->intr_handle.type =RTE_INTR_HANDLE_VFIO_LEGACY ;break ;default :
@@ -615,7 +619,7 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)int pci_vfio_map_resource (struct rte_pci_device *dev) { -if (internal_config.process_type ==RTE_PROC_PRIMARY ) +if (rte_eal_process_type () ==RTE_PROC_PRIMARY )return pci_vfio_map_resource_primary (dev);else return pci_vfio_map_resource_secondary (dev);
Signature · 1 line
2.1.4
PATCH v7 22/25 net/bonding: use local prefix for local function
In reply to Gaetan RivetThe current name conflicts with the librte_pci naming convention. Additionally, it is easier to use gdb when having prefixed even private functions.
--- drivers/net/bonding/rte_eth_bond_args.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bonding/rte_eth_bond_args.c +2 -2
@@ -89,7 +89,7 @@ find_port_id_by_dev_name(const char *name) }static inline int -pci_addr_cmp (const struct rte_device *dev,const void *_pci_addr) +bond_pci_addr_cmp (const struct rte_device *dev,const void *_pci_addr) {struct rte_pci_device *pdev;const struct rte_pci_addr *paddr = _pci_addr;
@@ -118,7 +118,7 @@ parse_port_id(const char *port_str)/* try parsing as pci address, physical devices */ if (pci_bus->parse (port_str, &dev_addr) ==0 ) { - dev = pci_bus->find_device (NULL , pci_addr_cmp, &dev_addr); + dev = pci_bus->find_device (NULL , bond_pci_addr_cmp, &dev_addr);if (dev ==NULL ) {RTE_LOG (ERR ,PMD ,"unable to find PCI device\n" );return -1 ;
Signature · 1 line
2.1.4
PATCH v7 23/25 pci: introduce PCI lib and bus
In reply to Gaetan RivetThe PCI lib defines the types and methods allowing to use PCI elements.
The PCI bus implements a bus driver for PCI devices by constructing rte_bus elements using the PCI lib.
Move the relevant code out of the EAL to its expected place.
Libraries, drivers, unit tests and applications are updated to use the new rte_bus_pci.h header when necessary.
--- app/test-pmd/testpmd.h | 1 + config/common_base | 10 + drivers/bus/Makefile | 2 + drivers/bus/pci/Makefile | 62 ++ drivers/bus/pci/bsd/Makefile | 32 ++ drivers/bus/pci/bsd/pci.c | 681 ++++++++++++++++++++++ drivers/bus/pci/include/rte_bus_pci.h | 340 +++++++++++ drivers/bus/pci/linux/Makefile | 36 ++ drivers/bus/pci/linux/pci.c | 826 +++++++++++++++++++++++++++ drivers/bus/pci/linux/pci_init.h | 99 ++++ drivers/bus/pci/linux/pci_uio.c | 568 ++++++++++++++++++ drivers/bus/pci/linux/pci_vfio.c | 756 ++++++++++++++++++++++++ drivers/bus/pci/pci_common.c | 535 +++++++++++++++++ drivers/bus/pci/pci_common_uio.c | 235 ++++++++ drivers/bus/pci/private.h | 248 ++++++++ drivers/bus/pci/rte_bus_pci_version.map | 17 + drivers/crypto/qat/Makefile | 1 + drivers/crypto/qat/qat_qp.c | 1 + drivers/crypto/qat/rte_qat_cryptodev.c | 1 + drivers/event/octeontx/Makefile | 1 + drivers/event/skeleton/Makefile | 1 + drivers/mempool/octeontx/Makefile | 1 + drivers/mempool/octeontx/octeontx_fpavf.c | 2 +- drivers/mempool/octeontx/octeontx_ssovf.c | 1 + drivers/net/ark/Makefile | 1 + drivers/net/ark/ark_ethdev.c | 1 + drivers/net/avp/Makefile | 1 + drivers/net/avp/avp_ethdev.c | 2 + drivers/net/bnx2x/Makefile | 1 + drivers/net/bnxt/Makefile | 1 + drivers/net/bnxt/bnxt.h | 1 + drivers/net/bonding/Makefile | 1 + drivers/net/bonding/rte_eth_bond_args.c | 1 + drivers/net/cxgbe/Makefile | 1 + drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 1 + drivers/net/e1000/Makefile | 1 + drivers/net/e1000/em_ethdev.c | 1 + drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/e1000/igb_pf.c | 1 + drivers/net/ena/Makefile | 1 + drivers/net/ena/ena_ethdev.h | 1 + drivers/net/enic/Makefile | 1 + drivers/net/enic/base/vnic_dev.h | 4 +- drivers/net/enic/enic_ethdev.c | 1 + drivers/net/enic/enic_main.c | 1 + drivers/net/fm10k/Makefile | 1 + drivers/net/i40e/Makefile | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/ixgbe/Makefile | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 1 + drivers/net/ixgbe/ixgbe_ethdev.h | 1 + drivers/net/liquidio/Makefile | 1 + drivers/net/mlx4/Makefile | 1 + drivers/net/mlx4/mlx4_ethdev.c | 1 + drivers/net/mlx5/Makefile | 1 + drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/nfp/Makefile | 1 + drivers/net/nfp/nfp_nfpu.c | 2 +- drivers/net/nfp/nfp_nfpu.h | 2 +- drivers/net/octeontx/Makefile | 1 + drivers/net/octeontx/base/octeontx_pkivf.c | 2 +- drivers/net/octeontx/base/octeontx_pkovf.c | 2 +- drivers/net/qede/Makefile | 1 + drivers/net/sfc/Makefile | 1 + drivers/net/sfc/sfc.h | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/szedata2/Makefile | 1 + drivers/net/thunderx/Makefile | 1 + drivers/net/thunderx/nicvf_ethdev.c | 1 + drivers/net/virtio/Makefile | 1 + drivers/net/virtio/virtio_ethdev.c | 1 + drivers/net/virtio/virtio_pci.h | 1 + drivers/net/vmxnet3/Makefile | 1 + drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 + lib/Makefile | 2 + lib/librte_eal/bsdapp/eal/Makefile | 3 - lib/librte_eal/bsdapp/eal/eal.c | 1 - lib/librte_eal/bsdapp/eal/eal_pci.c | 680 ---------------------- lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_pci.c | 693 ---------------------- lib/librte_eal/common/eal_common_pci_uio.c | 233 -------- lib/librte_eal/common/eal_private.h | 206 ------- lib/librte_eal/common/include/rte_pci.h | 533 ----------------- lib/librte_eal/linuxapp/eal/Makefile | 8 - lib/librte_eal/linuxapp/eal/eal.c | 1 - lib/librte_eal/linuxapp/eal/eal_interrupts.c | 1 - lib/librte_eal/linuxapp/eal/eal_pci.c | 823 -------------------------- lib/librte_eal/linuxapp/eal/eal_pci_init.h | 99 ---- lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 567 ------------------ lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 754 ------------------------ lib/librte_eal/rte_eal_version.map | 17 - lib/librte_ether/rte_ethdev.h | 2 - lib/librte_ether/rte_ethdev_pci.h | 1 + lib/librte_eventdev/rte_eventdev_pmd_pci.h | 1 + lib/librte_pci/Makefile | 49 ++ lib/librte_pci/include/rte_pci.h | 279 +++++++++ lib/librte_pci/rte_pci.c | 220 +++++++ lib/librte_pci/rte_pci_version.map | 15 + mk/rte.app.mk | 3 + test/test/test_kni.c | 1 + test/test/virtual_pmd.c | 1 + 104 files changed, 5085 insertions(+), 4628 deletions(-) create mode 100644 drivers/bus/pci/Makefile create mode 100644 drivers/bus/pci/bsd/Makefile create mode 100644 drivers/bus/pci/bsd/pci.c create mode 100644 drivers/bus/pci/include/rte_bus_pci.h create mode 100644 drivers/bus/pci/linux/Makefile create mode 100644 drivers/bus/pci/linux/pci.c create mode 100644 drivers/bus/pci/linux/pci_init.h create mode 100644 drivers/bus/pci/linux/pci_uio.c create mode 100644 drivers/bus/pci/linux/pci_vfio.c create mode 100644 drivers/bus/pci/pci_common.c create mode 100644 drivers/bus/pci/pci_common_uio.c create mode 100644 drivers/bus/pci/private.h create mode 100644 drivers/bus/pci/rte_bus_pci_version.map delete mode 100644 lib/librte_eal/bsdapp/eal/eal_pci.c delete mode 100644 lib/librte_eal/common/eal_common_pci.c delete mode 100644 lib/librte_eal/common/eal_common_pci_uio.c delete mode 100644 lib/librte_eal/common/include/rte_pci.h delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci.c delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_init.h delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_uio.c delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c create mode 100644 lib/librte_pci/Makefile create mode 100644 lib/librte_pci/include/rte_pci.h create mode 100644 lib/librte_pci/rte_pci.c create mode 100644 lib/librte_pci/rte_pci_version.map
app/test-pmd/testpmd.h +1 -0
@@ -35,6 +35,7 @@#define _TESTPMD_H_#include <rte_pci.h> +#include <rte_bus_pci.h> #include <rte_gro.h> #include <rte_gso.h>
config/common_base +10 -0
@@ -123,6 +123,11 @@ CONFIG_RTE_EAL_PMD_PATH="" CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=y # +# Compile the PCI library +# +CONFIG_RTE_LIBRTE_PCI=y + +# # Compile the argument parser library # CONFIG_RTE_LIBRTE_KVARGS=y
@@ -148,6 +153,11 @@ CONFIG_RTE_ETHDEV_PROFILE_ITT_WASTED_RX_ITERATIONS=n CONFIG_RTE_ETHDEV_TX_PREPARE_NOOP=n # +# Compile PCI bus driver +# +CONFIG_RTE_LIBRTE_PCI_BUS=y + +# # Compile burst-oriented Amazon ENA PMD driver # CONFIG_RTE_LIBRTE_ENA_PMD=y
drivers/bus/Makefile +2 -0
@@ -36,4 +36,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += dpaa DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc +DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci + include $(RTE_SDK)/mk/rte.subdir.mk
drivers/bus/pci/Makefile new file +62 -0
62 lines not on this page · raw message
drivers/bus/pci/bsd/Makefile new file +32 -0
@@ -0,0 +1,32 @@ +# BSD LICENSE +# +# Copyright(c) 2017 6WIND S.A. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SRCS += pci.c
drivers/bus/pci/bsd/pci.c new file +681 -0
681 lines not on this page · raw message
drivers/bus/pci/include/rte_bus_pci.h new file +340 -0
340 lines not on this page · raw message
drivers/bus/pci/linux/Makefile new file +36 -0
@@ -0,0 +1,36 @@ +# BSD LICENSE +# +# Copyright(c) 2017 6WIND S.A. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SRCS += pci.c +SRCS += pci_uio.c +SRCS += pci_vfio.c + +CFLAGS += -D_GNU_SOURCE
drivers/bus/pci/linux/pci.c new file +826 -0
826 lines not on this page · raw message
drivers/bus/pci/linux/pci_init.h new file +99 -0
99 lines not on this page · raw message
drivers/bus/pci/linux/pci_uio.c new file +568 -0
568 lines not on this page · raw message
drivers/bus/pci/linux/pci_vfio.c new file +756 -0
321 lines not on this page · raw message
drivers/bus/pci/pci_common.c new file +535 -0
535 lines not on this page · raw message
drivers/bus/pci/pci_common_uio.c new file +235 -0
235 lines not on this page · raw message
drivers/bus/pci/private.h new file +248 -0
248 lines not on this page · raw message
drivers/bus/pci/rte_bus_pci_version.map new file +17 -0
Lines of this file are not shown. View the raw message.
drivers/mempool/octeontx/octeontx_fpavf.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/mempool/octeontx/octeontx_ssovf.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/bonding/rte_eth_bond_args.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/octeontx/base/octeontx_pkivf.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/octeontx/base/octeontx_pkovf.c +1 -1
Lines of this file are not shown. View the raw message.
lib/librte_eal/bsdapp/eal/eal_pci.c deleted +0 -680
680 lines not on this page · raw message
lib/librte_eal/common/eal_common_pci.c deleted +0 -693
693 lines not on this page · raw message
lib/librte_eal/common/eal_common_pci_uio.c deleted +0 -233
233 lines not on this page · raw message
lib/librte_eal/common/eal_private.h +0 -206
206 lines not on this page · raw message
lib/librte_eal/common/include/rte_pci.h deleted +0 -533
533 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal_interrupts.c +0 -1
Lines of this file are not shown. View the raw message.
lib/librte_eal/linuxapp/eal/eal_pci.c deleted +0 -823
823 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal_pci_init.h deleted +0 -99
99 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal_pci_uio.c deleted +0 -567
567 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c deleted +0 -754
754 lines not on this page · raw message
lib/librte_eventdev/rte_eventdev_pmd_pci.h +1 -0
Lines of this file are not shown. View the raw message.
lib/librte_pci/Makefile new file +49 -0
49 lines not on this page · raw message
lib/librte_pci/include/rte_pci.h new file +279 -0
279 lines not on this page · raw message
lib/librte_pci/rte_pci.c new file +220 -0
220 lines not on this page · raw message
lib/librte_pci/rte_pci_version.map new file +15 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.4
Part of the diff is not shown here. View the raw message.
PATCH v7 24/25 doc: add notes on EAL PCI API update
In reply to Gaetan RivetAdd a section related to EAL API changes to 17.11 release notes.
--- doc/guides/rel_notes/release_17_11.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
doc/guides/rel_notes/release_17_11.rst +28 -0
@@ -297,6 +297,34 @@ API Changes ``rte_log_get_global_level()``, ``rte_log_set_level()`` and ``rte_log_get_level()``. +* **PCI bus API moved outside of the EAL** + + The PCI bus previously implemented within the EAL has been moved. + A first part has been added as an RTE library providing PCI helpers to + parse device locations or other such utilities. + A second part consisting in the actual bus driver has been moved to its + proper subdirectory, without changing its functionalities. + + As such, several PCI-related functions are not proposed by the EAL anymore: + + * rte_pci_detach + * rte_pci_dump + * rte_pci_ioport_map + * rte_pci_ioport_read + * rte_pci_ioport_unmap + * rte_pci_ioport_write + * rte_pci_map_device + * rte_pci_probe + * rte_pci_probe_one + * rte_pci_read_config + * rte_pci_register + * rte_pci_scan + * rte_pci_unmap_device + * rte_pci_unregister + * rte_pci_write_config + + These functions are made available either as part of ``librte_pci`` or + ``librte_bus_pci``. ABI Changes -----------
Signature · 1 line
2.1.4
PATCH v7 25/25 maintainers: claim maintainership of PCI lib
In reply to Gaetan Rivet--- MAINTAINERS | 4 ++++ 1 file changed, 4 insertions(+)
MAINTAINERS +4 -0
@@ -870,6 +870,10 @@ Latency statistics M: Reshma Pattan <[email protected]> F: lib/librte_latencystats/ +PCI +M: Gaetan Rivet <[email protected]> +F: lib/librte_pci/ + Test Applications -----------------
Signature · 1 line
2.1.4
v8 cover Move PCI away from the EAL
In reply to Gaetan RivetHi all,
Here is a new version of the PCI bus move out of the EAL.
The EAL PCI implementation is divided in two parts:
- librte_pci: library offering helpers to handle PCI objects
- librte_bus_pci: bus driver for PCI devices
This allows other libraries / tools to use PCI elements (location, mappings, parsing operations, etc) without forcing a dependency on a bus driver.
The latter should not have to export helpers that others might need. It is focused on defining the rte_pci_device, rte_pci_driver objects and their handling.
The cryptodev library has hard dependencies on rte_pci_devices (used by generic probe function). Other similar libs (ether and eventdev) avoided the issue by inlining such functions and expecting users to include the relevant headers once the PCI bus has already been built.
After review from Declan, he proposed to submit a patch removing this dependency. Once this patch is submitted, the relevant commit will be dropped from this patchset.
v2:
+ Made rte_eal_using_phys_addrs common to both linux and bsd interfaces.
+ Added documentation of EAL API changes in release note.
+ Fixed a few rebase-related mistakes.
+ Fixed parallel build race condition reported by Luca Boccassi.
+ Grouped together commits breaking compilation:
-> pci: introduce PCI lib and bus
-> lib: include rte_bus_pci
-> drivers: include rte_bus_pci
-> test: include rte_bus_pci
-> app/testpmd: include rte_bus_pci
-> cryptodev: move PCI specific helpers to drivers/cryptoUntil all of them have been applied, compilation is broken. I am currently wondering whether merging some of them might be sensible.
+ Not included in this series:
Several filesystem-related functions are currently
private to the EAL and directly linked. This is not good,
but the solution seems to be to have a new lib offering an FS abstraction. This seems an overreach for this patchset and should probably come in a second step.
v3:
+ Fixed .map versioning
+ merged one commit breaking the build into the main commit moving code around.
Other such commits are still present, as they only break specific subsystems (lib, drivers, apps, cryptodev). Merging them all within the one main commit does not seem right.
As such, build is still broken from
* pci: introduce PCI lib and bus
until
* cryptodev: move PCI specific helpers to drivers/crypto
v4:
+ Rebased unto master, with new PCI functionalities integrated.
+ Removed the exposition of private EAL functions.
While one commit did deal with this for one function, the issue is more widespread and should be fixed in a more generic way.
+ Introduced new PCI address parsing function,
deprecating the old ones.
+ Fix conflict with bonding PMD regarding pci_addr_cmp function name.
v5:
+ Rebase unto master: fix a few compilation issues with the header change.
+ Make more PCI bus functions private.
v6: (Not sent publicly)
+ Made a mistake when formatting the patches.
+ fixed a rebase error in the commit
bus/pci: do not expose IOVA mode getter
~*~
Compilation is still broken from
* pci: introduce PCI lib and bus
until
* net/bonding: use local prefix for local function
v7:
+ Fixed compilation issues with shared build This required exposing several private EAL symbols from VFIO and internal_config.
For VFIO
+ Squashed all commits breaking compilation into
the single big move. compilation is stable throughout the series now.
+ Removed cryptodev commit, now based upon Declan's work (see patchset dependencies).
+ Moved PCI enhancement prior to moving code into the lib and bus. Thanks to Aaron Conole for the suggestion.
+ Fixed build on FreeBSD
+ Claimed ownership on librte_pci, for the time being.
v8:
+ Fix compilation issues between commits in EAL vfio related parts. Keep proper includes when necessary, moved a few VFIO_PCI specific symbols around.
+ Added drivers/bus/pci tree to MAINTAINERS file, with no owner.
This patchset depends on:
Break dependency on bus infrastructure
http://dpdk.org/ml/archives/dev/2017-October/079827.html
Gaetan Rivet (25):
ethdev: remove useless PCI dependency
eal: include debug header in bus source
eal: include stdint in private header
eal: include common header
eal: expose rte_eal_using_phys_addrs
eal: expose internal config elements
eal: expose vfio symbols
vfio: remove useless PCI headers
vfio: check PCI dependency from within PCI code
vfio: move PCI-related symbols out of vfio header
pci: avoid inlining functions
pci: avoid over-complicated macro
pci: deprecate misnamed functions
pci: introduce PCI address parsing function
pci: make specialized parsing functions private
pci: use new PCI addr comparison function
pci: use new PCI addr parsing function
pci: do not expose private functions
pci: do not expose PCI match function
pci: do not expose IOVA mode getter
pci: use EAL exposed configuration net/bonding: use local prefix for local function
pci: introduce PCI lib and bus
doc: add notes on EAL PCI API update
maintainers: claim maintainership of PCI lib
MAINTAINERS | 9 + app/test-pmd/testpmd.h | 1 + config/common_base | 10 + doc/guides/rel_notes/deprecation.rst | 7 + doc/guides/rel_notes/release_17_11.rst | 28 + drivers/bus/Makefile | 2 + drivers/bus/fslmc/fslmc_vfio.h | 2 + drivers/bus/pci/Makefile | 62 ++ drivers/bus/pci/bsd/Makefile | 32 + drivers/bus/pci/bsd/pci.c | 681 ++++++++++++++++++++ drivers/bus/pci/include/rte_bus_pci.h | 340 ++++++++++ drivers/bus/pci/linux/Makefile | 36 ++ drivers/bus/pci/linux/pci.c | 826 +++++++++++++++++++++++++ drivers/bus/pci/linux/pci_init.h | 111 ++++ drivers/bus/pci/linux/pci_uio.c | 568 +++++++++++++++++ drivers/bus/pci/linux/pci_vfio.c | 756 ++++++++++++++++++++++ drivers/bus/pci/pci_common.c | 541 ++++++++++++++++ drivers/bus/pci/pci_common_uio.c | 235 +++++++ drivers/bus/pci/private.h | 248 ++++++++ drivers/bus/pci/rte_bus_pci_version.map | 17 + drivers/crypto/qat/Makefile | 1 + drivers/crypto/qat/qat_qp.c | 1 + drivers/crypto/qat/rte_qat_cryptodev.c | 1 + drivers/event/octeontx/Makefile | 1 + drivers/event/skeleton/Makefile | 1 + drivers/mempool/octeontx/Makefile | 1 + drivers/mempool/octeontx/octeontx_fpavf.c | 2 +- drivers/mempool/octeontx/octeontx_ssovf.c | 1 + drivers/net/ark/Makefile | 1 + drivers/net/ark/ark_ethdev.c | 1 + drivers/net/avp/Makefile | 1 + drivers/net/avp/avp_ethdev.c | 2 + drivers/net/bnx2x/Makefile | 1 + drivers/net/bnxt/Makefile | 1 + drivers/net/bnxt/bnxt.h | 1 + drivers/net/bonding/Makefile | 1 + drivers/net/bonding/rte_eth_bond_args.c | 5 +- drivers/net/cxgbe/Makefile | 1 + drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 1 + drivers/net/e1000/Makefile | 1 + drivers/net/e1000/em_ethdev.c | 1 + drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/e1000/igb_pf.c | 1 + drivers/net/ena/Makefile | 1 + drivers/net/ena/ena_ethdev.h | 1 + drivers/net/enic/Makefile | 1 + drivers/net/enic/base/vnic_dev.h | 4 +- drivers/net/enic/enic_ethdev.c | 1 + drivers/net/enic/enic_main.c | 1 + drivers/net/fm10k/Makefile | 1 + drivers/net/i40e/Makefile | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/ixgbe/Makefile | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 1 + drivers/net/ixgbe/ixgbe_ethdev.h | 1 + drivers/net/liquidio/Makefile | 1 + drivers/net/mlx4/Makefile | 1 + drivers/net/mlx4/mlx4_ethdev.c | 1 + drivers/net/mlx5/Makefile | 1 + drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/nfp/Makefile | 1 + drivers/net/nfp/nfp_nfpu.c | 2 +- drivers/net/nfp/nfp_nfpu.h | 2 +- drivers/net/octeontx/Makefile | 1 + drivers/net/octeontx/base/octeontx_pkivf.c | 2 +- drivers/net/octeontx/base/octeontx_pkovf.c | 2 +- drivers/net/qede/Makefile | 1 + drivers/net/sfc/Makefile | 1 + drivers/net/sfc/sfc.h | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/szedata2/Makefile | 1 + drivers/net/thunderx/Makefile | 1 + drivers/net/thunderx/nicvf_ethdev.c | 1 + drivers/net/virtio/Makefile | 1 + drivers/net/virtio/virtio_ethdev.c | 1 + drivers/net/virtio/virtio_pci.h | 1 + drivers/net/vmxnet3/Makefile | 1 + drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 + lib/Makefile | 2 + lib/librte_eal/bsdapp/eal/Makefile | 3 - lib/librte_eal/bsdapp/eal/eal.c | 58 +- lib/librte_eal/bsdapp/eal/eal_memory.c | 6 + lib/librte_eal/bsdapp/eal/eal_pci.c | 680 -------------------- lib/librte_eal/common/Makefile | 4 +- lib/librte_eal/common/arch/x86/rte_cycles.c | 2 + lib/librte_eal/common/eal_common_bus.c | 1 + lib/librte_eal/common/eal_common_pci.c | 579 ----------------- lib/librte_eal/common/eal_common_pci_uio.c | 233 ------- lib/librte_eal/common/eal_private.h | 144 +---- lib/librte_eal/common/include/rte_eal.h | 28 + lib/librte_eal/common/include/rte_memory.h | 11 + lib/librte_eal/common/include/rte_pci.h | 633 ------------------- lib/librte_eal/common/include/rte_vfio.h | 139 +++++ lib/librte_eal/linuxapp/eal/Makefile | 8 - lib/librte_eal/linuxapp/eal/eal.c | 23 +- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 2 +- lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci.c | 818 ------------------------ lib/librte_eal/linuxapp/eal/eal_pci_init.h | 97 --- lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 567 ----------------- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 750 ---------------------- lib/librte_eal/linuxapp/eal/eal_vfio.c | 1 + lib/librte_eal/linuxapp/eal/eal_vfio.h | 38 -- lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 4 +- lib/librte_eal/rte_eal_version.map | 26 +- lib/librte_ether/rte_ethdev.c | 1 - lib/librte_ether/rte_ethdev.h | 2 - lib/librte_ether/rte_ethdev_pci.h | 1 + lib/librte_eventdev/rte_eventdev_pmd_pci.h | 1 + lib/librte_pci/Makefile | 49 ++ lib/librte_pci/include/rte_pci.h | 279 +++++++++ lib/librte_pci/rte_pci.c | 220 +++++++ lib/librte_pci/rte_pci_version.map | 15 + mk/rte.app.mk | 3 + test/test/test_kni.c | 1 + test/test/virtual_pmd.c | 1 + 119 files changed, 5428 insertions(+), 4590 deletions(-) create mode 100644 drivers/bus/pci/Makefile create mode 100644 drivers/bus/pci/bsd/Makefile create mode 100644 drivers/bus/pci/bsd/pci.c create mode 100644 drivers/bus/pci/include/rte_bus_pci.h create mode 100644 drivers/bus/pci/linux/Makefile create mode 100644 drivers/bus/pci/linux/pci.c create mode 100644 drivers/bus/pci/linux/pci_init.h create mode 100644 drivers/bus/pci/linux/pci_uio.c create mode 100644 drivers/bus/pci/linux/pci_vfio.c create mode 100644 drivers/bus/pci/pci_common.c create mode 100644 drivers/bus/pci/pci_common_uio.c create mode 100644 drivers/bus/pci/private.h create mode 100644 drivers/bus/pci/rte_bus_pci_version.map delete mode 100644 lib/librte_eal/bsdapp/eal/eal_pci.c delete mode 100644 lib/librte_eal/common/eal_common_pci.c delete mode 100644 lib/librte_eal/common/eal_common_pci_uio.c delete mode 100644 lib/librte_eal/common/include/rte_pci.h create mode 100644 lib/librte_eal/common/include/rte_vfio.h delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci.c delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_init.h delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_uio.c delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c create mode 100644 lib/librte_pci/Makefile create mode 100644 lib/librte_pci/include/rte_pci.h create mode 100644 lib/librte_pci/rte_pci.c create mode 100644 lib/librte_pci/rte_pci_version.map
Signature · 1 line
2.1.4
PATCH v8 1/25 ethdev: remove useless PCI dependency
--- lib/librte_ether/rte_ethdev.c | 1 - 1 file changed, 1 deletion(-)
lib/librte_ether/rte_ethdev.c +0 -1
@@ -47,7 +47,6 @@#include <rte_log.h> #include <rte_debug.h> #include <rte_interrupts.h> -#include <rte_pci.h> #include <rte_memory.h> #include <rte_memcpy.h> #include <rte_memzone.h>
Signature · 1 line
2.1.4
PATCH v8 2/25 eal: include debug header in bus source
In reply to Gaetan RivetThis header is included through rte_pci.h, which will be removed once the PCI bus is moved out of the EAL.
--- lib/librte_eal/common/eal_common_bus.c | 1 + 1 file changed, 1 insertion(+)
lib/librte_eal/common/eal_common_bus.c +1 -0
@@ -35,6 +35,7 @@#include <sys/queue.h> #include <rte_bus.h> +#include <rte_debug.h> #include "eal_private.h"
Signature · 1 line
2.1.4
PATCH v8 3/25 eal: include stdint in private header
In reply to Gaetan Rivet--- lib/librte_eal/common/eal_private.h | 1 + 1 file changed, 1 insertion(+)
lib/librte_eal/common/eal_private.h +1 -0
@@ -35,6 +35,7 @@#define _EAL_PRIVATE_H_#include <stdbool.h> +#include <stdint.h> #include <stdio.h> #include <rte_pci.h>
Signature · 1 line
2.1.4
PATCH v8 4/25 eal: include common header
In reply to Gaetan RivetThe macro RTE_SET_USED is defined in rte_common.h
This header is included through eal_private.h, which includes in turn rte_pci.h
Once the PCI subsystem is out of the EAL, this will break the compilation (seen on FreeBSD).
--- lib/librte_eal/common/arch/x86/rte_cycles.c | 2 ++ 1 file changed, 2 insertions(+)
lib/librte_eal/common/arch/x86/rte_cycles.c +2 -0
@@ -35,6 +35,8 @@#include <unistd.h> #include <cpuid.h> +#include <rte_common.h> +#include "eal_private.h" static unsigned int
Signature · 1 line
2.1.4
PATCH v8 5/25 eal: expose rte_eal_using_phys_addrs
In reply to Gaetan RivetThis function was previously private to the EAL layer. Other subsystems requires it, such as the PCI bus.
In order not to force other components to include stdbool, which is incompatible with several NIC drivers, the return type has been changed from bool to int.
--- lib/librte_eal/bsdapp/eal/eal_memory.c | 6 ++++++ lib/librte_eal/common/eal_private.h | 11 ----------- lib/librte_eal/common/include/rte_memory.h | 11 +++++++++++ lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +- lib/librte_eal/rte_eal_version.map | 1 + 5 files changed, 19 insertions(+), 12 deletions(-)
lib/librte_eal/bsdapp/eal/eal_memory.c +6 -0
@@ -192,3 +192,9 @@ rte_eal_hugepage_attach(void)close (fd_hugepage);return -1 ; } + +int +rte_eal_using_phys_addrs (void ) +{ +return 0 ; +}
lib/librte_eal/common/eal_private.h +0 -11
@@ -345,17 +345,6 @@ int rte_eal_hugepage_init(void);int rte_eal_hugepage_attach (void );/** -* Returns true if the system is able to obtain -* physical addresses. Return false if using DMA -* addresses through an IOMMU. -* -* Drivers based on uio will not load unless physical -* addresses are obtainable. It is only possible to get -* physical addresses when running as a privileged user. -*/ -bool rte_eal_using_phys_addrs (void ); - -/** * Find a bus capable of identifying a device. * * @param str
lib/librte_eal/common/include/rte_memory.h +11 -0
@@ -187,6 +187,17 @@ unsigned rte_memory_get_nchannel(void);*/ unsigned rte_memory_get_nrank (void ); +/** +* Drivers based on uio will not load unless physical +* addresses are obtainable. It is only possible to get +* physical addresses when running as a privileged user. +* +* @return +* 1 if the system is able to obtain physical addresses. +* 0 if using DMA addresses through an IOMMU. +*/ +int rte_eal_using_phys_addrs (void ); + #ifdef __cplusplus }#endif
lib/librte_eal/linuxapp/eal/eal_memory.c +1 -1
@@ -1494,7 +1494,7 @@ rte_eal_hugepage_attach(void)return -1 ; } -bool +int rte_eal_using_phys_addrs (void ) {return phys_addrs_available;
lib/librte_eal/rte_eal_version.map +1 -0
@@ -244,6 +244,7 @@ DPDK_17.11 { rte_bus_get_iommu_class; rte_eal_iova_mode; rte_eal_mbuf_default_mempool_ops; + rte_eal_using_phys_addrs; rte_lcore_has_role; rte_memcpy_ptr; rte_pci_get_iommu_class;
Signature · 1 line
2.1.4
PATCH v8 6/25 eal: expose internal config elements
In reply to Gaetan RivetSome internal configuration elements set by the user on the command line are necessary outside the EAL, when the PCI bus is detached.
Expose:
+ rte_eal_create_uio_dev
+ rte_eal_has_pci
+ rte_eal_vfio_intr_mode
--- lib/librte_eal/bsdapp/eal/eal.c | 16 ++++++++++++++++ lib/librte_eal/common/include/rte_eal.h | 28 ++++++++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal.c | 16 ++++++++++++++++ lib/librte_eal/rte_eal_version.map | 3 +++ 4 files changed, 63 insertions(+)
lib/librte_eal/bsdapp/eal/eal.c +16 -0
@@ -723,3 +723,19 @@ rte_eal_process_type(void) {return rte_config.process_type; } + +int rte_eal_has_pci (void ) +{ +return !internal_config.no_pci; +} + +int rte_eal_create_uio_dev (void ) +{ +return internal_config.create_uio_dev; +} + +enum rte_intr_mode +rte_eal_vfio_intr_mode (void ) +{ +return RTE_INTR_MODE_NONE ; +}
lib/librte_eal/common/include/rte_eal.h +28 -0
@@ -47,6 +47,8 @@#include <rte_config.h> #include <rte_bus.h> +#include <rte_pci_dev_feature_defs.h> +#ifdef __cplusplusextern "C" {#endif
@@ -268,6 +270,32 @@ rte_set_application_usage_hook(rte_usage_hook_t usage_func);int rte_eal_has_hugepages (void );/** +* Whether EAL is using PCI bus. +* Disabled by --no-pci option. +* +* @return +* Nonzero if the PCI bus is enabled. +*/ +int rte_eal_has_pci (void ); + +/** +* Whether the EAL was asked to create UIO device. +* +* @return +* Nonzero if true. +*/ +int rte_eal_create_uio_dev (void ); + +/** +* The user-configured vfio interrupt mode. +* +* @return +* Interrupt mode configured with the command line, +* RTE_INTR_MODE_NONE by default. +*/ +enum rte_intr_mode rte_eal_vfio_intr_mode (void ); + +/** * A wrap API for syscall gettid. * * @return
lib/librte_eal/linuxapp/eal/eal.c +16 -0
@@ -989,6 +989,22 @@ int rte_eal_has_hugepages(void)return ! internal_config.no_hugetlbfs; } +int rte_eal_has_pci (void ) +{ +return !internal_config.no_pci; +} + +int rte_eal_create_uio_dev (void ) +{ +return internal_config.create_uio_dev; +} + +enum rte_intr_mode +rte_eal_vfio_intr_mode (void ) +{ +return internal_config.vfio_intr_mode; +} +int rte_eal_check_module (const char *module_name) {
lib/librte_eal/rte_eal_version.map +3 -0
@@ -241,10 +241,13 @@ EXPERIMENTAL { DPDK_17.11 { global: + rte_eal_create_uio_dev; rte_bus_get_iommu_class; + rte_eal_has_pci; rte_eal_iova_mode; rte_eal_mbuf_default_mempool_ops; rte_eal_using_phys_addrs; + rte_eal_vfio_intr_mode; rte_lcore_has_role; rte_memcpy_ptr; rte_pci_get_iommu_class;
Signature · 1 line
2.1.4
PATCH v8 7/25 eal: expose vfio symbols
In reply to Gaetan RivetThe following symbols are used by vfio implementations within the PCI bus. They need to be publicly available for the PCI bus to be outside the EAL.
+ vfio_enable;
+ vfio_is_enabled;
+ vfio_noiommu_is_enabled;
+ vfio_release_device;
+ vfio_setup_device;
--- drivers/bus/fslmc/fslmc_vfio.h | 2 + lib/librte_eal/bsdapp/eal/eal.c | 41 ++++++++ lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/include/rte_vfio.h | 139 +++++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal.c | 1 + lib/librte_eal/linuxapp/eal/eal_interrupts.c | 1 + lib/librte_eal/linuxapp/eal/eal_pci.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci_init.h | 4 +- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 1 + lib/librte_eal/linuxapp/eal/eal_vfio.c | 1 + lib/librte_eal/linuxapp/eal/eal_vfio.h | 26 ----- lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 2 + lib/librte_eal/rte_eal_version.map | 5 + 13 files changed, 197 insertions(+), 30 deletions(-) create mode 100644 lib/librte_eal/common/include/rte_vfio.h
drivers/bus/fslmc/fslmc_vfio.h +2 -0
@@ -34,6 +34,8 @@#ifndef _FSLMC_VFIO_H_#define _FSLMC_VFIO_H_ +#include <rte_vfio.h> +#include "eal_vfio.h" #define DPAA2_MC_DPNI_DEVID 7
lib/librte_eal/bsdapp/eal/eal.c +41 -0
44 lines not on this page · raw message
lib/librte_eal/common/Makefile +1 -1
@@ -43,7 +43,7 @@ INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_vdev.h INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h INC += rte_malloc.h rte_keepalive.h rte_time.h INC += rte_service.h rte_service_component.h -INC += rte_bitmap.h +INC += rte_bitmap.h rte_vfio.h GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h
lib/librte_eal/common/include/rte_vfio.h new file +139 -0
139 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal.c +1 -0
@@ -77,6 +77,7 @@#include <rte_version.h> #include <rte_atomic.h> #include <malloc_heap.h> +#include <rte_vfio.h> #include "eal_private.h" #include "eal_thread.h"
lib/librte_eal/linuxapp/eal/eal_interrupts.c +1 -0
@@ -65,6 +65,7 @@#include <rte_errno.h> #include <rte_spinlock.h> #include <rte_pause.h> +#include <rte_vfio.h> #include "eal_private.h" #include "eal_vfio.h"
lib/librte_eal/linuxapp/eal/eal_pci.c +1 -1
@@ -41,11 +41,11 @@#include <rte_malloc.h> #include <rte_devargs.h> #include <rte_memcpy.h> +#include <rte_vfio.h> #include "eal_filesystem.h" #include "eal_private.h" #include "eal_pci_init.h" -#include "eal_vfio.h" /** * @file
lib/librte_eal/linuxapp/eal/eal_pci_init.h +2 -2
@@ -34,7 +34,7 @@#ifndef EAL_PCI_INIT_H_ #define EAL_PCI_INIT_H_ -#include "eal_vfio.h" +#include <rte_vfio.h> /** IO resource type: */ #define IORESOURCE_IO 0x00000100
@@ -72,7 +72,7 @@ void pci_uio_ioport_write(struct rte_pci_ioport *p, const void *data, size_t len, off_t offset);int pci_uio_ioport_unmap (struct rte_pci_ioport *p); -#ifdef VFIO_PRESENT +#ifdef RTE_EAL_VFIO /* access config space */ int pci_vfio_read_config(const struct rte_intr_handle *intr_handle,
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +1 -0
@@ -44,6 +44,7 @@#include <rte_pci.h> #include <rte_eal_memconfig.h> #include <rte_malloc.h> +#include <rte_vfio.h> #include "eal_filesystem.h" #include "eal_pci_init.h"
lib/librte_eal/linuxapp/eal/eal_vfio.c +1 -0
@@ -39,6 +39,7 @@#include <rte_log.h> #include <rte_memory.h> #include <rte_eal_memconfig.h> +#include <rte_vfio.h> #include "eal_filesystem.h" #include "eal_vfio.h"
lib/librte_eal/linuxapp/eal/eal_vfio.h +0 -26
@@ -144,15 +144,6 @@ struct vfio_config {struct vfio_group vfio_groups[VFIO_MAX_GROUPS ]; }; -#define VFIO_DIR "/dev/vfio" -#define VFIO_CONTAINER_PATH "/dev/vfio/vfio" -#define VFIO_GROUP_FMT "/dev/vfio/%u" -#define VFIO_NOIOMMU_GROUP_FMT "/dev/vfio/noiommu-%u" -#define VFIO_GET_REGION_ADDR (x) ((uint64_t) x << 40ULL) -#define VFIO_GET_REGION_IDX (x) (x >> 40) -#define VFIO_NOIOMMU_MODE \ - "/sys/module/vfio/parameters/enable_unsafe_noiommu_mode" -/* DMA mapping function prototype. * Takes VFIO container fd as a parameter. * Returns 0 on success, -1 on error.
@@ -192,27 +183,10 @@ vfio_get_group_fd(int iommu_group_no);int clear_group (int vfio_group_fd); -/** -* Setup vfio_cfg for the device identified by its address. It discovers -* the configured I/O MMU groups or sets a new one for the device. If a new -* groups is assigned, the DMA mapping is performed. -* Returns 0 on success, a negative value on failure and a positive value in -* case the given device cannot be managed this way. -*/ -int vfio_setup_device (const char *sysfs_base,const char *dev_addr, -int *vfio_dev_fd,struct vfio_device_info *device_info); - -int vfio_release_device (const char *sysfs_base,const char *dev_addr,int fd); - -int vfio_enable (const char *modname); -int vfio_is_enabled (const char *modname); -int pci_vfio_is_enabled (void );int vfio_mp_sync_setup (void ); -int vfio_noiommu_is_enabled (void ); -#define SOCKET_REQ_CONTAINER 0x100#define SOCKET_REQ_GROUP 0x200#define SOCKET_CLR_GROUP 0x300
lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c +2 -0
@@ -52,9 +52,11 @@#include <rte_pci.h> #include <rte_eal_memconfig.h> #include <rte_malloc.h> +#include <rte_vfio.h> #include "eal_filesystem.h" #include "eal_pci_init.h" +#include "eal_vfio.h" #include "eal_thread.h" /**
lib/librte_eal/rte_eal_version.map +5 -0
@@ -252,5 +252,10 @@ DPDK_17.11 { rte_memcpy_ptr; rte_pci_get_iommu_class; rte_pci_match; + vfio_enable; + vfio_is_enabled; + vfio_noiommu_is_enabled; + vfio_release_device; + vfio_setup_device; } DPDK_17.08;
Signature · 1 line
2.1.4
PATCH v8 8/25 vfio: remove useless PCI headers
In reply to Gaetan RivetPCI headers are not necessary and are making this module dependent on the PCI subsystem.
--- lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 2 -- 1 file changed, 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c +0 -2
@@ -49,13 +49,11 @@#endif #include <rte_log.h> -#include <rte_pci.h> #include <rte_eal_memconfig.h> #include <rte_malloc.h> #include <rte_vfio.h> #include "eal_filesystem.h" -#include "eal_pci_init.h" #include "eal_vfio.h" #include "eal_thread.h"
Signature · 1 line
2.1.4
PATCH v8 9/25 vfio: check PCI dependency from within PCI code
In reply to Gaetan RivetPCI sometimes requires vfio to be enabled.
Move the check from EAL init to PCI bus scan.
--- lib/librte_eal/linuxapp/eal/eal.c | 5 ----- lib/librte_eal/linuxapp/eal/eal_pci.c | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-)
lib/librte_eal/linuxapp/eal/eal.c +0 -5
@@ -715,11 +715,6 @@ static int rte_eal_vfio_setup(void)return -1 ; vfio_enabled =vfio_is_enabled ("vfio" ); -if (!internal_config.no_pci) { -if (!pci_vfio_is_enabled ()) -RTE_LOG (DEBUG ,EAL ,"VFIO PCI modules not loaded\n" ); - } -if (vfio_enabled) {/* if we are primary process, create a thread to communicate with
lib/librte_eal/linuxapp/eal/eal_pci.c +5 -0
@@ -460,6 +460,11 @@ rte_pci_scan(void)if (internal_config.no_pci)return 0 ; +#ifdef VFIO_PRESENT +if (!pci_vfio_is_enabled ()) +RTE_LOG (DEBUG ,EAL ,"VFIO PCI modules not loaded\n" ); +#endif + dir =opendir (pci_get_sysfs_path ());if (dir ==NULL ) { RTE_LOG(ERR, EAL, "%s(): opendir failed: %s\n",
Signature · 1 line
2.1.4
PATCH v8 10/25 vfio: move PCI-related symbols out of vfio header
In reply to Gaetan RivetThese symbols are only relevant to PCI operations.
Move them to a private PCI-related header, allowing to remove the dependency of the PCI subsystem upon private eal_vfio.h.
--- lib/librte_eal/linuxapp/eal/eal_pci_init.h | 14 ++++++++++++++ lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 3 +-- lib/librte_eal/linuxapp/eal/eal_vfio.h | 12 ------------ 3 files changed, 15 insertions(+), 14 deletions(-)
lib/librte_eal/linuxapp/eal/eal_pci_init.h +14 -0
@@ -34,6 +34,8 @@#ifndef EAL_PCI_INIT_H_ #define EAL_PCI_INIT_H_ +#include <linux/version.h> +#include <rte_vfio.h> /** IO resource type: */
@@ -74,6 +76,16 @@ int pci_uio_ioport_unmap(struct rte_pci_ioport *p);#ifdef RTE_EAL_VFIO +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,10 ,0 ) +#define RTE_PCI_MSIX_TABLE_BIR 0x7 +#define RTE_PCI_MSIX_TABLE_OFFSET 0xfffffff8 +#define RTE_PCI_MSIX_FLAGS_QSIZE 0x07ff +#else +#define RTE_PCI_MSIX_TABLE_BIR PCI_MSIX_TABLE_BIR +#define RTE_PCI_MSIX_TABLE_OFFSET PCI_MSIX_TABLE_OFFSET +#define RTE_PCI_MSIX_FLAGS_QSIZE PCI_MSIX_FLAGS_QSIZE +#endif +/* access config space */ int pci_vfio_read_config (const struct rte_intr_handle *intr_handle,void *buf,size_t len,off_t offs);
@@ -92,6 +104,8 @@ int pci_vfio_ioport_unmap(struct rte_pci_ioport *p);int pci_vfio_map_resource (struct rte_pci_device *dev);int pci_vfio_unmap_resource (struct rte_pci_device *dev); +int pci_vfio_is_enabled (void ); +#endif #endif /* EAL_PCI_INIT_H_ */
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +1 -2
@@ -48,7 +48,6 @@#include "eal_filesystem.h" #include "eal_pci_init.h" -#include "eal_vfio.h" #include "eal_private.h" /**
@@ -61,7 +60,7 @@* This file is only compiled if CONFIG_RTE_EAL_VFIO is set to "y". */ -#ifdef VFIO_PRESENT +#ifdef RTE_EAL_VFIO #define PAGE_SIZE (sysconf(_SC_PAGESIZE))#define PAGE_MASK (~(PAGE_SIZE - 1))
lib/librte_eal/linuxapp/eal/eal_vfio.h +0 -12
@@ -42,16 +42,6 @@#if LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,6 ,0 )#include <linux/vfio.h> -#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,10 ,0 ) -#define RTE_PCI_MSIX_TABLE_BIR 0x7 -#define RTE_PCI_MSIX_TABLE_OFFSET 0xfffffff8 -#define RTE_PCI_MSIX_FLAGS_QSIZE 0x07ff -#else -#define RTE_PCI_MSIX_TABLE_BIR PCI_MSIX_TABLE_BIR -#define RTE_PCI_MSIX_TABLE_OFFSET PCI_MSIX_TABLE_OFFSET -#define RTE_PCI_MSIX_FLAGS_QSIZE PCI_MSIX_FLAGS_QSIZE -#endif -#define RTE_VFIO_TYPE1 VFIO_TYPE1_IOMMU#ifndef VFIO_SPAPR_TCE_v2_IOMMU
@@ -183,8 +173,6 @@ vfio_get_group_fd(int iommu_group_no);int clear_group (int vfio_group_fd); -int pci_vfio_is_enabled (void ); -int vfio_mp_sync_setup (void );#define SOCKET_REQ_CONTAINER 0x100
Signature · 1 line
2.1.4
PATCH v8 11/25 pci: avoid inlining functions
In reply to Gaetan RivetParsing operations should not happen in performance critical sections. Headers should not propose implementations unless duly required.
--- lib/librte_eal/common/eal_common_pci.c | 68 ++++++++++++++++++++++++++++++++ lib/librte_eal/common/include/rte_pci.h | 69 +++------------------------------ lib/librte_eal/rte_eal_version.map | 4 ++ 3 files changed, 78 insertions(+), 63 deletions(-)
lib/librte_eal/common/eal_common_pci.c +68 -0
@@ -87,6 +87,74 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)return NULL ; } +/* Macro used by pci addr parsing functions. **/ +#define GET_PCIADDR_FIELD (in, fd, lim, dlm) \ +do { \ + unsigned long val; \ + char *end; \ + errno = 0; \ + val = strtoul((in), &end, 16); \ + if (errno != 0 || end[0] != (dlm) || val > (lim)) \ + return -EINVAL; \ + (fd) = (typeof (fd))val; \ + (in) = end + 1; \ +} while(0) + + +int +eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr) +{ + dev_addr->domain =0 ; +GET_PCIADDR_FIELD (input, dev_addr->bus,UINT8_MAX ,':' ); +GET_PCIADDR_FIELD (input, dev_addr->devid,UINT8_MAX ,'.' ); +GET_PCIADDR_FIELD (input, dev_addr->function,UINT8_MAX ,0 ); +return 0 ; +} + +int +eal_parse_pci_DomBDF (const char *input,struct rte_pci_addr *dev_addr) +{ +GET_PCIADDR_FIELD (input, dev_addr->domain,UINT16_MAX ,':' ); +GET_PCIADDR_FIELD (input, dev_addr->bus,UINT8_MAX ,':' ); +GET_PCIADDR_FIELD (input, dev_addr->devid,UINT8_MAX ,'.' ); +GET_PCIADDR_FIELD (input, dev_addr->function,UINT8_MAX ,0 ); +return 0 ; +} + +#undef GET_PCIADDR_FIELD + +void +rte_pci_device_name (const struct rte_pci_addr *addr, +char *output,size_t size) +{ +RTE_VERIFY (size >=PCI_PRI_STR_SIZE ); +RTE_VERIFY (snprintf (output, size,PCI_PRI_FMT , + addr->domain, addr->bus, + addr->devid, addr->function) >=0 ); +} + +int +rte_eal_compare_pci_addr (const struct rte_pci_addr *addr, +const struct rte_pci_addr *addr2) +{ +uint64_t dev_addr, dev_addr2; + +if ((addr ==NULL ) || (addr2 ==NULL )) +return -1 ; + + dev_addr = ((uint64_t )addr->domain <<24 ) | + (addr->bus <<16 ) | (addr->devid <<8 ) | addr->function; + dev_addr2 = ((uint64_t )addr2->domain <<24 ) | + (addr2->bus <<16 ) | (addr2->devid <<8 ) | addr2->function; + +if (dev_addr > dev_addr2) +return 1 ; +else if (dev_addr < dev_addr2) +return -1 ; +else +return 0 ; +} +void pci_name_set (struct rte_pci_device *dev) {
lib/librte_eal/common/include/rte_pci.h +6 -63
100 lines not on this page · raw message
lib/librte_eal/rte_eal_version.map +4 -0
@@ -241,8 +241,11 @@ EXPERIMENTAL { DPDK_17.11 { global: + eal_parse_pci_BDF; + eal_parse_pci_DomBDF; rte_eal_create_uio_dev; rte_bus_get_iommu_class; + rte_eal_compare_pci_addr; rte_eal_has_pci; rte_eal_iova_mode; rte_eal_mbuf_default_mempool_ops;
@@ -250,6 +253,7 @@ DPDK_17.11 { rte_eal_vfio_intr_mode; rte_lcore_has_role; rte_memcpy_ptr; + rte_pci_device_name; rte_pci_get_iommu_class; rte_pci_match; vfio_enable;
Signature · 1 line
2.1.4
PATCH v8 12/25 pci: avoid over-complicated macro
In reply to Gaetan RivetUsing a macro helps writing the code to the detriment of the reader in this case. This is backward. Write once, read many.
The few LOCs gained is not worth the opacity of the implementation.
--- lib/librte_eal/common/eal_common_pci.c | 67 +++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 21 deletions(-)
lib/librte_eal/common/eal_common_pci.c +46 -21
@@ -87,42 +87,67 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)return NULL ; } -/* Macro used by pci addr parsing functions. **/ -#define GET_PCIADDR_FIELD (in, fd, lim, dlm) \ -do { \ - unsigned long val; \ - char *end; \ - errno = 0; \ - val = strtoul((in), &end, 16); \ - if (errno != 0 || end[0] != (dlm) || val > (lim)) \ - return -EINVAL; \ - (fd) = (typeof (fd))val; \ - (in) = end + 1; \ -} while(0) +static inline const char * +get_u8_pciaddr_field (const char *in,void *_u8,char dlm) +{ +unsigned long val; +uint8_t *u8 = _u8; +char *end; + + errno =0 ; + val =strtoul (in, &end,16 ); +if (errno !=0 || end[0 ] != dlm || val >UINT8_MAX ) { + errno = errno ? errno :EINVAL ; +return NULL ; + } + *u8 = (uint8_t )val; +return end +1 ; +}int eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr) { +const char *in = input; + dev_addr->domain =0 ; -GET_PCIADDR_FIELD (input, dev_addr->bus,UINT8_MAX ,':' ); -GET_PCIADDR_FIELD (input, dev_addr->devid,UINT8_MAX ,'.' ); -GET_PCIADDR_FIELD (input, dev_addr->function,UINT8_MAX ,0 ); + in =get_u8_pciaddr_field (in, &dev_addr->bus,':' ); +if (in ==NULL ) +return -EINVAL ; + in =get_u8_pciaddr_field (in, &dev_addr->devid,'.' ); +if (in ==NULL ) +return -EINVAL ; + in =get_u8_pciaddr_field (in, &dev_addr->function,'\0' ); +if (in ==NULL ) +return -EINVAL ;return 0 ; }int eal_parse_pci_DomBDF (const char *input,struct rte_pci_addr *dev_addr) { -GET_PCIADDR_FIELD (input, dev_addr->domain,UINT16_MAX ,':' ); -GET_PCIADDR_FIELD (input, dev_addr->bus,UINT8_MAX ,':' ); -GET_PCIADDR_FIELD (input, dev_addr->devid,UINT8_MAX ,'.' ); -GET_PCIADDR_FIELD (input, dev_addr->function,UINT8_MAX ,0 ); +const char *in = input; +unsigned long val; +char *end; + + errno =0 ; + val =strtoul (in, &end,16 ); +if (errno !=0 || end[0 ] !=':' || val >UINT16_MAX ) +return -EINVAL ; + dev_addr->domain = (uint16_t )val; + in = end +1 ; + in =get_u8_pciaddr_field (in, &dev_addr->bus,':' ); +if (in ==NULL ) +return -EINVAL ; + in =get_u8_pciaddr_field (in, &dev_addr->devid,'.' ); +if (in ==NULL ) +return -EINVAL ; + in =get_u8_pciaddr_field (in, &dev_addr->function,'\0' ); +if (in ==NULL ) +return -EINVAL ;return 0 ; } -#undef GET_PCIADDR_FIELD -void rte_pci_device_name (const struct rte_pci_addr *addr,char *output,size_t size)
Signature · 1 line
2.1.4
PATCH v8 13/25 pci: deprecate misnamed functions
In reply to Gaetan RivetRename misnamed functions and describe the change in a deprecation notice.
--- doc/guides/rel_notes/deprecation.rst | 9 +++++++ lib/librte_eal/common/eal_common_pci.c | 27 ++++++++++++++++--- lib/librte_eal/common/include/rte_pci.h | 47 +++++++++++++++++++++++++++++++++ lib/librte_eal/rte_eal_version.map | 3 +++ 4 files changed, 82 insertions(+), 4 deletions(-)
doc/guides/rel_notes/deprecation.rst +9 -0
@@ -60,3 +60,12 @@ Deprecation Notices * librte_meter: The API will change to accommodate configuration profiles. Most of the API functions will have an additional opaque parameter. + +* pci: Several exposed functions are misnamed. + The following functions are deprecated starting from v17.11 and are replaced: + + - ``eal_parse_pci_BDF`` replaced by ``rte_pci_bdf_parse`` + - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_dbdf_parse`` + - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` + + The functions are only renamed. Their behavior is not affected.
lib/librte_eal/common/eal_common_pci.c +23 -4
@@ -106,7 +106,7 @@ get_u8_pciaddr_field(const char *in, void *_u8, char dlm)int -eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr) +rte_pci_bdf_parse (const char *input,struct rte_pci_addr *dev_addr) {const char *in = input;
@@ -124,7 +124,13 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr) }int -eal_parse_pci_DomBDF (const char *input,struct rte_pci_addr *dev_addr) +eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr) +{ +return rte_pci_bdf_parse (input, dev_addr); +} + +int +rte_pci_dbdf_parse (const char *input,struct rte_pci_addr *dev_addr) {const char *in = input;unsigned long val;
@@ -148,6 +154,12 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)return 0 ; } +int +eal_parse_pci_DomBDF (const char *input,struct rte_pci_addr *dev_addr) +{ +return rte_pci_dbdf_parse (input, dev_addr); +} +void rte_pci_device_name (const struct rte_pci_addr *addr,char *output,size_t size)
@@ -159,8 +171,8 @@ rte_pci_device_name(const struct rte_pci_addr *addr, }int -rte_eal_compare_pci_addr (const struct rte_pci_addr *addr, -const struct rte_pci_addr *addr2) +rte_pci_addr_cmp (const struct rte_pci_addr *addr, +const struct rte_pci_addr *addr2) {uint64_t dev_addr, dev_addr2;
@@ -180,6 +192,13 @@ rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,return 0 ; } +int +rte_eal_compare_pci_addr (const struct rte_pci_addr *addr, +const struct rte_pci_addr *addr2) +{ +return rte_pci_addr_cmp (addr, addr2); +} +void pci_name_set (struct rte_pci_device *dev) {
lib/librte_eal/common/include/rte_pci.h +47 -0
65 lines not on this page · raw message
lib/librte_eal/rte_eal_version.map +3 -0
@@ -253,6 +253,9 @@ DPDK_17.11 { rte_eal_vfio_intr_mode; rte_lcore_has_role; rte_memcpy_ptr; + rte_pci_addr_cmp; + rte_pci_bdf_parse; + rte_pci_dbdf_parse; rte_pci_device_name; rte_pci_get_iommu_class; rte_pci_match;
Signature · 1 line
2.1.4
PATCH v8 14/25 pci: introduce PCI address parsing function
In reply to Gaetan RivetA new single function that is able to parse all currently supported format:
* Domain-Bus-Device-Function
* Bus-Device-Function
--- lib/librte_eal/common/eal_common_pci.c | 9 +++++++++ lib/librte_eal/common/include/rte_pci.h | 14 ++++++++++++++ lib/librte_eal/rte_eal_version.map | 1 + 3 files changed, 24 insertions(+)
lib/librte_eal/common/eal_common_pci.c +9 -0
@@ -199,6 +199,15 @@ rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,return rte_pci_addr_cmp (addr, addr2); } +int +rte_pci_addr_parse (const char *str,struct rte_pci_addr *addr) +{ +if (rte_pci_bdf_parse (str, addr) ==0 || +rte_pci_dbdf_parse (str, addr) ==0 ) +return 0 ; +return -1 ; +} +void pci_name_set (struct rte_pci_device *dev) {
lib/librte_eal/common/include/rte_pci.h +14 -0
@@ -347,6 +347,20 @@ int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr, const struct rte_pci_addr *addr2);/** +* Utility function to parse a string into a PCI location. +* +* @param str +* The string to parse +* @param addr +* The reference to the structure where the location +* is stored. +* @return +* 0 on success +* <0 otherwise +*/ +int rte_pci_addr_parse (const char *str,struct rte_pci_addr *addr); + +/** * Scan the content of the PCI bus, and the devices in the devices * list *
lib/librte_eal/rte_eal_version.map +1 -0
@@ -254,6 +254,7 @@ DPDK_17.11 { rte_lcore_has_role; rte_memcpy_ptr; rte_pci_addr_cmp; + rte_pci_addr_parse; rte_pci_bdf_parse; rte_pci_dbdf_parse; rte_pci_device_name;
Signature · 1 line
2.1.4
PATCH v8 15/25 pci: make specialized parsing functions private
In reply to Gaetan RivetDo not expose the minute implementations of PCI parsing. This leaves only the all-purpose rte_pci_addr_parse, which is simpler to use.
--- doc/guides/rel_notes/deprecation.rst | 6 ++---- lib/librte_eal/common/eal_common_pci.c | 4 ++-- lib/librte_eal/common/include/rte_pci.h | 29 ----------------------------- lib/librte_eal/rte_eal_version.map | 2 -- 4 files changed, 4 insertions(+), 37 deletions(-)
doc/guides/rel_notes/deprecation.rst +2 -4
@@ -64,8 +64,6 @@ Deprecation Notices * pci: Several exposed functions are misnamed. The following functions are deprecated starting from v17.11 and are replaced: - - ``eal_parse_pci_BDF`` replaced by ``rte_pci_bdf_parse`` - - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_dbdf_parse`` + - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse`` + - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_addr_parse`` - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` - - The functions are only renamed. Their behavior is not affected.
lib/librte_eal/common/eal_common_pci.c +2 -2
@@ -105,7 +105,7 @@ get_u8_pciaddr_field(const char *in, void *_u8, char dlm) } -int +static int rte_pci_bdf_parse (const char *input,struct rte_pci_addr *dev_addr) {const char *in = input;
@@ -129,7 +129,7 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)return rte_pci_bdf_parse (input, dev_addr); } -int +static int rte_pci_dbdf_parse (const char *input,struct rte_pci_addr *dev_addr) {const char *in = input;
lib/librte_eal/common/include/rte_pci.h +0 -29
@@ -241,21 +241,6 @@ struct mapped_pci_resource {TAILQ_HEAD (mapped_pci_res_list, mapped_pci_resource);/** -* Utility function to produce a PCI Bus-Device-Function value -* given a string representation. Assumes that the BDF is provided without -* a domain prefix (i.e. domain returned is always 0) -* -* @param input -* The input string to be parsed. Should have the format XX:XX.X -* @param dev_addr -* The PCI Bus-Device-Function address to be returned. Domain will always be -* returned as 0 -* @return -* 0 on success, negative on error. -*/ -int rte_pci_bdf_parse (const char *input,struct rte_pci_addr *dev_addr); - -/** * @deprecated * Utility function to produce a PCI Bus-Device-Function value * given a string representation. Assumes that the BDF is provided without
@@ -272,20 +257,6 @@ int rte_pci_bdf_parse(const char *input, struct rte_pci_addr *dev_addr);int eal_parse_pci_BDF (const char *input,struct rte_pci_addr *dev_addr);/** -* Utility function to produce a PCI Bus-Device-Function value -* given a string representation. Assumes that the BDF is provided including -* a domain prefix. -* -* @param input -* The input string to be parsed. Should have the format XXXX:XX:XX.X -* @param dev_addr -* The PCI Bus-Device-Function address to be returned -* @return -* 0 on success, negative on error. -*/ -int rte_pci_dbdf_parse (const char *input,struct rte_pci_addr *dev_addr); - -/** * @deprecated * Utility function to produce a PCI Bus-Device-Function value * given a string representation. Assumes that the BDF is provided including
lib/librte_eal/rte_eal_version.map +0 -2
@@ -255,8 +255,6 @@ DPDK_17.11 { rte_memcpy_ptr; rte_pci_addr_cmp; rte_pci_addr_parse; - rte_pci_bdf_parse; - rte_pci_dbdf_parse; rte_pci_device_name; rte_pci_get_iommu_class; rte_pci_match;
Signature · 1 line
2.1.4
PATCH v8 16/25 pci: use new PCI addr comparison function
In reply to Gaetan Rivet--- lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +- lib/librte_eal/common/eal_common_pci.c | 8 ++++---- lib/librte_eal/common/eal_common_pci_uio.c | 4 ++-- lib/librte_eal/linuxapp/eal/eal_pci.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-)
lib/librte_eal/bsdapp/eal/eal_pci.c +1 -1
@@ -323,7 +323,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)int ret; TAILQ_FOREACH(dev2, &rte_pci_bus.device_list, next) { - ret =rte_eal_compare_pci_addr (&dev->addr, &dev2->addr); + ret =rte_pci_addr_cmp (&dev->addr, &dev2->addr);if (ret >0 )continue ;else if (ret <0 ) {
lib/librte_eal/common/eal_common_pci.c +4 -4
@@ -81,7 +81,7 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)if (devargs->bus != pbus)continue ; devargs->bus->parse (devargs->name, &addr); -if (!rte_eal_compare_pci_addr (&dev->addr, &addr)) +if (!rte_pci_addr_cmp (&dev->addr, &addr))return devargs; }return NULL ;
@@ -194,7 +194,7 @@ rte_pci_addr_cmp(const struct rte_pci_addr *addr,int rte_eal_compare_pci_addr (const struct rte_pci_addr *addr, -const struct rte_pci_addr *addr2) +const struct rte_pci_addr *addr2) {return rte_pci_addr_cmp (addr, addr2); }
@@ -467,7 +467,7 @@ rte_pci_probe_one(const struct rte_pci_addr *addr) goto err_return;FOREACH_DEVICE_ON_PCIBUS (dev) { -if (rte_eal_compare_pci_addr (&dev->addr, addr)) +if (rte_pci_addr_cmp (&dev->addr, addr))continue ; ret =pci_probe_all_drivers (dev);
@@ -497,7 +497,7 @@ rte_pci_detach(const struct rte_pci_addr *addr)return -1 ;FOREACH_DEVICE_ON_PCIBUS (dev) { -if (rte_eal_compare_pci_addr (&dev->addr, addr)) +if (rte_pci_addr_cmp (&dev->addr, addr))continue ; ret =rte_pci_detach_dev (dev);
lib/librte_eal/common/eal_common_pci_uio.c +2 -2
@@ -61,7 +61,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev) TAILQ_FOREACH(uio_res, uio_res_list, next) {/* skip this element if it doesn't match our PCI address */ -if (rte_eal_compare_pci_addr (&uio_res->pci_addr, &dev->addr)) +if (rte_pci_addr_cmp (&uio_res->pci_addr, &dev->addr))continue ;for (i =0 ; i != uio_res->nb_maps; i++) {
@@ -187,7 +187,7 @@ pci_uio_find_resource(struct rte_pci_device *dev) TAILQ_FOREACH(uio_res, uio_res_list, next) {/* skip this element if it doesn't match our PCI address */ -if (!rte_eal_compare_pci_addr (&uio_res->pci_addr, &dev->addr)) +if (!rte_pci_addr_cmp (&uio_res->pci_addr, &dev->addr))return uio_res; }return NULL ;
lib/librte_eal/linuxapp/eal/eal_pci.c +1 -1
@@ -363,7 +363,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)int ret; TAILQ_FOREACH(dev2, &rte_pci_bus.device_list, next) { - ret =rte_eal_compare_pci_addr (&dev->addr, &dev2->addr); + ret =rte_pci_addr_cmp (&dev->addr, &dev2->addr);if (ret >0 )continue ;
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +2 -2
@@ -576,8 +576,8 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)/* if we're in a secondary process, just find our tailq entry */ TAILQ_FOREACH(vfio_res, vfio_res_list, next) { -if (rte_eal_compare_pci_addr (&vfio_res->pci_addr, - &dev->addr)) +if (rte_pci_addr_cmp (&vfio_res->pci_addr, + &dev->addr))continue ;break ; }
Signature · 1 line
2.1.4
PATCH v8 17/25 pci: use new PCI addr parsing function
In reply to Gaetan Rivet--- lib/librte_eal/common/eal_common_pci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
lib/librte_eal/common/eal_common_pci.c +1 -2
@@ -599,8 +599,7 @@ pci_parse(const char *name, void *addr)struct rte_pci_addr pci_addr;bool parse; - parse = (eal_parse_pci_BDF (name, &pci_addr) ==0 || -eal_parse_pci_DomBDF (name, &pci_addr) ==0 ); + parse = (rte_pci_addr_parse (name, &pci_addr) ==0 );if (parse && addr !=NULL ) *out = pci_addr;return parse == false;
Signature · 1 line
2.1.4
PATCH v8 18/25 pci: do not expose private functions
In reply to Gaetan Rivetmake the functions
+ rte_pci_detach
+ rte_pci_probe
+ rte_pci_probe_one
+ rte_pci_scan
private as there is no point in using them outside of the rte_bus framework.
--- lib/librte_eal/common/eal_private.h | 49 +++++++++++++++++++++++++++++++++ lib/librte_eal/common/include/rte_pci.h | 49 --------------------------------- lib/librte_eal/rte_eal_version.map | 4 --- 3 files changed, 49 insertions(+), 53 deletions(-)
lib/librte_eal/common/eal_private.h +49 -0
@@ -114,6 +114,55 @@ struct rte_pci_driver;struct rte_pci_device ;/** +* Probe the PCI bus +* +* @return +* - 0 on success. +* - !0 on error. +*/ +int +rte_pci_probe (void ); + +/** +* Scan the content of the PCI bus, and the devices in the devices +* list +* +* @return +* 0 on success, negative on error +*/ +int rte_pci_scan (void ); + +/** +* Probe the single PCI device. +* +* Scan the content of the PCI bus, and find the pci device specified by pci +* address, then call the probe() function for registered driver that has a +* matching entry in its id_table for discovered device. +* +* @param addr +* The PCI Bus-Device-Function address to probe. +* @return +* - 0 on success. +* - Negative on error. +*/ +int rte_pci_probe_one (const struct rte_pci_addr *addr); + +/** +* Close the single PCI device. +* +* Scan the content of the PCI bus, and find the pci device specified by pci +* address, then call the remove() function for registered driver that has a +* matching entry in its id_table for discovered device. +* +* @param addr +* The PCI Bus-Device-Function address to close. +* @return +* - 0 on success. +* - Negative on error. +*/ +int rte_pci_detach (const struct rte_pci_addr *addr); + +/** * Find the name of a PCI device. */ void pci_name_set (struct rte_pci_device *dev);
lib/librte_eal/common/include/rte_pci.h +0 -49
61 lines not on this page · raw message
lib/librte_eal/rte_eal_version.map +0 -4
@@ -166,18 +166,14 @@ DPDK_17.05 { rte_log_set_global_level; rte_log_set_level; rte_log_set_level_regexp; - rte_pci_detach; rte_pci_dump; rte_pci_ioport_map; rte_pci_ioport_read; rte_pci_ioport_unmap; rte_pci_ioport_write; rte_pci_map_device; - rte_pci_probe; - rte_pci_probe_one; rte_pci_read_config; rte_pci_register; - rte_pci_scan; rte_pci_unmap_device; rte_pci_unregister; rte_pci_write_config;
Signature · 1 line
2.1.4
PATCH v8 19/25 pci: do not expose PCI match function
In reply to Gaetan RivetThis function is private to the PCI bus.
--- lib/librte_eal/common/eal_private.h | 15 +++++++++++++++ lib/librte_eal/common/include/rte_pci.h | 16 ---------------- lib/librte_eal/rte_eal_version.map | 1 - 3 files changed, 15 insertions(+), 17 deletions(-)
lib/librte_eal/common/eal_private.h +15 -0
@@ -290,6 +290,21 @@ void pci_uio_free_resource(struct rte_pci_device *dev,int pci_uio_map_resource_by_index (struct rte_pci_device *dev,int res_idx,struct mapped_pci_resource *uio_res,int map_idx); +/* +* Match the PCI Driver and Device using the ID Table +* +* @param pci_drv +* PCI driver from which ID table would be extracted +* @param pci_dev +* PCI device to match against the driver +* @return +* 1 for successful match +* 0 for unsuccessful match +*/ +int +rte_pci_match (const struct rte_pci_driver *pci_drv, +const struct rte_pci_device *pci_dev); +/** * Init tail queues for non-EAL library structures. This is to allow * the rings, mempools, etc. lists to be shared among multiple processes
lib/librte_eal/common/include/rte_pci.h +0 -16
@@ -331,22 +331,6 @@ int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,*/ int rte_pci_addr_parse (const char *str,struct rte_pci_addr *addr); -/* -* Match the PCI Driver and Device using the ID Table -* -* @param pci_drv -* PCI driver from which ID table would be extracted -* @param pci_dev -* PCI device to match against the driver -* @return -* 1 for successful match -* 0 for unsuccessful match -*/ -int -rte_pci_match (const struct rte_pci_driver *pci_drv, -const struct rte_pci_device *pci_dev); - -/** * Get iommu class of PCI devices on the bus. * And return their preferred iova mapping mode.
lib/librte_eal/rte_eal_version.map +0 -1
@@ -253,7 +253,6 @@ DPDK_17.11 { rte_pci_addr_parse; rte_pci_device_name; rte_pci_get_iommu_class; - rte_pci_match; vfio_enable; vfio_is_enabled; vfio_noiommu_is_enabled;
Signature · 1 line
2.1.4
PATCH v8 20/25 pci: do not expose IOVA mode getter
In reply to Gaetan Rivet--- lib/librte_eal/common/eal_private.h | 10 ++++++++++ lib/librte_eal/common/include/rte_pci.h | 10 ---------- lib/librte_eal/rte_eal_version.map | 1 - 3 files changed, 10 insertions(+), 11 deletions(-)
lib/librte_eal/common/eal_private.h +10 -0
@@ -306,6 +306,16 @@ rte_pci_match(const struct rte_pci_driver *pci_drv, const struct rte_pci_device *pci_dev);/** +* Get iommu class of PCI devices on the bus. +* And return their preferred iova mapping mode. +* +* @return +* - enum rte_iova_mode. +*/ +enum rte_iova_mode +rte_pci_get_iommu_class (void ); + +/** * Init tail queues for non-EAL library structures. This is to allow * the rings, mempools, etc. lists to be shared among multiple processes *
lib/librte_eal/common/include/rte_pci.h +0 -10
@@ -332,16 +332,6 @@ int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,int rte_pci_addr_parse (const char *str,struct rte_pci_addr *addr);/** -* Get iommu class of PCI devices on the bus. -* And return their preferred iova mapping mode. -* -* @return -* - enum rte_iova_mode. -*/ -enum rte_iova_mode -rte_pci_get_iommu_class (void ); - -/** * Map the PCI device resources in user space virtual memory address * * Note that driver should not call this function when flag
lib/librte_eal/rte_eal_version.map +0 -1
@@ -252,7 +252,6 @@ DPDK_17.11 { rte_pci_addr_cmp; rte_pci_addr_parse; rte_pci_device_name; - rte_pci_get_iommu_class; vfio_enable; vfio_is_enabled; vfio_noiommu_is_enabled;
Signature · 1 line
2.1.4
PATCH v8 21/25 pci: use EAL exposed configuration
In reply to Gaetan Rivet--- lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 18 +++++++++++------- 4 files changed, 14 insertions(+), 10 deletions(-)
lib/librte_eal/bsdapp/eal/eal_pci.c +1 -1
@@ -368,7 +368,7 @@ rte_pci_scan(void) };/* for debug purposes, PCI can be disabled */ -if (internal_config.no_pci) +if (!rte_eal_has_pci ())return 0 ; fd =open ("/dev/pci" ,O_RDONLY );
lib/librte_eal/linuxapp/eal/eal_pci.c +1 -1
@@ -457,7 +457,7 @@ rte_pci_scan(void)struct rte_pci_addr addr;/* for debug purposes, PCI can be disabled */ -if (internal_config.no_pci) +if (!rte_eal_has_pci ())return 0 ;#ifdef VFIO_PRESENT
lib/librte_eal/linuxapp/eal/eal_pci_uio.c +1 -1
@@ -214,7 +214,7 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,return -1 ;/* create uio device if we've been asked to */ -if (internal_config.create_uio_dev && create && +if (rte_eal_create_uio_dev () && create &&pci_mknod_uio_dev (dstbuf, uio_num) <0 )RTE_LOG (WARNING ,EAL ,"Cannot create /dev/uio%u\n" , uio_num);
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +11 -7
@@ -209,14 +209,18 @@ static int pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd) { int i, ret, intr_idx; +enum rte_intr_mode intr_mode;/* default to invalid index */ intr_idx =VFIO_PCI_NUM_IRQS ; +/* Get default / configured intr_mode */ + intr_mode =rte_eal_vfio_intr_mode (); +/* get interrupt type from internal config (MSI-X by default, can be * overridden from the command line */ -switch (internal_config.vfio_intr_mode) { +switch (intr_mode) {case RTE_INTR_MODE_MSIX : intr_idx =VFIO_PCI_MSIX_IRQ_INDEX ;break ;
@@ -240,7 +244,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)int fd =-1 ;/* skip interrupt modes we don't want */ -if (internal_config.vfio_intr_mode !=RTE_INTR_MODE_NONE && +if (intr_mode !=RTE_INTR_MODE_NONE && i != intr_idx)continue ;
@@ -256,7 +260,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)/* if this vector cannot be used with eventfd, fail if we explicitly * specified interrupt type, otherwise continue */ if ((irq.flags &VFIO_IRQ_INFO_EVENTFD ) ==0 ) { -if (internal_config.vfio_intr_mode !=RTE_INTR_MODE_NONE ) { +if (intr_mode !=RTE_INTR_MODE_NONE ) {RTE_LOG (ERR ,EAL ," interrupt vector does not support eventfd!\n" );return -1 ;
@@ -277,15 +281,15 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)switch (i) {case VFIO_PCI_MSIX_IRQ_INDEX : - internal_config.vfio_intr_mode =RTE_INTR_MODE_MSIX ; + intr_mode =RTE_INTR_MODE_MSIX ; dev->intr_handle.type =RTE_INTR_HANDLE_VFIO_MSIX ;break ;case VFIO_PCI_MSI_IRQ_INDEX : - internal_config.vfio_intr_mode =RTE_INTR_MODE_MSI ; + intr_mode =RTE_INTR_MODE_MSI ; dev->intr_handle.type =RTE_INTR_HANDLE_VFIO_MSI ;break ;case VFIO_PCI_INTX_IRQ_INDEX : - internal_config.vfio_intr_mode =RTE_INTR_MODE_LEGACY ; + intr_mode =RTE_INTR_MODE_LEGACY ; dev->intr_handle.type =RTE_INTR_HANDLE_VFIO_LEGACY ;break ;default :
@@ -615,7 +619,7 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)int pci_vfio_map_resource (struct rte_pci_device *dev) { -if (internal_config.process_type ==RTE_PROC_PRIMARY ) +if (rte_eal_process_type () ==RTE_PROC_PRIMARY )return pci_vfio_map_resource_primary (dev);else return pci_vfio_map_resource_secondary (dev);
Signature · 1 line
2.1.4
PATCH v8 22/25 net/bonding: use local prefix for local function
In reply to Gaetan RivetThe current name conflicts with the librte_pci naming convention. Additionally, it is easier to use gdb when having prefixed even private functions.
--- drivers/net/bonding/rte_eth_bond_args.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/bonding/rte_eth_bond_args.c +2 -2
@@ -89,7 +89,7 @@ find_port_id_by_dev_name(const char *name) }static inline int -pci_addr_cmp (const struct rte_device *dev,const void *_pci_addr) +bond_pci_addr_cmp (const struct rte_device *dev,const void *_pci_addr) {struct rte_pci_device *pdev;const struct rte_pci_addr *paddr = _pci_addr;
@@ -118,7 +118,7 @@ parse_port_id(const char *port_str)/* try parsing as pci address, physical devices */ if (pci_bus->parse (port_str, &dev_addr) ==0 ) { - dev = pci_bus->find_device (NULL , pci_addr_cmp, &dev_addr); + dev = pci_bus->find_device (NULL , bond_pci_addr_cmp, &dev_addr);if (dev ==NULL ) {RTE_LOG (ERR ,PMD ,"unable to find PCI device\n" );return -1 ;
Signature · 1 line
2.1.4
PATCH v8 23/25 pci: introduce PCI lib and bus
In reply to Gaetan RivetThe PCI lib defines the types and methods allowing to use PCI elements.
The PCI bus implements a bus driver for PCI devices by constructing rte_bus elements using the PCI lib.
Move the relevant code out of the EAL to its expected place.
Libraries, drivers, unit tests and applications are updated to use the new rte_bus_pci.h header when necessary.
--- app/test-pmd/testpmd.h | 1 + config/common_base | 10 + drivers/bus/Makefile | 2 + drivers/bus/pci/Makefile | 62 ++ drivers/bus/pci/bsd/Makefile | 32 ++ drivers/bus/pci/bsd/pci.c | 681 ++++++++++++++++++++++ drivers/bus/pci/include/rte_bus_pci.h | 340 +++++++++++ drivers/bus/pci/linux/Makefile | 36 ++ drivers/bus/pci/linux/pci.c | 826 +++++++++++++++++++++++++++ drivers/bus/pci/linux/pci_init.h | 111 ++++ drivers/bus/pci/linux/pci_uio.c | 568 ++++++++++++++++++ drivers/bus/pci/linux/pci_vfio.c | 756 ++++++++++++++++++++++++ drivers/bus/pci/pci_common.c | 541 ++++++++++++++++++ drivers/bus/pci/pci_common_uio.c | 235 ++++++++ drivers/bus/pci/private.h | 248 ++++++++ drivers/bus/pci/rte_bus_pci_version.map | 17 + drivers/crypto/qat/Makefile | 1 + drivers/crypto/qat/qat_qp.c | 1 + drivers/crypto/qat/rte_qat_cryptodev.c | 1 + drivers/event/octeontx/Makefile | 1 + drivers/event/skeleton/Makefile | 1 + drivers/mempool/octeontx/Makefile | 1 + drivers/mempool/octeontx/octeontx_fpavf.c | 2 +- drivers/mempool/octeontx/octeontx_ssovf.c | 1 + drivers/net/ark/Makefile | 1 + drivers/net/ark/ark_ethdev.c | 1 + drivers/net/avp/Makefile | 1 + drivers/net/avp/avp_ethdev.c | 2 + drivers/net/bnx2x/Makefile | 1 + drivers/net/bnxt/Makefile | 1 + drivers/net/bnxt/bnxt.h | 1 + drivers/net/bonding/Makefile | 1 + drivers/net/bonding/rte_eth_bond_args.c | 1 + drivers/net/cxgbe/Makefile | 1 + drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 1 + drivers/net/e1000/Makefile | 1 + drivers/net/e1000/em_ethdev.c | 1 + drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/e1000/igb_pf.c | 1 + drivers/net/ena/Makefile | 1 + drivers/net/ena/ena_ethdev.h | 1 + drivers/net/enic/Makefile | 1 + drivers/net/enic/base/vnic_dev.h | 4 +- drivers/net/enic/enic_ethdev.c | 1 + drivers/net/enic/enic_main.c | 1 + drivers/net/fm10k/Makefile | 1 + drivers/net/i40e/Makefile | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/ixgbe/Makefile | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 1 + drivers/net/ixgbe/ixgbe_ethdev.h | 1 + drivers/net/liquidio/Makefile | 1 + drivers/net/mlx4/Makefile | 1 + drivers/net/mlx4/mlx4_ethdev.c | 1 + drivers/net/mlx5/Makefile | 1 + drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/nfp/Makefile | 1 + drivers/net/nfp/nfp_nfpu.c | 2 +- drivers/net/nfp/nfp_nfpu.h | 2 +- drivers/net/octeontx/Makefile | 1 + drivers/net/octeontx/base/octeontx_pkivf.c | 2 +- drivers/net/octeontx/base/octeontx_pkovf.c | 2 +- drivers/net/qede/Makefile | 1 + drivers/net/sfc/Makefile | 1 + drivers/net/sfc/sfc.h | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/szedata2/Makefile | 1 + drivers/net/thunderx/Makefile | 1 + drivers/net/thunderx/nicvf_ethdev.c | 1 + drivers/net/virtio/Makefile | 1 + drivers/net/virtio/virtio_ethdev.c | 1 + drivers/net/virtio/virtio_pci.h | 1 + drivers/net/vmxnet3/Makefile | 1 + drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 + lib/Makefile | 2 + lib/librte_eal/bsdapp/eal/Makefile | 3 - lib/librte_eal/bsdapp/eal/eal.c | 1 - lib/librte_eal/bsdapp/eal/eal_pci.c | 680 ---------------------- lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_pci.c | 699 ----------------------- lib/librte_eal/common/eal_common_pci_uio.c | 233 -------- lib/librte_eal/common/eal_private.h | 206 ------- lib/librte_eal/common/include/rte_pci.h | 533 ----------------- lib/librte_eal/linuxapp/eal/Makefile | 8 - lib/librte_eal/linuxapp/eal/eal.c | 1 - lib/librte_eal/linuxapp/eal/eal_interrupts.c | 1 - lib/librte_eal/linuxapp/eal/eal_pci.c | 823 -------------------------- lib/librte_eal/linuxapp/eal/eal_pci_init.h | 111 ---- lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 567 ------------------ lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 754 ------------------------ lib/librte_eal/rte_eal_version.map | 17 - lib/librte_ether/rte_ethdev.h | 2 - lib/librte_ether/rte_ethdev_pci.h | 1 + lib/librte_eventdev/rte_eventdev_pmd_pci.h | 1 + lib/librte_pci/Makefile | 49 ++ lib/librte_pci/include/rte_pci.h | 279 +++++++++ lib/librte_pci/rte_pci.c | 220 +++++++ lib/librte_pci/rte_pci_version.map | 15 + mk/rte.app.mk | 3 + test/test/test_kni.c | 1 + test/test/virtual_pmd.c | 1 + 104 files changed, 5103 insertions(+), 4646 deletions(-) create mode 100644 drivers/bus/pci/Makefile create mode 100644 drivers/bus/pci/bsd/Makefile create mode 100644 drivers/bus/pci/bsd/pci.c create mode 100644 drivers/bus/pci/include/rte_bus_pci.h create mode 100644 drivers/bus/pci/linux/Makefile create mode 100644 drivers/bus/pci/linux/pci.c create mode 100644 drivers/bus/pci/linux/pci_init.h create mode 100644 drivers/bus/pci/linux/pci_uio.c create mode 100644 drivers/bus/pci/linux/pci_vfio.c create mode 100644 drivers/bus/pci/pci_common.c create mode 100644 drivers/bus/pci/pci_common_uio.c create mode 100644 drivers/bus/pci/private.h create mode 100644 drivers/bus/pci/rte_bus_pci_version.map delete mode 100644 lib/librte_eal/bsdapp/eal/eal_pci.c delete mode 100644 lib/librte_eal/common/eal_common_pci.c delete mode 100644 lib/librte_eal/common/eal_common_pci_uio.c delete mode 100644 lib/librte_eal/common/include/rte_pci.h delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci.c delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_init.h delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_uio.c delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c create mode 100644 lib/librte_pci/Makefile create mode 100644 lib/librte_pci/include/rte_pci.h create mode 100644 lib/librte_pci/rte_pci.c create mode 100644 lib/librte_pci/rte_pci_version.map
app/test-pmd/testpmd.h +1 -0
@@ -35,6 +35,7 @@#define _TESTPMD_H_#include <rte_pci.h> +#include <rte_bus_pci.h> #include <rte_gro.h> #include <rte_gso.h>
config/common_base +10 -0
@@ -123,6 +123,11 @@ CONFIG_RTE_EAL_PMD_PATH="" CONFIG_RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT=y # +# Compile the PCI library +# +CONFIG_RTE_LIBRTE_PCI=y + +# # Compile the argument parser library # CONFIG_RTE_LIBRTE_KVARGS=y
@@ -148,6 +153,11 @@ CONFIG_RTE_ETHDEV_PROFILE_ITT_WASTED_RX_ITERATIONS=n CONFIG_RTE_ETHDEV_TX_PREPARE_NOOP=n # +# Compile PCI bus driver +# +CONFIG_RTE_LIBRTE_PCI_BUS=y + +# # Compile burst-oriented Amazon ENA PMD driver # CONFIG_RTE_LIBRTE_ENA_PMD=y
drivers/bus/Makefile +2 -0
@@ -36,4 +36,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += dpaa DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc +DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci + include $(RTE_SDK)/mk/rte.subdir.mk
drivers/bus/pci/Makefile new file +62 -0
62 lines not on this page · raw message
drivers/bus/pci/bsd/Makefile new file +32 -0
@@ -0,0 +1,32 @@ +# BSD LICENSE +# +# Copyright(c) 2017 6WIND S.A. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SRCS += pci.c
drivers/bus/pci/bsd/pci.c new file +681 -0
681 lines not on this page · raw message
drivers/bus/pci/include/rte_bus_pci.h new file +340 -0
340 lines not on this page · raw message
drivers/bus/pci/linux/Makefile new file +36 -0
@@ -0,0 +1,36 @@ +# BSD LICENSE +# +# Copyright(c) 2017 6WIND S.A. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of 6WIND nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +SRCS += pci.c +SRCS += pci_uio.c +SRCS += pci_vfio.c + +CFLAGS += -D_GNU_SOURCE
drivers/bus/pci/linux/pci.c new file +826 -0
826 lines not on this page · raw message
drivers/bus/pci/linux/pci_init.h new file +111 -0
111 lines not on this page · raw message
drivers/bus/pci/linux/pci_uio.c new file +568 -0
568 lines not on this page · raw message
drivers/bus/pci/linux/pci_vfio.c new file +756 -0
309 lines not on this page · raw message
drivers/bus/pci/pci_common.c new file +541 -0
541 lines not on this page · raw message
drivers/bus/pci/pci_common_uio.c new file +235 -0
235 lines not on this page · raw message
drivers/bus/pci/private.h new file +248 -0
248 lines not on this page · raw message
drivers/bus/pci/rte_bus_pci_version.map new file +17 -0
Lines of this file are not shown. View the raw message.
drivers/mempool/octeontx/octeontx_fpavf.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/mempool/octeontx/octeontx_ssovf.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/bonding/rte_eth_bond_args.c +1 -0
Lines of this file are not shown. View the raw message.
drivers/net/octeontx/base/octeontx_pkivf.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/octeontx/base/octeontx_pkovf.c +1 -1
Lines of this file are not shown. View the raw message.
lib/librte_eal/bsdapp/eal/eal_pci.c deleted +0 -680
680 lines not on this page · raw message
lib/librte_eal/common/eal_common_pci.c deleted +0 -699
699 lines not on this page · raw message
lib/librte_eal/common/eal_common_pci_uio.c deleted +0 -233
233 lines not on this page · raw message
lib/librte_eal/common/eal_private.h +0 -206
206 lines not on this page · raw message
lib/librte_eal/common/include/rte_pci.h deleted +0 -533
533 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal_interrupts.c +0 -1
Lines of this file are not shown. View the raw message.
lib/librte_eal/linuxapp/eal/eal_pci.c deleted +0 -823
823 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal_pci_init.h deleted +0 -111
111 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal_pci_uio.c deleted +0 -567
567 lines not on this page · raw message
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c deleted +0 -754
754 lines not on this page · raw message
lib/librte_eventdev/rte_eventdev_pmd_pci.h +1 -0
Lines of this file are not shown. View the raw message.
lib/librte_pci/Makefile new file +49 -0
49 lines not on this page · raw message
lib/librte_pci/include/rte_pci.h new file +279 -0
279 lines not on this page · raw message
lib/librte_pci/rte_pci.c new file +220 -0
220 lines not on this page · raw message
lib/librte_pci/rte_pci_version.map new file +15 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.4
Part of the diff is not shown here. View the raw message.
Re: [PATCH v8 23/25] pci: introduce PCI lib and bus
26/10/2017 12:06, Gaetan Rivet:
Quoted 2 lines
Libraries, drivers, unit tests and applications are updated to use the new
rte_bus_pci.hheader when necessary.
Few compilation fixes:
drivers/crypto/qat/qat_crypto.c +1 -0
@@ -60,6 +60,7 @@#include <rte_crypto_sym.h> #include <rte_byteorder.h> #include <rte_pci.h> +#include <rte_bus_pci.h> #include <openssl/evp.h>
drivers/net/bnx2x/bnx2x.h +1 -0
@@ -18,6 +18,7 @@#include <rte_byteorder.h> #include <rte_spinlock.h> +#include <rte_bus_pci.h> #include <rte_io.h> #if RTE_BYTE_ORDER ==RTE_LITTLE_ENDIAN
examples/ethtool/lib/rte_ethtool.c +1 -0
@@ -37,6 +37,7 @@#include <rte_ethdev.h> #include <rte_ether.h> #include <rte_pci.h> +#include <rte_bus_pci.h> #ifdef RTE_LIBRTE_IXGBE_PMD #include <rte_pmd_ixgbe.h> #endif
examples/ip_pipeline/init.c +1 -0
@@ -49,6 +49,7 @@#include <rte_ip.h> #include <rte_eal.h> #include <rte_malloc.h> +#include <rte_bus_pci.h> #include "app.h" #include "pipeline.h"
examples/kni/main.c +1 -0
@@ -62,6 +62,7 @@#include <rte_branch_prediction.h> #include <rte_interrupts.h> #include <rte_pci.h> +#include <rte_bus_pci.h> #include <rte_debug.h> #include <rte_ether.h> #include <rte_ethdev.h>
Re: [PATCH v8 23/25] pci: introduce PCI lib and bus
In reply to Gaetan Rivet26/10/2017 12:06, Gaetan Rivet:
Quoted 4 lines
lib/librte_pci/Makefile | 49 ++ lib/librte_pci/include/rte_pci.h | 279 +++++++++ lib/librte_pci/rte_pci.c | 220 +++++++ lib/librte_pci/rte_pci_version.map | 15 +
The include file is usually not in a sub-directory. I will move it for consistency.
The lib needs also to be added in doc/api/doxy-api.conf and doc/guides/rel_notes/release_17_11.rst
PATCH v8 24/25 doc: add notes on EAL PCI API update
In reply to Gaetan RivetAdd a section related to EAL API changes to 17.11 release notes.
--- doc/guides/rel_notes/release_17_11.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
doc/guides/rel_notes/release_17_11.rst +28 -0
@@ -369,6 +369,34 @@ API Changes the backing device supports the operation or if the operation was successfully performed. +* **PCI bus API moved outside of the EAL** + + The PCI bus previously implemented within the EAL has been moved. + A first part has been added as an RTE library providing PCI helpers to + parse device locations or other such utilities. + A second part consisting in the actual bus driver has been moved to its + proper subdirectory, without changing its functionalities. + + As such, several PCI-related functions are not proposed by the EAL anymore: + + * rte_pci_detach + * rte_pci_dump + * rte_pci_ioport_map + * rte_pci_ioport_read + * rte_pci_ioport_unmap + * rte_pci_ioport_write + * rte_pci_map_device + * rte_pci_probe + * rte_pci_probe_one + * rte_pci_read_config + * rte_pci_register + * rte_pci_scan + * rte_pci_unmap_device + * rte_pci_unregister + * rte_pci_write_config + + These functions are made available either as part of ``librte_pci`` or + ``librte_bus_pci``. ABI Changes -----------
Signature · 1 line
2.1.4
PATCH v8 25/25 maintainers: claim maintainership of PCI lib
In reply to Gaetan RivetAdd also PCI bus as an orphan.
--- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
@@ -286,6 +286,11 @@ T: git://dpdk.org/next/dpdk-next-eventdev F: lib/librte_eventdev/*eth_rx_adapter* F: test/test/test_event_eth_rx_adapter.c +Bus Drivers +----------- + +PCI: +F: drivers/bus/pci Networking Drivers ------------------
@@ -876,6 +881,10 @@ Latency statistics M: Reshma Pattan <[email protected]> F: lib/librte_latencystats/ +PCI +M: Gaetan Rivet <[email protected]> +F: lib/librte_pci/ + Test Applications -----------------
Signature · 1 line
2.1.4
26/10/2017 12:05, Gaetan Rivet:
Quoted 6 lines
Here is a new version of the PCI bus move out of the EAL.
The EAL PCI implementation is divided in two parts:
-
librte_pci: library offering helpers to handle PCI objects
-librte_bus_pci: bus driver for PCI devices
Applied with few fixes, thanks for the huge work Gaetan
As I understand as the result of these changes VFIO_PRESENT is always undefined when bus/pci sources are build (because eal_vfio.h is not included).
So, many things do not work if vfio-pci is used. In my case rte_pci_map_device() fails with -1.
Andrew.
Hi Andrew,
You're right, sorry for the instability.
A fix has been proposed[1]. It needs to be discussed.
My opinion was that VFIO_PRESENT should stay internal to the EAL. There should be no need to another library to depend on it.
I will discuss this in the other thread.
Regards,
[1]: http://dpdk.org/ml/archives/dev/2017-October/080746.html
Quoted 7 lines · Andrew Rybchenko
As I understand as the result of these changes
VFIO_PRESENTis always undefined
when bus/pci sources are build (becauseeal_vfio.his not included). So, many things do not work if vfio-pci is used. In my caserte_pci_map_device()fails with -1.Andrew.
Signature · 2 lines
Gaëtan Rivet 6WIND
Quoted 21 lines · Gaetan Rivet
Hi all,
Here is a new version of the PCI bus move out of the EAL.
The EAL PCI implementation is divided in two parts:
-
librte_pci: library offering helpers to handle PCI objects
-librte_bus_pci: bus driver for PCI devicesThis allows other libraries / tools to use PCI elements (location, mappings, parsing operations, etc) without forcing a dependency on a bus driver.
The latter should not have to export helpers that others might need. It is focused on defining the
rte_pci_device,rte_pci_driverobjects and their handling.The cryptodev library has hard dependencies on
rte_pci_devices(used by generic probe function). Other similar libs (ether and eventdev) avoided the issue by inlining such functions and expecting users to include the relevant headers once the PCI bus has already been built.
Quoted 7 lines
@Declan:
I proposed a solution that would avoid inlining those functions, which does not feel right. Let me know what you think of it or if you think of a better solution. I think it would be best to have cryptodev completely independent from PCI / vdev as far as the lib in concerned (the vdev bus will move as well).
Hey Gaetan, apologies for the delay in getting back to you on this, I had been looking at this but got sidelined onto other issues before usersapce and I'm only getting back to it now. I think that while your solution works it just highlights the dependency which probably shouldn't be there between the cryptodev library and PCI devices. I've had a look, and the functions in the cryptodev which you moved don't really provide that much useful functionality. I done some testing and completely removed them and just update the QAT PMD which is the only crypto PMD which was using them and it seems much cleaner to me. I'll push a patch for this change later today and it will allow you to drop the patch "cryptodev: move PCI specific helpers to drivers/crypto" from this set.
Regards
Declan
Quoted 167 lines
v2:
+ Made
rte_eal_using_phys_addrscommon to both linux and bsd interfaces.
+ Added documentation of EAL API changes in release note.
+ Fixed a few rebase-related mistakes.
+ Fixed parallel build race condition reported by Luca Boccassi.
+ Grouped together commits breaking compilation:-> pci: introduce PCI lib and bus -> lib: include rte_bus_pci -> drivers: include rte_bus_pci -> test: include rte_bus_pci -> app/testpmd: include rte_bus_pci -> cryptodev: move PCI specific helpers to drivers/cryptoUntil all of them have been applied, compilation is broken. I am currently wondering whether merging some of them might be sensible.
+ Not included in this series:
Several filesystem-related functions are currently
private to the EAL and directly linked. This is not good,
but the solution seems to be to have a new lib offering an FS abstraction. This seems an overreach for this patchset and should probably come in a second step.Gaetan Rivet (14):
eal: exposerte_eal_using_phys_addrs
ethdev: remove useless PCI dependency
bus: properly includerte_debug
eal: remove references to PCI
pci: introduce PCI lib and bus
lib: includerte_bus_pci
drivers: includerte_bus_pci
test: includerte_bus_pci
app/testpmd: includerte_bus_pci
cryptodev: move PCI specific helpers todrivers/crypto
pci: avoid inlining functions
pci: avoid over-complicated macro
pci: deprecate misnamed functions
doc: add notes on EAL PCI API updateapp/test-pmd/testpmd.h | 1 + config/common_base | 10 + doc/guides/rel_notes/deprecation.rst | 10 + doc/guides/rel_notes/release_17_11.rst | 28 + drivers/Makefile | 2 +- drivers/bus/Makefile | 2 + drivers/bus/pci/Makefile | 59 ++ drivers/bus/pci/bsd/Makefile | 32 + drivers/bus/pci/bsd/rte_pci.c | 671 +++++++++++++++++++++ drivers/bus/pci/include/rte_bus_pci.h | 387 ++++++++++++ drivers/bus/pci/linux/Makefile | 37 ++ drivers/bus/pci/linux/rte_pci.c | 723 +++++++++++++++++++++++ drivers/bus/pci/linux/rte_pci_init.h | 97 +++ drivers/bus/pci/linux/rte_pci_uio.c | 568 ++++++++++++++++++ drivers/bus/pci/linux/rte_pci_vfio.c | 675 +++++++++++++++++++++ drivers/bus/pci/linux/rte_vfio_mp_sync.c | 425 +++++++++++++ drivers/bus/pci/private.h | 174 ++++++ drivers/bus/pci/rte_bus_pci_version.map | 21 + drivers/bus/pci/rte_pci_common.c | 543 +++++++++++++++++ drivers/bus/pci/rte_pci_common_uio.c | 235 ++++++++ drivers/crypto/Makefile | 4 +- drivers/crypto/pci/Makefile | 52 ++ drivers/crypto/pci/rte_cryptodev_pci.c | 128 ++++ drivers/crypto/pci/rte_cryptodev_pci.h | 94 +++ drivers/crypto/pci/rte_cryptodev_pci_version.map | 7 + drivers/crypto/qat/qat_qp.c | 1 + drivers/event/octeontx/ssovf_probe.c | 1 + drivers/net/ark/ark_ethdev.c | 1 + drivers/net/avp/avp_ethdev.c | 2 + drivers/net/bnxt/bnxt.h | 1 + drivers/net/bonding/rte_eth_bond_args.c | 1 + drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 1 + drivers/net/e1000/em_ethdev.c | 1 + drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/e1000/igb_pf.c | 1 + drivers/net/ena/ena_ethdev.h | 1 + drivers/net/enic/base/vnic_dev.h | 4 +- drivers/net/enic/enic_ethdev.c | 1 + drivers/net/enic/enic_main.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 1 + drivers/net/ixgbe/ixgbe_ethdev.h | 1 + drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/sfc/sfc.h | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/thunderx/nicvf_ethdev.c | 1 + drivers/net/virtio/virtio_ethdev.c | 1 + drivers/net/virtio/virtio_pci.h | 1 + drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 + lib/Makefile | 2 + lib/librte_cryptodev/Makefile | 1 - lib/librte_cryptodev/rte_cryptodev_pci.h | 92 --- lib/librte_cryptodev/rte_cryptodev_pmd.c | 94 --- lib/librte_cryptodev/rte_cryptodev_version.map | 2 - lib/librte_eal/bsdapp/eal/Makefile | 3 - lib/librte_eal/bsdapp/eal/eal.c | 1 - lib/librte_eal/bsdapp/eal/eal_memory.c | 6 + lib/librte_eal/bsdapp/eal/eal_pci.c | 670 --------------------- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 16 +- lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_bus.c | 1 + lib/librte_eal/common/eal_common_pci.c | 580 ------------------ lib/librte_eal/common/eal_common_pci_uio.c | 233 -------- lib/librte_eal/common/eal_private.h | 143 ----- lib/librte_eal/common/include/rte_memory.h | 11 + lib/librte_eal/common/include/rte_pci.h | 598 ------------------- lib/librte_eal/linuxapp/eal/Makefile | 10 - lib/librte_eal/linuxapp/eal/eal.c | 1 - lib/librte_eal/linuxapp/eal/eal_interrupts.c | 1 - lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci.c | 722 ---------------------- lib/librte_eal/linuxapp/eal/eal_pci_init.h | 97 --- lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 567 ------------------ lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 674 --------------------- lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 424 ------------- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 16 +- lib/librte_ether/rte_ethdev.c | 1 - lib/librte_ether/rte_ethdev.h | 2 - lib/librte_ether/rte_ethdev_pci.h | 1 + lib/librte_eventdev/rte_eventdev_pmd_pci.h | 1 + lib/librte_pci/Makefile | 48 ++ lib/librte_pci/include/rte_pci.h | 285 +++++++++ lib/librte_pci/rte_pci.c | 210 +++++++ lib/librte_pci/rte_pci_version.map | 16 + mk/rte.app.mk | 3 + test/test/test_kni.c | 1 + test/test/virtual_pmd.c | 1 + 90 files changed, 5603 insertions(+), 4951 deletions(-)create mode 100644
drivers/bus/pci/Makefile
create mode 100644drivers/bus/pci/bsd/Makefile
create mode 100644drivers/bus/pci/bsd/rte_pci.c
create mode 100644drivers/bus/pci/include/rte_bus_pci.hcreate mode 100644drivers/bus/pci/linux/Makefile
create mode 100644drivers/bus/pci/linux/rte_pci.ccreate mode 100644drivers/bus/pci/linux/rte_pci_init.hcreate mode 100644drivers/bus/pci/linux/rte_pci_uio.ccreate mode 100644drivers/bus/pci/linux/rte_pci_vfio.ccreate mode 100644drivers/bus/pci/linux/rte_vfio_mp_sync.ccreate mode 100644drivers/bus/pci/private.h
create mode 100644drivers/bus/pci/rte_bus_pci_version.mapcreate mode 100644drivers/bus/pci/rte_pci_common.ccreate mode 100644drivers/bus/pci/rte_pci_common_uio.ccreate mode 100644drivers/crypto/pci/Makefile
create mode 100644drivers/crypto/pci/rte_cryptodev_pci.ccreate mode 100644drivers/crypto/pci/rte_cryptodev_pci.hcreate mode 100644drivers/crypto/pci/rte_cryptodev_pci_version.mapdelete mode 100644lib/librte_cryptodev/rte_cryptodev_pci.hdelete mode 100644lib/librte_eal/bsdapp/eal/eal_pci.cdelete mode 100644lib/librte_eal/common/eal_common_pci.cdelete mode 100644lib/librte_eal/common/eal_common_pci_uio.cdelete mode 100644lib/librte_eal/common/include/rte_pci.hdelete mode 100644lib/librte_eal/linuxapp/eal/eal_pci.cdelete mode 100644lib/librte_eal/linuxapp/eal/eal_pci_init.hdelete mode 100644lib/librte_eal/linuxapp/eal/eal_pci_uio.cdelete mode 100644lib/librte_eal/linuxapp/eal/eal_pci_vfio.cdelete mode 100644lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.ccreate mode 100644lib/librte_pci/Makefile
create mode 100644lib/librte_pci/include/rte_pci.hcreate mode 100644lib/librte_pci/rte_pci.c
create mode 100644lib/librte_pci/rte_pci_version.map
Quoted 43 lines · Declan
Quoted 21 lines · Gaetan Rivet
Hi all,
Here is a new version of the PCI bus move out of the EAL.
The EAL PCI implementation is divided in two parts:
-
librte_pci: library offering helpers to handle PCI objects
-librte_bus_pci: bus driver for PCI devicesThis allows other libraries / tools to use PCI elements (location, mappings, parsing operations, etc) without forcing a dependency on a bus driver.
The latter should not have to export helpers that others might need. It is focused on defining the
rte_pci_device,rte_pci_driverobjects and their handling.The cryptodev library has hard dependencies on
rte_pci_devices(used by generic probe function). Other similar libs (ether and eventdev) avoided the issue by inlining such functions and expecting users to include the relevant headers once the PCI bus has already been built.Quoted 7 lines
@Declan:
I proposed a solution that would avoid inlining those functions, which does not feel right. Let me know what you think of it or if you think of a better solution. I think it would be best to have cryptodev completely independent from PCI / vdev as far as the lib in concerned (the vdev bus will move as well).Hey Gaetan, apologies for the delay in getting back to you on this, I had been looking at this but got sidelined onto other issues before usersapce and I'm only getting back to it now. I think that while your solution works it just highlights the dependency which probably shouldn't be there between the cryptodev library and PCI devices. I've had a look, and the functions in the cryptodev which you moved don't really provide that much useful functionality. I done some testing and completely removed them and just update the QAT PMD which is the only crypto PMD which was using them and it seems much cleaner to me. I'll push a patch for this change later today and it will allow you to drop the patch "cryptodev: move PCI specific helpers to
drivers/crypto" from this set.
Quoted 5 lines
Regards
Declan
Hi Declan,
All right, seems good from my PoV. I will rebase onto your patch once it is sent.
Quoted 168 lines
Quoted 167 lines
v2:
+ Made
rte_eal_using_phys_addrscommon to both linux and bsd interfaces.
+ Added documentation of EAL API changes in release note.
+ Fixed a few rebase-related mistakes.
+ Fixed parallel build race condition reported by Luca Boccassi.
+ Grouped together commits breaking compilation:-> pci: introduce PCI lib and bus -> lib: include rte_bus_pci -> drivers: include rte_bus_pci -> test: include rte_bus_pci -> app/testpmd: include rte_bus_pci -> cryptodev: move PCI specific helpers to drivers/cryptoUntil all of them have been applied, compilation is broken. I am currently wondering whether merging some of them might be sensible.
+ Not included in this series:
Several filesystem-related functions are currently
private to the EAL and directly linked. This is not good,
but the solution seems to be to have a new lib offering an FS abstraction. This seems an overreach for this patchset and should probably come in a second step.Gaetan Rivet (14):
eal: exposerte_eal_using_phys_addrs
ethdev: remove useless PCI dependency
bus: properly includerte_debug
eal: remove references to PCI
pci: introduce PCI lib and bus
lib: includerte_bus_pci
drivers: includerte_bus_pci
test: includerte_bus_pci
app/testpmd: includerte_bus_pci
cryptodev: move PCI specific helpers todrivers/crypto
pci: avoid inlining functions
pci: avoid over-complicated macro
pci: deprecate misnamed functions
doc: add notes on EAL PCI API updateapp/test-pmd/testpmd.h | 1 + config/common_base | 10 + doc/guides/rel_notes/deprecation.rst | 10 + doc/guides/rel_notes/release_17_11.rst | 28 + drivers/Makefile | 2 +- drivers/bus/Makefile | 2 + drivers/bus/pci/Makefile | 59 ++ drivers/bus/pci/bsd/Makefile | 32 + drivers/bus/pci/bsd/rte_pci.c | 671 +++++++++++++++++++++ drivers/bus/pci/include/rte_bus_pci.h | 387 ++++++++++++ drivers/bus/pci/linux/Makefile | 37 ++ drivers/bus/pci/linux/rte_pci.c | 723 +++++++++++++++++++++++ drivers/bus/pci/linux/rte_pci_init.h | 97 +++ drivers/bus/pci/linux/rte_pci_uio.c | 568 ++++++++++++++++++ drivers/bus/pci/linux/rte_pci_vfio.c | 675 +++++++++++++++++++++ drivers/bus/pci/linux/rte_vfio_mp_sync.c | 425 +++++++++++++ drivers/bus/pci/private.h | 174 ++++++ drivers/bus/pci/rte_bus_pci_version.map | 21 + drivers/bus/pci/rte_pci_common.c | 543 +++++++++++++++++ drivers/bus/pci/rte_pci_common_uio.c | 235 ++++++++ drivers/crypto/Makefile | 4 +- drivers/crypto/pci/Makefile | 52 ++ drivers/crypto/pci/rte_cryptodev_pci.c | 128 ++++ drivers/crypto/pci/rte_cryptodev_pci.h | 94 +++ drivers/crypto/pci/rte_cryptodev_pci_version.map | 7 + drivers/crypto/qat/qat_qp.c | 1 + drivers/event/octeontx/ssovf_probe.c | 1 + drivers/net/ark/ark_ethdev.c | 1 + drivers/net/avp/avp_ethdev.c | 2 + drivers/net/bnxt/bnxt.h | 1 + drivers/net/bonding/rte_eth_bond_args.c | 1 + drivers/net/cxgbe/base/adapter.h | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 1 + drivers/net/e1000/em_ethdev.c | 1 + drivers/net/e1000/igb_ethdev.c | 1 + drivers/net/e1000/igb_pf.c | 1 + drivers/net/ena/ena_ethdev.h | 1 + drivers/net/enic/base/vnic_dev.h | 4 +- drivers/net/enic/enic_ethdev.c | 1 + drivers/net/enic/enic_main.c | 1 + drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/ixgbe/ixgbe_ethdev.c | 1 + drivers/net/ixgbe/ixgbe_ethdev.h | 1 + drivers/net/mlx5/mlx5.c | 1 + drivers/net/mlx5/mlx5_ethdev.c | 1 + drivers/net/sfc/sfc.h | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/thunderx/nicvf_ethdev.c | 1 + drivers/net/virtio/virtio_ethdev.c | 1 + drivers/net/virtio/virtio_pci.h | 1 + drivers/net/vmxnet3/vmxnet3_ethdev.c | 1 + lib/Makefile | 2 + lib/librte_cryptodev/Makefile | 1 - lib/librte_cryptodev/rte_cryptodev_pci.h | 92 --- lib/librte_cryptodev/rte_cryptodev_pmd.c | 94 --- lib/librte_cryptodev/rte_cryptodev_version.map | 2 - lib/librte_eal/bsdapp/eal/Makefile | 3 - lib/librte_eal/bsdapp/eal/eal.c | 1 - lib/librte_eal/bsdapp/eal/eal_memory.c | 6 + lib/librte_eal/bsdapp/eal/eal_pci.c | 670 --------------------- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 16 +- lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_bus.c | 1 + lib/librte_eal/common/eal_common_pci.c | 580 ------------------ lib/librte_eal/common/eal_common_pci_uio.c | 233 -------- lib/librte_eal/common/eal_private.h | 143 ----- lib/librte_eal/common/include/rte_memory.h | 11 + lib/librte_eal/common/include/rte_pci.h | 598 ------------------- lib/librte_eal/linuxapp/eal/Makefile | 10 - lib/librte_eal/linuxapp/eal/eal.c | 1 - lib/librte_eal/linuxapp/eal/eal_interrupts.c | 1 - lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +- lib/librte_eal/linuxapp/eal/eal_pci.c | 722 ---------------------- lib/librte_eal/linuxapp/eal/eal_pci_init.h | 97 --- lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 567 ------------------ lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 674 --------------------- lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 424 ------------- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 16 +- lib/librte_ether/rte_ethdev.c | 1 - lib/librte_ether/rte_ethdev.h | 2 - lib/librte_ether/rte_ethdev_pci.h | 1 + lib/librte_eventdev/rte_eventdev_pmd_pci.h | 1 + lib/librte_pci/Makefile | 48 ++ lib/librte_pci/include/rte_pci.h | 285 +++++++++ lib/librte_pci/rte_pci.c | 210 +++++++ lib/librte_pci/rte_pci_version.map | 16 + mk/rte.app.mk | 3 + test/test/test_kni.c | 1 + test/test/virtual_pmd.c | 1 + 90 files changed, 5603 insertions(+), 4951 deletions(-) create mode 100644 drivers/bus/pci/Makefile create mode 100644 drivers/bus/pci/bsd/Makefile create mode 100644 drivers/bus/pci/bsd/rte_pci.c create mode 100644 drivers/bus/pci/include/rte_bus_pci.h create mode 100644 drivers/bus/pci/linux/Makefile create mode 100644 drivers/bus/pci/linux/rte_pci.c create mode 100644 drivers/bus/pci/linux/rte_pci_init.h create mode 100644 drivers/bus/pci/linux/rte_pci_uio.c create mode 100644 drivers/bus/pci/linux/rte_pci_vfio.c create mode 100644 drivers/bus/pci/linux/rte_vfio_mp_sync.c create mode 100644 drivers/bus/pci/private.h create mode 100644 drivers/bus/pci/rte_bus_pci_version.map create mode 100644 drivers/bus/pci/rte_pci_common.c create mode 100644 drivers/bus/pci/rte_pci_common_uio.c create mode 100644 drivers/crypto/pci/Makefile create mode 100644 drivers/crypto/pci/rte_cryptodev_pci.c create mode 100644 drivers/crypto/pci/rte_cryptodev_pci.h create mode 100644 drivers/crypto/pci/rte_cryptodev_pci_version.map delete mode 100644 lib/librte_cryptodev/rte_cryptodev_pci.h delete mode 100644 lib/librte_eal/bsdapp/eal/eal_pci.c delete mode 100644 lib/librte_eal/common/eal_common_pci.c delete mode 100644 lib/librte_eal/common/eal_common_pci_uio.c delete mode 100644 lib/librte_eal/common/include/rte_pci.h delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci.c delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_init.h delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_uio.c delete mode 100644 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c delete mode 100644 lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c create mode 100644 lib/librte_pci/Makefile create mode 100644 lib/librte_pci/include/rte_pci.h create mode 100644 lib/librte_pci/rte_pci.c create mode 100644 lib/librte_pci/rte_pci_version.map
Signature · 2 lines
Gaëtan Rivet 6WIND
Hi Gaetan,
Quoted 59 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Gaëtan Rivet
Sent: Wednesday, October 11, 2017 3:32 PM
To: Doherty, Declan <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 00/14] Move PCI away from the EALQuoted 5 lines · Declan
Quoted 4 lines · Gaetan Rivet
Hi all,
Here is a new version of the PCI bus move out of the EAL.
Quoted 7 lines
Quoted 7 lines
The EAL PCI implementation is divided in two parts:
-
librte_pci: library offering helpers to handle PCI objects
-librte_bus_pci: bus driver for PCI devicesThis allows other libraries / tools to use PCI elements (location, mappings, parsing operations, etc) without forcing a dependency on a
bus driver.
Quoted 19 lines
Quoted 10 lines
The latter should not have to export helpers that others might need. It is focused on defining the
rte_pci_device,rte_pci_driverobjects and their handling.The cryptodev library has hard dependencies on
rte_pci_devices(used by generic probe function). Other similar libs (ether and eventdev) avoided the issue by inlining such functions and expecting users to include the relevant headers once the PCI bus has already been built.Quoted 7 lines
@Declan:
I proposed a solution that would avoid inlining those functions, which does not feel right. Let me know what you think of it or if you think of a better solution. I think it would be best to have cryptodev completely independent from PCI / vdev as far as the lib in concerned (the vdev bus will move as well).Quoted 11 lines
Hey Gaetan, apologies for the delay in getting back to you on this, I had been looking at this but got sidelined onto other issues before usersapce and I'm only getting back to it now. I think that while your solution works it just highlights the dependency which probably shouldn't be there between the cryptodev library and PCI devices. I've had a look, and the functions in the cryptodev which you moved don't really provide that much useful functionality. I done some testing and completely removed them and just update the QAT PMD which is the only crypto PMD which was using them and it seems much cleaner to me. I'll push a patch for this change later today and it will allow you to drop the patch "cryptodev: move PCI specific helpers to
drivers/crypto" fromthis set.
Quoted 6 lines
Regards
Declan
Quoted 5 lines
Hi Declan,
All right, seems good from my PoV. I will rebase onto your patch once it is sent.
Could you take a look at Declan's patchset and tell him what you think?
http://dpdk.org/ml/archives/dev/2017-October/079827.html
It might be a bit late, but if we think it is a better approach for cryptodev, we could avoid creating a new PCI folder under drivers/crypto.
Thanks!
Pablo
Hello Pablo,
Quoted 67 lines · Pablo
Hi Gaetan,
Quoted 59 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Gaëtan Rivet
Sent: Wednesday, October 11, 2017 3:32 PM
To: Doherty, Declan <[email protected]>
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v2 00/14] Move PCI away from the EALQuoted 5 lines · Declan
Quoted 4 lines · Gaetan Rivet
Hi all,
Here is a new version of the PCI bus move out of the EAL.
Quoted 7 lines
Quoted 7 lines
The EAL PCI implementation is divided in two parts:
-
librte_pci: library offering helpers to handle PCI objects
-librte_bus_pci: bus driver for PCI devicesThis allows other libraries / tools to use PCI elements (location, mappings, parsing operations, etc) without forcing a dependency on a
bus driver.
Quoted 19 lines
Quoted 10 lines
The latter should not have to export helpers that others might need. It is focused on defining the
rte_pci_device,rte_pci_driverobjects and their handling.The cryptodev library has hard dependencies on
rte_pci_devices(used by generic probe function). Other similar libs (ether and eventdev) avoided the issue by inlining such functions and expecting users to include the relevant headers once the PCI bus has already been built.Quoted 7 lines
@Declan:
I proposed a solution that would avoid inlining those functions, which does not feel right. Let me know what you think of it or if you think of a better solution. I think it would be best to have cryptodev completely independent from PCI / vdev as far as the lib in concerned (the vdev bus will move as well).Quoted 11 lines
Hey Gaetan, apologies for the delay in getting back to you on this, I had been looking at this but got sidelined onto other issues before usersapce and I'm only getting back to it now. I think that while your solution works it just highlights the dependency which probably shouldn't be there between the cryptodev library and PCI devices. I've had a look, and the functions in the cryptodev which you moved don't really provide that much useful functionality. I done some testing and completely removed them and just update the QAT PMD which is the only crypto PMD which was using them and it seems much cleaner to me. I'll push a patch for this change later today and it will allow you to drop the patch "cryptodev: move PCI specific helpers to
drivers/crypto" fromthis set.
Quoted 6 lines
Regards
DeclanQuoted 5 lines
Hi Declan,
All right, seems good from my PoV. I will rebase onto your patch once it is sent.
Quoted 9 lines
Could you take a look at Declan's patchset and tell him what you think?
http://dpdk.org/ml/archives/dev/2017-October/079827.htmlIt might be a bit late, but if we think it is a better approach for cryptodev, we could avoid creating a new PCI folder under
drivers/crypto.Thanks!
Pablo
Thanks for the heads up :)
I was working with a stand-in patch on my PCI move series, I will use yours instead and see if I have any problem.
I am bound to send a new version soon, if all is fine I will add the dependency on your series.
Signature · 2 lines
Gaëtan Rivet 6WIND