DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jan Viktorin <viktorin@rehivetech.com>
To: dev@dpdk.org
Cc: Jan Viktorin <viktorin@rehivetech.com>,
	Shreyansh Jain <shreyansh.jain@nxp.com>,
	thomas.monjalon@6wind.com,
	David Marchand <david.marchand@6wind.com>
Subject: [dpdk-dev] [PATCH v1 10/15] eal: rename and move rte_pci_resource
Date: Fri,  8 Jul 2016 21:09:40 +0200	[thread overview]
Message-ID: <20160708190945.24225-11-viktorin@rehivetech.com> (raw)
In-Reply-To: <20160708190945.24225-1-viktorin@rehivetech.com>

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@rehivetech.com>
---
 drivers/net/szedata2/rte_eth_szedata2.c   |  4 ++--
 lib/librte_eal/common/include/rte_dev.h   |  9 +++++++++
 lib/librte_eal/common/include/rte_pci.h   | 11 +----------
 lib/librte_eal/linuxapp/eal/eal_ivshmem.c |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 6815dbb..d925bc6 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 225257e..2a0d326 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -100,6 +100,15 @@ 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 ec77cbc..950ea89 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -111,15 +111,6 @@ const char *pci_get_sysfs_path(void);
 /** Default sysfs path for PCI device search. */
 #define SYSFS_PCI_DEVICES "/sys/bus/pci/devices"
 
-/**
- * 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
 
@@ -163,7 +154,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 */
diff --git a/lib/librte_eal/linuxapp/eal/eal_ivshmem.c b/lib/librte_eal/linuxapp/eal/eal_ivshmem.c
index 67b3caf..20f9413 100644
--- a/lib/librte_eal/linuxapp/eal/eal_ivshmem.c
+++ b/lib/librte_eal/linuxapp/eal/eal_ivshmem.c
@@ -834,7 +834,7 @@ rte_eal_ivshmem_obj_init(void)
 int rte_eal_ivshmem_init(void)
 {
 	struct rte_pci_device * dev;
-	struct rte_pci_resource * res;
+	struct rte_mem_resource * res;
 	int fd, ret;
 	char path[PATH_MAX];
 
-- 
2.9.0

  parent reply	other threads:[~2016-07-08 19:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-08 19:09 [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 01/15] eal: extract vdev infra Jan Viktorin
2016-07-11 13:29   ` Shreyansh jain
2016-07-11 14:08     ` Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 02/15] eal: no need to test for PMD_VDEV anymore Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 03/15] eal: do not call init for PMD_PDEV drivers Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 04/15] drivers: convert PMD_VDEV drivers to use rte_vdev_driver Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 05/15] eal: move init/uninit to rte_vdev_driver Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 06/15] eal: remove PMD_REGISTER_DRIVER Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 07/15] eal: get rid of pmd_type Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 08/15] eal: define macro container_of Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 09/15] eal: rte_pci.h includes rte_dev.h Jan Viktorin
2016-07-08 19:09 ` Jan Viktorin [this message]
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 11/15] eal/pci: inherit rte_driver by rte_pci_driver Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 12/15] eal: call rte_eal_driver_register Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 13/15] eal: introduce rte_device Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 14/15] eal/pci: inherit rte_device by rte_pci_device Jan Viktorin
2016-07-08 19:09 ` [dpdk-dev] [PATCH v1 15/15] eal/pci: insert rte_device on scan Jan Viktorin
2016-07-11 13:13 ` [dpdk-dev] [PATCH v1 00/15] rte_driver/device infrastructure Shreyansh jain
2016-07-15 13:19 ` Thomas Monjalon
2016-07-15 15:33   ` Jan Viktorin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160708190945.24225-11-viktorin@rehivetech.com \
    --to=viktorin@rehivetech.com \
    --cc=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    --cc=shreyansh.jain@nxp.com \
    --cc=thomas.monjalon@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).