Skip to contentSkip to conversation

Move PCI away from the EAL

PATCH Superseded Gaetan Rivet 10 participants 156 messages Aug 25, 2017 – Oct 30, 2017 Page 1 of 2

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Move PCI away from the EAL

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

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

TODO:

- Verify that the lib / bus divide is correct.
- Expose additional EAL functions the PCI bus is dependent upon. The PCI bus is currently dirty. It should be fixed.
- rte_eal_using_phys_addrs is currently linux-only, the symbol will be exposed on BSD as well (even if not implemented). This remark has been made already last release, but wasn't properly addressed.

Gaetan Rivet (13):
eal: expose rte_eal_using_phys_addrs
ethdev: remove useless PCI dependency
bus: properly include rte_debug
eal: remove references to PCI
pci: introduce PCI lib and bus
pci: avoid inlining functions
pci: avoid over-complicated macro
pci: deprecate misnamed functions
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/crypto

 app/test-pmd/testpmd.h                           |   1 +
 config/common_base                               |  15 +
 doc/guides/rel_notes/deprecation.rst             |  10 +
 drivers/Makefile                                 |   2 +-
 drivers/bus/Makefile                             |   2 +
 drivers/bus/pci/Makefile                         |  60 ++
 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                  | 724 +++++++++++++++++++++++
 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_pci.c              | 670 ---------------------
 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_pci.h          | 598 -------------------
 lib/librte_eal/linuxapp/eal/Makefile             |  12 +-
 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         |   3 +-
 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  |   1 +
 lib/librte_eal/linuxapp/eal/rte_memory_linux.h   |  64 ++
 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                 | 285 +++++++++
 lib/librte_pci/rte_pci.c                         | 210 +++++++
 lib/librte_pci/rte_pci_version.map               |  16 +
 mk/rte.app.mk                                    |   3 +
 test/test/virtual_pmd.c                          |   1 +
 86 files changed, 5631 insertions(+), 4921 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_eal/linuxapp/eal/rte_memory_linux.h
 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
#1 lore raw

PATCH 1/13 eal: expose rte_eal_using_phys_addrs

This function was previously private to the EAL layer. Other subsystems requires it, such as the PCI bus.

This function is only exposed for linuxapps.

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/common/eal_private.h             | 11 -----
 lib/librte_eal/linuxapp/eal/Makefile            |  2 +
 lib/librte_eal/linuxapp/eal/eal_memory.c        |  3 +-
 lib/librte_eal/linuxapp/eal/eal_pci.c           |  1 +
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 +
 lib/librte_eal/linuxapp/eal/rte_memory_linux.h  | 64 +++++++++++++++++++++++++
 6 files changed, 70 insertions(+), 12 deletions(-)
 create mode 100644 lib/librte_eal/linuxapp/eal/rte_memory_linux.h
lib/librte_eal/common/eal_private.h +0 -11
index 597d82e..10a7078 100644
@@ -333,17 +333,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/linuxapp/eal/Makefile +2 -0
index 90bca4d..ad7e34a 100644
@@ -135,4 +135,6 @@ INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h
 SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUXAPP)-include/exec-env := \
 	$(addprefix include/exec-env/,$(INC))
 
+SYMLINK-$(CONFIG_RTE_EXEC_ENV_LINUXAPP)-include += rte_memory_linux.h
+
 include $(RTE_SDK)/mk/rte.lib.mk
lib/librte_eal/linuxapp/eal/eal_memory.c +2 -1
index 5279128..6639670 100644
@@ -72,6 +72,7 @@
 #include "eal_internal_cfg.h"
 #include "eal_filesystem.h"
 #include "eal_hugepages.h"
+#include "rte_memory_linux.h"
 
 #define PFN_MASK_SIZE	8
 
@@ -1542,7 +1543,7 @@ rte_eal_hugepage_attach(void)
 	return -1;
 }
 
-bool
+int
 rte_eal_using_phys_addrs(void)
 {
 	return phys_addrs_available;
lib/librte_eal/linuxapp/eal/eal_pci.c +1 -0
index 8951ce7..8f658d6 100644
@@ -45,6 +45,7 @@
 #include "eal_filesystem.h"
 #include "eal_private.h"
 #include "eal_pci_init.h"
+#include "rte_memory_linux.h"
 
 /**
  * @file
lib/librte_eal/linuxapp/eal/rte_eal_version.map +1 -0
index 3a8f154..5cfd934 100644
@@ -206,6 +206,7 @@ DPDK_17.08 {
 	rte_bus_find_by_device;
 	rte_bus_find_by_name;
 	rte_log_get_level;
+	rte_eal_using_phys_addrs;
 
 } DPDK_17.05;
 
lib/librte_eal/linuxapp/eal/rte_memory_linux.h new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
2.1.4
#2 lore raw

Re: [PATCH 01/13] eal: expose rte_eal_using_phys_addrs

Hi Gaetan,

Quoted 9 lines

From: dev [mailto:[email protected]] On Behalf Of Gaetan Rivet
Sent: Friday, August 25, 2017 10:04 AM
To: [email protected]
Cc: Gaetan Rivet <[email protected]>
Subject: [dpdk-dev] [PATCH 01/13] eal: expose rte_eal_using_phys_addrs

This function was previously private to the EAL layer. Other subsystems requires it, such as the PCI bus.

Quoted 7 lines

This function is only exposed for linuxapps.

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.

This probably should be moved to common API, and BSD should just implement a stub. Linuxapp-only externally visible API's are not allowed as far as I'm aware.

Thanks,
Anatoly

#3 lore raw

PATCH 2/13 ethdev: remove useless PCI dependency

In reply to Gaetan Rivet
---
 lib/librte_ether/rte_ethdev.c | 1 -
 1 file changed, 1 deletion(-)
lib/librte_ether/rte_ethdev.c +0 -1
index 0597641..9b879f7 100644
@@ -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
#4 lore raw

PATCH 3/13 bus: properly include rte_debug

In reply to Gaetan Rivet
---
 lib/librte_eal/common/eal_common_bus.c | 1 +
 1 file changed, 1 insertion(+)
lib/librte_eal/common/eal_common_bus.c +1 -0
index 08bec2d..9d1be8a 100644
@@ -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
#5 lore raw

PATCH 4/13 eal: remove references to PCI

In reply to Gaetan Rivet
---
 lib/librte_eal/bsdapp/eal/eal.c              |   1 -
 lib/librte_eal/common/eal_private.h          | 132 ---------------------------
 lib/librte_eal/linuxapp/eal/eal.c            |   1 -
 lib/librte_eal/linuxapp/eal/eal_interrupts.c |   1 -
 4 files changed, 135 deletions(-)
lib/librte_eal/bsdapp/eal/eal.c +0 -1
index 5fa5988..b7c045f 100644
@@ -66,7 +66,6 @@
 #include <rte_cpuflags.h>
 #include <rte_interrupts.h>
 #include <rte_bus.h>
-#include <rte_pci.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
 #include <rte_version.h>
lib/librte_eal/common/eal_private.h +0 -132

144 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal.c +0 -1
index 48f12f4..f72da15 100644
@@ -71,7 +71,6 @@
 #include <rte_cpuflags.h>
 #include <rte_interrupts.h>
 #include <rte_bus.h>
-#include <rte_pci.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
 #include <rte_version.h>
lib/librte_eal/linuxapp/eal/eal_interrupts.c +0 -1
index 3e9ac41..0bebf00 100644
@@ -60,7 +60,6 @@
 #include <rte_branch_prediction.h>
 #include <rte_debug.h>
 #include <rte_log.h>
-#include <rte_pci.h>
 #include <rte_malloc.h>
 #include <rte_errno.h>
 #include <rte_spinlock.h>
Signature · 1 line
2.1.4
#6 lore raw

PATCH 5/13 pci: introduce PCI lib and bus

In reply to Gaetan Rivet

The 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 their expected place.

---
 config/common_base                             |  15 +
 drivers/bus/Makefile                           |   2 +
 drivers/bus/pci/Makefile                       |  60 ++
 drivers/bus/pci/bsd/Makefile                   |  32 ++
 drivers/bus/pci/bsd/rte_pci.c                  | 670 +++++++++++++++++++++++
 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            | 567 +++++++++++++++++++
 drivers/bus/pci/linux/rte_pci_vfio.c           | 674 +++++++++++++++++++++++
 drivers/bus/pci/linux/rte_vfio_mp_sync.c       | 424 +++++++++++++++
 drivers/bus/pci/private.h                      | 173 ++++++
 drivers/bus/pci/rte_bus_pci_version.map        |  21 +
 drivers/bus/pci/rte_pci_common.c               | 542 ++++++++++++++++++
 drivers/bus/pci/rte_pci_common_uio.c           | 234 ++++++++
 lib/Makefile                                   |   2 +
 lib/librte_eal/bsdapp/eal/Makefile             |   3 -
 lib/librte_eal/bsdapp/eal/eal_pci.c            | 670 -----------------------
 lib/librte_eal/common/Makefile                 |   2 +-
 lib/librte_eal/common/eal_common_pci.c         | 580 --------------------
 lib/librte_eal/common/eal_common_pci_uio.c     | 233 --------
 lib/librte_eal/common/include/rte_pci.h        | 598 --------------------
 lib/librte_eal/linuxapp/eal/Makefile           |  10 -
 lib/librte_eal/linuxapp/eal/eal_pci.c          | 723 -------------------------
 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_ether/rte_ethdev.h                  |   2 -
 lib/librte_pci/Makefile                        |  49 ++
 lib/librte_pci/include/rte_pci.h               | 279 ++++++++++
 lib/librte_pci/rte_pci.c                       |  92 ++++
 lib/librte_pci/rte_pci_version.map             |   8 +
 mk/rte.app.mk                                  |   3 +
 35 files changed, 5092 insertions(+), 4582 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
 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
config/common_base +15 -0
index 5e97a08..6141a65 100644
@@ -122,6 +122,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
@@ -146,6 +151,16 @@ CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
 CONFIG_RTE_ETHDEV_TX_PREPARE_NOOP=n
 
 #
+# Support NIC bypass logic
+#
+CONFIG_RTE_NIC_BYPASS=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
index 0224214..4b5bafe 100644
@@ -34,5 +34,7 @@ core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
 
 DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
 DEPDIRS-fslmc = $(core-libs)
+DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DEPDIRS-pci = $(core-libs)
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/bus/pci/Makefile new file +60 -0

60 lines not on this page · raw message

drivers/bus/pci/bsd/Makefile new file +32 -0
new file mode 100644
index 0000000..77cf539
@@ -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 += rte_pci.c
drivers/bus/pci/bsd/rte_pci.c new file +670 -0

670 lines not on this page · raw message

drivers/bus/pci/include/rte_bus_pci.h new file +387 -0

387 lines not on this page · raw message

drivers/bus/pci/linux/Makefile new file +37 -0
new file mode 100644
index 0000000..d2ea84c
@@ -0,0 +1,37 @@
+#   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 += rte_pci.c
+SRCS += rte_pci_uio.c
+SRCS += rte_pci_vfio.c
+SRCS += rte_vfio_mp_sync.c
+
+CFLAGS += -D_GNU_SOURCE
drivers/bus/pci/linux/rte_pci.c new file +723 -0

723 lines not on this page · raw message

drivers/bus/pci/linux/rte_pci_init.h new file +97 -0

97 lines not on this page · raw message

drivers/bus/pci/linux/rte_pci_uio.c new file +567 -0

567 lines not on this page · raw message

drivers/bus/pci/linux/rte_pci_vfio.c new file +674 -0

393 lines not on this page · raw message

drivers/bus/pci/linux/rte_vfio_mp_sync.c new file +424 -0

424 lines not on this page · raw message

drivers/bus/pci/private.h new file +173 -0

173 lines not on this page · raw message

drivers/bus/pci/rte_bus_pci_version.map new file +21 -0
new file mode 100644
index 0000000..eca49e9

Lines of this file are not shown. View the raw message.

drivers/bus/pci/rte_pci_common.c new file +542 -0

542 lines not on this page · raw message

drivers/bus/pci/rte_pci_common_uio.c new file +234 -0

234 lines not on this page · raw message

lib/Makefile +2 -0
index 86caba1..147be60 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/bsdapp/eal/Makefile +0 -3
index 005019e..e5273f7 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/bsdapp/eal/eal_pci.c deleted +0 -670

670 lines not on this page · raw message

lib/librte_eal/common/Makefile +1 -1
index e8fd67a..ac8d3bb 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/common/eal_common_pci.c deleted +0 -580

580 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/include/rte_pci.h deleted +0 -598

598 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/Makefile +0 -10
index ad7e34a..e24c103 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/linuxapp/eal/eal_pci.c deleted +0 -723

723 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal_pci_init.h deleted +0 -97

97 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 -674

674 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c deleted +0 -424

424 lines not on this page · raw message

lib/librte_ether/rte_ethdev.h +0 -2
index 0adf327..654bdf5 100644

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 +92 -0

92 lines not on this page · raw message

lib/librte_pci/rte_pci_version.map new file +8 -0
new file mode 100644
index 0000000..64dec54

Lines of this file are not shown. View the raw message.

mk/rte.app.mk +3 -0
index c25fdd9..f93618f 100644

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.

#7 lore raw

Re: [PATCH 05/13] pci: introduce PCI lib and bus

Quoted 139 lines · Gaetan Rivet

The 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 their expected place.

---
 config/common_base                             |  15 + drivers/bus/Makefile                           |   2 + drivers/bus/pci/Makefile                       |  60 ++ drivers/bus/pci/bsd/Makefile                   |  32 ++ drivers/bus/pci/bsd/rte_pci.c                  | 670
+++++++++++++++++++++++
 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            | 567
+++++++++++++++++++
 drivers/bus/pci/linux/rte_pci_vfio.c           | 674
+++++++++++++++++++++++
 drivers/bus/pci/linux/rte_vfio_mp_sync.c       | 424 +++++++++++++++ drivers/bus/pci/private.h                      | 173 ++++++ drivers/bus/pci/rte_bus_pci_version.map        |  21 + drivers/bus/pci/rte_pci_common.c               | 542
++++++++++++++++++
 drivers/bus/pci/rte_pci_common_uio.c           | 234 ++++++++ lib/Makefile                                   |   2 + lib/librte_eal/bsdapp/eal/Makefile             |   3 - lib/librte_eal/bsdapp/eal/eal_pci.c            | 670 -------------
----------
 lib/librte_eal/common/Makefile                 |   2 +- lib/librte_eal/common/eal_common_pci.c         | 580 -------------
-------
 lib/librte_eal/common/eal_common_pci_uio.c     | 233 -------- lib/librte_eal/common/include/rte_pci.h        | 598 -------------
-------
 lib/librte_eal/linuxapp/eal/Makefile           |  10 - lib/librte_eal/linuxapp/eal/eal_pci.c          | 723 -------------
------------
 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_ether/rte_ethdev.h                  |   2 - lib/librte_pci/Makefile                        |  49 ++ lib/librte_pci/include/rte_pci.h               | 279 ++++++++++ lib/librte_pci/rte_pci.c                       |  92 ++++ lib/librte_pci/rte_pci_version.map             |   8 + mk/rte.app.mk                                  |   3 +

 35 files changed, 5092 insertions(+), 4582 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 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

lib/librte_pci/Makefile new file +6 -0
new file mode 100644
index 0000000..e3c6ca5
@@ -0,0 +1,49 @@
+#   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

lib/librte_pci/Makefile new file +3 -0
+#   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

lib/librte_pci/Makefile new file +4 -0
+#       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.

lib/librte_pci/Makefile new file +2 -0
+#
+#   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,

lib/librte_pci/Makefile new file +2 -0
+#   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.

lib/librte_pci/Makefile line 39

Quoted 9 lines
lib/librte_pci/Makefile new file +9 -0
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pci.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/include

This breaks build reproducibility, please use something like:

CFLAGS := -I$(SRCDIR)/include -I$(SRCDIR) $(CFLAGS) CFLAGS += $(WERROR_FLAGS) -O3

See http://dpdk.org/dev/patchwork/patch/27639/

Signature · 2 lines
Kind regards,
Luca Boccassi
#8 lore raw

Re: [PATCH 05/13] pci: introduce PCI lib and bus

Quoted 152 lines · Luca Boccassi
Quoted 139 lines · Gaetan Rivet

The 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 their expected place.

---
 config/common_base                             |  15 + drivers/bus/Makefile                           |   2 + drivers/bus/pci/Makefile                       |  60 ++ drivers/bus/pci/bsd/Makefile                   |  32 ++ drivers/bus/pci/bsd/rte_pci.c                  | 670
+++++++++++++++++++++++
 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            | 567
+++++++++++++++++++
 drivers/bus/pci/linux/rte_pci_vfio.c           | 674
+++++++++++++++++++++++
 drivers/bus/pci/linux/rte_vfio_mp_sync.c       | 424 +++++++++++++++ drivers/bus/pci/private.h                      | 173 ++++++ drivers/bus/pci/rte_bus_pci_version.map        |  21 + drivers/bus/pci/rte_pci_common.c               | 542
++++++++++++++++++
 drivers/bus/pci/rte_pci_common_uio.c           | 234 ++++++++ lib/Makefile                                   |   2 + lib/librte_eal/bsdapp/eal/Makefile             |   3 - lib/librte_eal/bsdapp/eal/eal_pci.c            | 670 -------------
----------
 lib/librte_eal/common/Makefile                 |   2 +- lib/librte_eal/common/eal_common_pci.c         | 580 -------------
-------
 lib/librte_eal/common/eal_common_pci_uio.c     | 233 -------- lib/librte_eal/common/include/rte_pci.h        | 598 -------------
-------
 lib/librte_eal/linuxapp/eal/Makefile           |  10 - lib/librte_eal/linuxapp/eal/eal_pci.c          | 723 -------------
------------
 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_ether/rte_ethdev.h                  |   2 - lib/librte_pci/Makefile                        |  49 ++ lib/librte_pci/include/rte_pci.h               | 279 ++++++++++ lib/librte_pci/rte_pci.c                       |  92 ++++ lib/librte_pci/rte_pci_version.map             |   8 + mk/rte.app.mk                                  |   3 +

 35 files changed, 5092 insertions(+), 4582 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 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

lib/librte_pci/Makefile new file +6 -0
new file mode 100644
index 0000000..e3c6ca5
@@ -0,0 +1,49 @@
+#   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

lib/librte_pci/Makefile new file +3 -0
+#   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

lib/librte_pci/Makefile new file +4 -0
+#       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.

lib/librte_pci/Makefile new file +2 -0
+#
+#   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,

lib/librte_pci/Makefile new file +2 -0
+#   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.

lib/librte_pci/Makefile line 39

Quoted 9 lines
lib/librte_pci/Makefile new file +9 -0
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+# library name
+LIB = librte_pci.a
+
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+CFLAGS += -I$(SRCDIR) -I$(SRCDIR)/include

This breaks build reproducibility, please use something like:

Quoted 5 lines

CFLAGS := -I$(SRCDIR)/include -I$(SRCDIR) $(CFLAGS) CFLAGS += $(WERROR_FLAGS) -O3

See http://dpdk.org/dev/patchwork/patch/27639/

Sure, thanks for the heads up.

Quoted 3 lines
Signature · 2 lines
Kind regards,
Luca Boccassi
Signature · 2 lines
Gaëtan Rivet
6WIND
#9 lore raw

PATCH 6/13 pci: avoid inlining functions

In reply to Gaetan Rivet

Parsing operations should not happen in performance critical sections. Headers should not propose implementations unless duly required.

---
 lib/librte_pci/include/rte_pci.h   | 69 ++++----------------------------------
 lib/librte_pci/rte_pci.c           | 65 +++++++++++++++++++++++++++++++++++
 lib/librte_pci/rte_pci_version.map |  4 +++
 3 files changed, 75 insertions(+), 63 deletions(-)
lib/librte_pci/include/rte_pci.h +6 -63
index 3858e80..09a609a 100644
@@ -126,19 +126,6 @@ struct mapped_pci_resource {
 /** mapped pci device list */
 TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
 
-/**< Internal use only - 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)
-
 /**
  * Utility function to produce a PCI Bus-Device-Function value
  * given a string representation. Assumes that the BDF is provided without
@@ -152,15 +139,7 @@ do {                                                               \
  * @return
  *  0 on success, negative on error.
  */
-static inline 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_BDF(const char *input, struct rte_pci_addr *dev_addr);
 
 /**
  * Utility function to produce a PCI Bus-Device-Function value
@@ -174,16 +153,7 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
  * @return
  *  0 on success, negative on error.
  */
-static inline 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
+int eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr);
 
 /**
  * Utility function to write a pci device name, this device name can later be
@@ -197,17 +167,9 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
  * @param size
  *	The output buffer size
  */
-static inline 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);
-}
+void rte_pci_device_name(const struct rte_pci_addr *addr,
+			 char *output, size_t size);
 
-/* Compare two PCI device addresses. */
 /**
  * Utility function to compare two PCI device addresses.
  *
@@ -220,27 +182,8 @@ rte_pci_device_name(const struct rte_pci_addr *addr,
  *	Positive on addr is greater than addr2.
  *	Negative on addr is less than addr2, or error.
  */
