diff mbox series

[v1,38/38] net/mvpp2: add fill_bpool_buffs to cfg file

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

Checks

Context Check Description
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/checkpatch success coding style OK

Commit Message

Liron Himi Dec. 2, 2020, 10:12 a.m. UTC
From: Dana Vardi <danat@marvell.com>

extend config file with 'fill_bpool_buffs'
which control the amount of refill buffers

Signed-off-by: Dana Vardi <danat@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c |  7 ++++---
 drivers/net/mvpp2/mrvl_ethdev.h |  3 +++
 drivers/net/mvpp2/mrvl_qos.c    | 21 +++++++++++++++++++++
 drivers/net/mvpp2/mrvl_qos.h    |  1 +
 4 files changed, 29 insertions(+), 3 deletions(-)

Comments

Michael Shamis Dec. 23, 2020, 9:28 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; Dana Vardi <danat@marvell.com>; Liron Himi <lironh@marvell.com>
Subject: [dpdk-dev] [PATCH v1 38/38] net/mvpp2: add fill_bpool_buffs to cfg file

From: Dana Vardi <danat@marvell.com>

extend config file with 'fill_bpool_buffs'
which control the amount of refill buffers

Signed-off-by: Dana Vardi <danat@marvell.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c |  7 ++++---  drivers/net/mvpp2/mrvl_ethdev.h |  3 +++
 drivers/net/mvpp2/mrvl_qos.c    | 21 +++++++++++++++++++++
 drivers/net/mvpp2/mrvl_qos.h    |  1 +
 4 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index ca94805fb..725ecced4 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -52,8 +52,6 @@
 #define MRVL_IFACE_NAME_ARG "iface"
 #define MRVL_CFG_ARG "cfg"
 
-#define MRVL_BURST_SIZE 64
-
 #define MRVL_ARP_LENGTH 28
 
 #define MRVL_COOKIE_ADDR_INVALID ~0ULL
@@ -799,12 +797,15 @@ mrvl_dev_start(struct rte_eth_dev *dev)
 	priv->ppio_params.match = match;
 	priv->ppio_params.eth_start_hdr = PP2_PPIO_HDR_ETH;
 	priv->forward_bad_frames = 0;
+	priv->fill_bpool_buffs = MRVL_BURST_SIZE;
 
 	if (mrvl_cfg) {
 		priv->ppio_params.eth_start_hdr =
 			mrvl_cfg->port[dev->data->port_id].eth_start_hdr;
 		priv->forward_bad_frames =
 			mrvl_cfg->port[dev->data->port_id].forward_bad_frames;
+		priv->fill_bpool_buffs =
+			mrvl_cfg->port[dev->data->port_id].fill_bpool_buffs;
 	}
 
 	/*
@@ -2754,7 +2755,7 @@ mrvl_rx_pkt_burst(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
 		if (unlikely(num <= q->priv->bpool_min_size ||
 			     (!rx_done && num < q->priv->bpool_init_size))) {
-			ret = mrvl_fill_bpool(q, MRVL_BURST_SIZE);
+			ret = mrvl_fill_bpool(q, q->priv->fill_bpool_buffs);
 			if (ret)
 				MRVL_LOG(DEBUG, "Failed to fill bpool");
 		} else if (unlikely(num > q->priv->bpool_max_size)) { diff --git a/drivers/net/mvpp2/mrvl_ethdev.h b/drivers/net/mvpp2/mrvl_ethdev.h index 2c1c159b9..fc4f3b799 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.h
+++ b/drivers/net/mvpp2/mrvl_ethdev.h
@@ -82,6 +82,8 @@
 /** Maximum length of a match string */  #define MRVL_MATCH_LEN 16
 
