DPDK patches and discussions
 help / color / Atom feed
* [dpdk-dev] [PATCH 0/5] 20.11 announced cleanups
@ 2020-09-14  8:17 David Marchand
  2020-09-14  8:17 ` [dpdk-dev] [PATCH 1/5] bus/pci: switch to private kernel driver enum David Marchand
                   ` (6 more replies)
  0 siblings, 7 replies; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:17 UTC (permalink / raw)
  To: dev

I put those EAL and PCI cleanups as a single series since I intend to
apply them at once with the rte_logs series.

Nothing really hard in this series, but the devil is in the details,
reviews welcome.


-- 
David Marchand

David Marchand (5):
  bus/pci: switch to private kernel driver enum
  pci: move resource mapping to the PCI bus
  mem: drop mapping API workaround
  eal: hide internal device event structure
  bus/pci: remove duplicate declaration

 doc/guides/rel_notes/deprecation.rst    | 18 -------
 doc/guides/rel_notes/release_20_11.rst  | 12 +++++
 drivers/bus/pci/bsd/pci.c               | 19 ++++---
 drivers/bus/pci/linux/pci.c             | 64 +++++++++++------------
 drivers/bus/pci/linux/pci_init.h        |  2 +
 drivers/bus/pci/linux/pci_uio.c         |  5 +-
 drivers/bus/pci/linux/pci_vfio.c        |  4 +-
 drivers/bus/pci/pci_common.c            | 56 +++++++++++++++++---
 drivers/bus/pci/pci_common_uio.c        |  2 +-
 drivers/bus/pci/private.h               | 68 ++++++++++++++++++++++++-
 drivers/bus/pci/rte_bus_pci.h           | 11 +++-
 drivers/bus/pci/windows/pci.c           |  6 +--
 drivers/net/hinic/base/hinic_pmd_hwif.c |  2 +-
 drivers/net/hns3/hns3_ethdev_vf.c       |  4 +-
 drivers/net/liquidio/lio_ethdev.c       |  4 +-
 drivers/net/nfp/nfp_net.c               |  2 +-
 drivers/net/virtio/virtio_pci.c         |  2 +-
 lib/librte_eal/include/rte_dev.h        | 18 -------
 lib/librte_eal/include/rte_eal_paging.h | 10 ----
 lib/librte_eal/linux/eal_dev.c          |  6 +++
 lib/librte_eal/windows/include/rte_os.h |  6 ---
 lib/librte_pci/rte_pci.c                | 42 ---------------
 lib/librte_pci/rte_pci.h                | 66 ------------------------
 lib/librte_pci/rte_pci_version.map      |  2 -
 24 files changed, 201 insertions(+), 230 deletions(-)

-- 
2.23.0


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

* [dpdk-dev] [PATCH 1/5] bus/pci: switch to private kernel driver enum
  2020-09-14  8:17 [dpdk-dev] [PATCH 0/5] 20.11 announced cleanups David Marchand
@ 2020-09-14  8:17 ` David Marchand
  2020-09-14  8:17 ` [dpdk-dev] [PATCH 2/5] pci: move resource mapping to the PCI bus David Marchand
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:17 UTC (permalink / raw)
  To: dev
  Cc: Ray Kinsella, Neil Horman, John McNamara, Marko Kovacevic,
	Ferruh Yigit, Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou,
	Wei Hu (Xavier), Min Hu (Connor),
	Yisen Zhuang, Shijith Thotton, Srisivasubramanian Srinivasan,
	Heinrich Kuhn, Maxime Coquelin, Chenbo Xia, Zhihong Wang

The rte_kernel_driver enum actually only pointed at PCI drivers and is
only used in the PCI subsystem.
Remove it from the generic device API and use a private enum in the PCI
code.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/rel_notes/deprecation.rst    |  4 --
 doc/guides/rel_notes/release_20_11.rst  |  3 ++
 drivers/bus/pci/bsd/pci.c               | 17 ++++---
 drivers/bus/pci/linux/pci.c             | 64 ++++++++++++-------------
 drivers/bus/pci/linux/pci_uio.c         |  2 +-
 drivers/bus/pci/pci_common.c            | 16 +++----
 drivers/bus/pci/rte_bus_pci.h           | 11 ++++-
 drivers/bus/pci/windows/pci.c           |  6 +--
 drivers/net/hinic/base/hinic_pmd_hwif.c |  2 +-
 drivers/net/hns3/hns3_ethdev_vf.c       |  4 +-
 drivers/net/liquidio/lio_ethdev.c       |  4 +-
 drivers/net/nfp/nfp_net.c               |  2 +-
 drivers/net/virtio/virtio_pci.c         |  2 +-
 lib/librte_eal/include/rte_dev.h        | 12 -----
 14 files changed, 72 insertions(+), 77 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index f13248a0fe..d9357fa182 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -124,10 +124,6 @@ Deprecation Notices
   With this removal, there won't be a need for the mentioned workaround which
   will be reverted.
 
-* pci: The ``rte_kernel_driver`` enum defined in rte_dev.h will be made private
-  to the PCI subsystem as it is used only by the PCI bus driver and PCI
-  drivers.
-
 * mbuf: Some fields will be converted to dynamic API in DPDK 20.11
   in order to reserve more space for the dynamic fields, as explained in
   `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 442b201678..bffbe31947 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -87,6 +87,9 @@ API Changes
 * eal: The ``rte_logs`` struct and global symbol was made private
   and is no longer part of the API.
 
+* pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
+  replaced with a private enum in the PCI subsystem.
+
 * ethdev: Removed the ``kdrv`` field in the ethdev ``rte_eth_dev_data``
   structure as it gave no useful abstracted information to the applications.
 
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 6ec27b4b5b..a07fc241fe 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -65,7 +65,7 @@ rte_pci_map_device(struct rte_pci_device *dev)
 
 	/* try mapping the NIC resources */
 	switch (dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		/* map resources for devices that use uio */
 		ret = pci_uio_map_resource(dev);
 		break;
@@ -85,7 +85,7 @@ rte_pci_unmap_device(struct rte_pci_device *dev)
 {
 	/* try unmapping the NIC resources */
 	switch (dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		/* unmap resources for devices that use uio */
 		pci_uio_unmap_resource(dev);
 		break;
@@ -255,7 +255,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	pci_name_set(dev);
 
 	/* FreeBSD has only one pass through driver */
-	dev->kdrv = RTE_KDRV_NIC_UIO;
+	dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
 
 	/* parse resources */
 	switch (conf->pc_hdr & PCIM_HDRTYPE) {
@@ -395,8 +395,7 @@ enum rte_iova_mode
 pci_device_iova_mode(const struct rte_pci_driver *pdrv __rte_unused,
 		     const struct rte_pci_device *pdev)
 {
-	/* Supports only RTE_KDRV_NIC_UIO */
-	if (pdev->kdrv != RTE_KDRV_NIC_UIO)
+	if (pdev->kdrv != RTE_PCI_KDRV_NIC_UIO)
 		RTE_LOG(DEBUG, EAL, "Unsupported kernel driver? Defaulting to IOVA as 'PA'\n");
 
 	return RTE_IOVA_PA;
@@ -548,7 +547,7 @@ rte_pci_ioport_map(struct rte_pci_device *dev, int bar,
 
 	switch (dev->kdrv) {
 #if defined(RTE_ARCH_X86)
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		if (rte_eal_iopl_init() != 0) {
 			RTE_LOG(ERR, EAL, "%s(): insufficient ioport permissions for PCI device %s\n",
 				__func__, dev->name);
@@ -606,7 +605,7 @@ rte_pci_ioport_read(struct rte_pci_ioport *p,
 		void *data, size_t len, off_t offset)
 {
 	switch (p->dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
 	default:
@@ -648,7 +647,7 @@ rte_pci_ioport_write(struct rte_pci_ioport *p,
 		const void *data, size_t len, off_t offset)
 {
 	switch (p->dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
 	default:
@@ -663,7 +662,7 @@ rte_pci_ioport_unmap(struct rte_pci_ioport *p)
 
 	switch (p->dev->kdrv) {
 #if defined(RTE_ARCH_X86)
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		ret = 0;
 		break;
 #endif
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index a2198abf43..bf275947f4 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -68,14 +68,14 @@ rte_pci_map_device(struct rte_pci_device *dev)
 
 	/* try mapping the NIC resources using VFIO if it exists */
 	switch (dev->kdrv) {
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 #ifdef VFIO_PRESENT
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_map_resource(dev);
 #endif
 		break;
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		if (rte_eal_using_phys_addrs()) {
 			/* map resources for devices that use uio */
 			ret = pci_uio_map_resource(dev);
@@ -97,14 +97,14 @@ rte_pci_unmap_device(struct rte_pci_device *dev)
 {
 	/* try unmapping the NIC resources using VFIO if it exists */
 	switch (dev->kdrv) {
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 #ifdef VFIO_PRESENT
 		if (pci_vfio_is_enabled())
 			pci_vfio_unmap_resource(dev);
 #endif
 		break;
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		/* unmap resources for devices that use uio */
 		pci_uio_unmap_resource(dev);
 		break;
@@ -323,15 +323,15 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 
 	if (!ret) {
 		if (!strcmp(driver, "vfio-pci"))
-			dev->kdrv = RTE_KDRV_VFIO;
+			dev->kdrv = RTE_PCI_KDRV_VFIO;
 		else if (!strcmp(driver, "igb_uio"))
-			dev->kdrv = RTE_KDRV_IGB_UIO;
+			dev->kdrv = RTE_PCI_KDRV_IGB_UIO;
 		else if (!strcmp(driver, "uio_pci_generic"))
-			dev->kdrv = RTE_KDRV_UIO_GENERIC;
+			dev->kdrv = RTE_PCI_KDRV_UIO_GENERIC;
 		else
-			dev->kdrv = RTE_KDRV_UNKNOWN;
+			dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 	} else {
-		dev->kdrv = RTE_KDRV_NONE;
+		dev->kdrv = RTE_PCI_KDRV_NONE;
 		return 0;
 	}
 	/* device is valid, add in list (sorted) */
@@ -608,7 +608,7 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv,
 	enum rte_iova_mode iova_mode = RTE_IOVA_DC;
 
 	switch (pdev->kdrv) {
-	case RTE_KDRV_VFIO: {
+	case RTE_PCI_KDRV_VFIO: {
 #ifdef VFIO_PRESENT
 		static int is_vfio_noiommu_enabled = -1;
 
@@ -626,8 +626,8 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv,
 		break;
 	}
 
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		iova_mode = RTE_IOVA_PA;
 		break;
 
@@ -647,11 +647,11 @@ int rte_pci_read_config(const struct rte_pci_device *device,
 	const struct rte_intr_handle *intr_handle = &device->intr_handle;
 
 	switch (device->kdrv) {
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		return pci_uio_read_config(intr_handle, buf, len, offset);
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		return pci_vfio_read_config(intr_handle, buf, len, offset);
 #endif
 	default:
@@ -671,11 +671,11 @@ int rte_pci_write_config(const struct rte_pci_device *device,
 	const struct rte_intr_handle *intr_handle = &device->intr_handle;
 
 	switch (device->kdrv) {
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		return pci_uio_write_config(intr_handle, buf, len, offset);
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		return pci_vfio_write_config(intr_handle, buf, len, offset);
 #endif
 	default:
@@ -760,15 +760,15 @@ rte_pci_ioport_map(struct rte_pci_device *dev, int bar,
 
 	switch (dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_ioport_map(dev, bar, p);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		ret = pci_uio_ioport_map(dev, bar, p);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 #if defined(RTE_ARCH_X86)
 		ret = pci_ioport_map(dev, bar, p);
 #else
@@ -791,14 +791,14 @@ rte_pci_ioport_read(struct rte_pci_ioport *p,
 {
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		pci_vfio_ioport_read(p, data, len, offset);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
 	default:
@@ -812,14 +812,14 @@ rte_pci_ioport_write(struct rte_pci_ioport *p,
 {
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		pci_vfio_ioport_write(p, data, len, offset);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
 	default:
@@ -834,15 +834,15 @@ rte_pci_ioport_unmap(struct rte_pci_ioport *p)
 
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_ioport_unmap(p);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		ret = pci_uio_ioport_unmap(p);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 #if defined(RTE_ARCH_X86)
 		ret = 0;
 #else
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 097dc19225..a354920d5f 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -248,7 +248,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 		goto error;
 	}
 
-	if (dev->kdrv == RTE_KDRV_IGB_UIO)
+	if (dev->kdrv == RTE_PCI_KDRV_IGB_UIO)
 		dev->intr_handle.type = RTE_INTR_HANDLE_UIO;
 	else {
 		dev->intr_handle.type = RTE_INTR_HANDLE_UIO_INTX;
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index a8e5fd52c1..dddf2b2aad 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -465,7 +465,7 @@ pci_hot_unplug_handler(struct rte_device *dev)
 
 	switch (pdev->kdrv) {
 #ifdef HAVE_VFIO_DEV_REQ_INTERFACE
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		/*
 		 * vfio kernel module guaranty the pci device would not be
 		 * deleted until the user space release the resource, so no
@@ -476,9 +476,9 @@ pci_hot_unplug_handler(struct rte_device *dev)
 					       RTE_DEV_EVENT_REMOVE);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_NIC_UIO:
 		/* BARs resource is invalid, remap it to be safe. */
 		ret = pci_uio_remap_resource(pdev);
 		break;
@@ -552,7 +552,7 @@ pci_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
 	 *  In case driver don't provides any specific mapping
 	 *  try fallback to VFIO.
 	 */
-	if (pdev->kdrv == RTE_KDRV_VFIO)
+	if (pdev->kdrv == RTE_PCI_KDRV_VFIO)
 		return rte_vfio_container_dma_map
 				(RTE_VFIO_DEFAULT_CONTAINER_FD, (uintptr_t)addr,
 				 iova, len);
@@ -575,7 +575,7 @@ pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
 	 *  In case driver don't provides any specific mapping
 	 *  try fallback to VFIO.
 	 */
-	if (pdev->kdrv == RTE_KDRV_VFIO)
+	if (pdev->kdrv == RTE_PCI_KDRV_VFIO)
 		return rte_vfio_container_dma_unmap
 				(RTE_VFIO_DEFAULT_CONTAINER_FD, (uintptr_t)addr,
 				 iova, len);
@@ -622,8 +622,8 @@ rte_pci_get_iommu_class(void)
 			iommu_no_va = pci_device_iommu_support_va(dev)
 					? 0 : 1;
 
-		if (dev->kdrv == RTE_KDRV_UNKNOWN ||
-		    dev->kdrv == RTE_KDRV_NONE)
+		if (dev->kdrv == RTE_PCI_KDRV_UNKNOWN ||
+		    dev->kdrv == RTE_PCI_KDRV_NONE)
 			continue;
 		FOREACH_DRIVER_ON_PCIBUS(drv) {
 			enum rte_iova_mode dev_iova_mode;
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 29bea6d70d..ff6f072470 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -51,6 +51,15 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
 
 struct rte_devargs;
 
+enum rte_pci_kernel_driver {
+	RTE_PCI_KDRV_UNKNOWN = 0,
+	RTE_PCI_KDRV_IGB_UIO,
+	RTE_PCI_KDRV_VFIO,
+	RTE_PCI_KDRV_UIO_GENERIC,
+	RTE_PCI_KDRV_NIC_UIO,
+	RTE_PCI_KDRV_NONE,
+};
+
 /**
  * A structure describing a PCI device.
  */
@@ -64,7 +73,7 @@ struct rte_pci_device {
 	struct rte_intr_handle intr_handle; /**< Interrupt handle */
 	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
 	uint16_t max_vfs;                   /**< sriov enable if not zero */
-	enum rte_kernel_driver kdrv;        /**< Kernel driver passthrough */
+	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
 	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
 	struct rte_intr_handle vfio_req_intr_handle;
 				/**< Handler of VFIO request interrupt */
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index c80bd55716..9e5c8fafb0 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -211,7 +211,7 @@ get_device_resource_info(HDEVINFO dev_info,
 	BOOL  res;
 
 	switch (dev->kdrv) {
-	case RTE_KDRV_NONE:
+	case RTE_PCI_KDRV_NONE:
 		/* Get NUMA node using DEVPKEY_Device_Numa_Node */
 		res = SetupDiGetDevicePropertyW(dev_info, dev_info_data,
 			&DEVPKEY_Device_Numa_Node, &property_type,
@@ -223,7 +223,7 @@ get_device_resource_info(HDEVINFO dev_info,
 			return -1;
 		}
 		dev->device.numa_node = numa_node;
-		/* mem_resource - Unneeded for RTE_KDRV_NONE */
+		/* mem_resource - Unneeded for RTE_PCI_KDRV_NONE */
 		dev->mem_resource[0].phys_addr = 0;
 		dev->mem_resource[0].len = 0;
 		dev->mem_resource[0].addr = NULL;
@@ -292,7 +292,7 @@ get_kernel_driver_type(struct rte_pci_device *dev)
 	 * If another kernel driver is supported the relevant checking
 	 * functions should be here
 	 */
-	dev->kdrv = RTE_KDRV_NONE;
+	dev->kdrv = RTE_PCI_KDRV_NONE;
 }
 
 static int
diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c
index d7fc1af707..26fa1e27d4 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwif.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwif.c
@@ -280,7 +280,7 @@ void hinic_set_msix_state(void *hwdev, u16 msix_idx, enum hinic_msix_state flag)
 	/* vfio-pci does not mmap msi-x vector table to user space,
 	 * we can not access the space when kernel driver is vfio-pci
 	 */
-	if (hw->pcidev_hdl->kdrv == RTE_KDRV_VFIO)
+	if (hw->pcidev_hdl->kdrv == RTE_PCI_KDRV_VFIO)
 		return;
 
 	mask_bits = readl(hwif->intr_regs_base + offset);
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 1d2941f0e3..63089d0bd4 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2425,8 +2425,8 @@ hns3vf_reinit_dev(struct hns3_adapter *hns)
 		 * UIO enables msix by writing the pcie configuration space
 		 * vfio_pci enables msix in rte_intr_enable.
 		 */
-		if (pci_dev->kdrv == RTE_KDRV_IGB_UIO ||
-		    pci_dev->kdrv == RTE_KDRV_UIO_GENERIC) {
+		if (pci_dev->kdrv == RTE_PCI_KDRV_IGB_UIO ||
+		    pci_dev->kdrv == RTE_PCI_KDRV_UIO_GENERIC) {
 			if (hns3vf_enable_msix(pci_dev, true))
 				hns3_err(hw, "Failed to enable msix");
 		}
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 2258838c4c..2c2b27e62a 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -1563,7 +1563,7 @@ lio_dev_close(struct rte_eth_dev *eth_dev)
 	/* Reset ioq regs */
 	lio_dev->fn_list.setup_device_regs(lio_dev);
 
-	if (lio_dev->pci_dev->kdrv == RTE_KDRV_IGB_UIO) {
+	if (lio_dev->pci_dev->kdrv == RTE_PCI_KDRV_IGB_UIO) {
 		cn23xx_vf_ask_pf_to_do_flr(lio_dev);
 		rte_delay_ms(LIO_PCI_FLR_WAIT);
 	}
@@ -2012,7 +2012,7 @@ lio_first_time_init(struct lio_device *lio_dev,
 		goto error;
 
 	/* Request and wait for device reset. */
-	if (pdev->kdrv == RTE_KDRV_IGB_UIO) {
+	if (pdev->kdrv == RTE_PCI_KDRV_IGB_UIO) {
 		cn23xx_vf_ask_pf_to_do_flr(lio_dev);
 		/* FLR wait time doubled as a precaution. */
 		rte_delay_ms(LIO_PCI_FLR_WAIT * 2);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 99946279db..1cf949a9ab 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -3614,7 +3614,7 @@ static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	 * interface. Here we avoid this telling to the CPP init code to
 	 * use a lock file if UIO is being used.
 	 */
-	if (dev->kdrv == RTE_KDRV_VFIO)
+	if (dev->kdrv == RTE_PCI_KDRV_VFIO)
 		cpp = nfp_cpp_from_device_name(dev, 0);
 	else
 		cpp = nfp_cpp_from_device_name(dev, 1);
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 29a354bf76..9915eabf68 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -704,7 +704,7 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw)
 	PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
 	if (rte_pci_ioport_map(dev, 0, VTPCI_IO(hw)) < 0) {
 		rte_pci_unmap_device(dev);
-		if (dev->kdrv == RTE_KDRV_UNKNOWN &&
+		if (dev->kdrv == RTE_PCI_KDRV_UNKNOWN &&
 		    (!dev->device.devargs ||
 		     dev->device.devargs->bus !=
 		     rte_bus_find_by_name("pci"))) {
diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
index c8d985fb5c..53c8bc6fab 100644
--- a/lib/librte_eal/include/rte_dev.h
+++ b/lib/librte_eal/include/rte_dev.h
@@ -54,18 +54,6 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 		return; \
 } while (0)
 
-/**
- * Device driver.
- */
-enum rte_kernel_driver {
-	RTE_KDRV_UNKNOWN = 0,
-	RTE_KDRV_IGB_UIO,
-	RTE_KDRV_VFIO,
-	RTE_KDRV_UIO_GENERIC,
-	RTE_KDRV_NIC_UIO,
-	RTE_KDRV_NONE,
-};
-
 /**
  * Device policies.
  */
-- 
2.23.0


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

* [dpdk-dev] [PATCH 2/5] pci: move resource mapping to the PCI bus
  2020-09-14  8:17 [dpdk-dev] [PATCH 0/5] 20.11 announced cleanups David Marchand
  2020-09-14  8:17 ` [dpdk-dev] [PATCH 1/5] bus/pci: switch to private kernel driver enum David Marchand
@ 2020-09-14  8:17 ` David Marchand
  2020-09-14  8:17 ` [dpdk-dev] [PATCH 3/5] mem: drop mapping API workaround David Marchand
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:17 UTC (permalink / raw)
  To: dev
  Cc: Ray Kinsella, Neil Horman, John McNamara, Marko Kovacevic,
	Ferruh Yigit, Gaetan Rivet

As reported during 20.08 work for Windows, the pci_map_resource API was
built with the assumption that its flags would be passed to mmap().