-static inline 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;
-}
+int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
+			     const struct rte_pci_addr *addr2);
 
 /**
  * Map a particular resource from a file.
lib/librte_pci/rte_pci.c +65 -0

71 lines not on this page · raw message

lib/librte_pci/rte_pci_version.map +4 -0
index 64dec54..a940259 100644
@@ -1,8 +1,12 @@
 DPDK_17.11 {
 	global:
 
+	eal_parse_pci_BDF;
+	eal_parse_pci_DomBDF;
 	pci_map_resource;
 	pci_unmap_resource;
+	rte_eal_compare_pci_addr;
+	rte_pci_device_name;
 
 	local: *;
 };
Signature · 1 line
2.1.4
#10 lore raw

PATCH 7/13 pci: avoid over-complicated macro

In reply to Gaetan Rivet

Using 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_pci/rte_pci.c | 65 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 46 insertions(+), 19 deletions(-)
lib/librte_pci/rte_pci.c +46 -19
index 8584b55..cbb5359 100644
@@ -53,36 +53,63 @@
 
 #include "rte_pci.h"
 
-/* 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;
 }
 
Signature · 1 line
2.1.4
#11 lore raw

PATCH 8/13 pci: deprecate misnamed functions

In reply to Gaetan Rivet

Rename misnamed functions and describe the change in a deprecation notice.

---
 doc/guides/rel_notes/deprecation.rst | 10 ++++++
 lib/librte_pci/include/rte_pci.h     | 63 ++++++++++++++++++++++++++++++++++++
 lib/librte_pci/rte_pci.c             | 26 +++++++++++++++
 lib/librte_pci/rte_pci_version.map   |  4 +++
 4 files changed, 103 insertions(+)
doc/guides/rel_notes/deprecation.rst +10 -0
index 3362f33..1828e57 100644
@@ -120,3 +120,13 @@ Deprecation Notices
   The non-"do-sig" versions of the hash tables will be removed
   (including the ``signature_offset`` parameter)
   and the "do-sig" versions renamed accordingly.
+
+* pci: Several exposed functions are misnamed.
+  The following functions are deprecated starting from v17.11 and are replaced:
+
+  - ``eal_parse_pci_BDF`` replaced by ``pci_parse_BDF``
+  - ``eal_parse_pci_DomBDF`` replaced by ``pci_parse_DomBDF``
+  - ``rte_eal_compare_pci_addr`` replaced by ``pci_addr_cmp``
+  - ``rte_pci_device_name`` replaced by ``pci_device_name``
+
+  The functions are only renamed. Their behavior is not affected.
lib/librte_pci/include/rte_pci.h +63 -0

93 lines not on this page · raw message

lib/librte_pci/rte_pci.c +26 -0
index cbb5359..54ce10d 100644
@@ -73,6 +73,12 @@ 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)
 {
+	return pci_parse_BDF(input, dev_addr);
+}
+
+int
+pci_parse_BDF(const char *input, struct rte_pci_addr *dev_addr)
+{
 	const char *in = input;
 
 	dev_addr->domain = 0;
@@ -91,6 +97,12 @@ 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)
 {
+	return pci_parse_DomBDF(input, dev_addr);
+}
+
+int
+pci_parse_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
+{
 	const char *in = input;
 	unsigned long val;
 	char *end;
@@ -117,6 +129,13 @@ void
 rte_pci_device_name(const struct rte_pci_addr *addr,
 		    char *output, size_t size)
 {
+	pci_device_name(addr, output, size);
+}
+
+void
+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,
@@ -127,6 +146,13 @@ int
 rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
 			 const struct rte_pci_addr *addr2)
 {
+	return pci_addr_cmp(addr, addr2);
+}
+
+int
+pci_addr_cmp(const struct rte_pci_addr *addr,
+	     const struct rte_pci_addr *addr2)
+{
 	uint64_t dev_addr, dev_addr2;
 
 	if ((addr == NULL) || (addr2 == NULL))
lib/librte_pci/rte_pci_version.map +4 -0
index a940259..541769f 100644
@@ -3,7 +3,11 @@ DPDK_17.11 {
 
 	eal_parse_pci_BDF;
 	eal_parse_pci_DomBDF;
+	pci_addr_cmp;
+	pci_device_name;
 	pci_map_resource;
+	pci_parse_BDF;
+	pci_parse_DomBDF;
 	pci_unmap_resource;
 	rte_eal_compare_pci_addr;
 	rte_pci_device_name;
Signature · 1 line
2.1.4
#12 lore raw

PATCH 9/13 lib: include rte_bus_pci

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update the libraries, as structuraly unsound as it may be.

---
 lib/librte_ether/rte_ethdev_pci.h          | 1 +
 lib/librte_eventdev/rte_eventdev_pmd_pci.h | 1 +
 2 files changed, 2 insertions(+)
lib/librte_ether/rte_ethdev_pci.h +1 -0
index 56b1072..722075e 100644
@@ -36,6 +36,7 @@
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 
 /**
lib/librte_eventdev/rte_eventdev_pmd_pci.h +1 -0
index b6bd731..ade32b5 100644
@@ -50,6 +50,7 @@ extern "C" {
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "rte_eventdev_pmd.h"
 
Signature · 1 line
2.1.4
#13 lore raw

PATCH 10/13 drivers: include rte_bus_pci

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update drivers.

---
 drivers/bus/pci/bsd/rte_pci.c            | 1 +
 drivers/bus/pci/linux/rte_pci.c          | 1 +
 drivers/bus/pci/linux/rte_pci_uio.c      | 1 +
 drivers/bus/pci/linux/rte_pci_vfio.c     | 1 +
 drivers/bus/pci/linux/rte_vfio_mp_sync.c | 1 +
 drivers/bus/pci/private.h                | 1 +
 drivers/bus/pci/rte_pci_common.c         | 1 +
 drivers/bus/pci/rte_pci_common_uio.c     | 1 +
 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 +
 35 files changed, 38 insertions(+), 1 deletion(-)
drivers/bus/pci/bsd/rte_pci.c +1 -0
index 5bd0f4b..6c7ab81 100644
@@ -57,6 +57,7 @@
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_launch.h>
 #include <rte_memory.h>
drivers/bus/pci/linux/rte_pci.c +1 -0
index 96f9778..4f5255b 100644
@@ -37,6 +37,7 @@
 #include <rte_log.h>
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
drivers/bus/pci/linux/rte_pci_uio.c +1 -0
index eed6d0f..1f0dacd 100644
@@ -47,6 +47,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
drivers/bus/pci/linux/rte_pci_vfio.c +1 -0
index 81b67c9..ab63423 100644
@@ -42,6 +42,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 
drivers/bus/pci/linux/rte_vfio_mp_sync.c +1 -0
index 2c1654d..d24eba1 100644
@@ -50,6 +50,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 
drivers/bus/pci/private.h +1 -0
index 7ff1fc4..fdc2c81 100644
@@ -37,6 +37,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 struct rte_pci_driver;
 struct rte_pci_device;
drivers/bus/pci/rte_pci_common.c +1 -0
index c37b85b..459ae42 100644
@@ -45,6 +45,7 @@
 #include <rte_log.h>
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
drivers/bus/pci/rte_pci_common_uio.c +1 -0
index 4365660..544c606 100644
@@ -40,6 +40,7 @@
 
 #include <rte_eal.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
drivers/crypto/qat/qat_qp.c +1 -0
index 5048d21..a22d6ef 100644
@@ -37,6 +37,7 @@
 #include <rte_memzone.h>
 #include <rte_cryptodev_pmd.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_prefetch.h>
 
drivers/event/octeontx/ssovf_probe.c +1 -0
index e1c0c6d..1cac4bc 100644
@@ -35,6 +35,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "ssovf_evdev.h"
 
drivers/net/ark/ark_ethdev.c +1 -0
index 6db362b..78a4d79 100644
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 #include <dlfcn.h>
 
+#include <rte_bus_pci.h>
 #include <rte_ethdev_pci.h>
 #include <rte_kvargs.h>
 
drivers/net/avp/avp_ethdev.c +2 -0
index c746a0e..194aadb 100644
@@ -36,6 +36,7 @@
 #include <errno.h>
 #include <unistd.h>
 
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_memcpy.h>
@@ -45,6 +46,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
drivers/net/bnxt/bnxt.h +1 -0
index 405d94d..d7409a8 100644
@@ -39,6 +39,7 @@
 #include <sys/queue.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
drivers/net/bonding/rte_eth_bond_args.c +1 -0
index bb634c6..2b7b464 100644
@@ -33,6 +33,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_kvargs.h>
 
 #include <cmdline_parse.h>
drivers/net/cxgbe/base/adapter.h +1 -0
index 5e5f221..f2057af 100644
@@ -36,6 +36,7 @@
 #ifndef __T4_ADAPTER_H__
 #define __T4_ADAPTER_H__
 
+#include <rte_bus_pci.h>
 #include <rte_mbuf.h>
 #include <rte_io.h>
 
drivers/net/cxgbe/cxgbe_ethdev.c +1 -0
index 7bca456..dc322da 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/e1000/em_ethdev.c +1 -0
index 3d4ab93..c52e5f7 100644
@@ -43,6 +43,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/e1000/igb_ethdev.c +1 -0
index e4f7a9f..36385cf 100644
@@ -43,6 +43,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/e1000/igb_pf.c +1 -0
index 6809d30..cd6ae2f 100644
@@ -39,6 +39,7 @@
 #include <stdarg.h>
 #include <inttypes.h>
 
+#include <rte_bus_pci.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_debug.h>
drivers/net/ena/ena_ethdev.h +1 -0
index dc3080f..be8bc9f 100644
@@ -35,6 +35,7 @@
 #define _ENA_ETHDEV_H_
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "ena_com.h"
 
drivers/net/enic/base/vnic_dev.h +3 -1
index 9a9e691..c9ca25b 100644
@@ -35,8 +35,10 @@
 #ifndef _VNIC_DEV_H_
 #define _VNIC_DEV_H_
 
+#include <rte_pci.h>
+#include <rte_bus_pci.h>
+
 #include "enic_compat.h"
-#include "rte_pci.h"
 #include "vnic_resource.h"
 #include "vnic_devcmd.h"
 
drivers/net/enic/enic_ethdev.c +1 -0
index da8fec2..681efb2 100644
@@ -37,6 +37,7 @@
 
 #include <rte_dev.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_string_fns.h>
drivers/net/enic/enic_main.c +1 -0
index 40dbec7..b35ad5d 100644
@@ -40,6 +40,7 @@
 #include <libgen.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
drivers/net/i40e/i40e_ethdev.c +1 -0
index 5f26e24..edf6e4c 100644
@@ -43,6 +43,7 @@
 #include <rte_eal.h>
 #include <rte_string_fns.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
index f6d8293..1686ad0 100644
@@ -47,6 +47,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/ixgbe/ixgbe_ethdev.c +1 -0
index 22171d8..a348112 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/ixgbe/ixgbe_ethdev.h +1 -0
index caa50c8..383ec71 100644
@@ -41,6 +41,7 @@
 #include <rte_time.h>
 #include <rte_hash.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
drivers/net/mlx5/mlx5.c +1 -0
index b7e5046..968599e 100644
@@ -58,6 +58,7 @@
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #ifdef PEDANTIC
drivers/net/mlx5/mlx5_ethdev.c +1 -0
index b0eb3cd..c2dc1f1 100644
@@ -56,6 +56,7 @@
 #endif
 #include <rte_atomic.h>
 #include <rte_ethdev.h>
+#include <rte_bus_pci.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
drivers/net/sfc/sfc.h +1 -0
index 286d1ac..5944103 100644
@@ -35,6 +35,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
drivers/net/sfc/sfc_ethdev.c +1 -0
index 12bcd6f..74e2486 100644
@@ -33,6 +33,7 @@
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_errno.h>
 
 #include "efx.h"
drivers/net/thunderx/nicvf_ethdev.c +1 -0
index edc17f1..e63dc4e 100644
@@ -61,6 +61,7 @@
 #include <rte_malloc.h>
 #include <rte_random.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tailq.h>
 
 #include "base/nicvf_plat.h"
drivers/net/virtio/virtio_ethdev.c +1 -0
index e320811..9a6850d 100644
@@ -46,6 +46,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_errno.h>
drivers/net/virtio/virtio_pci.h +1 -0
index 18caebd..c8261b7 100644
@@ -37,6 +37,7 @@
 #include <stdint.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 
 struct virtqueue;
drivers/net/vmxnet3/vmxnet3_ethdev.c +1 -0
index 3910991..bf4900d 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
Signature · 1 line
2.1.4
#14 lore raw

PATCH 11/13 test: include rte_bus_pci

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update test applications.

---
 test/test/virtual_pmd.c | 1 +
 1 file changed, 1 insertion(+)
test/test/virtual_pmd.c +1 -0
index 9d46ad5..72e784a 100644
@@ -34,6 +34,7 @@
 #include <rte_mbuf.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_memory.h>
Signature · 1 line
2.1.4
#15 lore raw

PATCH 12/13 app/testpmd: include rte_bus_pci

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update applications.

---
 app/test-pmd/testpmd.h | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/testpmd.h +1 -0
index c9d7739..787fc03 100644
@@ -35,6 +35,7 @@
 #define _TESTPMD_H_
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_gro.h>
 
 #define RTE_PORT_ALL            (~(portid_t)0x0)
Signature · 1 line
2.1.4
#16 lore raw

PATCH 13/13 cryptodev: move PCI specific helpers to drivers/crypto

In reply to Gaetan Rivet

Those helpers rely on the PCI bus driver implementation. Other similar libraries relied on the bus-specifics being handled in inlined functions, to be compiled on demand by drivers, once the proper PCI dependency has been settled. This seems unsafe.

Move the PCI-specific helpers out of the lib directory to the drivers/crypto directory, properly following the dependency hierarchy.

---
 drivers/Makefile                                 |   2 +-
 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 ++
 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 -
 10 files changed, 285 insertions(+), 191 deletions(-)
 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
drivers/Makefile +1 -1
index 7fef66d..a5d3fa0 100644
@@ -37,7 +37,7 @@ DEPDIRS-mempool := bus
 DIRS-y += net
 DEPDIRS-net := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
-DEPDIRS-crypto := mempool
+DEPDIRS-crypto := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
 DEPDIRS-event := bus
 
drivers/crypto/Makefile +3 -1
index 7a719b9..cfd6cb6 100644
@@ -33,6 +33,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_cryptodev
 
+DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DEPDIRS-pci = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm
 DEPDIRS-aesni_gcm = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
@@ -42,7 +44,7 @@ DEPDIRS-armv8 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += openssl
 DEPDIRS-openssl = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat
-DEPDIRS-qat = $(core-libs)
+DEPDIRS-qat = $(core-libs) librte_cryptodev_pci
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler
 DEPDIRS-scheduler = $(core-libs) librte_kvargs librte_reorder
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += snow3g
drivers/crypto/pci/Makefile new file +52 -0

52 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci.c new file +128 -0

128 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci.h new file +94 -0

94 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci_version.map new file +7 -0
new file mode 100644
index 0000000..0510fef
@@ -0,0 +1,7 @@
+DPDK_17.11 {
+	global:
+
+	rte_cryptodev_pci_generic_probe;
+	rte_cryptodev_pci_generic_remove;
+
+};
lib/librte_cryptodev/Makefile +0 -1
index 6ac331b..bd94cf7 100644
@@ -49,7 +49,6 @@ SYMLINK-y-include += rte_crypto_sym.h
 SYMLINK-y-include += rte_cryptodev.h
 SYMLINK-y-include += rte_cryptodev_pmd.h
 SYMLINK-y-include += rte_cryptodev_vdev.h
-SYMLINK-y-include += rte_cryptodev_pci.h
 
 # versioning export map
 EXPORT_MAP := rte_cryptodev_version.map
lib/librte_cryptodev/rte_cryptodev_pci.h deleted +0 -92

92 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_pmd.c +0 -94

103 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_version.map +0 -2
index e9ba88a..496253d 100644
@@ -68,8 +68,6 @@ DPDK_17.08 {
 	rte_cryptodev_get_aead_algo_enum;
 	rte_cryptodev_get_header_session_size;
 	rte_cryptodev_get_private_session_size;
-	rte_cryptodev_pci_generic_probe;
-	rte_cryptodev_pci_generic_remove;
 	rte_cryptodev_sym_capability_check_aead;
 	rte_cryptodev_sym_session_init;
 	rte_cryptodev_sym_session_clear;
Signature · 1 line
2.1.4
#17 lore raw

v2 cover Move PCI away from the EAL

In reply to 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 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.

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

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/crypto

Until 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: expose rte_eal_using_phys_addrs
ethdev: remove useless PCI dependency
bus: properly include rte_debug
eal: remove references to PCI
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/crypto
pci: avoid inlining functions
pci: avoid over-complicated macro
pci: deprecate misnamed functions
doc: add notes on EAL PCI API update

 app/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 · 1 line
2.1.4
#18 lore raw

PATCH v2 1/14 eal: expose rte_eal_using_phys_addrs

This 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/bsdapp/eal/rte_eal_version.map   |  1 +
 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/linuxapp/eal/rte_eal_version.map |  1 +
 6 files changed, 20 insertions(+), 12 deletions(-)
lib/librte_eal/bsdapp/eal/eal_memory.c +6 -0
index 3614da8..65c96b0 100644
@@ -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/bsdapp/eal/rte_eal_version.map +1 -0
index 47a09ea..cff7d18 100644
@@ -200,6 +200,7 @@ DPDK_17.08 {
 	rte_bus_find;
 	rte_bus_find_by_device;
 	rte_bus_find_by_name;
+	rte_eal_using_phys_addrs;
 	rte_log_get_level;
 
 } DPDK_17.05;
lib/librte_eal/common/eal_private.h +0 -11
index 597d82e..10a7078 100644
@@ -333,17 +333,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
index 4aa5d1f..5568931 100644
@@ -195,6 +195,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 RTE_LIBRTE_XEN_DOM0
 
 /**< Internal use only - should DOM0 memory mapping be used */
lib/librte_eal/linuxapp/eal/eal_memory.c +1 -1
index 5279128..af8719b 100644
@@ -1542,7 +1542,7 @@ rte_eal_hugepage_attach(void)
 	return -1;
 }
 
