DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nipun Gupta <nipun.gupta@nxp.com>
To: shreyansh.jain@nxp.com, thomas@monjalon.net, hemant.agrawal@nxp.com
Cc: dev@dpdk.org, Nipun Gupta <nipun.gupta@nxp.com>,
	Cristian Sovaiala <cristian.sovaiala@nxp.com>
Subject: [dpdk-dev] [PATCH 2/8 v4] bus/fslmc: support MC DPDMAI object
Date: Tue, 24 Apr 2018 17:19:43 +0530	[thread overview]
Message-ID: <1524570589-20148-3-git-send-email-nipun.gupta@nxp.com> (raw)
In-Reply-To: <1524570589-20148-1-git-send-email-nipun.gupta@nxp.com>

This patch adds the DPDMAI (Data Path DMA Interface)
object support in MC driver.

Signed-off-by: Cristian Sovaiala <cristian.sovaiala@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/Makefile                  |   9 +-
 drivers/bus/fslmc/mc/dpdmai.c               | 429 ++++++++++++++++++++++++++++
 drivers/bus/fslmc/mc/fsl_dpdmai.h           | 189 ++++++++++++
 drivers/bus/fslmc/mc/fsl_dpdmai_cmd.h       | 107 +++++++
 drivers/bus/fslmc/meson.build               |   1 +
 drivers/bus/fslmc/rte_bus_fslmc_version.map |   9 +
 6 files changed, 740 insertions(+), 4 deletions(-)
 create mode 100644 drivers/bus/fslmc/mc/dpdmai.c
 create mode 100644 drivers/bus/fslmc/mc/fsl_dpdmai.h
 create mode 100644 drivers/bus/fslmc/mc/fsl_dpdmai_cmd.h

diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile
index 3aa34e2..515d0f5 100644
--- a/drivers/bus/fslmc/Makefile
+++ b/drivers/bus/fslmc/Makefile
@@ -32,11 +32,12 @@ SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += \
 
 SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += \
 	mc/dpmng.c \
-        mc/dpbp.c \
-        mc/dpio.c \
-        mc/mc_sys.c \
+	mc/dpbp.c \
+	mc/dpio.c \
+	mc/mc_sys.c \
 	mc/dpcon.c \
-	mc/dpci.c
+	mc/dpci.c \
+	mc/dpdmai.c
 
 SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += portal/dpaa2_hw_dpio.c
 SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += portal/dpaa2_hw_dpbp.c