This introduced a regression when adding the rte_mem_map API as reported
in the workaround commit 9d2b24593724 ("pci: keep API compatibility with
mmap values").

This API was only used in the PCI bus code, so move it there.
With this move, there is no other user so no ambiguity anymore: the
passed additional flags are documented as rte_mem_map API flags.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/rel_notes/deprecation.rst   | 11 -----
 doc/guides/rel_notes/release_20_11.rst |  6 +++
 drivers/bus/pci/linux/pci_init.h       |  2 +
 drivers/bus/pci/linux/pci_uio.c        |  1 +
 drivers/bus/pci/pci_common.c           | 41 ++++++++++++++++
 drivers/bus/pci/private.h              | 66 ++++++++++++++++++++++++++
 lib/librte_pci/rte_pci.c               | 42 ----------------
 lib/librte_pci/rte_pci.h               | 66 --------------------------
 lib/librte_pci/rte_pci_version.map     |  2 -
 9 files changed, 116 insertions(+), 121 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index d9357fa182..2c7ae1f51e 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -113,17 +113,6 @@ Deprecation Notices
   us extending existing enum/define.
   One solution can be using a fixed size array instead of ``.*MAX.*`` value.
 
-* pci: The PCI resources map API (``pci_map_resource`` and
-  ``pci_unmap_resource``) was not abstracting the Unix mmap flags (see the
-  workaround for Windows support implemented in the commit
-  9d2b24593724 ("pci: keep API compatibility with mmap values")).
-  This API will be removed from the public API in 20.11 and moved to the PCI
-  bus driver along with the PCI resources lists and associated structures
-  (``pci_map``, ``pci_msix_table``, ``mapped_pci_resource`` and
-  ``mapped_pci_res_list``).
-  With this removal, there won't be a need for the mentioned workaround which
-  will be reverted.
-
 * mbuf: Some fields will be converted to dynamic API in DPDK 20.11
   in order to reserve more space for the dynamic fields, as explained in
   `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index bffbe31947..0f6a557501 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -90,6 +90,12 @@ API Changes
 * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
   replaced with a private enum in the PCI subsystem.
 
+* pci: Removed the PCI resources map API from the public API
+  (``pci_map_resource`` and ``pci_unmap_resource``) and moved it to the
+  PCI bus driver along with the PCI resources lists and associated structures
+  (``pci_map``, ``pci_msix_table``, ``mapped_pci_resource`` and
+  ``mapped_pci_res_list``).
+
 * ethdev: Removed the ``kdrv`` field in the ethdev ``rte_eth_dev_data``
   structure as it gave no useful abstracted information to the applications.
 
diff --git a/drivers/bus/pci/linux/pci_init.h b/drivers/bus/pci/linux/pci_init.h
index c2e603a374..dcea726186 100644
--- a/drivers/bus/pci/linux/pci_init.h
+++ b/drivers/bus/pci/linux/pci_init.h
@@ -7,6 +7,8 @@
 
 #include <rte_vfio.h>
 
+#include "private.h"
+
 /** IO resource type: */
 #define IORESOURCE_IO         0x00000100
 #define IORESOURCE_MEM        0x00000200
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index a354920d5f..9ab20a0b25 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -25,6 +25,7 @@
 
 #include "eal_filesystem.h"
 #include "pci_init.h"
+#include "private.h"
 
 void *pci_map_addr = NULL;
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index dddf2b2aad..3a2ae07958 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -19,6 +19,7 @@
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
+#include <rte_eal_paging.h>
 #include <rte_string_fns.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
@@ -79,6 +80,46 @@ pci_name_set(struct rte_pci_device *dev)
 		dev->device.name = dev->name;
 }
 
+/* map a particular resource from a file */
+void *
+pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
+		 int additional_flags)
+{
+	void *mapaddr;
+
+	/* Map the PCI memory resource of device */
+	mapaddr = rte_mem_map(requested_addr, size,
+		RTE_PROT_READ | RTE_PROT_WRITE,
+		RTE_MAP_SHARED | additional_flags, fd, offset);
+	if (mapaddr == NULL) {
+		RTE_LOG(ERR, EAL,
+			"%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\n",
+			__func__, fd, requested_addr, size,
+			(unsigned long long)offset,
+			rte_strerror(rte_errno), mapaddr);
+		mapaddr = MAP_FAILED; /* API uses mmap error code */
+	} else
+		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
+
+	return mapaddr;
+}
+
+/* unmap a particular resource */
+void
+pci_unmap_resource(void *requested_addr, size_t size)
+{
+	if (requested_addr == NULL)
+		return;
+
+	/* Unmap the PCI memory resource of device */
+	if (rte_mem_unmap(requested_addr, size)) {
+		RTE_LOG(ERR, EAL, "%s(): cannot mem unmap(%p, %#zx): %s\n",
+			__func__, requested_addr, size,
+			rte_strerror(rte_errno));
+	} else
+		RTE_LOG(DEBUG, EAL, "  PCI memory unmapped at %p\n",
+				requested_addr);
+}
 /*
  * Match the PCI Driver and Device using the ID Table
  */
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 367cdd9a65..9617268024 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -81,6 +81,72 @@ void rte_pci_insert_device(struct rte_pci_device *exist_pci_dev,
  */
 int pci_update_device(const struct rte_pci_addr *addr);
 
+/**
+ * A structure describing a PCI mapping.
+ */
+struct pci_map {
+	void *addr;
+	char *path;
+	uint64_t offset;
+	uint64_t size;
+	uint64_t phaddr;
+};
+
+struct pci_msix_table {
+	int bar_index;
+	uint32_t offset;
+	uint32_t size;
+};
+
+/**
+ * A structure describing a mapped PCI resource.
+ * For multi-process we need to reproduce all PCI mappings in secondary
+ * processes, so save them in a tailq.
+ */
+struct mapped_pci_resource {
+	TAILQ_ENTRY(mapped_pci_resource) next;
+
+	struct rte_pci_addr pci_addr;
+	char path[PATH_MAX];
+	int nb_maps;
+	struct pci_map maps[PCI_MAX_RESOURCE];
+	struct pci_msix_table msix_table;
+};
+
+
+/** mapped pci device list */
+TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
+
+/**
+ * Map a particular resource from a file.
+ *
+ * @param requested_addr
+ *      The starting address for the new mapping range.
+ * @param fd
+ *      The file descriptor.
+ * @param offset
+ *      The offset for the mapping range.
+ * @param size
+ *      The size for the mapping range.
+ * @param additional_flags
+ *      The additional rte_mem_map() flags for the mapping range.
+ * @return
+ *   - On success, the function returns a pointer to the mapped area.
+ *   - On error, MAP_FAILED is returned.
+ */
+void *pci_map_resource(void *requested_addr, int fd, off_t offset,
+		size_t size, int additional_flags);
+
+/**
+ * Unmap a particular resource.
+ *
+ * @param requested_addr
+ *      The address for the unmapping range.
+ * @param size
+ *      The size for the unmapping range.
+ */
+void pci_unmap_resource(void *requested_addr, size_t size);
+
 /**
  * Map the PCI resource of a PCI device in virtual memory
  *
diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c
index 1d1cbc75ac..c91be8b167 100644
--- a/lib/librte_pci/rte_pci.c
+++ b/lib/librte_pci/rte_pci.c
@@ -144,45 +144,3 @@ rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr)
 		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,
-		 int additional_flags)
-{
-	void *mapaddr;
-
-	/* Map the PCI memory resource of device */
-	mapaddr = rte_mem_map(requested_addr, size,
-		RTE_PROT_READ | RTE_PROT_WRITE,
-		RTE_MAP_SHARED | additional_flags, fd, offset);
-	if (mapaddr == NULL) {
-		RTE_LOG(ERR, EAL,
-			"%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\n",
-			__func__, fd, requested_addr, size,
-			(unsigned long long)offset,
-			rte_strerror(rte_errno), mapaddr);
-		mapaddr = MAP_FAILED; /* API uses mmap error code */
-	} else
-		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
-
-	return mapaddr;
-}
-
-/* unmap a particular resource */
-void
-pci_unmap_resource(void *requested_addr, size_t size)
-{
-	if (requested_addr == NULL)
-		return;
-
-	/* Unmap the PCI memory resource of device */
-	if (rte_mem_unmap(requested_addr, size)) {
-		RTE_LOG(ERR, EAL, "%s(): cannot mem unmap(%p, %#zx): %s\n",
-			__func__, requested_addr, size,
-			rte_strerror(rte_errno));
-	} else
-		RTE_LOG(DEBUG, EAL, "  PCI memory unmapped at %p\n",
-				requested_addr);
-}
diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h
index a03235da1f..567c8cd68d 100644
--- a/lib/librte_pci/rte_pci.h
+++ b/lib/librte_pci/rte_pci.h
@@ -64,42 +64,6 @@ struct rte_pci_addr {
 #define PCI_ANY_ID (0xffff)
 #define RTE_CLASS_ANY_ID (0xffffff)
 
-/**
- * A structure describing a PCI mapping.
- */
-struct pci_map {
-	void *addr;
-	char *path;
-	uint64_t offset;
-	uint64_t size;
-	uint64_t phaddr;
-};
-
-struct pci_msix_table {
-	int bar_index;
-	uint32_t offset;
-	uint32_t size;
-};
-
-/**
- * A structure describing a mapped PCI resource.
- * For multi-process we need to reproduce all PCI mappings in secondary
- * processes, so save them in a tailq.
- */
-struct mapped_pci_resource {
-	TAILQ_ENTRY(mapped_pci_resource) next;
-
-	struct rte_pci_addr pci_addr;
-	char path[PATH_MAX];
-	int nb_maps;
-	struct pci_map maps[PCI_MAX_RESOURCE];
-	struct pci_msix_table msix_table;
-};
-
-
-/** mapped pci device list */
-TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
-
 /**
  * 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_*
@@ -145,36 +109,6 @@ int rte_pci_addr_cmp(const struct rte_pci_addr *addr,
  */
 int rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr);
 
-/**
- * Map a particular resource from a file.
- *
- * @param requested_addr
- *      The starting address for the new mapping range.
- * @param fd
- *      The file descriptor.
- * @param offset
- *      The offset for the mapping range.
- * @param size
- *      The size for the mapping range.
- * @param additional_flags
- *      The additional flags for the mapping range.
- * @return
- *   - On success, the function returns a pointer to the mapped area.
- *   - On error, MAP_FAILED is returned.
- */
-void *pci_map_resource(void *requested_addr, int fd, off_t offset,
-		size_t size, int additional_flags);
-
-/**
- * Unmap a particular resource.
- *
- * @param requested_addr
- *      The address for the unmapping range.
- * @param size
- *      The size for the unmapping range.
- */
-void pci_unmap_resource(void *requested_addr, size_t size);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_pci/rte_pci_version.map b/lib/librte_pci/rte_pci_version.map
index cd77c9dc9e..1db19a5122 100644
--- a/lib/librte_pci/rte_pci_version.map
+++ b/lib/librte_pci/rte_pci_version.map
@@ -1,8 +1,6 @@
 DPDK_21 {
 	global:
 
-	pci_map_resource;
-	pci_unmap_resource;
 	rte_pci_addr_cmp;
 	rte_pci_addr_parse;
 	rte_pci_device_name;
-- 
2.23.0


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

* [dpdk-dev] [PATCH 3/5] mem: drop mapping API workaround
  2020-09-14  8:17 [dpdk-dev] [PATCH 0/5] 20.11 announced cleanups David Marchand
  2020-09-14  8:17 ` [dpdk-dev] [PATCH 1/5] bus/pci: switch to private kernel driver enum David Marchand
  2020-09-14  8:17 ` [dpdk-dev] [PATCH 2/5] pci: move resource mapping to the PCI bus David Marchand
@ 2020-09-14  8:17 ` David Marchand
  2020-09-14  8:17 ` [dpdk-dev] [PATCH 4/5] eal: hide internal device event structure David Marchand
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:17 UTC (permalink / raw)
  To: dev
  Cc: Ferruh Yigit, Anatoly Burakov, Dmitry Kozlyuk,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam

Now that the pci_map_resource API is private to the PCI bus, we can drop
the compatibility workaround we had implemented in 20.08.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/pci/bsd/pci.c               |  2 +-
 drivers/bus/pci/linux/pci_uio.c         |  2 +-
 drivers/bus/pci/linux/pci_vfio.c        |  4 ++--
 drivers/bus/pci/pci_common.c            |  1 -
 drivers/bus/pci/pci_common_uio.c        |  2 +-
 drivers/bus/pci/private.h               |  2 +-
 lib/librte_eal/include/rte_eal_paging.h | 10 ----------
 lib/librte_eal/windows/include/rte_os.h |  6 ------
 8 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index a07fc241fe..2ed8261349 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -192,7 +192,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	mapaddr = pci_map_resource(NULL, fd, (off_t)offset,
 			(size_t)dev->mem_resource[res_idx].len, 0);
 	close(fd);
-	if (mapaddr == MAP_FAILED)
+	if (mapaddr == NULL)
 		goto error;
 
 	maps[map_idx].phaddr = dev->mem_resource[res_idx].phys_addr;
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 9ab20a0b25..f3305a2f28 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -346,7 +346,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	mapaddr = pci_map_resource(pci_map_addr, fd, 0,
 			(size_t)dev->mem_resource[res_idx].len, 0);
 	close(fd);
-	if (mapaddr == MAP_FAILED)
+	if (mapaddr == NULL)
 		goto error;
 
 	pci_map_addr = RTE_PTR_ADD(mapaddr,
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index c15ed3bade..34b5da80df 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -565,7 +565,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 		}
 
 		/* if there's a second part, try to map it */
-		if (map_addr != MAP_FAILED
+		if (map_addr != NULL
 			&& memreg[1].offset && memreg[1].size) {
 			void *second_addr = RTE_PTR_ADD(bar_addr,
 						(uintptr_t)(memreg[1].offset -
@@ -577,7 +577,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 							RTE_MAP_FORCE_ADDRESS);
 		}
 
-		if (map_addr == NULL || map_addr == MAP_FAILED) {
+		if (map_addr == NULL) {
 			munmap(bar_addr, bar->size);
 			bar_addr = MAP_FAILED;
 			RTE_LOG(ERR, EAL, "Failed to map pci BAR%d\n",
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 3a2ae07958..62d45041bb 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -97,7 +97,6 @@ pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
 			__func__, fd, requested_addr, size,
 			(unsigned long long)offset,
 			rte_strerror(rte_errno), mapaddr);
-		mapaddr = MAP_FAILED; /* API uses mmap error code */
 	} else
 		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
 
diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c
index f4dca9da91..793dfd0a7c 100644
--- a/drivers/bus/pci/pci_common_uio.c
+++ b/drivers/bus/pci/pci_common_uio.c
@@ -58,7 +58,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 					"Cannot mmap device resource file %s to address: %p\n",
 					uio_res->maps[i].path,
 					uio_res->maps[i].addr);
-				if (mapaddr != MAP_FAILED) {
+				if (mapaddr != NULL) {
 					/* unmap addrs correctly mapped */
 					for (j = 0; j < i; j++)
 						pci_unmap_resource(
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 9617268024..530123767b 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -132,7 +132,7 @@ TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
  *      The additional rte_mem_map() flags for the mapping range.
  * @return
  *   - On success, the function returns a pointer to the mapped area.
- *   - On error, MAP_FAILED is returned.
+ *   - On error, NULL is returned.
  */
 void *pci_map_resource(void *requested_addr, int fd, off_t offset,
 		size_t size, int additional_flags);
diff --git a/lib/librte_eal/include/rte_eal_paging.h b/lib/librte_eal/include/rte_eal_paging.h
index 429f896c8c..ed98e70e9e 100644
--- a/lib/librte_eal/include/rte_eal_paging.h
+++ b/lib/librte_eal/include/rte_eal_paging.h
@@ -3,9 +3,6 @@
  */
 
 #include <stdint.h>
-#ifndef RTE_EXEC_ENV_WINDOWS
-#include <sys/mman.h>
-#endif
 
 #include <rte_compat.h>
 
@@ -25,7 +22,6 @@ enum rte_mem_prot {
 
 /** Additional flags for memory mapping. */
 enum rte_map_flags {
-#ifdef RTE_EXEC_ENV_WINDOWS
 	/** Changes to the mapped memory are visible to other processes. */
 	RTE_MAP_SHARED = 1 << 0,
 	/** Mapping is not backed by a regular file. */
@@ -39,12 +35,6 @@ enum rte_map_flags {
 	 * it is not required to do so, thus mapping with this flag may fail.
 	 */
 	RTE_MAP_FORCE_ADDRESS = 1 << 3
-#else /* map mmap flags because they are exposed in pci_map_resource() API */
-	RTE_MAP_SHARED = MAP_SHARED,
-	RTE_MAP_ANONYMOUS = MAP_ANONYMOUS,
-	RTE_MAP_PRIVATE = MAP_PRIVATE,
-	RTE_MAP_FORCE_ADDRESS = MAP_FIXED,
-#endif
 };
 
 /**
diff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h
index 2881bf2224..569ed92d51 100644
--- a/lib/librte_eal/windows/include/rte_os.h
+++ b/lib/librte_eal/windows/include/rte_os.h
@@ -25,12 +25,6 @@ extern "C" {
 #define PATH_MAX _MAX_PATH
 #endif
 
-/* sys/mman.h
- * The syscall mmap does not exist on Windows,
- * but this error code is used in a badly defined DPDK API for PCI mapping.
- */
-#define MAP_FAILED ((void *) -1)
-
 #define sleep(x) Sleep(1000 * (x))
 
 #define strerror_r(a, b, c) strerror_s(b, c, a)
-- 
2.23.0


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

* [dpdk-dev] [PATCH 4/5] eal: hide internal device event structure
  2020-09-14  8:17 [dpdk-dev] [PATCH 0/5] 20.11 announced cleanups David Marchand
                   ` (2 preceding siblings ...)
  2020-09-14  8:17 ` [dpdk-dev] [PATCH 3/5] mem: drop mapping API workaround David Marchand
@ 2020-09-14  8:17 ` David Marchand
  2020-09-14  8:17 ` [dpdk-dev] [PATCH 5/5] bus/pci: remove duplicate declaration David Marchand
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:17 UTC (permalink / raw)
  To: dev
  Cc: Ray Kinsella, Neil Horman, John McNamara, Marko Kovacevic,
	Jianfeng Tan, Jeff Guo

This structure is not used in the public API.

Fixes: a753e53d517b ("eal: add device event monitor framework")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/rel_notes/deprecation.rst   | 3 ---
 doc/guides/rel_notes/release_20_11.rst | 3 +++
 lib/librte_eal/include/rte_dev.h       | 6 ------
 lib/librte_eal/linux/eal_dev.c         | 6 ++++++
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 2c7ae1f51e..3bd3abd7f8 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -70,9 +70,6 @@ Deprecation Notices
 * eal: The function ``rte_eal_remote_launch`` will return new error codes
   after read or write error on the pipe, instead of calling ``rte_panic``.
 
-* eal: The ``rte_dev_event`` structure will be made private to the EAL as no
-  public API makes use of it.
-
 * rte_atomicNN_xxx: These APIs do not take memory order parameter. This does
   not allow for writing optimized code for all the CPU architectures supported
   in DPDK. DPDK will adopt C11 atomic operations semantics and provide wrappers
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 0f6a557501..8397046988 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -87,6 +87,9 @@ API Changes
 * eal: The ``rte_logs`` struct and global symbol was made private
   and is no longer part of the API.
 
+* eal: Made the ``rte_dev_event`` structure private to the EAL as no public API
+  used it.
+
 * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
   replaced with a private enum in the PCI subsystem.
 
diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
index 53c8bc6fab..81905b3ae3 100644
--- a/lib/librte_eal/include/rte_dev.h
+++ b/lib/librte_eal/include/rte_dev.h
@@ -33,12 +33,6 @@ enum rte_dev_event_type {
 	RTE_DEV_EVENT_MAX	/**< max value of this enum */
 };
 
-struct rte_dev_event {
-	enum rte_dev_event_type type;	/**< device event type */
-	int subsystem;			/**< subsystem id */
-	char *devname;			/**< device name */
-};
-
 typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 					enum rte_dev_event_type event,
 					void *cb_arg);
diff --git a/lib/librte_eal/linux/eal_dev.c b/lib/librte_eal/linux/eal_dev.c
index 83c9cd6607..c8dd77c049 100644
--- a/lib/librte_eal/linux/eal_dev.c
+++ b/lib/librte_eal/linux/eal_dev.c
@@ -133,6 +133,12 @@ dev_uev_socket_fd_create(void)
 	return ret;
 }
 
+struct rte_dev_event {
+	enum rte_dev_event_type type;	/**< device event type */
+	int subsystem;			/**< subsystem id */
+	char *devname;			/**< device name */
+};
+
 static int
 dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
 {
-- 
2.23.0


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

* [dpdk-dev] [PATCH 5/5] bus/pci: remove duplicate declaration
  2020-09-14  8:17 [dpdk-dev] [PATCH 0/5] 20.11 announced cleanups David Marchand
                   ` (3 preceding siblings ...)
  2020-09-14  8:17 ` [dpdk-dev] [PATCH 4/5] eal: hide internal device event structure David Marchand
@ 2020-09-14  8:17 ` David Marchand
  2020-09-14  8:23 ` [dpdk-dev] [PATCH v2 0/6] 20.11 announced cleanups David Marchand
  2020-09-17 11:28 ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand
  6 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:17 UTC (permalink / raw)
  To: dev; +Cc: stable, Stephen Hemminger, Gaetan Rivet, Thomas Monjalon

This declaration is the same as the one a few lines before.

Fixes: 6844d146ff39 ("eal: add bus pointer in device structure")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/pci/private.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 530123767b..9aa7e67c73 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -15,8 +15,6 @@ extern struct rte_pci_bus rte_pci_bus;
 struct rte_pci_driver;
 struct rte_pci_device;
 
-extern struct rte_pci_bus rte_pci_bus;
-
 /**
  * Scan the content of the PCI bus, and the devices in the devices
  * list
-- 
2.23.0


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

* [dpdk-dev] [PATCH v2 0/6] 20.11 announced cleanups
  2020-09-14  8:17 [dpdk-dev] [PATCH 0/5] 20.11 announced cleanups David Marchand
                   ` (4 preceding siblings ...)
  2020-09-14  8:17 ` [dpdk-dev] [PATCH 5/5] bus/pci: remove duplicate declaration David Marchand
@ 2020-09-14  8:23 ` David Marchand
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 1/6] ethdev: remove unused kernel driver field David Marchand
                     ` (5 more replies)
  2020-09-17 11:28 ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand
  6 siblings, 6 replies; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:23 UTC (permalink / raw)
  To: dev

I put those EAL and PCI cleanups as a single series since I intend to
apply them at once with the rte_logs series.

Nothing really hard in this series, but the devil is in the details,
reviews welcome.


-- 
David Marchand

Changelog since v1:
- added missing first patch, I suspect this will be a long week...

David Marchand (6):
  ethdev: remove unused kernel driver field
  bus/pci: switch to private kernel driver enum
  pci: move resource mapping to the PCI bus
  mem: drop mapping API workaround
  eal: hide internal device event structure
  bus/pci: remove duplicate declaration

 doc/guides/rel_notes/deprecation.rst    | 21 --------
 doc/guides/rel_notes/release_20_11.rst  | 15 ++++++
 drivers/bus/pci/bsd/pci.c               | 19 ++++---
 drivers/bus/pci/linux/pci.c             | 64 +++++++++++------------
 drivers/bus/pci/linux/pci_init.h        |  2 +
 drivers/bus/pci/linux/pci_uio.c         |  5 +-
 drivers/bus/pci/linux/pci_vfio.c        |  4 +-
 drivers/bus/pci/pci_common.c            | 56 +++++++++++++++++---
 drivers/bus/pci/pci_common_uio.c        |  2 +-
 drivers/bus/pci/private.h               | 68 ++++++++++++++++++++++++-
 drivers/bus/pci/rte_bus_pci.h           | 11 +++-
 drivers/bus/pci/windows/pci.c           |  6 +--
 drivers/net/hinic/base/hinic_pmd_hwif.c |  2 +-
 drivers/net/hns3/hns3_ethdev_vf.c       |  4 +-
 drivers/net/liquidio/lio_ethdev.c       |  4 +-
 drivers/net/mvneta/mvneta_ethdev.c      |  1 -
 drivers/net/mvpp2/mrvl_ethdev.c         |  1 -
 drivers/net/nfp/nfp_net.c               |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c  |  1 -
 drivers/net/ring/rte_eth_ring.c         |  1 -
 drivers/net/softnic/rte_eth_softnic.c   |  1 -
 drivers/net/virtio/virtio_pci.c         |  2 +-
 lib/librte_eal/include/rte_dev.h        | 18 -------
 lib/librte_eal/include/rte_eal_paging.h | 10 ----
 lib/librte_eal/linux/eal_dev.c          |  6 +++
 lib/librte_eal/windows/include/rte_os.h |  6 ---
 lib/librte_ethdev/rte_ethdev_core.h     |  1 -
 lib/librte_ethdev/rte_ethdev_pci.h      |  1 -
 lib/librte_ethdev/rte_ethdev_vdev.h     |  1 -
 lib/librte_pci/rte_pci.c                | 42 ---------------
 lib/librte_pci/rte_pci.h                | 66 ------------------------
 lib/librte_pci/rte_pci_version.map      |  2 -
 32 files changed, 204 insertions(+), 241 deletions(-)

-- 
2.23.0


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

* [dpdk-dev] [PATCH v2 1/6] ethdev: remove unused kernel driver field
  2020-09-14  8:23 ` [dpdk-dev] [PATCH v2 0/6] 20.11 announced cleanups David Marchand
@ 2020-09-14  8:23   ` David Marchand
  2020-09-14 10:14     ` Andrew Rybchenko
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 2/6] bus/pci: switch to private kernel driver enum David Marchand
                     ` (4 subsequent siblings)
  5 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:23 UTC (permalink / raw)
  To: dev
  Cc: Ray Kinsella, Neil Horman, John McNamara, Marko Kovacevic,
	Zyta Szpak, Liron Himi, Harman Kalra, Bruce Richardson,
	Jasvinder Singh, Cristian Dumitrescu, Thomas Monjalon,
	Ferruh Yigit, Andrew Rybchenko

This field was not generic as it was filled with PCI kernel drivers only.
It has no known in-tree user (and I could not find opensource projects
using it).

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/rel_notes/deprecation.rst   | 3 ---
 doc/guides/rel_notes/release_20_11.rst | 3 +++
 drivers/net/mvneta/mvneta_ethdev.c     | 1 -
 drivers/net/mvpp2/mrvl_ethdev.c        | 1 -
 drivers/net/octeontx/octeontx_ethdev.c | 1 -
 drivers/net/ring/rte_eth_ring.c        | 1 -
 drivers/net/softnic/rte_eth_softnic.c  | 1 -
 lib/librte_ethdev/rte_ethdev_core.h    | 1 -
 lib/librte_ethdev/rte_ethdev_pci.h     | 1 -
 lib/librte_ethdev/rte_ethdev_vdev.h    | 1 -
 10 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 64d588d7e0..f13248a0fe 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -127,9 +127,6 @@ Deprecation Notices
 * pci: The ``rte_kernel_driver`` enum defined in rte_dev.h will be made private
   to the PCI subsystem as it is used only by the PCI bus driver and PCI
   drivers.
-  The associated field ``kdrv`` in the ethdev ``rte_eth_dev_data`` structure
-  will be removed as it gave no useful abstracted information to the
-  applications and had no user (neither internal nor external).
 
 * mbuf: Some fields will be converted to dynamic API in DPDK 20.11
   in order to reserve more space for the dynamic fields, as explained in
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 5d5be0065a..442b201678 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -87,6 +87,9 @@ API Changes
 * eal: The ``rte_logs`` struct and global symbol was made private
   and is no longer part of the API.
 
+* ethdev: Removed the ``kdrv`` field in the ethdev ``rte_eth_dev_data``
+  structure as it gave no useful abstracted information to the applications.
+
 * rawdev: Added a structure size parameter to the functions
   ``rte_rawdev_queue_setup()``, ``rte_rawdev_queue_conf_get()``,
   ``rte_rawdev_info_get()`` and ``rte_rawdev_configure()``,
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index 673a8e2b3a..5bf3ebc4bd 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -827,7 +827,6 @@ mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name)
 	memcpy(eth_dev->data->mac_addrs[0].addr_bytes,
 	       req.ifr_addr.sa_data, RTE_ETHER_ADDR_LEN);
 
-	eth_dev->data->kdrv = RTE_KDRV_NONE;
 	eth_dev->device = &vdev->device;
 	eth_dev->rx_pkt_burst = mvneta_rx_pkt_burst;
 	mvneta_set_tx_function(eth_dev);
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 96b27dfd30..f5e77d07bf 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -2856,7 +2856,6 @@ mrvl_eth_dev_create(struct rte_vdev_device *vdev, const char *name)
 	memcpy(eth_dev->data->mac_addrs[0].addr_bytes,
 	       req.ifr_addr.sa_data, RTE_ETHER_ADDR_LEN);
 
-	eth_dev->data->kdrv = RTE_KDRV_NONE;
 	eth_dev->device = &vdev->device;
 	eth_dev->rx_pkt_burst = mrvl_rx_pkt_burst;
 	mrvl_set_tx_function(eth_dev);
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 76c69294d0..653ab9b458 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -1363,7 +1363,6 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
 
 	eth_dev->device = &dev->device;
 	eth_dev->intr_handle = NULL;
-	eth_dev->data->kdrv = RTE_KDRV_NONE;
 	eth_dev->data->numa_node = dev->device.numa_node;
 
 	data->port_id = eth_dev->data->port_id;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 733c898259..40fe1ca4ba 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -326,7 +326,6 @@ do_eth_dev_ring_create(const char *name,
 	data->all_multicast = 1;
 
 	eth_dev->dev_ops = &ops;
-	data->kdrv = RTE_KDRV_NONE;
 	data->numa_node = numa_node;
 
 	/* finally assign rx and tx ops */
diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index 866d17a93c..e453fd1486 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -391,7 +391,6 @@ pmd_ethdev_register(struct rte_vdev_device *vdev,
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
 	dev->data->mac_addrs = &eth_addr;
 	dev->data->promiscuous = 1;
-	dev->data->kdrv = RTE_KDRV_NONE;
 	dev->data->numa_node = params->cpu_id;
 
 	rte_eth_dev_probing_finish(dev);
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 32407dd418..78c7902897 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -866,7 +866,6 @@ struct rte_eth_dev_data {
 	uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
 		/**< Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0). */
 	uint32_t dev_flags;             /**< Capabilities. */
-	enum rte_kernel_driver kdrv;    /**< Kernel driver passthrough. */
 	int numa_node;                  /**< NUMA node connection. */
 	struct rte_vlan_filter_conf vlan_filter_conf;
 			/**< VLAN filter configuration. */
diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h
index a999602fdd..6ac6ea41f5 100644
--- a/lib/librte_ethdev/rte_ethdev_pci.h
+++ b/lib/librte_ethdev/rte_ethdev_pci.h
@@ -67,7 +67,6 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
 		if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_RMV)
 			eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_RMV;
 
-		eth_dev->data->kdrv = pci_dev->kdrv;
 		eth_dev->data->numa_node = pci_dev->device.numa_node;
 	}
 }
diff --git a/lib/librte_ethdev/rte_ethdev_vdev.h b/lib/librte_ethdev/rte_ethdev_vdev.h
index b3ef12398e..64fa689ed3 100644
--- a/lib/librte_ethdev/rte_ethdev_vdev.h
+++ b/lib/librte_ethdev/rte_ethdev_vdev.h
@@ -74,7 +74,6 @@ rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size)
 	eth_dev->device = &dev->device;
 	eth_dev->intr_handle = NULL;
 
-	eth_dev->data->kdrv = RTE_KDRV_NONE;
 	eth_dev->data->numa_node = dev->device.numa_node;
 	return eth_dev;
 }
-- 
2.23.0


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

* [dpdk-dev] [PATCH v2 2/6] bus/pci: switch to private kernel driver enum
  2020-09-14  8:23 ` [dpdk-dev] [PATCH v2 0/6] 20.11 announced cleanups David Marchand
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 1/6] ethdev: remove unused kernel driver field David Marchand
@ 2020-09-14  8:23   ` David Marchand
  2020-09-14 10:19     ` Andrew Rybchenko
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 3/6] pci: move resource mapping to the PCI bus David Marchand
                     ` (3 subsequent siblings)
  5 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:23 UTC (permalink / raw)
  To: dev
  Cc: Ray Kinsella, Neil Horman, John McNamara, Marko Kovacevic,
	Ferruh Yigit, Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou,
	Wei Hu (Xavier), Min Hu (Connor),
	Yisen Zhuang, Shijith Thotton, Srisivasubramanian Srinivasan,
	Heinrich Kuhn, Maxime Coquelin, Chenbo Xia, Zhihong Wang

The rte_kernel_driver enum actually only pointed at PCI drivers and is
only used in the PCI subsystem.
Remove it from the generic device API and use a private enum in the PCI
code.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/rel_notes/deprecation.rst    |  4 --
 doc/guides/rel_notes/release_20_11.rst  |  3 ++
 drivers/bus/pci/bsd/pci.c               | 17 ++++---
 drivers/bus/pci/linux/pci.c             | 64 ++++++++++++-------------
 drivers/bus/pci/linux/pci_uio.c         |  2 +-
 drivers/bus/pci/pci_common.c            | 16 +++----
 drivers/bus/pci/rte_bus_pci.h           | 11 ++++-
 drivers/bus/pci/windows/pci.c           |  6 +--
 drivers/net/hinic/base/hinic_pmd_hwif.c |  2 +-
 drivers/net/hns3/hns3_ethdev_vf.c       |  4 +-
 drivers/net/liquidio/lio_ethdev.c       |  4 +-
 drivers/net/nfp/nfp_net.c               |  2 +-
 drivers/net/virtio/virtio_pci.c         |  2 +-
 lib/librte_eal/include/rte_dev.h        | 12 -----
 14 files changed, 72 insertions(+), 77 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index f13248a0fe..d9357fa182 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -124,10 +124,6 @@ Deprecation Notices
   With this removal, there won't be a need for the mentioned workaround which
   will be reverted.
 
-* pci: The ``rte_kernel_driver`` enum defined in rte_dev.h will be made private
-  to the PCI subsystem as it is used only by the PCI bus driver and PCI
-  drivers.
-
 * mbuf: Some fields will be converted to dynamic API in DPDK 20.11
   in order to reserve more space for the dynamic fields, as explained in
   `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 442b201678..bffbe31947 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -87,6 +87,9 @@ API Changes
 * eal: The ``rte_logs`` struct and global symbol was made private
   and is no longer part of the API.
 
+* pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
+  replaced with a private enum in the PCI subsystem.
+
 * ethdev: Removed the ``kdrv`` field in the ethdev ``rte_eth_dev_data``
   structure as it gave no useful abstracted information to the applications.
 
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 6ec27b4b5b..a07fc241fe 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -65,7 +65,7 @@ rte_pci_map_device(struct rte_pci_device *dev)
 
 	/* try mapping the NIC resources */
 	switch (dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		/* map resources for devices that use uio */
 		ret = pci_uio_map_resource(dev);
 		break;
@@ -85,7 +85,7 @@ rte_pci_unmap_device(struct rte_pci_device *dev)
 {
 	/* try unmapping the NIC resources */
 	switch (dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		/* unmap resources for devices that use uio */
 		pci_uio_unmap_resource(dev);
 		break;
@@ -255,7 +255,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	pci_name_set(dev);
 
 	/* FreeBSD has only one pass through driver */
-	dev->kdrv = RTE_KDRV_NIC_UIO;
+	dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
 
 	/* parse resources */
 	switch (conf->pc_hdr & PCIM_HDRTYPE) {
@@ -395,8 +395,7 @@ enum rte_iova_mode
 pci_device_iova_mode(const struct rte_pci_driver *pdrv __rte_unused,
 		     const struct rte_pci_device *pdev)
 {
-	/* Supports only RTE_KDRV_NIC_UIO */
-	if (pdev->kdrv != RTE_KDRV_NIC_UIO)
+	if (pdev->kdrv != RTE_PCI_KDRV_NIC_UIO)
 		RTE_LOG(DEBUG, EAL, "Unsupported kernel driver? Defaulting to IOVA as 'PA'\n");
 
 	return RTE_IOVA_PA;
@@ -548,7 +547,7 @@ rte_pci_ioport_map(struct rte_pci_device *dev, int bar,
 
 	switch (dev->kdrv) {
 #if defined(RTE_ARCH_X86)
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		if (rte_eal_iopl_init() != 0) {
 			RTE_LOG(ERR, EAL, "%s(): insufficient ioport permissions for PCI device %s\n",
 				__func__, dev->name);
@@ -606,7 +605,7 @@ rte_pci_ioport_read(struct rte_pci_ioport *p,
 		void *data, size_t len, off_t offset)
 {
 	switch (p->dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
 	default:
@@ -648,7 +647,7 @@ rte_pci_ioport_write(struct rte_pci_ioport *p,
 		const void *data, size_t len, off_t offset)
 {
 	switch (p->dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
 	default:
@@ -663,7 +662,7 @@ rte_pci_ioport_unmap(struct rte_pci_ioport *p)
 
 	switch (p->dev->kdrv) {
 #if defined(RTE_ARCH_X86)
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		ret = 0;
 		break;
 #endif
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index a2198abf43..bf275947f4 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -68,14 +68,14 @@ rte_pci_map_device(struct rte_pci_device *dev)
 
 	/* try mapping the NIC resources using VFIO if it exists */
 	switch (dev->kdrv) {
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 #ifdef VFIO_PRESENT
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_map_resource(dev);
 #endif
 		break;
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		if (rte_eal_using_phys_addrs()) {
 			/* map resources for devices that use uio */
 			ret = pci_uio_map_resource(dev);
@@ -97,14 +97,14 @@ rte_pci_unmap_device(struct rte_pci_device *dev)
 {
 	/* try unmapping the NIC resources using VFIO if it exists */
 	switch (dev->kdrv) {
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 #ifdef VFIO_PRESENT
 		if (pci_vfio_is_enabled())
 			pci_vfio_unmap_resource(dev);
 #endif
 		break;
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		/* unmap resources for devices that use uio */
 		pci_uio_unmap_resource(dev);
 		break;
@@ -323,15 +323,15 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 
 	if (!ret) {
 		if (!strcmp(driver, "vfio-pci"))
-			dev->kdrv = RTE_KDRV_VFIO;
+			dev->kdrv = RTE_PCI_KDRV_VFIO;
 		else if (!strcmp(driver, "igb_uio"))
-			dev->kdrv = RTE_KDRV_IGB_UIO;
+			dev->kdrv = RTE_PCI_KDRV_IGB_UIO;
 		else if (!strcmp(driver, "uio_pci_generic"))
-			dev->kdrv = RTE_KDRV_UIO_GENERIC;
+			dev->kdrv = RTE_PCI_KDRV_UIO_GENERIC;
 		else
-			dev->kdrv = RTE_KDRV_UNKNOWN;
+			dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 	} else {
-		dev->kdrv = RTE_KDRV_NONE;
+		dev->kdrv = RTE_PCI_KDRV_NONE;
 		return 0;
 	}
 	/* device is valid, add in list (sorted) */
@@ -608,7 +608,7 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv,
 	enum rte_iova_mode iova_mode = RTE_IOVA_DC;
 
 	switch (pdev->kdrv) {
-	case RTE_KDRV_VFIO: {
+	case RTE_PCI_KDRV_VFIO: {
 #ifdef VFIO_PRESENT
 		static int is_vfio_noiommu_enabled = -1;
 
@@ -626,8 +626,8 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv,
 		break;
 	}
 
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		iova_mode = RTE_IOVA_PA;
 		break;
 
@@ -647,11 +647,11 @@ int rte_pci_read_config(const struct rte_pci_device *device,
 	const struct rte_intr_handle *intr_handle = &device->intr_handle;
 
 	switch (device->kdrv) {
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		return pci_uio_read_config(intr_handle, buf, len, offset);
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		return pci_vfio_read_config(intr_handle, buf, len, offset);
 #endif
 	default:
@@ -671,11 +671,11 @@ int rte_pci_write_config(const struct rte_pci_device *device,
 	const struct rte_intr_handle *intr_handle = &device->intr_handle;
 
 	switch (device->kdrv) {
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		return pci_uio_write_config(intr_handle, buf, len, offset);
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		return pci_vfio_write_config(intr_handle, buf, len, offset);
 #endif
 	default:
@@ -760,15 +760,15 @@ rte_pci_ioport_map(struct rte_pci_device *dev, int bar,
 
 	switch (dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_ioport_map(dev, bar, p);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		ret = pci_uio_ioport_map(dev, bar, p);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 #if defined(RTE_ARCH_X86)
 		ret = pci_ioport_map(dev, bar, p);
 #else
@@ -791,14 +791,14 @@ rte_pci_ioport_read(struct rte_pci_ioport *p,
 {
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		pci_vfio_ioport_read(p, data, len, offset);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
 	default:
@@ -812,14 +812,14 @@ rte_pci_ioport_write(struct rte_pci_ioport *p,
 {
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		pci_vfio_ioport_write(p, data, len, offset);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
 	default:
@@ -834,15 +834,15 @@ rte_pci_ioport_unmap(struct rte_pci_ioport *p)
 
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_ioport_unmap(p);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		ret = pci_uio_ioport_unmap(p);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 #if defined(RTE_ARCH_X86)
 		ret = 0;
 #else
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 097dc19225..a354920d5f 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -248,7 +248,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 		goto error;
 	}
 
-	if (dev->kdrv == RTE_KDRV_IGB_UIO)
+	if (dev->kdrv == RTE_PCI_KDRV_IGB_UIO)
 		dev->intr_handle.type = RTE_INTR_HANDLE_UIO;
 	else {
 		dev->intr_handle.type = RTE_INTR_HANDLE_UIO_INTX;
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index a8e5fd52c1..dddf2b2aad 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -465,7 +465,7 @@ pci_hot_unplug_handler(struct rte_device *dev)
 
 	switch (pdev->kdrv) {
 #ifdef HAVE_VFIO_DEV_REQ_INTERFACE
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		/*
 		 * vfio kernel module guaranty the pci device would not be
 		 * deleted until the user space release the resource, so no
@@ -476,9 +476,9 @@ pci_hot_unplug_handler(struct rte_device *dev)
 					       RTE_DEV_EVENT_REMOVE);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_NIC_UIO:
 		/* BARs resource is invalid, remap it to be safe. */
 		ret = pci_uio_remap_resource(pdev);
 		break;
@@ -552,7 +552,7 @@ pci_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
 	 *  In case driver don't provides any specific mapping
 	 *  try fallback to VFIO.
 	 */
-	if (pdev->kdrv == RTE_KDRV_VFIO)
+	if (pdev->kdrv == RTE_PCI_KDRV_VFIO)
 		return rte_vfio_container_dma_map
 				(RTE_VFIO_DEFAULT_CONTAINER_FD, (uintptr_t)addr,
 				 iova, len);
@@ -575,7 +575,7 @@ pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
 	 *  In case driver don't provides any specific mapping
 	 *  try fallback to VFIO.
 	 */
-	if (pdev->kdrv == RTE_KDRV_VFIO)
+	if (pdev->kdrv == RTE_PCI_KDRV_VFIO)
 		return rte_vfio_container_dma_unmap
 				(RTE_VFIO_DEFAULT_CONTAINER_FD, (uintptr_t)addr,
 				 iova, len);
@@ -622,8 +622,8 @@ rte_pci_get_iommu_class(void)
 			iommu_no_va = pci_device_iommu_support_va(dev)
 					? 0 : 1;
 
-		if (dev->kdrv == RTE_KDRV_UNKNOWN ||
-		    dev->kdrv == RTE_KDRV_NONE)
+		if (dev->kdrv == RTE_PCI_KDRV_UNKNOWN ||
+		    dev->kdrv == RTE_PCI_KDRV_NONE)
 			continue;
 		FOREACH_DRIVER_ON_PCIBUS(drv) {
 			enum rte_iova_mode dev_iova_mode;
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 29bea6d70d..ff6f072470 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -51,6 +51,15 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
 
 struct rte_devargs;
 
+enum rte_pci_kernel_driver {
+	RTE_PCI_KDRV_UNKNOWN = 0,
+	RTE_PCI_KDRV_IGB_UIO,
+	RTE_PCI_KDRV_VFIO,
+	RTE_PCI_KDRV_UIO_GENERIC,
+	RTE_PCI_KDRV_NIC_UIO,
+	RTE_PCI_KDRV_NONE,
+};
+
 /**
  * A structure describing a PCI device.
  */
@@ -64,7 +73,7 @@ struct rte_pci_device {
 	struct rte_intr_handle intr_handle; /**< Interrupt handle */
 	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
 	uint16_t max_vfs;                   /**< sriov enable if not zero */
-	enum rte_kernel_driver kdrv;        /**< Kernel driver passthrough */
+	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
 	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
 	struct rte_intr_handle vfio_req_intr_handle;
 				/**< Handler of VFIO request interrupt */
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index c80bd55716..9e5c8fafb0 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -211,7 +211,7 @@ get_device_resource_info(HDEVINFO dev_info,
 	BOOL  res;
 
 	switch (dev->kdrv) {
-	case RTE_KDRV_NONE:
+	case RTE_PCI_KDRV_NONE:
 		/* Get NUMA node using DEVPKEY_Device_Numa_Node */
 		res = SetupDiGetDevicePropertyW(dev_info, dev_info_data,
 			&DEVPKEY_Device_Numa_Node, &property_type,
@@ -223,7 +223,7 @@ get_device_resource_info(HDEVINFO dev_info,
 			return -1;
 		}
 		dev->device.numa_node = numa_node;
-		/* mem_resource - Unneeded for RTE_KDRV_NONE */
+		/* mem_resource - Unneeded for RTE_PCI_KDRV_NONE */
 		dev->mem_resource[0].phys_addr = 0;
 		dev->mem_resource[0].len = 0;
 		dev->mem_resource[0].addr = NULL;
@@ -292,7 +292,7 @@ get_kernel_driver_type(struct rte_pci_device *dev)
 	 * If another kernel driver is supported the relevant checking
 	 * functions should be here
 	 */
-	dev->kdrv = RTE_KDRV_NONE;
+	dev->kdrv = RTE_PCI_KDRV_NONE;
 }
 
 static int
diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c
index d7fc1af707..26fa1e27d4 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwif.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwif.c
@@ -280,7 +280,7 @@ void hinic_set_msix_state(void *hwdev, u16 msix_idx, enum hinic_msix_state flag)
 	/* vfio-pci does not mmap msi-x vector table to user space,
 	 * we can not access the space when kernel driver is vfio-pci
 	 */
-	if (hw->pcidev_hdl->kdrv == RTE_KDRV_VFIO)
+	if (hw->pcidev_hdl->kdrv == RTE_PCI_KDRV_VFIO)
 		return;
 
 	mask_bits = readl(hwif->intr_regs_base + offset);
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 1d2941f0e3..63089d0bd4 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2425,8 +2425,8 @@ hns3vf_reinit_dev(struct hns3_adapter *hns)
 		 * UIO enables msix by writing the pcie configuration space
 		 * vfio_pci enables msix in rte_intr_enable.
 		 */
-		if (pci_dev->kdrv == RTE_KDRV_IGB_UIO ||
-		    pci_dev->kdrv == RTE_KDRV_UIO_GENERIC) {
+		if (pci_dev->kdrv == RTE_PCI_KDRV_IGB_UIO ||
+		    pci_dev->kdrv == RTE_PCI_KDRV_UIO_GENERIC) {
 			if (hns3vf_enable_msix(pci_dev, true))
 				hns3_err(hw, "Failed to enable msix");
 		}
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 2258838c4c..2c2b27e62a 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -1563,7 +1563,7 @@ lio_dev_close(struct rte_eth_dev *eth_dev)
 	/* Reset ioq regs */
 	lio_dev->fn_list.setup_device_regs(lio_dev);
 
-	if (lio_dev->pci_dev->kdrv == RTE_KDRV_IGB_UIO) {
+	if (lio_dev->pci_dev->kdrv == RTE_PCI_KDRV_IGB_UIO) {
 		cn23xx_vf_ask_pf_to_do_flr(lio_dev);
 		rte_delay_ms(LIO_PCI_FLR_WAIT);
 	}
@@ -2012,7 +2012,7 @@ lio_first_time_init(struct lio_device *lio_dev,
 		goto error;
 
 	/* Request and wait for device reset. */
-	if (pdev->kdrv == RTE_KDRV_IGB_UIO) {
+	if (pdev->kdrv == RTE_PCI_KDRV_IGB_UIO) {
 		cn23xx_vf_ask_pf_to_do_flr(lio_dev);
 		/* FLR wait time doubled as a precaution. */
 		rte_delay_ms(LIO_PCI_FLR_WAIT * 2);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 99946279db..1cf949a9ab 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -3614,7 +3614,7 @@ static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	 * interface. Here we avoid this telling to the CPP init code to
 	 * use a lock file if UIO is being used.
 	 */
-	if (dev->kdrv == RTE_KDRV_VFIO)
+	if (dev->kdrv == RTE_PCI_KDRV_VFIO)
 		cpp = nfp_cpp_from_device_name(dev, 0);
 	else
 		cpp = nfp_cpp_from_device_name(dev, 1);
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 29a354bf76..9915eabf68 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -704,7 +704,7 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw)
 	PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
 	if (rte_pci_ioport_map(dev, 0, VTPCI_IO(hw)) < 0) {
 		rte_pci_unmap_device(dev);
-		if (dev->kdrv == RTE_KDRV_UNKNOWN &&
+		if (dev->kdrv == RTE_PCI_KDRV_UNKNOWN &&
 		    (!dev->device.devargs ||
 		     dev->device.devargs->bus !=
 		     rte_bus_find_by_name("pci"))) {
diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
index c8d985fb5c..53c8bc6fab 100644
--- a/lib/librte_eal/include/rte_dev.h
+++ b/lib/librte_eal/include/rte_dev.h
@@ -54,18 +54,6 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 		return; \
 } while (0)
 
-/**
- * Device driver.
- */
-enum rte_kernel_driver {
-	RTE_KDRV_UNKNOWN = 0,
-	RTE_KDRV_IGB_UIO,
-	RTE_KDRV_VFIO,
-	RTE_KDRV_UIO_GENERIC,
-	RTE_KDRV_NIC_UIO,
-	RTE_KDRV_NONE,
-};
-
 /**
  * Device policies.
  */
-- 
2.23.0


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

* [dpdk-dev] [PATCH v2 3/6] pci: move resource mapping to the PCI bus
  2020-09-14  8:23 ` [dpdk-dev] [PATCH v2 0/6] 20.11 announced cleanups David Marchand
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 1/6] ethdev: remove unused kernel driver field David Marchand
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 2/6] bus/pci: switch to private kernel driver enum David Marchand
@ 2020-09-14  8:23   ` David Marchand
  2020-09-14 10:22     ` Andrew Rybchenko
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 4/6] mem: drop mapping API workaround David Marchand
                     ` (2 subsequent siblings)
  5 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:23 UTC (permalink / raw)
  To: dev
  Cc: Ray Kinsella, Neil Horman, John McNamara, Marko Kovacevic,
	Ferruh Yigit, Gaetan Rivet

As reported during 20.08 work for Windows, the pci_map_resource API was
built with the assumption that its flags would be passed to mmap().

This introduced a regression when adding the rte_mem_map API as reported
in the workaround commit 9d2b24593724 ("pci: keep API compatibility with
mmap values").

This API was only used in the PCI bus code, so move it there.
With this move, there is no other user so no ambiguity anymore: the
passed additional flags are documented as rte_mem_map API flags.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/rel_notes/deprecation.rst   | 11 -----
 doc/guides/rel_notes/release_20_11.rst |  6 +++
 drivers/bus/pci/linux/pci_init.h       |  2 +
 drivers/bus/pci/linux/pci_uio.c        |  1 +
 drivers/bus/pci/pci_common.c           | 41 ++++++++++++++++
 drivers/bus/pci/private.h              | 66 ++++++++++++++++++++++++++
 lib/librte_pci/rte_pci.c               | 42 ----------------
 lib/librte_pci/rte_pci.h               | 66 --------------------------
 lib/librte_pci/rte_pci_version.map     |  2 -
 9 files changed, 116 insertions(+), 121 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index d9357fa182..2c7ae1f51e 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -113,17 +113,6 @@ Deprecation Notices
   us extending existing enum/define.
   One solution can be using a fixed size array instead of ``.*MAX.*`` value.
 
-* pci: The PCI resources map API (``pci_map_resource`` and
-  ``pci_unmap_resource``) was not abstracting the Unix mmap flags (see the
-  workaround for Windows support implemented in the commit
-  9d2b24593724 ("pci: keep API compatibility with mmap values")).
-  This API will be removed from the public API in 20.11 and moved to the PCI
-  bus driver along with the PCI resources lists and associated structures
-  (``pci_map``, ``pci_msix_table``, ``mapped_pci_resource`` and
-  ``mapped_pci_res_list``).
-  With this removal, there won't be a need for the mentioned workaround which
-  will be reverted.
-
 * mbuf: Some fields will be converted to dynamic API in DPDK 20.11
   in order to reserve more space for the dynamic fields, as explained in
   `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index bffbe31947..0f6a557501 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -90,6 +90,12 @@ API Changes
 * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
   replaced with a private enum in the PCI subsystem.
 
+* pci: Removed the PCI resources map API from the public API
+  (``pci_map_resource`` and ``pci_unmap_resource``) and moved it to the
+  PCI bus driver along with the PCI resources lists and associated structures
+  (``pci_map``, ``pci_msix_table``, ``mapped_pci_resource`` and
+  ``mapped_pci_res_list``).
+
 * ethdev: Removed the ``kdrv`` field in the ethdev ``rte_eth_dev_data``
   structure as it gave no useful abstracted information to the applications.
 
diff --git a/drivers/bus/pci/linux/pci_init.h b/drivers/bus/pci/linux/pci_init.h
index c2e603a374..dcea726186 100644
--- a/drivers/bus/pci/linux/pci_init.h
+++ b/drivers/bus/pci/linux/pci_init.h
@@ -7,6 +7,8 @@
 
 #include <rte_vfio.h>
 
+#include "private.h"
+
 /** IO resource type: */
 #define IORESOURCE_IO         0x00000100
 #define IORESOURCE_MEM        0x00000200
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index a354920d5f..9ab20a0b25 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -25,6 +25,7 @@
 
 #include "eal_filesystem.h"
 #include "pci_init.h"
+#include "private.h"
 
 void *pci_map_addr = NULL;
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index dddf2b2aad..3a2ae07958 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -19,6 +19,7 @@
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
+#include <rte_eal_paging.h>
 #include <rte_string_fns.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
@@ -79,6 +80,46 @@ pci_name_set(struct rte_pci_device *dev)
 		dev->device.name = dev->name;
 }
 
+/* map a particular resource from a file */
+void *
+pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
+		 int additional_flags)
+{
+	void *mapaddr;
+
+	/* Map the PCI memory resource of device */
+	mapaddr = rte_mem_map(requested_addr, size,
+		RTE_PROT_READ | RTE_PROT_WRITE,
+		RTE_MAP_SHARED | additional_flags, fd, offset);
+	if (mapaddr == NULL) {
+		RTE_LOG(ERR, EAL,
+			"%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\n",
+			__func__, fd, requested_addr, size,
+			(unsigned long long)offset,
+			rte_strerror(rte_errno), mapaddr);
+		mapaddr = MAP_FAILED; /* API uses mmap error code */
+	} else
+		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
+
+	return mapaddr;
+}
+
+/* unmap a particular resource */
+void
+pci_unmap_resource(void *requested_addr, size_t size)
+{
+	if (requested_addr == NULL)
+		return;
+
+	/* Unmap the PCI memory resource of device */
+	if (rte_mem_unmap(requested_addr, size)) {
+		RTE_LOG(ERR, EAL, "%s(): cannot mem unmap(%p, %#zx): %s\n",
+			__func__, requested_addr, size,
+			rte_strerror(rte_errno));
+	} else
+		RTE_LOG(DEBUG, EAL, "  PCI memory unmapped at %p\n",
+				requested_addr);
+}
 /*
  * Match the PCI Driver and Device using the ID Table
  */
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 367cdd9a65..9617268024 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -81,6 +81,72 @@ void rte_pci_insert_device(struct rte_pci_device *exist_pci_dev,
  */
 int pci_update_device(const struct rte_pci_addr *addr);
 
+/**
+ * A structure describing a PCI mapping.
+ */
+struct pci_map {
+	void *addr;
+	char *path;
+	uint64_t offset;
+	uint64_t size;
+	uint64_t phaddr;
+};
+
+struct pci_msix_table {
+	int bar_index;
+	uint32_t offset;
+	uint32_t size;
+};
+
+/**
+ * A structure describing a mapped PCI resource.
+ * For multi-process we need to reproduce all PCI mappings in secondary
+ * processes, so save them in a tailq.
+ */
+struct mapped_pci_resource {
+	TAILQ_ENTRY(mapped_pci_resource) next;
+
+	struct rte_pci_addr pci_addr;
+	char path[PATH_MAX];
+	int nb_maps;
+	struct pci_map maps[PCI_MAX_RESOURCE];
+	struct pci_msix_table msix_table;
+};
+
+
+/** mapped pci device list */
+TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
+
+/**
+ * Map a particular resource from a file.
+ *
+ * @param requested_addr
+ *      The starting address for the new mapping range.
+ * @param fd
+ *      The file descriptor.
+ * @param offset
+ *      The offset for the mapping range.
+ * @param size
+ *      The size for the mapping range.
+ * @param additional_flags
+ *      The additional rte_mem_map() flags for the mapping range.
+ * @return
+ *   - On success, the function returns a pointer to the mapped area.
+ *   - On error, MAP_FAILED is returned.
+ */
+void *pci_map_resource(void *requested_addr, int fd, off_t offset,
+		size_t size, int additional_flags);
+
+/**
+ * Unmap a particular resource.
+ *
+ * @param requested_addr
+ *      The address for the unmapping range.
+ * @param size
+ *      The size for the unmapping range.
+ */
+void pci_unmap_resource(void *requested_addr, size_t size);
+
 /**
  * Map the PCI resource of a PCI device in virtual memory
  *
diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c
index 1d1cbc75ac..c91be8b167 100644
--- a/lib/librte_pci/rte_pci.c
+++ b/lib/librte_pci/rte_pci.c
@@ -144,45 +144,3 @@ rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr)
 		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,
-		 int additional_flags)
-{
-	void *mapaddr;
-
-	/* Map the PCI memory resource of device */
-	mapaddr = rte_mem_map(requested_addr, size,
-		RTE_PROT_READ | RTE_PROT_WRITE,
-		RTE_MAP_SHARED | additional_flags, fd, offset);
-	if (mapaddr == NULL) {
-		RTE_LOG(ERR, EAL,
-			"%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\n",
-			__func__, fd, requested_addr, size,
-			(unsigned long long)offset,
-			rte_strerror(rte_errno), mapaddr);
-		mapaddr = MAP_FAILED; /* API uses mmap error code */
-	} else
-		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
-
-	return mapaddr;
-}
-
-/* unmap a particular resource */
-void
-pci_unmap_resource(void *requested_addr, size_t size)
-{
-	if (requested_addr == NULL)
-		return;
-
-	/* Unmap the PCI memory resource of device */
-	if (rte_mem_unmap(requested_addr, size)) {
-		RTE_LOG(ERR, EAL, "%s(): cannot mem unmap(%p, %#zx): %s\n",
-			__func__, requested_addr, size,
-			rte_strerror(rte_errno));
-	} else
-		RTE_LOG(DEBUG, EAL, "  PCI memory unmapped at %p\n",
-				requested_addr);
-}
diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h
index a03235da1f..567c8cd68d 100644
--- a/lib/librte_pci/rte_pci.h
+++ b/lib/librte_pci/rte_pci.h
@@ -64,42 +64,6 @@ struct rte_pci_addr {
 #define PCI_ANY_ID (0xffff)
 #define RTE_CLASS_ANY_ID (0xffffff)
 
-/**
- * A structure describing a PCI mapping.
- */
-struct pci_map {
-	void *addr;
-	char *path;
-	uint64_t offset;
-	uint64_t size;
-	uint64_t phaddr;
-};
-
-struct pci_msix_table {
-	int bar_index;
-	uint32_t offset;
-	uint32_t size;
-};
-
-/**
- * A structure describing a mapped PCI resource.
- * For multi-process we need to reproduce all PCI mappings in secondary
- * processes, so save them in a tailq.
- */
-struct mapped_pci_resource {
-	TAILQ_ENTRY(mapped_pci_resource) next;
-
-	struct rte_pci_addr pci_addr;
-	char path[PATH_MAX];
-	int nb_maps;
-	struct pci_map maps[PCI_MAX_RESOURCE];
-	struct pci_msix_table msix_table;
-};
-
-
-/** mapped pci device list */
-TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
-
 /**
  * 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_*
@@ -145,36 +109,6 @@ int rte_pci_addr_cmp(const struct rte_pci_addr *addr,
  */
 int rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr);
 
-/**
- * Map a particular resource from a file.
- *
- * @param requested_addr
- *      The starting address for the new mapping range.
- * @param fd
- *      The file descriptor.
- * @param offset
- *      The offset for the mapping range.
- * @param size
- *      The size for the mapping range.
- * @param additional_flags
- *      The additional flags for the mapping range.
- * @return
- *   - On success, the function returns a pointer to the mapped area.
- *   - On error, MAP_FAILED is returned.
- */
-void *pci_map_resource(void *requested_addr, int fd, off_t offset,
-		size_t size, int additional_flags);
-
-/**
- * Unmap a particular resource.
- *
- * @param requested_addr
- *      The address for the unmapping range.
- * @param size
- *      The size for the unmapping range.
- */
-void pci_unmap_resource(void *requested_addr, size_t size);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_pci/rte_pci_version.map b/lib/librte_pci/rte_pci_version.map
index cd77c9dc9e..1db19a5122 100644
--- a/lib/librte_pci/rte_pci_version.map
+++ b/lib/librte_pci/rte_pci_version.map
@@ -1,8 +1,6 @@
 DPDK_21 {
 	global:
 
-	pci_map_resource;
-	pci_unmap_resource;
 	rte_pci_addr_cmp;
 	rte_pci_addr_parse;
 	rte_pci_device_name;
-- 
2.23.0


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

* [dpdk-dev] [PATCH v2 4/6] mem: drop mapping API workaround
  2020-09-14  8:23 ` [dpdk-dev] [PATCH v2 0/6] 20.11 announced cleanups David Marchand
                     ` (2 preceding siblings ...)
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 3/6] pci: move resource mapping to the PCI bus David Marchand
@ 2020-09-14  8:23   ` David Marchand
  2020-09-14 10:22     ` Andrew Rybchenko
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 5/6] eal: hide internal device event structure David Marchand
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 6/6] bus/pci: remove duplicate declaration David Marchand
  5 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:23 UTC (permalink / raw)
  To: dev
  Cc: Ferruh Yigit, Anatoly Burakov, Dmitry Kozlyuk,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam

Now that the pci_map_resource API is private to the PCI bus, we can drop
the compatibility workaround we had implemented in 20.08.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/pci/bsd/pci.c               |  2 +-
 drivers/bus/pci/linux/pci_uio.c         |  2 +-
 drivers/bus/pci/linux/pci_vfio.c        |  4 ++--
 drivers/bus/pci/pci_common.c            |  1 -
 drivers/bus/pci/pci_common_uio.c        |  2 +-
 drivers/bus/pci/private.h               |  2 +-
 lib/librte_eal/include/rte_eal_paging.h | 10 ----------
 lib/librte_eal/windows/include/rte_os.h |  6 ------
 8 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index a07fc241fe..2ed8261349 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -192,7 +192,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	mapaddr = pci_map_resource(NULL, fd, (off_t)offset,
 			(size_t)dev->mem_resource[res_idx].len, 0);
 	close(fd);
-	if (mapaddr == MAP_FAILED)
+	if (mapaddr == NULL)
 		goto error;
 
 	maps[map_idx].phaddr = dev->mem_resource[res_idx].phys_addr;
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 9ab20a0b25..f3305a2f28 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -346,7 +346,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	mapaddr = pci_map_resource(pci_map_addr, fd, 0,
 			(size_t)dev->mem_resource[res_idx].len, 0);
 	close(fd);
-	if (mapaddr == MAP_FAILED)
+	if (mapaddr == NULL)
 		goto error;
 
 	pci_map_addr = RTE_PTR_ADD(mapaddr,
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index c15ed3bade..34b5da80df 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -565,7 +565,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 		}
 
 		/* if there's a second part, try to map it */
-		if (map_addr != MAP_FAILED
+		if (map_addr != NULL
 			&& memreg[1].offset && memreg[1].size) {
 			void *second_addr = RTE_PTR_ADD(bar_addr,
 						(uintptr_t)(memreg[1].offset -
@@ -577,7 +577,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 							RTE_MAP_FORCE_ADDRESS);
 		}
 
-		if (map_addr == NULL || map_addr == MAP_FAILED) {
+		if (map_addr == NULL) {
 			munmap(bar_addr, bar->size);
 			bar_addr = MAP_FAILED;
 			RTE_LOG(ERR, EAL, "Failed to map pci BAR%d\n",
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 3a2ae07958..62d45041bb 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -97,7 +97,6 @@ pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
 			__func__, fd, requested_addr, size,
 			(unsigned long long)offset,
 			rte_strerror(rte_errno), mapaddr);
-		mapaddr = MAP_FAILED; /* API uses mmap error code */
 	} else
 		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
 
diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c
index f4dca9da91..793dfd0a7c 100644
--- a/drivers/bus/pci/pci_common_uio.c
+++ b/drivers/bus/pci/pci_common_uio.c
@@ -58,7 +58,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 					"Cannot mmap device resource file %s to address: %p\n",
 					uio_res->maps[i].path,
 					uio_res->maps[i].addr);
-				if (mapaddr != MAP_FAILED) {
+				if (mapaddr != NULL) {
 					/* unmap addrs correctly mapped */
 					for (j = 0; j < i; j++)
 						pci_unmap_resource(
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 9617268024..530123767b 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -132,7 +132,7 @@ TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
  *      The additional rte_mem_map() flags for the mapping range.
  * @return
  *   - On success, the function returns a pointer to the mapped area.
- *   - On error, MAP_FAILED is returned.
+ *   - On error, NULL is returned.
  */
 void *pci_map_resource(void *requested_addr, int fd, off_t offset,
 		size_t size, int additional_flags);
diff --git a/lib/librte_eal/include/rte_eal_paging.h b/lib/librte_eal/include/rte_eal_paging.h
index 429f896c8c..ed98e70e9e 100644
--- a/lib/librte_eal/include/rte_eal_paging.h
+++ b/lib/librte_eal/include/rte_eal_paging.h
@@ -3,9 +3,6 @@
  */
 
 #include <stdint.h>
-#ifndef RTE_EXEC_ENV_WINDOWS
-#include <sys/mman.h>
-#endif
 
 #include <rte_compat.h>
 
@@ -25,7 +22,6 @@ enum rte_mem_prot {
 
 /** Additional flags for memory mapping. */
 enum rte_map_flags {
-#ifdef RTE_EXEC_ENV_WINDOWS
 	/** Changes to the mapped memory are visible to other processes. */
 	RTE_MAP_SHARED = 1 << 0,
 	/** Mapping is not backed by a regular file. */
@@ -39,12 +35,6 @@ enum rte_map_flags {
 	 * it is not required to do so, thus mapping with this flag may fail.
 	 */
 	RTE_MAP_FORCE_ADDRESS = 1 << 3
-#else /* map mmap flags because they are exposed in pci_map_resource() API */
-	RTE_MAP_SHARED = MAP_SHARED,
-	RTE_MAP_ANONYMOUS = MAP_ANONYMOUS,
-	RTE_MAP_PRIVATE = MAP_PRIVATE,
-	RTE_MAP_FORCE_ADDRESS = MAP_FIXED,
-#endif
 };
 
 /**
diff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h
index 2881bf2224..569ed92d51 100644
--- a/lib/librte_eal/windows/include/rte_os.h
+++ b/lib/librte_eal/windows/include/rte_os.h
@@ -25,12 +25,6 @@ extern "C" {
 #define PATH_MAX _MAX_PATH
 #endif
 
-/* sys/mman.h
- * The syscall mmap does not exist on Windows,
- * but this error code is used in a badly defined DPDK API for PCI mapping.
- */
-#define MAP_FAILED ((void *) -1)
-
 #define sleep(x) Sleep(1000 * (x))
 
 #define strerror_r(a, b, c) strerror_s(b, c, a)
-- 
2.23.0


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

* [dpdk-dev] [PATCH v2 5/6] eal: hide internal device event structure
  2020-09-14  8:23 ` [dpdk-dev] [PATCH v2 0/6] 20.11 announced cleanups David Marchand
                     ` (3 preceding siblings ...)
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 4/6] mem: drop mapping API workaround David Marchand
@ 2020-09-14  8:23   ` David Marchand
  2020-09-18 14:56     ` Kinsella, Ray
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 6/6] bus/pci: remove duplicate declaration David Marchand
  5 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:23 UTC (permalink / raw)
  To: dev
  Cc: Ray Kinsella, Neil Horman, John McNamara, Marko Kovacevic,
	Jianfeng Tan, Jeff Guo

This structure is not used in the public API.

Fixes: a753e53d517b ("eal: add device event monitor framework")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/rel_notes/deprecation.rst   | 3 ---
 doc/guides/rel_notes/release_20_11.rst | 3 +++
 lib/librte_eal/include/rte_dev.h       | 6 ------
 lib/librte_eal/linux/eal_dev.c         | 6 ++++++
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 2c7ae1f51e..3bd3abd7f8 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -70,9 +70,6 @@ Deprecation Notices
 * eal: The function ``rte_eal_remote_launch`` will return new error codes
   after read or write error on the pipe, instead of calling ``rte_panic``.
 
-* eal: The ``rte_dev_event`` structure will be made private to the EAL as no
-  public API makes use of it.
-
 * rte_atomicNN_xxx: These APIs do not take memory order parameter. This does
   not allow for writing optimized code for all the CPU architectures supported
   in DPDK. DPDK will adopt C11 atomic operations semantics and provide wrappers
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 0f6a557501..8397046988 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -87,6 +87,9 @@ API Changes
 * eal: The ``rte_logs`` struct and global symbol was made private
   and is no longer part of the API.
 
+* eal: Made the ``rte_dev_event`` structure private to the EAL as no public API
+  used it.
+
 * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
   replaced with a private enum in the PCI subsystem.
 
diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
index 53c8bc6fab..81905b3ae3 100644
--- a/lib/librte_eal/include/rte_dev.h
+++ b/lib/librte_eal/include/rte_dev.h
@@ -33,12 +33,6 @@ enum rte_dev_event_type {
 	RTE_DEV_EVENT_MAX	/**< max value of this enum */
 };
 
-struct rte_dev_event {
-	enum rte_dev_event_type type;	/**< device event type */
-	int subsystem;			/**< subsystem id */
-	char *devname;			/**< device name */
-};
-
 typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 					enum rte_dev_event_type event,
 					void *cb_arg);
diff --git a/lib/librte_eal/linux/eal_dev.c b/lib/librte_eal/linux/eal_dev.c
index 83c9cd6607..c8dd77c049 100644
--- a/lib/librte_eal/linux/eal_dev.c
+++ b/lib/librte_eal/linux/eal_dev.c
@@ -133,6 +133,12 @@ dev_uev_socket_fd_create(void)
 	return ret;
 }
 
+struct rte_dev_event {
+	enum rte_dev_event_type type;	/**< device event type */
+	int subsystem;			/**< subsystem id */
+	char *devname;			/**< device name */
+};
+
 static int
 dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
 {
-- 
2.23.0


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

* [dpdk-dev] [PATCH v2 6/6] bus/pci: remove duplicate declaration
  2020-09-14  8:23 ` [dpdk-dev] [PATCH v2 0/6] 20.11 announced cleanups David Marchand
                     ` (4 preceding siblings ...)
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 5/6] eal: hide internal device event structure David Marchand
@ 2020-09-14  8:23   ` David Marchand
  2020-09-14 10:24     ` Andrew Rybchenko
  5 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2020-09-14  8:23 UTC (permalink / raw)
  To: dev; +Cc: stable, Stephen Hemminger, Gaetan Rivet, Thomas Monjalon

This declaration is the same as the one a few lines before.

Fixes: 6844d146ff39 ("eal: add bus pointer in device structure")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/bus/pci/private.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 530123767b..9aa7e67c73 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -15,8 +15,6 @@ extern struct rte_pci_bus rte_pci_bus;
 struct rte_pci_driver;
 struct rte_pci_device;
 
-extern struct rte_pci_bus rte_pci_bus;
-
 /**
  * Scan the content of the PCI bus, and the devices in the devices
  * list
-- 
2.23.0


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

* Re: [dpdk-dev] [PATCH v2 1/6] ethdev: remove unused kernel driver field
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 1/6] ethdev: remove unused kernel driver field David Marchand
@ 2020-09-14 10:14     ` Andrew Rybchenko
  0 siblings, 0 replies; 30+ messages in thread
From: Andrew Rybchenko @ 2020-09-14 10:14 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: Ray Kinsella, Neil Horman, John McNamara, Marko Kovacevic,
	Zyta Szpak, Liron Himi, Harman Kalra, Bruce Richardson,
	Jasvinder Singh, Cristian Dumitrescu, Thomas Monjalon,
	Ferruh Yigit

On 9/14/20 11:23 AM, David Marchand wrote:
> This field was not generic as it was filled with PCI kernel drivers only.
> It has no known in-tree user (and I could not find opensource projects
> using it).
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>


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

* Re: [dpdk-dev] [PATCH v2 2/6] bus/pci: switch to private kernel driver enum
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 2/6] bus/pci: switch to private kernel driver enum David Marchand
@ 2020-09-14 10:19     ` Andrew Rybchenko
  0 siblings, 0 replies; 30+ messages in thread
From: Andrew Rybchenko @ 2020-09-14 10:19 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: Ray Kinsella, Neil Horman, John McNamara, Marko Kovacevic,
	Ferruh Yigit, Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou,
	Wei Hu (Xavier), Min Hu (Connor),
	Yisen Zhuang, Shijith Thotton, Srisivasubramanian Srinivasan,
	Heinrich Kuhn, Maxime Coquelin, Chenbo Xia, Zhihong Wang

On 9/14/20 11:23 AM, David Marchand wrote:
> The rte_kernel_driver enum actually only pointed at PCI drivers and is
> only used in the PCI subsystem.
> Remove it from the generic device API and use a private enum in the PCI
> code.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>


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

* Re: [dpdk-dev] [PATCH v2 3/6] pci: move resource mapping to the PCI bus
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 3/6] pci: move resource mapping to the PCI bus David Marchand
@ 2020-09-14 10:22     ` Andrew Rybchenko
  0 siblings, 0 replies; 30+ messages in thread
From: Andrew Rybchenko @ 2020-09-14 10:22 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: Ray Kinsella, Neil Horman, John McNamara, Marko Kovacevic,
	Ferruh Yigit, Gaetan Rivet

On 9/14/20 11:23 AM, David Marchand wrote:
> As reported during 20.08 work for Windows, the pci_map_resource API was
> built with the assumption that its flags would be passed to mmap().
> 
> This introduced a regression when adding the rte_mem_map API as reported
> in the workaround commit 9d2b24593724 ("pci: keep API compatibility with
> mmap values").
> 
> This API was only used in the PCI bus code, so move it there.
> With this move, there is no other user so no ambiguity anymore: the
> passed additional flags are documented as rte_mem_map API flags.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>

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

* Re: [dpdk-dev] [PATCH v2 4/6] mem: drop mapping API workaround
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 4/6] mem: drop mapping API workaround David Marchand
@ 2020-09-14 10:22     ` Andrew Rybchenko
  0 siblings, 0 replies; 30+ messages in thread
From: Andrew Rybchenko @ 2020-09-14 10:22 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: Ferruh Yigit, Anatoly Burakov, Dmitry Kozlyuk,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam

On 9/14/20 11:23 AM, David Marchand wrote:
> Now that the pci_map_resource API is private to the PCI bus, we can drop
> the compatibility workaround we had implemented in 20.08.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>

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

* Re: [dpdk-dev] [PATCH v2 6/6] bus/pci: remove duplicate declaration
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 6/6] bus/pci: remove duplicate declaration David Marchand
@ 2020-09-14 10:24     ` Andrew Rybchenko
  0 siblings, 0 replies; 30+ messages in thread
From: Andrew Rybchenko @ 2020-09-14 10:24 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: stable, Stephen Hemminger, Gaetan Rivet, Thomas Monjalon

On 9/14/20 11:23 AM, David Marchand wrote:
> This declaration is the same as the one a few lines before.
> 
> Fixes: 6844d146ff39 ("eal: add bus pointer in device structure")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>

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

* [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups
  2020-09-14  8:17 [dpdk-dev] [PATCH 0/5] 20.11 announced cleanups David Marchand
                   ` (5 preceding siblings ...)
  2020-09-14  8:23 ` [dpdk-dev] [PATCH v2 0/6] 20.11 announced cleanups David Marchand
@ 2020-09-17 11:28 ` David Marchand
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 1/6] ethdev: remove unused kernel driver field David Marchand
                     ` (6 more replies)
  6 siblings, 7 replies; 30+ messages in thread
From: David Marchand @ 2020-09-17 11:28 UTC (permalink / raw)
  To: dev; +Cc: arybchenko

I put those EAL and PCI cleanups as a single series since I intend to
apply them at once with the rte_logs series.

Nothing really hard in this series, but the devil is in the details,
reviews welcome.


-- 
David Marchand

Changelog since v2:
- no change: rebased, added acks, reworded patch3 commitlog for Thomas,

Changelog since v1:
- added missing first patch, I suspect this will be a long week...

David Marchand (6):
  ethdev: remove unused kernel driver field
  bus/pci: switch to private kernel driver enum
  pci: move resource mapping to the PCI bus
  mem: drop mapping API workaround
  eal: hide internal device event structure
  bus/pci: remove duplicate declaration

 doc/guides/rel_notes/deprecation.rst    | 21 --------
 doc/guides/rel_notes/release_20_11.rst  | 15 ++++++
 drivers/bus/pci/bsd/pci.c               | 19 ++++---
 drivers/bus/pci/linux/pci.c             | 64 +++++++++++------------
 drivers/bus/pci/linux/pci_init.h        |  2 +
 drivers/bus/pci/linux/pci_uio.c         |  5 +-
 drivers/bus/pci/linux/pci_vfio.c        |  4 +-
 drivers/bus/pci/pci_common.c            | 56 ++++++++++++++++++---
 drivers/bus/pci/pci_common_uio.c        |  2 +-
 drivers/bus/pci/private.h               | 67 ++++++++++++++++++++++++-
 drivers/bus/pci/rte_bus_pci.h           | 11 +++-
 drivers/bus/pci/windows/pci.c           |  6 +--
 drivers/net/hinic/base/hinic_pmd_hwif.c |  2 +-
 drivers/net/hns3/hns3_ethdev_vf.c       |  4 +-
 drivers/net/liquidio/lio_ethdev.c       |  4 +-
 drivers/net/mvneta/mvneta_ethdev.c      |  1 -
 drivers/net/mvpp2/mrvl_ethdev.c         |  1 -
 drivers/net/nfp/nfp_net.c               |  2 +-
 drivers/net/octeontx/octeontx_ethdev.c  |  1 -
 drivers/net/ring/rte_eth_ring.c         |  1 -
 drivers/net/softnic/rte_eth_softnic.c   |  1 -
 drivers/net/virtio/virtio_pci.c         |  2 +-
 lib/librte_eal/include/rte_dev.h        | 18 -------
 lib/librte_eal/include/rte_eal_paging.h | 10 ----
 lib/librte_eal/linux/eal_dev.c          |  6 +++
 lib/librte_eal/windows/include/rte_os.h |  6 ---
 lib/librte_ethdev/rte_ethdev_core.h     |  1 -
 lib/librte_ethdev/rte_ethdev_pci.h      |  1 -
 lib/librte_ethdev/rte_ethdev_vdev.h     |  1 -
 lib/librte_pci/rte_pci.c                | 42 ----------------
 lib/librte_pci/rte_pci.h                | 66 ------------------------
 lib/librte_pci/rte_pci_version.map      |  2 -
 32 files changed, 203 insertions(+), 241 deletions(-)

-- 
2.23.0


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

* [dpdk-dev] [PATCH v3 1/6] ethdev: remove unused kernel driver field
  2020-09-17 11:28 ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand
@ 2020-09-17 11:28   ` David Marchand
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 2/6] bus/pci: switch to private kernel driver enum David Marchand
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2020-09-17 11:28 UTC (permalink / raw)
  To: dev
  Cc: arybchenko, Ray Kinsella, Neil Horman, John McNamara,
	Marko Kovacevic, Zyta Szpak, Liron Himi, Harman Kalra,
	Bruce Richardson, Jasvinder Singh, Cristian Dumitrescu,
	Thomas Monjalon, Ferruh Yigit

This field was not generic as it was filled with PCI kernel drivers only.
It has no known in-tree user (and I could not find opensource projects
using it).

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 doc/guides/rel_notes/deprecation.rst   | 3 ---
 doc/guides/rel_notes/release_20_11.rst | 3 +++
 drivers/net/mvneta/mvneta_ethdev.c     | 1 -
 drivers/net/mvpp2/mrvl_ethdev.c        | 1 -
 drivers/net/octeontx/octeontx_ethdev.c | 1 -
 drivers/net/ring/rte_eth_ring.c        | 1 -
 drivers/net/softnic/rte_eth_softnic.c  | 1 -
 lib/librte_ethdev/rte_ethdev_core.h    | 1 -
 lib/librte_ethdev/rte_ethdev_pci.h     | 1 -
 lib/librte_ethdev/rte_ethdev_vdev.h    | 1 -
 10 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 1f888fa90e..394b55d8ca 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -127,9 +127,6 @@ Deprecation Notices
 * pci: The ``rte_kernel_driver`` enum defined in rte_dev.h will be made private
   to the PCI subsystem as it is used only by the PCI bus driver and PCI
   drivers.
-  The associated field ``kdrv`` in the ethdev ``rte_eth_dev_data`` structure
-  will be removed as it gave no useful abstracted information to the
-  applications and had no user (neither internal nor external).
 
 * mbuf: Some fields will be converted to dynamic API in DPDK 20.11
   in order to reserve more space for the dynamic fields, as explained in
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index cc726095a7..684da5157d 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -91,6 +91,9 @@ API Changes
   the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.
   The field ``refcnt`` is remaining from the old unions.
 
+* ethdev: Removed the ``kdrv`` field in the ethdev ``rte_eth_dev_data``
+  structure as it gave no useful abstracted information to the applications.
+
 * rawdev: Added a structure size parameter to the functions
   ``rte_rawdev_queue_setup()``, ``rte_rawdev_queue_conf_get()``,
   ``rte_rawdev_info_get()`` and ``rte_rawdev_configure()``,
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index 673a8e2b3a..5bf3ebc4bd 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -827,7 +827,6 @@ mvneta_eth_dev_create(struct rte_vdev_device *vdev, const char *name)
 	memcpy(eth_dev->data->mac_addrs[0].addr_bytes,
 	       req.ifr_addr.sa_data, RTE_ETHER_ADDR_LEN);
 
-	eth_dev->data->kdrv = RTE_KDRV_NONE;
 	eth_dev->device = &vdev->device;
 	eth_dev->rx_pkt_burst = mvneta_rx_pkt_burst;
 	mvneta_set_tx_function(eth_dev);
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 96b27dfd30..f5e77d07bf 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -2856,7 +2856,6 @@ mrvl_eth_dev_create(struct rte_vdev_device *vdev, const char *name)
 	memcpy(eth_dev->data->mac_addrs[0].addr_bytes,
 	       req.ifr_addr.sa_data, RTE_ETHER_ADDR_LEN);
 
-	eth_dev->data->kdrv = RTE_KDRV_NONE;
 	eth_dev->device = &vdev->device;
 	eth_dev->rx_pkt_burst = mrvl_rx_pkt_burst;
 	mrvl_set_tx_function(eth_dev);
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index 76c69294d0..653ab9b458 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -1363,7 +1363,6 @@ octeontx_create(struct rte_vdev_device *dev, int port, uint8_t evdev,
 
 	eth_dev->device = &dev->device;
 	eth_dev->intr_handle = NULL;
-	eth_dev->data->kdrv = RTE_KDRV_NONE;
 	eth_dev->data->numa_node = dev->device.numa_node;
 
 	data->port_id = eth_dev->data->port_id;
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 733c898259..40fe1ca4ba 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -326,7 +326,6 @@ do_eth_dev_ring_create(const char *name,
 	data->all_multicast = 1;
 
 	eth_dev->dev_ops = &ops;
-	data->kdrv = RTE_KDRV_NONE;
 	data->numa_node = numa_node;
 
 	/* finally assign rx and tx ops */
diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index 866d17a93c..e453fd1486 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -391,7 +391,6 @@ pmd_ethdev_register(struct rte_vdev_device *vdev,
 	dev->data->dev_link.link_status = ETH_LINK_DOWN;
 	dev->data->mac_addrs = &eth_addr;
 	dev->data->promiscuous = 1;
-	dev->data->kdrv = RTE_KDRV_NONE;
 	dev->data->numa_node = params->cpu_id;
 
 	rte_eth_dev_probing_finish(dev);
diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h
index 32407dd418..78c7902897 100644
--- a/lib/librte_ethdev/rte_ethdev_core.h
+++ b/lib/librte_ethdev/rte_ethdev_core.h
@@ -866,7 +866,6 @@ struct rte_eth_dev_data {
 	uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT];
 		/**< Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0). */
 	uint32_t dev_flags;             /**< Capabilities. */
-	enum rte_kernel_driver kdrv;    /**< Kernel driver passthrough. */
 	int numa_node;                  /**< NUMA node connection. */
 	struct rte_vlan_filter_conf vlan_filter_conf;
 			/**< VLAN filter configuration. */
diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h
index a999602fdd..6ac6ea41f5 100644
--- a/lib/librte_ethdev/rte_ethdev_pci.h
+++ b/lib/librte_ethdev/rte_ethdev_pci.h
@@ -67,7 +67,6 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev,
 		if (pci_dev->driver->drv_flags & RTE_PCI_DRV_INTR_RMV)
 			eth_dev->data->dev_flags |= RTE_ETH_DEV_INTR_RMV;
 
-		eth_dev->data->kdrv = pci_dev->kdrv;
 		eth_dev->data->numa_node = pci_dev->device.numa_node;
 	}
 }
diff --git a/lib/librte_ethdev/rte_ethdev_vdev.h b/lib/librte_ethdev/rte_ethdev_vdev.h
index b3ef12398e..64fa689ed3 100644
--- a/lib/librte_ethdev/rte_ethdev_vdev.h
+++ b/lib/librte_ethdev/rte_ethdev_vdev.h
@@ -74,7 +74,6 @@ rte_eth_vdev_allocate(struct rte_vdev_device *dev, size_t private_data_size)
 	eth_dev->device = &dev->device;
 	eth_dev->intr_handle = NULL;
 
-	eth_dev->data->kdrv = RTE_KDRV_NONE;
 	eth_dev->data->numa_node = dev->device.numa_node;
 	return eth_dev;
 }
-- 
2.23.0


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

* [dpdk-dev] [PATCH v3 2/6] bus/pci: switch to private kernel driver enum
  2020-09-17 11:28 ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 1/6] ethdev: remove unused kernel driver field David Marchand
@ 2020-09-17 11:28   ` David Marchand
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 3/6] pci: move resource mapping to the PCI bus David Marchand
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2020-09-17 11:28 UTC (permalink / raw)
  To: dev
  Cc: arybchenko, Ray Kinsella, Neil Horman, John McNamara,
	Marko Kovacevic, Ferruh Yigit, Ziyang Xuan, Xiaoyun Wang,
	Guoyang Zhou, Wei Hu (Xavier), Min Hu (Connor),
	Yisen Zhuang, Shijith Thotton, Srisivasubramanian Srinivasan,
	Heinrich Kuhn, Maxime Coquelin, Chenbo Xia, Zhihong Wang

The rte_kernel_driver enum actually only pointed at PCI drivers and is
only used in the PCI subsystem.
Remove it from the generic device API and use a private enum in the PCI
code.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 doc/guides/rel_notes/deprecation.rst    |  4 --
 doc/guides/rel_notes/release_20_11.rst  |  3 ++
 drivers/bus/pci/bsd/pci.c               | 17 ++++---
 drivers/bus/pci/linux/pci.c             | 64 ++++++++++++-------------
 drivers/bus/pci/linux/pci_uio.c         |  2 +-
 drivers/bus/pci/pci_common.c            | 16 +++----
 drivers/bus/pci/rte_bus_pci.h           | 11 ++++-
 drivers/bus/pci/windows/pci.c           |  6 +--
 drivers/net/hinic/base/hinic_pmd_hwif.c |  2 +-
 drivers/net/hns3/hns3_ethdev_vf.c       |  4 +-
 drivers/net/liquidio/lio_ethdev.c       |  4 +-
 drivers/net/nfp/nfp_net.c               |  2 +-
 drivers/net/virtio/virtio_pci.c         |  2 +-
 lib/librte_eal/include/rte_dev.h        | 12 -----
 14 files changed, 72 insertions(+), 77 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 394b55d8ca..83ba567632 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -124,10 +124,6 @@ Deprecation Notices
   With this removal, there won't be a need for the mentioned workaround which
   will be reverted.
 
-* pci: The ``rte_kernel_driver`` enum defined in rte_dev.h will be made private
-  to the PCI subsystem as it is used only by the PCI bus driver and PCI
-  drivers.
-
 * mbuf: Some fields will be converted to dynamic API in DPDK 20.11
   in order to reserve more space for the dynamic fields, as explained in
   `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 684da5157d..a76e7a2941 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -87,6 +87,9 @@ API Changes
 * eal: The ``rte_logs`` struct and global symbol was made private
   and is no longer part of the API.
 
+* pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
+  replaced with a private enum in the PCI subsystem.
+
 * mbuf: Removed the unioned field ``refcnt_atomic`` from
   the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.
   The field ``refcnt`` is remaining from the old unions.
diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index 6ec27b4b5b..a07fc241fe 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -65,7 +65,7 @@ rte_pci_map_device(struct rte_pci_device *dev)
 
 	/* try mapping the NIC resources */
 	switch (dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		/* map resources for devices that use uio */
 		ret = pci_uio_map_resource(dev);
 		break;
@@ -85,7 +85,7 @@ rte_pci_unmap_device(struct rte_pci_device *dev)
 {
 	/* try unmapping the NIC resources */
 	switch (dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		/* unmap resources for devices that use uio */
 		pci_uio_unmap_resource(dev);
 		break;
@@ -255,7 +255,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	pci_name_set(dev);
 
 	/* FreeBSD has only one pass through driver */
-	dev->kdrv = RTE_KDRV_NIC_UIO;
+	dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
 
 	/* parse resources */
 	switch (conf->pc_hdr & PCIM_HDRTYPE) {
@@ -395,8 +395,7 @@ enum rte_iova_mode
 pci_device_iova_mode(const struct rte_pci_driver *pdrv __rte_unused,
 		     const struct rte_pci_device *pdev)
 {
-	/* Supports only RTE_KDRV_NIC_UIO */
-	if (pdev->kdrv != RTE_KDRV_NIC_UIO)
+	if (pdev->kdrv != RTE_PCI_KDRV_NIC_UIO)
 		RTE_LOG(DEBUG, EAL, "Unsupported kernel driver? Defaulting to IOVA as 'PA'\n");
 
 	return RTE_IOVA_PA;
@@ -548,7 +547,7 @@ rte_pci_ioport_map(struct rte_pci_device *dev, int bar,
 
 	switch (dev->kdrv) {
 #if defined(RTE_ARCH_X86)
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		if (rte_eal_iopl_init() != 0) {
 			RTE_LOG(ERR, EAL, "%s(): insufficient ioport permissions for PCI device %s\n",
 				__func__, dev->name);
@@ -606,7 +605,7 @@ rte_pci_ioport_read(struct rte_pci_ioport *p,
 		void *data, size_t len, off_t offset)
 {
 	switch (p->dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
 	default:
@@ -648,7 +647,7 @@ rte_pci_ioport_write(struct rte_pci_ioport *p,
 		const void *data, size_t len, off_t offset)
 {
 	switch (p->dev->kdrv) {
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
 	default:
@@ -663,7 +662,7 @@ rte_pci_ioport_unmap(struct rte_pci_ioport *p)
 
 	switch (p->dev->kdrv) {
 #if defined(RTE_ARCH_X86)
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_NIC_UIO:
 		ret = 0;
 		break;
 #endif
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index a2198abf43..bf275947f4 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -68,14 +68,14 @@ rte_pci_map_device(struct rte_pci_device *dev)
 
 	/* try mapping the NIC resources using VFIO if it exists */
 	switch (dev->kdrv) {
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 #ifdef VFIO_PRESENT
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_map_resource(dev);
 #endif
 		break;
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		if (rte_eal_using_phys_addrs()) {
 			/* map resources for devices that use uio */
 			ret = pci_uio_map_resource(dev);
@@ -97,14 +97,14 @@ rte_pci_unmap_device(struct rte_pci_device *dev)
 {
 	/* try unmapping the NIC resources using VFIO if it exists */
 	switch (dev->kdrv) {
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 #ifdef VFIO_PRESENT
 		if (pci_vfio_is_enabled())
 			pci_vfio_unmap_resource(dev);
 #endif
 		break;
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		/* unmap resources for devices that use uio */
 		pci_uio_unmap_resource(dev);
 		break;
@@ -323,15 +323,15 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)
 
 	if (!ret) {
 		if (!strcmp(driver, "vfio-pci"))
-			dev->kdrv = RTE_KDRV_VFIO;
+			dev->kdrv = RTE_PCI_KDRV_VFIO;
 		else if (!strcmp(driver, "igb_uio"))
-			dev->kdrv = RTE_KDRV_IGB_UIO;
+			dev->kdrv = RTE_PCI_KDRV_IGB_UIO;
 		else if (!strcmp(driver, "uio_pci_generic"))
-			dev->kdrv = RTE_KDRV_UIO_GENERIC;
+			dev->kdrv = RTE_PCI_KDRV_UIO_GENERIC;
 		else
-			dev->kdrv = RTE_KDRV_UNKNOWN;
+			dev->kdrv = RTE_PCI_KDRV_UNKNOWN;
 	} else {
-		dev->kdrv = RTE_KDRV_NONE;
+		dev->kdrv = RTE_PCI_KDRV_NONE;
 		return 0;
 	}
 	/* device is valid, add in list (sorted) */
@@ -608,7 +608,7 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv,
 	enum rte_iova_mode iova_mode = RTE_IOVA_DC;
 
 	switch (pdev->kdrv) {
-	case RTE_KDRV_VFIO: {
+	case RTE_PCI_KDRV_VFIO: {
 #ifdef VFIO_PRESENT
 		static int is_vfio_noiommu_enabled = -1;
 
@@ -626,8 +626,8 @@ pci_device_iova_mode(const struct rte_pci_driver *pdrv,
 		break;
 	}
 
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		iova_mode = RTE_IOVA_PA;
 		break;
 
@@ -647,11 +647,11 @@ int rte_pci_read_config(const struct rte_pci_device *device,
 	const struct rte_intr_handle *intr_handle = &device->intr_handle;
 
 	switch (device->kdrv) {
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		return pci_uio_read_config(intr_handle, buf, len, offset);
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		return pci_vfio_read_config(intr_handle, buf, len, offset);
 #endif
 	default:
@@ -671,11 +671,11 @@ int rte_pci_write_config(const struct rte_pci_device *device,
 	const struct rte_intr_handle *intr_handle = &device->intr_handle;
 
 	switch (device->kdrv) {
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		return pci_uio_write_config(intr_handle, buf, len, offset);
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		return pci_vfio_write_config(intr_handle, buf, len, offset);
 #endif
 	default:
@@ -760,15 +760,15 @@ rte_pci_ioport_map(struct rte_pci_device *dev, int bar,
 
 	switch (dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_ioport_map(dev, bar, p);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		ret = pci_uio_ioport_map(dev, bar, p);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 #if defined(RTE_ARCH_X86)
 		ret = pci_ioport_map(dev, bar, p);
 #else
@@ -791,14 +791,14 @@ rte_pci_ioport_read(struct rte_pci_ioport *p,
 {
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		pci_vfio_ioport_read(p, data, len, offset);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		pci_uio_ioport_read(p, data, len, offset);
 		break;
 	default:
@@ -812,14 +812,14 @@ rte_pci_ioport_write(struct rte_pci_ioport *p,
 {
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		pci_vfio_ioport_write(p, data, len, offset);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 		pci_uio_ioport_write(p, data, len, offset);
 		break;
 	default:
@@ -834,15 +834,15 @@ rte_pci_ioport_unmap(struct rte_pci_ioport *p)
 
 	switch (p->dev->kdrv) {
 #ifdef VFIO_PRESENT
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		if (pci_vfio_is_enabled())
 			ret = pci_vfio_ioport_unmap(p);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
 		ret = pci_uio_ioport_unmap(p);
 		break;
-	case RTE_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_UIO_GENERIC:
 #if defined(RTE_ARCH_X86)
 		ret = 0;
 #else
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 097dc19225..a354920d5f 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -248,7 +248,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
 		goto error;
 	}
 
-	if (dev->kdrv == RTE_KDRV_IGB_UIO)
+	if (dev->kdrv == RTE_PCI_KDRV_IGB_UIO)
 		dev->intr_handle.type = RTE_INTR_HANDLE_UIO;
 	else {
 		dev->intr_handle.type = RTE_INTR_HANDLE_UIO_INTX;
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index a8e5fd52c1..dddf2b2aad 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -465,7 +465,7 @@ pci_hot_unplug_handler(struct rte_device *dev)
 
 	switch (pdev->kdrv) {
 #ifdef HAVE_VFIO_DEV_REQ_INTERFACE
-	case RTE_KDRV_VFIO:
+	case RTE_PCI_KDRV_VFIO:
 		/*
 		 * vfio kernel module guaranty the pci device would not be
 		 * deleted until the user space release the resource, so no
@@ -476,9 +476,9 @@ pci_hot_unplug_handler(struct rte_device *dev)
 					       RTE_DEV_EVENT_REMOVE);
 		break;
 #endif
-	case RTE_KDRV_IGB_UIO:
-	case RTE_KDRV_UIO_GENERIC:
-	case RTE_KDRV_NIC_UIO:
+	case RTE_PCI_KDRV_IGB_UIO:
+	case RTE_PCI_KDRV_UIO_GENERIC:
+	case RTE_PCI_KDRV_NIC_UIO:
 		/* BARs resource is invalid, remap it to be safe. */
 		ret = pci_uio_remap_resource(pdev);
 		break;
@@ -552,7 +552,7 @@ pci_dma_map(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
 	 *  In case driver don't provides any specific mapping
 	 *  try fallback to VFIO.
 	 */
-	if (pdev->kdrv == RTE_KDRV_VFIO)
+	if (pdev->kdrv == RTE_PCI_KDRV_VFIO)
 		return rte_vfio_container_dma_map
 				(RTE_VFIO_DEFAULT_CONTAINER_FD, (uintptr_t)addr,
 				 iova, len);
@@ -575,7 +575,7 @@ pci_dma_unmap(struct rte_device *dev, void *addr, uint64_t iova, size_t len)
 	 *  In case driver don't provides any specific mapping
 	 *  try fallback to VFIO.
 	 */
-	if (pdev->kdrv == RTE_KDRV_VFIO)
+	if (pdev->kdrv == RTE_PCI_KDRV_VFIO)
 		return rte_vfio_container_dma_unmap
 				(RTE_VFIO_DEFAULT_CONTAINER_FD, (uintptr_t)addr,
 				 iova, len);
@@ -622,8 +622,8 @@ rte_pci_get_iommu_class(void)
 			iommu_no_va = pci_device_iommu_support_va(dev)
 					? 0 : 1;
 
-		if (dev->kdrv == RTE_KDRV_UNKNOWN ||
-		    dev->kdrv == RTE_KDRV_NONE)
+		if (dev->kdrv == RTE_PCI_KDRV_UNKNOWN ||
+		    dev->kdrv == RTE_PCI_KDRV_NONE)
 			continue;
 		FOREACH_DRIVER_ON_PCIBUS(drv) {
 			enum rte_iova_mode dev_iova_mode;
diff --git a/drivers/bus/pci/rte_bus_pci.h b/drivers/bus/pci/rte_bus_pci.h
index 29bea6d70d..ff6f072470 100644
--- a/drivers/bus/pci/rte_bus_pci.h
+++ b/drivers/bus/pci/rte_bus_pci.h
@@ -51,6 +51,15 @@ TAILQ_HEAD(rte_pci_driver_list, rte_pci_driver);
 
 struct rte_devargs;
 
+enum rte_pci_kernel_driver {
+	RTE_PCI_KDRV_UNKNOWN = 0,
+	RTE_PCI_KDRV_IGB_UIO,
+	RTE_PCI_KDRV_VFIO,
+	RTE_PCI_KDRV_UIO_GENERIC,
+	RTE_PCI_KDRV_NIC_UIO,
+	RTE_PCI_KDRV_NONE,
+};
+
 /**
  * A structure describing a PCI device.
  */
@@ -64,7 +73,7 @@ struct rte_pci_device {
 	struct rte_intr_handle intr_handle; /**< Interrupt handle */
 	struct rte_pci_driver *driver;      /**< PCI driver used in probing */
 	uint16_t max_vfs;                   /**< sriov enable if not zero */
-	enum rte_kernel_driver kdrv;        /**< Kernel driver passthrough */
+	enum rte_pci_kernel_driver kdrv;    /**< Kernel driver passthrough */
 	char name[PCI_PRI_STR_SIZE+1];      /**< PCI location (ASCII) */
 	struct rte_intr_handle vfio_req_intr_handle;
 				/**< Handler of VFIO request interrupt */
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index c80bd55716..9e5c8fafb0 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -211,7 +211,7 @@ get_device_resource_info(HDEVINFO dev_info,
 	BOOL  res;
 
 	switch (dev->kdrv) {
-	case RTE_KDRV_NONE:
+	case RTE_PCI_KDRV_NONE:
 		/* Get NUMA node using DEVPKEY_Device_Numa_Node */
 		res = SetupDiGetDevicePropertyW(dev_info, dev_info_data,
 			&DEVPKEY_Device_Numa_Node, &property_type,
@@ -223,7 +223,7 @@ get_device_resource_info(HDEVINFO dev_info,
 			return -1;
 		}
 		dev->device.numa_node = numa_node;
-		/* mem_resource - Unneeded for RTE_KDRV_NONE */
+		/* mem_resource - Unneeded for RTE_PCI_KDRV_NONE */
 		dev->mem_resource[0].phys_addr = 0;
 		dev->mem_resource[0].len = 0;
 		dev->mem_resource[0].addr = NULL;
@@ -292,7 +292,7 @@ get_kernel_driver_type(struct rte_pci_device *dev)
 	 * If another kernel driver is supported the relevant checking
 	 * functions should be here
 	 */
-	dev->kdrv = RTE_KDRV_NONE;
+	dev->kdrv = RTE_PCI_KDRV_NONE;
 }
 
 static int
diff --git a/drivers/net/hinic/base/hinic_pmd_hwif.c b/drivers/net/hinic/base/hinic_pmd_hwif.c
index d7fc1af707..26fa1e27d4 100644
--- a/drivers/net/hinic/base/hinic_pmd_hwif.c
+++ b/drivers/net/hinic/base/hinic_pmd_hwif.c
@@ -280,7 +280,7 @@ void hinic_set_msix_state(void *hwdev, u16 msix_idx, enum hinic_msix_state flag)
 	/* vfio-pci does not mmap msi-x vector table to user space,
 	 * we can not access the space when kernel driver is vfio-pci
 	 */
-	if (hw->pcidev_hdl->kdrv == RTE_KDRV_VFIO)
+	if (hw->pcidev_hdl->kdrv == RTE_PCI_KDRV_VFIO)
 		return;
 
 	mask_bits = readl(hwif->intr_regs_base + offset);
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index 1d2941f0e3..63089d0bd4 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2425,8 +2425,8 @@ hns3vf_reinit_dev(struct hns3_adapter *hns)
 		 * UIO enables msix by writing the pcie configuration space
 		 * vfio_pci enables msix in rte_intr_enable.
 		 */
-		if (pci_dev->kdrv == RTE_KDRV_IGB_UIO ||
-		    pci_dev->kdrv == RTE_KDRV_UIO_GENERIC) {
+		if (pci_dev->kdrv == RTE_PCI_KDRV_IGB_UIO ||
+		    pci_dev->kdrv == RTE_PCI_KDRV_UIO_GENERIC) {
 			if (hns3vf_enable_msix(pci_dev, true))
 				hns3_err(hw, "Failed to enable msix");
 		}
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index 2258838c4c..2c2b27e62a 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -1563,7 +1563,7 @@ lio_dev_close(struct rte_eth_dev *eth_dev)
 	/* Reset ioq regs */
 	lio_dev->fn_list.setup_device_regs(lio_dev);
 
-	if (lio_dev->pci_dev->kdrv == RTE_KDRV_IGB_UIO) {
+	if (lio_dev->pci_dev->kdrv == RTE_PCI_KDRV_IGB_UIO) {
 		cn23xx_vf_ask_pf_to_do_flr(lio_dev);
 		rte_delay_ms(LIO_PCI_FLR_WAIT);
 	}
@@ -2012,7 +2012,7 @@ lio_first_time_init(struct lio_device *lio_dev,
 		goto error;
 
 	/* Request and wait for device reset. */
-	if (pdev->kdrv == RTE_KDRV_IGB_UIO) {
+	if (pdev->kdrv == RTE_PCI_KDRV_IGB_UIO) {
 		cn23xx_vf_ask_pf_to_do_flr(lio_dev);
 		/* FLR wait time doubled as a precaution. */
 		rte_delay_ms(LIO_PCI_FLR_WAIT * 2);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 99946279db..1cf949a9ab 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -3614,7 +3614,7 @@ static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	 * interface. Here we avoid this telling to the CPP init code to
 	 * use a lock file if UIO is being used.
 	 */
-	if (dev->kdrv == RTE_KDRV_VFIO)
+	if (dev->kdrv == RTE_PCI_KDRV_VFIO)
 		cpp = nfp_cpp_from_device_name(dev, 0);
 	else
 		cpp = nfp_cpp_from_device_name(dev, 1);
diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c
index 29a354bf76..9915eabf68 100644
--- a/drivers/net/virtio/virtio_pci.c
+++ b/drivers/net/virtio/virtio_pci.c
@@ -704,7 +704,7 @@ vtpci_init(struct rte_pci_device *dev, struct virtio_hw *hw)
 	PMD_INIT_LOG(INFO, "trying with legacy virtio pci.");
 	if (rte_pci_ioport_map(dev, 0, VTPCI_IO(hw)) < 0) {
 		rte_pci_unmap_device(dev);
-		if (dev->kdrv == RTE_KDRV_UNKNOWN &&
+		if (dev->kdrv == RTE_PCI_KDRV_UNKNOWN &&
 		    (!dev->device.devargs ||
 		     dev->device.devargs->bus !=
 		     rte_bus_find_by_name("pci"))) {
diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
index c8d985fb5c..53c8bc6fab 100644
--- a/lib/librte_eal/include/rte_dev.h
+++ b/lib/librte_eal/include/rte_dev.h
@@ -54,18 +54,6 @@ typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 		return; \
 } while (0)
 
-/**
- * Device driver.
- */
-enum rte_kernel_driver {
-	RTE_KDRV_UNKNOWN = 0,
-	RTE_KDRV_IGB_UIO,
-	RTE_KDRV_VFIO,
-	RTE_KDRV_UIO_GENERIC,
-	RTE_KDRV_NIC_UIO,
-	RTE_KDRV_NONE,
-};
-
 /**
  * Device policies.
  */
-- 
2.23.0


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

* [dpdk-dev] [PATCH v3 3/6] pci: move resource mapping to the PCI bus
  2020-09-17 11:28 ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 1/6] ethdev: remove unused kernel driver field David Marchand
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 2/6] bus/pci: switch to private kernel driver enum David Marchand
@ 2020-09-17 11:28   ` David Marchand
  2020-09-18 13:43     ` Kinsella, Ray
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 4/6] mem: drop mapping API workaround David Marchand
                     ` (3 subsequent siblings)
  6 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2020-09-17 11:28 UTC (permalink / raw)
  To: dev
  Cc: arybchenko, Ray Kinsella, Neil Horman, John McNamara,
	Marko Kovacevic, Ferruh Yigit, Gaetan Rivet

As reported during 20.08 work for Windows, the pci_map_resource API was
built with the assumption that its flags would be passed to mmap().

This introduced a regression when adding the rte_mem_map API as reported
in the workaround commit 9d2b24593724 ("pci: keep API compatibility with
mmap values").

This API was only used in the PCI bus code, so move it there.

There is no code change happening during the move.
The only change is in the pci_map_resource description where the
additional flags are now documented as rte_mem_map API flags:
- *      The additional flags for the mapping range.
+ *      The additional rte_mem_map() flags for the mapping range.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 doc/guides/rel_notes/deprecation.rst   | 11 -----
 doc/guides/rel_notes/release_20_11.rst |  6 +++
 drivers/bus/pci/linux/pci_init.h       |  2 +
 drivers/bus/pci/linux/pci_uio.c        |  1 +
 drivers/bus/pci/pci_common.c           | 41 ++++++++++++++++
 drivers/bus/pci/private.h              | 65 +++++++++++++++++++++++++
 lib/librte_pci/rte_pci.c               | 42 ----------------
 lib/librte_pci/rte_pci.h               | 66 --------------------------
 lib/librte_pci/rte_pci_version.map     |  2 -
 9 files changed, 115 insertions(+), 121 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 83ba567632..8fca461045 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -113,17 +113,6 @@ Deprecation Notices
   us extending existing enum/define.
   One solution can be using a fixed size array instead of ``.*MAX.*`` value.
 
-* pci: The PCI resources map API (``pci_map_resource`` and
-  ``pci_unmap_resource``) was not abstracting the Unix mmap flags (see the
-  workaround for Windows support implemented in the commit
-  9d2b24593724 ("pci: keep API compatibility with mmap values")).
-  This API will be removed from the public API in 20.11 and moved to the PCI
-  bus driver along with the PCI resources lists and associated structures
-  (``pci_map``, ``pci_msix_table``, ``mapped_pci_resource`` and
-  ``mapped_pci_res_list``).
-  With this removal, there won't be a need for the mentioned workaround which
-  will be reverted.
-
 * mbuf: Some fields will be converted to dynamic API in DPDK 20.11
   in order to reserve more space for the dynamic fields, as explained in
   `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index a76e7a2941..185eeae731 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -90,6 +90,12 @@ API Changes
 * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
   replaced with a private enum in the PCI subsystem.
 
+* pci: Removed the PCI resources map API from the public API
+  (``pci_map_resource`` and ``pci_unmap_resource``) and moved it to the
+  PCI bus driver along with the PCI resources lists and associated structures
+  (``pci_map``, ``pci_msix_table``, ``mapped_pci_resource`` and
+  ``mapped_pci_res_list``).
+
 * mbuf: Removed the unioned field ``refcnt_atomic`` from
   the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.
   The field ``refcnt`` is remaining from the old unions.
diff --git a/drivers/bus/pci/linux/pci_init.h b/drivers/bus/pci/linux/pci_init.h
index c2e603a374..dcea726186 100644
--- a/drivers/bus/pci/linux/pci_init.h
+++ b/drivers/bus/pci/linux/pci_init.h
@@ -7,6 +7,8 @@
 
 #include <rte_vfio.h>
 
+#include "private.h"
+
 /** IO resource type: */
 #define IORESOURCE_IO         0x00000100
 #define IORESOURCE_MEM        0x00000200
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index a354920d5f..9ab20a0b25 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -25,6 +25,7 @@
 
 #include "eal_filesystem.h"
 #include "pci_init.h"
+#include "private.h"
 
 void *pci_map_addr = NULL;
 
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index dddf2b2aad..3a2ae07958 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -19,6 +19,7 @@
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
+#include <rte_eal_paging.h>
 #include <rte_string_fns.h>
 #include <rte_common.h>
 #include <rte_devargs.h>
@@ -79,6 +80,46 @@ pci_name_set(struct rte_pci_device *dev)
 		dev->device.name = dev->name;
 }
 
+/* map a particular resource from a file */
+void *
+pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
+		 int additional_flags)
+{
+	void *mapaddr;
+
+	/* Map the PCI memory resource of device */
+	mapaddr = rte_mem_map(requested_addr, size,
+		RTE_PROT_READ | RTE_PROT_WRITE,
+		RTE_MAP_SHARED | additional_flags, fd, offset);
+	if (mapaddr == NULL) {
+		RTE_LOG(ERR, EAL,
+			"%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\n",
+			__func__, fd, requested_addr, size,
+			(unsigned long long)offset,
+			rte_strerror(rte_errno), mapaddr);
+		mapaddr = MAP_FAILED; /* API uses mmap error code */
+	} else
+		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
+
+	return mapaddr;
+}
+
+/* unmap a particular resource */
+void
+pci_unmap_resource(void *requested_addr, size_t size)
+{
+	if (requested_addr == NULL)
+		return;
+
+	/* Unmap the PCI memory resource of device */
+	if (rte_mem_unmap(requested_addr, size)) {
+		RTE_LOG(ERR, EAL, "%s(): cannot mem unmap(%p, %#zx): %s\n",
+			__func__, requested_addr, size,
+			rte_strerror(rte_errno));
+	} else
+		RTE_LOG(DEBUG, EAL, "  PCI memory unmapped at %p\n",
+				requested_addr);
+}
 /*
  * Match the PCI Driver and Device using the ID Table
  */
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 367cdd9a65..7c89744b66 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -81,6 +81,71 @@ void rte_pci_insert_device(struct rte_pci_device *exist_pci_dev,
  */
 int pci_update_device(const struct rte_pci_addr *addr);
 
+/**
+ * A structure describing a PCI mapping.
+ */
+struct pci_map {
+	void *addr;
+	char *path;
+	uint64_t offset;
+	uint64_t size;
+	uint64_t phaddr;
+};
+
+struct pci_msix_table {
+	int bar_index;
+	uint32_t offset;
+	uint32_t size;
+};
+
+/**
+ * A structure describing a mapped PCI resource.
+ * For multi-process we need to reproduce all PCI mappings in secondary
+ * processes, so save them in a tailq.
+ */
+struct mapped_pci_resource {
+	TAILQ_ENTRY(mapped_pci_resource) next;
+
+	struct rte_pci_addr pci_addr;
+	char path[PATH_MAX];
+	int nb_maps;
+	struct pci_map maps[PCI_MAX_RESOURCE];
+	struct pci_msix_table msix_table;
+};
+
+/** mapped pci device list */
+TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
+
+/**
+ * Map a particular resource from a file.
+ *
+ * @param requested_addr
+ *      The starting address for the new mapping range.
+ * @param fd
+ *      The file descriptor.
+ * @param offset
+ *      The offset for the mapping range.
+ * @param size
+ *      The size for the mapping range.
+ * @param additional_flags
+ *      The additional rte_mem_map() flags for the mapping range.
+ * @return
+ *   - On success, the function returns a pointer to the mapped area.
+ *   - On error, MAP_FAILED is returned.
+ */
+void *pci_map_resource(void *requested_addr, int fd, off_t offset,
+		size_t size, int additional_flags);
+
+/**
+ * Unmap a particular resource.
+ *
+ * @param requested_addr
+ *      The address for the unmapping range.
+ * @param size
+ *      The size for the unmapping range.
+ */
+void pci_unmap_resource(void *requested_addr, size_t size);
+
 /**
  * Map the PCI resource of a PCI device in virtual memory
  *
diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c
index 1d1cbc75ac..c91be8b167 100644
--- a/lib/librte_pci/rte_pci.c
+++ b/lib/librte_pci/rte_pci.c
@@ -144,45 +144,3 @@ rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr)
 		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,
-		 int additional_flags)
-{
-	void *mapaddr;
-
-	/* Map the PCI memory resource of device */
-	mapaddr = rte_mem_map(requested_addr, size,
-		RTE_PROT_READ | RTE_PROT_WRITE,
-		RTE_MAP_SHARED | additional_flags, fd, offset);
-	if (mapaddr == NULL) {
-		RTE_LOG(ERR, EAL,
-			"%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\n",
-			__func__, fd, requested_addr, size,
-			(unsigned long long)offset,
-			rte_strerror(rte_errno), mapaddr);
-		mapaddr = MAP_FAILED; /* API uses mmap error code */
-	} else
-		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
-
-	return mapaddr;
-}
-
-/* unmap a particular resource */
-void
-pci_unmap_resource(void *requested_addr, size_t size)
-{
-	if (requested_addr == NULL)
-		return;
-
-	/* Unmap the PCI memory resource of device */
-	if (rte_mem_unmap(requested_addr, size)) {
-		RTE_LOG(ERR, EAL, "%s(): cannot mem unmap(%p, %#zx): %s\n",
-			__func__, requested_addr, size,
-			rte_strerror(rte_errno));
-	} else
-		RTE_LOG(DEBUG, EAL, "  PCI memory unmapped at %p\n",
-				requested_addr);
-}
diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h
index a03235da1f..567c8cd68d 100644
--- a/lib/librte_pci/rte_pci.h
+++ b/lib/librte_pci/rte_pci.h
@@ -64,42 +64,6 @@ struct rte_pci_addr {
 #define PCI_ANY_ID (0xffff)
 #define RTE_CLASS_ANY_ID (0xffffff)
 
-/**
- * A structure describing a PCI mapping.
- */
-struct pci_map {
-	void *addr;
-	char *path;
-	uint64_t offset;
-	uint64_t size;
-	uint64_t phaddr;
-};
-
-struct pci_msix_table {
-	int bar_index;
-	uint32_t offset;
-	uint32_t size;
-};
-
-/**
- * A structure describing a mapped PCI resource.
- * For multi-process we need to reproduce all PCI mappings in secondary
- * processes, so save them in a tailq.
- */
-struct mapped_pci_resource {
-	TAILQ_ENTRY(mapped_pci_resource) next;
-
-	struct rte_pci_addr pci_addr;
-	char path[PATH_MAX];
-	int nb_maps;
-	struct pci_map maps[PCI_MAX_RESOURCE];
-	struct pci_msix_table msix_table;
-};
-
-
-/** mapped pci device list */
-TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
-
 /**
  * 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_*
@@ -145,36 +109,6 @@ int rte_pci_addr_cmp(const struct rte_pci_addr *addr,
  */
 int rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr);
 
-/**
- * Map a particular resource from a file.
- *
- * @param requested_addr
- *      The starting address for the new mapping range.
- * @param fd
- *      The file descriptor.
- * @param offset
- *      The offset for the mapping range.
- * @param size
- *      The size for the mapping range.
- * @param additional_flags
- *      The additional flags for the mapping range.
- * @return
- *   - On success, the function returns a pointer to the mapped area.
- *   - On error, MAP_FAILED is returned.
- */
-void *pci_map_resource(void *requested_addr, int fd, off_t offset,
-		size_t size, int additional_flags);
-
-/**
- * Unmap a particular resource.
- *
- * @param requested_addr
- *      The address for the unmapping range.
- * @param size
- *      The size for the unmapping range.
- */
-void pci_unmap_resource(void *requested_addr, size_t size);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_pci/rte_pci_version.map b/lib/librte_pci/rte_pci_version.map
index cd77c9dc9e..1db19a5122 100644
--- a/lib/librte_pci/rte_pci_version.map
+++ b/lib/librte_pci/rte_pci_version.map
@@ -1,8 +1,6 @@
 DPDK_21 {
 	global:
 
-	pci_map_resource;
-	pci_unmap_resource;
 	rte_pci_addr_cmp;
 	rte_pci_addr_parse;
 	rte_pci_device_name;
-- 
2.23.0


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

* [dpdk-dev] [PATCH v3 4/6] mem: drop mapping API workaround
  2020-09-17 11:28 ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand
                     ` (2 preceding siblings ...)
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 3/6] pci: move resource mapping to the PCI bus David Marchand
@ 2020-09-17 11:28   ` David Marchand
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 5/6] eal: hide internal device event structure David Marchand
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2020-09-17 11:28 UTC (permalink / raw)
  To: dev
  Cc: arybchenko, Ferruh Yigit, Anatoly Burakov, Dmitry Kozlyuk,
	Narcisa Ana Maria Vasile, Dmitry Malloy, Pallavi Kadam

Now that the pci_map_resource API is private to the PCI bus, we can drop
the compatibility workaround we had implemented in 20.08.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/bus/pci/bsd/pci.c               |  2 +-
 drivers/bus/pci/linux/pci_uio.c         |  2 +-
 drivers/bus/pci/linux/pci_vfio.c        |  4 ++--
 drivers/bus/pci/pci_common.c            |  1 -
 drivers/bus/pci/pci_common_uio.c        |  2 +-
 drivers/bus/pci/private.h               |  2 +-
 lib/librte_eal/include/rte_eal_paging.h | 10 ----------
 lib/librte_eal/windows/include/rte_os.h |  6 ------
 8 files changed, 6 insertions(+), 23 deletions(-)

diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c
index a07fc241fe..2ed8261349 100644
--- a/drivers/bus/pci/bsd/pci.c
+++ b/drivers/bus/pci/bsd/pci.c
@@ -192,7 +192,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	mapaddr = pci_map_resource(NULL, fd, (off_t)offset,
 			(size_t)dev->mem_resource[res_idx].len, 0);
 	close(fd);
-	if (mapaddr == MAP_FAILED)
+	if (mapaddr == NULL)
 		goto error;
 
 	maps[map_idx].phaddr = dev->mem_resource[res_idx].phys_addr;
diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
index 9ab20a0b25..f3305a2f28 100644
--- a/drivers/bus/pci/linux/pci_uio.c
+++ b/drivers/bus/pci/linux/pci_uio.c
@@ -346,7 +346,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
 	mapaddr = pci_map_resource(pci_map_addr, fd, 0,
 			(size_t)dev->mem_resource[res_idx].len, 0);
 	close(fd);
-	if (mapaddr == MAP_FAILED)
+	if (mapaddr == NULL)
 		goto error;
 
 	pci_map_addr = RTE_PTR_ADD(mapaddr,
diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c
index c15ed3bade..34b5da80df 100644
--- a/drivers/bus/pci/linux/pci_vfio.c
+++ b/drivers/bus/pci/linux/pci_vfio.c
@@ -565,7 +565,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 		}
 
 		/* if there's a second part, try to map it */
-		if (map_addr != MAP_FAILED
+		if (map_addr != NULL
 			&& memreg[1].offset && memreg[1].size) {
 			void *second_addr = RTE_PTR_ADD(bar_addr,
 						(uintptr_t)(memreg[1].offset -
@@ -577,7 +577,7 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res,
 							RTE_MAP_FORCE_ADDRESS);
 		}
 
-		if (map_addr == NULL || map_addr == MAP_FAILED) {
+		if (map_addr == NULL) {
 			munmap(bar_addr, bar->size);
 			bar_addr = MAP_FAILED;
 			RTE_LOG(ERR, EAL, "Failed to map pci BAR%d\n",
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 3a2ae07958..62d45041bb 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -97,7 +97,6 @@ pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
 			__func__, fd, requested_addr, size,
 			(unsigned long long)offset,
 			rte_strerror(rte_errno), mapaddr);
-		mapaddr = MAP_FAILED; /* API uses mmap error code */
 	} else
 		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
 
diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c
index f4dca9da91..793dfd0a7c 100644
--- a/drivers/bus/pci/pci_common_uio.c
+++ b/drivers/bus/pci/pci_common_uio.c
@@ -58,7 +58,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev)
 					"Cannot mmap device resource file %s to address: %p\n",
 					uio_res->maps[i].path,
 					uio_res->maps[i].addr);
-				if (mapaddr != MAP_FAILED) {
+				if (mapaddr != NULL) {
 					/* unmap addrs correctly mapped */
 					for (j = 0; j < i; j++)
 						pci_unmap_resource(
diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index 7c89744b66..fadc767236 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -131,7 +131,7 @@ TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
  *      The additional rte_mem_map() flags for the mapping range.
  * @return
  *   - On success, the function returns a pointer to the mapped area.
- *   - On error, MAP_FAILED is returned.
+ *   - On error, NULL is returned.
  */
 void *pci_map_resource(void *requested_addr, int fd, off_t offset,
 		size_t size, int additional_flags);
diff --git a/lib/librte_eal/include/rte_eal_paging.h b/lib/librte_eal/include/rte_eal_paging.h
index 429f896c8c..ed98e70e9e 100644
--- a/lib/librte_eal/include/rte_eal_paging.h
+++ b/lib/librte_eal/include/rte_eal_paging.h
@@ -3,9 +3,6 @@
  */
 
 #include <stdint.h>
-#ifndef RTE_EXEC_ENV_WINDOWS
-#include <sys/mman.h>
-#endif
 
 #include <rte_compat.h>
 
@@ -25,7 +22,6 @@ enum rte_mem_prot {
 
 /** Additional flags for memory mapping. */
 enum rte_map_flags {
-#ifdef RTE_EXEC_ENV_WINDOWS
 	/** Changes to the mapped memory are visible to other processes. */
 	RTE_MAP_SHARED = 1 << 0,
 	/** Mapping is not backed by a regular file. */
@@ -39,12 +35,6 @@ enum rte_map_flags {
 	 * it is not required to do so, thus mapping with this flag may fail.
 	 */
 	RTE_MAP_FORCE_ADDRESS = 1 << 3
-#else /* map mmap flags because they are exposed in pci_map_resource() API */
-	RTE_MAP_SHARED = MAP_SHARED,
-	RTE_MAP_ANONYMOUS = MAP_ANONYMOUS,
-	RTE_MAP_PRIVATE = MAP_PRIVATE,
-	RTE_MAP_FORCE_ADDRESS = MAP_FIXED,
-#endif
 };
 
 /**
diff --git a/lib/librte_eal/windows/include/rte_os.h b/lib/librte_eal/windows/include/rte_os.h
index 2881bf2224..569ed92d51 100644
--- a/lib/librte_eal/windows/include/rte_os.h
+++ b/lib/librte_eal/windows/include/rte_os.h
@@ -25,12 +25,6 @@ extern "C" {
 #define PATH_MAX _MAX_PATH
 #endif
 
-/* sys/mman.h
- * The syscall mmap does not exist on Windows,
- * but this error code is used in a badly defined DPDK API for PCI mapping.
- */
-#define MAP_FAILED ((void *) -1)
-
 #define sleep(x) Sleep(1000 * (x))
 
 #define strerror_r(a, b, c) strerror_s(b, c, a)
-- 
2.23.0


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

* [dpdk-dev] [PATCH v3 5/6] eal: hide internal device event structure
  2020-09-17 11:28 ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand
                     ` (3 preceding siblings ...)
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 4/6] mem: drop mapping API workaround David Marchand
@ 2020-09-17 11:28   ` David Marchand
  2020-09-18  3:40     ` Guo, Jia
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 6/6] bus/pci: remove duplicate declaration David Marchand
  2020-09-21  9:05   ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand
  6 siblings, 1 reply; 30+ messages in thread
From: David Marchand @ 2020-09-17 11:28 UTC (permalink / raw)
  To: dev
  Cc: arybchenko, Ray Kinsella, Neil Horman, John McNamara,
	Marko Kovacevic, Jianfeng Tan, Jeff Guo

This structure is not used in the public API.

Fixes: a753e53d517b ("eal: add device event monitor framework")

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 doc/guides/rel_notes/deprecation.rst   | 3 ---
 doc/guides/rel_notes/release_20_11.rst | 3 +++
 lib/librte_eal/include/rte_dev.h       | 6 ------
 lib/librte_eal/linux/eal_dev.c         | 6 ++++++
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 8fca461045..3669d6533b 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -70,9 +70,6 @@ Deprecation Notices
 * eal: The function ``rte_eal_remote_launch`` will return new error codes
   after read or write error on the pipe, instead of calling ``rte_panic``.
 
-* eal: The ``rte_dev_event`` structure will be made private to the EAL as no
-  public API makes use of it.
-
 * rte_atomicNN_xxx: These APIs do not take memory order parameter. This does
   not allow for writing optimized code for all the CPU architectures supported
   in DPDK. DPDK will adopt C11 atomic operations semantics and provide wrappers
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 185eeae731..e87509dfa7 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -87,6 +87,9 @@ API Changes
 * eal: The ``rte_logs`` struct and global symbol was made private
   and is no longer part of the API.
 
+* eal: Made the ``rte_dev_event`` structure private to the EAL as no public API
+  used it.
+
 * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
   replaced with a private enum in the PCI subsystem.
 
diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
index 53c8bc6fab..81905b3ae3 100644
--- a/lib/librte_eal/include/rte_dev.h
+++ b/lib/librte_eal/include/rte_dev.h
@@ -33,12 +33,6 @@ enum rte_dev_event_type {
 	RTE_DEV_EVENT_MAX	/**< max value of this enum */
 };
 
-struct rte_dev_event {
-	enum rte_dev_event_type type;	/**< device event type */
-	int subsystem;			/**< subsystem id */
-	char *devname;			/**< device name */
-};
-
 typedef void (*rte_dev_event_cb_fn)(const char *device_name,
 					enum rte_dev_event_type event,
 					void *cb_arg);
diff --git a/lib/librte_eal/linux/eal_dev.c b/lib/librte_eal/linux/eal_dev.c
index 83b6068264..2e15762b56 100644
--- a/lib/librte_eal/linux/eal_dev.c
+++ b/lib/librte_eal/linux/eal_dev.c
@@ -133,6 +133,12 @@ dev_uev_socket_fd_create(void)
 	return ret;
 }
 
+struct rte_dev_event {
+	enum rte_dev_event_type type;	/**< device event type */
+	int subsystem;			/**< subsystem id */
+	char *devname;			/**< device name */
+};
+
 static int
 dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
 {
-- 
2.23.0


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

* [dpdk-dev] [PATCH v3 6/6] bus/pci: remove duplicate declaration
  2020-09-17 11:28 ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand
                     ` (4 preceding siblings ...)
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 5/6] eal: hide internal device event structure David Marchand
@ 2020-09-17 11:28   ` David Marchand
  2020-09-21  9:05   ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand
  6 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2020-09-17 11:28 UTC (permalink / raw)
  To: dev; +Cc: arybchenko, stable, Stephen Hemminger, Gaetan Rivet, Thomas Monjalon

This declaration is the same as the one a few lines before.

Fixes: 6844d146ff39 ("eal: add bus pointer in device structure")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/bus/pci/private.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
index fadc767236..16f997c701 100644
--- a/drivers/bus/pci/private.h
+++ b/drivers/bus/pci/private.h
@@ -15,8 +15,6 @@ extern struct rte_pci_bus rte_pci_bus;
 struct rte_pci_driver;
 struct rte_pci_device;
 
-extern struct rte_pci_bus rte_pci_bus;
-
 /**
  * Scan the content of the PCI bus, and the devices in the devices
  * list
-- 
2.23.0


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

* Re: [dpdk-dev] [PATCH v3 5/6] eal: hide internal device event structure
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 5/6] eal: hide internal device event structure David Marchand
@ 2020-09-18  3:40     ` Guo, Jia
  2020-09-18 13:36       ` Kinsella, Ray
  0 siblings, 1 reply; 30+ messages in thread
From: Guo, Jia @ 2020-09-18  3:40 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: arybchenko, Ray Kinsella, Neil Horman, Mcnamara, John, Kovacevic,
	Marko, Jianfeng Tan

Hi, David

> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Thursday, September 17, 2020 7:28 PM
> To: dev@dpdk.org
> Cc: arybchenko@solarflare.com; Ray Kinsella <mdr@ashroe.eu>; Neil
> Horman <nhorman@tuxdriver.com>; Mcnamara, John
> <john.mcnamara@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; Jianfeng Tan <jianfeng.tan@intel.com>; Guo,
> Jia <jia.guo@intel.com>
> Subject: [PATCH v3 5/6] eal: hide internal device event structure
> 
> This structure is not used in the public API.
> 
> Fixes: a753e53d517b ("eal: add device event monitor framework")
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Agree with the patch that the struct involve os platform specific, it is better no public it.
Acked-by: Jeff Guo <jia.guo@intel.com>

> ---
>  doc/guides/rel_notes/deprecation.rst   | 3 ---
>  doc/guides/rel_notes/release_20_11.rst | 3 +++
>  lib/librte_eal/include/rte_dev.h       | 6 ------
>  lib/librte_eal/linux/eal_dev.c         | 6 ++++++
>  4 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/deprecation.rst
> b/doc/guides/rel_notes/deprecation.rst
> index 8fca461045..3669d6533b 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -70,9 +70,6 @@ Deprecation Notices
>  * eal: The function ``rte_eal_remote_launch`` will return new error codes
>    after read or write error on the pipe, instead of calling ``rte_panic``.
> 
> -* eal: The ``rte_dev_event`` structure will be made private to the EAL as no
> -  public API makes use of it.
> -
>  * rte_atomicNN_xxx: These APIs do not take memory order parameter. This
> does
>    not allow for writing optimized code for all the CPU architectures supported
>    in DPDK. DPDK will adopt C11 atomic operations semantics and provide
> wrappers diff --git a/doc/guides/rel_notes/release_20_11.rst
> b/doc/guides/rel_notes/release_20_11.rst
> index 185eeae731..e87509dfa7 100644
> --- a/doc/guides/rel_notes/release_20_11.rst
> +++ b/doc/guides/rel_notes/release_20_11.rst
> @@ -87,6 +87,9 @@ API Changes
>  * eal: The ``rte_logs`` struct and global symbol was made private
>    and is no longer part of the API.
> 
> +* eal: Made the ``rte_dev_event`` structure private to the EAL as no
> +public API
> +  used it.
> +
>  * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
>    replaced with a private enum in the PCI subsystem.
> 
> diff --git a/lib/librte_eal/include/rte_dev.h
> b/lib/librte_eal/include/rte_dev.h
> index 53c8bc6fab..81905b3ae3 100644
> --- a/lib/librte_eal/include/rte_dev.h
> +++ b/lib/librte_eal/include/rte_dev.h
> @@ -33,12 +33,6 @@ enum rte_dev_event_type {
>  	RTE_DEV_EVENT_MAX	/**< max value of this enum */
>  };
> 
> -struct rte_dev_event {
> -	enum rte_dev_event_type type;	/**< device event type */
> -	int subsystem;			/**< subsystem id */
> -	char *devname;			/**< device name */
> -};
> -
>  typedef void (*rte_dev_event_cb_fn)(const char *device_name,
>  					enum rte_dev_event_type event,
>  					void *cb_arg);
> diff --git a/lib/librte_eal/linux/eal_dev.c b/lib/librte_eal/linux/eal_dev.c
> index 83b6068264..2e15762b56 100644
> --- a/lib/librte_eal/linux/eal_dev.c
> +++ b/lib/librte_eal/linux/eal_dev.c
> @@ -133,6 +133,12 @@ dev_uev_socket_fd_create(void)
>  	return ret;
>  }
> 
> +struct rte_dev_event {
> +	enum rte_dev_event_type type;	/**< device event type */
> +	int subsystem;			/**< subsystem id */
> +	char *devname;			/**< device name */
> +};
> +
>  static int
>  dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)  {
> --
> 2.23.0


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

* Re: [dpdk-dev] [PATCH v3 5/6] eal: hide internal device event structure
  2020-09-18  3:40     ` Guo, Jia
@ 2020-09-18 13:36       ` Kinsella, Ray
  0 siblings, 0 replies; 30+ messages in thread
From: Kinsella, Ray @ 2020-09-18 13:36 UTC (permalink / raw)
  To: Guo, Jia, David Marchand, dev
  Cc: arybchenko, Neil Horman, Mcnamara, John, Kovacevic, Marko, Jianfeng Tan



On 18/09/2020 04:40, Guo, Jia wrote:
> Hi, David
> 
>> -----Original Message-----
>> From: David Marchand <david.marchand@redhat.com>
>> Sent: Thursday, September 17, 2020 7:28 PM
>> To: dev@dpdk.org
>> Cc: arybchenko@solarflare.com; Ray Kinsella <mdr@ashroe.eu>; Neil
>> Horman <nhorman@tuxdriver.com>; Mcnamara, John
>> <john.mcnamara@intel.com>; Kovacevic, Marko
>> <marko.kovacevic@intel.com>; Jianfeng Tan <jianfeng.tan@intel.com>; Guo,
>> Jia <jia.guo@intel.com>
>> Subject: [PATCH v3 5/6] eal: hide internal device event structure
>>
>> This structure is not used in the public API.
>>
>> Fixes: a753e53d517b ("eal: add device event monitor framework")
>>
>> Signed-off-by: David Marchand <david.marchand@redhat.com>
> 
> Agree with the patch that the struct involve os platform specific, it is better no public it.
> Acked-by: Jeff Guo <jia.guo@intel.com>

Acked-by: Ray Kinsella <mdr@ashroe.eu>

> 
>> ---
>>  doc/guides/rel_notes/deprecation.rst   | 3 ---
>>  doc/guides/rel_notes/release_20_11.rst | 3 +++
>>  lib/librte_eal/include/rte_dev.h       | 6 ------
>>  lib/librte_eal/linux/eal_dev.c         | 6 ++++++
>>  4 files changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/doc/guides/rel_notes/deprecation.rst
>> b/doc/guides/rel_notes/deprecation.rst
>> index 8fca461045..3669d6533b 100644
>> --- a/doc/guides/rel_notes/deprecation.rst
>> +++ b/doc/guides/rel_notes/deprecation.rst
>> @@ -70,9 +70,6 @@ Deprecation Notices
>>  * eal: The function ``rte_eal_remote_launch`` will return new error codes
>>    after read or write error on the pipe, instead of calling ``rte_panic``.
>>
>> -* eal: The ``rte_dev_event`` structure will be made private to the EAL as no
>> -  public API makes use of it.
>> -
>>  * rte_atomicNN_xxx: These APIs do not take memory order parameter. This
>> does
>>    not allow for writing optimized code for all the CPU architectures supported
>>    in DPDK. DPDK will adopt C11 atomic operations semantics and provide
>> wrappers diff --git a/doc/guides/rel_notes/release_20_11.rst
>> b/doc/guides/rel_notes/release_20_11.rst
>> index 185eeae731..e87509dfa7 100644
>> --- a/doc/guides/rel_notes/release_20_11.rst
>> +++ b/doc/guides/rel_notes/release_20_11.rst
>> @@ -87,6 +87,9 @@ API Changes
>>  * eal: The ``rte_logs`` struct and global symbol was made private
>>    and is no longer part of the API.
>>
>> +* eal: Made the ``rte_dev_event`` structure private to the EAL as no
>> +public API
>> +  used it.
>> +
>>  * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
>>    replaced with a private enum in the PCI subsystem.
>>
>> diff --git a/lib/librte_eal/include/rte_dev.h
>> b/lib/librte_eal/include/rte_dev.h
>> index 53c8bc6fab..81905b3ae3 100644
>> --- a/lib/librte_eal/include/rte_dev.h
>> +++ b/lib/librte_eal/include/rte_dev.h
>> @@ -33,12 +33,6 @@ enum rte_dev_event_type {
>>  	RTE_DEV_EVENT_MAX	/**< max value of this enum */
>>  };
>>
>> -struct rte_dev_event {
>> -	enum rte_dev_event_type type;	/**< device event type */
>> -	int subsystem;			/**< subsystem id */
>> -	char *devname;			/**< device name */
>> -};
>> -
>>  typedef void (*rte_dev_event_cb_fn)(const char *device_name,
>>  					enum rte_dev_event_type event,
>>  					void *cb_arg);
>> diff --git a/lib/librte_eal/linux/eal_dev.c b/lib/librte_eal/linux/eal_dev.c
>> index 83b6068264..2e15762b56 100644
>> --- a/lib/librte_eal/linux/eal_dev.c
>> +++ b/lib/librte_eal/linux/eal_dev.c
>> @@ -133,6 +133,12 @@ dev_uev_socket_fd_create(void)
>>  	return ret;
>>  }
>>
>> +struct rte_dev_event {
>> +	enum rte_dev_event_type type;	/**< device event type */
>> +	int subsystem;			/**< subsystem id */
>> +	char *devname;			/**< device name */
>> +};
>> +
>>  static int
>>  dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)  {
>> --
>> 2.23.0
> 

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

* Re: [dpdk-dev] [PATCH v3 3/6] pci: move resource mapping to the PCI bus
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 3/6] pci: move resource mapping to the PCI bus David Marchand
@ 2020-09-18 13:43     ` Kinsella, Ray
  0 siblings, 0 replies; 30+ messages in thread
From: Kinsella, Ray @ 2020-09-18 13:43 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: arybchenko, Neil Horman, John McNamara, Marko Kovacevic,
	Ferruh Yigit, Gaetan Rivet



On 17/09/2020 12:28, David Marchand wrote:
> As reported during 20.08 work for Windows, the pci_map_resource API was
> built with the assumption that its flags would be passed to mmap().
> 
> This introduced a regression when adding the rte_mem_map API as reported
> in the workaround commit 9d2b24593724 ("pci: keep API compatibility with
> mmap values").
> 
> This API was only used in the PCI bus code, so move it there.
> 
> There is no code change happening during the move.
> The only change is in the pci_map_resource description where the
> additional flags are now documented as rte_mem_map API flags:
> - *      The additional flags for the mapping range.
> + *      The additional rte_mem_map() flags for the mapping range.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
> ---
>  doc/guides/rel_notes/deprecation.rst   | 11 -----
>  doc/guides/rel_notes/release_20_11.rst |  6 +++
>  drivers/bus/pci/linux/pci_init.h       |  2 +
>  drivers/bus/pci/linux/pci_uio.c        |  1 +
>  drivers/bus/pci/pci_common.c           | 41 ++++++++++++++++
>  drivers/bus/pci/private.h              | 65 +++++++++++++++++++++++++
>  lib/librte_pci/rte_pci.c               | 42 ----------------
>  lib/librte_pci/rte_pci.h               | 66 --------------------------
>  lib/librte_pci/rte_pci_version.map     |  2 -
>  9 files changed, 115 insertions(+), 121 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
> index 83ba567632..8fca461045 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -113,17 +113,6 @@ Deprecation Notices
>    us extending existing enum/define.
>    One solution can be using a fixed size array instead of ``.*MAX.*`` value.
>  
> -* pci: The PCI resources map API (``pci_map_resource`` and
> -  ``pci_unmap_resource``) was not abstracting the Unix mmap flags (see the
> -  workaround for Windows support implemented in the commit
> -  9d2b24593724 ("pci: keep API compatibility with mmap values")).
> -  This API will be removed from the public API in 20.11 and moved to the PCI
> -  bus driver along with the PCI resources lists and associated structures
> -  (``pci_map``, ``pci_msix_table``, ``mapped_pci_resource`` and
> -  ``mapped_pci_res_list``).
> -  With this removal, there won't be a need for the mentioned workaround which
> -  will be reverted.
> -
>  * mbuf: Some fields will be converted to dynamic API in DPDK 20.11
>    in order to reserve more space for the dynamic fields, as explained in
>    `this presentation <https://www.youtube.com/watch?v=Ttl6MlhmzWY>`_.
> diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
> index a76e7a2941..185eeae731 100644
> --- a/doc/guides/rel_notes/release_20_11.rst
> +++ b/doc/guides/rel_notes/release_20_11.rst
> @@ -90,6 +90,12 @@ API Changes
>  * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
>    replaced with a private enum in the PCI subsystem.
>  
> +* pci: Removed the PCI resources map API from the public API
> +  (``pci_map_resource`` and ``pci_unmap_resource``) and moved it to the
> +  PCI bus driver along with the PCI resources lists and associated structures
> +  (``pci_map``, ``pci_msix_table``, ``mapped_pci_resource`` and
> +  ``mapped_pci_res_list``).
> +
>  * mbuf: Removed the unioned field ``refcnt_atomic`` from
>    the structures ``rte_mbuf`` and ``rte_mbuf_ext_shared_info``.
>    The field ``refcnt`` is remaining from the old unions.
> diff --git a/drivers/bus/pci/linux/pci_init.h b/drivers/bus/pci/linux/pci_init.h
> index c2e603a374..dcea726186 100644
> --- a/drivers/bus/pci/linux/pci_init.h
> +++ b/drivers/bus/pci/linux/pci_init.h
> @@ -7,6 +7,8 @@
>  
>  #include <rte_vfio.h>
>  
> +#include "private.h"
> +
>  /** IO resource type: */
>  #define IORESOURCE_IO         0x00000100
>  #define IORESOURCE_MEM        0x00000200
> diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c
> index a354920d5f..9ab20a0b25 100644
> --- a/drivers/bus/pci/linux/pci_uio.c
> +++ b/drivers/bus/pci/linux/pci_uio.c
> @@ -25,6 +25,7 @@
>  
>  #include "eal_filesystem.h"
>  #include "pci_init.h"
> +#include "private.h"
>  
>  void *pci_map_addr = NULL;
>  
> diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
> index dddf2b2aad..3a2ae07958 100644
> --- a/drivers/bus/pci/pci_common.c
> +++ b/drivers/bus/pci/pci_common.c
> @@ -19,6 +19,7 @@
>  #include <rte_per_lcore.h>
>  #include <rte_memory.h>
>  #include <rte_eal.h>
> +#include <rte_eal_paging.h>
>  #include <rte_string_fns.h>
>  #include <rte_common.h>
>  #include <rte_devargs.h>
> @@ -79,6 +80,46 @@ pci_name_set(struct rte_pci_device *dev)
>  		dev->device.name = dev->name;
>  }
>  
> +/* map a particular resource from a file */
> +void *
> +pci_map_resource(void *requested_addr, int fd, off_t offset, size_t size,
> +		 int additional_flags)
> +{
> +	void *mapaddr;
> +
> +	/* Map the PCI memory resource of device */
> +	mapaddr = rte_mem_map(requested_addr, size,
> +		RTE_PROT_READ | RTE_PROT_WRITE,
> +		RTE_MAP_SHARED | additional_flags, fd, offset);
> +	if (mapaddr == NULL) {
> +		RTE_LOG(ERR, EAL,
> +			"%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\n",
> +			__func__, fd, requested_addr, size,
> +			(unsigned long long)offset,
> +			rte_strerror(rte_errno), mapaddr);
> +		mapaddr = MAP_FAILED; /* API uses mmap error code */
> +	} else
> +		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
> +
> +	return mapaddr;
> +}
> +
> +/* unmap a particular resource */
> +void
> +pci_unmap_resource(void *requested_addr, size_t size)
> +{
> +	if (requested_addr == NULL)
> +		return;
> +
> +	/* Unmap the PCI memory resource of device */
> +	if (rte_mem_unmap(requested_addr, size)) {
> +		RTE_LOG(ERR, EAL, "%s(): cannot mem unmap(%p, %#zx): %s\n",
> +			__func__, requested_addr, size,
> +			rte_strerror(rte_errno));
> +	} else
> +		RTE_LOG(DEBUG, EAL, "  PCI memory unmapped at %p\n",
> +				requested_addr);
> +}
>  /*
>   * Match the PCI Driver and Device using the ID Table
>   */
> diff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h
> index 367cdd9a65..7c89744b66 100644
> --- a/drivers/bus/pci/private.h
> +++ b/drivers/bus/pci/private.h
> @@ -81,6 +81,71 @@ void rte_pci_insert_device(struct rte_pci_device *exist_pci_dev,
>   */
>  int pci_update_device(const struct rte_pci_addr *addr);
>  
> +/**
> + * A structure describing a PCI mapping.
> + */
> +struct pci_map {
> +	void *addr;
> +	char *path;
> +	uint64_t offset;
> +	uint64_t size;
> +	uint64_t phaddr;
> +};
> +
> +struct pci_msix_table {
> +	int bar_index;
> +	uint32_t offset;
> +	uint32_t size;
> +};
> +
> +/**
> + * A structure describing a mapped PCI resource.
> + * For multi-process we need to reproduce all PCI mappings in secondary
> + * processes, so save them in a tailq.
> + */
> +struct mapped_pci_resource {
> +	TAILQ_ENTRY(mapped_pci_resource) next;
> +
> +	struct rte_pci_addr pci_addr;
> +	char path[PATH_MAX];
> +	int nb_maps;
> +	struct pci_map maps[PCI_MAX_RESOURCE];
> +	struct pci_msix_table msix_table;
> +};
> +
> +/** mapped pci device list */
> +TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
> +
> +/**
> + * Map a particular resource from a file.
> + *
> + * @param requested_addr
> + *      The starting address for the new mapping range.
> + * @param fd
> + *      The file descriptor.
> + * @param offset
> + *      The offset for the mapping range.
> + * @param size
> + *      The size for the mapping range.
> + * @param additional_flags
> + *      The additional rte_mem_map() flags for the mapping range.
> + * @return
> + *   - On success, the function returns a pointer to the mapped area.
> + *   - On error, MAP_FAILED is returned.
> + */
> +void *pci_map_resource(void *requested_addr, int fd, off_t offset,
> +		size_t size, int additional_flags);
> +
> +/**
> + * Unmap a particular resource.
> + *
> + * @param requested_addr
> + *      The address for the unmapping range.
> + * @param size
> + *      The size for the unmapping range.
> + */
> +void pci_unmap_resource(void *requested_addr, size_t size);
> +
>  /**
>   * Map the PCI resource of a PCI device in virtual memory
>   *
> diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c
> index 1d1cbc75ac..c91be8b167 100644
> --- a/lib/librte_pci/rte_pci.c
> +++ b/lib/librte_pci/rte_pci.c
> @@ -144,45 +144,3 @@ rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr)
>  		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,
> -		 int additional_flags)
> -{
> -	void *mapaddr;
> -
> -	/* Map the PCI memory resource of device */
> -	mapaddr = rte_mem_map(requested_addr, size,
> -		RTE_PROT_READ | RTE_PROT_WRITE,
> -		RTE_MAP_SHARED | additional_flags, fd, offset);
> -	if (mapaddr == NULL) {
> -		RTE_LOG(ERR, EAL,
> -			"%s(): cannot map resource(%d, %p, 0x%zx, 0x%llx): %s (%p)\n",
> -			__func__, fd, requested_addr, size,
> -			(unsigned long long)offset,
> -			rte_strerror(rte_errno), mapaddr);
> -		mapaddr = MAP_FAILED; /* API uses mmap error code */
> -	} else
> -		RTE_LOG(DEBUG, EAL, "  PCI memory mapped at %p\n", mapaddr);
> -
> -	return mapaddr;
> -}
> -
> -/* unmap a particular resource */
> -void
> -pci_unmap_resource(void *requested_addr, size_t size)
> -{
> -	if (requested_addr == NULL)
> -		return;
> -
> -	/* Unmap the PCI memory resource of device */
> -	if (rte_mem_unmap(requested_addr, size)) {
> -		RTE_LOG(ERR, EAL, "%s(): cannot mem unmap(%p, %#zx): %s\n",
> -			__func__, requested_addr, size,
> -			rte_strerror(rte_errno));
> -	} else
> -		RTE_LOG(DEBUG, EAL, "  PCI memory unmapped at %p\n",
> -				requested_addr);
> -}
> diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h
> index a03235da1f..567c8cd68d 100644
> --- a/lib/librte_pci/rte_pci.h
> +++ b/lib/librte_pci/rte_pci.h
> @@ -64,42 +64,6 @@ struct rte_pci_addr {
>  #define PCI_ANY_ID (0xffff)
>  #define RTE_CLASS_ANY_ID (0xffffff)
>  
> -/**
> - * A structure describing a PCI mapping.
> - */
> -struct pci_map {
> -	void *addr;
> -	char *path;
> -	uint64_t offset;
> -	uint64_t size;
> -	uint64_t phaddr;
> -};
> -
> -struct pci_msix_table {
> -	int bar_index;
> -	uint32_t offset;
> -	uint32_t size;
> -};
> -
> -/**
> - * A structure describing a mapped PCI resource.
> - * For multi-process we need to reproduce all PCI mappings in secondary
> - * processes, so save them in a tailq.
> - */
> -struct mapped_pci_resource {
> -	TAILQ_ENTRY(mapped_pci_resource) next;
> -
> -	struct rte_pci_addr pci_addr;
> -	char path[PATH_MAX];
> -	int nb_maps;
> -	struct pci_map maps[PCI_MAX_RESOURCE];
> -	struct pci_msix_table msix_table;
> -};
> -
> -
> -/** mapped pci device list */
> -TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
> -
>  /**
>   * 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_*
> @@ -145,36 +109,6 @@ int rte_pci_addr_cmp(const struct rte_pci_addr *addr,
>   */
>  int rte_pci_addr_parse(const char *str, struct rte_pci_addr *addr);
>  
> -/**
> - * Map a particular resource from a file.
> - *
> - * @param requested_addr
> - *      The starting address for the new mapping range.
> - * @param fd
> - *      The file descriptor.
> - * @param offset
> - *      The offset for the mapping range.
> - * @param size
> - *      The size for the mapping range.
> - * @param additional_flags
> - *      The additional flags for the mapping range.
> - * @return
> - *   - On success, the function returns a pointer to the mapped area.
> - *   - On error, MAP_FAILED is returned.
> - */
> -void *pci_map_resource(void *requested_addr, int fd, off_t offset,
> -		size_t size, int additional_flags);
> -
> -/**
> - * Unmap a particular resource.
> - *
> - * @param requested_addr
> - *      The address for the unmapping range.
> - * @param size
> - *      The size for the unmapping range.
> - */
> -void pci_unmap_resource(void *requested_addr, size_t size);
> -
>  #ifdef __cplusplus
>  }
>  #endif
> diff --git a/lib/librte_pci/rte_pci_version.map b/lib/librte_pci/rte_pci_version.map
> index cd77c9dc9e..1db19a5122 100644
> --- a/lib/librte_pci/rte_pci_version.map
> +++ b/lib/librte_pci/rte_pci_version.map
> @@ -1,8 +1,6 @@
>  DPDK_21 {
>  	global:
>  
> -	pci_map_resource;
> -	pci_unmap_resource;
>  	rte_pci_addr_cmp;
>  	rte_pci_addr_parse;
>  	rte_pci_device_name;
> 

Acked-by: Ray Kinsella <mdr@ashroe.eu>

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

* Re: [dpdk-dev] [PATCH v2 5/6] eal: hide internal device event structure
  2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 5/6] eal: hide internal device event structure David Marchand
@ 2020-09-18 14:56     ` Kinsella, Ray
  0 siblings, 0 replies; 30+ messages in thread
From: Kinsella, Ray @ 2020-09-18 14:56 UTC (permalink / raw)
  To: David Marchand, dev
  Cc: Neil Horman, John McNamara, Marko Kovacevic, Jianfeng Tan, Jeff Guo



On 14/09/2020 09:23, David Marchand wrote:
> This structure is not used in the public API.
> 
> Fixes: a753e53d517b ("eal: add device event monitor framework")
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  doc/guides/rel_notes/deprecation.rst   | 3 ---
>  doc/guides/rel_notes/release_20_11.rst | 3 +++
>  lib/librte_eal/include/rte_dev.h       | 6 ------
>  lib/librte_eal/linux/eal_dev.c         | 6 ++++++
>  4 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
> index 2c7ae1f51e..3bd3abd7f8 100644
> --- a/doc/guides/rel_notes/deprecation.rst
> +++ b/doc/guides/rel_notes/deprecation.rst
> @@ -70,9 +70,6 @@ Deprecation Notices
>  * eal: The function ``rte_eal_remote_launch`` will return new error codes
>    after read or write error on the pipe, instead of calling ``rte_panic``.
>  
> -* eal: The ``rte_dev_event`` structure will be made private to the EAL as no
> -  public API makes use of it.
> -
>  * rte_atomicNN_xxx: These APIs do not take memory order parameter. This does
>    not allow for writing optimized code for all the CPU architectures supported
>    in DPDK. DPDK will adopt C11 atomic operations semantics and provide wrappers
> diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
> index 0f6a557501..8397046988 100644
> --- a/doc/guides/rel_notes/release_20_11.rst
> +++ b/doc/guides/rel_notes/release_20_11.rst
> @@ -87,6 +87,9 @@ API Changes
>  * eal: The ``rte_logs`` struct and global symbol was made private
>    and is no longer part of the API.
>  
> +* eal: Made the ``rte_dev_event`` structure private to the EAL as no public API
> +  used it.
> +
>  * pci: Removed the ``rte_kernel_driver`` enum defined in rte_dev.h and
>    replaced with a private enum in the PCI subsystem.
>  
> diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
> index 53c8bc6fab..81905b3ae3 100644
> --- a/lib/librte_eal/include/rte_dev.h
> +++ b/lib/librte_eal/include/rte_dev.h
> @@ -33,12 +33,6 @@ enum rte_dev_event_type {
>  	RTE_DEV_EVENT_MAX	/**< max value of this enum */
>  };
>  
> -struct rte_dev_event {
> -	enum rte_dev_event_type type;	/**< device event type */
> -	int subsystem;			/**< subsystem id */
> -	char *devname;			/**< device name */
> -};
> -
>  typedef void (*rte_dev_event_cb_fn)(const char *device_name,
>  					enum rte_dev_event_type event,
>  					void *cb_arg);
> diff --git a/lib/librte_eal/linux/eal_dev.c b/lib/librte_eal/linux/eal_dev.c
> index 83c9cd6607..c8dd77c049 100644
> --- a/lib/librte_eal/linux/eal_dev.c
> +++ b/lib/librte_eal/linux/eal_dev.c
> @@ -133,6 +133,12 @@ dev_uev_socket_fd_create(void)
>  	return ret;
>  }
>  
> +struct rte_dev_event {
> +	enum rte_dev_event_type type;	/**< device event type */
> +	int subsystem;			/**< subsystem id */
> +	char *devname;			/**< device name */
> +};
> +
>  static int
>  dev_uev_parse(const char *buf, struct rte_dev_event *event, int length)
>  {
> 
Acked-by: Ray Kinsella <mdr@ashroe.eu>

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

* Re: [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups
  2020-09-17 11:28 ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand
                     ` (5 preceding siblings ...)
  2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 6/6] bus/pci: remove duplicate declaration David Marchand
@ 2020-09-21  9:05   ` David Marchand
  6 siblings, 0 replies; 30+ messages in thread
From: David Marchand @ 2020-09-21  9:05 UTC (permalink / raw)
  To: dev
  Cc: Andrew Rybchenko, Jeff Guo, Ray Kinsella, Yigit, Ferruh, Thomas Monjalon

On Thu, Sep 17, 2020 at 1:28 PM David Marchand
<david.marchand@redhat.com> wrote:
> David Marchand (6):
>   ethdev: remove unused kernel driver field
>   bus/pci: switch to private kernel driver enum
>   pci: move resource mapping to the PCI bus
>   mem: drop mapping API workaround
>   eal: hide internal device event structure
>   bus/pci: remove duplicate declaration

Thanks for the reviews.
Applied.


-- 
David Marchand


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

end of thread, back to index

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14  8:17 [dpdk-dev] [PATCH 0/5] 20.11 announced cleanups David Marchand
2020-09-14  8:17 ` [dpdk-dev] [PATCH 1/5] bus/pci: switch to private kernel driver enum David Marchand
2020-09-14  8:17 ` [dpdk-dev] [PATCH 2/5] pci: move resource mapping to the PCI bus David Marchand
2020-09-14  8:17 ` [dpdk-dev] [PATCH 3/5] mem: drop mapping API workaround David Marchand
2020-09-14  8:17 ` [dpdk-dev] [PATCH 4/5] eal: hide internal device event structure David Marchand
2020-09-14  8:17 ` [dpdk-dev] [PATCH 5/5] bus/pci: remove duplicate declaration David Marchand
2020-09-14  8:23 ` [dpdk-dev] [PATCH v2 0/6] 20.11 announced cleanups David Marchand
2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 1/6] ethdev: remove unused kernel driver field David Marchand
2020-09-14 10:14     ` Andrew Rybchenko
2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 2/6] bus/pci: switch to private kernel driver enum David Marchand
2020-09-14 10:19     ` Andrew Rybchenko
2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 3/6] pci: move resource mapping to the PCI bus David Marchand
2020-09-14 10:22     ` Andrew Rybchenko
2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 4/6] mem: drop mapping API workaround David Marchand
2020-09-14 10:22     ` Andrew Rybchenko
2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 5/6] eal: hide internal device event structure David Marchand
2020-09-18 14:56     ` Kinsella, Ray
2020-09-14  8:23   ` [dpdk-dev] [PATCH v2 6/6] bus/pci: remove duplicate declaration David Marchand
2020-09-14 10:24     ` Andrew Rybchenko
2020-09-17 11:28 ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand
2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 1/6] ethdev: remove unused kernel driver field David Marchand
2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 2/6] bus/pci: switch to private kernel driver enum David Marchand
2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 3/6] pci: move resource mapping to the PCI bus David Marchand
2020-09-18 13:43     ` Kinsella, Ray
2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 4/6] mem: drop mapping API workaround David Marchand
2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 5/6] eal: hide internal device event structure David Marchand
2020-09-18  3:40     ` Guo, Jia
2020-09-18 13:36       ` Kinsella, Ray
2020-09-17 11:28   ` [dpdk-dev] [PATCH v3 6/6] bus/pci: remove duplicate declaration David Marchand
2020-09-21  9:05   ` [dpdk-dev] [PATCH v3 0/6] 20.11 announced cleanups David Marchand

DPDK patches and discussions

Archives are clonable:
	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

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


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


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