-bool
+int
 rte_eal_using_phys_addrs(void)
 {
 	return phys_addrs_available;
lib/librte_eal/linuxapp/eal/rte_eal_version.map +1 -0
index 8c08b8d..f866b70 100644
@@ -205,6 +205,7 @@ DPDK_17.08 {
 	rte_bus_find;
 	rte_bus_find_by_device;
 	rte_bus_find_by_name;
+	rte_eal_using_phys_addrs;
 	rte_log_get_level;
 
 } DPDK_17.05;
Signature · 1 line
2.1.4
#19 lore raw

Re: [PATCH v2 01/14] eal: expose rte_eal_using_phys_addrs

Hello Gaetan,

Quoted 9 lines · Gaetan Rivet

This 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/linuxapp/eal/rte_eal_version.map DPDK_17.08 {

Quoted 18 lines
lib/librte_eal/linuxapp/eal/eal_memory.c +1 -1
index 5279128..af8719b 100644
@@ -1542,7 +1542,7 @@ rte_eal_hugepage_attach(void)
  	return -1;
  }
 
-bool
+int
  rte_eal_using_phys_addrs(void)
  {
  	return phys_addrs_available;
lib/librte_eal/linuxapp/eal/rte_eal_version.map +0 -0
index 8c08b8d..f866b70 100644
@@ -205,6 +205,7 @@ DPDK_17.08 {

This symbol should be added to 17.11, isn't it?

lib/librte_eal/linuxapp/eal/rte_eal_version.map DPDK_17.08 { · line 211

Quoted 8 lines
lib/librte_eal/linuxapp/eal/rte_eal_version.map +1 -0
  	rte_bus_find;
  	rte_bus_find_by_device;
  	rte_bus_find_by_name;
+	rte_eal_using_phys_addrs;
  	rte_log_get_level;
 
  } DPDK_17.05;

-
Shreyansh

#20 lore raw

Re: [PATCH v2 01/14] eal: expose rte_eal_using_phys_addrs

Quoted 26 lines · Shreyansh Jain

Hello Gaetan,

Quoted 9 lines · Gaetan Rivet

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

---

[...]

Quoted 11 lines
lib/librte_eal/linuxapp/eal/eal_memory.c +1 -1
index 5279128..af8719b 100644
@@ -1542,7 +1542,7 @@ rte_eal_hugepage_attach(void)
 	return -1;
 }
-bool
+int
 rte_eal_using_phys_addrs(void)
 {
Quoted 9 lines

lib/librte_eal/linuxapp/eal/rte_eal_version.map DPDK_17.08 {

Quoted 6 lines
lib/librte_eal/linuxapp/eal/eal_memory.c +0 -0
 	return phys_addrs_available;
lib/librte_eal/linuxapp/eal/rte_eal_version.map +0 -0
index 8c08b8d..f866b70 100644
@@ -205,6 +205,7 @@ DPDK_17.08 {

This symbol should be added to 17.11, isn't it?

Ah, yes indeed

Quoted 9 lines

lib/librte_eal/linuxapp/eal/rte_eal_version.map DPDK_17.08 { · line 211

Quoted 7 lines
lib/librte_eal/linuxapp/eal/rte_eal_version.map +1 -0
 	rte_bus_find;
 	rte_bus_find_by_device;
 	rte_bus_find_by_name;
+	rte_eal_using_phys_addrs;
 	rte_log_get_level;
 } DPDK_17.05;
 

-
Shreyansh

Signature · 2 lines
Gaëtan Rivet
6WIND
#21 lore raw

PATCH v2 2/14 ethdev: remove useless PCI dependency

In reply to Gaetan Rivet
---
 lib/librte_ether/rte_ethdev.c | 1 -
 1 file changed, 1 deletion(-)
lib/librte_ether/rte_ethdev.c +0 -1
index a88916f..c5b0b17 100644
@@ -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
#22 lore raw

PATCH v2 3/14 bus: properly include rte_debug

In reply to Gaetan Rivet
---
 lib/librte_eal/common/eal_common_bus.c | 1 +
 1 file changed, 1 insertion(+)
lib/librte_eal/common/eal_common_bus.c +1 -0
index 08bec2d..9d1be8a 100644
@@ -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
#23 lore raw

PATCH v2 4/14 eal: remove references to PCI

In reply to Gaetan Rivet
---
 lib/librte_eal/bsdapp/eal/eal.c              |   1 -
 lib/librte_eal/common/eal_private.h          | 132 ---------------------------
 lib/librte_eal/linuxapp/eal/eal.c            |   1 -
 lib/librte_eal/linuxapp/eal/eal_interrupts.c |   1 -
 4 files changed, 135 deletions(-)
lib/librte_eal/bsdapp/eal/eal.c +0 -1
index 5fa5988..b7c045f 100644
@@ -66,7 +66,6 @@
 #include <rte_cpuflags.h>
 #include <rte_interrupts.h>
 #include <rte_bus.h>
-#include <rte_pci.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
 #include <rte_version.h>
lib/librte_eal/common/eal_private.h +0 -132

144 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal.c +0 -1
index 48f12f4..f72da15 100644
@@ -71,7 +71,6 @@
 #include <rte_cpuflags.h>
 #include <rte_interrupts.h>
 #include <rte_bus.h>
-#include <rte_pci.h>
 #include <rte_dev.h>
 #include <rte_devargs.h>
 #include <rte_version.h>
lib/librte_eal/linuxapp/eal/eal_interrupts.c +0 -1
index 3e9ac41..0bebf00 100644
@@ -60,7 +60,6 @@
 #include <rte_branch_prediction.h>
 #include <rte_debug.h>
 #include <rte_log.h>
-#include <rte_pci.h>
 #include <rte_malloc.h>
 #include <rte_errno.h>
 #include <rte_spinlock.h>
Signature · 1 line
2.1.4
#24 lore raw

PATCH v2 5/14 pci: introduce PCI lib and bus

In reply to Gaetan Rivet

The 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 their expected place.

---
 config/common_base                              |  10 +
 drivers/bus/Makefile                            |   2 +
 drivers/bus/pci/Makefile                        |  59 ++
 drivers/bus/pci/bsd/Makefile                    |  32 ++
 drivers/bus/pci/bsd/rte_pci.c                   | 670 ++++++++++++++++++++++
 drivers/bus/pci/include/rte_bus_pci.h           | 387 +++++++++++++
 drivers/bus/pci/linux/Makefile                  |  37 ++
 drivers/bus/pci/linux/rte_pci.c                 | 722 ++++++++++++++++++++++++
 drivers/bus/pci/linux/rte_pci_init.h            |  97 ++++
 drivers/bus/pci/linux/rte_pci_uio.c             | 567 +++++++++++++++++++
 drivers/bus/pci/linux/rte_pci_vfio.c            | 674 ++++++++++++++++++++++
 drivers/bus/pci/linux/rte_vfio_mp_sync.c        | 424 ++++++++++++++
 drivers/bus/pci/private.h                       | 173 ++++++
 drivers/bus/pci/rte_bus_pci_version.map         |  21 +
 drivers/bus/pci/rte_pci_common.c                | 542 ++++++++++++++++++
 drivers/bus/pci/rte_pci_common_uio.c            | 234 ++++++++
 lib/Makefile                                    |   2 +
 lib/librte_eal/bsdapp/eal/Makefile              |   3 -
 lib/librte_eal/bsdapp/eal/eal_pci.c             | 670 ----------------------
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  15 -
 lib/librte_eal/common/Makefile                  |   2 +-
 lib/librte_eal/common/eal_common_pci.c          | 580 -------------------
 lib/librte_eal/common/eal_common_pci_uio.c      | 233 --------
 lib/librte_eal/common/include/rte_pci.h         | 598 --------------------
 lib/librte_eal/linuxapp/eal/Makefile            |  10 -
 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 |  15 -
 lib/librte_ether/rte_ethdev.h                   |   2 -
 lib/librte_pci/Makefile                         |  48 ++
 lib/librte_pci/include/rte_pci.h                | 279 +++++++++
 lib/librte_pci/rte_pci.c                        |  92 +++
 lib/librte_pci/rte_pci_version.map              |   8 +
 mk/rte.app.mk                                   |   3 +
 37 files changed, 5084 insertions(+), 4611 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
 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
config/common_base +10 -0
index 5e97a08..08db392 100644
@@ -122,6 +122,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
@@ -146,6 +151,11 @@ CONFIG_RTE_ETHDEV_RXTX_CALLBACKS=y
 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
index 0224214..4b5bafe 100644
@@ -34,5 +34,7 @@ core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
 
 DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
 DEPDIRS-fslmc = $(core-libs)
+DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DEPDIRS-pci = $(core-libs)
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/bus/pci/Makefile new file +59 -0

59 lines not on this page · raw message

drivers/bus/pci/bsd/Makefile new file +32 -0
new file mode 100644
index 0000000..77cf539
@@ -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 += rte_pci.c
drivers/bus/pci/bsd/rte_pci.c new file +670 -0

670 lines not on this page · raw message

drivers/bus/pci/include/rte_bus_pci.h new file +387 -0

387 lines not on this page · raw message

drivers/bus/pci/linux/Makefile new file +37 -0
new file mode 100644
index 0000000..d2ea84c
@@ -0,0 +1,37 @@
+#   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 += rte_pci.c
+SRCS += rte_pci_uio.c
+SRCS += rte_pci_vfio.c
+SRCS += rte_vfio_mp_sync.c
+
+CFLAGS += -D_GNU_SOURCE
drivers/bus/pci/linux/rte_pci.c new file +722 -0

722 lines not on this page · raw message

drivers/bus/pci/linux/rte_pci_init.h new file +97 -0

97 lines not on this page · raw message

drivers/bus/pci/linux/rte_pci_uio.c new file +567 -0

567 lines not on this page · raw message

drivers/bus/pci/linux/rte_pci_vfio.c new file +674 -0

400 lines not on this page · raw message

drivers/bus/pci/linux/rte_vfio_mp_sync.c new file +424 -0

424 lines not on this page · raw message

drivers/bus/pci/private.h new file +173 -0

173 lines not on this page · raw message

drivers/bus/pci/rte_bus_pci_version.map new file +21 -0
new file mode 100644
index 0000000..eca49e9

Lines of this file are not shown. View the raw message.

drivers/bus/pci/rte_pci_common.c new file +542 -0

542 lines not on this page · raw message

drivers/bus/pci/rte_pci_common_uio.c new file +234 -0

234 lines not on this page · raw message

lib/Makefile +2 -0
index 86caba1..147be60 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/bsdapp/eal/Makefile +0 -3
index 005019e..e5273f7 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/bsdapp/eal/eal_pci.c deleted +0 -670

670 lines not on this page · raw message

lib/librte_eal/bsdapp/eal/rte_eal_version.map +0 -15
index cff7d18..3ed3283 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/common/Makefile +1 -1
index e8fd67a..ac8d3bb 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/common/eal_common_pci.c deleted +0 -580

580 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/include/rte_pci.h deleted +0 -598

598 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/Makefile +0 -10
index 90bca4d..4abc886 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/linuxapp/eal/eal_pci.c deleted +0 -722

722 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal_pci_init.h deleted +0 -97

97 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 -674

674 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c deleted +0 -424

424 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/rte_eal_version.map +0 -15
index f866b70..0dc23bf 100644

Lines of this file are not shown. View the raw message.

lib/librte_ether/rte_ethdev.h +0 -2
index 99cdd54..af7af0a 100644

Lines of this file are not shown. View the raw message.

lib/librte_pci/Makefile new file +48 -0

48 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 +92 -0

92 lines not on this page · raw message

lib/librte_pci/rte_pci_version.map new file +8 -0
new file mode 100644
index 0000000..64dec54

Lines of this file are not shown. View the raw message.

mk/rte.app.mk +3 -0
index c25fdd9..f93618f 100644

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.

#25 lore raw

Re: [PATCH v2 05/14] pci: introduce PCI lib and bus

Hello Gaetan,

Quoted 66 lines · Gaetan Rivet

The 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 their expected place.

---
  config/common_base                              |  10 +
  drivers/bus/Makefile                            |   2 +
  drivers/bus/pci/Makefile                        |  59 ++
  drivers/bus/pci/bsd/Makefile                    |  32 ++
  drivers/bus/pci/bsd/rte_pci.c                   | 670 ++++++++++++++++++++++
  drivers/bus/pci/include/rte_bus_pci.h           | 387 +++++++++++++
  drivers/bus/pci/linux/Makefile                  |  37 ++
  drivers/bus/pci/linux/rte_pci.c                 | 722 ++++++++++++++++++++++++
  drivers/bus/pci/linux/rte_pci_init.h            |  97 ++++
  drivers/bus/pci/linux/rte_pci_uio.c             | 567 +++++++++++++++++++
  drivers/bus/pci/linux/rte_pci_vfio.c            | 674 ++++++++++++++++++++++
  drivers/bus/pci/linux/rte_vfio_mp_sync.c        | 424 ++++++++++++++
  drivers/bus/pci/private.h                       | 173 ++++++
  drivers/bus/pci/rte_bus_pci_version.map         |  21 +
  drivers/bus/pci/rte_pci_common.c                | 542 ++++++++++++++++++
  drivers/bus/pci/rte_pci_common_uio.c            | 234 ++++++++
  lib/Makefile                                    |   2 +
  lib/librte_eal/bsdapp/eal/Makefile              |   3 -
  lib/librte_eal/bsdapp/eal/eal_pci.c             | 670 ----------------------
  lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  15 -
  lib/librte_eal/common/Makefile                  |   2 +-
  lib/librte_eal/common/eal_common_pci.c          | 580 -------------------
  lib/librte_eal/common/eal_common_pci_uio.c      | 233 --------
  lib/librte_eal/common/include/rte_pci.h         | 598 --------------------
  lib/librte_eal/linuxapp/eal/Makefile            |  10 -
  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 |  15 -
  lib/librte_ether/rte_ethdev.h                   |   2 -
  lib/librte_pci/Makefile                         |  48 ++
  lib/librte_pci/include/rte_pci.h                | 279 +++++++++
  lib/librte_pci/rte_pci.c                        |  92 +++
  lib/librte_pci/rte_pci_version.map              |   8 +
  mk/rte.app.mk                                   |   3 +
  37 files changed, 5084 insertions(+), 4611 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 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

Quoted 9 lines

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

<lot of snip here...>

drivers/bus/pci/rte_bus_pci_version.map line 1

Quoted 8 lines
drivers/bus/pci/private.h new file +1 -0
+#endif /* _PCI_PRIVATE_H_ */
drivers/bus/pci/rte_bus_pci_version.map new file +1 -0
new file mode 100644
index 0000000..eca49e9
@@ -0,0 +1,21 @@
+DPDK_17.08 {

You might want to bump this to 17.11.

Quoted 10 lines
drivers/bus/pci/rte_bus_pci_version.map new file +10 -0
+	global:
+
+	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;

drivers/bus/pci/rte_bus_pci_version.map line 21

Quoted 10 lines
drivers/bus/pci/rte_bus_pci_version.map new file +10 -0
+	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;
+
+	local: *;
+};

This is huuuge patch :( and I am not yet through it (most of it is movement so I doubt anything major would be problem here). Just the above comment in case you are spinning a new series.

#26 lore raw

Re: [PATCH v2 05/14] pci: introduce PCI lib and bus

Hey,

Quoted 81 lines · Shreyansh Jain

Hello Gaetan,

Quoted 66 lines · Gaetan Rivet

The 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 their expected place.

---
 config/common_base                              |  10 +
 drivers/bus/Makefile                            |   2 +
 drivers/bus/pci/Makefile                        |  59 ++
 drivers/bus/pci/bsd/Makefile                    |  32 ++
 drivers/bus/pci/bsd/rte_pci.c                   | 670 ++++++++++++++++++++++
 drivers/bus/pci/include/rte_bus_pci.h           | 387 +++++++++++++
 drivers/bus/pci/linux/Makefile                  |  37 ++
 drivers/bus/pci/linux/rte_pci.c                 | 722 ++++++++++++++++++++++++
 drivers/bus/pci/linux/rte_pci_init.h            |  97 ++++
 drivers/bus/pci/linux/rte_pci_uio.c             | 567 +++++++++++++++++++
 drivers/bus/pci/linux/rte_pci_vfio.c            | 674 ++++++++++++++++++++++
 drivers/bus/pci/linux/rte_vfio_mp_sync.c        | 424 ++++++++++++++
 drivers/bus/pci/private.h                       | 173 ++++++
 drivers/bus/pci/rte_bus_pci_version.map         |  21 +
 drivers/bus/pci/rte_pci_common.c                | 542 ++++++++++++++++++
 drivers/bus/pci/rte_pci_common_uio.c            | 234 ++++++++
 lib/Makefile                                    |   2 +
 lib/librte_eal/bsdapp/eal/Makefile              |   3 -
 lib/librte_eal/bsdapp/eal/eal_pci.c             | 670 ----------------------
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  15 -
 lib/librte_eal/common/Makefile                  |   2 +-
 lib/librte_eal/common/eal_common_pci.c          | 580 -------------------
 lib/librte_eal/common/eal_common_pci_uio.c      | 233 --------
 lib/librte_eal/common/include/rte_pci.h         | 598 --------------------
 lib/librte_eal/linuxapp/eal/Makefile            |  10 -
 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 |  15 -
 lib/librte_ether/rte_ethdev.h                   |   2 -
 lib/librte_pci/Makefile                         |  48 ++
 lib/librte_pci/include/rte_pci.h                | 279 +++++++++
 lib/librte_pci/rte_pci.c                        |  92 +++
 lib/librte_pci/rte_pci_version.map              |   8 +
 mk/rte.app.mk                                   |   3 +
 37 files changed, 5084 insertions(+), 4611 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
 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
Quoted 9 lines
 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

<lot of snip here...>

Quoted 11 lines

drivers/bus/pci/rte_bus_pci_version.map line 1

Quoted 8 lines
drivers/bus/pci/private.h new file +1 -0
+#endif /* _PCI_PRIVATE_H_ */
drivers/bus/pci/rte_bus_pci_version.map new file +1 -0
new file mode 100644
index 0000000..eca49e9
@@ -0,0 +1,21 @@
+DPDK_17.08 {

You might want to bump this to 17.11.

Thanks, fixing this.

Quoted 16 lines
Quoted 16 lines
drivers/bus/pci/rte_bus_pci_version.map new file +16 -0
+	global:
+
+	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;
Quoted 10 lines

drivers/bus/pci/rte_bus_pci_version.map line 21

Quoted 4 lines
drivers/bus/pci/rte_bus_pci_version.map new file +4 -0
+	rte_pci_write_config;
+
+	local: *;
+};

This is huuuge patch :( and I am not yet through it (most of it is movement so I doubt anything major would be problem here).
Just the above comment in case you are spinning a new series.

Thanks for reading the patch.

Yes, most of it is moving the code as-is to a new location. I tried to reduce it, but at some point it does not really make sense anymore.

I think the important thing to look for here is the build system, dependency graph and the division of the PCI API between the lib and the bus driver.

I divided it along the lines of the rte_pci_device being defined or not. Anything using an rte_pci_device going to the bus and everything else going to the lib.

I'm mostly worried about this divide. Having the rte_pci_device defined seems mostly of the responsibility of the bus driver, in my opinion. I'd like to hear others'.

Signature · 2 lines
Gaëtan Rivet
6WIND
#27 lore raw

Re: [PATCH v2 05/14] pci: introduce PCI lib and bus

Quoted 125 lines · Gaëtan Rivet

Hey,

Quoted 81 lines · Shreyansh Jain

Hello Gaetan,

Quoted 66 lines · Gaetan Rivet

The 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 their expected place.

---
  config/common_base                              |  10 +
  drivers/bus/Makefile                            |   2 +
  drivers/bus/pci/Makefile                        |  59 ++
  drivers/bus/pci/bsd/Makefile                    |  32 ++
  drivers/bus/pci/bsd/rte_pci.c                   | 670 ++++++++++++++++++++++
  drivers/bus/pci/include/rte_bus_pci.h           | 387 +++++++++++++
  drivers/bus/pci/linux/Makefile                  |  37 ++
  drivers/bus/pci/linux/rte_pci.c                 | 722 ++++++++++++++++++++++++
  drivers/bus/pci/linux/rte_pci_init.h            |  97 ++++
  drivers/bus/pci/linux/rte_pci_uio.c             | 567 +++++++++++++++++++
  drivers/bus/pci/linux/rte_pci_vfio.c            | 674 ++++++++++++++++++++++
  drivers/bus/pci/linux/rte_vfio_mp_sync.c        | 424 ++++++++++++++
  drivers/bus/pci/private.h                       | 173 ++++++
  drivers/bus/pci/rte_bus_pci_version.map         |  21 +
  drivers/bus/pci/rte_pci_common.c                | 542 ++++++++++++++++++
  drivers/bus/pci/rte_pci_common_uio.c            | 234 ++++++++
  lib/Makefile                                    |   2 +
  lib/librte_eal/bsdapp/eal/Makefile              |   3 -
  lib/librte_eal/bsdapp/eal/eal_pci.c             | 670 ----------------------
  lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  15 -
  lib/librte_eal/common/Makefile                  |   2 +-
  lib/librte_eal/common/eal_common_pci.c          | 580 -------------------
  lib/librte_eal/common/eal_common_pci_uio.c      | 233 --------
  lib/librte_eal/common/include/rte_pci.h         | 598 --------------------
  lib/librte_eal/linuxapp/eal/Makefile            |  10 -
  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 |  15 -
  lib/librte_ether/rte_ethdev.h                   |   2 -
  lib/librte_pci/Makefile                         |  48 ++
  lib/librte_pci/include/rte_pci.h                | 279 +++++++++
  lib/librte_pci/rte_pci.c                        |  92 +++
  lib/librte_pci/rte_pci_version.map              |   8 +
  mk/rte.app.mk                                   |   3 +
  37 files changed, 5084 insertions(+), 4611 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 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

Quoted 9 lines

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

<lot of snip here...>

Quoted 11 lines

drivers/bus/pci/rte_bus_pci_version.map line 1

Quoted 8 lines
drivers/bus/pci/private.h new file +1 -0
+#endif /* _PCI_PRIVATE_H_ */
drivers/bus/pci/rte_bus_pci_version.map new file +1 -0
new file mode 100644
index 0000000..eca49e9
@@ -0,0 +1,21 @@
+DPDK_17.08 {

You might want to bump this to 17.11.

Thanks, fixing this.

Quoted 16 lines
Quoted 16 lines
drivers/bus/pci/rte_bus_pci_version.map new file +16 -0
+	global:
+
+	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;
Quoted 10 lines

drivers/bus/pci/rte_bus_pci_version.map line 21

Quoted 4 lines
drivers/bus/pci/rte_bus_pci_version.map new file +4 -0
+	rte_pci_write_config;
+
+	local: *;
+};

This is huuuge patch :( and I am not yet through it (most of it is movement so I doubt anything major would be problem here).
Just the above comment in case you are spinning a new series.

Quoted 5 lines

Thanks for reading the patch.

Yes, most of it is moving the code as-is to a new location. I tried to reduce it, but at some point it does not really make sense anymore.

Agree. It is difficult to manage such large movement with a compile-able patch series. I think compilation success takes priority over size in such cases so as not to break bisect.

Here, I found that "eal: remove references to PCI" onwards, the compilation was breaking. You have already mentioned about this in the cover letter, it seems.

Quoted 4 lines

I think the important thing to look for here is the build system, dependency graph and the division of the PCI API between the lib and the bus driver.

Agree. I am trying to look through this.

Quoted 4 lines

I divided it along the lines of the rte_pci_device being defined or not. Anything using an rte_pci_device going to the bus and everything else going to the lib.

Yes, I agree with this in principle.
rte_xxx_device and rte_xxx_driver originate from the xxx_bus. Bus should be responsible for defining (scan) xxx_devices and attaching (probe) to xxx_driver. Which in turn means that all APIs dealing with xxx_device and xxx_driver should be pivoted in the Bus layer.

Though, I think here the complexity is also of crypto devices. You have already reached out to Declan through cover letter - probably his (and other crypto experts) opinion would matter here.

My opinion would be to have

Quoted 5 lines

I'm mostly worried about this divide. Having the rte_pci_device defined seems mostly of the responsibility of the bus driver, in my opinion. I'd like to hear others'.

+1 from side for this principle for divide.

#28 lore raw

PATCH v2 6/14 lib: include rte_bus_pci

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update the libraries, as structuraly unsound as it may be.

---
 lib/librte_ether/rte_ethdev_pci.h          | 1 +
 lib/librte_eventdev/rte_eventdev_pmd_pci.h | 1 +
 2 files changed, 2 insertions(+)
lib/librte_ether/rte_ethdev_pci.h +1 -0
index 56b1072..722075e 100644
@@ -36,6 +36,7 @@
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 
 /**
lib/librte_eventdev/rte_eventdev_pmd_pci.h +1 -0
index b6bd731..ade32b5 100644
@@ -50,6 +50,7 @@ extern "C" {
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "rte_eventdev_pmd.h"
 
Signature · 1 line
2.1.4
#29 lore raw

PATCH v2 7/14 drivers: include rte_bus_pci

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update drivers.

---
 drivers/bus/pci/bsd/rte_pci.c            | 1 +
 drivers/bus/pci/linux/rte_pci.c          | 1 +
 drivers/bus/pci/linux/rte_pci_uio.c      | 1 +
 drivers/bus/pci/linux/rte_pci_vfio.c     | 1 +
 drivers/bus/pci/linux/rte_vfio_mp_sync.c | 1 +
 drivers/bus/pci/private.h                | 1 +
 drivers/bus/pci/rte_pci_common.c         | 1 +
 drivers/bus/pci/rte_pci_common_uio.c     | 1 +
 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 +
 35 files changed, 38 insertions(+), 1 deletion(-)
drivers/bus/pci/bsd/rte_pci.c +1 -0
index 5bd0f4b..6c7ab81 100644
@@ -57,6 +57,7 @@
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_launch.h>
 #include <rte_memory.h>
drivers/bus/pci/linux/rte_pci.c +1 -0
index c2ac82b..ba32d8b 100644
@@ -37,6 +37,7 @@
 #include <rte_log.h>
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
drivers/bus/pci/linux/rte_pci_uio.c +1 -0
index eed6d0f..1f0dacd 100644
@@ -47,6 +47,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
drivers/bus/pci/linux/rte_pci_vfio.c +1 -0
index 81b67c9..ab63423 100644
@@ -42,6 +42,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 
drivers/bus/pci/linux/rte_vfio_mp_sync.c +1 -0
index 2c1654d..d24eba1 100644
@@ -50,6 +50,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 
drivers/bus/pci/private.h +1 -0
index 7ff1fc4..fdc2c81 100644
@@ -37,6 +37,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 struct rte_pci_driver;
 struct rte_pci_device;
drivers/bus/pci/rte_pci_common.c +1 -0
index c37b85b..459ae42 100644
@@ -45,6 +45,7 @@
 #include <rte_log.h>
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
drivers/bus/pci/rte_pci_common_uio.c +1 -0
index 4365660..544c606 100644
@@ -40,6 +40,7 @@
 
 #include <rte_eal.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
drivers/crypto/qat/qat_qp.c +1 -0
index 5048d21..a22d6ef 100644
@@ -37,6 +37,7 @@
 #include <rte_memzone.h>
 #include <rte_cryptodev_pmd.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_prefetch.h>
 
drivers/event/octeontx/ssovf_probe.c +1 -0
index e1c0c6d..1cac4bc 100644
@@ -35,6 +35,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "ssovf_evdev.h"
 
drivers/net/ark/ark_ethdev.c +1 -0
index 6db362b..78a4d79 100644
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 #include <dlfcn.h>
 
+#include <rte_bus_pci.h>
 #include <rte_ethdev_pci.h>
 #include <rte_kvargs.h>
 
drivers/net/avp/avp_ethdev.c +2 -0
index c746a0e..194aadb 100644
@@ -36,6 +36,7 @@
 #include <errno.h>
 #include <unistd.h>
 
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_memcpy.h>
@@ -45,6 +46,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
drivers/net/bnxt/bnxt.h +1 -0
index 405d94d..d7409a8 100644
@@ -39,6 +39,7 @@
 #include <sys/queue.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
drivers/net/bonding/rte_eth_bond_args.c +1 -0
index bb634c6..2b7b464 100644
@@ -33,6 +33,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_kvargs.h>
 
 #include <cmdline_parse.h>
drivers/net/cxgbe/base/adapter.h +1 -0
index 5e5f221..f2057af 100644
@@ -36,6 +36,7 @@
 #ifndef __T4_ADAPTER_H__
 #define __T4_ADAPTER_H__
 
+#include <rte_bus_pci.h>
 #include <rte_mbuf.h>
 #include <rte_io.h>
 
drivers/net/cxgbe/cxgbe_ethdev.c +1 -0
index 7bca456..dc322da 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/e1000/em_ethdev.c +1 -0
index 3d4ab93..c52e5f7 100644
@@ -43,6 +43,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/e1000/igb_ethdev.c +1 -0
index e4f7a9f..36385cf 100644
@@ -43,6 +43,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/e1000/igb_pf.c +1 -0
index 6809d30..cd6ae2f 100644
@@ -39,6 +39,7 @@
 #include <stdarg.h>
 #include <inttypes.h>
 
+#include <rte_bus_pci.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_debug.h>
drivers/net/ena/ena_ethdev.h +1 -0
index dc3080f..be8bc9f 100644
@@ -35,6 +35,7 @@
 #define _ENA_ETHDEV_H_
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "ena_com.h"
 
drivers/net/enic/base/vnic_dev.h +3 -1
index 9a9e691..c9ca25b 100644
@@ -35,8 +35,10 @@
 #ifndef _VNIC_DEV_H_
 #define _VNIC_DEV_H_
 
+#include <rte_pci.h>
+#include <rte_bus_pci.h>
+
 #include "enic_compat.h"
-#include "rte_pci.h"
 #include "vnic_resource.h"
 #include "vnic_devcmd.h"
 
drivers/net/enic/enic_ethdev.c +1 -0
index da8fec2..681efb2 100644
@@ -37,6 +37,7 @@
 
 #include <rte_dev.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_string_fns.h>
drivers/net/enic/enic_main.c +1 -0
index 40dbec7..b35ad5d 100644
@@ -40,6 +40,7 @@
 #include <libgen.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
drivers/net/i40e/i40e_ethdev.c +1 -0
index f12aefa..88b6e50 100644
@@ -43,6 +43,7 @@
 #include <rte_eal.h>
 #include <rte_string_fns.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
index 73c315a..a7aff37 100644
@@ -47,6 +47,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/ixgbe/ixgbe_ethdev.c +1 -0
index 9ca5cbc..a2d73a1 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/ixgbe/ixgbe_ethdev.h +1 -0
index caa50c8..383ec71 100644
@@ -41,6 +41,7 @@
 #include <rte_time.h>
 #include <rte_hash.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
drivers/net/mlx5/mlx5.c +1 -0
index b7e5046..968599e 100644
@@ -58,6 +58,7 @@
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #ifdef PEDANTIC
drivers/net/mlx5/mlx5_ethdev.c +1 -0
index b0eb3cd..c2dc1f1 100644
@@ -56,6 +56,7 @@
 #endif
 #include <rte_atomic.h>
 #include <rte_ethdev.h>
+#include <rte_bus_pci.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
drivers/net/sfc/sfc.h +1 -0
index 286d1ac..5944103 100644
@@ -35,6 +35,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
drivers/net/sfc/sfc_ethdev.c +1 -0
index 12bcd6f..74e2486 100644
@@ -33,6 +33,7 @@
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_errno.h>
 
 #include "efx.h"
drivers/net/thunderx/nicvf_ethdev.c +1 -0
index edc17f1..e63dc4e 100644
@@ -61,6 +61,7 @@
 #include <rte_malloc.h>
 #include <rte_random.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tailq.h>
 
 #include "base/nicvf_plat.h"
drivers/net/virtio/virtio_ethdev.c +1 -0
index e320811..9a6850d 100644
@@ -46,6 +46,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_errno.h>
drivers/net/virtio/virtio_pci.h +1 -0
index 18caebd..c8261b7 100644
@@ -37,6 +37,7 @@
 #include <stdint.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 
 struct virtqueue;
drivers/net/vmxnet3/vmxnet3_ethdev.c +1 -0
index 3910991..bf4900d 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
Signature · 1 line
2.1.4
#30 lore raw

PATCH v2 8/14 test: include rte_bus_pci

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update test applications.

---
 test/test/test_kni.c    | 1 +
 test/test/virtual_pmd.c | 1 +
 2 files changed, 2 insertions(+)
test/test/test_kni.c +1 -0
index db17fdf..b2f05ec 100644
@@ -42,6 +42,7 @@
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
+#include <rte_bus_pci.h>
 #include <rte_cycles.h>
 #include <rte_kni.h>
 
test/test/virtual_pmd.c +1 -0
index 9d46ad5..72e784a 100644
@@ -34,6 +34,7 @@
 #include <rte_mbuf.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_memory.h>
Signature · 1 line
2.1.4
#31 lore raw

PATCH v2 9/14 app/testpmd: include rte_bus_pci

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update applications.

---
 app/test-pmd/testpmd.h | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/testpmd.h +1 -0
index 1d1ee75..d0613b5 100644
@@ -35,6 +35,7 @@
 #define _TESTPMD_H_
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_gro.h>
 
 #define RTE_PORT_ALL            (~(portid_t)0x0)
Signature · 1 line
2.1.4
#32 lore raw

PATCH v2 10/14 cryptodev: move PCI specific helpers to drivers/crypto

In reply to Gaetan Rivet

Those helpers rely on the PCI bus driver implementation. Other similar libraries relied on the bus-specifics being handled in inlined functions, to be compiled on demand by drivers, once the proper PCI dependency has been settled. This seems unsafe.

Move the PCI-specific helpers out of the lib directory to the drivers/crypto directory, properly following the dependency hierarchy.

Cc Declan Doherty <[email protected]>

---

This issue is seen by the vdev bus as well:

[PATCH 04/12] vdev: move to drivers/bus
http://dpdk.org/ml/archives/dev/2017-August/073740.html

 drivers/Makefile                                 |   2 +-
 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 ++
 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 -
 10 files changed, 285 insertions(+), 191 deletions(-)
 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
drivers/Makefile +1 -1
index 7fef66d..a5d3fa0 100644
@@ -37,7 +37,7 @@ DEPDIRS-mempool := bus
 DIRS-y += net
 DEPDIRS-net := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
-DEPDIRS-crypto := mempool
+DEPDIRS-crypto := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
 DEPDIRS-event := bus
 
drivers/crypto/Makefile +3 -1
index 7a719b9..cfd6cb6 100644
@@ -33,6 +33,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_cryptodev
 
+DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DEPDIRS-pci = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm
 DEPDIRS-aesni_gcm = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
@@ -42,7 +44,7 @@ DEPDIRS-armv8 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += openssl
 DEPDIRS-openssl = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat
-DEPDIRS-qat = $(core-libs)
+DEPDIRS-qat = $(core-libs) librte_cryptodev_pci
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler
 DEPDIRS-scheduler = $(core-libs) librte_kvargs librte_reorder
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += snow3g
drivers/crypto/pci/Makefile new file +52 -0

52 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci.c new file +128 -0

128 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci.h new file +94 -0

94 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci_version.map new file +7 -0
new file mode 100644
index 0000000..0510fef
@@ -0,0 +1,7 @@
+DPDK_17.11 {
+	global:
+
+	rte_cryptodev_pci_generic_probe;
+	rte_cryptodev_pci_generic_remove;
+
+};
lib/librte_cryptodev/Makefile +0 -1
index 6ac331b..bd94cf7 100644
@@ -49,7 +49,6 @@ SYMLINK-y-include += rte_crypto_sym.h
 SYMLINK-y-include += rte_cryptodev.h
 SYMLINK-y-include += rte_cryptodev_pmd.h
 SYMLINK-y-include += rte_cryptodev_vdev.h
-SYMLINK-y-include += rte_cryptodev_pci.h
 
 # versioning export map
 EXPORT_MAP := rte_cryptodev_version.map
lib/librte_cryptodev/rte_cryptodev_pci.h deleted +0 -92

92 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_pmd.c +0 -94

103 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_version.map +0 -2
index e9ba88a..496253d 100644
@@ -68,8 +68,6 @@ DPDK_17.08 {
 	rte_cryptodev_get_aead_algo_enum;
 	rte_cryptodev_get_header_session_size;
 	rte_cryptodev_get_private_session_size;
-	rte_cryptodev_pci_generic_probe;
-	rte_cryptodev_pci_generic_remove;
 	rte_cryptodev_sym_capability_check_aead;
 	rte_cryptodev_sym_session_init;
 	rte_cryptodev_sym_session_clear;
Signature · 1 line
2.1.4
#33 lore raw

PATCH v2 11/14 pci: avoid inlining functions

In reply to Gaetan Rivet

Parsing operations should not happen in performance critical sections. Headers should not propose implementations unless duly required.

---
 lib/librte_pci/include/rte_pci.h   | 69 ++++----------------------------------
 lib/librte_pci/rte_pci.c           | 65 +++++++++++++++++++++++++++++++++++
 lib/librte_pci/rte_pci_version.map |  4 +++
 3 files changed, 75 insertions(+), 63 deletions(-)
lib/librte_pci/include/rte_pci.h +6 -63
index 3858e80..09a609a 100644
@@ -126,19 +126,6 @@ struct mapped_pci_resource {
 /** mapped pci device list */
 TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
 
-/**< Internal use only - 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)
-
 /**
  * Utility function to produce a PCI Bus-Device-Function value
  * given a string representation. Assumes that the BDF is provided without
@@ -152,15 +139,7 @@ do {                                                               \
  * @return
  *  0 on success, negative on error.
  */
-static inline 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_BDF(const char *input, struct rte_pci_addr *dev_addr);
 
 /**
  * Utility function to produce a PCI Bus-Device-Function value
@@ -174,16 +153,7 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
  * @return
  *  0 on success, negative on error.
  */
-static inline 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
+int eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr);
 
 /**
  * Utility function to write a pci device name, this device name can later be
@@ -197,17 +167,9 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
  * @param size
  *	The output buffer size
  */
-static inline 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);
-}
+void rte_pci_device_name(const struct rte_pci_addr *addr,
+			 char *output, size_t size);
 
-/* Compare two PCI device addresses. */
 /**
  * Utility function to compare two PCI device addresses.
  *
@@ -220,27 +182,8 @@ rte_pci_device_name(const struct rte_pci_addr *addr,
  *	Positive on addr is greater than addr2.
  *	Negative on addr is less than addr2, or error.
  */
-static inline 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;
-}
+int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
+			     const struct rte_pci_addr *addr2);
 
 /**
  * Map a particular resource from a file.
lib/librte_pci/rte_pci.c +65 -0

71 lines not on this page · raw message

lib/librte_pci/rte_pci_version.map +4 -0
index 64dec54..a940259 100644
@@ -1,8 +1,12 @@
 DPDK_17.11 {
 	global:
 
+	eal_parse_pci_BDF;
+	eal_parse_pci_DomBDF;
 	pci_map_resource;
 	pci_unmap_resource;
+	rte_eal_compare_pci_addr;
+	rte_pci_device_name;
 
 	local: *;
 };
Signature · 1 line
2.1.4
#34 lore raw

PATCH v2 12/14 pci: avoid over-complicated macro

In reply to Gaetan Rivet

Using 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_pci/rte_pci.c | 65 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 46 insertions(+), 19 deletions(-)
lib/librte_pci/rte_pci.c +46 -19
index 8584b55..cbb5359 100644
@@ -53,36 +53,63 @@
 
 #include "rte_pci.h"
 
-/* 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;
 }
 
Signature · 1 line
2.1.4
#35 lore raw

PATCH v2 13/14 pci: deprecate misnamed functions

In reply to Gaetan Rivet

Rename misnamed functions and describe the change in a deprecation notice.

---
 doc/guides/rel_notes/deprecation.rst | 10 ++++++
 lib/librte_pci/include/rte_pci.h     | 63 ++++++++++++++++++++++++++++++++++++
 lib/librte_pci/rte_pci.c             | 26 +++++++++++++++
 lib/librte_pci/rte_pci_version.map   |  4 +++
 4 files changed, 103 insertions(+)
doc/guides/rel_notes/deprecation.rst +10 -0
index 3362f33..1828e57 100644
@@ -120,3 +120,13 @@ Deprecation Notices
   The non-"do-sig" versions of the hash tables will be removed
   (including the ``signature_offset`` parameter)
   and the "do-sig" versions renamed accordingly.
+
+* pci: Several exposed functions are misnamed.
+  The following functions are deprecated starting from v17.11 and are replaced:
+
+  - ``eal_parse_pci_BDF`` replaced by ``pci_parse_BDF``
+  - ``eal_parse_pci_DomBDF`` replaced by ``pci_parse_DomBDF``
+  - ``rte_eal_compare_pci_addr`` replaced by ``pci_addr_cmp``
+  - ``rte_pci_device_name`` replaced by ``pci_device_name``
+
+  The functions are only renamed. Their behavior is not affected.
lib/librte_pci/include/rte_pci.h +63 -0

93 lines not on this page · raw message

lib/librte_pci/rte_pci.c +26 -0
index cbb5359..54ce10d 100644
@@ -73,6 +73,12 @@ 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)
 {
+	return pci_parse_BDF(input, dev_addr);
+}
+
+int
+pci_parse_BDF(const char *input, struct rte_pci_addr *dev_addr)
+{
 	const char *in = input;
 
 	dev_addr->domain = 0;
@@ -91,6 +97,12 @@ 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)
 {
+	return pci_parse_DomBDF(input, dev_addr);
+}
+
+int
+pci_parse_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
+{
 	const char *in = input;
 	unsigned long val;
 	char *end;
@@ -117,6 +129,13 @@ void
 rte_pci_device_name(const struct rte_pci_addr *addr,
 		    char *output, size_t size)
 {
+	pci_device_name(addr, output, size);
+}
+
+void
+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,
@@ -127,6 +146,13 @@ int
 rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
 			 const struct rte_pci_addr *addr2)
 {
+	return pci_addr_cmp(addr, addr2);
+}
+
+int
+pci_addr_cmp(const struct rte_pci_addr *addr,
+	     const struct rte_pci_addr *addr2)
+{
 	uint64_t dev_addr, dev_addr2;
 
 	if ((addr == NULL) || (addr2 == NULL))
lib/librte_pci/rte_pci_version.map +4 -0
index a940259..541769f 100644
@@ -3,7 +3,11 @@ DPDK_17.11 {
 
 	eal_parse_pci_BDF;
 	eal_parse_pci_DomBDF;
+	pci_addr_cmp;
+	pci_device_name;
 	pci_map_resource;
+	pci_parse_BDF;
+	pci_parse_DomBDF;
 	pci_unmap_resource;
 	rte_eal_compare_pci_addr;
 	rte_pci_device_name;
Signature · 1 line
2.1.4
#36 lore raw

PATCH v2 14/14 doc: add notes on EAL PCI API update

In reply to Gaetan Rivet

Add 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
index 8bf91bd..d5546ba 100644
@@ -130,6 +130,34 @@ API Changes
   * Rework start and stop APIs into ``rte_service_runstate_set``
   * Added API to set runstate of service implementation to indicate readyness
 
+* **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
Acked-by on v2 14/14
#37 lore raw

Re: [PATCH v2 14/14] doc: add notes on EAL PCI API update

Quoted 9 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Gaetan Rivet
Sent: Monday, September 18, 2017 10:32 AM
To: [email protected]
Cc: Gaetan Rivet <[email protected]>
Subject: [dpdk-dev] [PATCH v2 14/14] doc: add notes on EAL PCI API update

Quoted 3 lines

Add a section related to EAL API changes to 17.11 release notes.

#38 lore raw

v3 cover Move PCI away from the EAL

In reply to 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 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.

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

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/crypto

Until 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

Gaetan Rivet (13):
eal: expose rte_eal_using_phys_addrs
ethdev: remove useless PCI dependency
bus: properly include rte_debug
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/crypto
pci: avoid inlining functions
pci: avoid over-complicated macro
pci: deprecate misnamed functions
doc: add notes on EAL PCI API update

 app/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    |  24 +-
 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  |  24 +-
 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, 5617 insertions(+), 4953 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 · 1 line
2.1.4
#39 lore raw

PATCH v3 1/13 eal: expose rte_eal_using_phys_addrs

This 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/bsdapp/eal/rte_eal_version.map   |  9 ++++++++-
 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/linuxapp/eal/rte_eal_version.map |  9 ++++++++-
 6 files changed, 34 insertions(+), 14 deletions(-)
lib/librte_eal/bsdapp/eal/eal_memory.c +6 -0
index 3614da8..65c96b0 100644
@@ -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/bsdapp/eal/rte_eal_version.map +8 -1
index 47a09ea..2065c53 100644
@@ -204,6 +204,13 @@ DPDK_17.08 {
 
 } DPDK_17.05;
 
+DPDK_17.11 {
+	global;
+
+	rte_eal_using_phys_addrs;
+
+} DPDK_17.08;
+
 EXPERIMENTAL {
 	global:
 
@@ -237,4 +244,4 @@ EXPERIMENTAL {
 	rte_service_set_stats_enable;
 	rte_service_start_with_defaults;
 
-} DPDK_17.08;
+} DPDK_17.11;
lib/librte_eal/common/eal_private.h +0 -11
index 597d82e..10a7078 100644
@@ -333,17 +333,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
index 4aa5d1f..5568931 100644
@@ -195,6 +195,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 RTE_LIBRTE_XEN_DOM0
 
 /**< Internal use only - should DOM0 memory mapping be used */
lib/librte_eal/linuxapp/eal/eal_memory.c +1 -1
index 5279128..af8719b 100644
@@ -1542,7 +1542,7 @@ rte_eal_hugepage_attach(void)
 	return -1;
 }
 
-bool
+int
 rte_eal_using_phys_addrs(void)
 {
 	return phys_addrs_available;
lib/librte_eal/linuxapp/eal/rte_eal_version.map +8 -1
index 8c08b8d..18bce25 100644
@@ -209,6 +209,13 @@ DPDK_17.08 {
 
 } DPDK_17.05;
 
+DPDK_17.11 {
+	global;
+
+	rte_eal_using_phys_addrs;
+
+} DPDK_17.08;
+
 EXPERIMENTAL {
 	global:
 
@@ -242,4 +249,4 @@ EXPERIMENTAL {
 	rte_service_set_stats_enable;
 	rte_service_start_with_defaults;
 
-} DPDK_17.08;
+} DPDK_17.11;
Signature · 1 line
2.1.4
#40 lore raw

PATCH v3 2/13 ethdev: remove useless PCI dependency

In reply to Gaetan Rivet
---
 lib/librte_ether/rte_ethdev.c | 1 -
 1 file changed, 1 deletion(-)
lib/librte_ether/rte_ethdev.c +0 -1
index 1849a3b..5092b82 100644
@@ -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
#41 lore raw

PATCH v3 3/13 bus: properly include rte_debug

In reply to Gaetan Rivet
---
 lib/librte_eal/common/eal_common_bus.c | 1 +
 1 file changed, 1 insertion(+)
lib/librte_eal/common/eal_common_bus.c +1 -0
index 08bec2d..9d1be8a 100644
@@ -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
#42 lore raw

PATCH v3 4/13 pci: introduce PCI lib and bus

In reply to Gaetan Rivet

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

---
 config/common_base                              |  10 +
 drivers/bus/Makefile                            |   2 +
 drivers/bus/pci/Makefile                        |  59 ++
 drivers/bus/pci/bsd/Makefile                    |  32 ++
 drivers/bus/pci/bsd/rte_pci.c                   | 670 ++++++++++++++++++++++
 drivers/bus/pci/include/rte_bus_pci.h           | 387 +++++++++++++
 drivers/bus/pci/linux/Makefile                  |  37 ++
 drivers/bus/pci/linux/rte_pci.c                 | 722 ++++++++++++++++++++++++
 drivers/bus/pci/linux/rte_pci_init.h            |  97 ++++
 drivers/bus/pci/linux/rte_pci_uio.c             | 567 +++++++++++++++++++
 drivers/bus/pci/linux/rte_pci_vfio.c            | 674 ++++++++++++++++++++++
 drivers/bus/pci/linux/rte_vfio_mp_sync.c        | 424 ++++++++++++++
 drivers/bus/pci/private.h                       | 173 ++++++
 drivers/bus/pci/rte_bus_pci_version.map         |  21 +
 drivers/bus/pci/rte_pci_common.c                | 542 ++++++++++++++++++
 drivers/bus/pci/rte_pci_common_uio.c            | 234 ++++++++
 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             | 670 ----------------------
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  15 -
 lib/librte_eal/common/Makefile                  |   2 +-
 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             | 132 -----
 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_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 |  15 -
 lib/librte_ether/rte_ethdev.h                   |   2 -
 lib/librte_pci/Makefile                         |  48 ++
 lib/librte_pci/include/rte_pci.h                | 279 +++++++++
 lib/librte_pci/rte_pci.c                        |  92 +++
 lib/librte_pci/rte_pci_version.map              |   8 +
 mk/rte.app.mk                                   |   3 +
 41 files changed, 5084 insertions(+), 4746 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
 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
config/common_base +10 -0
index 12f6be9..ec32d6a 100644
@@ -122,6 +122,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
@@ -147,6 +152,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
index 0224214..4b5bafe 100644
@@ -34,5 +34,7 @@ core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_ether
 
 DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
 DEPDIRS-fslmc = $(core-libs)
+DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DEPDIRS-pci = $(core-libs)
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/bus/pci/Makefile new file +59 -0

59 lines not on this page · raw message

drivers/bus/pci/bsd/Makefile new file +32 -0
new file mode 100644
index 0000000..77cf539
@@ -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 += rte_pci.c
drivers/bus/pci/bsd/rte_pci.c new file +670 -0

670 lines not on this page · raw message

drivers/bus/pci/include/rte_bus_pci.h new file +387 -0

387 lines not on this page · raw message

drivers/bus/pci/linux/Makefile new file +37 -0
new file mode 100644
index 0000000..d2ea84c
@@ -0,0 +1,37 @@
+#   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 += rte_pci.c
+SRCS += rte_pci_uio.c
+SRCS += rte_pci_vfio.c
+SRCS += rte_vfio_mp_sync.c
+
+CFLAGS += -D_GNU_SOURCE
drivers/bus/pci/linux/rte_pci.c new file +722 -0

722 lines not on this page · raw message

drivers/bus/pci/linux/rte_pci_init.h new file +97 -0

97 lines not on this page · raw message

drivers/bus/pci/linux/rte_pci_uio.c new file +567 -0

567 lines not on this page · raw message

drivers/bus/pci/linux/rte_pci_vfio.c new file +674 -0

400 lines not on this page · raw message

drivers/bus/pci/linux/rte_vfio_mp_sync.c new file +424 -0

424 lines not on this page · raw message

drivers/bus/pci/private.h new file +173 -0

173 lines not on this page · raw message

drivers/bus/pci/rte_bus_pci_version.map new file +21 -0
new file mode 100644
index 0000000..c1973f6

Lines of this file are not shown. View the raw message.

drivers/bus/pci/rte_pci_common.c new file +542 -0

542 lines not on this page · raw message

drivers/bus/pci/rte_pci_common_uio.c new file +234 -0

234 lines not on this page · raw message

lib/Makefile +2 -0
index 86caba1..147be60 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/bsdapp/eal/Makefile +0 -3
index 005019e..e5273f7 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/bsdapp/eal/eal.c +0 -1
index 5fa5988..b7c045f 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/bsdapp/eal/eal_pci.c deleted +0 -670

670 lines not on this page · raw message

lib/librte_eal/bsdapp/eal/rte_eal_version.map +0 -15
index 2065c53..cdd9dca 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/common/Makefile +1 -1
index e8fd67a..ac8d3bb 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/common/eal_common_pci.c deleted +0 -580

580 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 -132

132 lines not on this page · raw message

lib/librte_eal/common/include/rte_pci.h deleted +0 -598

598 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/Makefile +0 -10
index 90bca4d..4abc886 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/linuxapp/eal/eal.c +0 -1
index 48f12f4..f72da15 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/linuxapp/eal/eal_interrupts.c +0 -1
index 3e9ac41..0bebf00 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/linuxapp/eal/eal_pci.c deleted +0 -722

722 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal_pci_init.h deleted +0 -97

97 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 -674

674 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c deleted +0 -424

424 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/rte_eal_version.map +0 -15
index 18bce25..466dad3 100644

Lines of this file are not shown. View the raw message.

lib/librte_ether/rte_ethdev.h +0 -2
index 99cdd54..af7af0a 100644

Lines of this file are not shown. View the raw message.

lib/librte_pci/Makefile new file +48 -0

48 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 +92 -0

92 lines not on this page · raw message

lib/librte_pci/rte_pci_version.map new file +8 -0
new file mode 100644
index 0000000..64dec54

Lines of this file are not shown. View the raw message.

mk/rte.app.mk +3 -0
index c25fdd9..f93618f 100644

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.

#43 lore raw

PATCH v3 5/13 lib: include rte_bus_pci

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update the libraries, as structuraly unsound as it may be.

---
 lib/librte_ether/rte_ethdev_pci.h          | 1 +
 lib/librte_eventdev/rte_eventdev_pmd_pci.h | 1 +
 2 files changed, 2 insertions(+)
lib/librte_ether/rte_ethdev_pci.h +1 -0
index 56b1072..722075e 100644
@@ -36,6 +36,7 @@
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 
 /**
lib/librte_eventdev/rte_eventdev_pmd_pci.h +1 -0
index b6bd731..ade32b5 100644
@@ -50,6 +50,7 @@ extern "C" {
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "rte_eventdev_pmd.h"
 
Signature · 1 line
2.1.4
#44 lore raw

PATCH v3 6/13 drivers: include rte_bus_pci

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update drivers.

---
 drivers/bus/pci/bsd/rte_pci.c            | 1 +
 drivers/bus/pci/linux/rte_pci.c          | 1 +
 drivers/bus/pci/linux/rte_pci_uio.c      | 1 +
 drivers/bus/pci/linux/rte_pci_vfio.c     | 1 +
 drivers/bus/pci/linux/rte_vfio_mp_sync.c | 1 +
 drivers/bus/pci/private.h                | 1 +
 drivers/bus/pci/rte_pci_common.c         | 1 +
 drivers/bus/pci/rte_pci_common_uio.c     | 1 +
 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 +
 35 files changed, 38 insertions(+), 1 deletion(-)
drivers/bus/pci/bsd/rte_pci.c +1 -0
index 5bd0f4b..6c7ab81 100644
@@ -57,6 +57,7 @@
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_launch.h>
 #include <rte_memory.h>
drivers/bus/pci/linux/rte_pci.c +1 -0
index c2ac82b..ba32d8b 100644
@@ -37,6 +37,7 @@
 #include <rte_log.h>
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
drivers/bus/pci/linux/rte_pci_uio.c +1 -0
index eed6d0f..1f0dacd 100644
@@ -47,6 +47,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
drivers/bus/pci/linux/rte_pci_vfio.c +1 -0
index 81b67c9..ab63423 100644
@@ -42,6 +42,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 
drivers/bus/pci/linux/rte_vfio_mp_sync.c +1 -0
index 2c1654d..d24eba1 100644
@@ -50,6 +50,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 
drivers/bus/pci/private.h +1 -0
index 7ff1fc4..fdc2c81 100644
@@ -37,6 +37,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 struct rte_pci_driver;
 struct rte_pci_device;
drivers/bus/pci/rte_pci_common.c +1 -0
index c37b85b..459ae42 100644
@@ -45,6 +45,7 @@
 #include <rte_log.h>
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
drivers/bus/pci/rte_pci_common_uio.c +1 -0
index 4365660..544c606 100644
@@ -40,6 +40,7 @@
 
 #include <rte_eal.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
drivers/crypto/qat/qat_qp.c +1 -0
index 5048d21..a22d6ef 100644
@@ -37,6 +37,7 @@
 #include <rte_memzone.h>
 #include <rte_cryptodev_pmd.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_prefetch.h>
 
drivers/event/octeontx/ssovf_probe.c +1 -0
index e1c0c6d..1cac4bc 100644
@@ -35,6 +35,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "ssovf_evdev.h"
 
drivers/net/ark/ark_ethdev.c +1 -0
index 6db362b..78a4d79 100644
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 #include <dlfcn.h>
 
+#include <rte_bus_pci.h>
 #include <rte_ethdev_pci.h>
 #include <rte_kvargs.h>
 
drivers/net/avp/avp_ethdev.c +2 -0
index c746a0e..194aadb 100644
@@ -36,6 +36,7 @@
 #include <errno.h>
 #include <unistd.h>
 
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_memcpy.h>
@@ -45,6 +46,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
drivers/net/bnxt/bnxt.h +1 -0
index 405d94d..d7409a8 100644
@@ -39,6 +39,7 @@
 #include <sys/queue.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
drivers/net/bonding/rte_eth_bond_args.c +1 -0
index bb634c6..2b7b464 100644
@@ -33,6 +33,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_kvargs.h>
 
 #include <cmdline_parse.h>
drivers/net/cxgbe/base/adapter.h +1 -0
index 5e5f221..f2057af 100644
@@ -36,6 +36,7 @@
 #ifndef __T4_ADAPTER_H__
 #define __T4_ADAPTER_H__
 
+#include <rte_bus_pci.h>
 #include <rte_mbuf.h>
 #include <rte_io.h>
 
drivers/net/cxgbe/cxgbe_ethdev.c +1 -0
index 7bca456..dc322da 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/e1000/em_ethdev.c +1 -0
index 3d4ab93..c52e5f7 100644
@@ -43,6 +43,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/e1000/igb_ethdev.c +1 -0
index e4f7a9f..36385cf 100644
@@ -43,6 +43,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/e1000/igb_pf.c +1 -0
index 6809d30..cd6ae2f 100644
@@ -39,6 +39,7 @@
 #include <stdarg.h>
 #include <inttypes.h>
 
+#include <rte_bus_pci.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_debug.h>
drivers/net/ena/ena_ethdev.h +1 -0
index dc3080f..be8bc9f 100644
@@ -35,6 +35,7 @@
 #define _ENA_ETHDEV_H_
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "ena_com.h"
 
drivers/net/enic/base/vnic_dev.h +3 -1
index 9a9e691..c9ca25b 100644
@@ -35,8 +35,10 @@
 #ifndef _VNIC_DEV_H_
 #define _VNIC_DEV_H_
 
+#include <rte_pci.h>
+#include <rte_bus_pci.h>
+
 #include "enic_compat.h"
-#include "rte_pci.h"
 #include "vnic_resource.h"
 #include "vnic_devcmd.h"
 
drivers/net/enic/enic_ethdev.c +1 -0
index da8fec2..681efb2 100644
@@ -37,6 +37,7 @@
 
 #include <rte_dev.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_string_fns.h>
drivers/net/enic/enic_main.c +1 -0
index 40dbec7..b35ad5d 100644
@@ -40,6 +40,7 @@
 #include <libgen.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
drivers/net/i40e/i40e_ethdev.c +1 -0
index f12aefa..88b6e50 100644
@@ -43,6 +43,7 @@
 #include <rte_eal.h>
 #include <rte_string_fns.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
index 73c315a..a7aff37 100644
@@ -47,6 +47,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/ixgbe/ixgbe_ethdev.c +1 -0
index 9ca5cbc..a2d73a1 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/ixgbe/ixgbe_ethdev.h +1 -0
index caa50c8..383ec71 100644
@@ -41,6 +41,7 @@
 #include <rte_time.h>
 #include <rte_hash.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
drivers/net/mlx5/mlx5.c +1 -0
index b7e5046..968599e 100644
@@ -58,6 +58,7 @@
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 #ifdef PEDANTIC
drivers/net/mlx5/mlx5_ethdev.c +1 -0
index b0eb3cd..c2dc1f1 100644
@@ -56,6 +56,7 @@
 #endif
 #include <rte_atomic.h>
 #include <rte_ethdev.h>
+#include <rte_bus_pci.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
drivers/net/sfc/sfc.h +1 -0
index 286d1ac..5944103 100644
@@ -35,6 +35,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
drivers/net/sfc/sfc_ethdev.c +1 -0
index 12bcd6f..74e2486 100644
@@ -33,6 +33,7 @@
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_errno.h>
 
 #include "efx.h"
drivers/net/thunderx/nicvf_ethdev.c +1 -0
index edc17f1..e63dc4e 100644
@@ -61,6 +61,7 @@
 #include <rte_malloc.h>
 #include <rte_random.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tailq.h>
 
 #include "base/nicvf_plat.h"
drivers/net/virtio/virtio_ethdev.c +1 -0
index e320811..9a6850d 100644
@@ -46,6 +46,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_errno.h>
drivers/net/virtio/virtio_pci.h +1 -0
index 18caebd..c8261b7 100644
@@ -37,6 +37,7 @@
 #include <stdint.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 
 struct virtqueue;
drivers/net/vmxnet3/vmxnet3_ethdev.c +1 -0
index 3910991..bf4900d 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
Signature · 1 line
2.1.4
#45 lore raw

PATCH v3 7/13 test: include rte_bus_pci

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update test applications.

---
 test/test/test_kni.c    | 1 +
 test/test/virtual_pmd.c | 1 +
 2 files changed, 2 insertions(+)
test/test/test_kni.c +1 -0
index db17fdf..b2f05ec 100644
@@ -42,6 +42,7 @@
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
+#include <rte_bus_pci.h>
 #include <rte_cycles.h>
 #include <rte_kni.h>
 
test/test/virtual_pmd.c +1 -0
index 9d46ad5..72e784a 100644
@@ -34,6 +34,7 @@
 #include <rte_mbuf.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_memory.h>
Signature · 1 line
2.1.4
#46 lore raw

PATCH v3 8/13 app/testpmd: include rte_bus_pci

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update applications.

---
 app/test-pmd/testpmd.h | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/testpmd.h +1 -0
index 1d1ee75..d0613b5 100644
@@ -35,6 +35,7 @@
 #define _TESTPMD_H_
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_gro.h>
 
 #define RTE_PORT_ALL            (~(portid_t)0x0)
Signature · 1 line
2.1.4
#47 lore raw

PATCH v3 9/13 cryptodev: move PCI specific helpers to drivers/crypto

In reply to Gaetan Rivet

Those helpers rely on the PCI bus driver implementation. Other similar libraries relied on the bus-specifics being handled in inlined functions, to be compiled on demand by drivers, once the proper PCI dependency has been settled. This seems unsafe.

Move the PCI-specific helpers out of the lib directory to the drivers/crypto directory, properly following the dependency hierarchy.

---
 drivers/Makefile                                 |   2 +-
 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 ++
 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 -
 10 files changed, 285 insertions(+), 191 deletions(-)
 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
drivers/Makefile +1 -1
index 7fef66d..a5d3fa0 100644
@@ -37,7 +37,7 @@ DEPDIRS-mempool := bus
 DIRS-y += net
 DEPDIRS-net := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto
-DEPDIRS-crypto := mempool
+DEPDIRS-crypto := bus mempool
 DIRS-$(CONFIG_RTE_LIBRTE_EVENTDEV) += event
 DEPDIRS-event := bus
 
drivers/crypto/Makefile +3 -1
index 7a719b9..cfd6cb6 100644
@@ -33,6 +33,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_cryptodev
 
+DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DEPDIRS-pci = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm
 DEPDIRS-aesni_gcm = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
@@ -42,7 +44,7 @@ DEPDIRS-armv8 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += openssl
 DEPDIRS-openssl = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat
-DEPDIRS-qat = $(core-libs)
+DEPDIRS-qat = $(core-libs) librte_cryptodev_pci
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler
 DEPDIRS-scheduler = $(core-libs) librte_kvargs librte_reorder
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += snow3g
drivers/crypto/pci/Makefile new file +52 -0

52 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci.c new file +128 -0

128 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci.h new file +94 -0

94 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci_version.map new file +7 -0
new file mode 100644
index 0000000..0510fef
@@ -0,0 +1,7 @@
+DPDK_17.11 {
+	global:
+
+	rte_cryptodev_pci_generic_probe;
+	rte_cryptodev_pci_generic_remove;
+
+};
lib/librte_cryptodev/Makefile +0 -1
index 6ac331b..bd94cf7 100644
@@ -49,7 +49,6 @@ SYMLINK-y-include += rte_crypto_sym.h
 SYMLINK-y-include += rte_cryptodev.h
 SYMLINK-y-include += rte_cryptodev_pmd.h
 SYMLINK-y-include += rte_cryptodev_vdev.h
-SYMLINK-y-include += rte_cryptodev_pci.h
 
 # versioning export map
 EXPORT_MAP := rte_cryptodev_version.map
lib/librte_cryptodev/rte_cryptodev_pci.h deleted +0 -92

92 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_pmd.c +0 -94

103 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_version.map +0 -2
index e9ba88a..496253d 100644
@@ -68,8 +68,6 @@ DPDK_17.08 {
 	rte_cryptodev_get_aead_algo_enum;
 	rte_cryptodev_get_header_session_size;
 	rte_cryptodev_get_private_session_size;
-	rte_cryptodev_pci_generic_probe;
-	rte_cryptodev_pci_generic_remove;
 	rte_cryptodev_sym_capability_check_aead;
 	rte_cryptodev_sym_session_init;
 	rte_cryptodev_sym_session_clear;
Signature · 1 line
2.1.4
#48 lore raw

PATCH v3 10/13 pci: avoid inlining functions

In reply to Gaetan Rivet

Parsing operations should not happen in performance critical sections. Headers should not propose implementations unless duly required.

---
 lib/librte_pci/include/rte_pci.h   | 69 ++++----------------------------------
 lib/librte_pci/rte_pci.c           | 65 +++++++++++++++++++++++++++++++++++
 lib/librte_pci/rte_pci_version.map |  4 +++
 3 files changed, 75 insertions(+), 63 deletions(-)
lib/librte_pci/include/rte_pci.h +6 -63
index 3858e80..09a609a 100644
@@ -126,19 +126,6 @@ struct mapped_pci_resource {
 /** mapped pci device list */
 TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
 
-/**< Internal use only - 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)
-
 /**
  * Utility function to produce a PCI Bus-Device-Function value
  * given a string representation. Assumes that the BDF is provided without
@@ -152,15 +139,7 @@ do {                                                               \
  * @return
  *  0 on success, negative on error.
  */
-static inline 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_BDF(const char *input, struct rte_pci_addr *dev_addr);
 
 /**
  * Utility function to produce a PCI Bus-Device-Function value
@@ -174,16 +153,7 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
  * @return
  *  0 on success, negative on error.
  */
-static inline 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
+int eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr);
 
 /**
  * Utility function to write a pci device name, this device name can later be
@@ -197,17 +167,9 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
  * @param size
  *	The output buffer size
  */
-static inline 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);
-}
+void rte_pci_device_name(const struct rte_pci_addr *addr,
+			 char *output, size_t size);
 
