DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rakesh Kudurumalla <rkudurumalla@marvell.com>
To: <jerinj@marvell.com>, Nithin Dabilpuram <ndabilpuram@marvell.com>,
	"Kiran Kumar K" <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>
Cc: <dev@dpdk.org>, Rakesh Kudurumalla <rkudurumalla@marvell.com>,
	"Sunil Kumar Kori" <skori@mavell.com>
Subject: [PATCH v3 1/2] net/cnxk: update meter bpf ID in Receive Queue
Date: Thu, 13 Jan 2022 17:58:06 +0530	[thread overview]
Message-ID: <20220113122807.1570511-1-rkudurumalla@marvell.com> (raw)
In-Reply-To: <20211130064147.1023321-1-rkudurumalla@marvell.com>

Patch updates configured meter bpf is in receive queue
context during meter creation

Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
Acked-by: Sunil Kumar Kori <skori@mavell.com>
---
v3: Fix commit message spelling
 drivers/net/cnxk/cn10k_rte_flow.c  |  7 +++----
 drivers/net/cnxk/cnxk_ethdev_mtr.c | 21 ++++++++++++++++-----
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/net/cnxk/cn10k_rte_flow.c b/drivers/net/cnxk/cn10k_rte_flow.c
index b830abe63e..529fb0e4b7 100644
--- a/drivers/net/cnxk/cn10k_rte_flow.c
+++ b/drivers/net/cnxk/cn10k_rte_flow.c
@@ -36,20 +36,20 @@ cn10k_mtr_configure(struct rte_eth_dev *eth_dev,
 	for (i = 0; actions[i].type != RTE_FLOW_ACTION_TYPE_END; i++) {
 		if (actions[i].type == RTE_FLOW_ACTION_TYPE_METER) {
 			mtr_conf = (const struct rte_flow_action_meter
-					    *)(actions->conf);
+					    *)(actions[i].conf);
 			mtr_id = mtr_conf->mtr_id;
 			is_mtr_act = true;
 		}
 		if (actions[i].type == RTE_FLOW_ACTION_TYPE_QUEUE) {
 			q_conf = (const struct rte_flow_action_queue
-					  *)(actions->conf);
+					  *)(actions[i].conf);
 			if (is_mtr_act)
 				nix_mtr_rq_update(eth_dev, mtr_id, 1,
 						  &q_conf->index);
 		}
 		if (actions[i].type == RTE_FLOW_ACTION_TYPE_RSS) {
 			rss_conf = (const struct rte_flow_action_rss
-					    *)(actions->conf);
+					    *)(actions[i].conf);
 			if (is_mtr_act)
 				nix_mtr_rq_update(eth_dev, mtr_id,
 						  rss_conf->queue_num,
@@ -171,7 +171,6 @@ cn10k_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
 			return NULL;
 		}
 	}
-
 	for (i = 0; actions[i].type != RTE_FLOW_ACTION_TYPE_END; i++) {
 		if (actions[i].type == RTE_FLOW_ACTION_TYPE_METER) {
 			mtr = (const struct rte_flow_action_meter *)actions[i]
diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c
index 39d8563826..cc783e5f86 100644
--- a/drivers/net/cnxk/cnxk_ethdev_mtr.c
+++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c
@@ -35,7 +35,6 @@ static struct rte_mtr_capabilities mtr_capa = {
 	.chaining_n_mtrs_per_flow_max = NIX_MTR_COUNT_PER_FLOW,
 	.chaining_use_prev_mtr_color_supported = true,
 	.chaining_use_prev_mtr_color_enforced = true,
-	.meter_rate_max = NIX_BPF_RATE_MAX / 8, /* Bytes per second */
 	.color_aware_srtcm_rfc2697_supported = true,
 	.color_aware_trtcm_rfc2698_supported = true,
 	.color_aware_trtcm_rfc4115_supported = true,
@@ -180,13 +179,13 @@ cnxk_nix_mtr_capabilities_get(struct rte_eth_dev *dev,
 			      struct rte_mtr_capabilities *capa,
 			      struct rte_mtr_error *error)
 {
-	struct cnxk_eth_dev *eth_dev = cnxk_eth_pmd_priv(dev);
-	uint16_t count[ROC_NIX_BPF_LEVEL_MAX] = {0};
 	uint8_t lvl_mask = ROC_NIX_BPF_LEVEL_F_LEAF | ROC_NIX_BPF_LEVEL_F_MID |
 			   ROC_NIX_BPF_LEVEL_F_TOP;
+	struct cnxk_eth_dev *eth_dev = cnxk_eth_pmd_priv(dev);
+	uint16_t count[ROC_NIX_BPF_LEVEL_MAX] = {0};
 	struct roc_nix *nix = &eth_dev->nix;
-	int rc;
-	int i;
+	uint32_t time_unit;
+	int rc, i;
 
 	RTE_SET_USED(dev);
 
@@ -207,6 +206,15 @@ cnxk_nix_mtr_capabilities_get(struct rte_eth_dev *dev,
 	mtr_capa.meter_trtcm_rfc4115_n_max = mtr_capa.n_max;
 	mtr_capa.meter_policy_n_max = mtr_capa.n_max;
 
+	rc = roc_nix_bpf_timeunit_get(nix, &time_unit);
+	if (rc)
+		return rc;
+
+	mtr_capa.meter_rate_max =
+		NIX_BPF_RATE(time_unit, NIX_BPF_MAX_RATE_EXPONENT,
+			     NIX_BPF_MAX_RATE_MANTISSA, 0) /
+		8;
+
 	*capa = mtr_capa;
 	return 0;
 }
@@ -304,6 +312,9 @@ cnxk_nix_mtr_policy_validate(struct rte_eth_dev *dev,
 				if (action->type == RTE_FLOW_ACTION_TYPE_DROP)
 					supported[i] = true;
 
+				if (action->type == RTE_FLOW_ACTION_TYPE_VOID)
+					supported[i] = true;
+
 				if (!supported[i]) {
 					sprintf(message,
 						"%s action is not valid",
-- 
2.25.1


  parent reply	other threads:[~2022-01-13 12:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-30  6:41 [PATCH 1/2] net/cnxk: update meter bpf ID in rq Rakesh Kudurumalla
2021-11-30  6:41 ` [PATCH 2/2] common/cnxk: update meter algorithm in band profile Rakesh Kudurumalla
2021-11-30  7:15   ` Sunil Kumar Kori
2021-11-30  7:16 ` [PATCH 1/2] net/cnxk: update meter bpf ID in rq Sunil Kumar Kori
2022-01-10  8:45   ` Jerin Jacob
2022-01-11 12:46 ` Ferruh Yigit
2022-01-13  8:21   ` [EXT] " Rakesh Kudurumalla
2022-01-13 12:20 ` [PATCH v2 1/2] net/cnxk: update meter bpf ID in Recevie Queue Rakesh Kudurumalla
2022-01-13 12:20   ` [PATCH v2 2/2] common/cnxk: update meter algorithm in band profile Rakesh Kudurumalla
2022-01-13 12:28 ` Rakesh Kudurumalla [this message]
2022-01-13 12:28   ` [PATCH v3 " Rakesh Kudurumalla
2022-01-20  8:43   ` [PATCH v3 1/2] net/cnxk: update meter bpf ID in Receive Queue Jerin Jacob

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=20220113122807.1570511-1-rkudurumalla@marvell.com \
    --to=rkudurumalla@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skori@mavell.com \
    --cc=skoteshwar@marvell.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).