DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nipun Gupta <nipun.gupta@nxp.com>
To: <dev@dpdk.org>
Cc: <hemant.agrawal@nxp.com>, <jerin.jacob@caviumnetworks.com>,
	<harry.van.haaren@intel.com>, <bruce.richardson@intel.com>,
	<gage.eads@intel.com>, <shreyansh.jain@nxp.com>,
	Nipun Gupta <nipun.gupta@nxp.com>
Subject: [dpdk-dev] [PATCH 03/20] bus/fslmc: integrating dpio and dpbp to object framework
Date: Thu, 25 May 2017 23:37:34 +0530	[thread overview]
Message-ID: <1495735671-4917-4-git-send-email-nipun.gupta@nxp.com> (raw)
In-Reply-To: <1495735671-4917-1-git-send-email-nipun.gupta@nxp.com>

This patch removes the existing static call for dpio and dpbp
create and add them to object registration framework.

This patch also changes the vfio mc object processing to use
the framework.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c           | 24 ++++++++++--------------
 drivers/bus/fslmc/fslmc_vfio.h           |  9 ++-------
 drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 14 +++++++++++---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 11 +++++++++--
 4 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index b9ea358..07a9278 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -377,7 +377,6 @@ int fslmc_vfio_process_group(void)
 	char path[PATH_MAX];
 	int64_t v_addr;
 	int ndev_count;
-	int dpio_count = 0, dpbp_count = 0;
 	struct fslmc_vfio_group *group = &vfio_groups[0];
 	static int process_once;
 
@@ -520,18 +519,17 @@ int fslmc_vfio_process_group(void)
 				      object_type, object_id);
 
 			fslmc_bus_add_device(dev);
-		}
-		if (!strcmp(object_type, "dpio")) {
-			ret = dpaa2_create_dpio_device(vdev,
-						       &device_info,
+		} else {
+			/* Parse all other objects */
+			struct rte_dpaa2_object *object;
+
+			TAILQ_FOREACH(object, &fslmc_obj_list, next) {
+				if (!strcmp(object_type, object->name))
+					object->create(vdev, &device_info,
 						       object_id);
-			if (!ret)
-				dpio_count++;
-		}
-		if (!strcmp(object_type, "dpbp")) {
-			ret = dpaa2_create_dpbp_device(object_id);
-			if (!ret)
-				dpbp_count++;
+				else
+					continue;
+			}
 		}
 	}
 	closedir(d);
@@ -540,8 +538,6 @@ int fslmc_vfio_process_group(void)
 	if (ret)
 		FSLMC_VFIO_LOG(DEBUG, "Error in affining qbman swp %d", ret);
 
-	FSLMC_VFIO_LOG(DEBUG, "DPAA2: Added dpbp_count = %d dpio_count=%d\n",
-		      dpbp_count, dpio_count);
 	return 0;
 
 FAILURE:
diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h
index 58b3acd..ffed62e 100644
--- a/drivers/bus/fslmc/fslmc_vfio.h
+++ b/drivers/bus/fslmc/fslmc_vfio.h
@@ -39,6 +39,8 @@
 #define DPAA2_VENDOR_ID		0x1957
 #define DPAA2_MC_DPNI_DEVID	7
 #define DPAA2_MC_DPSECI_DEVID	3
+#define DPAA2_MC_DPIO_DEVID	9
+#define DPAA2_MC_DPBP_DEVID	10
 
 #define VFIO_MAX_GRP 1
 
@@ -90,13 +92,6 @@ int vfio_dmamap_mem_region(
 int fslmc_vfio_process_group(void);
 int rte_fslmc_vfio_dmamap(void);
 
-/* create dpio device */
-int dpaa2_create_dpio_device(struct fslmc_vfio_device *vdev,
-			     struct vfio_device_info *obj_info,
-			     int object_id);
-
-int dpaa2_create_dpbp_device(int dpbp_id);
-
 /**
  * Register a DPAA2 MC Object driver.
  *
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
index 2fb285c..7575bf9 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c
@@ -56,9 +56,10 @@
 TAILQ_HEAD(dpbp_device_list, dpaa2_dpbp_dev);
 static struct dpbp_device_list *dpbp_dev_list; /*!< DPBP device list */
 
-int
-dpaa2_create_dpbp_device(
-		int dpbp_id)
+static int
+dpaa2_create_dpbp_device(struct fslmc_vfio_device *vdev __rte_unused,
+			 struct vfio_device_info *obj_info __rte_unused,
+			 int dpbp_id)
 {
 	struct dpaa2_dpbp_dev *dpbp_node;
 	int ret;
@@ -137,3 +138,10 @@ void dpaa2_free_dpbp_dev(struct dpaa2_dpbp_dev *dpbp)
 		}
 	}
 }