-/* Compare two PCI device addresses. */
 /**
  * Utility function to compare two PCI device addresses.
  *
@@ -220,27 +182,8 @@ rte_pci_device_name(const struct rte_pci_addr *addr,
  *	Positive on addr is greater than addr2.
  *	Negative on addr is less than addr2, or error.
  */
-static inline 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;
-}
+int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
+			     const struct rte_pci_addr *addr2);
 
 /**
  * Map a particular resource from a file.
lib/librte_pci/rte_pci.c +65 -0

71 lines not on this page · raw message

lib/librte_pci/rte_pci_version.map +4 -0
index 64dec54..a940259 100644
@@ -1,8 +1,12 @@
 DPDK_17.11 {
 	global:
 
+	eal_parse_pci_BDF;
+	eal_parse_pci_DomBDF;
 	pci_map_resource;
 	pci_unmap_resource;
+	rte_eal_compare_pci_addr;
+	rte_pci_device_name;
 
 	local: *;
 };
Signature · 1 line
2.1.4
#49 lore raw

PATCH v3 11/13 pci: avoid over-complicated macro

In reply to Gaetan Rivet

Using 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_pci/rte_pci.c | 65 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 46 insertions(+), 19 deletions(-)
lib/librte_pci/rte_pci.c +46 -19
index 8584b55..cbb5359 100644
@@ -53,36 +53,63 @@
 
 #include "rte_pci.h"
 
-/* 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;
 }
 
Signature · 1 line
2.1.4
#50 lore raw

PATCH v3 12/13 pci: deprecate misnamed functions

In reply to Gaetan Rivet

Rename misnamed functions and describe the change in a deprecation notice.

---
 doc/guides/rel_notes/deprecation.rst | 10 ++++++
 lib/librte_pci/include/rte_pci.h     | 63 ++++++++++++++++++++++++++++++++++++
 lib/librte_pci/rte_pci.c             | 26 +++++++++++++++
 lib/librte_pci/rte_pci_version.map   |  4 +++
 4 files changed, 103 insertions(+)
doc/guides/rel_notes/deprecation.rst +10 -0
index 3362f33..1828e57 100644
@@ -120,3 +120,13 @@ Deprecation Notices
   The non-"do-sig" versions of the hash tables will be removed
   (including the ``signature_offset`` parameter)
   and the "do-sig" versions renamed accordingly.
+
+* pci: Several exposed functions are misnamed.
+  The following functions are deprecated starting from v17.11 and are replaced:
+
+  - ``eal_parse_pci_BDF`` replaced by ``pci_parse_BDF``
+  - ``eal_parse_pci_DomBDF`` replaced by ``pci_parse_DomBDF``
+  - ``rte_eal_compare_pci_addr`` replaced by ``pci_addr_cmp``
+  - ``rte_pci_device_name`` replaced by ``pci_device_name``
+
+  The functions are only renamed. Their behavior is not affected.
lib/librte_pci/include/rte_pci.h +63 -0

93 lines not on this page · raw message

lib/librte_pci/rte_pci.c +26 -0
index cbb5359..54ce10d 100644
@@ -73,6 +73,12 @@ 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)
 {
+	return pci_parse_BDF(input, dev_addr);
+}
+
+int
+pci_parse_BDF(const char *input, struct rte_pci_addr *dev_addr)
+{
 	const char *in = input;
 
 	dev_addr->domain = 0;
@@ -91,6 +97,12 @@ 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)
 {
+	return pci_parse_DomBDF(input, dev_addr);
+}
+
+int
+pci_parse_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
+{
 	const char *in = input;
 	unsigned long val;
 	char *end;
@@ -117,6 +129,13 @@ void
 rte_pci_device_name(const struct rte_pci_addr *addr,
 		    char *output, size_t size)
 {
+	pci_device_name(addr, output, size);
+}
+
+void
+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,
@@ -127,6 +146,13 @@ int
 rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
 			 const struct rte_pci_addr *addr2)
 {
+	return pci_addr_cmp(addr, addr2);
+}
+
+int
+pci_addr_cmp(const struct rte_pci_addr *addr,
+	     const struct rte_pci_addr *addr2)
+{
 	uint64_t dev_addr, dev_addr2;
 
 	if ((addr == NULL) || (addr2 == NULL))
lib/librte_pci/rte_pci_version.map +4 -0
index a940259..541769f 100644
@@ -3,7 +3,11 @@ DPDK_17.11 {
 
 	eal_parse_pci_BDF;
 	eal_parse_pci_DomBDF;
+	pci_addr_cmp;
+	pci_device_name;
 	pci_map_resource;
+	pci_parse_BDF;
+	pci_parse_DomBDF;
 	pci_unmap_resource;
 	rte_eal_compare_pci_addr;
 	rte_pci_device_name;
Signature · 1 line
2.1.4
#51 lore raw

PATCH v3 13/13 doc: add notes on EAL PCI API update

In reply to Gaetan Rivet

Add 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
index 8bf91bd..d5546ba 100644
@@ -130,6 +130,34 @@ API Changes
   * Rework start and stop APIs into ``rte_service_runstate_set``
   * Added API to set runstate of service implementation to indicate readyness
 
+* **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
#52 lore raw

v4 cover Move PCI away from the EAL

In reply to 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 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/crypto

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

Compilation is still broken from

* pci: introduce PCI lib and bus

until

* net/bonding: use local prefix for local function

Gaetan Rivet (16):
eal: include debug header in bus source
ethdev: remove useless PCI dependency
pci: introduce PCI lib and bus
lib: include PCI bus header
drivers: include PCI bus header
test: include PCI bus header
app/testpmd: include PCI bus header
cryptodev: move PCI specific helpers to drivers/crypto net/bonding: use local prefix for local function
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 bus/pci: use new PCI addr parsing function
doc: add notes on EAL PCI API update

 app/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/bus/Makefile                             |   2 +
 drivers/bus/pci/Makefile                         |  59 ++
 drivers/bus/pci/bsd/Makefile                     |  32 +
 drivers/bus/pci/bsd/pci.c                        | 681 +++++++++++++++++++
 drivers/bus/pci/include/rte_bus_pci.h            | 415 ++++++++++++
 drivers/bus/pci/linux/Makefile                   |  37 +
 drivers/bus/pci/linux/pci.c                      | 821 +++++++++++++++++++++++
 drivers/bus/pci/linux/pci_init.h                 |  97 +++
 drivers/bus/pci/linux/pci_uio.c                  | 568 ++++++++++++++++
 drivers/bus/pci/linux/pci_vfio.c                 | 757 +++++++++++++++++++++
 drivers/bus/pci/linux/vfio_mp_sync.c             | 426 ++++++++++++
 drivers/bus/pci/pci_common.c                     | 535 +++++++++++++++
 drivers/bus/pci/pci_common_uio.c                 | 235 +++++++
 drivers/bus/pci/private.h                        | 174 +++++
 drivers/bus/pci/rte_bus_pci_version.map          |  21 +
 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/mempool/octeontx/octeontx_fpavf.c        |   2 +-
 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          |   5 +-
 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/mlx4/mlx4_ethdev.c                   |   2 +-
 drivers/net/mlx5/mlx5.c                          |   1 +
 drivers/net/mlx5/mlx5_ethdev.c                   |   1 +
 drivers/net/nfp/nfp_nfpu.c                       |   2 +-
 drivers/net/nfp/nfp_nfpu.h                       |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c       |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c       |   2 +-
 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_pci.c              | 680 -------------------
 lib/librte_eal/bsdapp/eal/rte_eal_version.map    |  15 -
 lib/librte_eal/common/Makefile                   |   2 +-
 lib/librte_eal/common/eal_common_bus.c           |   1 +
 lib/librte_eal/common/eal_common_pci.c           | 573 ----------------
 lib/librte_eal/common/eal_common_pci_uio.c       | 233 -------
 lib/librte_eal/common/eal_private.h              | 132 ----
 lib/librte_eal/common/include/rte_pci.h          | 633 -----------------
 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_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       | 756 ---------------------
 lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c   | 425 ------------
 lib/librte_eal/linuxapp/eal/rte_eal_version.map  |  15 -
 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                 | 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 +
 92 files changed, 5804 insertions(+), 5163 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/linux/vfio_mp_sync.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
 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 · 1 line
2.1.4
#53 lore raw

PATCH v4 1/16 eal: include debug header in bus source

This 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
index c3c77f4..3c66a02 100644
@@ -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
#54 lore raw

PATCH v4 2/16 ethdev: remove useless PCI dependency

In reply to Gaetan Rivet
---
 lib/librte_ether/rte_ethdev.c | 1 -
 1 file changed, 1 deletion(-)
lib/librte_ether/rte_ethdev.c +0 -1
index 9460161..bb08204 100644
@@ -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
#55 lore raw

PATCH v4 3/16 pci: introduce PCI lib and bus

In reply to Gaetan Rivet

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

---
 config/common_base                              |  10 +
 drivers/bus/Makefile                            |   2 +
 drivers/bus/pci/Makefile                        |  59 ++
 drivers/bus/pci/bsd/Makefile                    |  32 +
 drivers/bus/pci/bsd/pci.c                       | 680 ++++++++++++++++++++
 drivers/bus/pci/include/rte_bus_pci.h           | 415 ++++++++++++
 drivers/bus/pci/linux/Makefile                  |  37 ++
 drivers/bus/pci/linux/pci.c                     | 820 ++++++++++++++++++++++++
 drivers/bus/pci/linux/pci_init.h                |  97 +++
 drivers/bus/pci/linux/pci_uio.c                 | 567 ++++++++++++++++
 drivers/bus/pci/linux/pci_vfio.c                | 756 ++++++++++++++++++++++
 drivers/bus/pci/linux/vfio_mp_sync.c            | 425 ++++++++++++
 drivers/bus/pci/pci_common.c                    | 535 ++++++++++++++++
 drivers/bus/pci/pci_common_uio.c                | 234 +++++++
 drivers/bus/pci/private.h                       | 173 +++++
 drivers/bus/pci/rte_bus_pci_version.map         |  21 +
 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/bsdapp/eal/rte_eal_version.map   |  15 -
 lib/librte_eal/common/Makefile                  |   2 +-
 lib/librte_eal/common/eal_common_pci.c          | 573 -----------------
 lib/librte_eal/common/eal_common_pci_uio.c      | 233 -------
 lib/librte_eal/common/eal_private.h             | 132 ----
 lib/librte_eal/common/include/rte_pci.h         | 633 ------------------
 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_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      | 756 ----------------------
 lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c  | 425 ------------
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  15 -
 lib/librte_ether/rte_ethdev.h                   |   2 -
 lib/librte_pci/Makefile                         |  48 ++
 lib/librte_pci/include/rte_pci.h                | 287 +++++++++
 lib/librte_pci/rte_pci.c                        |  92 +++
 lib/librte_pci/rte_pci_version.map              |   8 +
 mk/rte.app.mk                                   |   3 +
 41 files changed, 5304 insertions(+), 4963 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/linux/vfio_mp_sync.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
 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
config/common_base +10 -0
index dc4da9a..39ec7f0 100644
@@ -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
index 6cb6466..40b9e96 100644
@@ -37,5 +37,7 @@ DEPDIRS-dpaa = $(core-libs)
 
 DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
 DEPDIRS-fslmc = $(core-libs)
+DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DEPDIRS-pci = $(core-libs)
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/bus/pci/Makefile new file +59 -0

59 lines not on this page · raw message

drivers/bus/pci/bsd/Makefile new file +32 -0
new file mode 100644
index 0000000..4450913
@@ -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 +680 -0

680 lines not on this page · raw message

drivers/bus/pci/include/rte_bus_pci.h new file +415 -0

415 lines not on this page · raw message

drivers/bus/pci/linux/Makefile new file +37 -0
new file mode 100644
index 0000000..5410566
@@ -0,0 +1,37 @@
+#   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
+SRCS += vfio_mp_sync.c
+
+CFLAGS += -D_GNU_SOURCE
drivers/bus/pci/linux/pci.c new file +820 -0

820 lines not on this page · raw message

drivers/bus/pci/linux/pci_init.h new file +97 -0

97 lines not on this page · raw message

drivers/bus/pci/linux/pci_uio.c new file +567 -0

567 lines not on this page · raw message

drivers/bus/pci/linux/pci_vfio.c new file +756 -0

264 lines not on this page · raw message

drivers/bus/pci/linux/vfio_mp_sync.c new file +425 -0

425 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 +234 -0

234 lines not on this page · raw message

drivers/bus/pci/private.h new file +173 -0

173 lines not on this page · raw message

drivers/bus/pci/rte_bus_pci_version.map new file +21 -0
new file mode 100644
index 0000000..c1973f6

Lines of this file are not shown. View the raw message.

lib/Makefile +2 -0
index 86d475f..abe6467 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/bsdapp/eal/Makefile +0 -3
index 317a75e..518832f 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/bsdapp/eal/eal.c +0 -1
index 30d3bd5..2917808 100644

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/bsdapp/eal/rte_eal_version.map +0 -15
index d19f264..97b3918 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/common/Makefile +1 -1
index e8fd67a..ac8d3bb 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/common/eal_common_pci.c deleted +0 -573

573 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 -132

132 lines not on this page · raw message

lib/librte_eal/common/include/rte_pci.h deleted +0 -633

633 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/Makefile +0 -10
index 21e0b4a..90adb8d 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/linuxapp/eal/eal.c +0 -1
index ec37c52..5005e6d 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/linuxapp/eal/eal_interrupts.c +0 -1
index 3e9ac41..0bebf00 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/linuxapp/eal/eal_pci.c deleted +0 -818

818 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal_pci_init.h deleted +0 -97

97 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 -756

756 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c deleted +0 -425

425 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/rte_eal_version.map +0 -15
index fe186cb..a8ea4ea 100644

Lines of this file are not shown. View the raw message.

lib/librte_ether/rte_ethdev.h +0 -2
index 354d170..e7be855 100644

Lines of this file are not shown. View the raw message.

lib/librte_pci/Makefile new file +48 -0

48 lines not on this page · raw message

lib/librte_pci/include/rte_pci.h new file +287 -0

287 lines not on this page · raw message

lib/librte_pci/rte_pci.c new file +92 -0

92 lines not on this page · raw message

lib/librte_pci/rte_pci_version.map new file +8 -0
new file mode 100644
index 0000000..64dec54

Lines of this file are not shown. View the raw message.

mk/rte.app.mk +3 -0
index 0b8f612..88b1a71 100644

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.

#56 lore raw

PATCH v4 4/16 lib: include PCI bus header

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update the libraries, as structuraly unsound as it may be.

---
 lib/librte_ether/rte_ethdev_pci.h          | 1 +
 lib/librte_eventdev/rte_eventdev_pmd_pci.h | 1 +
 2 files changed, 2 insertions(+)
lib/librte_ether/rte_ethdev_pci.h +1 -0
index 56b1072..722075e 100644
@@ -36,6 +36,7 @@
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 
 /**
lib/librte_eventdev/rte_eventdev_pmd_pci.h +1 -0
index b6bd731..ade32b5 100644
@@ -50,6 +50,7 @@ extern "C" {
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "rte_eventdev_pmd.h"
 
Signature · 1 line
2.1.4
#57 lore raw

PATCH v4 5/16 drivers: include PCI bus header

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update drivers.

---
 drivers/bus/pci/bsd/pci.c                  | 1 +
 drivers/bus/pci/linux/pci.c                | 1 +
 drivers/bus/pci/linux/pci_uio.c            | 1 +
 drivers/bus/pci/linux/pci_vfio.c           | 1 +
 drivers/bus/pci/linux/vfio_mp_sync.c       | 1 +
 drivers/bus/pci/pci_common.c               | 1 +
 drivers/bus/pci/pci_common_uio.c           | 1 +
 drivers/bus/pci/private.h                  | 1 +
 drivers/crypto/qat/qat_qp.c                | 1 +
 drivers/event/octeontx/ssovf_probe.c       | 1 +
 drivers/mempool/octeontx/octeontx_fpavf.c  | 2 +-
 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/mlx4/mlx4_ethdev.c             | 2 +-
 drivers/net/mlx5/mlx5.c                    | 1 +
 drivers/net/mlx5/mlx5_ethdev.c             | 1 +
 drivers/net/nfp/nfp_nfpu.c                 | 2 +-
 drivers/net/nfp/nfp_nfpu.h                 | 2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c | 2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c | 2 +-
 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 +
 41 files changed, 44 insertions(+), 7 deletions(-)
drivers/bus/pci/bsd/pci.c +1 -0
index 599519a..753d914 100644
@@ -57,6 +57,7 @@
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_launch.h>
 #include <rte_memory.h>
drivers/bus/pci/linux/pci.c +1 -0
index c1fcc56..422579f 100644
@@ -37,6 +37,7 @@
 #include <rte_log.h>
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
drivers/bus/pci/linux/pci_uio.c +1 -0
index d3f0556..940fa21 100644
@@ -47,6 +47,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
drivers/bus/pci/linux/pci_vfio.c +1 -0
index e69e4d3..855e2b9 100644
@@ -42,6 +42,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 
drivers/bus/pci/linux/vfio_mp_sync.c +1 -0
index dd24e86..d07687f 100644
@@ -50,6 +50,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 
drivers/bus/pci/pci_common.c +1 -0
index 7b68e99..cd95d1a 100644
@@ -45,6 +45,7 @@
 #include <rte_log.h>
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
drivers/bus/pci/pci_common_uio.c +1 -0
index 4365660..544c606 100644
@@ -40,6 +40,7 @@
 
 #include <rte_eal.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
drivers/bus/pci/private.h +1 -0
index 7ff1fc4..fdc2c81 100644
@@ -37,6 +37,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 struct rte_pci_driver;
 struct rte_pci_device;
drivers/crypto/qat/qat_qp.c +1 -0
index 34f75ca..8489662 100644
@@ -37,6 +37,7 @@
 #include <rte_memzone.h>
 #include <rte_cryptodev_pmd.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_prefetch.h>
 
drivers/event/octeontx/ssovf_probe.c +1 -0
index e1c0c6d..1cac4bc 100644
@@ -35,6 +35,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "ssovf_evdev.h"
 
drivers/mempool/octeontx/octeontx_fpavf.c +1 -1
index eea934f..bbede5d 100644
@@ -41,7 +41,7 @@
 
 #include <rte_atomic.h>
 #include <rte_eal.h>
-#include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_malloc.h>
drivers/net/ark/ark_ethdev.c +1 -0
index dae1f3d..384be47 100644
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 #include <dlfcn.h>
 
+#include <rte_bus_pci.h>
 #include <rte_ethdev_pci.h>
 #include <rte_kvargs.h>
 
drivers/net/avp/avp_ethdev.c +2 -0
index b97a90c..89e91e2 100644
@@ -36,6 +36,7 @@
 #include <errno.h>
 #include <unistd.h>
 
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_memcpy.h>
@@ -45,6 +46,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
drivers/net/bnxt/bnxt.h +1 -0
index 294a174..039b248 100644
@@ -39,6 +39,7 @@
 #include <sys/queue.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
drivers/net/bonding/rte_eth_bond_args.c +1 -0
index c4dcefa..dea0265 100644
@@ -33,6 +33,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_kvargs.h>
 
 #include <cmdline_parse.h>
drivers/net/cxgbe/base/adapter.h +1 -0
index 5e5f221..f2057af 100644
@@ -36,6 +36,7 @@
 #ifndef __T4_ADAPTER_H__
 #define __T4_ADAPTER_H__
 
+#include <rte_bus_pci.h>
 #include <rte_mbuf.h>
 #include <rte_io.h>
 
drivers/net/cxgbe/cxgbe_ethdev.c +1 -0
index 02b4f62..b1405e5 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/e1000/em_ethdev.c +1 -0
index e724205..aa831f8 100644
@@ -43,6 +43,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/e1000/igb_ethdev.c +1 -0
index f3b1d70..380ec31 100644
@@ -43,6 +43,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/e1000/igb_pf.c +1 -0
index 6809d30..cd6ae2f 100644
@@ -39,6 +39,7 @@
 #include <stdarg.h>
 #include <inttypes.h>
 
+#include <rte_bus_pci.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_debug.h>
drivers/net/ena/ena_ethdev.h +1 -0
index dc3080f..be8bc9f 100644
@@ -35,6 +35,7 @@
 #define _ENA_ETHDEV_H_
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "ena_com.h"
 
drivers/net/enic/base/vnic_dev.h +3 -1
index 9a9e691..c9ca25b 100644
@@ -35,8 +35,10 @@
 #ifndef _VNIC_DEV_H_
 #define _VNIC_DEV_H_
 
+#include <rte_pci.h>
+#include <rte_bus_pci.h>
+
 #include "enic_compat.h"
-#include "rte_pci.h"
 #include "vnic_resource.h"
 #include "vnic_devcmd.h"
 
drivers/net/enic/enic_ethdev.c +1 -0
index 5386b2a..7a7e2d9 100644
@@ -37,6 +37,7 @@
 
 #include <rte_dev.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_string_fns.h>
drivers/net/enic/enic_main.c +1 -0
index 5211670..be62447 100644
@@ -40,6 +40,7 @@
 #include <libgen.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
drivers/net/i40e/i40e_ethdev.c +1 -0
index 814f458..ffead82 100644
@@ -43,6 +43,7 @@
 #include <rte_eal.h>
 #include <rte_string_fns.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
index 63d1f77..39a0cbd 100644
@@ -47,6 +47,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/ixgbe/ixgbe_ethdev.c +1 -0
index a08e475..a750a88 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/ixgbe/ixgbe_ethdev.h +1 -0
index e28c856..5156483 100644
@@ -41,6 +41,7 @@
 #include <rte_time.h>
 #include <rte_hash.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
drivers/net/mlx4/mlx4_ethdev.c +1 -1
index 8962be1..b97b146 100644
@@ -64,7 +64,7 @@
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
-#include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "mlx4.h"
 #include "mlx4_rxtx.h"
drivers/net/mlx5/mlx5.c +1 -0
index 29221dc..d60ef74 100644
@@ -54,6 +54,7 @@
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 
drivers/net/mlx5/mlx5_ethdev.c +1 -0
index e06dce3..c31ea4b 100644
@@ -56,6 +56,7 @@
 
 #include <rte_atomic.h>
 #include <rte_ethdev.h>
+#include <rte_bus_pci.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
drivers/net/nfp/nfp_nfpu.c +1 -1
index 556ded3..5775d8d 100644
@@ -8,7 +8,7 @@
 #include <fcntl.h>
 #include <sys/types.h>
 
-#include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_malloc.h>
 
 #include "nfp_nfpu.h"
drivers/net/nfp/nfp_nfpu.h +1 -1
index 31511b3..e56fa09 100644
@@ -42,7 +42,7 @@
  */
 
 
