[v2,15/37] net/mvpp2: add dsa mode support

Message ID 20210122191925.24308-16-lironh@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers
Series net/mvpp2: misc updates |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Liron Himi Jan. 22, 2021, 7:19 p.m. UTC
  From: Liron Himi <lironh@marvell.com>

Extend the config file with 'start-hdr' field.
currently 'eth' (default) and 'dsa' headers are supported.

Signed-off-by: Liron Himi <lironh@marvell.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c |  4 ++
 drivers/net/mvpp2/mrvl_qos.c    | 65 ++++++++++++++++++++++++++-------
 drivers/net/mvpp2/mrvl_qos.h    |  1 +
 3 files changed, 57 insertions(+), 13 deletions(-)
  

Comments

Ferruh Yigit Jan. 26, 2021, 11:50 p.m. UTC | #1
On 1/22/2021 7:19 PM, lironh@marvell.com wrote:
> From: Liron Himi <lironh@marvell.com>
> 
> Extend the config file with 'start-hdr' field.
> currently 'eth' (default) and 'dsa' headers are supported.
> 
> Signed-off-by: Liron Himi <lironh@marvell.com>

<...>

> @@ -575,13 +607,15 @@ mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
>   				(*cfg)->port[n].mapping_priority =
>   					PP2_CLS_QOS_TBL_IP_PRI;
>   			else if (!strncmp(entry, MRVL_TOK_VLAN,
> -				sizeof(MRVL_TOK_VLAN)))
> +				sizeof(MRVL_TOK_VLAN))) {
>   				(*cfg)->port[n].mapping_priority =
>   					PP2_CLS_QOS_TBL_VLAN_PRI;
> -			else
> -				rte_exit(EXIT_FAILURE,
> +			} else {
> +				MRVL_LOG(ERR,
>   					"Error in parsing %s value (%s)!\n",
>   					MRVL_TOK_MAPPING_PRIORITY, entry);
> +				return -1;
> +			}

+1 to replace the rte_exit() in PMD;

> @@ -628,7 +666,8 @@ mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
>   		} else {
>   			if ((*cfg)->port[n].use_global_defaults == 0) {
>   				MRVL_LOG(ERR,
> -					 "Default Traffic Class required in custom configuration!");
> +					 "Default Traffic Class required in " > +					 "custom configuration!");

It is preferred to not break the log strings, if you don't mind I will merge it 
back in the next-net.
  
Ferruh Yigit Jan. 27, 2021, midnight UTC | #2
On 1/22/2021 7:19 PM, lironh@marvell.com wrote:
> From: Liron Himi <lironh@marvell.com>
> 
> Extend the config file with 'start-hdr' field.
> currently 'eth' (default) and 'dsa' headers are supported.
> 
> Signed-off-by: Liron Himi <lironh@marvell.com>

There are multiple update to the config file in this series, but the 
documentation is not updated, can you please document the changes in each patch 
updating the config?
  
Liron Himi Jan. 27, 2021, 2:09 p.m. UTC | #3
-----Original Message-----
From: Ferruh Yigit <ferruh.yigit@intel.com> 
Sent: Wednesday, 27 January 2021 02:00
To: Liron Himi <lironh@marvell.com>; Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Cc: dev@dpdk.org
Subject: [EXT] Re: [dpdk-dev] [PATCH v2 15/37] net/mvpp2: add dsa mode support

External Email

----------------------------------------------------------------------
On 1/22/2021 7:19 PM, lironh@marvell.com wrote:
> From: Liron Himi <lironh@marvell.com>
> 
> Extend the config file with 'start-hdr' field.
> currently 'eth' (default) and 'dsa' headers are supported.
> 
> Signed-off-by: Liron Himi <lironh@marvell.com>

There are multiple update to the config file in this series, but the documentation is not updated, can you please document the changes in each patch updating the config?
[L.H.] yes, I will add it as part of v3
  

Patch

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index aabe5d210..71a6e8826 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -695,6 +695,10 @@  mrvl_dev_start(struct rte_eth_dev *dev)
 	snprintf(match, sizeof(match), "ppio-%d:%d",
 		 priv->pp_id, priv->ppio_id);
 	priv->ppio_params.match = match;
+	priv->ppio_params.eth_start_hdr = PP2_PPIO_HDR_ETH;
+	if (mrvl_qos_cfg)
+		priv->ppio_params.eth_start_hdr =
+			mrvl_qos_cfg->port[dev->data->port_id].eth_start_hdr;
 
 	/*
 	 * Calculate the minimum bpool size for refill feature as follows:
diff --git a/drivers/net/mvpp2/mrvl_qos.c b/drivers/net/mvpp2/mrvl_qos.c
index 7fd970309..976cb06a8 100644
--- a/drivers/net/mvpp2/mrvl_qos.c
+++ b/drivers/net/mvpp2/mrvl_qos.c
@@ -19,6 +19,10 @@ 
 
 /* Parsing tokens. Defined conveniently, so that any correction is easy. */
 #define MRVL_TOK_DEFAULT "default"
+#define MRVL_TOK_DSA_MODE "dsa_mode"
+#define MRVL_TOK_DSA_MODE_NONE "none"
+#define MRVL_TOK_DSA_MODE_DSA "dsa"
+#define MRVL_TOK_DSA_MODE_EXT_DSA "ext_dsa"
 #define MRVL_TOK_DEFAULT_TC "default_tc"
 #define MRVL_TOK_DSCP "dscp"
 #define MRVL_TOK_MAPPING_PRIORITY "mapping_priority"
@@ -494,16 +498,19 @@  mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
 	const char *entry;
 	char sec_name[32];
 
-	if (file == NULL)
-		rte_exit(EXIT_FAILURE, "Cannot load configuration %s\n", path);
+	if (file == NULL) {
+		MRVL_LOG(ERR, "Cannot load configuration %s\n", path);
+		return -1;
+	}
 
 	/* Create configuration. This is never accessed on the fast path,
 	 * so we can ignore socket.
 	 */
 	*cfg = rte_zmalloc("mrvl_qos_cfg", sizeof(struct mrvl_qos_cfg), 0);
-	if (*cfg == NULL)
-		rte_exit(EXIT_FAILURE, "Cannot allocate configuration %s\n",
-			path);
+	if (*cfg == NULL) {
+		MRVL_LOG(ERR, "Cannot allocate configuration %s\n", path);
+		return -1;
+	}
 
 	n = rte_cfgfile_num_sections(file, MRVL_TOK_PORT,
 		sizeof(MRVL_TOK_PORT) - 1);
@@ -528,6 +535,31 @@  mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
 			continue;
 		}
 