+
+static struct rte_dpaa2_object rte_dpaa2_dpbp_obj = {
+	.object_id = DPAA2_MC_DPBP_DEVID,
+	.create = dpaa2_create_dpbp_device,
+};
+
+RTE_PMD_REGISTER_DPAA2_OBJECT(dpbp, rte_dpaa2_dpbp_obj);
diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index a1a58b9..1dcc91f 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -320,10 +320,10 @@ static inline struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(void)
 	}
 }
 
-int
+static int
 dpaa2_create_dpio_device(struct fslmc_vfio_device *vdev,
 			 struct vfio_device_info *obj_info,
-		int object_id)
+			 int object_id)
 {
 	struct dpaa2_dpio_dev *dpio_dev;
 	struct vfio_region_info reg_info = { .argsz = sizeof(reg_info)};
@@ -443,3 +443,10 @@ static inline struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(void)
 
 	return -1;
 }
+
+static struct rte_dpaa2_object rte_dpaa2_dpio_obj = {
+	.object_id = DPAA2_MC_DPIO_DEVID,
+	.create = dpaa2_create_dpio_device,
+};
+
+RTE_PMD_REGISTER_DPAA2_OBJECT(dpio, rte_dpaa2_dpio_obj);
-- 
1.9.1

  parent reply	other threads:[~2017-05-25 18:08 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25 18:07 [dpdk-dev] [PATCH 00/20] next-eventdev: NXP DPAA2 eventdev PMD Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 01/20] event/dpaa2: add basic build infrastructure Nipun Gupta
2017-05-31 14:59   ` Jerin Jacob
2017-05-25 18:07 ` [dpdk-dev] [PATCH 02/20] bus/fslmc: generic framework for mc object creation Nipun Gupta
2017-05-25 18:07 ` Nipun Gupta [this message]
2017-05-25 18:07 ` [dpdk-dev] [PATCH 04/20] bus/fslmc: adding basic dpcon support Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 05/20] bus/fslmc: export qbman dqrr funcs for eventdev usages Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 06/20] event/dpaa2: register dpcon as dpaa2 device for bus scan Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 07/20] bus/fslmc: adding basic dpci support Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 08/20] bus/fslmc: register dpci as dpaa2 device for bus scan Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 09/20] bus/fslmc: adding cpu support in stashing config Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 10/20] event/dpaa2: add initialization of event device Nipun Gupta
2017-05-31 15:10   ` Jerin Jacob
2017-06-01 10:25     ` Nipun Gupta
2017-06-01 10:39       ` Jerin Jacob
2017-05-25 18:07 ` [dpdk-dev] [PATCH 11/20] bus/fslmc: add support for static dequeue from portal Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 12/20] event/dpaa2: add configuration functions Nipun Gupta
2017-05-31 15:20   ` Jerin Jacob
2017-05-31 15:29   ` Jerin Jacob
2017-06-01 11:39     ` Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 13/20] bus/fslmc: support enqueue with multiple enqueue descriptors Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 14/20] bus/fslmc: add callback per queue to enable Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 15/20] bus/fslmc: change func argument to const to avoid warning Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 16/20] event/dpaa2: add enqueue and dequeue functionality Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 17/20] fslmc/bus: add interrupt enabling routine Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 18/20] bus/fslmc: enable portal interrupt handling Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 19/20] event/dpaa2: handle timeout using interrupts in dequeue Nipun Gupta
2017-05-31 15:49   ` Jerin Jacob
2017-06-01 11:42     ` Nipun Gupta
2017-05-25 18:07 ` [dpdk-dev] [PATCH 20/20] doc: add NXP DPAA2 EVENTDEV details Nipun Gupta
2017-05-31 15:58   ` Jerin Jacob
2017-06-01 12:07     ` Nipun Gupta
2017-05-31 14:50 ` [dpdk-dev] [PATCH 00/20] next-eventdev: NXP DPAA2 eventdev PMD Jerin Jacob
2017-05-31 16:17   ` Thomas Monjalon

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=1495735671-4917-4-git-send-email-nipun.gupta@nxp.com \
    --to=nipun.gupta@nxp.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=gage.eads@intel.com \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=shreyansh.jain@nxp.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).