-#include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include "nfp_nspu.h"
 
 typedef struct {
drivers/net/octeontx/base/octeontx_pkivf.c +1 -1
index afae6a3..20cbe0c 100644
@@ -32,7 +32,7 @@
 #include <string.h>
 
 #include <rte_eal.h>
-#include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "octeontx_pkivf.h"
 
drivers/net/octeontx/base/octeontx_pkovf.c +1 -1
index a8f6e5d..2bf607b 100644
@@ -37,7 +37,7 @@
 #include <rte_cycles.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_spinlock.h>
 
 #include "../octeontx_logs.h"
drivers/net/sfc/sfc.h +1 -0
index c170384..7f11bf2 100644
@@ -35,6 +35,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
drivers/net/sfc/sfc_ethdev.c +1 -0
index bd09191..430e24f 100644
@@ -33,6 +33,7 @@
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_errno.h>
 
 #include "efx.h"
drivers/net/thunderx/nicvf_ethdev.c +1 -0
index 551b371..24ac3f9 100644
@@ -61,6 +61,7 @@
 #include <rte_malloc.h>
 #include <rte_random.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tailq.h>
 
 #include "base/nicvf_plat.h"
drivers/net/virtio/virtio_ethdev.c +1 -0
index 0ec54a9..3c4c083 100644
@@ -46,6 +46,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_errno.h>
drivers/net/virtio/virtio_pci.h +1 -0
index 5f3b6c8..36d452c 100644
@@ -37,6 +37,7 @@
 #include <stdint.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 
 struct virtqueue;
drivers/net/vmxnet3/vmxnet3_ethdev.c +1 -0
index 58bc4f2..9772386 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
Signature · 1 line
2.1.4
#58 lore raw

PATCH v4 6/16 test: include PCI bus header

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update test applications.

---
 test/test/test_kni.c    | 1 +
 test/test/virtual_pmd.c | 1 +
 2 files changed, 2 insertions(+)
test/test/test_kni.c +1 -0
index 2450c9f..b956727 100644
@@ -42,6 +42,7 @@
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
+#include <rte_bus_pci.h>
 #include <rte_cycles.h>
 #include <rte_kni.h>
 
test/test/virtual_pmd.c +1 -0
index 09daf6c..b57a949 100644
@@ -34,6 +34,7 @@
 #include <rte_mbuf.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_memory.h>
Signature · 1 line
2.1.4
#59 lore raw

PATCH v4 7/16 app/testpmd: include PCI bus header

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update applications.

---
 app/test-pmd/testpmd.h | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/testpmd.h +1 -0
index 0b8e624..b05c8a0 100644
@@ -35,6 +35,7 @@
 #define _TESTPMD_H_
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_gro.h>
 #include <rte_gso.h>
 
Signature · 1 line
2.1.4
#60 lore raw

PATCH v4 8/16 cryptodev: move PCI specific helpers to drivers/crypto

In reply to Gaetan Rivet

Those helpers rely on the PCI bus driver implementation. Other similar libraries relied on the bus-specifics being handled in inlined functions, to be compiled on demand by drivers, once the proper PCI dependency has been settled. This seems unsafe.

Move the PCI-specific helpers out of the lib directory to the drivers/crypto directory, properly following the dependency hierarchy.

---
 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 ++
 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 -
 9 files changed, 284 insertions(+), 190 deletions(-)
 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
drivers/crypto/Makefile +3 -1
index 7a719b9..cfd6cb6 100644
@@ -33,6 +33,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_cryptodev
 
+DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DEPDIRS-pci = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm
 DEPDIRS-aesni_gcm = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
@@ -42,7 +44,7 @@ DEPDIRS-armv8 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += openssl
 DEPDIRS-openssl = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat
-DEPDIRS-qat = $(core-libs)
+DEPDIRS-qat = $(core-libs) librte_cryptodev_pci
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler
 DEPDIRS-scheduler = $(core-libs) librte_kvargs librte_reorder
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += snow3g
drivers/crypto/pci/Makefile new file +52 -0

52 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci.c new file +128 -0

128 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci.h new file +94 -0

94 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci_version.map new file +7 -0
new file mode 100644
index 0000000..0510fef
@@ -0,0 +1,7 @@
+DPDK_17.11 {
+	global:
+
+	rte_cryptodev_pci_generic_probe;
+	rte_cryptodev_pci_generic_remove;
+
+};
lib/librte_cryptodev/Makefile +0 -1
index 6ac331b..bd94cf7 100644
@@ -49,7 +49,6 @@ SYMLINK-y-include += rte_crypto_sym.h
 SYMLINK-y-include += rte_cryptodev.h
 SYMLINK-y-include += rte_cryptodev_pmd.h
 SYMLINK-y-include += rte_cryptodev_vdev.h
-SYMLINK-y-include += rte_cryptodev_pci.h
 
 # versioning export map
 EXPORT_MAP := rte_cryptodev_version.map
lib/librte_cryptodev/rte_cryptodev_pci.h deleted +0 -92

92 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_pmd.c +0 -94

103 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_version.map +0 -2
index e9ba88a..496253d 100644
@@ -68,8 +68,6 @@ DPDK_17.08 {
 	rte_cryptodev_get_aead_algo_enum;
 	rte_cryptodev_get_header_session_size;
 	rte_cryptodev_get_private_session_size;
-	rte_cryptodev_pci_generic_probe;
-	rte_cryptodev_pci_generic_remove;
 	rte_cryptodev_sym_capability_check_aead;
 	rte_cryptodev_sym_session_init;
 	rte_cryptodev_sym_session_clear;
Signature · 1 line
2.1.4
#61 lore raw

PATCH v4 9/16 net/bonding: use local prefix for local function

In reply to Gaetan Rivet
---
 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
index dea0265..e816da3 100644
@@ -90,7 +90,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;
@@ -119,7 +119,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
#62 lore raw

PATCH v4 10/16 pci: avoid inlining functions

In reply to Gaetan Rivet

Parsing operations should not happen in performance critical sections. Headers should not propose implementations unless duly required.

---
 lib/librte_pci/include/rte_pci.h   | 69 ++++----------------------------------
 lib/librte_pci/rte_pci.c           | 65 +++++++++++++++++++++++++++++++++++
 lib/librte_pci/rte_pci_version.map |  4 +++
 3 files changed, 75 insertions(+), 63 deletions(-)
lib/librte_pci/include/rte_pci.h +6 -63
index 2647568..fe4d411 100644
@@ -134,19 +134,6 @@ struct mapped_pci_resource {
 /** mapped pci device list */
 TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
 
-/**< Internal use only - 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)
-
 /**
  * Utility function to produce a PCI Bus-Device-Function value
  * given a string representation. Assumes that the BDF is provided without
@@ -160,15 +147,7 @@ do {                                                               \
  * @return
  *  0 on success, negative on error.
  */
-static inline 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_BDF(const char *input, struct rte_pci_addr *dev_addr);
 
 /**
  * Utility function to produce a PCI Bus-Device-Function value
@@ -182,16 +161,7 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
  * @return
  *  0 on success, negative on error.
  */
-static inline 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
+int eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr);
 
 /**
  * Utility function to write a pci device name, this device name can later be
@@ -205,17 +175,9 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
  * @param size
  *	The output buffer size
  */
-static inline 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);
-}
+void rte_pci_device_name(const struct rte_pci_addr *addr,
+			 char *output, size_t size);
 
