DPDK patches and discussions
 help / color / Atom feed
From: Sachin Saxena <sachin.saxena@nxp.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, Sachin Saxena <sachin.saxena@nxp.com>
Subject: [dpdk-dev] [PATCH v1 2/2] net/dpaa2: update MC firmware version for FSLMC bus
Date: Tue, 10 Sep 2019 16:00:51 +0530
Message-ID: <20190910103051.27556-3-sachin.saxena@nxp.com> (raw)
In-Reply-To: <20190910103051.27556-1-sachin.saxena@nxp.com>

    MC firmware is the core component of FSLMC bus and net/DPAA2 devices.
    Prior to this patch, MC firmware supported 10.14.x version. This
    patch bumps the min supported version to 10.18.x.

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
---
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c |  1 +
 drivers/net/dpaa2/dpaa2_ethdev.c       |  8 ++---
 drivers/net/dpaa2/dpaa2_flow.c         |  5 +--
 drivers/net/dpaa2/mc/dpni.c            | 46 +++++++++++++++++++++++---
 drivers/net/dpaa2/mc/fsl_dpni.h        | 30 +++++++++++++++--
 drivers/net/dpaa2/mc/fsl_dpni_cmd.h    | 33 +++++++++++++-----
 drivers/net/dpaa2/mc/fsl_net.h         |  2 ++
 7 files changed, 102 insertions(+), 23 deletions(-)

diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 56e2e56a3..16555d7b0 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -365,6 +365,7 @@ dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
 	}
 
 	/*Attach buffer pool to the network interface as described by the user*/
+	memset(&bpool_cfg, 0, sizeof(struct dpni_pools_cfg));
 	bpool_cfg.num_dpbp = 1;
 	bpool_cfg.pools[0].dpbp_id = bp_list->buf_pool.dpbp_node->dpbp_id;
 	bpool_cfg.pools[0].backup_pool = 0;
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 34852ad08..8c205110c 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -128,8 +128,8 @@ dpaa2_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 	}
 
 	if (on)
-		ret = dpni_add_vlan_id(dpni, CMD_PRI_LOW,
-				       priv->token, vlan_id);
+		ret = dpni_add_vlan_id(dpni, CMD_PRI_LOW, priv->token,
+				       vlan_id, 0, 0, 0);
 	else
 		ret = dpni_remove_vlan_id(dpni, CMD_PRI_LOW,
 					  priv->token, vlan_id);
@@ -1315,8 +1315,8 @@ dpaa2_dev_add_mac_addr(struct rte_eth_dev *dev,
 		return -1;
 	}
 
-	ret = dpni_add_mac_addr(dpni, CMD_PRI_LOW,
-				priv->token, addr->addr_bytes);
+	ret = dpni_add_mac_addr(dpni, CMD_PRI_LOW, priv->token,
+				addr->addr_bytes, 0, 0, 0);
 	if (ret)
 		DPAA2_PMD_ERR(
 			"error: Adding the MAC ADDR failed: err = %d", ret);
diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c
index 572eb8462..221265032 100644
--- a/drivers/net/dpaa2/dpaa2_flow.c
+++ b/drivers/net/dpaa2/dpaa2_flow.c
@@ -1505,7 +1505,8 @@ dpaa2_generic_flow_set(struct rte_flow *flow,
 			index = flow->index + (flow->tc_id * nic_attr.fs_entries);
 			ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW,
 						priv->token, &flow->rule,
-						flow->tc_id, index);
+						flow->tc_id, index,
+						0, 0);
 			if (ret < 0) {
 				DPAA2_PMD_ERR(
 				"Error in addnig entry to QoS table(%d)", ret);
@@ -1607,7 +1608,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow,
 			index = flow->index + (flow->tc_id * nic_attr.fs_entries);
 			ret = dpni_add_qos_entry(dpni, CMD_PRI_LOW, priv->token,
 						&flow->rule, flow->tc_id,
-						index);
+						index, 0, 0);
 			if (ret < 0) {
 				DPAA2_PMD_ERR(
 				"Error in entry addition in QoS table(%d)",
diff --git a/drivers/net/dpaa2/mc/dpni.c b/drivers/net/dpaa2/mc/dpni.c
index b37f9976f..0950ee007 100644
--- a/drivers/net/dpaa2/mc/dpni.c
+++ b/drivers/net/dpaa2/mc/dpni.c
@@ -200,6 +200,7 @@ int dpni_set_pools(struct fsl_mc_io *mc_io,
 					  token);
 	cmd_params = (struct dpni_cmd_set_pools *)cmd.params;
 	cmd_params->num_dpbp = cfg->num_dpbp;
+	cmd_params->pool_options = cfg->pool_options;
 	for (i = 0; i < cmd_params->num_dpbp; i++) {
 		cmd_params->pool[i].dpbp_id =
 			cpu_to_le16(cfg->pools[i].dpbp_id);
@@ -1211,13 +1212,24 @@ int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
  * @token:	Token of DPNI object
  * @mac_addr:	MAC address to add
- *
+ * @flags :	0 - tc_id and flow_id will be ignored.
+ *		  Pkt with this mac_id will be passed to the next
+ *		  classification stages
+ *		DPNI_MAC_SET_QUEUE_ACTION
+ *		  Pkt with this mac will be forward directly to
+ *		  queue defined by the tc_id and flow_id
+ * @tc_id : Traffic class selection (0-7)
+ * @flow_id : Selects the specific queue out of the set allocated for the
+ *            same as tc_id. Value must be in range 0 to NUM_QUEUES - 1
  * Return:	'0' on Success; Error code otherwise.
  */
 int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
 		      uint32_t cmd_flags,
 		      uint16_t token,
-		      const uint8_t mac_addr[6])
+		      const uint8_t mac_addr[6],
+			  uint8_t flags,
+			  uint8_t tc_id,
+			  uint8_t flow_id)
 {
 	struct mc_command cmd = { 0 };
 	struct dpni_cmd_add_mac_addr *cmd_params;
@@ -1228,6 +1240,10 @@ int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
 					  cmd_flags,
 					  token);
 	cmd_params = (struct dpni_cmd_add_mac_addr *)cmd.params;
+	cmd_params->flags = flags;
+	cmd_params->tc_id = tc_id;
+	cmd_params->fq_id = flow_id;
+
 	for (i = 0; i < 6; i++)
 		cmd_params->mac_addr[i] = mac_addr[5 - i];
 
@@ -1371,13 +1387,26 @@ int dpni_enable_vlan_filter(struct fsl_mc_io *mc_io,
  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
  * @token:	Token of DPNI object
  * @vlan_id:	VLAN ID to add
+ * @flags:	0 - tc_id and flow_id will be ignored.
+ *		  Pkt with this vlan_id will be passed to the next
+ *		  classification stages
+ *		DPNI_VLAN_SET_QUEUE_ACTION
+ *		  Pkt with this vlan_id will be forward directly to
+ *		  queue defined by the tc_id and flow_id
+ *
+ * @tc_id: Traffic class selection (0-7)
+ * @flow_id: Selects the specific queue out of the set allocated for the
+ *           same as tc_id. Value must be in range 0 to NUM_QUEUES - 1
  *
  * Return:	'0' on Success; Error code otherwise.
  */
 int dpni_add_vlan_id(struct fsl_mc_io *mc_io,
 		     uint32_t cmd_flags,
 		     uint16_t token,
-		     uint16_t vlan_id)
+		     uint16_t vlan_id,
+			 uint8_t flags,
+			 uint8_t tc_id,
+			 uint8_t flow_id)
 {
 	struct dpni_cmd_vlan_id *cmd_params;
 	struct mc_command cmd = { 0 };
@@ -1387,6 +1416,9 @@ int dpni_add_vlan_id(struct fsl_mc_io *mc_io,
 					  cmd_flags,
 					  token);
 	cmd_params = (struct dpni_cmd_vlan_id *)cmd.params;
+	cmd_params->flags = flags;
+	cmd_params->tc_id = tc_id;
+	cmd_params->flow_id =  flow_id;
 	cmd_params->vlan_id = cpu_to_le16(vlan_id);
 
 	/* send command to mc*/
@@ -1589,7 +1621,9 @@ int dpni_add_qos_entry(struct fsl_mc_io *mc_io,
 		       uint16_t token,
 		       const struct dpni_rule_cfg *cfg,
 		       uint8_t tc_id,
-		       uint16_t index)
+		       uint16_t index,
+			   uint8_t flags,
+			   uint8_t flow_id)
 {
 	struct dpni_cmd_add_qos_entry *cmd_params;
 	struct mc_command cmd = { 0 };
@@ -1599,6 +1633,8 @@ int dpni_add_qos_entry(struct fsl_mc_io *mc_io,
 					  cmd_flags,
 					  token);
 	cmd_params = (struct dpni_cmd_add_qos_entry *)cmd.params;
+	cmd_params->flags = flags;
+	cmd_params->flow_id = flow_id;
 	cmd_params->tc_id = tc_id;
 	cmd_params->key_size = cfg->key_size;
 	cmd_params->index = cpu_to_le16(index);
@@ -2031,7 +2067,7 @@ int dpni_get_queue(struct fsl_mc_io *mc_io,
  * @cmd_flags:	Command flags; one or more of 'MC_CMD_FLAG_'
  * @token:	Token of DPNI object
  * @page:	Selects the statistics page to retrieve, see
- *		DPNI_GET_STATISTICS output. Pages are numbered 0 to 3.
+ *		DPNI_GET_STATISTICS output. Pages are numbered 0 to 6.
  * @param:	Custom parameter for some pages used to select
  *		a certain statistic source, for example the TC.
  * @stat:	Structure containing the statistics
diff --git a/drivers/net/dpaa2/mc/fsl_dpni.h b/drivers/net/dpaa2/mc/fsl_dpni.h
index 97fde316e..51b39bdba 100644
--- a/drivers/net/dpaa2/mc/fsl_dpni.h
+++ b/drivers/net/dpaa2/mc/fsl_dpni.h
@@ -199,6 +199,8 @@ int dpni_destroy(struct fsl_mc_io *mc_io,
 /**
  * struct dpni_pools_cfg - Structure representing buffer pools configuration
  * @num_dpbp:	Number of DPBPs
+ * @pool_options: Buffer assignment options
+ *                This field is a combination of DPNI_POOL_ASSOC_flags
  * @pools:	Array of buffer pools parameters; The number of valid entries
  *		must match 'num_dpbp' value
  * @pools.dpbp_id:     DPBP object ID
@@ -207,8 +209,13 @@ int dpni_destroy(struct fsl_mc_io *mc_io,
  * @pools.buffer_size: Buffer size
  * @pools.backup_pool: Backup pool
  */
+
+#define DPNI_POOL_ASSOC_QPRI	0
+#define DPNI_POOL_ASSOC_QDBIN	1
+
 struct dpni_pools_cfg {
 	uint8_t num_dpbp;
+	uint8_t pool_options;
 	struct {
 		int		dpbp_id;
 		uint8_t		priority_mask;
@@ -581,6 +588,7 @@ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
  * @page_5.policer_cnt_green: number of green colored frames
  * @page_5.policer_cnt_re_red: number of recolored red frames
  * @page_5.policer_cnt_re_yellow: number of recolored yellow frames
+ * @page_6.tx_pending_frames_cnt: total number of frames pending in Tx queues
  * @raw: raw statistics structure, used to index counters
  */
 union dpni_statistics {
@@ -624,6 +632,9 @@ union dpni_statistics {
 		uint64_t policer_cnt_re_red;
 		uint64_t policer_cnt_re_yellow;
 	} page_5;
+	struct {
+		uint64_t tx_pending_frames_cnt;
+	} page_6;
 	struct {
 		uint64_t counter[DPNI_STATISTICS_CNT];
 	} raw;
@@ -773,7 +784,10 @@ int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
 int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
 		      uint32_t cmd_flags,
 		      uint16_t token,
-		      const uint8_t mac_addr[6]);
+		      const uint8_t mac_addr[6],
+			  uint8_t flags,
+			  uint8_t tc_id,
+			  uint8_t flow_id);
 
 int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
 			 uint32_t cmd_flags,
@@ -796,10 +810,18 @@ int dpni_enable_vlan_filter(struct fsl_mc_io *mc_io,
 			    uint16_t token,
 			    int en);
 
+/**
+ * Set vlan filter queue action
+ */
+#define DPNI_VLAN_SET_QUEUE_ACTION 1
+
 int dpni_add_vlan_id(struct fsl_mc_io *mc_io,
 		     uint32_t cmd_flags,
 		     uint16_t token,
-		     uint16_t vlan_id);
+		     uint16_t vlan_id,
+			 uint8_t flags,
+			 uint8_t tc_id,
+			 uint8_t flow_id);
 
 int dpni_remove_vlan_id(struct fsl_mc_io *mc_io,
 			uint32_t cmd_flags,
@@ -1181,7 +1203,9 @@ int dpni_add_qos_entry(struct fsl_mc_io *mc_io,
 		       uint16_t token,
 		       const struct dpni_rule_cfg *cfg,
 		       uint8_t tc_id,
-		       uint16_t index);
+		       uint16_t index,
+			   uint8_t flags,
+			   uint8_t flow_id);
 
 int dpni_remove_qos_entry(struct fsl_mc_io *mc_io,
 			  uint32_t cmd_flags,
diff --git a/drivers/net/dpaa2/mc/fsl_dpni_cmd.h b/drivers/net/dpaa2/mc/fsl_dpni_cmd.h
index dfaccd91c..9e7376200 100644
--- a/drivers/net/dpaa2/mc/fsl_dpni_cmd.h
+++ b/drivers/net/dpaa2/mc/fsl_dpni_cmd.h
@@ -9,7 +9,7 @@
 
 /* DPNI Version */
 #define DPNI_VER_MAJOR				7
-#define DPNI_VER_MINOR				9
+#define DPNI_VER_MINOR				13
 
 #define DPNI_CMD_BASE_VERSION			1
 #define DPNI_CMD_VERSION_2			2
@@ -40,7 +40,7 @@
 #define DPNI_CMDID_GET_IRQ_STATUS		DPNI_CMD(0x016)
 #define DPNI_CMDID_CLEAR_IRQ_STATUS		DPNI_CMD(0x017)
 
-#define DPNI_CMDID_SET_POOLS			DPNI_CMD_V2(0x200)
+#define DPNI_CMDID_SET_POOLS			DPNI_CMD_V3(0x200)
 #define DPNI_CMDID_SET_ERRORS_BEHAVIOR		DPNI_CMD(0x20B)
 
 #define DPNI_CMDID_GET_QDID			DPNI_CMD(0x210)
@@ -58,19 +58,19 @@
 #define DPNI_CMDID_GET_UNICAST_PROMISC		DPNI_CMD(0x223)
 #define DPNI_CMDID_SET_PRIM_MAC			DPNI_CMD(0x224)
 #define DPNI_CMDID_GET_PRIM_MAC			DPNI_CMD(0x225)
-#define DPNI_CMDID_ADD_MAC_ADDR			DPNI_CMD(0x226)
+#define DPNI_CMDID_ADD_MAC_ADDR			DPNI_CMD_V2(0x226)
 #define DPNI_CMDID_REMOVE_MAC_ADDR		DPNI_CMD(0x227)
 #define DPNI_CMDID_CLR_MAC_FILTERS		DPNI_CMD(0x228)
 
 #define DPNI_CMDID_ENABLE_VLAN_FILTER		DPNI_CMD(0x230)
-#define DPNI_CMDID_ADD_VLAN_ID			DPNI_CMD(0x231)
+#define DPNI_CMDID_ADD_VLAN_ID			DPNI_CMD_V2(0x231)
 #define DPNI_CMDID_REMOVE_VLAN_ID		DPNI_CMD(0x232)
 #define DPNI_CMDID_CLR_VLAN_FILTERS		DPNI_CMD(0x233)
 
 #define DPNI_CMDID_SET_RX_TC_DIST		DPNI_CMD_V3(0x235)
 
 #define DPNI_CMDID_SET_QOS_TBL			DPNI_CMD_V2(0x240)
-#define DPNI_CMDID_ADD_QOS_ENT			DPNI_CMD(0x241)
+#define DPNI_CMDID_ADD_QOS_ENT			DPNI_CMD_V2(0x241)
 #define DPNI_CMDID_REMOVE_QOS_ENT		DPNI_CMD(0x242)
 #define DPNI_CMDID_CLR_QOS_TBL			DPNI_CMD(0x243)
 #define DPNI_CMDID_ADD_FS_ENT			DPNI_CMD(0x244)
@@ -153,7 +153,8 @@ struct dpni_cmd_pool {
 struct dpni_cmd_set_pools {
 	uint8_t num_dpbp;
 	uint8_t backup_pool_mask;
-	uint16_t pad;
+	uint8_t pad;
+	uint8_t pool_options;
 	struct dpni_cmd_pool pool[8];
 	uint16_t buffer_size[8];
 };
@@ -392,9 +393,14 @@ struct dpni_rsp_get_port_mac_addr {
 	uint8_t mac_addr[6];
 };
 
+#define DPNI_MAC_SET_QUEUE_ACTION 1
+
 struct dpni_cmd_add_mac_addr {
-	uint16_t pad;
+	uint8_t flags;
+	uint8_t pad;
 	uint8_t mac_addr[6];
+	uint8_t tc_id;
+	uint8_t fq_id;
 };
 
 struct dpni_cmd_remove_mac_addr {
@@ -417,8 +423,13 @@ struct dpni_cmd_enable_vlan_filter {
 	uint8_t en;
 };
 
+#define DPNI_VLAN_SET_QUEUE_ACTION 1
+
 struct dpni_cmd_vlan_id {
-	uint32_t pad;
+	uint8_t flags;
+	uint8_t tc_id;
+	uint8_t flow_id;
+	uint8_t pad;
 	uint16_t vlan_id;
 };
 
@@ -534,8 +545,12 @@ struct dpni_cmd_set_qos_table {
 	uint64_t key_cfg_iova;
 };
 
+#define DPNI_QOS_OPT_SET_TC_ONLY 0x0
+#define DPNI_QOS_OPT_SET_FLOW_ID 0x1
+
 struct dpni_cmd_add_qos_entry {
-	uint16_t pad;
+	uint8_t flags;
+	uint8_t flow_id;
 	uint8_t tc_id;
 	uint8_t key_size;
 	uint16_t index;
diff --git a/drivers/net/dpaa2/mc/fsl_net.h b/drivers/net/dpaa2/mc/fsl_net.h
index 0dc0131bb..3eaad2f71 100644
--- a/drivers/net/dpaa2/mc/fsl_net.h
+++ b/drivers/net/dpaa2/mc/fsl_net.h
@@ -1,8 +1,10 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  *
  * Copyright 2013-2015 Freescale Semiconductor Inc.
+ * Copyright 2018-2019 NXP
  *
  */
+
 #ifndef __FSL_NET_H
 #define __FSL_NET_H
 
-- 
2.17.1


  parent reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-10 10:30 [dpdk-dev] [PATCH v1 0/2] Update MC firmware version for FSLMC bus and DPAA2 devices Sachin Saxena
2019-09-10 10:30 ` [dpdk-dev] [PATCH v1 1/2] bus/fslmc: update MC firmware version for FSLMC bus Sachin Saxena
2019-09-30 11:50   ` Hemant Agrawal
2019-09-10 10:30 ` Sachin Saxena [this message]
2019-09-30 11:50   ` [dpdk-dev] [PATCH v1 2/2] net/dpaa2: " Hemant Agrawal
2019-10-09  7:45 ` [dpdk-dev] [PATCH v1 0/2] Update MC firmware version for FSLMC bus and DPAA2 devices Ferruh Yigit

Reply instructions:

You may reply publically 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=20190910103051.27556-3-sachin.saxena@nxp.com \
    --to=sachin.saxena@nxp.com \
    --cc=dev@dpdk.org \
    --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

DPDK patches and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox