[v1,19/38] net/mvpp2: replace 'qos_cfg' with 'cfg'

Message ID 20201202101212.4717-20-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 Dec. 2, 2020, 10:11 a.m. UTC
  From: Liron Himi <lironh@marvell.com>

as the config file is not just for 'qos'
it is more accurate to replace the name from 'qos_cfg'
to 'cfg'

Signed-off-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c | 12 ++++++------
 drivers/net/mvpp2/mrvl_qos.c    | 31 +++++++++++++++----------------
 drivers/net/mvpp2/mrvl_qos.h    | 13 ++++++-------
 3 files changed, 27 insertions(+), 29 deletions(-)
  

Comments

Michael Shamis Dec. 23, 2020, 9:40 a.m. UTC | #1
Reviewed-by: Michael Shamis <michaelsh@marvell.com>

-----Original Message-----
From: dev <dev-bounces@dpdk.org> On Behalf Of lironh@marvell.com
Sent: Wednesday, December 2, 2020 12:12 PM
To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
Cc: dev@dpdk.org; Liron Himi <lironh@marvell.com>
Subject: [dpdk-dev] [PATCH v1 19/38] net/mvpp2: replace 'qos_cfg' with 'cfg'

From: Liron Himi <lironh@marvell.com>

as the config file is not just for 'qos'
it is more accurate to replace the name from 'qos_cfg'
to 'cfg'

Signed-off-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c | 12 ++++++------
 drivers/net/mvpp2/mrvl_qos.c    | 31 +++++++++++++++----------------
 drivers/net/mvpp2/mrvl_qos.h    | 13 ++++++-------
 3 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 1be607b61..6bd3b0430 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -696,9 +696,9 @@ mrvl_dev_start(struct rte_eth_dev *dev)
 		 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)
+	if (mrvl_cfg)
 		priv->ppio_params.eth_start_hdr =
-			mrvl_qos_cfg->port[dev->data->port_id].eth_start_hdr;
+			mrvl_cfg->port[dev->data->port_id].eth_start_hdr;
 
 	/*
 	 * Calculate the minimum bpool size for refill feature as follows:
@@ -794,8 +794,8 @@ mrvl_dev_start(struct rte_eth_dev *dev)
 	}
 
 	/* For default QoS config, don't start classifier. */
