There is no need to have a custom memory resource representation for
each infrastructure (PCI, ...) as it would always have the same members.

Signed-off-by: Jan Viktorin <viktorin at rehivetech.com>
Signed-off-by: Shreyansh Jain <shreyansh.jain at nxp.com>
---
 drivers/net/szedata2/rte_eth_szedata2.c |  4 ++--
 lib/librte_eal/common/include/rte_dev.h |  8 ++++++++
 lib/librte_eal/common/include/rte_pci.h | 11 +----------
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c 
b/drivers/net/szedata2/rte_eth_szedata2.c
index 6d21024..1b9e88a 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -1416,7 +1416,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)
        int ret;
        uint32_t szedata2_index;
        struct rte_pci_addr *pci_addr = &dev->pci_dev->addr;
-       struct rte_pci_resource *pci_rsc =
+       struct rte_mem_resource *pci_rsc =
                &dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER];
        char rsc_filename[PATH_MAX];
        void *pci_resource_ptr = NULL;
@@ -1473,7 +1473,7 @@ rte_szedata2_eth_dev_init(struct rte_eth_dev *dev)

        rte_eth_copy_pci_info(dev, dev->pci_dev);

-       /* mmap pci resource0 file to rte_pci_resource structure */
+       /* mmap pci resource0 file to rte_mem_resource structure */
        if (dev->pci_dev->mem_resource[PCI_RESOURCE_NUMBER].phys_addr ==
                        0) {
                RTE_LOG(ERR, PMD, "Missing resource%u file\n",
diff --git a/lib/librte_eal/common/include/rte_dev.h 
b/lib/librte_eal/common/include/rte_dev.h
index 3d0d2b8..5c314bf 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -100,6 +100,14 @@ rte_pmd_debug_trace(const char *func_name, const char 
*fmt, ...)
        } \
 } while (0)

+/**
+ * A generic memory resource representation.
+ */
+struct rte_mem_resource {
+       uint64_t phys_addr; /**< Physical address, 0 if not resource. */
+       uint64_t len;       /**< Length of the resource. */
+       void *addr;         /**< Virtual address, NULL when not mapped. */
+};

 /** Double linked list of device drivers. */
 TAILQ_HEAD(rte_driver_list, rte_driver);
diff --git a/lib/librte_eal/common/include/rte_pci.h 
b/lib/librte_eal/common/include/rte_pci.h
index e8e05da..e2d457a 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -108,15 +108,6 @@ const char *pci_get_sysfs_path(void);
 /** Nb. of values in PCI resource format. */
 #define PCI_RESOURCE_FMT_NVAL 3

-/**
- * A structure describing a PCI resource.
- */
-struct rte_pci_resource {
-       uint64_t phys_addr;   /**< Physical address, 0 if no resource. */
-       uint64_t len;         /**< Length of the resource. */
-       void *addr;           /**< Virtual address, NULL when not mapped. */
-};
-
 /** Maximum number of PCI resources. */
 #define PCI_MAX_RESOURCE 6

@@ -160,7 +151,7 @@ struct rte_pci_device {
        TAILQ_ENTRY(rte_pci_device) next;       /**< Next probed PCI device. */
        struct rte_pci_addr addr;               /**< PCI location. */
        struct rte_pci_id id;                   /**< PCI ID. */
-       struct rte_pci_resource mem_resource[PCI_MAX_RESOURCE];   /**< PCI 
Memory Resource */
+       struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE];   /**< PCI 
Memory Resource */
        struct rte_intr_handle intr_handle;     /**< Interrupt handle */
        struct rte_pci_driver *driver;          /**< Associated driver */
        uint16_t max_vfs;                       /**< sriov enable if not zero */
-- 
2.7.4

Reply via email to