+#define MRVL_BURST_SIZE 64
+
 /** PMD-specific definition of a flow rule handle. */  struct mrvl_mtr;  struct rte_flow { @@ -184,6 +186,7 @@ struct mrvl_priv {
 	uint64_t rate_max;
 
 	uint8_t forward_bad_frames;
+	uint32_t fill_bpool_buffs;
 };
 
 /** Flow operations forward declaration. */ diff --git a/drivers/net/mvpp2/mrvl_qos.c b/drivers/net/mvpp2/mrvl_qos.c index d9af07c3d..8a6ad5d3b 100644
--- a/drivers/net/mvpp2/mrvl_qos.c
+++ b/drivers/net/mvpp2/mrvl_qos.c
@@ -79,6 +79,9 @@
 /* paser forward bad frames tokens */
 #define MRVL_TOK_FWD_BAD_FRAMES "forward_bad_frames"
 
+/* parse fill bpool buffers tokens */
+#define MRVL_TOK_FILL_BPOOL_BUFFS "fill_bpool_buffs"
+
 /** Number of tokens in range a-b = 2. */  #define MAX_RNG_TOKENS 2
 
@@ -720,6 +723,11 @@ mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args)
 		/* Use global defaults, unless an override occurs */
 		(*cfg)->port[n].use_qos_global_defaults = 1;
 
+		/* Set non-zero defaults before the decision to continue to next
+		 * port or to parse the port section in config file
+		 */
+		(*cfg)->port[n].fill_bpool_buffs = MRVL_BURST_SIZE;
+
 		/* Skip ports non-existing in configuration. */
 		if (rte_cfgfile_num_sections(file, sec_name,
 				strlen(sec_name)) <= 0) {
@@ -889,6 +897,19 @@ mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args)
 		} else {
 			(*cfg)->port[n].forward_bad_frames = 0;
 		}
+
+		/* Parse fill bpool buffs option */
+		entry = rte_cfgfile_get_entry(file, sec_name,
+				MRVL_TOK_FILL_BPOOL_BUFFS);
+		if (entry) {
+			if (get_val_securely(entry, &val) < 0) {
+				MRVL_LOG(ERR,
+					"Error in parsing %s value (%s)!\n",
+					MRVL_TOK_FILL_BPOOL_BUFFS, entry);
+				return -1;
+			}
+			(*cfg)->port[n].fill_bpool_buffs = val;
+		}
 	}
 
 	return 0;
diff --git a/drivers/net/mvpp2/mrvl_qos.h b/drivers/net/mvpp2/mrvl_qos.h index 763130bf1..38ea309ca 100644
--- a/drivers/net/mvpp2/mrvl_qos.h
+++ b/drivers/net/mvpp2/mrvl_qos.h
@@ -49,6 +49,7 @@ struct mrvl_cfg {
 		struct pp2_cls_plcr_params policer_params;
 		uint8_t setup_policer;
 		uint8_t forward_bad_frames;
+		uint32_t fill_bpool_buffs;
 	} port[RTE_MAX_ETHPORTS];
 };
 
--
2.28.0
diff mbox series

Patch

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index ca94805fb..725ecced4 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -52,8 +52,6 @@ 
 #define MRVL_IFACE_NAME_ARG "iface"
 #define MRVL_CFG_ARG "cfg"
 
-#define MRVL_BURST_SIZE 64
-
 #define MRVL_ARP_LENGTH 28
 
 #define MRVL_COOKIE_ADDR_INVALID ~0ULL
@@ -799,12 +797,15 @@  mrvl_dev_start(struct rte_eth_dev *dev)
 	priv->ppio_params.match = match;
 	priv->ppio_params.eth_start_hdr = PP2_PPIO_HDR_ETH;
 	priv->forward_bad_frames = 0;