-/* Compare two PCI device addresses. */
 /**
  * Utility function to compare two PCI device addresses.
  *
@@ -228,27 +190,8 @@ rte_pci_device_name(const struct rte_pci_addr *addr,
  *	Positive on addr is greater than addr2.
  *	Negative on addr is less than addr2, or error.
  */
-static inline 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;
-}
+int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
+			     const struct rte_pci_addr *addr2);
 
 /**
  * Map a particular resource from a file.
lib/librte_pci/rte_pci.c +65 -0

71 lines not on this page · raw message

lib/librte_pci/rte_pci_version.map +4 -0
index 64dec54..a940259 100644
@@ -1,8 +1,12 @@
 DPDK_17.11 {
 	global:
 
+	eal_parse_pci_BDF;
+	eal_parse_pci_DomBDF;
 	pci_map_resource;
 	pci_unmap_resource;
+	rte_eal_compare_pci_addr;
+	rte_pci_device_name;
 
 	local: *;
 };
Signature · 1 line
2.1.4
#63 lore raw

PATCH v4 11/16 pci: avoid over-complicated macro

In reply to Gaetan Rivet

Using 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_pci/rte_pci.c | 65 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 46 insertions(+), 19 deletions(-)
lib/librte_pci/rte_pci.c +46 -19
index 8584b55..cbb5359 100644
@@ -53,36 +53,63 @@
 
 #include "rte_pci.h"
 
-/* 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;
 }
 
Signature · 1 line
2.1.4
#64 lore raw

PATCH v4 12/16 pci: deprecate misnamed functions

In reply to Gaetan Rivet

Rename misnamed functions and describe the change in a deprecation notice.

---
 doc/guides/rel_notes/deprecation.rst | 10 ++++++
 lib/librte_pci/include/rte_pci.h     | 63 ++++++++++++++++++++++++++++++++++++
 lib/librte_pci/rte_pci.c             | 26 +++++++++++++++
 lib/librte_pci/rte_pci_version.map   |  4 +++
 4 files changed, 103 insertions(+)
doc/guides/rel_notes/deprecation.rst +10 -0
index 4e4d97b..ef2264f 100644
@@ -98,3 +98,13 @@ Deprecation Notices
   The non-"do-sig" versions of the hash tables will be removed
   (including the ``signature_offset`` parameter)
   and the "do-sig" versions renamed accordingly.
+
+* pci: Several exposed functions are misnamed.
+  The following functions are deprecated starting from v17.11 and are replaced:
+
+  - ``eal_parse_pci_BDF`` replaced by ``pci_parse_BDF``
+  - ``eal_parse_pci_DomBDF`` replaced by ``pci_parse_DomBDF``
+  - ``rte_eal_compare_pci_addr`` replaced by ``pci_addr_cmp``
+  - ``rte_pci_device_name`` replaced by ``pci_device_name``
+
+  The functions are only renamed. Their behavior is not affected.
lib/librte_pci/include/rte_pci.h +63 -0

93 lines not on this page · raw message

lib/librte_pci/rte_pci.c +26 -0
index cbb5359..fc2fc7f 100644
@@ -73,6 +73,12 @@ 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)
 {
+	return pci_bdf_parse(input, dev_addr);
+}
+
+int
+pci_bdf_parse(const char *input, struct rte_pci_addr *dev_addr)
+{
 	const char *in = input;
 
 	dev_addr->domain = 0;
@@ -91,6 +97,12 @@ 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)
 {
+	return pci_dbdf_parse(input, dev_addr);
+}
+
+int
+pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr)
+{
 	const char *in = input;
 	unsigned long val;
 	char *end;
@@ -117,6 +129,13 @@ void
 rte_pci_device_name(const struct rte_pci_addr *addr,
 		    char *output, size_t size)
 {
+	pci_device_name(addr, output, size);
+}
+
+void
+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,
@@ -127,6 +146,13 @@ int
 rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
 			 const struct rte_pci_addr *addr2)
 {
+	return pci_addr_cmp(addr, addr2);
+}
+
+int
+pci_addr_cmp(const struct rte_pci_addr *addr,
+	     const struct rte_pci_addr *addr2)
+{
 	uint64_t dev_addr, dev_addr2;
 
 	if ((addr == NULL) || (addr2 == NULL))
lib/librte_pci/rte_pci_version.map +4 -0
index a940259..8d180e3 100644
@@ -3,6 +3,10 @@ DPDK_17.11 {
 
 	eal_parse_pci_BDF;
 	eal_parse_pci_DomBDF;
+	pci_addr_cmp;
+	pci_bdf_parse;
+	pci_dbdf_parse;
+	pci_device_name;
 	pci_map_resource;
 	pci_unmap_resource;
 	rte_eal_compare_pci_addr;
Signature · 1 line
2.1.4
#65 lore raw

PATCH v4 13/16 pci: introduce PCI address parsing function

In reply to Gaetan Rivet

A new single function that is able to parse all currently supported format:

* Domain-Bus-Device-Function
* Bus-Device-Function

---
 lib/librte_pci/include/rte_pci.h   | 15 +++++++++++++++
 lib/librte_pci/rte_pci.c           | 10 ++++++++++
 lib/librte_pci/rte_pci_version.map |  1 +
 3 files changed, 26 insertions(+)
lib/librte_pci/include/rte_pci.h +15 -0
index 38cbdb3..9e79557 100644
@@ -256,6 +256,21 @@ int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
 int pci_addr_cmp(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 pci_addr_parse(const char *str, struct rte_pci_addr *addr);
+
 /**
  * Map a particular resource from a file.
  *
lib/librte_pci/rte_pci.c +10 -0
index fc2fc7f..7ba472c 100644
@@ -171,6 +171,16 @@ pci_addr_cmp(const struct rte_pci_addr *addr,
 		return 0;
 }
 
+int
+pci_addr_parse(const char *str, struct rte_pci_addr *addr)
+{
+	if (pci_bdf_parse(str, addr) == 0 ||
+	    pci_dbdf_parse(str, addr) == 0)
+		return 0;
+	return -1;
+}
+
+
 /* map a particular resource from a file */
 void *
 pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
