DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1 0/2] Windows sampling actions
@ 2021-01-03 12:15 Ophir Munk
  2021-01-03 12:15 ` [dpdk-dev] [PATCH v1 1/2] net/mlx5/linux: wrap sampling actions with OS calls Ophir Munk
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ophir Munk @ 2021-01-03 12:15 UTC (permalink / raw)
  To: dev, Raslan Darawsheh
  Cc: Thomas Monjalon, Matan Azrad, Tal Shnaiderman, Ophir Munk

v1: First release

Ophir Munk (2):
  net/mlx5/linux: wrap sampling actions with OS calls
  net/mlx5/windows: implement sampling actions wrappers

 drivers/common/mlx5/windows/mlx5_glue.h | 34 +++++++++++++++++++++
 drivers/net/mlx5/linux/mlx5_flow_os.h   | 47 +++++++++++++++++++++++++++++
 drivers/net/mlx5/mlx5_flow_dv.c         | 15 +++++-----
 drivers/net/mlx5/windows/mlx5_flow_os.h | 52 +++++++++++++++++++++++++++++++++
 4 files changed, 141 insertions(+), 7 deletions(-)

-- 
2.8.4


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

* [dpdk-dev] [PATCH v1 1/2] net/mlx5/linux: wrap sampling actions with OS calls
  2021-01-03 12:15 [dpdk-dev] [PATCH v1 0/2] Windows sampling actions Ophir Munk
@ 2021-01-03 12:15 ` Ophir Munk
  2021-01-03 12:15 ` [dpdk-dev] [PATCH v1 2/2] net/mlx5/windows: implement sampling actions wrappers Ophir Munk
  2021-01-06 22:03 ` [dpdk-dev] [PATCH v1 0/2] Windows sampling actions Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Ophir Munk @ 2021-01-03 12:15 UTC (permalink / raw)
  To: dev, Raslan Darawsheh
  Cc: Thomas Monjalon, Matan Azrad, Tal Shnaiderman, Ophir Munk

Wrap glue calls dr_create_flow_action_sampler() and
dr_create_flow_action_dest_array() with OS APIs. This commit is a follow
up on [1].

[1]
commit b293fbf9672b ("net/mlx5: add OS specific flow actions operations")

Signed-off-by: Ophir Munk <ophirmu@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/linux/mlx5_flow_os.h | 47 +++++++++++++++++++++++++++++++++++
 drivers/net/mlx5/mlx5_flow_dv.c       | 15 +++++------
 2 files changed, 55 insertions(+), 7 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_flow_os.h b/drivers/net/mlx5/linux/mlx5_flow_os.h
index 45b7b9f..cee6850 100644
--- a/drivers/net/mlx5/linux/mlx5_flow_os.h
+++ b/drivers/net/mlx5/linux/mlx5_flow_os.h
@@ -393,6 +393,53 @@ mlx5_flow_os_create_flow_action_dest_devx_tir(struct mlx5_devx_obj *tir,
 }
 
 /**
+ * Create flow action: sampler
+ *
+ * @param[in] attr
+ *   Pointer to sampler attribute
+ * @param[out] action
+ *   Pointer to a valid action on success, NULL otherwise.
+ *
+ * @return
+ *   0 on success, or -1 on failure and errno is set.
+ */
+static inline int
+mlx5_os_flow_dr_create_flow_action_sampler
+			(struct mlx5dv_dr_flow_sampler_attr *attr,
+			void **action)
+{
+	*action = mlx5_glue->dr_create_flow_action_sampler(attr);
+	return (*action) ? 0 : -1;
+}
+
+/**
+ * Create flow action: dest_array
+ *
+ * @param[in] domain
+ *   Pointer to relevant domain.
+ * @param[in] num_dest
+ *   Number of destinations array.
+ * @param[in] dests
+ *   Array of destination attributes.
+ * @param[out] action
+ *   Pointer to a valid action on success, NULL otherwise.
+ *
+ * @return
+ *   0 on success, or -1 on failure and errno is set.
+ */
+static inline int
+mlx5_os_flow_dr_create_flow_action_dest_array
+			(void *domain,
+			 size_t num_dest,
+			 struct mlx5dv_dr_action_dest_attr *dests[],
+			 void **action)
+{
+	*action = mlx5_glue->dr_create_flow_action_dest_array(
+						domain, num_dest, dests);
+	return (*action) ? 0 : -1;
+}
+
+/**
  * Destroy flow action.
  *
  * @param[in] action
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index ce229db..398a68b 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -8786,9 +8786,8 @@ flow_dv_sample_create_cb(struct mlx5_cache_list *list __rte_unused,
 	sampler_attr.sample_actions = (struct mlx5dv_dr_action **)
 							&sample_dv_actions[0];
 	sampler_attr.action = cache_resource->set_action;
-	cache_resource->verbs_action =
-		mlx5_glue->dr_create_flow_action_sampler(&sampler_attr);
-	if (!cache_resource->verbs_action) {
+	if (mlx5_os_flow_dr_create_flow_action_sampler
+			(&sampler_attr, &cache_resource->verbs_action)) {
 		rte_flow_error_set(error, ENOMEM,
 					RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 					NULL, "cannot create sample action");
@@ -8800,7 +8799,7 @@ flow_dv_sample_create_cb(struct mlx5_cache_list *list __rte_unused,
 error:
 	if (cache_resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_FDB &&
 	    cache_resource->default_miss)
-		claim_zero(mlx5_glue->destroy_flow_action
+		claim_zero(mlx5_flow_os_destroy_flow_action
 				(cache_resource->default_miss));
 	else
 		flow_dv_sample_sub_actions_release(dev,
@@ -8898,6 +8897,7 @@ flow_dv_dest_array_create_cb(struct mlx5_cache_list *list __rte_unused,
 	struct mlx5dv_dr_domain *domain;
 	uint32_t idx = 0, res_idx = 0;
 	struct rte_flow_error *error = ctx->error;
+	int ret;
 
 	/* Register new destination array resource. */
 	cache_resource = mlx5_ipool_zmalloc(sh->ipool[MLX5_IPOOL_DEST_ARRAY],
@@ -8946,11 +8946,12 @@ flow_dv_dest_array_create_cb(struct mlx5_cache_list *list __rte_unused,
 		}
 	}
 	/* create a dest array actioin */
