DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dekel Peled <dekelp@nvidia.com>
To: viacheslavo@nvidia.com, shahafs@nvidia.com, matan@nvidia.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 3/3] common/mlx5: move to formal ASO action API
Date: Wed, 18 Nov 2020 10:59:57 +0200	[thread overview]
Message-ID: <c1aaa4a92d9f8402b7ebd70920b72ec508976827.1605689124.git.dekelp@nvidia.com> (raw)
In-Reply-To: <cover.1605689124.git.dekelp@nvidia.com>

Existing code uses the previous API offered by rdma-core in order
to create ASO Flow Hit action.

A general API is now formally released, to create ASO action of any type.
This patch moves the MLX5 PMD code to use the formal API.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/linux/meson.build |  4 +--
 drivers/common/mlx5/linux/mlx5_glue.c | 38 ++++++++++++++++-----------
 drivers/common/mlx5/linux/mlx5_glue.h |  6 ++---
 drivers/net/mlx5/linux/mlx5_os.c      |  4 +--
 drivers/net/mlx5/mlx5_flow_dv.c       | 11 +++++---
 5 files changed, 36 insertions(+), 27 deletions(-)

diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build
index 87f7bfda51..63b78e4bce 100644
--- a/drivers/common/mlx5/linux/meson.build
+++ b/drivers/common/mlx5/linux/meson.build
@@ -181,8 +181,8 @@ has_sym_args = [
 	[ 'HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY', 'infiniband/mlx5dv.h',
 	'mlx5dv_dr_action_create_dest_array'],
 	[ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ],
-        [ 'HAVE_MLX5DV_DR_ACTION_FLOW_HIT', 'infiniband/mlx5dv.h',
-        'mlx5dv_dr_action_create_flow_hit'],
+        [ 'HAVE_MLX5_DR_CREATE_ACTION_ASO', 'infiniband/mlx5dv.h',
+        'mlx5dv_dr_action_create_aso' ],
 ]
 config = configuration_data()
 foreach arg:has_sym_args
diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c
index cc6670c5bd..8146c79287 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.c
+++ b/drivers/common/mlx5/linux/mlx5_glue.c
@@ -811,6 +811,27 @@ mlx5_glue_dv_modify_flow_action_meter(void *action,
 #endif
 }
 
+static void *
+mlx5_glue_dv_create_flow_action_aso(struct mlx5dv_dr_domain *domain,
+				    void *aso_obj,
+				    uint32_t offset,
+				    uint32_t flags,
+				    uint8_t return_reg_c)
+{
+#if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_ASO)
+	return mlx5dv_dr_action_create_aso(domain, aso_obj, offset,
+					   flags, return_reg_c);
+#else
+	(void)domain;
+	(void)aso_obj;
+	(void)offset;
+	(void)flags;
+	(void)return_reg_c;
+	errno = ENOTSUP;
+	return NULL;
+#endif
+}
+
 static void *
 mlx5_glue_dr_create_flow_action_default_miss(void)
 {
@@ -1281,21 +1302,6 @@ mlx5_glue_dv_free_pp(struct mlx5dv_pp *pp)
 #endif
 }
 
-static void *
-mlx5_glue_dr_action_create_flow_hit(struct mlx5dv_devx_obj *devx_obj,
-				    uint32_t offset, uint8_t reg_c_index)
-{
-#ifdef HAVE_MLX5DV_DR_ACTION_FLOW_HIT
-	return mlx5dv_dr_action_create_flow_hit(devx_obj, offset, reg_c_index);
-#else
-	(void)(devx_obj);
-	(void)(offset);
-	(void)(reg_c_index);
-	errno = ENOTSUP;
-	return NULL;
-#endif
-}
-
 __rte_cache_aligned
 const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
 	.version = MLX5_GLUE_VERSION,
@@ -1379,6 +1385,7 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
 	.dv_create_flow_action_tag =  mlx5_glue_dv_create_flow_action_tag,
 	.dv_create_flow_action_meter = mlx5_glue_dv_create_flow_action_meter,
 	.dv_modify_flow_action_meter = mlx5_glue_dv_modify_flow_action_meter,
+	.dv_create_flow_action_aso = mlx5_glue_dv_create_flow_action_aso,
 	.dr_create_flow_action_default_miss =
 		mlx5_glue_dr_create_flow_action_default_miss,
 	.dv_destroy_flow = mlx5_glue_dv_destroy_flow,
@@ -1415,5 +1422,4 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
 	.dv_free_var = mlx5_glue_dv_free_var,
 	.dv_alloc_pp = mlx5_glue_dv_alloc_pp,
 	.dv_free_pp = mlx5_glue_dv_free_pp,
-	.dr_action_create_flow_hit = mlx5_glue_dr_action_create_flow_hit,
 };
diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h
index c5d7853ea9..8be446a902 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.h
+++ b/drivers/common/mlx5/linux/mlx5_glue.h
@@ -344,9 +344,9 @@ struct mlx5_glue {
 			(void *domain,
 			 size_t num_dest,
 			 struct mlx5dv_dr_action_dest_attr *dests[]);
-	void *(*dr_action_create_flow_hit)(struct mlx5dv_devx_obj *devx_obj,
-					   uint32_t offset,
-					   uint8_t reg_c_index);
+	void *(*dv_create_flow_action_aso)
+			(struct mlx5dv_dr_domain *domain, void *aso_obj,
+			 uint32_t offset, uint32_t flags, uint8_t return_reg_c);
 };
 
 extern const struct mlx5_glue *mlx5_glue;
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 468ef3356f..2dfed4b16f 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1200,7 +1200,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 			}
 		}
 #endif
-#ifdef HAVE_MLX5DV_DR_ACTION_FLOW_HIT
+#ifdef HAVE_MLX5_DR_CREATE_ACTION_ASO
 		if (config->hca_attr.flow_hit_aso &&
 		    priv->mtr_color_reg == REG_C_3) {
 			sh->flow_hit_aso_en = 1;
@@ -1211,7 +1211,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 			}
 			DRV_LOG(DEBUG, "Flow Hit ASO is supported.");
 		}
-#endif /* HAVE_MLX5DV_DR_ACTION_FLOW_HIT */
+#endif /* HAVE_MLX5_DR_CREATE_ACTION_ASO */
 #if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE)
 		if (config->hca_attr.log_max_ft_sampler_num > 0  &&
 		    config->dv_flow_en) {
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index ae8967ec58..b3e71fc564 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -9491,10 +9491,13 @@ flow_dv_aso_age_alloc(struct rte_eth_dev *dev, struct rte_flow_error *error)
 					   "for ASO flow hit");
 			return 0; /* 0 is an error. */
 		}
-		age_free->dr_action = mlx5_glue->dr_action_create_flow_hit
-						(pool->flow_hit_aso_obj->obj,
-						 age_free->offset,
-						 (reg_c - REG_C_0));
+#ifdef HAVE_MLX5_DR_CREATE_ACTION_ASO
+		age_free->dr_action = mlx5_glue->dv_create_flow_action_aso
+				(priv->sh->rx_domain,
+				 pool->flow_hit_aso_obj->obj, age_free->offset,
+				 MLX5DV_DR_ACTION_FLAGS_ASO_FIRST_HIT_SET,
+				 (reg_c - REG_C_0));
+#endif /* HAVE_MLX5_DR_CREATE_ACTION_ASO */
 		if (!age_free->dr_action) {
 			rte_errno = errno;
 			rte_spinlock_lock(&mng->free_sl);
-- 
2.25.1


  parent reply	other threads:[~2020-11-18  9:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18  8:59 [dpdk-dev] [PATCH 0/3] ASO age action fixes Dekel Peled
2020-11-18  8:59 ` [dpdk-dev] [PATCH 1/3] net/mlx5: fix unfreed memory on ASO age close Dekel Peled
2020-11-18  8:59 ` [dpdk-dev] [PATCH 2/3] net/mlx5: fix input register for ASO object Dekel Peled
2020-11-18  8:59 ` Dekel Peled [this message]
2020-11-19 16:18 ` [dpdk-dev] [PATCH 0/3] ASO age action fixes Raslan Darawsheh

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=c1aaa4a92d9f8402b7ebd70920b72ec508976827.1605689124.git.dekelp@nvidia.com \
    --to=dekelp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=viacheslavo@nvidia.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).