lib/librte_pci/rte_pci_version.map +1 -0
index 8d180e3..5f50f98 100644
@@ -4,6 +4,7 @@ DPDK_17.11 {
 	eal_parse_pci_BDF;
 	eal_parse_pci_DomBDF;
 	pci_addr_cmp;
+	pci_addr_parse;
 	pci_bdf_parse;
 	pci_dbdf_parse;
 	pci_device_name;
Signature · 1 line
2.1.4
#66 lore raw

PATCH v4 14/16 pci: make specialized parsing functions private

In reply to Gaetan Rivet

Do not expose the minute implementations of PCI parsing. This leaves only the all-purpose pci_addr_parse, which is simpler to use.

---
 lib/librte_pci/include/rte_pci.h   | 29 -----------------------------
 lib/librte_pci/rte_pci.c           | 28 ++++++++++++++--------------
 lib/librte_pci/rte_pci_version.map |  2 --
 3 files changed, 14 insertions(+), 45 deletions(-)
lib/librte_pci/include/rte_pci.h +0 -29
index 9e79557..ea0897c 100644
@@ -151,21 +151,6 @@ TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
 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 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 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 including
@@ -181,20 +166,6 @@ int pci_bdf_parse(const char *input, struct rte_pci_addr *dev_addr);
 int eal_parse_pci_DomBDF(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 pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr);
-
-/**
  * @deprecated
  * Utility function to write a pci device name, this device name can later be
  * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_*
lib/librte_pci/rte_pci.c +14 -14
index 7ba472c..1307a18 100644
@@ -70,13 +70,7 @@ get_u8_pciaddr_field(const char *in, void *_u8, char dlm)
 	return end + 1;
 }
 
-int
-eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
-{
-	return pci_bdf_parse(input, dev_addr);
-}
-
-int
+static int
 pci_bdf_parse(const char *input, struct rte_pci_addr *dev_addr)
 {
 	const char *in = input;
@@ -94,13 +88,7 @@ pci_bdf_parse(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 pci_dbdf_parse(input, dev_addr);
-}
-
-int
+static int
 pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr)
 {
 	const char *in = input;
@@ -125,6 +113,18 @@ pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr)
 	return 0;
 }
 
+int
+eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
+{
+	return pci_bdf_parse(input, dev_addr);
+}
+
+int
+eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
+{
+	return pci_dbdf_parse(input, dev_addr);
+}
+
 void
 rte_pci_device_name(const struct rte_pci_addr *addr,
 		    char *output, size_t size)
lib/librte_pci/rte_pci_version.map +0 -2
index 5f50f98..b5c9ec2 100644
@@ -5,8 +5,6 @@ DPDK_17.11 {
 	eal_parse_pci_DomBDF;
 	pci_addr_cmp;
 	pci_addr_parse;
-	pci_bdf_parse;
-	pci_dbdf_parse;
 	pci_device_name;
 	pci_map_resource;
 	pci_unmap_resource;
Signature · 1 line
2.1.4
#67 lore raw

PATCH v4 15/16 bus/pci: use new PCI addr parsing function

In reply to Gaetan Rivet
---
 drivers/bus/pci/pci_common.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/bus/pci/pci_common.c +1 -2
index cd95d1a..d7a1c05 100644
@@ -437,8 +437,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 = (pci_addr_parse(name, &pci_addr) == 0);
 	if (parse && addr != NULL)
 		*out = pci_addr;
 	return parse == false;
Signature · 1 line
2.1.4
#68 lore raw

PATCH v4 16/16 doc: add notes on EAL PCI API update

In reply to Gaetan Rivet

Add 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
index 63b9869..ed3d6d8 100644
@@ -232,6 +232,34 @@ API Changes
   By this way PMDs can return an error value in case of failure at stats
   getting process time.
 
+* **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
#69 lore raw

v5 cover Move PCI away from the EAL

In reply to 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 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/crypto

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

               ~*~

Compilation is still broken from

* pci: introduce PCI lib and bus

until

* net/bonding: use local prefix for local function

Gaetan Rivet (20):
eal: include debug header in bus source
ethdev: remove useless PCI dependency
pci: introduce PCI lib and bus
lib: include PCI bus header
drivers: include PCI bus header
test: include PCI bus header
app/testpmd: include PCI bus header
cryptodev: move PCI specific helpers to drivers/crypto net/bonding: use local prefix for local function
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 bus/pci: use new PCI addr parsing function bus/pci: do not expose private functions bus/pci: do not expose PCI match function bus/pci: do not expose IOVA mode getter
doc: add notes on EAL PCI API update
bus: rename scan policy as probe policy

 app/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/bus/Makefile                             |   2 +
 drivers/bus/pci/Makefile                         |  59 ++
 drivers/bus/pci/bsd/Makefile                     |  32 +
 drivers/bus/pci/bsd/pci.c                        | 681 +++++++++++++++++++
 drivers/bus/pci/include/rte_bus_pci.h            | 350 ++++++++++
 drivers/bus/pci/linux/Makefile                   |  37 +
 drivers/bus/pci/linux/pci.c                      | 821 +++++++++++++++++++++++
 drivers/bus/pci/linux/pci_init.h                 |  97 +++
 drivers/bus/pci/linux/pci_uio.c                  | 568 ++++++++++++++++
 drivers/bus/pci/linux/pci_vfio.c                 | 757 +++++++++++++++++++++
 drivers/bus/pci/linux/vfio_mp_sync.c             | 426 ++++++++++++
 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/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/mempool/octeontx/octeontx_fpavf.c        |   2 +-
 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          |   5 +-
 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/mlx4/mlx4_ethdev.c                   |   2 +-
 drivers/net/mlx5/mlx5.c                          |   1 +
 drivers/net/mlx5/mlx5_ethdev.c                   |   1 +
 drivers/net/nfp/nfp_nfpu.c                       |   2 +-
 drivers/net/nfp/nfp_nfpu.h                       |   2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c       |   2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c       |   2 +-
 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_pci.c              | 680 -------------------
 lib/librte_eal/bsdapp/eal/rte_eal_version.map    |  17 -
 lib/librte_eal/common/Makefile                   |   2 +-
 lib/librte_eal/common/eal_common_bus.c           |   1 +
 lib/librte_eal/common/eal_common_devargs.c       |   6 +-
 lib/librte_eal/common/eal_common_pci.c           | 573 ----------------
 lib/librte_eal/common/eal_common_pci_uio.c       | 233 -------
 lib/librte_eal/common/eal_private.h              | 132 ----
 lib/librte_eal/common/include/rte_bus.h          |  12 +-
 lib/librte_eal/common/include/rte_pci.h          | 633 -----------------
 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_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       | 756 ---------------------
 lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c   | 425 ------------
 lib/librte_eal/linuxapp/eal/rte_eal_version.map  |  17 -
 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                 | 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 +
 94 files changed, 5818 insertions(+), 5176 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/linux/vfio_mp_sync.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
 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 · 1 line
2.1.4
#70 lore raw

PATCH v5 1/20 eal: include debug header in bus source

This 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
index c3c77f4..3c66a02 100644
@@ -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
#71 lore raw

PATCH v5 2/20 ethdev: remove useless PCI dependency

In reply to Gaetan Rivet
---
 lib/librte_ether/rte_ethdev.c | 1 -
 1 file changed, 1 deletion(-)
lib/librte_ether/rte_ethdev.c +0 -1
index 9460161..bb08204 100644
@@ -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
#72 lore raw

PATCH v5 3/20 pci: introduce PCI lib and bus

In reply to Gaetan Rivet

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

---
 config/common_base                              |  10 +
 drivers/bus/Makefile                            |   2 +
 drivers/bus/pci/Makefile                        |  59 ++
 drivers/bus/pci/bsd/Makefile                    |  32 +
 drivers/bus/pci/bsd/pci.c                       | 680 ++++++++++++++++++++
 drivers/bus/pci/include/rte_bus_pci.h           | 415 ++++++++++++
 drivers/bus/pci/linux/Makefile                  |  37 ++
 drivers/bus/pci/linux/pci.c                     | 820 ++++++++++++++++++++++++
 drivers/bus/pci/linux/pci_init.h                |  97 +++
 drivers/bus/pci/linux/pci_uio.c                 | 567 ++++++++++++++++
 drivers/bus/pci/linux/pci_vfio.c                | 756 ++++++++++++++++++++++
 drivers/bus/pci/linux/vfio_mp_sync.c            | 425 ++++++++++++
 drivers/bus/pci/pci_common.c                    | 535 ++++++++++++++++
 drivers/bus/pci/pci_common_uio.c                | 234 +++++++
 drivers/bus/pci/private.h                       | 173 +++++
 drivers/bus/pci/rte_bus_pci_version.map         |  21 +
 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/bsdapp/eal/rte_eal_version.map   |  15 -
 lib/librte_eal/common/Makefile                  |   2 +-
 lib/librte_eal/common/eal_common_pci.c          | 573 -----------------
 lib/librte_eal/common/eal_common_pci_uio.c      | 233 -------
 lib/librte_eal/common/eal_private.h             | 132 ----
 lib/librte_eal/common/include/rte_pci.h         | 633 ------------------
 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_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      | 756 ----------------------
 lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c  | 425 ------------
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  15 -
 lib/librte_ether/rte_ethdev.h                   |   2 -
 lib/librte_pci/Makefile                         |  48 ++
 lib/librte_pci/include/rte_pci.h                | 287 +++++++++
 lib/librte_pci/rte_pci.c                        |  92 +++
 lib/librte_pci/rte_pci_version.map              |   8 +
 mk/rte.app.mk                                   |   3 +
 41 files changed, 5304 insertions(+), 4963 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/linux/vfio_mp_sync.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
 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
config/common_base +10 -0
index dc4da9a..39ec7f0 100644
@@ -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
index 6cb6466..40b9e96 100644
@@ -37,5 +37,7 @@ DEPDIRS-dpaa = $(core-libs)
 
 DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
 DEPDIRS-fslmc = $(core-libs)
+DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DEPDIRS-pci = $(core-libs)
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/bus/pci/Makefile new file +59 -0

59 lines not on this page · raw message

drivers/bus/pci/bsd/Makefile new file +32 -0
new file mode 100644
index 0000000..4450913
@@ -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 +680 -0

680 lines not on this page · raw message

drivers/bus/pci/include/rte_bus_pci.h new file +415 -0

415 lines not on this page · raw message

drivers/bus/pci/linux/Makefile new file +37 -0
new file mode 100644
index 0000000..5410566
@@ -0,0 +1,37 @@
+#   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
+SRCS += vfio_mp_sync.c
+
+CFLAGS += -D_GNU_SOURCE
drivers/bus/pci/linux/pci.c new file +820 -0

820 lines not on this page · raw message

drivers/bus/pci/linux/pci_init.h new file +97 -0

97 lines not on this page · raw message

drivers/bus/pci/linux/pci_uio.c new file +567 -0

567 lines not on this page · raw message

drivers/bus/pci/linux/pci_vfio.c new file +756 -0

264 lines not on this page · raw message

drivers/bus/pci/linux/vfio_mp_sync.c new file +425 -0

425 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 +234 -0

234 lines not on this page · raw message

drivers/bus/pci/private.h new file +173 -0

173 lines not on this page · raw message

drivers/bus/pci/rte_bus_pci_version.map new file +21 -0
new file mode 100644
index 0000000..c1973f6

Lines of this file are not shown. View the raw message.

lib/Makefile +2 -0
index 86d475f..abe6467 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/bsdapp/eal/Makefile +0 -3
index 317a75e..518832f 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/bsdapp/eal/eal.c +0 -1
index 30d3bd5..2917808 100644

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/bsdapp/eal/rte_eal_version.map +0 -15
index d19f264..97b3918 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/common/Makefile +1 -1
index e8fd67a..ac8d3bb 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/common/eal_common_pci.c deleted +0 -573

573 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 -132

132 lines not on this page · raw message

lib/librte_eal/common/include/rte_pci.h deleted +0 -633

633 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/Makefile +0 -10
index 21e0b4a..90adb8d 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/linuxapp/eal/eal.c +0 -1
index ec37c52..5005e6d 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/linuxapp/eal/eal_interrupts.c +0 -1
index 3e9ac41..0bebf00 100644

Lines of this file are not shown. View the raw message.

lib/librte_eal/linuxapp/eal/eal_pci.c deleted +0 -818

818 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal_pci_init.h deleted +0 -97

97 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 -756

756 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c deleted +0 -425

425 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/rte_eal_version.map +0 -15
index fe186cb..a8ea4ea 100644

Lines of this file are not shown. View the raw message.

lib/librte_ether/rte_ethdev.h +0 -2
index 354d170..e7be855 100644

Lines of this file are not shown. View the raw message.

lib/librte_pci/Makefile new file +48 -0

48 lines not on this page · raw message

lib/librte_pci/include/rte_pci.h new file +287 -0

287 lines not on this page · raw message

lib/librte_pci/rte_pci.c new file +92 -0

92 lines not on this page · raw message

lib/librte_pci/rte_pci_version.map new file +8 -0
new file mode 100644
index 0000000..64dec54

Lines of this file are not shown. View the raw message.

mk/rte.app.mk +3 -0
index 0b8f612..88b1a71 100644

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.

#73 lore raw

PATCH v5 4/20 lib: include PCI bus header

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update the libraries, as structuraly unsound as it may be.

---
 lib/librte_ether/rte_ethdev_pci.h          | 1 +
 lib/librte_eventdev/rte_eventdev_pmd_pci.h | 1 +
 2 files changed, 2 insertions(+)
lib/librte_ether/rte_ethdev_pci.h +1 -0
index 56b1072..722075e 100644
@@ -36,6 +36,7 @@
 
 #include <rte_malloc.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 
 /**
lib/librte_eventdev/rte_eventdev_pmd_pci.h +1 -0
index b6bd731..ade32b5 100644
@@ -50,6 +50,7 @@ extern "C" {
 #include <rte_eal.h>
 #include <rte_lcore.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "rte_eventdev_pmd.h"
 
Signature · 1 line
2.1.4
#74 lore raw

PATCH v5 5/20 drivers: include PCI bus header

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update drivers.

---
 drivers/bus/pci/bsd/pci.c                  | 1 +
 drivers/bus/pci/linux/pci.c                | 1 +
 drivers/bus/pci/linux/pci_uio.c            | 1 +
 drivers/bus/pci/linux/pci_vfio.c           | 1 +
 drivers/bus/pci/linux/vfio_mp_sync.c       | 1 +
 drivers/bus/pci/pci_common.c               | 1 +
 drivers/bus/pci/pci_common_uio.c           | 1 +
 drivers/bus/pci/private.h                  | 1 +
 drivers/crypto/qat/qat_qp.c                | 1 +
 drivers/event/octeontx/ssovf_probe.c       | 1 +
 drivers/mempool/octeontx/octeontx_fpavf.c  | 2 +-
 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/mlx4/mlx4_ethdev.c             | 2 +-
 drivers/net/mlx5/mlx5.c                    | 1 +
 drivers/net/mlx5/mlx5_ethdev.c             | 1 +
 drivers/net/nfp/nfp_nfpu.c                 | 2 +-
 drivers/net/nfp/nfp_nfpu.h                 | 2 +-
 drivers/net/octeontx/base/octeontx_pkivf.c | 2 +-
 drivers/net/octeontx/base/octeontx_pkovf.c | 2 +-
 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 +
 41 files changed, 44 insertions(+), 7 deletions(-)
drivers/bus/pci/bsd/pci.c +1 -0
index 599519a..753d914 100644
@@ -57,6 +57,7 @@
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_launch.h>
 #include <rte_memory.h>
drivers/bus/pci/linux/pci.c +1 -0
index c1fcc56..422579f 100644
@@ -37,6 +37,7 @@
 #include <rte_log.h>
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 #include <rte_devargs.h>
drivers/bus/pci/linux/pci_uio.c +1 -0
index d3f0556..940fa21 100644
@@ -47,6 +47,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
drivers/bus/pci/linux/pci_vfio.c +1 -0
index e69e4d3..855e2b9 100644
@@ -42,6 +42,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 
drivers/bus/pci/linux/vfio_mp_sync.c +1 -0
index dd24e86..d07687f 100644
@@ -50,6 +50,7 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 
drivers/bus/pci/pci_common.c +1 -0
index 7b68e99..cd95d1a 100644
@@ -45,6 +45,7 @@
 #include <rte_log.h>
 #include <rte_bus.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_memzone.h>
drivers/bus/pci/pci_common_uio.c +1 -0
index 4365660..544c606 100644
@@ -40,6 +40,7 @@
 
 #include <rte_eal.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tailq.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
drivers/bus/pci/private.h +1 -0
index 7ff1fc4..fdc2c81 100644
@@ -37,6 +37,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 struct rte_pci_driver;
 struct rte_pci_device;
drivers/crypto/qat/qat_qp.c +1 -0
index 34f75ca..8489662 100644
@@ -37,6 +37,7 @@
 #include <rte_memzone.h>
 #include <rte_cryptodev_pmd.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_prefetch.h>
 
drivers/event/octeontx/ssovf_probe.c +1 -0
index e1c0c6d..1cac4bc 100644
@@ -35,6 +35,7 @@
 #include <rte_eal.h>
 #include <rte_io.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "ssovf_evdev.h"
 
drivers/mempool/octeontx/octeontx_fpavf.c +1 -1
index eea934f..bbede5d 100644
@@ -41,7 +41,7 @@
 
 #include <rte_atomic.h>
 #include <rte_eal.h>
-#include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_errno.h>
 #include <rte_memory.h>
 #include <rte_malloc.h>
drivers/net/ark/ark_ethdev.c +1 -0
index dae1f3d..384be47 100644
@@ -35,6 +35,7 @@
 #include <sys/stat.h>
 #include <dlfcn.h>
 
+#include <rte_bus_pci.h>
 #include <rte_ethdev_pci.h>
 #include <rte_kvargs.h>
 
drivers/net/avp/avp_ethdev.c +2 -0
index b97a90c..89e91e2 100644
@@ -36,6 +36,7 @@
 #include <errno.h>
 #include <unistd.h>
 
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_memcpy.h>
@@ -45,6 +46,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_cycles.h>
drivers/net/bnxt/bnxt.h +1 -0
index 294a174..039b248 100644
@@ -39,6 +39,7 @@
 #include <sys/queue.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_memory.h>
 #include <rte_lcore.h>
drivers/net/bonding/rte_eth_bond_args.c +1 -0
index c4dcefa..dea0265 100644
@@ -33,6 +33,7 @@
 
 #include <rte_devargs.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_kvargs.h>
 
 #include <cmdline_parse.h>
drivers/net/cxgbe/base/adapter.h +1 -0
index 5e5f221..f2057af 100644
@@ -36,6 +36,7 @@
 #ifndef __T4_ADAPTER_H__
 #define __T4_ADAPTER_H__
 
+#include <rte_bus_pci.h>
 #include <rte_mbuf.h>
 #include <rte_io.h>
 
drivers/net/cxgbe/cxgbe_ethdev.c +1 -0
index 02b4f62..b1405e5 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/e1000/em_ethdev.c +1 -0
index e724205..aa831f8 100644
@@ -43,6 +43,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/e1000/igb_ethdev.c +1 -0
index f3b1d70..380ec31 100644
@@ -43,6 +43,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/e1000/igb_pf.c +1 -0
index 6809d30..cd6ae2f 100644
@@ -39,6 +39,7 @@
 #include <stdarg.h>
 #include <inttypes.h>
 
+#include <rte_bus_pci.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
 #include <rte_debug.h>
drivers/net/ena/ena_ethdev.h +1 -0
index dc3080f..be8bc9f 100644
@@ -35,6 +35,7 @@
 #define _ENA_ETHDEV_H_
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "ena_com.h"
 
drivers/net/enic/base/vnic_dev.h +3 -1
index 9a9e691..c9ca25b 100644
@@ -35,8 +35,10 @@
 #ifndef _VNIC_DEV_H_
 #define _VNIC_DEV_H_
 
+#include <rte_pci.h>
+#include <rte_bus_pci.h>
+
 #include "enic_compat.h"
-#include "rte_pci.h"
 #include "vnic_resource.h"
 #include "vnic_devcmd.h"
 
drivers/net/enic/enic_ethdev.c +1 -0
index 5386b2a..7a7e2d9 100644
@@ -37,6 +37,7 @@
 
 #include <rte_dev.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_string_fns.h>
drivers/net/enic/enic_main.c +1 -0
index 5211670..be62447 100644
@@ -40,6 +40,7 @@
 #include <libgen.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_memzone.h>
 #include <rte_malloc.h>
 #include <rte_mbuf.h>
drivers/net/i40e/i40e_ethdev.c +1 -0
index 814f458..ffead82 100644
@@ -43,6 +43,7 @@
 #include <rte_eal.h>
 #include <rte_string_fns.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
drivers/net/i40e/i40e_ethdev_vf.c +1 -0
index 63d1f77..39a0cbd 100644
@@ -47,6 +47,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/ixgbe/ixgbe_ethdev.c +1 -0
index a08e475..a750a88 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
drivers/net/ixgbe/ixgbe_ethdev.h +1 -0
index e28c856..5156483 100644
@@ -41,6 +41,7 @@
 #include <rte_time.h>
 #include <rte_hash.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tm_driver.h>
 
 /* need update link, bit flag */
drivers/net/mlx4/mlx4_ethdev.c +1 -1
index 8962be1..b97b146 100644
@@ -64,7 +64,7 @@
 #include <rte_errno.h>
 #include <rte_ethdev.h>
 #include <rte_ether.h>
-#include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "mlx4.h"
 #include "mlx4_rxtx.h"
drivers/net/mlx5/mlx5.c +1 -0
index 29221dc..d60ef74 100644
@@ -54,6 +54,7 @@
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_common.h>
 #include <rte_kvargs.h>
 
drivers/net/mlx5/mlx5_ethdev.c +1 -0
index e06dce3..c31ea4b 100644
@@ -56,6 +56,7 @@
 
 #include <rte_atomic.h>
 #include <rte_ethdev.h>
+#include <rte_bus_pci.h>
 #include <rte_mbuf.h>
 #include <rte_common.h>
 #include <rte_interrupts.h>
drivers/net/nfp/nfp_nfpu.c +1 -1
index 556ded3..5775d8d 100644
@@ -8,7 +8,7 @@
 #include <fcntl.h>
 #include <sys/types.h>
 
-#include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_malloc.h>
 
 #include "nfp_nfpu.h"
drivers/net/nfp/nfp_nfpu.h +1 -1
index 31511b3..e56fa09 100644
@@ -42,7 +42,7 @@
  */
 
 
-#include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include "nfp_nspu.h"
 
 typedef struct {
drivers/net/octeontx/base/octeontx_pkivf.c +1 -1
index afae6a3..20cbe0c 100644
@@ -32,7 +32,7 @@
 #include <string.h>
 
 #include <rte_eal.h>
-#include <rte_pci.h>
+#include <rte_bus_pci.h>
 
 #include "octeontx_pkivf.h"
 
drivers/net/octeontx/base/octeontx_pkovf.c +1 -1
index a8f6e5d..2bf607b 100644
@@ -37,7 +37,7 @@
 #include <rte_cycles.h>
 #include <rte_malloc.h>
 #include <rte_memory.h>
-#include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_spinlock.h>
 
 #include "../octeontx_logs.h"
drivers/net/sfc/sfc.h +1 -0
index c170384..7f11bf2 100644
@@ -35,6 +35,7 @@
 #include <stdbool.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 #include <rte_kvargs.h>
 #include <rte_spinlock.h>
drivers/net/sfc/sfc_ethdev.c +1 -0
index bd09191..430e24f 100644
@@ -33,6 +33,7 @@
 #include <rte_ethdev.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_errno.h>
 
 #include "efx.h"
drivers/net/thunderx/nicvf_ethdev.c +1 -0
index 551b371..24ac3f9 100644
@@ -61,6 +61,7 @@
 #include <rte_malloc.h>
 #include <rte_random.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_tailq.h>
 
 #include "base/nicvf_plat.h"
drivers/net/virtio/virtio_ethdev.c +1 -0
index 0ec54a9..3c4c083 100644
@@ -46,6 +46,7 @@
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ether.h>
 #include <rte_common.h>
 #include <rte_errno.h>
drivers/net/virtio/virtio_pci.h +1 -0
index 5f3b6c8..36d452c 100644
@@ -37,6 +37,7 @@
 #include <stdint.h>
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_ethdev.h>
 
 struct virtqueue;
drivers/net/vmxnet3/vmxnet3_ethdev.c +1 -0
index 58bc4f2..9772386 100644
@@ -48,6 +48,7 @@
 #include <rte_log.h>
 #include <rte_debug.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_atomic.h>
 #include <rte_branch_prediction.h>
 #include <rte_memory.h>
Signature · 1 line
2.1.4
#75 lore raw

PATCH v5 6/20 test: include PCI bus header

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update test applications.

---
 test/test/test_kni.c    | 1 +
 test/test/virtual_pmd.c | 1 +
 2 files changed, 2 insertions(+)
test/test/test_kni.c +1 -0
index 2450c9f..b956727 100644
@@ -42,6 +42,7 @@
 #include <rte_string_fns.h>
 #include <rte_mempool.h>
 #include <rte_ethdev.h>
+#include <rte_bus_pci.h>
 #include <rte_cycles.h>
 #include <rte_kni.h>
 
test/test/virtual_pmd.c +1 -0
index 09daf6c..b57a949 100644
@@ -34,6 +34,7 @@
 #include <rte_mbuf.h>
 #include <rte_ethdev.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_malloc.h>
 #include <rte_memcpy.h>
 #include <rte_memory.h>
Signature · 1 line
2.1.4
#76 lore raw

PATCH v5 7/20 app/testpmd: include PCI bus header

In reply to Gaetan Rivet

Devices and drivers are now defined within the bus-specific PCI header. Update applications.

---
 app/test-pmd/testpmd.h | 1 +
 1 file changed, 1 insertion(+)
app/test-pmd/testpmd.h +1 -0
index 0b8e624..b05c8a0 100644
@@ -35,6 +35,7 @@
 #define _TESTPMD_H_
 
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_gro.h>
 #include <rte_gso.h>
 
Signature · 1 line
2.1.4
#77 lore raw

PATCH v5 8/20 cryptodev: move PCI specific helpers to drivers/crypto

In reply to Gaetan Rivet

Those helpers rely on the PCI bus driver implementation. Other similar libraries relied on the bus-specifics being handled in inlined functions, to be compiled on demand by drivers, once the proper PCI dependency has been settled. This seems unsafe.

Move the PCI-specific helpers out of the lib directory to the drivers/crypto directory, properly following the dependency hierarchy.

---
 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 ++
 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 -
 9 files changed, 284 insertions(+), 190 deletions(-)
 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
drivers/crypto/Makefile +3 -1
index 7a719b9..cfd6cb6 100644
@@ -33,6 +33,8 @@ include $(RTE_SDK)/mk/rte.vars.mk
 
 core-libs := librte_eal librte_mbuf librte_mempool librte_ring librte_cryptodev
 
+DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
+DEPDIRS-pci = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_GCM) += aesni_gcm
 DEPDIRS-aesni_gcm = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB) += aesni_mb
@@ -42,7 +44,7 @@ DEPDIRS-armv8 = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_OPENSSL) += openssl
 DEPDIRS-openssl = $(core-libs)
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_QAT) += qat
-DEPDIRS-qat = $(core-libs)
+DEPDIRS-qat = $(core-libs) librte_cryptodev_pci
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler
 DEPDIRS-scheduler = $(core-libs) librte_kvargs librte_reorder
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_SNOW3G) += snow3g
drivers/crypto/pci/Makefile new file +52 -0

52 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci.c new file +128 -0

128 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci.h new file +94 -0

94 lines not on this page · raw message

drivers/crypto/pci/rte_cryptodev_pci_version.map new file +7 -0
new file mode 100644
index 0000000..0510fef
@@ -0,0 +1,7 @@
+DPDK_17.11 {
+	global:
+
+	rte_cryptodev_pci_generic_probe;
+	rte_cryptodev_pci_generic_remove;
+
+};
lib/librte_cryptodev/Makefile +0 -1
index 6ac331b..bd94cf7 100644
@@ -49,7 +49,6 @@ SYMLINK-y-include += rte_crypto_sym.h
 SYMLINK-y-include += rte_cryptodev.h
 SYMLINK-y-include += rte_cryptodev_pmd.h
 SYMLINK-y-include += rte_cryptodev_vdev.h
-SYMLINK-y-include += rte_cryptodev_pci.h
 
 # versioning export map
 EXPORT_MAP := rte_cryptodev_version.map
lib/librte_cryptodev/rte_cryptodev_pci.h deleted +0 -92

92 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_pmd.c +0 -94

103 lines not on this page · raw message

lib/librte_cryptodev/rte_cryptodev_version.map +0 -2
index e9ba88a..496253d 100644
@@ -68,8 +68,6 @@ DPDK_17.08 {
 	rte_cryptodev_get_aead_algo_enum;
 	rte_cryptodev_get_header_session_size;
 	rte_cryptodev_get_private_session_size;
-	rte_cryptodev_pci_generic_probe;
-	rte_cryptodev_pci_generic_remove;
 	rte_cryptodev_sym_capability_check_aead;
 	rte_cryptodev_sym_session_init;
 	rte_cryptodev_sym_session_clear;
Signature · 1 line
2.1.4
#78 lore raw

PATCH v5 9/20 net/bonding: use local prefix for local function

In reply to Gaetan Rivet
---
 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
index dea0265..e816da3 100644
@@ -90,7 +90,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;
@@ -119,7 +119,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
#79 lore raw

PATCH v5 10/20 pci: avoid inlining functions

In reply to Gaetan Rivet

Parsing operations should not happen in performance critical sections. Headers should not propose implementations unless duly required.

---
 lib/librte_pci/include/rte_pci.h   | 69 ++++----------------------------------
 lib/librte_pci/rte_pci.c           | 65 +++++++++++++++++++++++++++++++++++
 lib/librte_pci/rte_pci_version.map |  4 +++
 3 files changed, 75 insertions(+), 63 deletions(-)
lib/librte_pci/include/rte_pci.h +6 -63
index 2647568..fe4d411 100644
@@ -134,19 +134,6 @@ struct mapped_pci_resource {
 /** mapped pci device list */
 TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
 
-/**< Internal use only - 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)
-
 /**
  * Utility function to produce a PCI Bus-Device-Function value
  * given a string representation. Assumes that the BDF is provided without
@@ -160,15 +147,7 @@ do {                                                               \
  * @return
  *  0 on success, negative on error.
  */
-static inline 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_BDF(const char *input, struct rte_pci_addr *dev_addr);
 
 /**
  * Utility function to produce a PCI Bus-Device-Function value
@@ -182,16 +161,7 @@ eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
  * @return
  *  0 on success, negative on error.
  */
-static inline 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
+int eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr);
 
 /**
  * Utility function to write a pci device name, this device name can later be
@@ -205,17 +175,9 @@ eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
  * @param size
  *	The output buffer size
  */
-static inline 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);
-}
+void rte_pci_device_name(const struct rte_pci_addr *addr,
+			 char *output, size_t size);
 
-/* Compare two PCI device addresses. */
 /**
  * Utility function to compare two PCI device addresses.
  *
@@ -228,27 +190,8 @@ rte_pci_device_name(const struct rte_pci_addr *addr,
  *	Positive on addr is greater than addr2.
  *	Negative on addr is less than addr2, or error.
  */