+		entry = rte_cfgfile_get_entry(file, sec_name,
+				MRVL_TOK_DSA_MODE);
+		if (entry) {
+			if (!strncmp(entry, MRVL_TOK_DSA_MODE_NONE,
+				sizeof(MRVL_TOK_DSA_MODE_NONE)))
+				(*cfg)->port[n].eth_start_hdr =
+				PP2_PPIO_HDR_ETH;
+			else if (!strncmp(entry, MRVL_TOK_DSA_MODE_DSA,
+				sizeof(MRVL_TOK_DSA_MODE_DSA)))
+				(*cfg)->port[n].eth_start_hdr =
+				PP2_PPIO_HDR_ETH_DSA;
+			else if (!strncmp(entry, MRVL_TOK_DSA_MODE_EXT_DSA,
+				sizeof(MRVL_TOK_DSA_MODE_EXT_DSA))) {
+				(*cfg)->port[n].eth_start_hdr =
+				PP2_PPIO_HDR_ETH_EXT_DSA;
+			} else {
+				MRVL_LOG(ERR,
+					"Error in parsing %s value (%s)!\n",
+					MRVL_TOK_DSA_MODE, entry);
+				return -1;
+			}
+		} else {
+			(*cfg)->port[n].eth_start_hdr = PP2_PPIO_HDR_ETH;
+		}
+
 		/*
 		 * Read per-port rate limiting. Setting that will
 		 * disable per-queue rate limiting.
@@ -575,13 +607,15 @@  mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
 				(*cfg)->port[n].mapping_priority =
 					PP2_CLS_QOS_TBL_IP_PRI;
 			else if (!strncmp(entry, MRVL_TOK_VLAN,
-				sizeof(MRVL_TOK_VLAN)))
+				sizeof(MRVL_TOK_VLAN))) {
 				(*cfg)->port[n].mapping_priority =
 					PP2_CLS_QOS_TBL_VLAN_PRI;
-			else
-				rte_exit(EXIT_FAILURE,
+			} else {
+				MRVL_LOG(ERR,
 					"Error in parsing %s value (%s)!\n",
 					MRVL_TOK_MAPPING_PRIORITY, entry);
+				return -1;
+			}
 		} else {
 			(*cfg)->port[n].mapping_priority =
 				PP2_CLS_QOS_TBL_VLAN_IP_PRI;
@@ -604,18 +638,22 @@  mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
 
 		for (i = 0; i < MRVL_PP2_RXQ_MAX; ++i) {
 			ret = get_outq_cfg(file, n, i, *cfg);
-			if (ret < 0)
-				rte_exit(EXIT_FAILURE,
+			if (ret < 0) {
+				MRVL_LOG(ERR,
 					"Error %d parsing port %d outq %d!\n",
 					ret, n, i);
+				return -1;
+			}
 		}
 
 		for (i = 0; i < MRVL_PP2_TC_MAX; ++i) {
 			ret = parse_tc_cfg(file, n, i, *cfg);
-			if (ret < 0)
-				rte_exit(EXIT_FAILURE,
+			if (ret < 0) {
+				MRVL_LOG(ERR,
 					"Error %d parsing port %d tc %d!\n",
 					ret, n, i);
+				return -1;
+			}
 		}
 
 		entry = rte_cfgfile_get_entry(file, sec_name,
@@ -628,7 +666,8 @@  mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
 		} else {
 			if ((*cfg)->port[n].use_global_defaults == 0) {
 				MRVL_LOG(ERR,
-					 "Default Traffic Class required in custom configuration!");
+					 "Default Traffic Class required in "
+					 "custom configuration!");
 				return -1;
 			}
 		}
diff --git a/drivers/net/mvpp2/mrvl_qos.h b/drivers/net/mvpp2/mrvl_qos.h
index f03e7731c..0934752cf 100644
--- a/drivers/net/mvpp2/mrvl_qos.h
+++ b/drivers/net/mvpp2/mrvl_qos.h
@@ -20,6 +20,7 @@ 
 /* QoS config. */
 struct mrvl_qos_cfg {
 	struct port_cfg {
+		enum pp2_ppio_eth_start_hdr eth_start_hdr;
 		int rate_limit_enable;
 		struct pp2_ppio_rate_limit_params rate_limit_params;
 		struct {