diff --git a/drivers/bus/fslmc/mc/dpdmai.c b/drivers/bus/fslmc/mc/dpdmai.c
new file mode 100644
index 0000000..528889d
--- /dev/null
+++ b/drivers/bus/fslmc/mc/dpdmai.c
@@ -0,0 +1,429 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#include <fsl_mc_sys.h>
+#include <fsl_mc_cmd.h>
+#include <fsl_dpdmai.h>
+#include <fsl_dpdmai_cmd.h>
+
+/**
+ * dpdmai_open() - Open a control session for the specified object
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @dpdmai_id:	DPDMAI unique ID
+ * @token:	Returned token; use in subsequent API calls
+ *
+ * This function can be used to open a control session for an
+ * already created object; an object may have been declared in
+ * the DPL or by calling the dpdmai_create() function.
+ * This function returns a unique authentication token,
+ * associated with the specific object ID and the specific MC
+ * portal; this token must be used in all subsequent commands for
+ * this specific object.
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmai_open(struct fsl_mc_io *mc_io,
+		uint32_t cmd_flags,
+		int dpdmai_id,
+		uint16_t *token)
+{
+	struct dpdmai_cmd_open *cmd_params;
+	struct mc_command cmd = { 0 };
+	int err;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_OPEN,
+					  cmd_flags,
+					  0);
+	cmd_params = (struct dpdmai_cmd_open *)cmd.params;
+	cmd_params->dpdmai_id = cpu_to_le32(dpdmai_id);
+
+	/* send command to mc*/
+	err = mc_send_command(mc_io, &cmd);
+	if (err)
+		return err;
+
+	/* retrieve response parameters */
+	*token = mc_cmd_hdr_read_token(&cmd);
+
+	return 0;
+}
+
+/**
+ * dpdmai_close() - Close the control session of the object
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPDMAI object
+ *
+ * After this function is called, no further operations are
+ * allowed on the object without opening a new control session.
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmai_close(struct fsl_mc_io *mc_io,
+		 uint32_t cmd_flags,
+		 uint16_t token)
+{
+	struct mc_command cmd = { 0 };
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_CLOSE,
+					  cmd_flags, token);
+
+	/* send command to mc*/
+	return mc_send_command(mc_io, &cmd);
+}
+
+/**
+ * dpdmai_create() - Create the DPDMAI object
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @dprc_token:	Parent container token; '0' for default container
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @cfg:	Configuration structure
+ * @obj_id:	Returned object id
+ *
+ * Create the DPDMAI object, allocate required resources and
+ * perform required initialization.
+ *
+ * The object can be created either by declaring it in the
+ * DPL file, or by calling this function.
+ *
+ * The function accepts an authentication token of a parent
+ * container that this object should be assigned to. The token
+ * can be '0' so the object will be assigned to the default container.
+ * The newly created object can be opened with the returned
+ * object id and using the container's associated tokens and MC portals.
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmai_create(struct fsl_mc_io *mc_io,
+		  uint16_t dprc_token,
+		  uint32_t cmd_flags,
+		  const struct dpdmai_cfg *cfg,
+		  uint32_t *obj_id)
+{
+	struct dpdmai_cmd_create *cmd_params;
+	struct mc_command cmd = { 0 };
+	int err;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_CREATE,
+					  cmd_flags,
+					  dprc_token);
+	cmd_params = (struct dpdmai_cmd_create *)cmd.params;
+	cmd_params->priorities[0] = cfg->priorities[0];
+	cmd_params->priorities[1] = cfg->priorities[1];
+
+	/* send command to mc*/
+	err = mc_send_command(mc_io, &cmd);
+	if (err)
+		return err;
+
+	/* retrieve response parameters */
+	*obj_id = mc_cmd_read_object_id(&cmd);
+
+	return 0;
+}
+
+/**
+ * dpdmai_destroy() - Destroy the DPDMAI object and release all its resources.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @dprc_token: Parent container token; '0' for default container
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @object_id:	The object id; it must be a valid id within the container that
+ *		created this object;
+ *
+ * The function accepts the authentication token of the parent container that
+ * created the object (not the one that currently owns the object). The object
+ * is searched within parent using the provided 'object_id'.
+ * All tokens to the object must be closed before calling destroy.
+ *
+ * Return:	'0' on Success; error code otherwise.
+ */
+int dpdmai_destroy(struct fsl_mc_io *mc_io,
+		   uint16_t dprc_token,
+		   uint32_t cmd_flags,
+		   uint32_t object_id)
+{
+	struct dpdmai_cmd_destroy *cmd_params;
+	struct mc_command cmd = { 0 };
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_DESTROY,
+					  cmd_flags,
+					  dprc_token);
+	cmd_params = (struct dpdmai_cmd_destroy *)cmd.params;
+	cmd_params->dpdmai_id = cpu_to_le32(object_id);
+
+	/* send command to mc*/
+	return mc_send_command(mc_io, &cmd);
+}
+
+/**
+ * dpdmai_enable() - Enable the DPDMAI, allow sending and receiving frames.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPDMAI object
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmai_enable(struct fsl_mc_io *mc_io,
+		  uint32_t cmd_flags,
+		  uint16_t token)
+{
+	struct mc_command cmd = { 0 };
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_ENABLE,
+					  cmd_flags,
+					  token);
+
+	/* send command to mc*/
+	return mc_send_command(mc_io, &cmd);
+}
+
+/**
+ * dpdmai_disable() - Disable the DPDMAI, stop sending and receiving frames.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPDMAI object
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmai_disable(struct fsl_mc_io *mc_io,
+		   uint32_t cmd_flags,
+		   uint16_t token)
+{
+	struct mc_command cmd = { 0 };
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_DISABLE,
+					  cmd_flags,
+					  token);
+
+	/* send command to mc*/
+	return mc_send_command(mc_io, &cmd);
+}
+
+/**
+ * dpdmai_is_enabled() - Check if the DPDMAI is enabled.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPDMAI object
+ * @en:		Returns '1' if object is enabled; '0' otherwise
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmai_is_enabled(struct fsl_mc_io *mc_io,
+		      uint32_t cmd_flags,
+		      uint16_t token,
+		      int *en)
+{
+	struct dpdmai_rsp_is_enabled *rsp_params;
+	struct mc_command cmd = { 0 };
+	int err;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_IS_ENABLED,
+					  cmd_flags,
+					  token);
+
+	/* send command to mc*/
+	err = mc_send_command(mc_io, &cmd);
+	if (err)
+		return err;
+
+	/* retrieve response parameters */
+	rsp_params = (struct dpdmai_rsp_is_enabled *)cmd.params;
+	*en = dpdmai_get_field(rsp_params->en, ENABLE);
+
+	return 0;
+}
+
+/**
+ * dpdmai_reset() - Reset the DPDMAI, returns the object to initial state.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPDMAI object
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmai_reset(struct fsl_mc_io *mc_io,
+		 uint32_t cmd_flags,
+		 uint16_t token)
+{
+	struct mc_command cmd = { 0 };
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_RESET,
+					  cmd_flags,
+					  token);
+
+	/* send command to mc*/
+	return mc_send_command(mc_io, &cmd);
+}
+
+/**
+ * dpdmai_get_attributes() - Retrieve DPDMAI attributes.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPDMAI object
+ * @attr:	Returned object's attributes
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmai_get_attributes(struct fsl_mc_io *mc_io,
+			  uint32_t cmd_flags,
+			  uint16_t token,
+			  struct dpdmai_attr *attr)
+{
+	struct dpdmai_rsp_get_attr *rsp_params;
+	struct mc_command cmd = { 0 };
+	int err;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_GET_ATTR,
+					  cmd_flags,
+					  token);
+
+	/* send command to mc*/
+	err = mc_send_command(mc_io, &cmd);
+	if (err)
+		return err;
+
+	/* retrieve response parameters */
+	rsp_params = (struct dpdmai_rsp_get_attr *)cmd.params;
+	attr->id = le32_to_cpu(rsp_params->id);
+	attr->num_of_priorities = rsp_params->num_of_priorities;
+
+	return 0;
+}
+
+/**
+ * dpdmai_set_rx_queue() - Set Rx queue configuration
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPDMAI object
+ * @priority:	Select the queue relative to number of
+ *		priorities configured at DPDMAI creation; use
+ *		DPDMAI_ALL_QUEUES to configure all Rx queues
+ *		identically.
+ * @cfg:	Rx queue configuration
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmai_set_rx_queue(struct fsl_mc_io *mc_io,
+			uint32_t cmd_flags,
+			uint16_t token,
+			uint8_t priority,
+			const struct dpdmai_rx_queue_cfg *cfg)
+{
+	struct dpdmai_cmd_set_rx_queue *cmd_params;
+	struct mc_command cmd = { 0 };
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_SET_RX_QUEUE,
+					  cmd_flags,
+					  token);
+	cmd_params = (struct dpdmai_cmd_set_rx_queue *)cmd.params;
+	cmd_params->dest_id = cpu_to_le32(cfg->dest_cfg.dest_id);
+	cmd_params->dest_priority = cfg->dest_cfg.priority;
+	cmd_params->priority = priority;
+	cmd_params->user_ctx = cpu_to_le64(cfg->user_ctx);
+	cmd_params->options = cpu_to_le32(cfg->options);
+	dpdmai_set_field(cmd_params->dest_type,
+			 DEST_TYPE,
+			 cfg->dest_cfg.dest_type);
+
+	/* send command to mc*/
+	return mc_send_command(mc_io, &cmd);
+}
+
+/**
+ * dpdmai_get_rx_queue() - Retrieve Rx queue attributes.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPDMAI object
+ * @priority:	Select the queue relative to number of
+ *		priorities configured at DPDMAI creation
+ * @attr:	Returned Rx queue attributes
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmai_get_rx_queue(struct fsl_mc_io *mc_io,
+			uint32_t cmd_flags,
+			uint16_t token,
+			uint8_t priority,
+			struct dpdmai_rx_queue_attr *attr)
+{
+	struct dpdmai_cmd_get_queue *cmd_params;
+	struct dpdmai_rsp_get_rx_queue *rsp_params;
+	struct mc_command cmd = { 0 };
+	int err;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_GET_RX_QUEUE,
+					  cmd_flags,
+					  token);
+	cmd_params = (struct dpdmai_cmd_get_queue *)cmd.params;
+	cmd_params->priority = priority;
+
+	/* send command to mc*/
+	err = mc_send_command(mc_io, &cmd);
+	if (err)
+		return err;
+
+	/* retrieve response parameters */
+	rsp_params = (struct dpdmai_rsp_get_rx_queue *)cmd.params;
+	attr->user_ctx = le64_to_cpu(rsp_params->user_ctx);
+	attr->fqid = le32_to_cpu(rsp_params->fqid);
+	attr->dest_cfg.dest_id = le32_to_cpu(rsp_params->dest_id);
+	attr->dest_cfg.priority = le32_to_cpu(rsp_params->dest_priority);
+	attr->dest_cfg.dest_type = dpdmai_get_field(rsp_params->dest_type,
+						    DEST_TYPE);
+
+	return 0;
+}
+
+/**
+ * dpdmai_get_tx_queue() - Retrieve Tx queue attributes.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPDMAI object
+ * @priority:	Select the queue relative to number of
+ *		priorities configured at DPDMAI creation
+ * @attr:	Returned Tx queue attributes
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmai_get_tx_queue(struct fsl_mc_io *mc_io,
+			uint32_t cmd_flags,
+			uint16_t token,
+			uint8_t priority,
+			struct dpdmai_tx_queue_attr *attr)
+{
+	struct dpdmai_cmd_get_queue *cmd_params;
+	struct dpdmai_rsp_get_tx_queue *rsp_params;
+	struct mc_command cmd = { 0 };
+	int err;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMAI_CMDID_GET_TX_QUEUE,
+					  cmd_flags,
+					  token);
+	cmd_params = (struct dpdmai_cmd_get_queue *)cmd.params;
+	cmd_params->priority = priority;
+
+	/* send command to mc*/
+	err = mc_send_command(mc_io, &cmd);
+	if (err)
+		return err;
+
+	/* retrieve response parameters */
+	rsp_params = (struct dpdmai_rsp_get_tx_queue *)cmd.params;
+	attr->fqid = le32_to_cpu(rsp_params->fqid);
+
+	return 0;
+}
diff --git a/drivers/bus/fslmc/mc/fsl_dpdmai.h b/drivers/bus/fslmc/mc/fsl_dpdmai.h
new file mode 100644
index 0000000..03e46ec
--- /dev/null
+++ b/drivers/bus/fslmc/mc/fsl_dpdmai.h
@@ -0,0 +1,189 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#ifndef __FSL_DPDMAI_H
+#define __FSL_DPDMAI_H
+
+struct fsl_mc_io;
+
+/* Data Path DMA Interface API
+ * Contains initialization APIs and runtime control APIs for DPDMAI
+ */
+
+/* General DPDMAI macros */
+
+/**
+ * Maximum number of Tx/Rx priorities per DPDMAI object
+ */
+#define DPDMAI_PRIO_NUM		2
+
+/**
+ * All queues considered; see dpdmai_set_rx_queue()
+ */
+#define DPDMAI_ALL_QUEUES	(uint8_t)(-1)
+
+int dpdmai_open(struct fsl_mc_io *mc_io,
+		uint32_t cmd_flags,
+		int dpdmai_id,
+		uint16_t *token);
+
+int dpdmai_close(struct fsl_mc_io *mc_io,
+		 uint32_t cmd_flags,
+		 uint16_t token);
+
+/**
+ * struct dpdmai_cfg - Structure representing DPDMAI configuration
+ * @priorities: Priorities for the DMA hardware processing; valid priorities are
+ *	configured with values 1-8; the entry following last valid entry
+ *	should be configured with 0
+ */
+struct dpdmai_cfg {
+	uint8_t priorities[DPDMAI_PRIO_NUM];
+};
+
+int dpdmai_create(struct fsl_mc_io *mc_io,
+		  uint16_t dprc_token,
+		  uint32_t cmd_flags,
+		  const struct dpdmai_cfg *cfg,
+		  uint32_t *obj_id);
+
+int dpdmai_destroy(struct fsl_mc_io *mc_io,
+		   uint16_t dprc_token,
+		   uint32_t cmd_flags,
+		   uint32_t object_id);
+
+int dpdmai_enable(struct fsl_mc_io *mc_io,
+		  uint32_t cmd_flags,
+		  uint16_t token);
+
+int dpdmai_disable(struct fsl_mc_io *mc_io,
+		   uint32_t cmd_flags,
+		   uint16_t token);
+
+int dpdmai_is_enabled(struct fsl_mc_io *mc_io,
+		      uint32_t cmd_flags,
+		      uint16_t token,
+		      int *en);
+
+int dpdmai_reset(struct fsl_mc_io *mc_io,
+		 uint32_t cmd_flags,
+		 uint16_t token);
+
+/**
+ * struct dpdmai_attr - Structure representing DPDMAI attributes
+ * @id: DPDMAI object ID
+ * @num_of_priorities: number of priorities
+ */
+struct dpdmai_attr {
+	int id;
+	uint8_t num_of_priorities;
+};
+
+int dpdmai_get_attributes(struct fsl_mc_io *mc_io,
+			  uint32_t cmd_flags,
+			  uint16_t token,
+			  struct dpdmai_attr *attr);
+
+/**
+ * enum dpdmai_dest - DPDMAI destination types
+ * @DPDMAI_DEST_NONE: Unassigned destination; The queue is set in parked mode
+ *	and does not generate FQDAN notifications; user is expected to dequeue
+ *	from the queue based on polling or other user-defined method
+ * @DPDMAI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN
+ *	notifications to the specified DPIO; user is expected to dequeue
+ *	from the queue only after notification is received
+ * @DPDMAI_DEST_DPCON: The queue is set in schedule mode and does not generate
+ *	FQDAN notifications, but is connected to the specified DPCON object;
+ *	user is expected to dequeue from the DPCON channel
+ */
+enum dpdmai_dest {
+	DPDMAI_DEST_NONE = 0,
+	DPDMAI_DEST_DPIO = 1,
+	DPDMAI_DEST_DPCON = 2
+};
+
+/**
+ * struct dpdmai_dest_cfg - Structure representing DPDMAI destination parameters
+ * @dest_type: Destination type
+ * @dest_id: Either DPIO ID or DPCON ID, depending on the destination type
+ * @priority: Priority selection within the DPIO or DPCON channel; valid values
+ *	are 0-1 or 0-7, depending on the number of priorities in that
+ *	channel; not relevant for 'DPDMAI_DEST_NONE' option
+ */
+struct dpdmai_dest_cfg {
+	enum dpdmai_dest dest_type;
+	int dest_id;
+	uint8_t priority;
+};
+
+/* DPDMAI queue modification options */
+
+/**
+ * Select to modify the user's context associated with the queue
+ */
+#define DPDMAI_QUEUE_OPT_USER_CTX	0x00000001
+
+/**
+ * Select to modify the queue's destination
+ */
+#define DPDMAI_QUEUE_OPT_DEST		0x00000002
+
+/**
+ * struct dpdmai_rx_queue_cfg - DPDMAI RX queue configuration
+ * @options: Flags representing the suggested modifications to the queue;
+ *	Use any combination of 'DPDMAI_QUEUE_OPT_<X>' flags
+ * @user_ctx: User context value provided in the frame descriptor of each
+ *	dequeued frame;
+ *	valid only if 'DPDMAI_QUEUE_OPT_USER_CTX' is contained in 'options'
+ * @dest_cfg: Queue destination parameters;
+ *	valid only if 'DPDMAI_QUEUE_OPT_DEST' is contained in 'options'
+ */
+struct dpdmai_rx_queue_cfg {
+	uint32_t options;
+	uint64_t user_ctx;
+	struct dpdmai_dest_cfg dest_cfg;
+
+};
+
+int dpdmai_set_rx_queue(struct fsl_mc_io *mc_io,
+			uint32_t cmd_flags,
+			uint16_t token,
+			uint8_t priority,
+			const struct dpdmai_rx_queue_cfg *cfg);
+
+/**
+ * struct dpdmai_rx_queue_attr - Structure representing attributes of Rx queues
+ * @user_ctx:  User context value provided in the frame descriptor of each
+ *	 dequeued frame
+ * @dest_cfg: Queue destination configuration
+ * @fqid: Virtual FQID value to be used for dequeue operations
+ */
+struct dpdmai_rx_queue_attr {
+	uint64_t user_ctx;
+	struct dpdmai_dest_cfg dest_cfg;
+	uint32_t fqid;
+};
+
+int dpdmai_get_rx_queue(struct fsl_mc_io *mc_io,
+			uint32_t cmd_flags,
+			uint16_t token,
+			uint8_t priority,
+			struct dpdmai_rx_queue_attr *attr);
+
+/**
+ * struct dpdmai_tx_queue_attr - Structure representing attributes of Tx queues
+ * @fqid: Virtual FQID to be used for sending frames to DMA hardware
+ */
+
+struct dpdmai_tx_queue_attr {
+	uint32_t fqid;
+};
+
+int dpdmai_get_tx_queue(struct fsl_mc_io *mc_io,
+			uint32_t cmd_flags,
+			uint16_t token,
+			uint8_t priority,
+			struct dpdmai_tx_queue_attr *attr);
+
+#endif /* __FSL_DPDMAI_H */
diff --git a/drivers/bus/fslmc/mc/fsl_dpdmai_cmd.h b/drivers/bus/fslmc/mc/fsl_dpdmai_cmd.h
new file mode 100644
index 0000000..618e19e
--- /dev/null
+++ b/drivers/bus/fslmc/mc/fsl_dpdmai_cmd.h
@@ -0,0 +1,107 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018 NXP
+ */
+
+#ifndef _FSL_DPDMAI_CMD_H
+#define _FSL_DPDMAI_CMD_H
+
+/* DPDMAI Version */
+#define DPDMAI_VER_MAJOR		3
+#define DPDMAI_VER_MINOR		2
+
+/* Command versioning */
+#define DPDMAI_CMD_BASE_VERSION		1
+#define DPDMAI_CMD_ID_OFFSET		4
+
+#define DPDMAI_CMD(id)	((id << DPDMAI_CMD_ID_OFFSET) | DPDMAI_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPDMAI_CMDID_CLOSE		DPDMAI_CMD(0x800)
+#define DPDMAI_CMDID_OPEN		DPDMAI_CMD(0x80E)
+#define DPDMAI_CMDID_CREATE		DPDMAI_CMD(0x90E)
+#define DPDMAI_CMDID_DESTROY		DPDMAI_CMD(0x98E)
+#define DPDMAI_CMDID_GET_API_VERSION	DPDMAI_CMD(0xa0E)
+
+#define DPDMAI_CMDID_ENABLE		DPDMAI_CMD(0x002)
+#define DPDMAI_CMDID_DISABLE		DPDMAI_CMD(0x003)
+#define DPDMAI_CMDID_GET_ATTR		DPDMAI_CMD(0x004)
+#define DPDMAI_CMDID_RESET		DPDMAI_CMD(0x005)
+#define DPDMAI_CMDID_IS_ENABLED		DPDMAI_CMD(0x006)
+
+#define DPDMAI_CMDID_SET_RX_QUEUE	DPDMAI_CMD(0x1A0)
+#define DPDMAI_CMDID_GET_RX_QUEUE	DPDMAI_CMD(0x1A1)
+#define DPDMAI_CMDID_GET_TX_QUEUE	DPDMAI_CMD(0x1A2)
+
+/* Macros for accessing command fields smaller than 1byte */
+#define DPDMAI_MASK(field)        \
+	GENMASK(DPDMAI_##field##_SHIFT + DPDMAI_##field##_SIZE - 1, \
+		DPDMAI_##field##_SHIFT)
+#define dpdmai_set_field(var, field, val) \
+	((var) |= (((val) << DPDMAI_##field##_SHIFT) & DPDMAI_MASK(field)))
+#define dpdmai_get_field(var, field)      \
+	(((var) & DPDMAI_MASK(field)) >> DPDMAI_##field##_SHIFT)
+
+#pragma pack(push, 1)
+struct dpdmai_cmd_open {
+	uint32_t dpdmai_id;
+};
+
+struct dpdmai_cmd_create {
+	uint8_t pad;
+	uint8_t priorities[2];
+};
+
+struct dpdmai_cmd_destroy {
+	uint32_t dpdmai_id;
+};
+
+#define DPDMAI_ENABLE_SHIFT	0
+#define DPDMAI_ENABLE_SIZE	1
+
+struct dpdmai_rsp_is_enabled {
+	/* only the LSB bit */
+	uint8_t en;
+};
+
+struct dpdmai_rsp_get_attr {
+	uint32_t id;
+	uint8_t num_of_priorities;
+};
+
+#define DPDMAI_DEST_TYPE_SHIFT	0
+#define DPDMAI_DEST_TYPE_SIZE	4
+
+struct dpdmai_cmd_set_rx_queue {
+	uint32_t dest_id;
+	uint8_t dest_priority;
+	uint8_t priority;
+	/* from LSB: dest_type:4 */
+	uint8_t dest_type;
+	uint8_t pad;
+	uint64_t user_ctx;
+	uint32_t options;
+};
+
+struct dpdmai_cmd_get_queue {
+	uint8_t pad[5];
+	uint8_t priority;
+};
+
+struct dpdmai_rsp_get_rx_queue {
+	uint32_t dest_id;
+	uint8_t dest_priority;
+	uint8_t pad1;
+	/* from LSB: dest_type:4 */
+	uint8_t dest_type;
+	uint8_t pad2;
+	uint64_t user_ctx;
+	uint32_t fqid;
+};
+
+struct dpdmai_rsp_get_tx_queue {
+	uint64_t pad;
+	uint32_t fqid;
+};
+
+#pragma pack(pop)
+#endif /* _FSL_DPDMAI_CMD_H */
diff --git a/drivers/bus/fslmc/meson.build b/drivers/bus/fslmc/meson.build
index 890d6c0..22a56a6 100644
--- a/drivers/bus/fslmc/meson.build
+++ b/drivers/bus/fslmc/meson.build
@@ -11,6 +11,7 @@ sources = files('fslmc_bus.c',
 		'mc/dpbp.c',
 		'mc/dpci.c',
 		'mc/dpcon.c',
+		'mc/dpdmai.c',
 		'mc/dpio.c',
 		'mc/dpmng.c',
 		'mc/mc_sys.c',
diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map
index f519651..70fb719 100644
--- a/drivers/bus/fslmc/rte_bus_fslmc_version.map
+++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map
@@ -105,5 +105,14 @@ DPDK_18.05 {
 	global:
 
 	dpaa2_affine_qbman_ethrx_swp;
+	dpdmai_close;
+	dpdmai_disable;
+	dpdmai_enable;
+	dpdmai_get_attributes;
+	dpdmai_get_rx_queue;
+	dpdmai_get_tx_queue;
+	dpdmai_open;
+	dpdmai_set_rx_queue;
+	dpdmai_set_tx_queue;
 
 } DPDK_18.02;
-- 
1.9.1

  parent reply	other threads:[~2018-04-24 11:50 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-07 15:16 [dpdk-dev] [PATCH 0/8] Introduce DPAA2 QDMA raw driver Nipun Gupta
2018-04-07 15:16 ` [dpdk-dev] [PATCH 1/8] bus/fslmc: support MC DPDMAI object Nipun Gupta
2018-04-16 11:46   ` Shreyansh Jain
2018-04-07 15:16 ` [dpdk-dev] [PATCH 2/8] bus/fslmc: support scanning and probing of QDMA devices Nipun Gupta
2018-04-16 11:58   ` Shreyansh Jain
2018-04-07 15:16 ` [dpdk-dev] [PATCH 3/8] bus/fslmc: add macros required by QDMA for FLE and FD Nipun Gupta
2018-04-16 12:23   ` Shreyansh Jain
2018-04-07 15:17 ` [dpdk-dev] [PATCH 4/8] raw/dpaa2_qdma: introduce the DPAA2 QDMA driver Nipun Gupta
2018-04-16 13:46   ` Shreyansh Jain
2018-04-07 15:17 ` [dpdk-dev] [PATCH 5/8] raw/dpaa2_qdma: support configuration APIs Nipun Gupta
2018-04-07 15:17 ` [dpdk-dev] [PATCH 6/8] raw/dpaa2_qdma: support enq and deq operations Nipun Gupta
2018-04-16 14:01   ` Shreyansh Jain
2018-04-07 15:17 ` [dpdk-dev] [PATCH 7/8] doc: add DPAA2 QDMA rawdev guide Nipun Gupta
2018-04-16 14:04   ` Shreyansh Jain
2018-04-07 15:17 ` [dpdk-dev] [PATCH 8/8] doc: add dpaa2 qdma rawdev to release notes Nipun Gupta
2018-04-20  4:04 ` [dpdk-dev] [PATCH 0/9 v2] Introduce DPAA2 QDMA raw driver Nipun Gupta
2018-04-20  4:04   ` [dpdk-dev] [PATCH 1/9 v2] bus/fslmc: support MC DPDMAI object Nipun Gupta
2018-04-20  4:04   ` [dpdk-dev] [PATCH 2/9 v2] bus/fslmc: support scanning and probing of QDMA devices Nipun Gupta
2018-04-20  4:04   ` [dpdk-dev] [PATCH 3/9 v2] bus/fslmc: add macros required by QDMA for FLE and FD Nipun Gupta
2018-04-20  9:17     ` Hemant Agrawal
2018-04-20  4:04   ` [dpdk-dev] [PATCH 4/9 v2] bus/fslmc: fix typecasting in IOVA/virt conversion macros Nipun Gupta
2018-04-20  4:04   ` [dpdk-dev] [PATCH 5/9 v2] raw/dpaa2_qdma: introduce the DPAA2 QDMA driver Nipun Gupta
2018-04-20  4:04   ` [dpdk-dev] [PATCH 6/9 v2] raw/dpaa2_qdma: support configuration APIs Nipun Gupta
2018-04-20  4:04   ` [dpdk-dev] [PATCH 7/9 v2] raw/dpaa2_qdma: support enq and deq operations Nipun Gupta
2018-04-20  4:04   ` [dpdk-dev] [PATCH 8/9 v2] doc: add DPAA2 QDMA rawdev guide Nipun Gupta
2018-04-20  4:04   ` [dpdk-dev] [PATCH 9/9 v2] doc: add dpaa2 qdma rawdev to release notes Nipun Gupta
2018-04-20  4:10   ` [dpdk-dev] [PATCH 0/9 v2] Introduce DPAA2 QDMA raw driver Nipun Gupta
2018-04-20 10:34     ` Nipun Gupta
2018-04-20 10:30 ` [dpdk-dev] [PATCH 0/9 v3] " Nipun Gupta
2018-04-20 10:30   ` [dpdk-dev] [PATCH 1/9 v3] bus/fslmc: support MC DPDMAI object Nipun Gupta
2018-04-20 10:30   ` [dpdk-dev] [PATCH 2/9 v3] bus/fslmc: support scanning and probing of QDMA devices Nipun Gupta
2018-04-20 10:30   ` [dpdk-dev] [PATCH 3/9 v3] bus/fslmc: add macros required by QDMA for FLE and FD Nipun Gupta
2018-04-20 10:30   ` [dpdk-dev] [PATCH 4/9 v3] bus/fslmc: fix typecasting in IOVA/virt conversion macros Nipun Gupta
2018-04-20 10:31   ` [dpdk-dev] [PATCH 5/9 v3] raw/dpaa2_qdma: introduce the DPAA2 QDMA driver Nipun Gupta
2018-04-20 10:31   ` [dpdk-dev] [PATCH 6/9 v3] raw/dpaa2_qdma: support configuration APIs Nipun Gupta
2018-04-20 10:31   ` [dpdk-dev] [PATCH 7/9 v3] raw/dpaa2_qdma: support enq and deq operations Nipun Gupta
2018-04-20 10:31   ` [dpdk-dev] [PATCH 8/9 v3] doc: add DPAA2 QDMA rawdev guide Nipun Gupta
2018-04-20 10:31   ` [dpdk-dev] [PATCH 9/9 v3] doc: add dpaa2 qdma rawdev to release notes Nipun Gupta
2018-04-23  0:03     ` Thomas Monjalon
2018-04-23  8:45       ` Nipun Gupta
2018-04-23  0:05   ` [dpdk-dev] [PATCH 0/9 v3] Introduce DPAA2 QDMA raw driver Thomas Monjalon
2018-04-23  8:46     ` Nipun Gupta
2018-04-24 11:49 ` [dpdk-dev] [PATCH 0/8 v4] " Nipun Gupta
2018-04-24 11:49   ` [dpdk-dev] [PATCH 1/8 v4] raw: support meson build Nipun Gupta
2018-04-26  6:58     ` Shreyansh Jain
2018-04-24 11:49   ` Nipun Gupta [this message]
2018-04-24 11:49   ` [dpdk-dev] [PATCH 3/8 v4] bus/fslmc: support scanning and probing of QDMA devices Nipun Gupta
2018-04-24 11:49   ` [dpdk-dev] [PATCH 4/8 v4] bus/fslmc: add macros required by QDMA for FLE and FD Nipun Gupta
2018-04-24 11:49   ` [dpdk-dev] [PATCH 5/8 v4] raw/dpaa2_qdma: introduce the DPAA2 QDMA driver Nipun Gupta
2018-04-30 12:34     ` Thomas Monjalon
2018-05-01  6:14       ` Nipun Gupta
2018-05-01  6:21         ` Nipun Gupta
2018-04-24 11:49   ` [dpdk-dev] [PATCH 6/8 v4] raw/dpaa2_qdma: support configuration APIs Nipun Gupta
2018-04-24 11:49   ` [dpdk-dev] [PATCH 7/8 v4] raw/dpaa2_qdma: support enq and deq operations Nipun Gupta
2018-04-24 11:49   ` [dpdk-dev] [PATCH 8/8 v4] doc: add DPAA2 QDMA rawdev guide Nipun Gupta
2018-05-01  9:58   ` [dpdk-dev] [PATCH v5 0/8] Introduce DPAA2 QDMA raw driver Nipun Gupta
2018-05-01  9:58     ` [dpdk-dev] [PATCH v5 1/8] raw: support meson build Nipun Gupta
2018-05-01  9:58     ` [dpdk-dev] [PATCH v5 2/8] bus/fslmc: support MC DPDMAI object Nipun Gupta
2018-05-01  9:58     ` [dpdk-dev] [PATCH v5 3/8] bus/fslmc: support scanning and probing of QDMA devices Nipun Gupta
2018-05-01  9:58     ` [dpdk-dev] [PATCH v5 4/8] bus/fslmc: add macros required by QDMA for FLE and FD Nipun Gupta
2018-05-01  9:58     ` [dpdk-dev] [PATCH v5 5/8] raw/dpaa2_qdma: introduce the DPAA2 QDMA driver Nipun Gupta
2018-05-01  9:58     ` [dpdk-dev] [PATCH v6 6/8] raw/dpaa2_qdma: support configuration APIs Nipun Gupta
2018-05-01  9:58     ` [dpdk-dev] [PATCH v5 7/8] raw/dpaa2_qdma: support enq and deq operations Nipun Gupta
2018-05-01  9:58     ` [dpdk-dev] [PATCH v5 8/8] doc: add DPAA2 QDMA rawdev guide Nipun Gupta
2018-05-02 17:09     ` [dpdk-dev] [PATCH v6 0/8] Introduce DPAA2 QDMA raw driver Nipun Gupta
2018-05-02 17:09       ` [dpdk-dev] [PATCH v6 1/8] raw: support meson build Nipun Gupta
2018-05-02 17:09       ` [dpdk-dev] [PATCH v6 2/8] bus/fslmc: support MC DPDMAI object Nipun Gupta
2018-05-02 17:09       ` [dpdk-dev] [PATCH v6 3/8] bus/fslmc: support scanning and probing of QDMA devices Nipun Gupta
2018-05-02 17:09       ` [dpdk-dev] [PATCH v6 4/8] bus/fslmc: add macros required by QDMA for FLE and FD Nipun Gupta
2018-05-02 17:09       ` [dpdk-dev] [PATCH v6 5/8] raw/dpaa2_qdma: introduce the DPAA2 QDMA driver Nipun Gupta
2018-05-03 14:07         ` Shreyansh Jain
2018-05-02 17:09       ` [dpdk-dev] [PATCH v6 6/8] raw/dpaa2_qdma: support configuration APIs Nipun Gupta
2018-05-02 17:09       ` [dpdk-dev] [PATCH v6 7/8] raw/dpaa2_qdma: support enq and deq operations Nipun Gupta
2018-05-02 17:09       ` [dpdk-dev] [PATCH v6 8/8] doc: add DPAA2 QDMA rawdev guide Nipun Gupta
2018-05-03 15:51       ` [dpdk-dev] [PATCH v7 0/8] Introduce DPAA2 QDMA raw driver Nipun Gupta
2018-05-03 15:51         ` [dpdk-dev] [PATCH v7 1/8] raw: support meson build Nipun Gupta
2018-05-03 15:51         ` [dpdk-dev] [PATCH v7 2/8] bus/fslmc: support MC DPDMAI object Nipun Gupta
2018-05-03 15:51         ` [dpdk-dev] [PATCH v7 3/8] bus/fslmc: support scanning and probing of QDMA devices Nipun Gupta
2018-05-03 15:51         ` [dpdk-dev] [PATCH v7 4/8] bus/fslmc: add macros required by QDMA for FLE and FD Nipun Gupta
2018-05-03 15:51         ` [dpdk-dev] [PATCH v7 5/8] raw/dpaa2_qdma: introduce the DPAA2 QDMA driver Nipun Gupta
2018-05-03 15:52         ` [dpdk-dev] [PATCH v7 6/8] raw/dpaa2_qdma: support configuration APIs Nipun Gupta
2018-05-03 15:52         ` [dpdk-dev] [PATCH v7 7/8] raw/dpaa2_qdma: support enq and deq operations Nipun Gupta
2018-05-03 15:52         ` [dpdk-dev] [PATCH v7 8/8] doc: add DPAA2 QDMA rawdev guide Nipun Gupta
2018-05-03 15:58         ` [dpdk-dev] [PATCH v7 0/8] Introduce DPAA2 QDMA raw driver Nipun Gupta
2018-05-03 16:06       ` [dpdk-dev] [PATCH RESEND " Nipun Gupta
2018-05-03 16:06         ` [dpdk-dev] [PATCH RESEND v7 1/8] raw: support meson build Nipun Gupta
2018-05-03 16:06         ` [dpdk-dev] [PATCH RESEND v7 2/8] bus/fslmc: support MC DPDMAI object Nipun Gupta
2018-05-03 16:06         ` [dpdk-dev] [PATCH RESEND v7 3/8] bus/fslmc: support scanning and probing of QDMA devices Nipun Gupta
2018-05-03 16:06         ` [dpdk-dev] [PATCH RESEND v7 4/8] bus/fslmc: add macros required by QDMA for FLE and FD Nipun Gupta
2018-05-03 16:06         ` [dpdk-dev] [PATCH RESEND v7 5/8] raw/dpaa2_qdma: introduce the DPAA2 QDMA driver Nipun Gupta
2018-05-03 16:06         ` [dpdk-dev] [PATCH RESEND v7 6/8] raw/dpaa2_qdma: support configuration APIs Nipun Gupta
2018-05-03 16:06         ` [dpdk-dev] [PATCH RESEND v7 7/8] raw/dpaa2_qdma: support enq and deq operations Nipun Gupta
2018-05-03 16:06         ` [dpdk-dev] [PATCH RESEND v7 8/8] doc: add DPAA2 QDMA rawdev guide Nipun Gupta
2018-05-08 10:17           ` Thomas Monjalon
2018-05-08 10:22         ` [dpdk-dev] [PATCH RESEND v7 0/8] Introduce DPAA2 QDMA raw driver 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=1524570589-20148-3-git-send-email-nipun.gupta@nxp.com \
    --to=nipun.gupta@nxp.com \
    --cc=cristian.sovaiala@nxp.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=shreyansh.jain@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).