-static inline 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;
-}
+int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
+			     const struct rte_pci_addr *addr2);
 
 /**
  * Map a particular resource from a file.
lib/librte_pci/rte_pci.c +65 -0

71 lines not on this page · raw message

lib/librte_pci/rte_pci_version.map +4 -0
index 64dec54..a940259 100644
@@ -1,8 +1,12 @@
 DPDK_17.11 {
 	global:
 
+	eal_parse_pci_BDF;
+	eal_parse_pci_DomBDF;
 	pci_map_resource;
 	pci_unmap_resource;
+	rte_eal_compare_pci_addr;
+	rte_pci_device_name;
 
 	local: *;
 };
Signature · 1 line
2.1.4
#80 lore raw

Re: [PATCH v5 10/20] pci: avoid inlining functions

Quoted 5 lines · Gaetan Rivet

Parsing operations should not happen in performance critical sections. Headers should not propose implementations unless duly required.

---

Can these cleanups be done before the move in patch 3?

#81 lore raw

Re: [PATCH v5 10/20] pci: avoid inlining functions

Quoted 9 lines · Aaron Conole
Quoted 5 lines · Gaetan Rivet

Parsing operations should not happen in performance critical sections. Headers should not propose implementations unless duly required.

---

Can these cleanups be done before the move in patch 3?

Sure.

I wanted to minimize the changes before moving the code. If I had rework to do on these patches, I wanted to avoid having to redo the move and verify the changes were properly propagated.

But if it is necessary, these changes can happen before moving the whole lot.

Signature · 2 lines
Gaëtan Rivet
6WIND
#82 lore raw

Re: [PATCH v5 10/20] pci: avoid inlining functions

Quoted 9 lines · Gaëtan Rivet
Quoted 8 lines · Aaron Conole
Quoted 5 lines · Gaetan Rivet

Parsing operations should not happen in performance critical sections. Headers should not propose implementations unless duly required.

---

Quoted 7 lines
Quoted 1 line

Can these cleanups be done before the move in patch 3?

Sure.

I wanted to minimize the changes before moving the code. If I had rework to do on these patches, I wanted to avoid having to redo the move and verify the changes were properly propagated.

I use 'git rebase -i' to do changes; it can take care of moving through a stack of changes.

Quoted 2 lines

But if it is necessary, these changes can happen before moving the whole lot.

I think it's better to do all the changes before hand. If there is a change that could be part of a bug fix, it can be easily backported to stable branches.

#83 lore raw

PATCH v5 11/20 pci: avoid over-complicated macro

In reply to Gaetan Rivet

Using 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_pci/rte_pci.c | 65 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 46 insertions(+), 19 deletions(-)
lib/librte_pci/rte_pci.c +46 -19
index 8584b55..cbb5359 100644
@@ -53,36 +53,63 @@
 
 #include "rte_pci.h"
 
-/* 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;
 }
 
Signature · 1 line
2.1.4
#84 lore raw

PATCH v5 12/20 pci: deprecate misnamed functions

In reply to Gaetan Rivet

Rename misnamed functions and describe the change in a deprecation notice.

---
 doc/guides/rel_notes/deprecation.rst | 10 ++++++
 lib/librte_pci/include/rte_pci.h     | 63 ++++++++++++++++++++++++++++++++++++
 lib/librte_pci/rte_pci.c             | 26 +++++++++++++++
 lib/librte_pci/rte_pci_version.map   |  4 +++
 4 files changed, 103 insertions(+)
doc/guides/rel_notes/deprecation.rst +10 -0
index 4e4d97b..ef2264f 100644
@@ -98,3 +98,13 @@ Deprecation Notices
   The non-"do-sig" versions of the hash tables will be removed
   (including the ``signature_offset`` parameter)
   and the "do-sig" versions renamed accordingly.
+
+* pci: Several exposed functions are misnamed.
+  The following functions are deprecated starting from v17.11 and are replaced:
+
+  - ``eal_parse_pci_BDF`` replaced by ``pci_parse_BDF``
+  - ``eal_parse_pci_DomBDF`` replaced by ``pci_parse_DomBDF``
+  - ``rte_eal_compare_pci_addr`` replaced by ``pci_addr_cmp``
+  - ``rte_pci_device_name`` replaced by ``pci_device_name``
+
+  The functions are only renamed. Their behavior is not affected.
lib/librte_pci/include/rte_pci.h +63 -0

93 lines not on this page · raw message

lib/librte_pci/rte_pci.c +26 -0
index cbb5359..fc2fc7f 100644
@@ -73,6 +73,12 @@ 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)
 {
+	return pci_bdf_parse(input, dev_addr);
+}
+
+int
+pci_bdf_parse(const char *input, struct rte_pci_addr *dev_addr)
+{
 	const char *in = input;
 
 	dev_addr->domain = 0;
@@ -91,6 +97,12 @@ 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)
 {
+	return pci_dbdf_parse(input, dev_addr);
+}
+
+int
+pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr)
+{
 	const char *in = input;
 	unsigned long val;
 	char *end;
@@ -117,6 +129,13 @@ void
 rte_pci_device_name(const struct rte_pci_addr *addr,
 		    char *output, size_t size)
 {
+	pci_device_name(addr, output, size);
+}
+
+void
+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,
@@ -127,6 +146,13 @@ int
 rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
 			 const struct rte_pci_addr *addr2)
 {
+	return pci_addr_cmp(addr, addr2);
+}
+
+int
+pci_addr_cmp(const struct rte_pci_addr *addr,
+	     const struct rte_pci_addr *addr2)
+{
 	uint64_t dev_addr, dev_addr2;
 
 	if ((addr == NULL) || (addr2 == NULL))
lib/librte_pci/rte_pci_version.map +4 -0
index a940259..8d180e3 100644
@@ -3,6 +3,10 @@ DPDK_17.11 {
 
 	eal_parse_pci_BDF;
 	eal_parse_pci_DomBDF;
+	pci_addr_cmp;
+	pci_bdf_parse;
+	pci_dbdf_parse;
+	pci_device_name;
 	pci_map_resource;
 	pci_unmap_resource;
 	rte_eal_compare_pci_addr;
Signature · 1 line
2.1.4
#85 lore raw

PATCH v5 13/20 pci: introduce PCI address parsing function

In reply to Gaetan Rivet

A new single function that is able to parse all currently supported format:

* Domain-Bus-Device-Function
* Bus-Device-Function

---
 lib/librte_pci/include/rte_pci.h   | 15 +++++++++++++++
 lib/librte_pci/rte_pci.c           | 10 ++++++++++
 lib/librte_pci/rte_pci_version.map |  1 +
 3 files changed, 26 insertions(+)
lib/librte_pci/include/rte_pci.h +15 -0
index 38cbdb3..9e79557 100644
@@ -256,6 +256,21 @@ int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr,
 int pci_addr_cmp(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 pci_addr_parse(const char *str, struct rte_pci_addr *addr);
+
 /**
  * Map a particular resource from a file.
  *
lib/librte_pci/rte_pci.c +10 -0
index fc2fc7f..7ba472c 100644
@@ -171,6 +171,16 @@ pci_addr_cmp(const struct rte_pci_addr *addr,
 		return 0;
 }
 
+int
+pci_addr_parse(const char *str, struct rte_pci_addr *addr)
+{
+	if (pci_bdf_parse(str, addr) == 0 ||
+	    pci_dbdf_parse(str, addr) == 0)
+		return 0;
+	return -1;
+}
+
+
 /* map a particular resource from a file */
 void *
 pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
lib/librte_pci/rte_pci_version.map +1 -0
index 8d180e3..5f50f98 100644
@@ -4,6 +4,7 @@ DPDK_17.11 {
 	eal_parse_pci_BDF;
 	eal_parse_pci_DomBDF;
 	pci_addr_cmp;
+	pci_addr_parse;
 	pci_bdf_parse;
 	pci_dbdf_parse;
 	pci_device_name;
Signature · 1 line
2.1.4
#86 lore raw

PATCH v5 14/20 pci: make specialized parsing functions private

In reply to Gaetan Rivet

Do not expose the minute implementations of PCI parsing. This leaves only the all-purpose pci_addr_parse, which is simpler to use.

---
 lib/librte_pci/include/rte_pci.h   | 29 -----------------------------
 lib/librte_pci/rte_pci.c           | 28 ++++++++++++++--------------
 lib/librte_pci/rte_pci_version.map |  2 --
 3 files changed, 14 insertions(+), 45 deletions(-)
lib/librte_pci/include/rte_pci.h +0 -29
index 9e79557..ea0897c 100644
@@ -151,21 +151,6 @@ TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
 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 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 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 including
@@ -181,20 +166,6 @@ int pci_bdf_parse(const char *input, struct rte_pci_addr *dev_addr);
 int eal_parse_pci_DomBDF(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 pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr);
-
-/**
  * @deprecated
  * Utility function to write a pci device name, this device name can later be
  * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_*
lib/librte_pci/rte_pci.c +14 -14
index 7ba472c..1307a18 100644
@@ -70,13 +70,7 @@ get_u8_pciaddr_field(const char *in, void *_u8, char dlm)
 	return end + 1;
 }
 
-int
-eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
-{
-	return pci_bdf_parse(input, dev_addr);
-}
-
-int
+static int
 pci_bdf_parse(const char *input, struct rte_pci_addr *dev_addr)
 {
 	const char *in = input;
@@ -94,13 +88,7 @@ pci_bdf_parse(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 pci_dbdf_parse(input, dev_addr);
-}
-
-int
+static int
 pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr)
 {
 	const char *in = input;
@@ -125,6 +113,18 @@ pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr)
 	return 0;
 }
 
+int
+eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr)
+{
+	return pci_bdf_parse(input, dev_addr);
+}
+
+int
+eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr)
+{
+	return pci_dbdf_parse(input, dev_addr);
+}
+
 void
 rte_pci_device_name(const struct rte_pci_addr *addr,
 		    char *output, size_t size)
lib/librte_pci/rte_pci_version.map +0 -2
index 5f50f98..b5c9ec2 100644
@@ -5,8 +5,6 @@ DPDK_17.11 {
 	eal_parse_pci_DomBDF;
 	pci_addr_cmp;
 	pci_addr_parse;
-	pci_bdf_parse;
-	pci_dbdf_parse;
 	pci_device_name;
 	pci_map_resource;
 	pci_unmap_resource;
Signature · 1 line
2.1.4
#87 lore raw

PATCH v5 15/20 bus/pci: use new PCI addr parsing function

In reply to Gaetan Rivet
---
 drivers/bus/pci/pci_common.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/bus/pci/pci_common.c +1 -2
index cd95d1a..d7a1c05 100644
@@ -437,8 +437,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 = (pci_addr_parse(name, &pci_addr) == 0);
 	if (parse && addr != NULL)
 		*out = pci_addr;
 	return parse == false;
Signature · 1 line
2.1.4
#88 lore raw

PATCH v5 16/20 bus/pci: do not expose private functions

In reply to Gaetan Rivet

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

---
 drivers/bus/pci/include/rte_bus_pci.h   | 49 ---------------------------------
 drivers/bus/pci/private.h               | 49 +++++++++++++++++++++++++++++++++
 drivers/bus/pci/rte_bus_pci_version.map |  4 ---
 3 files changed, 49 insertions(+), 53 deletions(-)
drivers/bus/pci/include/rte_bus_pci.h +0 -49
index e6a7998..d188353 100644
@@ -170,25 +170,6 @@ struct rte_pci_bus {
 /** Device driver supports IOVA as VA */
 #define RTE_PCI_DRV_IOVA_AS_VA 0X0040
 
-/**
- * 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 PCI bus
- *
- * @return
- *   - 0 on success.
- *   - !0 on error.
- */
-int
-rte_pci_probe(void);
-
 /*
  * Match the PCI Driver and Device using the ID Table
  *
@@ -242,36 +223,6 @@ int rte_pci_map_device(struct rte_pci_device *dev);
 void rte_pci_unmap_device(struct rte_pci_device *dev);
 
 /**
- * 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);
-
-/**
  * Dump the content of the PCI bus.
  *
  * @param f
drivers/bus/pci/private.h +49 -0

55 lines not on this page · raw message

drivers/bus/pci/rte_bus_pci_version.map +0 -4
index c1973f6..ee67033 100644
@@ -1,18 +1,14 @@
 DPDK_17.11 {
 	global:
 
-	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
#89 lore raw

PATCH v5 17/20 bus/pci: do not expose PCI match function

In reply to Gaetan Rivet

This function is private to the PCI bus.

---
 drivers/bus/pci/include/rte_bus_pci.h           | 16 ----------------
 drivers/bus/pci/private.h                       | 15 +++++++++++++++
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  1 -
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 -
 4 files changed, 15 insertions(+), 18 deletions(-)
drivers/bus/pci/include/rte_bus_pci.h +0 -16
index d188353..f0a3b37 100644
@@ -170,22 +170,6 @@ struct rte_pci_bus {
 /** Device driver supports IOVA as VA */
 #define RTE_PCI_DRV_IOVA_AS_VA 0X0040
 
-/*
- * 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.
drivers/bus/pci/private.h +15 -0
index 455c81d..b91217b 100644
@@ -220,4 +220,19 @@ 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);
+
 #endif /* _PCI_PRIVATE_H_ */
lib/librte_eal/bsdapp/eal/rte_eal_version.map +0 -1
index 97b3918..1c18ca5 100644
@@ -229,6 +229,5 @@ DPDK_17.11 {
 	rte_eal_mbuf_default_mempool_ops;
 	rte_lcore_has_role;
 	rte_pci_get_iommu_class;
-	rte_pci_match;
 
 } DPDK_17.08;
lib/librte_eal/linuxapp/eal/rte_eal_version.map +0 -1
index a8ea4ea..827bcd4 100644
@@ -233,6 +233,5 @@ DPDK_17.11 {
 	rte_eal_mbuf_default_mempool_ops;
 	rte_lcore_has_role;
 	rte_pci_get_iommu_class;
-	rte_pci_match;
 
 } DPDK_17.08;
Signature · 1 line
2.1.4
#90 lore raw

PATCH v5 18/20 bus/pci: do not expose IOVA mode getter

In reply to Gaetan Rivet
---
 drivers/bus/pci/private.h                       | 10 ++++++++++
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  1 -
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 -
 3 files changed, 10 insertions(+), 2 deletions(-)
drivers/bus/pci/private.h +10 -0
index b91217b..2283f09 100644
@@ -235,4 +235,14 @@ 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.
+ *
+ * @return
+ *   - enum rte_iova_mode.
+ */
+enum rte_iova_mode
+rte_pci_get_iommu_class(void);
+
 #endif /* _PCI_PRIVATE_H_ */
lib/librte_eal/bsdapp/eal/rte_eal_version.map +0 -1
index 1c18ca5..1d879a1 100644
@@ -228,6 +228,5 @@ DPDK_17.11 {
 	rte_eal_iova_mode;
 	rte_eal_mbuf_default_mempool_ops;
 	rte_lcore_has_role;
-	rte_pci_get_iommu_class;
 
 } DPDK_17.08;
lib/librte_eal/linuxapp/eal/rte_eal_version.map +0 -1
index 827bcd4..1334433 100644
@@ -232,6 +232,5 @@ DPDK_17.11 {
 	rte_eal_iova_mode;
 	rte_eal_mbuf_default_mempool_ops;
 	rte_lcore_has_role;
-	rte_pci_get_iommu_class;
 
 } DPDK_17.08;
Signature · 1 line
2.1.4
#91 lore raw

Re: [PATCH v5 18/20] bus/pci: do not expose IOVA mode getter

Quoted 15 lines · Gaetan Rivet
---
 drivers/bus/pci/private.h                       | 10 ++++++++++
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  1 -
 lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 -
 3 files changed, 10 insertions(+), 2 deletions(-)
drivers/bus/pci/private.h +0 -0
index b91217b..2283f09 100644
@@ -235,4 +235,14 @@ int
 rte_pci_match(const struct rte_pci_driver *pci_drv,
 	      const struct rte_pci_device *pci_dev);
 

drivers/bus/pci/private.h int · line 247

Quoted 10 lines
drivers/bus/pci/private.h +10 -0
+/**
+ * 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);
+

Made a mistake here while rebasing.
The function declaration should be removed from

drivers/bus/pci/include/rte_bus_pci.h

as well.

Quoted 26 lines
drivers/bus/pci/private.h +0 -0
 #endif /* _PCI_PRIVATE_H_ */
lib/librte_eal/bsdapp/eal/rte_eal_version.map +0 -1
index 1c18ca5..1d879a1 100644
@@ -228,6 +228,5 @@ DPDK_17.11 {
 	rte_eal_iova_mode;
 	rte_eal_mbuf_default_mempool_ops;
 	rte_lcore_has_role;
-	rte_pci_get_iommu_class;
 
 } DPDK_17.08;
lib/librte_eal/linuxapp/eal/rte_eal_version.map +0 -1
index 827bcd4..1334433 100644
@@ -232,6 +232,5 @@ DPDK_17.11 {
 	rte_eal_iova_mode;
 	rte_eal_mbuf_default_mempool_ops;
 	rte_lcore_has_role;
-	rte_pci_get_iommu_class;
 
 } DPDK_17.08;
Signature · 1 line
2.1.4
Signature · 2 lines
Gaëtan Rivet
6WIND
#92 lore raw

PATCH v5 19/20 doc: add notes on EAL PCI API update

In reply to Gaetan Rivet

Add 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
index 63b9869..ed3d6d8 100644
@@ -232,6 +232,34 @@ API Changes
   By this way PMDs can return an error value in case of failure at stats
   getting process time.
 
+* **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
#93 lore raw

PATCH v5 20/20 bus: rename scan policy as probe policy

In reply to Gaetan Rivet

This bus configuration item is misnamed, as it actually refers to the probing process.

---
 drivers/bus/pci/pci_common.c               |  2 +-
 lib/librte_eal/common/eal_common_devargs.c |  6 +++---
 lib/librte_eal/common/include/rte_bus.h    | 12 ++++++------
 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/bus/pci/pci_common.c +1 -1
index d7a1c05..cc23a39 100644
@@ -373,7 +373,7 @@ rte_pci_probe(void)
 	int probe_all = 0;
 	int ret = 0;
 
-	if (rte_pci_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST)
+	if (rte_pci_bus.bus.conf.probe_mode != RTE_BUS_PROBE_WHITELIST)
 		probe_all = 1;
 
 	FOREACH_DEVICE_ON_PCIBUS(dev) {
lib/librte_eal/common/eal_common_devargs.c +3 -3
index 6ac88d6..f5ef913 100644
@@ -170,11 +170,11 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)
 	bus = devargs->bus;
 	if (devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI)
 		devargs->policy = RTE_DEV_BLACKLISTED;
-	if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
+	if (bus->conf.probe_mode == RTE_BUS_PROBE_UNDEFINED) {
 		if (devargs->policy == RTE_DEV_WHITELISTED)
-			bus->conf.scan_mode = RTE_BUS_SCAN_WHITELIST;
+			bus->conf.probe_mode = RTE_BUS_PROBE_WHITELIST;
 		else if (devargs->policy == RTE_DEV_BLACKLISTED)
-			bus->conf.scan_mode = RTE_BUS_SCAN_BLACKLIST;
+			bus->conf.probe_mode = RTE_BUS_PROBE_BLACKLIST;
 	}
 	TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
 	return 0;
lib/librte_eal/common/include/rte_bus.h +6 -6
index 6fb0834..331d954 100644
@@ -168,19 +168,19 @@ typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
 typedef int (*rte_bus_parse_t)(const char *name, void *addr);
 
 /**
- * Bus scan policies
+ * Bus probe policies
  */
-enum rte_bus_scan_mode {
-	RTE_BUS_SCAN_UNDEFINED,
-	RTE_BUS_SCAN_WHITELIST,
-	RTE_BUS_SCAN_BLACKLIST,
+enum rte_bus_probe_mode {
+	RTE_BUS_PROBE_UNDEFINED,
+	RTE_BUS_PROBE_WHITELIST,
+	RTE_BUS_PROBE_BLACKLIST,
 };
 
 /**
  * A structure used to configure bus operations.
  */
 struct rte_bus_conf {
-	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
+	enum rte_bus_probe_mode probe_mode; /**< Probe policy. */
 };
 
 
Signature · 1 line
2.1.4
#94 lore raw

Re: [PATCH v5 20/20] bus: rename scan policy as probe policy

This patch is not part of this series, sorry.
I can send a v6 if necessary, but here simply ignore this patch.

Quoted 75 lines · Gaetan Rivet

This bus configuration item is misnamed, as it actually refers to the probing process.

---
 drivers/bus/pci/pci_common.c               |  2 +-
 lib/librte_eal/common/eal_common_devargs.c |  6 +++---
 lib/librte_eal/common/include/rte_bus.h    | 12 ++++++------
 3 files changed, 10 insertions(+), 10 deletions(-)
drivers/bus/pci/pci_common.c +1 -1
index d7a1c05..cc23a39 100644
@@ -373,7 +373,7 @@ rte_pci_probe(void)
 	int probe_all = 0;
 	int ret = 0;
 
-	if (rte_pci_bus.bus.conf.scan_mode != RTE_BUS_SCAN_WHITELIST)
+	if (rte_pci_bus.bus.conf.probe_mode != RTE_BUS_PROBE_WHITELIST)
 		probe_all = 1;
 
 	FOREACH_DEVICE_ON_PCIBUS(dev) {
lib/librte_eal/common/eal_common_devargs.c +3 -3
index 6ac88d6..f5ef913 100644
@@ -170,11 +170,11 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)
 	bus = devargs->bus;
 	if (devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI)
 		devargs->policy = RTE_DEV_BLACKLISTED;
-	if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
+	if (bus->conf.probe_mode == RTE_BUS_PROBE_UNDEFINED) {
 		if (devargs->policy == RTE_DEV_WHITELISTED)
-			bus->conf.scan_mode = RTE_BUS_SCAN_WHITELIST;
+			bus->conf.probe_mode = RTE_BUS_PROBE_WHITELIST;
 		else if (devargs->policy == RTE_DEV_BLACKLISTED)
-			bus->conf.scan_mode = RTE_BUS_SCAN_BLACKLIST;
+			bus->conf.probe_mode = RTE_BUS_PROBE_BLACKLIST;
 	}
 	TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
 	return 0;
lib/librte_eal/common/include/rte_bus.h +6 -6
index 6fb0834..331d954 100644
@@ -168,19 +168,19 @@ typedef int (*rte_bus_unplug_t)(struct rte_device *dev);
 typedef int (*rte_bus_parse_t)(const char *name, void *addr);
 
 /**
- * Bus scan policies
+ * Bus probe policies
  */
-enum rte_bus_scan_mode {
-	RTE_BUS_SCAN_UNDEFINED,
-	RTE_BUS_SCAN_WHITELIST,
-	RTE_BUS_SCAN_BLACKLIST,
+enum rte_bus_probe_mode {
+	RTE_BUS_PROBE_UNDEFINED,
+	RTE_BUS_PROBE_WHITELIST,
+	RTE_BUS_PROBE_BLACKLIST,
 };
 
 /**
  * A structure used to configure bus operations.
  */
 struct rte_bus_conf {
-	enum rte_bus_scan_mode scan_mode; /**< Scan policy. */
+	enum rte_bus_probe_mode probe_mode; /**< Probe policy. */
 };
 
 
Signature · 1 line
2.1.4
Signature · 2 lines
Gaëtan Rivet
6WIND
#95 lore raw

v7 cover Move PCI away from the EAL

In reply to 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 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/crypto

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

Cc Anatoly Burakov <[email protected]>

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.

This patchset now 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 and add vfio one
vfio: check PCI dependency from within PCI code
vfio: move PCI-related functions 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                                    |   4 +
 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               |  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        |   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         | 573 -----------------
 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       | 130 ++++
 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         |  19 -
 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, 5396 insertions(+), 4565 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
#96 lore raw

PATCH v7 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
index 0b1e928..e91c963 100644
@@ -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
#97 lore raw

PATCH v7 2/25 eal: include debug header in bus source

In reply to Gaetan Rivet

This 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
index 5c63ced..3e022d5 100644
@@ -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
#98 lore raw

PATCH v7 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
index 6e0f85d..9340b6e 100644
@@ -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
#99 lore raw

PATCH v7 4/25 eal: include common header

In reply to Gaetan Rivet

The 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
index b286d90..417850e 100644
@@ -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
#100 lore raw

PATCH v7 5/25 eal: expose rte_eal_using_phys_addrs

In reply to Gaetan Rivet

This 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
index 3614da8..65c96b0 100644
@@ -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
index 9340b6e..80fea24 100644
@@ -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
index c545963..271d2bb 100644
@@ -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
index 187d338..ddf88c5 100644
@@ -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
index 8eb53ab..bcc594d 100644
@@ -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
#101 lore raw

PATCH v7 6/25 eal: expose internal config elements

In reply to Gaetan Rivet

Some 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
index e981721..d54a280 100644
@@ -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
index 4ea2ff4..cc2636c 100644
@@ -47,6 +47,8 @@
 #include <rte_config.h>
 #include <rte_bus.h>
 
+#include <rte_pci_dev_feature_defs.h>
+
 #ifdef __cplusplus
 extern "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
index 02381d0..18a07b0 100644
@@ -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
index bcc594d..9f06d23 100644
@@ -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
#102 lore raw

PATCH v7 7/25 eal: expose vfio symbols

In reply to Gaetan Rivet

The 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;

PCI-related files (either source or private headers) do not rely on private EAL vfio header and only need the public one henceforth. This is preparing moving the PCI bus outside the EAL.

---
 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       | 130 +++++++++++++++++++++++++
 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     |   2 +-
 lib/librte_eal/linuxapp/eal/eal_vfio.c         |   1 +
 lib/librte_eal/linuxapp/eal/eal_vfio.h         |  17 ----
 lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c |   1 +
 lib/librte_eal/rte_eal_version.map             |   5 +
 13 files changed, 187 insertions(+), 22 deletions(-)
 create mode 100644 lib/librte_eal/common/include/rte_vfio.h
drivers/bus/fslmc/fslmc_vfio.h +2 -0
index 5470a41..b442dc0 100644
@@ -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
index 6f5b3f3..64ff811 100644
@@ -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 +130 -0

130 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/eal.c +1 -0
index 18a07b0..bee3bbe 100644
@@ -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
index 3e9ac41..6df63d4 100644
@@ -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
index b4dbf95..8682ee6 100644
@@ -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
index ae2980d..a20783d 100644
@@ -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 -1
index d407c87..d498df6 100644
@@ -44,10 +44,10 @@
 #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_private.h"
 
 /**
lib/librte_eal/linuxapp/eal/eal_vfio.c +1 -0
index 3f56967..5bbcdf9 100644
@@ -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 -17
index 4bab363..3fd433c 100644
@@ -192,27 +192,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 +1 -0
index 537beeb..598df12 100644
@@ -52,6 +52,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/rte_eal_version.map +5 -0
index 9f06d23..262211a 100644
@@ -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
#103 lore raw

PATCH v7 8/25 vfio: remove useless PCI headers and add vfio one

In reply to Gaetan Rivet

PCI headers are not necessary and are making this module dependent on the PCI subsystem.

The internal eal_vfio.h header was necessary however for shared build.

---
 lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c +1 -2
index 598df12..a793e9a 100644
@@ -49,14 +49,13 @@
 #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_thread.h"
+#include "eal_vfio.h"
 
 /**
  * @file
Signature · 1 line
2.1.4
#104 lore raw

PATCH v7 9/25 vfio: check PCI dependency from within PCI code

In reply to Gaetan Rivet

PCI 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
index bee3bbe..91c3712 100644
@@ -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
index 8682ee6..dc65852 100644
@@ -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
#105 lore raw

PATCH v7 10/25 vfio: move PCI-related functions out of vfio header

In reply to Gaetan Rivet

These two declarations are only relevant to PCI operations and should be in a related header.

---
 lib/librte_eal/linuxapp/eal/eal_pci_init.h | 2 ++
 lib/librte_eal/linuxapp/eal/eal_vfio.h     | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
lib/librte_eal/linuxapp/eal/eal_pci_init.h +2 -0
index a20783d..c94ba19 100644
@@ -92,6 +92,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_vfio.h +0 -2
index 3fd433c..0c7b062 100644
@@ -192,8 +192,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