DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org, ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH v2 11/20] net/dpaa2: dpdmux skip reset
Date: Thu, 11 Feb 2021 19:46:11 +0530	[thread overview]
Message-ID: <20210211141620.12482-12-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20210211141620.12482-1-hemant.agrawal@nxp.com>

From: Apeksha Gupta <apeksha.gupta@nxp.com>

This is require as the interface is shared with linux and we do not want
the dpdmux to be reset. rather the default interface to kernel shall
continue.
command dpdmux_set_resetable is used to skip DPDMUX reset.
By default the DPDMUX_RESET command will reset the DPDMUX completely,
dpdmux_set_resetable command will be ignored in old MC firmware.

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
---
 drivers/net/dpaa2/dpaa2_mux.c         | 26 +++++++++
 drivers/net/dpaa2/mc/dpdmux.c         | 84 +++++++++++++++++++++++++++
 drivers/net/dpaa2/mc/fsl_dpdmux.h     | 32 ++++++++++
 drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h | 22 ++++++-
 4 files changed, 161 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c
index b669a16fc1..1ff00ca8f7 100644
--- a/drivers/net/dpaa2/dpaa2_mux.c
+++ b/drivers/net/dpaa2/dpaa2_mux.c
@@ -264,6 +264,8 @@ dpaa2_create_dpdmux_device(int vdev_fd __rte_unused,
 	struct dpaa2_dpdmux_dev *dpdmux_dev;
 	struct dpdmux_attr attr;
 	int ret;
+	uint16_t maj_ver;
+	uint16_t min_ver;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -298,6 +300,30 @@ dpaa2_create_dpdmux_device(int vdev_fd __rte_unused,
 		goto init_err;
 	}
 
+	ret = dpdmux_get_api_version(&dpdmux_dev->dpdmux, CMD_PRI_LOW,
+					&maj_ver, &min_ver);
+	if (ret) {
+		DPAA2_PMD_ERR("setting version failed in %s",
+				__func__);
+		goto init_err;
+	}
+
+	/* The new dpdmux_set/get_resetable() API are available starting with
+	 * DPDMUX_VER_MAJOR==6 and DPDMUX_VER_MINOR==6
+	 */
+	if (maj_ver >= 6 && min_ver >= 6) {
+		ret = dpdmux_set_resetable(&dpdmux_dev->dpdmux, CMD_PRI_LOW,
+				dpdmux_dev->token,
+				DPDMUX_SKIP_DEFAULT_INTERFACE |
+				DPDMUX_SKIP_UNICAST_RULES |
+				DPDMUX_SKIP_MULTICAST_RULES);
+		if (ret) {
+			DPAA2_PMD_ERR("setting default interface failed in %s",
+				      __func__);
+			goto init_err;
+		}
+	}
+
 	dpdmux_dev->dpdmux_id = dpdmux_id;
 	dpdmux_dev->num_ifs = attr.num_ifs;
 
diff --git a/drivers/net/dpaa2/mc/dpdmux.c b/drivers/net/dpaa2/mc/dpdmux.c
index 67d37ed4cd..57c811c70f 100644
--- a/drivers/net/dpaa2/mc/dpdmux.c
+++ b/drivers/net/dpaa2/mc/dpdmux.c
@@ -123,10 +123,12 @@ int dpdmux_create(struct fsl_mc_io *mc_io,
 	cmd_params->method = cfg->method;
 	cmd_params->manip = cfg->manip;
 	cmd_params->num_ifs = cpu_to_le16(cfg->num_ifs);
+	cmd_params->default_if = cpu_to_le16(cfg->default_if);
 	cmd_params->adv_max_dmat_entries =
 			cpu_to_le16(cfg->adv.max_dmat_entries);
 	cmd_params->adv_max_mc_groups = cpu_to_le16(cfg->adv.max_mc_groups);
 	cmd_params->adv_max_vlan_ids = cpu_to_le16(cfg->adv.max_vlan_ids);
+	cmd_params->mem_size = cpu_to_le16(cfg->adv.mem_size);
 	cmd_params->options = cpu_to_le64(cfg->adv.options);
 
 	/* send command to mc*/
@@ -278,6 +280,87 @@ int dpdmux_reset(struct fsl_mc_io *mc_io,
 	return mc_send_command(mc_io, &cmd);
 }
 
+/**
+ * dpdmux_set_resetable() - Set overall resetable DPDMUX parameters.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPDMUX object
+ * @skip_reset_flags:	By default all are 0.
+ *			By setting 1 will deactivate the reset.
+ *	The flags are:
+ *			DPDMUX_SKIP_DEFAULT_INTERFACE  0x01
+ *			DPDMUX_SKIP_UNICAST_RULES      0x02
+ *			DPDMUX_SKIP_MULTICAST_RULES    0x04
+ *
+ * For example, by default, through DPDMUX_RESET the default
+ * interface will be restored with the one from create.
+ * By setting DPDMUX_SKIP_DEFAULT_INTERFACE flag,
+ * through DPDMUX_RESET the default interface will not be modified.
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmux_set_resetable(struct fsl_mc_io *mc_io,
+				  uint32_t cmd_flags,
+				  uint16_t token,
+				  uint8_t skip_reset_flags)
+{
+	struct mc_command cmd = { 0 };
+	struct dpdmux_cmd_set_skip_reset_flags *cmd_params;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_SET_RESETABLE,
+					  cmd_flags,
+					  token);
+	cmd_params = (struct dpdmux_cmd_set_skip_reset_flags *)cmd.params;
+	dpdmux_set_field(cmd_params->skip_reset_flags,
+			SKIP_RESET_FLAGS,
+			skip_reset_flags);
+
+	/* send command to mc*/
+	return mc_send_command(mc_io, &cmd);
+}
+
+/**
+ * dpdmux_get_resetable() - Get overall resetable parameters.
+ * @mc_io:	Pointer to MC portal's I/O object
+ * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token:	Token of DPDMUX object
+ * @skip_reset_flags:	Get the reset flags.
+ *
+ *	The flags are:
+ *			DPDMUX_SKIP_DEFAULT_INTERFACE  0x01
+ *			DPDMUX_SKIP_UNICAST_RULES      0x02
+ *			DPDMUX_SKIP_MULTICAST_RULES    0x04
+ *
+ * Return:	'0' on Success; Error code otherwise.
+ */
+int dpdmux_get_resetable(struct fsl_mc_io *mc_io,
+				  uint32_t cmd_flags,
+				  uint16_t token,
+				  uint8_t *skip_reset_flags)
+{
+	struct mc_command cmd = { 0 };
+	struct dpdmux_rsp_get_skip_reset_flags *rsp_params;
+	int err;
+
+	/* prepare command */
+	cmd.header = mc_encode_cmd_header(DPDMUX_CMDID_GET_RESETABLE,
+					  cmd_flags,
+					  token);
+
+	/* send command to mc*/
+	err = mc_send_command(mc_io, &cmd);
+	if (err)
+		return err;
+
+	/* retrieve response parameters */
+	rsp_params = (struct dpdmux_rsp_get_skip_reset_flags *)cmd.params;
+	*skip_reset_flags = dpdmux_get_field(rsp_params->skip_reset_flags,
+			SKIP_RESET_FLAGS);
+
+	return 0;
+}
+
 /**
  * dpdmux_get_attributes() - Retrieve DPDMUX attributes
  * @mc_io:	Pointer to MC portal's I/O object
@@ -314,6 +397,7 @@ int dpdmux_get_attributes(struct fsl_mc_io *mc_io,
 	attr->manip = rsp_params->manip;
 	attr->num_ifs = le16_to_cpu(rsp_params->num_ifs);
 	attr->mem_size = le16_to_cpu(rsp_params->mem_size);
+	attr->default_if = le16_to_cpu(rsp_params->default_if);
 
 	return 0;
 }
diff --git a/drivers/net/dpaa2/mc/fsl_dpdmux.h b/drivers/net/dpaa2/mc/fsl_dpdmux.h
index b809aade5d..f035f0f24e 100644
--- a/drivers/net/dpaa2/mc/fsl_dpdmux.h
+++ b/drivers/net/dpaa2/mc/fsl_dpdmux.h
@@ -79,6 +79,8 @@ enum dpdmux_method {
  * @method: Defines the operation method for the DPDMUX address table
  * @manip: Required manipulation operation
  * @num_ifs: Number of interfaces (excluding the uplink interface)
+ * @default_if: Default interface number (different from uplink,
+	maximum value num_ifs)
  * @adv: Advanced parameters; default is all zeros;
  *	use this structure to change default settings
  * @adv.options: DPDMUX options - combination of 'DPDMUX_OPT_<X>' flags.
@@ -89,16 +91,20 @@ enum dpdmux_method {
  * @adv.max_vlan_ids: Maximum vlan ids allowed in the system -
  *	relevant only case of working in mac+vlan method.
  *	0 - indicates default 16 vlan ids.
+ * @adv.mem_size: Size of the memory used for internal buffers expressed as
+ * number of 256byte buffers.
  */
 struct dpdmux_cfg {
 	enum dpdmux_method method;
 	enum dpdmux_manip manip;
 	uint16_t num_ifs;
+	uint16_t default_if;
 	struct {
 		uint64_t options;
 		uint16_t max_dmat_entries;
 		uint16_t max_mc_groups;
 		uint16_t max_vlan_ids;
+		uint16_t mem_size;
 	} adv;
 };
 
@@ -130,6 +136,29 @@ int dpdmux_reset(struct fsl_mc_io *mc_io,
 		 uint32_t cmd_flags,
 		 uint16_t token);
 
+/**
+ *Setting 1 DPDMUX_RESET will not reset default interface
+ */
+#define DPDMUX_SKIP_DEFAULT_INTERFACE	0x01
+/**
+ *Setting 1 DPDMUX_RESET will not reset unicast rules
+ */
+#define DPDMUX_SKIP_UNICAST_RULES	0x02
+/**
+ *Setting 1 DPDMUX_RESET will not reset multicast rules
+ */
+#define DPDMUX_SKIP_MULTICAST_RULES	0x04
+
+int dpdmux_set_resetable(struct fsl_mc_io *mc_io,
+				  uint32_t cmd_flags,
+				  uint16_t token,
+				  uint8_t skip_reset_flags);
+
+int dpdmux_get_resetable(struct fsl_mc_io *mc_io,
+				  uint32_t cmd_flags,
+				  uint16_t token,
+				  uint8_t *skip_reset_flags);
+
 /**
  * struct dpdmux_attr - Structure representing DPDMUX attributes
  * @id: DPDMUX object ID
@@ -138,6 +167,8 @@ int dpdmux_reset(struct fsl_mc_io *mc_io,
  * @manip: DPDMUX manipulation type
  * @num_ifs: Number of interfaces (excluding the uplink interface)
  * @mem_size: DPDMUX frame storage memory size
+ * @default_if: Default interface number (different from uplink,
+	maximum value num_ifs)
  */
 struct dpdmux_attr {
 	int id;
@@ -146,6 +177,7 @@ struct dpdmux_attr {
 	enum dpdmux_manip manip;
 	uint16_t num_ifs;
 	uint16_t mem_size;
+	uint16_t default_if;
 };
 
 int dpdmux_get_attributes(struct fsl_mc_io *mc_io,
diff --git a/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h b/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h
index b6b8c38c41..2444e9a2e5 100644
--- a/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h
+++ b/drivers/net/dpaa2/mc/fsl_dpdmux_cmd.h
@@ -55,6 +55,9 @@
 #define DPDMUX_CMDID_IF_SET_DEFAULT		DPDMUX_CMD(0x0b8)
 #define DPDMUX_CMDID_IF_GET_DEFAULT		DPDMUX_CMD(0x0b9)
 
+#define DPDMUX_CMDID_SET_RESETABLE		DPDMUX_CMD(0x0ba)
+#define DPDMUX_CMDID_GET_RESETABLE		DPDMUX_CMD(0x0bb)
+
 #define DPDMUX_MASK(field)        \
 	GENMASK(DPDMUX_##field##_SHIFT + DPDMUX_##field##_SIZE - 1, \
 		DPDMUX_##field##_SHIFT)
@@ -72,12 +75,13 @@ struct dpdmux_cmd_create {
 	uint8_t method;
 	uint8_t manip;
 	uint16_t num_ifs;
-	uint32_t pad;
+	uint16_t default_if;
+	uint16_t pad;
 
 	uint16_t adv_max_dmat_entries;
 	uint16_t adv_max_mc_groups;
 	uint16_t adv_max_vlan_ids;
-	uint16_t pad1;
+	uint16_t mem_size;
 
 	uint64_t options;
 };
@@ -100,7 +104,7 @@ struct dpdmux_rsp_get_attr {
 	uint8_t manip;
 	uint16_t num_ifs;
 	uint16_t mem_size;
-	uint16_t pad;
+	uint16_t default_if;
 
 	uint64_t pad1;
 
@@ -217,5 +221,17 @@ struct dpdmux_cmd_remove_custom_cls_entry {
 	uint64_t key_iova;
 	uint64_t mask_iova;
 };
+
+#define DPDMUX_SKIP_RESET_FLAGS_SHIFT    0
+#define DPDMUX_SKIP_RESET_FLAGS_SIZE     3
+
+struct dpdmux_cmd_set_skip_reset_flags {
+	uint8_t skip_reset_flags;
+};
+
+struct dpdmux_rsp_get_skip_reset_flags {
+	uint8_t skip_reset_flags;
+};
+
 #pragma pack(pop)
 #endif /* _FSL_DPDMUX_CMD_H */
-- 
2.17.1


  parent reply	other threads:[~2021-02-11 14:29 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20 14:27 [dpdk-dev] [PATCH 0/7] NXP DPAAx ethernet PMD changes Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 1/7] bus/fslmc: fix to use ci value for qbman 5.0 Hemant Agrawal
2021-02-02 11:36   ` Ferruh Yigit
2021-02-04 12:42     ` Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 2/7] net/dpaa2: fix link get API implementation Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 3/7] net/dpaa2: allocate SGT table from first segment Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 4/7] net/dpaa2: support external buffers in Tx Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 5/7] net/dpaa: " Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 6/7] net/dpaa2: add traffic management driver Hemant Agrawal
2021-02-02 11:41   ` Ferruh Yigit
2021-02-04 10:47     ` Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 7/7] net/dpaa2: add support to configure dpdmux max Rx frame len Hemant Agrawal
2021-02-02 11:38   ` Ferruh Yigit
2021-02-04 10:46     ` Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 0/7] NXP DPAAx ethernet PMD changes Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 00/20] " Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 01/20] bus/fslmc: fix to use ci value for qbman 5.0 Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 02/20] bus/dpaa: fix statistics reading Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 03/20] net/dpaa2: fix link get API implementation Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 04/20] net/dpaa: " Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 05/20] net/dpaa2: allocate SGT table from first segment Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 06/20] net/dpaa2: support external buffers in Tx Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 07/20] net/dpaa: " Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 08/20] net/dpaa2: add traffic management driver Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 09/20] net/dpaa2: add support to configure dpdmux max Rx frame len Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 10/20] net/dpaa2: add support for raw pattern in dpdmux Hemant Agrawal
2021-02-11 14:16   ` Hemant Agrawal [this message]
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 12/20] net/dpaa2: support dpdmux to not drop parse err pkts Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 13/20] net/dpaa2: add device args for enable Tx confirmation Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 14/20] net/dpaa2: optionally enable error queues Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 15/20] mempool/dpaa2: support stats for secondary process Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 16/20] net/dpaa: do not release the cgr ranges Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 17/20] net/dpaa: prevent multiple mp config on an device Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 18/20] bus/dpaa: secondary process init support Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 19/20] bus/dpaa: support shared ethernet MAC interface Hemant Agrawal
2021-02-11 14:16   ` [dpdk-dev] [PATCH v2 20/20] bus/dpaa: enhance checks for bus and device detection Hemant Agrawal
2021-02-24 12:42   ` [dpdk-dev] [PATCH v3 00/23] NXP DPAAx ethernet PMD changes Hemant Agrawal
2021-02-24 12:42     ` [dpdk-dev] [PATCH v3 01/23] bus/fslmc: fix to use ci value for qbman 5.0 Hemant Agrawal
2021-02-24 12:42     ` [dpdk-dev] [PATCH v3 02/23] bus/dpaa: fix statistics reading Hemant Agrawal
2021-02-24 12:42     ` [dpdk-dev] [PATCH v3 03/23] net/dpaa2: fix link get API implementation Hemant Agrawal
2021-02-24 12:42     ` [dpdk-dev] [PATCH v3 04/23] net/dpaa: " Hemant Agrawal
2021-02-24 12:42     ` [dpdk-dev] [PATCH v3 05/23] net/dpaa2: allocate SGT table from first segment Hemant Agrawal
2021-02-24 12:42     ` [dpdk-dev] [PATCH v3 06/23] net/dpaa2: support external buffers in Tx Hemant Agrawal
2021-02-24 12:42     ` [dpdk-dev] [PATCH v3 07/23] net/dpaa: " Hemant Agrawal
2021-02-24 12:42     ` [dpdk-dev] [PATCH v3 08/23] net/dpaa2: add traffic management driver Hemant Agrawal
2021-02-24 12:42     ` [dpdk-dev] [PATCH v3 09/23] net/dpaa2: add support to configure dpdmux max Rx frame len Hemant Agrawal
2021-02-24 17:22       ` Ferruh Yigit
2021-02-24 12:42     ` [dpdk-dev] [PATCH v3 10/23] net/dpaa2: add support for raw pattern in dpdmux Hemant Agrawal
2021-02-24 12:42     ` [dpdk-dev] [PATCH v3 11/23] net/dpaa2: dpdmux skip reset Hemant Agrawal
2021-02-24 12:43     ` [dpdk-dev] [PATCH v3 12/23] net/dpaa2: support dpdmux to not drop parse err pkts Hemant Agrawal
2021-02-24 12:43     ` [dpdk-dev] [PATCH v3 13/23] net/dpaa2: add device args for enable Tx confirmation Hemant Agrawal
2021-02-24 12:43     ` [dpdk-dev] [PATCH v3 14/23] net/dpaa2: optionally enable error queues Hemant Agrawal
2021-02-24 12:43     ` [dpdk-dev] [PATCH v3 15/23] net/dpaa2: change Tx queue congestion settings Hemant Agrawal
2021-02-24 12:43     ` [dpdk-dev] [PATCH v3 16/23] mempool/dpaa2: support stats for secondary process Hemant Agrawal
2021-02-24 12:43     ` [dpdk-dev] [PATCH v3 17/23] net/dpaa: do not release the cgr ranges Hemant Agrawal
2021-02-24 12:43     ` [dpdk-dev] [PATCH v3 18/23] net/dpaa: prevent multiple mp config on an device Hemant Agrawal
2021-02-24 12:43     ` [dpdk-dev] [PATCH v3 19/23] bus/dpaa: secondary process init support Hemant Agrawal
2021-02-24 12:43     ` [dpdk-dev] [PATCH v3 20/23] bus/dpaa: support shared ethernet MAC interface Hemant Agrawal
2021-02-24 12:43     ` [dpdk-dev] [PATCH v3 21/23] bus/dpaa: enhance checks for bus and device detection Hemant Agrawal
2021-02-24 12:43     ` [dpdk-dev] [PATCH v3 22/23] net/dpaa2: add Rx buf size support Hemant Agrawal
2021-02-24 12:43     ` [dpdk-dev] [PATCH v3 23/23] net/dpaa: " Hemant Agrawal
2021-02-24 17:23     ` [dpdk-dev] [PATCH v3 00/23] NXP DPAAx ethernet PMD changes Ferruh Yigit

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=20210211141620.12482-12-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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).