-	if (mrvl_qos_cfg  &&
-	    mrvl_qos_cfg->port[dev->data->port_id].use_global_defaults == 0) {
+	if (mrvl_cfg  &&
+	    mrvl_cfg->port[dev->data->port_id].use_global_defaults == 0) {
 		ret = mrvl_start_qos_mapping(priv);
 		if (ret) {
 			MRVL_LOG(ERR, "Failed to setup QoS mapping"); @@ -3237,7 +3237,7 @@ rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
 	 * The below system initialization should be done only once,
 	 * on the first provided configuration file
 	 */
-	if (!mrvl_qos_cfg) {
+	if (!mrvl_cfg) {
 		cfgnum = rte_kvargs_count(kvlist, MRVL_CFG_ARG);
 		MRVL_LOG(INFO, "Parsing config file!");
 		if (cfgnum > 1) {
@@ -3245,7 +3245,7 @@ rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
 			goto out_free_kvlist;
 		} else if (cfgnum == 1) {
 			rte_kvargs_process(kvlist, MRVL_CFG_ARG,
-					   mrvl_get_qoscfg, &mrvl_qos_cfg);
+					   mrvl_get_cfg, &mrvl_cfg);
 		}
 	}
 
diff --git a/drivers/net/mvpp2/mrvl_qos.c b/drivers/net/mvpp2/mrvl_qos.c index 976cb06a8..18cf470dd 100644
--- a/drivers/net/mvpp2/mrvl_qos.c
+++ b/drivers/net/mvpp2/mrvl_qos.c
@@ -71,8 +71,8 @@
 /** Maximum possible value of DSCP. */
 #define MAX_DSCP 63
 
-/** Global QoS configuration. */
-struct mrvl_qos_cfg *mrvl_qos_cfg;
+/** Global configuration. */
+struct mrvl_cfg *mrvl_cfg;
 
 /**
  * Convert string to uint32_t with extra checks for result correctness.
@@ -104,12 +104,12 @@ get_val_securely(const char *string, uint32_t *val)
  * @param file Path to the configuration file.
  * @param port Port number.
  * @param outq Out queue number.
- * @param cfg Pointer to the Marvell QoS configuration structure.
+ * @param cfg Pointer to the Marvell configuration structure.
  * @returns 0 in case of success, negative value otherwise.
  */
 static int
 get_outq_cfg(struct rte_cfgfile *file, int port, int outq,
-		struct mrvl_qos_cfg *cfg)
+		struct mrvl_cfg *cfg)
 {
 	char sec_name[32];
 	const char *entry;
@@ -315,7 +315,7 @@ get_entry_values(const char *entry, uint8_t *tab,
  */
 static int
 parse_tc_cfg(struct rte_cfgfile *file, int port, int tc,
-		struct mrvl_qos_cfg *cfg)
+		struct mrvl_cfg *cfg)
 {
 	char sec_name[32];
 	const char *entry;
@@ -409,7 +409,7 @@ parse_tc_cfg(struct rte_cfgfile *file, int port, int tc,
  */
 static int
 parse_policer(struct rte_cfgfile *file, int port, const char *sec_name,
-		struct mrvl_qos_cfg *cfg)
+		struct mrvl_cfg *cfg)
 {
 	const char *entry;
 	uint32_t val;
@@ -478,7 +478,7 @@ parse_policer(struct rte_cfgfile *file, int port, const char *sec_name,  }
 
 /**
- * Parse QoS configuration - rte_kvargs_process handler.
+ * Parse configuration - rte_kvargs_process handler.
  *
  * Opens configuration file and parses its content.
  *
@@ -488,10 +488,9 @@ parse_policer(struct rte_cfgfile *file, int port, const char *sec_name,
  * @returns 0 in case of success, exits otherwise.
  */
 int
-mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
-		void *extra_args)
+mrvl_get_cfg(const char *key __rte_unused, const char *path, void 
+*extra_args)
 {
-	struct mrvl_qos_cfg **cfg = extra_args;
+	struct mrvl_cfg **cfg = extra_args;
 	struct rte_cfgfile *file = rte_cfgfile_load(path, 0);
 	uint32_t val;
 	int n, i, ret;
@@ -506,7 +505,7 @@ mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
 	/* 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);
+	*cfg = rte_zmalloc("mrvl_cfg", sizeof(struct mrvl_cfg), 0);
 	if (*cfg == NULL) {
 		MRVL_LOG(ERR, "Cannot allocate configuration %s\n", path);
 		return -1;
@@ -764,8 +763,8 @@ mrvl_configure_rxqs(struct mrvl_priv *priv, uint16_t portid,  {
 	size_t i, tc;
 
-	if (mrvl_qos_cfg == NULL ||
-		mrvl_qos_cfg->port[portid].use_global_defaults) {
+	if (mrvl_cfg == NULL ||
+		mrvl_cfg->port[portid].use_global_defaults) {
 		/*
 		 * No port configuration, use default: 1 TC, no QoS,
 		 * TC color set to green.
@@ -783,7 +782,7 @@ mrvl_configure_rxqs(struct mrvl_priv *priv, uint16_t portid,
 	}
 
 	/* We need only a subset of configuration. */
-	struct port_cfg *port_cfg = &mrvl_qos_cfg->port[portid];
+	struct port_cfg *port_cfg = &mrvl_cfg->port[portid];
 
 	priv->qos_tbl_params.type = port_cfg->mapping_priority;
 
@@ -896,10 +895,10 @@ mrvl_configure_txqs(struct mrvl_priv *priv, uint16_t portid,
 		uint16_t max_queues)
 {
 	/* We need only a subset of configuration. */
-	struct port_cfg *port_cfg = &mrvl_qos_cfg->port[portid];
+	struct port_cfg *port_cfg = &mrvl_cfg->port[portid];
 	int i;
 
-	if (mrvl_qos_cfg == NULL)
+	if (mrvl_cfg == NULL)
 		return 0;
 
 	priv->ppio_params.rate_limit_enable = port_cfg->rate_limit_enable; diff --git a/drivers/net/mvpp2/mrvl_qos.h b/drivers/net/mvpp2/mrvl_qos.h index 0934752cf..928cfe366 100644
--- a/drivers/net/mvpp2/mrvl_qos.h
+++ b/drivers/net/mvpp2/mrvl_qos.h
@@ -17,8 +17,8 @@
 /** Value used as "unknown". */
 #define MRVL_UNKNOWN_TC (0xFF)
 
-/* QoS config. */
-struct mrvl_qos_cfg {
+/* config. */
+struct mrvl_cfg {
 	struct port_cfg {
 		enum pp2_ppio_eth_start_hdr eth_start_hdr;
 		int rate_limit_enable;
@@ -48,11 +48,11 @@ struct mrvl_qos_cfg {
 	} port[RTE_MAX_ETHPORTS];
 };
 
-/** Global QoS configuration. */
-extern struct mrvl_qos_cfg *mrvl_qos_cfg;
+/** Global configuration. */
+extern struct mrvl_cfg *mrvl_cfg;
 
 /**
- * Parse QoS configuration - rte_kvargs_process handler.
+ * Parse configuration - rte_kvargs_process handler.
  *
  * Opens configuration file and parses its content.
  *
@@ -62,8 +62,7 @@ extern struct mrvl_qos_cfg *mrvl_qos_cfg;
  * @returns 0 in case of success, exits otherwise.
  */
 int
-mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
-		void *extra_args);
+mrvl_get_cfg(const char *key __rte_unused, const char *path, void 
+*extra_args);
 
 /**
  * Configure RX Queues in a given port.
--
2.28.0
  

Patch

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 1be607b61..6bd3b0430 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -696,9 +696,9 @@  mrvl_dev_start(struct rte_eth_dev *dev)
 		 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)
+	if (mrvl_cfg)
 		priv->ppio_params.eth_start_hdr =
-			mrvl_qos_cfg->port[dev->data->port_id].eth_start_hdr;
+			mrvl_cfg->port[dev->data->port_id].eth_start_hdr;
 
 	/*
 	 * Calculate the minimum bpool size for refill feature as follows:
@@ -794,8 +794,8 @@  mrvl_dev_start(struct rte_eth_dev *dev)
 	}
 
 	/* For default QoS config, don't start classifier. */
-	if (mrvl_qos_cfg  &&
-	    mrvl_qos_cfg->port[dev->data->port_id].use_global_defaults == 0) {
+	if (mrvl_cfg  &&
+	    mrvl_cfg->port[dev->data->port_id].use_global_defaults == 0) {
 		ret = mrvl_start_qos_mapping(priv);
 		if (ret) {
 			MRVL_LOG(ERR, "Failed to setup QoS mapping");
@@ -3237,7 +3237,7 @@  rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
 	 * The below system initialization should be done only once,
 	 * on the first provided configuration file
 	 */
-	if (!mrvl_qos_cfg) {
+	if (!mrvl_cfg) {
 		cfgnum = rte_kvargs_count(kvlist, MRVL_CFG_ARG);
 		MRVL_LOG(INFO, "Parsing config file!");
 		if (cfgnum > 1) {
@@ -3245,7 +3245,7 @@  rte_pmd_mrvl_probe(struct rte_vdev_device *vdev)
 			goto out_free_kvlist;
 		} else if (cfgnum == 1) {
 			rte_kvargs_process(kvlist, MRVL_CFG_ARG,
-					   mrvl_get_qoscfg, &mrvl_qos_cfg);
+					   mrvl_get_cfg, &mrvl_cfg);
 		}
 	}
 
diff --git a/drivers/net/mvpp2/mrvl_qos.c b/drivers/net/mvpp2/mrvl_qos.c
index 976cb06a8..18cf470dd 100644
--- a/drivers/net/mvpp2/mrvl_qos.c
+++ b/drivers/net/mvpp2/mrvl_qos.c
@@ -71,8 +71,8 @@ 
 /** Maximum possible value of DSCP. */
 #define MAX_DSCP 63
 
-/** Global QoS configuration. */
-struct mrvl_qos_cfg *mrvl_qos_cfg;
+/** Global configuration. */
+struct mrvl_cfg *mrvl_cfg;
 
 /**
  * Convert string to uint32_t with extra checks for result correctness.
@@ -104,12 +104,12 @@  get_val_securely(const char *string, uint32_t *val)
  * @param file Path to the configuration file.
  * @param port Port number.
  * @param outq Out queue number.
- * @param cfg Pointer to the Marvell QoS configuration structure.
+ * @param cfg Pointer to the Marvell configuration structure.
  * @returns 0 in case of success, negative value otherwise.
  */
 static int
 get_outq_cfg(struct rte_cfgfile *file, int port, int outq,
-		struct mrvl_qos_cfg *cfg)
+		struct mrvl_cfg *cfg)
 {
 	char sec_name[32];
 	const char *entry;
@@ -315,7 +315,7 @@  get_entry_values(const char *entry, uint8_t *tab,
  */
 static int
 parse_tc_cfg(struct rte_cfgfile *file, int port, int tc,
-		struct mrvl_qos_cfg *cfg)
+		struct mrvl_cfg *cfg)
 {
 	char sec_name[32];
 	const char *entry;
@@ -409,7 +409,7 @@  parse_tc_cfg(struct rte_cfgfile *file, int port, int tc,
  */
 static int
 parse_policer(struct rte_cfgfile *file, int port, const char *sec_name,
-		struct mrvl_qos_cfg *cfg)
+		struct mrvl_cfg *cfg)
 {
 	const char *entry;
 	uint32_t val;
@@ -478,7 +478,7 @@  parse_policer(struct rte_cfgfile *file, int port, const char *sec_name,
 }
 
 /**
- * Parse QoS configuration - rte_kvargs_process handler.
+ * Parse configuration - rte_kvargs_process handler.
  *
  * Opens configuration file and parses its content.
  *
@@ -488,10 +488,9 @@  parse_policer(struct rte_cfgfile *file, int port, const char *sec_name,
  * @returns 0 in case of success, exits otherwise.
  */
 int
-mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
-		void *extra_args)
+mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args)
 {
-	struct mrvl_qos_cfg **cfg = extra_args;
+	struct mrvl_cfg **cfg = extra_args;
 	struct rte_cfgfile *file = rte_cfgfile_load(path, 0);
 	uint32_t val;
 	int n, i, ret;
@@ -506,7 +505,7 @@  mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
 	/* 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);
+	*cfg = rte_zmalloc("mrvl_cfg", sizeof(struct mrvl_cfg), 0);
 	if (*cfg == NULL) {
 		MRVL_LOG(ERR, "Cannot allocate configuration %s\n", path);
 		return -1;
@@ -764,8 +763,8 @@  mrvl_configure_rxqs(struct mrvl_priv *priv, uint16_t portid,
 {
 	size_t i, tc;
 
-	if (mrvl_qos_cfg == NULL ||
-		mrvl_qos_cfg->port[portid].use_global_defaults) {
+	if (mrvl_cfg == NULL ||
+		mrvl_cfg->port[portid].use_global_defaults) {
 		/*
 		 * No port configuration, use default: 1 TC, no QoS,
 		 * TC color set to green.
@@ -783,7 +782,7 @@  mrvl_configure_rxqs(struct mrvl_priv *priv, uint16_t portid,
 	}
 
 	/* We need only a subset of configuration. */
-	struct port_cfg *port_cfg = &mrvl_qos_cfg->port[portid];
+	struct port_cfg *port_cfg = &mrvl_cfg->port[portid];
 
 	priv->qos_tbl_params.type = port_cfg->mapping_priority;
 
@@ -896,10 +895,10 @@  mrvl_configure_txqs(struct mrvl_priv *priv, uint16_t portid,
 		uint16_t max_queues)
 {
 	/* We need only a subset of configuration. */
-	struct port_cfg *port_cfg = &mrvl_qos_cfg->port[portid];
+	struct port_cfg *port_cfg = &mrvl_cfg->port[portid];
 	int i;
 
-	if (mrvl_qos_cfg == NULL)
+	if (mrvl_cfg == NULL)
 		return 0;
 
 	priv->ppio_params.rate_limit_enable = port_cfg->rate_limit_enable;
diff --git a/drivers/net/mvpp2/mrvl_qos.h b/drivers/net/mvpp2/mrvl_qos.h
index 0934752cf..928cfe366 100644
--- a/drivers/net/mvpp2/mrvl_qos.h
+++ b/drivers/net/mvpp2/mrvl_qos.h
@@ -17,8 +17,8 @@ 
 /** Value used as "unknown". */
 #define MRVL_UNKNOWN_TC (0xFF)
 
-/* QoS config. */
-struct mrvl_qos_cfg {
+/* config. */
+struct mrvl_cfg {
 	struct port_cfg {
 		enum pp2_ppio_eth_start_hdr eth_start_hdr;
 		int rate_limit_enable;
@@ -48,11 +48,11 @@  struct mrvl_qos_cfg {
 	} port[RTE_MAX_ETHPORTS];
 };
 
-/** Global QoS configuration. */
-extern struct mrvl_qos_cfg *mrvl_qos_cfg;
+/** Global configuration. */
+extern struct mrvl_cfg *mrvl_cfg;
 
 /**
- * Parse QoS configuration - rte_kvargs_process handler.
+ * Parse configuration - rte_kvargs_process handler.
  *
  * Opens configuration file and parses its content.
  *
@@ -62,8 +62,7 @@  extern struct mrvl_qos_cfg *mrvl_qos_cfg;
  * @returns 0 in case of success, exits otherwise.
  */
 int
-mrvl_get_qoscfg(const char *key __rte_unused, const char *path,
-		void *extra_args);
+mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args);
 
 /**
  * Configure RX Queues in a given port.