DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shreyansh Jain <shreyansh.jain@nxp.com>
To: <dev@dpdk.org>
Cc: <hemant.agrawal@nxp.com>, <thomas@monjalon.net>,
	Shreyansh Jain <shreyansh.jain@nxp.com>
Subject: [dpdk-dev] [PATCH 2/6] bus/fslmc: introduce new device type enumerator
Date: Fri, 18 Aug 2017 18:21:23 +0530	[thread overview]
Message-ID: <20170818125127.22346-3-shreyansh.jain@nxp.com> (raw)
In-Reply-To: <20170818125127.22346-1-shreyansh.jain@nxp.com>

Existing devices and drivers depended on device ID rather than type.
A new enumerator for all DPAA2 devices is introduced in this patch.

At this point, the probe would not be able to link DPAA2 devices
with the driver and I/O would not work. Subsequent patches will
fix this.

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c              |  6 +++---
 drivers/bus/fslmc/rte_bus_fslmc_version.map |  7 +++++++
 drivers/bus/fslmc/rte_fslmc.h               | 24 ++++++++++++++++++++----
 3 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 3423b57..3b452e1 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -288,8 +288,8 @@ dpaa2_compare_dpaa2_dev(const struct rte_dpaa2_device *dev,
 			 const struct rte_dpaa2_device *dev2)
 {
 	/*not the same family device */
-	if (dev->dev_type != DPAA2_MC_DPNI_DEVID ||
-			dev->dev_type != DPAA2_MC_DPSECI_DEVID)
+	if (dev->dev_type != DPAA2_ETH ||
+			dev->dev_type != DPAA2_CRYPTO)
 		return -1;
 
 	if (dev->object_id == dev2->object_id)
@@ -506,7 +506,7 @@ int fslmc_vfio_process_group(void)
 			/* store hw_id of dpni/dpseci device */
 			dev->object_id = object_id;
 			dev->dev_type = (strcmp(object_type, "dpseci")) ?
-				DPAA2_MC_DPNI_DEVID : DPAA2_MC_DPSECI_DEVID;
+				DPAA2_ETH : DPAA2_CRYPTO;
 
 			sprintf(dev->name, "%s.%d", object_type, object_id);
 			dev->device.name = dev->name;
diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map
index 3cdf14e..6ac256d 100644
--- a/drivers/bus/fslmc/rte_bus_fslmc_version.map
+++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map
@@ -77,3 +77,10 @@ DPDK_17.08 {
 	rte_global_active_dqs_list;
 
 } DPDK_17.05;
+
+DPDK_17.11 {
+	global:
+
+	rte_dpaa2_dev_type;
+
+} DPDK_17.08;
diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h
index e60d6eb..ff7a49e 100644
--- a/drivers/bus/fslmc/rte_fslmc.h
+++ b/drivers/bus/fslmc/rte_fslmc.h
@@ -56,6 +56,8 @@ extern "C" {
 #include <rte_dev.h>
 #include <rte_bus.h>
 
+#define FSLMC_OBJECT_MAX_LEN 32   /**< Length of each device on bus */
+
 struct rte_dpaa2_driver;
 
 /* DPAA2 Device and Driver lists for FSLMC bus */
@@ -64,6 +66,20 @@ TAILQ_HEAD(rte_fslmc_driver_list, rte_dpaa2_driver);
 
 extern struct rte_fslmc_bus rte_fslmc_bus;
 
+enum rte_dpaa2_dev_type {
+	/* Devices backed by DPDK driver */
+	DPAA2_ETH,	/**< DPNI type device*/
+	DPAA2_CRYPTO,	/**< DPSECI type device */
+	DPAA2_CON,	/**< DPCONC type device */
+	/* Devices not backed by a DPDK driver: DPIO, DPBP, DPCI, DPMCP */
+	DPAA2_BPOOL,	/**< DPBP type device */
+	DPAA2_IO,	/**< DPIO type device */
+	DPAA2_CI,	/**< DPCI type device */
+	DPAA2_MPORTAL,  /**< DPMCP type device */
+	/* Unknown device placeholder */
+	DPAA2_UNKNOWN
+};
+
 /**
  * A structure describing a DPAA2 device.
  */
@@ -74,11 +90,11 @@ struct rte_dpaa2_device {
 		struct rte_eth_dev *eth_dev;        /**< ethernet device */
 		struct rte_cryptodev *cryptodev;    /**< Crypto Device */
 	};
-	uint16_t dev_type;                  /**< Device Type */
-	uint16_t object_id;             /**< DPAA2 Object ID */
+	enum rte_dpaa2_dev_type dev_type;   /**< Device Type */
+	uint16_t object_id;                 /**< DPAA2 Object ID */
 	struct rte_intr_handle intr_handle; /**< Interrupt handle */
 	struct rte_dpaa2_driver *driver;    /**< Associated driver */
-	char name[32];          /**< DPAA2 Object name*/
+	char name[FSLMC_OBJECT_MAX_LEN];    /**< DPAA2 Object name*/
 };
 
 typedef int (*rte_dpaa2_probe_t)(struct rte_dpaa2_driver *dpaa2_drv,
@@ -93,7 +109,7 @@ struct rte_dpaa2_driver {
 	struct rte_driver driver;           /**< Inherit core driver. */
 	struct rte_fslmc_bus *fslmc_bus;    /**< FSLMC bus reference */
 	uint32_t drv_flags;                 /**< Flags for controlling device.*/
-	uint16_t drv_type;                  /**< Driver Type */
+	enum rte_dpaa2_dev_type drv_type;   /**< Driver Type */
 	rte_dpaa2_probe_t probe;
 	rte_dpaa2_remove_t remove;
 };
-- 
2.9.3

  parent reply	other threads:[~2017-08-18 12:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18 12:51 [dpdk-dev] [PATCH 0/6] NXP DPAA2: Refactor bus scan/probe code Shreyansh Jain
2017-08-18 12:51 ` [dpdk-dev] [PATCH 1/6] bus/fslmc: support only single group and container Shreyansh Jain
2017-08-18 12:51 ` Shreyansh Jain [this message]
2017-08-18 12:51 ` [dpdk-dev] [PATCH 3/6] net/dpaa2: update driver type field Shreyansh Jain
2017-08-18 12:51 ` [dpdk-dev] [PATCH 4/6] crypto/dpaa2_sec: " Shreyansh Jain
2017-08-18 12:51 ` [dpdk-dev] [PATCH 5/6] drivers: refactor DPAA2 object definition Shreyansh Jain
2017-08-18 12:51 ` [dpdk-dev] [PATCH 6/6] bus/fslmc: refactor scan and probe functions Shreyansh Jain
2017-08-25 10:19 ` [dpdk-dev] [PATCH v2 0/6] NXP DPAA2: Refactor bus scan/probe code Shreyansh Jain
2017-08-25 10:19   ` [dpdk-dev] [PATCH v2 1/6] bus/fslmc: support only single group and container Shreyansh Jain
2017-09-18 11:15     ` santosh
2017-08-25 10:19   ` [dpdk-dev] [PATCH v2 2/6] bus/fslmc: introduce new device type enumerator Shreyansh Jain
2017-08-25 10:19   ` [dpdk-dev] [PATCH v2 3/6] crypto/dpaa2_sec: update driver type field Shreyansh Jain
2017-08-25 10:19   ` [dpdk-dev] [PATCH v2 4/6] net/dpaa2: " Shreyansh Jain
2017-08-25 10:19   ` [dpdk-dev] [PATCH v2 5/6] drivers: refactor DPAA2 object definition Shreyansh Jain
2017-08-25 10:19   ` [dpdk-dev] [PATCH v2 6/6] bus/fslmc: refactor scan and probe functions Shreyansh Jain
2017-09-11 14:06   ` [dpdk-dev] [PATCH v2 0/6] NXP DPAA2: Refactor bus scan/probe code Ferruh Yigit
2017-09-11 14:25     ` Shreyansh Jain
2017-09-25  7:07       ` Hemant Agrawal
2017-09-18 14:36     ` santosh
2017-10-05 23:09     ` 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=20170818125127.22346-3-shreyansh.jain@nxp.com \
    --to=shreyansh.jain@nxp.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=thomas@monjalon.net \
    /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).