DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/cnxk: support flow info API
@ 2022-12-19 13:18 psatheesh
  2023-01-12  6:24 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: psatheesh @ 2022-12-19 13:18 UTC (permalink / raw)
  To: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao
  Cc: dev, Satheesh Paul

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/cnxk: support flow info API
  2022-12-19 13:18 [dpdk-dev] [PATCH] net/cnxk: support flow info API psatheesh
@ 2023-01-12  6:24 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2023-01-12  6:24 UTC (permalink / raw)
  To: psatheesh
  Cc: Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao, dev

On Mon, Dec 19, 2022 at 6:48 PM <psatheesh@marvell.com> wrote:
>
> 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")



Applied to dpdk-next-net-mrvl/for-next-net. Thanks

>
>  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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-01-12  6:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19 13:18 [dpdk-dev] [PATCH] net/cnxk: support flow info API psatheesh
2023-01-12  6:24 ` Jerin Jacob

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).