-	cache_resource->action = mlx5_glue->dr_create_flow_action_dest_array
+	ret = mlx5_os_flow_dr_create_flow_action_dest_array
 						(domain,
 						 cache_resource->num_of_dest,
-						 dest_attr);
-	if (!cache_resource->action) {
+						 dest_attr,
+						 &cache_resource->action);
+	if (ret) {
 		rte_flow_error_set(error, ENOMEM,
 				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 				   NULL,
-- 
2.8.4


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

* [dpdk-dev] [PATCH v1 2/2] net/mlx5/windows: implement sampling actions wrappers
  2021-01-03 12:15 [dpdk-dev] [PATCH v1 0/2] Windows sampling actions Ophir Munk
  2021-01-03 12:15 ` [dpdk-dev] [PATCH v1 1/2] net/mlx5/linux: wrap sampling actions with OS calls Ophir Munk
@ 2021-01-03 12:15 ` Ophir Munk
  2021-01-06 22:03 ` [dpdk-dev] [PATCH v1 0/2] Windows sampling actions Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Ophir Munk @ 2021-01-03 12:15 UTC (permalink / raw)
  To: dev, Raslan Darawsheh
  Cc: Thomas Monjalon, Matan Azrad, Tal Shnaiderman, Ophir Munk

This commit adds the Windows sampling actions wrappers (currently return
ENOTSUP): mlx5_os_flow_dr_create_flow_action_sampler() and
mlx5_os_flow_dr_create_flow_action_dest_array().  Using configuration
definitions HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE and
HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY the missing sampling DV structs
are added as stubs to windows/mlx5_glue.h file.

Signed-off-by: Ophir Munk <ophirmu@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/windows/mlx5_glue.h | 34 +++++++++++++++++++++
 drivers/net/mlx5/windows/mlx5_flow_os.h | 52 +++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+)

diff --git a/drivers/common/mlx5/windows/mlx5_glue.h b/drivers/common/mlx5/windows/mlx5_glue.h
index 420bfb2..db8f2e8 100644
--- a/drivers/common/mlx5/windows/mlx5_glue.h
+++ b/drivers/common/mlx5/windows/mlx5_glue.h
@@ -15,6 +15,40 @@
 #define MLX5_GLUE_VERSION ""
 #endif
 
+#ifndef HAVE_MLX5DV_DR
+enum  mlx5dv_dr_domain_type { unused, };
+struct mlx5dv_dr_domain;
+struct mlx5dv_dr_action;
+#endif
+
+#ifndef HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE
+struct mlx5dv_dr_flow_sampler_attr {
+	uint32_t sample_ratio;
+	void *default_next_table;
+	size_t num_sample_actions;
+	struct mlx5dv_dr_action **sample_actions;
+	uint64_t action;
+};
+#endif
+
+#ifndef HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY
+enum mlx5dv_dr_action_dest_type {
+	MLX5DV_DR_ACTION_DEST,
+	MLX5DV_DR_ACTION_DEST_REFORMAT,
+};
+struct mlx5dv_dr_action_dest_reformat {
+	struct mlx5dv_dr_action *reformat;
+	struct mlx5dv_dr_action *dest;
+};
+struct mlx5dv_dr_action_dest_attr {
+	enum mlx5dv_dr_action_dest_type type;
+	union {
+		struct mlx5dv_dr_action *dest;
+		struct mlx5dv_dr_action_dest_reformat *dest_reformat;
+	};
+};
+#endif
+
 /* LIB_GLUE_VERSION must be updated every time this structure is modified. */
 struct mlx5_glue {
 	const char *version;
diff --git a/drivers/net/mlx5/windows/mlx5_flow_os.h b/drivers/net/mlx5/windows/mlx5_flow_os.h
index 630b214..26c3e59 100644
--- a/drivers/net/mlx5/windows/mlx5_flow_os.h
+++ b/drivers/net/mlx5/windows/mlx5_flow_os.h
@@ -322,6 +322,58 @@ mlx5_flow_os_create_flow_action_default_miss(void **action)
 }
 
 /**
+ * Create flow action: sampler
+ *
+ * @param[in] attr
+ *   Pointer to sampler attribute
+ * @param[out] action
+ *   Pointer to a valid action on success, NULL otherwise.
+ *
+ * @return
+ *   0 on success, or -1 on failure and errno is set.
+ */
+static inline int
+mlx5_os_flow_dr_create_flow_action_sampler
+			(struct mlx5dv_dr_flow_sampler_attr *attr,
+			void **action)
+{
+	RTE_SET_USED(attr);
+	*action = NULL;
+	rte_errno = ENOTSUP;
+	return -rte_errno;
+}
+
+/**
+ * Create flow action: dest_array
+ *
+ * @param[in] domain
+ *   Pointer to relevant domain.
+ * @param[in] num_dest
+ *   Number of destinations array.
+ * @param[in] dests
+ *   Array of destination attributes.
+ * @param[out] action
+ *   Pointer to a valid action on success, NULL otherwise.
+ *
+ * @return
+ *   0 on success, or -1 on failure and errno is set.
+ */
+static inline int
+mlx5_os_flow_dr_create_flow_action_dest_array
+			(void *domain,
+			 size_t num_dest,
+			 struct mlx5dv_dr_action_dest_attr *dests[],
+			 void **action)
+{
+	RTE_SET_USED(domain);
+	RTE_SET_USED(num_dest);
+	RTE_SET_USED(dests);
+	*action = NULL;
+	rte_errno = ENOTSUP;
+	return -rte_errno;
+}
+
+/**
  * OS stub for mlx5_flow_adjust_priority() API.
  * Windows only supports flow priority 0 that cannot be adjusted.
  *
-- 
2.8.4


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

* Re: [dpdk-dev] [PATCH v1 0/2] Windows sampling actions
  2021-01-03 12:15 [dpdk-dev] [PATCH v1 0/2] Windows sampling actions Ophir Munk
  2021-01-03 12:15 ` [dpdk-dev] [PATCH v1 1/2] net/mlx5/linux: wrap sampling actions with OS calls Ophir Munk
  2021-01-03 12:15 ` [dpdk-dev] [PATCH v1 2/2] net/mlx5/windows: implement sampling actions wrappers Ophir Munk
@ 2021-01-06 22:03 ` Thomas Monjalon
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2021-01-06 22:03 UTC (permalink / raw)
  To: Ophir Munk; +Cc: dev, Raslan Darawsheh, Matan Azrad, Tal Shnaiderman

03/01/2021 13:15, Ophir Munk:
> v1: First release
> 
> Ophir Munk (2):
>   net/mlx5/linux: wrap sampling actions with OS calls
>   net/mlx5/windows: implement sampling actions wrappers

I don't see a need to split Linux and Windows changes.
Squashed in one commit in next-net-mlx, thanks.



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

end of thread, other threads:[~2021-01-06 22:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-03 12:15 [dpdk-dev] [PATCH v1 0/2] Windows sampling actions Ophir Munk
2021-01-03 12:15 ` [dpdk-dev] [PATCH v1 1/2] net/mlx5/linux: wrap sampling actions with OS calls Ophir Munk
2021-01-03 12:15 ` [dpdk-dev] [PATCH v1 2/2] net/mlx5/windows: implement sampling actions wrappers Ophir Munk
2021-01-06 22:03 ` [dpdk-dev] [PATCH v1 0/2] Windows sampling actions Thomas Monjalon

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