+	priv->fill_bpool_buffs = MRVL_BURST_SIZE;
 
 	if (mrvl_cfg) {
 		priv->ppio_params.eth_start_hdr =
 			mrvl_cfg->port[dev->data->port_id].eth_start_hdr;
 		priv->forward_bad_frames =
 			mrvl_cfg->port[dev->data->port_id].forward_bad_frames;
+		priv->fill_bpool_buffs =
+			mrvl_cfg->port[dev->data->port_id].fill_bpool_buffs;
 	}
 
 	/*
@@ -2754,7 +2755,7 @@  mrvl_rx_pkt_burst(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 
 		if (unlikely(num <= q->priv->bpool_min_size ||
 			     (!rx_done && num < q->priv->bpool_init_size))) {
-			ret = mrvl_fill_bpool(q, MRVL_BURST_SIZE);
+			ret = mrvl_fill_bpool(q, q->priv->fill_bpool_buffs);
 			if (ret)
 				MRVL_LOG(DEBUG, "Failed to fill bpool");
 		} else if (unlikely(num > q->priv->bpool_max_size)) {
diff --git a/drivers/net/mvpp2/mrvl_ethdev.h b/drivers/net/mvpp2/mrvl_ethdev.h
index 2c1c159b9..fc4f3b799 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.h
+++ b/drivers/net/mvpp2/mrvl_ethdev.h
@@ -82,6 +82,8 @@ 
 /** Maximum length of a match string */
 #define MRVL_MATCH_LEN 16
 
+#define MRVL_BURST_SIZE 64
+
 /** PMD-specific definition of a flow rule handle. */
 struct mrvl_mtr;
 struct rte_flow {
@@ -184,6 +186,7 @@  struct mrvl_priv {
 	uint64_t rate_max;
 
 	uint8_t forward_bad_frames;
+	uint32_t fill_bpool_buffs;
 };
 
 /** Flow operations forward declaration. */
diff --git a/drivers/net/mvpp2/mrvl_qos.c b/drivers/net/mvpp2/mrvl_qos.c
index d9af07c3d..8a6ad5d3b 100644
--- a/drivers/net/mvpp2/mrvl_qos.c
+++ b/drivers/net/mvpp2/mrvl_qos.c
@@ -79,6 +79,9 @@ 
 /* paser forward bad frames tokens */
 #define MRVL_TOK_FWD_BAD_FRAMES "forward_bad_frames"
 
+/* parse fill bpool buffers tokens */
+#define MRVL_TOK_FILL_BPOOL_BUFFS "fill_bpool_buffs"
+
 /** Number of tokens in range a-b = 2. */
 #define MAX_RNG_TOKENS 2
 
@@ -720,6 +723,11 @@  mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args)
 		/* Use global defaults, unless an override occurs */
 		(*cfg)->port[n].use_qos_global_defaults = 1;
 
+		/* Set non-zero defaults before the decision to continue to next
+		 * port or to parse the port section in config file
+		 */
+		(*cfg)->port[n].fill_bpool_buffs = MRVL_BURST_SIZE;
+
 		/* Skip ports non-existing in configuration. */
 		if (rte_cfgfile_num_sections(file, sec_name,
 				strlen(sec_name)) <= 0) {
@@ -889,6 +897,19 @@  mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args)
 		} else {
 			(*cfg)->port[n].forward_bad_frames = 0;
 		}
+
+		/* Parse fill bpool buffs option */
+		entry = rte_cfgfile_get_entry(file, sec_name,
+				MRVL_TOK_FILL_BPOOL_BUFFS);
+		if (entry) {
+			if (get_val_securely(entry, &val) < 0) {
+				MRVL_LOG(ERR,
+					"Error in parsing %s value (%s)!\n",
+					MRVL_TOK_FILL_BPOOL_BUFFS, entry);
+				return -1;
+			}
+			(*cfg)->port[n].fill_bpool_buffs = val;
+		}
 	}
 
 	return 0;
diff --git a/drivers/net/mvpp2/mrvl_qos.h b/drivers/net/mvpp2/mrvl_qos.h
index 763130bf1..38ea309ca 100644
--- a/drivers/net/mvpp2/mrvl_qos.h
+++ b/drivers/net/mvpp2/mrvl_qos.h
@@ -49,6 +49,7 @@  struct mrvl_cfg {
 		struct pp2_cls_plcr_params policer_params;
 		uint8_t setup_policer;
 		uint8_t forward_bad_frames;
+		uint32_t fill_bpool_buffs;
 	} port[RTE_MAX_ETHPORTS];
 };