DPDK patches and discussions
 help / color / mirror / Atom feed
From: <psatheesh@marvell.com>
To: 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>, Satheesh Paul <psatheesh@marvell.com>
Subject: [dpdk-dev] [PATCH] net/cnxk: support flow info API
Date: Mon, 19 Dec 2022 18:48:25 +0530	[thread overview]
Message-ID: <20221219131825.4100343-1-psatheesh@marvell.com> (raw)

From: Satheesh Paul <psatheesh@marvell.com>

Implement rte_flow_info_get API to get the maximum
number of counters and meters.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Reviewed-by: Kiran Kumar K <kirankumark@marvell.com>
---
Depends-on: patch-26075 ("common/cnxk: fix dual VLAN parsing issue")

 drivers/net/cnxk/cn10k_ethdev.c    |  1 +
 drivers/net/cnxk/cn10k_flow.c      | 16 ++++++++++++++++
 drivers/net/cnxk/cn10k_flow.h      |  8 ++++++--
 drivers/net/cnxk/cn9k_ethdev.c     |  1 +
 drivers/net/cnxk/cn9k_flow.c       | 15 +++++++++++++++
 drivers/net/cnxk/cn9k_flow.h       | 10 ++++++----
 drivers/net/cnxk/cnxk_ethdev.h     |  1 +
 drivers/net/cnxk/cnxk_ethdev_mtr.c |  1 -
 8 files changed, 46 insertions(+), 7 deletions(-)

diff --git a/drivers/net/cnxk/cn10k_ethdev.c b/drivers/net/cnxk/cn10k_ethdev.c
index 4658713591..ef1637ec08 100644
--- a/drivers/net/cnxk/cn10k_ethdev.c
+++ b/drivers/net/cnxk/cn10k_ethdev.c
@@ -754,6 +754,7 @@ npc_flow_ops_override(void)
 	/* Update platform specific ops */
 	cnxk_flow_ops.create = cn10k_flow_create;
 	cnxk_flow_ops.destroy = cn10k_flow_destroy;
+	cnxk_flow_ops.info_get = cn10k_flow_info_get;
 }
 
 static int
diff --git a/drivers/net/cnxk/cn10k_flow.c b/drivers/net/cnxk/cn10k_flow.c
index 7df879a2bb..2ce9e1de74 100644
--- a/drivers/net/cnxk/cn10k_flow.c
+++ b/drivers/net/cnxk/cn10k_flow.c
@@ -207,6 +207,22 @@ cn10k_flow_create(struct rte_eth_dev *eth_dev, const struct rte_flow_attr *attr,
 	return (struct rte_flow *)flow;
 }
 
+int
+cn10k_flow_info_get(struct rte_eth_dev *dev, struct rte_flow_port_info *port_info,
+		    struct rte_flow_queue_info *queue_info, struct rte_flow_error *err)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(err);
+
+	memset(port_info, 0, sizeof(*port_info));
+	memset(queue_info, 0, sizeof(*queue_info));
+
+	port_info->max_nb_counters = CN10K_NPC_COUNTERS_MAX;
+	port_info->max_nb_meters = CNXK_NIX_MTR_COUNT_MAX;
+
+	return 0;
+}
+
 int
 cn10k_flow_destroy(struct rte_eth_dev *eth_dev, struct rte_flow *rte_flow,
 		   struct rte_flow_error *error)
diff --git a/drivers/net/cnxk/cn10k_flow.h b/drivers/net/cnxk/cn10k_flow.h
index f64fcf2a5e..316b74e6a6 100644
--- a/drivers/net/cnxk/cn10k_flow.h
+++ b/drivers/net/cnxk/cn10k_flow.h
@@ -6,12 +6,16 @@
 
 #include <rte_flow_driver.h>
 
-struct rte_flow *cn10k_flow_create(struct rte_eth_dev *dev,
-				   const struct rte_flow_attr *attr,
+struct rte_flow *cn10k_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 				   const struct rte_flow_item pattern[],
 				   const struct rte_flow_action actions[],
 				   struct rte_flow_error *error);
 int cn10k_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
 		       struct rte_flow_error *error);
 
+int cn10k_flow_info_get(struct rte_eth_dev *dev, struct rte_flow_port_info *port_info,
+			struct rte_flow_queue_info *queue_info, struct rte_flow_error *err);
+
+#define CN10K_NPC_COUNTERS_MAX 512
+
 #endif /* __CN10K_RTE_FLOW_H__ */
diff --git a/drivers/net/cnxk/cn9k_ethdev.c b/drivers/net/cnxk/cn9k_ethdev.c
index 3b702d9696..f08e986bd1 100644
--- a/drivers/net/cnxk/cn9k_ethdev.c
+++ b/drivers/net/cnxk/cn9k_ethdev.c
@@ -674,6 +674,7 @@ npc_flow_ops_override(void)
 	/* Update platform specific ops */
 	cnxk_flow_ops.create = cn9k_flow_create;
 	cnxk_flow_ops.destroy = cn9k_flow_destroy;
+	cnxk_flow_ops.info_get = cn9k_flow_info_get;
 }
 
 static int
diff --git a/drivers/net/cnxk/cn9k_flow.c b/drivers/net/cnxk/cn9k_flow.c
index 15ccdf8919..a418af185d 100644
--- a/drivers/net/cnxk/cn9k_flow.c
+++ b/drivers/net/cnxk/cn9k_flow.c
@@ -54,3 +54,18 @@ cn9k_flow_destroy(struct rte_eth_dev *eth_dev, struct rte_flow *rte_flow,
 
 	return cnxk_flow_destroy(eth_dev, flow, error);
 }
+
+int
+cn9k_flow_info_get(struct rte_eth_dev *dev, struct rte_flow_port_info *port_info,
+		   struct rte_flow_queue_info *queue_info, struct rte_flow_error *err)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(err);
+
+	memset(port_info, 0, sizeof(*port_info));
+	memset(queue_info, 0, sizeof(*queue_info));
+
+	port_info->max_nb_counters = CN9K_NPC_COUNTERS_MAX;
+
+	return 0;
+}
diff --git a/drivers/net/cnxk/cn9k_flow.h b/drivers/net/cnxk/cn9k_flow.h
index 43d59e1eb2..26f93ea204 100644
--- a/drivers/net/cnxk/cn9k_flow.h
+++ b/drivers/net/cnxk/cn9k_flow.h
@@ -6,12 +6,14 @@
 
 #include <rte_flow_driver.h>
 
-struct rte_flow *cn9k_flow_create(struct rte_eth_dev *dev,
-				  const struct rte_flow_attr *attr,
+struct rte_flow *cn9k_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 				  const struct rte_flow_item pattern[],
 				  const struct rte_flow_action actions[],
 				  struct rte_flow_error *error);
-int cn9k_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
-		      struct rte_flow_error *error);
+int cn9k_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, struct rte_flow_error *error);
+int cn9k_flow_info_get(struct rte_eth_dev *dev, struct rte_flow_port_info *port_info,
+		       struct rte_flow_queue_info *queue_info, struct rte_flow_error *err);
+
+#define CN9K_NPC_COUNTERS_MAX 512
 
 #endif /* __CN9K_RTE_FLOW_H__ */
diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h
index 651ef45ea8..46917bb5d4 100644
--- a/drivers/net/cnxk/cnxk_ethdev.h
+++ b/drivers/net/cnxk/cnxk_ethdev.h
@@ -112,6 +112,7 @@
 
 /* Default mark value used when none is provided. */
 #define CNXK_FLOW_ACTION_FLAG_DEFAULT 0xffff
+#define CNXK_NIX_MTR_COUNT_MAX	      73 /* 64(leaf) + 8(mid) + 1(top) */
 
 /* Default cycle counter mask */
 #define CNXK_CYCLECOUNTER_MASK     0xffffffffffffffffULL
diff --git a/drivers/net/cnxk/cnxk_ethdev_mtr.c b/drivers/net/cnxk/cnxk_ethdev_mtr.c
index 0fa18f01c7..dcfa4223d5 100644
--- a/drivers/net/cnxk/cnxk_ethdev_mtr.c
+++ b/drivers/net/cnxk/cnxk_ethdev_mtr.c
@@ -5,7 +5,6 @@
 #include "cnxk_ethdev.h"
 #include <rte_mtr_driver.h>
 
-#define NIX_MTR_COUNT_MAX      73 /* 64(leaf) + 8(mid) + 1(top) */
 #define NIX_MTR_COUNT_PER_FLOW 3  /* 1(leaf) + 1(mid) + 1(top) */
 
 #define NIX_BPF_STATS_MASK_ALL                                                 \
-- 
2.35.3


             reply	other threads:[~2022-12-19 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19 13:18 psatheesh [this message]
2023-01-12  6:24 ` 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=20221219131825.4100343-1-psatheesh@marvell.com \
    --to=psatheesh@marvell.com \
    --cc=dev@dpdk.org \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.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).