All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bing Zhao <bingz@nvidia.com>
To: orika@nvidia.com, thomas@monjalon.net, ferruh.yigit@intel.com,
	andrew.rybchenko@oktetlabs.ru, matan@nvidia.com,
	viacheslavo@nvidia.com
Cc: dev@dpdk.org, ajit.khaparde@broadcom.com, getelson@nvidia.com,
	andreyv@nvidia.com
Subject: [dpdk-dev] [PATCH v2 4/4] net/mlx5: adaption to indirect action API
Date: Sat, 10 Apr 2021 22:03:48 +0800	[thread overview]
Message-ID: <1618063428-206842-5-git-send-email-bingz@nvidia.com> (raw)
In-Reply-To: <1618063428-206842-1-git-send-email-bingz@nvidia.com>

Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, mlx5 PMD needs to do the
adaption to the new APIs.

Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
 drivers/net/mlx5/mlx5.c         |   2 +-
 drivers/net/mlx5/mlx5_defs.h    |   4 +-
 drivers/net/mlx5/mlx5_flow.c    | 238 ++++++++++++++++++++--------------------
 drivers/net/mlx5/mlx5_flow.h    |  24 ++--
 drivers/net/mlx5/mlx5_flow_dv.c |  85 +++++++-------
 5 files changed, 180 insertions(+), 173 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 593532d..a198476 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1342,7 +1342,7 @@ struct mlx5_dev_ctx_shared *
 	 * then this will return directly without any action.
 	 */
 	mlx5_flow_list_flush(dev, &priv->flows, true);
-	mlx5_shared_action_flush(dev);
+	mlx5_action_handle_flush(dev);
 	mlx5_flow_meter_flush(dev, NULL);
 	/* Prevent crashes when queues are still in use. */
 	dev->rx_pkt_burst = removed_rx_burst;
diff --git a/drivers/net/mlx5/mlx5_defs.h b/drivers/net/mlx5/mlx5_defs.h
index 8f2807d..6e9c4b9 100644
--- a/drivers/net/mlx5/mlx5_defs.h
+++ b/drivers/net/mlx5/mlx5_defs.h
@@ -192,8 +192,8 @@
 #define MLX5_HAIRPIN_QUEUE_STRIDE 6
 #define MLX5_HAIRPIN_JUMBO_LOG_SIZE (14 + 2)
 
-/* Maximum number of shared actions supported by rte_flow */
-#define MLX5_MAX_SHARED_ACTIONS 2
+/* Maximum number of indirect actions supported by rte_flow */
+#define MLX5_MAX_INDIRECT_ACTIONS 2
 
 /*
  * Linux definition of static_assert is found in /usr/include/assert.h.
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index c347f81..546b9ea 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -583,23 +583,23 @@ enum mlx5_expansion {
 	},
 };
 
-static struct rte_flow_shared_action *
-mlx5_shared_action_create(struct rte_eth_dev *dev,
-			  const struct rte_flow_shared_action_conf *conf,
+static struct rte_flow_action_handle *
+mlx5_action_handle_create(struct rte_eth_dev *dev,
+			  const struct rte_flow_indir_action_conf *conf,
 			  const struct rte_flow_action *action,
 			  struct rte_flow_error *error);
-static int mlx5_shared_action_destroy
+static int mlx5_action_handle_destroy
 				(struct rte_eth_dev *dev,
-				 struct rte_flow_shared_action *shared_action,
+				 struct rte_flow_action_handle *handle,
 				 struct rte_flow_error *error);
-static int mlx5_shared_action_update
+static int mlx5_action_handle_update
 				(struct rte_eth_dev *dev,
-				 struct rte_flow_shared_action *shared_action,
-				 const struct rte_flow_action *action,
+				 struct rte_flow_action_handle *handle,
+				 const void *update,
 				 struct rte_flow_error *error);
-static int mlx5_shared_action_query
+static int mlx5_action_handle_query
 				(struct rte_eth_dev *dev,
-				 const struct rte_flow_shared_action *action,
+				 const struct rte_flow_action_handle *handle,
 				 void *data,
 				 struct rte_flow_error *error);
 static int
@@ -638,10 +638,10 @@ enum mlx5_expansion {
 	.query = mlx5_flow_query,
 	.dev_dump = mlx5_flow_dev_dump,
 	.get_aged_flows = mlx5_flow_get_aged_flows,
-	.shared_action_create = mlx5_shared_action_create,
-	.shared_action_destroy = mlx5_shared_action_destroy,
-	.shared_action_update = mlx5_shared_action_update,
-	.shared_action_query = mlx5_shared_action_query,
+	.action_handle_create = mlx5_action_handle_create,
+	.action_handle_destroy = mlx5_action_handle_destroy,
+	.action_handle_update = mlx5_action_handle_update,
+	.action_handle_query = mlx5_action_handle_query,
 	.tunnel_decap_set = mlx5_flow_tunnel_decap_set,
 	.tunnel_match = mlx5_flow_tunnel_match,
 	.tunnel_action_decap_release = mlx5_flow_tunnel_action_release,
@@ -3417,31 +3417,31 @@ struct mlx5_aso_age_action*
 	return &pool->actions[offset - 1];
 }
 
-/* maps shared action to translated non shared in some actions array */
-struct mlx5_translated_shared_action {
-	struct rte_flow_shared_action *action; /**< Shared action */
-	int index; /**< Index in related array of rte_flow_action */
+/* maps indirect action to translated direct in some actions array */
+struct mlx5_translated_action_handle {
+	struct rte_flow_action_handle *action; /**< Indirect action handle. */
+	int index; /**< Index in related array of rte_flow_action. */
 };
 
 /**
- * Translates actions of type RTE_FLOW_ACTION_TYPE_SHARED to related
- * non shared action if translation possible.
- * This functionality used to run same execution path for both shared & non
- * shared actions on flow create. All necessary preparations for shared
- * action handling should be preformed on *shared* actions list returned
+ * Translates actions of type RTE_FLOW_ACTION_TYPE_INDIRECT to related
+ * direct action if translation possible.
+ * This functionality used to run same execution path for both direct and
+ * indirect actions on flow create. All necessary preparations for indirect
+ * action handling should be performed on *handle* actions list returned
  * from this call.
  *
  * @param[in] dev
  *   Pointer to Ethernet device.
  * @param[in] actions
  *   List of actions to translate.
- * @param[out] shared
- *   List to store translated shared actions.
- * @param[in, out] shared_n
- *   Size of *shared* array. On return should be updated with number of shared
- *   actions retrieved from the *actions* list.
+ * @param[out] handle
+ *   List to store translated indirect action object handles.
+ * @param[in, out] indir_n
+ *   Size of *handle* array. On return should be updated with number of
+ *   indirect actions retrieved from the *actions* list.
  * @param[out] translated_actions
- *   List of actions where all shared actions were translated to non shared
+ *   List of actions where all indirect actions were translated to direct
  *   if possible. NULL if no translation took place.
  * @param[out] error
  *   Pointer to the error structure.
@@ -3450,10 +3450,10 @@ struct mlx5_translated_shared_action {
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 static int
-flow_shared_actions_translate(struct rte_eth_dev *dev,
+flow_action_handles_translate(struct rte_eth_dev *dev,
 			      const struct rte_flow_action actions[],
-			      struct mlx5_translated_shared_action *shared,
-			      int *shared_n,
+			      struct mlx5_translated_action_handle *handle,
+			      int *indir_n,
 			      struct rte_flow_action **translated_actions,
 			      struct rte_flow_error *error)
 {
@@ -3462,23 +3462,23 @@ struct mlx5_translated_shared_action {
 	size_t actions_size;
 	int n;
 	int copied_n = 0;
-	struct mlx5_translated_shared_action *shared_end = NULL;
+	struct mlx5_translated_action_handle *handle_end = NULL;
 
 	for (n = 0; actions[n].type != RTE_FLOW_ACTION_TYPE_END; n++) {
-		if (actions[n].type != RTE_FLOW_ACTION_TYPE_SHARED)
+		if (actions[n].type != RTE_FLOW_ACTION_TYPE_INDIRECT)
 			continue;
-		if (copied_n == *shared_n) {
+		if (copied_n == *indir_n) {
 			return rte_flow_error_set
 				(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_NUM,
 				 NULL, "too many shared actions");
 		}
-		rte_memcpy(&shared[copied_n].action, &actions[n].conf,
+		rte_memcpy(&handle[copied_n].action, &actions[n].conf,
 			   sizeof(actions[n].conf));
-		shared[copied_n].index = n;
+		handle[copied_n].index = n;
 		copied_n++;
 	}
 	n++;
-	*shared_n = copied_n;
+	*indir_n = copied_n;
 	if (!copied_n)
 		return 0;
 	actions_size = sizeof(struct rte_flow_action) * n;
@@ -3488,28 +3488,28 @@ struct mlx5_translated_shared_action {
 		return -ENOMEM;
 	}
 	memcpy(translated, actions, actions_size);
-	for (shared_end = shared + copied_n; shared < shared_end; shared++) {
+	for (handle_end = handle + copied_n; handle < handle_end; handle++) {
 		struct mlx5_shared_action_rss *shared_rss;
-		uint32_t act_idx = (uint32_t)(uintptr_t)shared->action;
-		uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
-		uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET)
-									   - 1);
+		uint32_t act_idx = (uint32_t)(uintptr_t)handle->action;
+		uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+		uint32_t idx = act_idx &
+			       ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
 
 		switch (type) {
-		case MLX5_SHARED_ACTION_TYPE_RSS:
+		case MLX5_INDIRECT_ACTION_TYPE_RSS:
 			shared_rss = mlx5_ipool_get
 			  (priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS], idx);
-			translated[shared->index].type =
+			translated[handle->index].type =
 				RTE_FLOW_ACTION_TYPE_RSS;
-			translated[shared->index].conf =
+			translated[handle->index].conf =
 				&shared_rss->origin;
 			break;
-		case MLX5_SHARED_ACTION_TYPE_AGE:
+		case MLX5_INDIRECT_ACTION_TYPE_AGE:
 			if (priv->sh->flow_hit_aso_en) {
-				translated[shared->index].type =
+				translated[handle->index].type =
 					(enum rte_flow_action_type)
 					MLX5_RTE_FLOW_ACTION_TYPE_AGE;
-				translated[shared->index].conf =
+				translated[handle->index].conf =
 							 (void *)(uintptr_t)idx;
 				break;
 			}
@@ -3518,7 +3518,7 @@ struct mlx5_translated_shared_action {
 			mlx5_free(translated);
 			return rte_flow_error_set
 				(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
-				 NULL, "invalid shared action type");
+				 NULL, "invalid indirect action type");
 		}
 	}
 	*translated_actions = translated;
@@ -3540,21 +3540,21 @@ struct mlx5_translated_shared_action {
  */
 static uint32_t
 flow_get_shared_rss_action(struct rte_eth_dev *dev,
-			   struct mlx5_translated_shared_action *shared,
+			   struct mlx5_translated_action_handle *handle,
 			   int shared_n)
 {
-	struct mlx5_translated_shared_action *shared_end;
+	struct mlx5_translated_action_handle *handle_end;
 	struct mlx5_priv *priv = dev->data->dev_private;
 	struct mlx5_shared_action_rss *shared_rss;
 
 
-	for (shared_end = shared + shared_n; shared < shared_end; shared++) {
-		uint32_t act_idx = (uint32_t)(uintptr_t)shared->action;
-		uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
+	for (handle_end = handle + shared_n; handle < handle_end; handle++) {
+		uint32_t act_idx = (uint32_t)(uintptr_t)handle->action;
+		uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
 		uint32_t idx = act_idx &
-				   ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+			       ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
 		switch (type) {
-		case MLX5_SHARED_ACTION_TYPE_RSS:
+		case MLX5_INDIRECT_ACTION_TYPE_RSS:
 			shared_rss = mlx5_ipool_get
 				(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
 									   idx);
@@ -5564,9 +5564,9 @@ struct mlx5_hlist_entry *
 	struct rte_flow *flow = NULL;
 	struct mlx5_flow *dev_flow;
 	const struct rte_flow_action_rss *rss = NULL;
-	struct mlx5_translated_shared_action
-		shared_actions[MLX5_MAX_SHARED_ACTIONS];
-	int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
+	struct mlx5_translated_action_handle
+		indir_actions[MLX5_MAX_INDIRECT_ACTIONS];
+	int indir_actions_n = MLX5_MAX_INDIRECT_ACTIONS;
 	union {
 		struct mlx5_flow_expand_rss buf;
 		uint8_t buffer[2048];
@@ -5606,9 +5606,9 @@ struct mlx5_hlist_entry *
 
 	MLX5_ASSERT(wks);
 	rss_desc = &wks->rss_desc;
-	ret = flow_shared_actions_translate(dev, original_actions,
-					    shared_actions,
-					    &shared_actions_n,
+	ret = flow_action_handles_translate(dev, original_actions,
+					    indir_actions,
+					    &indir_actions_n,
 					    &translated_actions, error);
 	if (ret < 0) {
 		MLX5_ASSERT(translated_actions == NULL);
@@ -5669,8 +5669,8 @@ struct mlx5_hlist_entry *
 		buf->entries = 1;
 		buf->entry[0].pattern = (void *)(uintptr_t)items;
 	}
-	rss_desc->shared_rss = flow_get_shared_rss_action(dev, shared_actions,
-						      shared_actions_n);
+	rss_desc->shared_rss = flow_get_shared_rss_action(dev, indir_actions,
+						      indir_actions_n);
 	for (i = 0; i < buf->entries; ++i) {
 		/* Initialize flow split data. */
 		flow_split_info.prefix_layers = 0;
@@ -5849,14 +5849,14 @@ struct rte_flow *
 		   struct rte_flow_error *error)
 {
 	int hairpin_flow;
-	struct mlx5_translated_shared_action
-		shared_actions[MLX5_MAX_SHARED_ACTIONS];
-	int shared_actions_n = MLX5_MAX_SHARED_ACTIONS;
+	struct mlx5_translated_action_handle
+		indir_actions[MLX5_MAX_INDIRECT_ACTIONS];
+	int indir_actions_n = MLX5_MAX_INDIRECT_ACTIONS;
 	const struct rte_flow_action *actions;
 	struct rte_flow_action *translated_actions = NULL;
-	int ret = flow_shared_actions_translate(dev, original_actions,
-						shared_actions,
-						&shared_actions_n,
+	int ret = flow_action_handles_translate(dev, original_actions,
+						indir_actions,
+						&indir_actions_n,
 						&translated_actions, error);
 
 	if (ret)
@@ -7226,12 +7226,12 @@ struct mlx5_meter_domains_infos *
 /* Wrapper for driver action_validate op callback */
 static int
 flow_drv_action_validate(struct rte_eth_dev *dev,
-			 const struct rte_flow_shared_action_conf *conf,
+			 const struct rte_flow_indir_action_conf *conf,
 			 const struct rte_flow_action *action,
 			 const struct mlx5_flow_driver_ops *fops,
 			 struct rte_flow_error *error)
 {
-	static const char err_msg[] = "shared action validation unsupported";
+	static const char err_msg[] = "indirect action validation unsupported";
 
 	if (!fops->action_validate) {
 		DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7247,8 +7247,8 @@ struct mlx5_meter_domains_infos *
  *
  * @param dev
  *   Pointer to Ethernet device structure.
- * @param[in] action
- *   Handle for the shared action to be destroyed.
+ * @param[in] handle
+ *   Handle for the indirect action object to be destroyed.
  * @param[out] error
  *   Perform verbose error reporting if not NULL. PMDs initialize this
  *   structure in case of error only.
@@ -7259,11 +7259,11 @@ struct mlx5_meter_domains_infos *
  * @note: wrapper for driver action_create op callback.
  */
 static int
-mlx5_shared_action_destroy(struct rte_eth_dev *dev,
-			   struct rte_flow_shared_action *action,
+mlx5_action_handle_destroy(struct rte_eth_dev *dev,
+			   struct rte_flow_action_handle *handle,
 			   struct rte_flow_error *error)
 {
-	static const char err_msg[] = "shared action destruction unsupported";
+	static const char err_msg[] = "indirect action destruction unsupported";
 	struct rte_flow_attr attr = { .transfer = 0 };
 	const struct mlx5_flow_driver_ops *fops =
 			flow_get_drv_ops(flow_get_drv_type(dev, &attr));
@@ -7274,18 +7274,18 @@ struct mlx5_meter_domains_infos *
 				   NULL, err_msg);
 		return -rte_errno;
 	}
-	return fops->action_destroy(dev, action, error);
+	return fops->action_destroy(dev, handle, error);
 }
 
 /* Wrapper for driver action_destroy op callback */
 static int
 flow_drv_action_update(struct rte_eth_dev *dev,
-		       struct rte_flow_shared_action *action,
-		       const void *action_conf,
+		       struct rte_flow_action_handle *handle,
+		       const void *update,
 		       const struct mlx5_flow_driver_ops *fops,
 		       struct rte_flow_error *error)
 {
-	static const char err_msg[] = "shared action update unsupported";
+	static const char err_msg[] = "indirect action update unsupported";
 
 	if (!fops->action_update) {
 		DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7293,18 +7293,18 @@ struct mlx5_meter_domains_infos *
 				   NULL, err_msg);
 		return -rte_errno;
 	}
-	return fops->action_update(dev, action, action_conf, error);
+	return fops->action_update(dev, handle, update, error);
 }
 
 /* Wrapper for driver action_destroy op callback */
 static int
 flow_drv_action_query(struct rte_eth_dev *dev,
-		      const struct rte_flow_shared_action *action,
+		      const struct rte_flow_action_handle *handle,
 		      void *data,
 		      const struct mlx5_flow_driver_ops *fops,
 		      struct rte_flow_error *error)
 {
-	static const char err_msg[] = "shared action query unsupported";
+	static const char err_msg[] = "indirect action query unsupported";
 
 	if (!fops->action_query) {
 		DRV_LOG(ERR, "port %u %s.", dev->data->port_id, err_msg);
@@ -7312,29 +7312,31 @@ struct mlx5_meter_domains_infos *
 				   NULL, err_msg);
 		return -rte_errno;
 	}
-	return fops->action_query(dev, action, data, error);
+	return fops->action_query(dev, handle, data, error);
 }
 
 /**
- * Create shared action for reuse in multiple flow rules.
+ * Create indirect action for reuse in multiple flow rules.
  *
  * @param dev
  *   Pointer to Ethernet device structure.
+ * @param conf
+ *   Pointer to indirect action object configuration.
  * @param[in] action
- *   Action configuration for shared action creation.
+ *   Action configuration for indirect action object creation.
  * @param[out] error
  *   Perform verbose error reporting if not NULL. PMDs initialize this
  *   structure in case of error only.
  * @return
  *   A valid handle in case of success, NULL otherwise and rte_errno is set.
  */
-static struct rte_flow_shared_action *
-mlx5_shared_action_create(struct rte_eth_dev *dev,
-			  const struct rte_flow_shared_action_conf *conf,
+static struct rte_flow_action_handle *
+mlx5_action_handle_create(struct rte_eth_dev *dev,
+			  const struct rte_flow_indir_action_conf *conf,
 			  const struct rte_flow_action *action,
 			  struct rte_flow_error *error)
 {
-	static const char err_msg[] = "shared action creation unsupported";
+	static const char err_msg[] = "indirect action creation unsupported";
 	struct rte_flow_attr attr = { .transfer = 0 };
 	const struct mlx5_flow_driver_ops *fops =
 			flow_get_drv_ops(flow_get_drv_type(dev, &attr));
@@ -7351,19 +7353,20 @@ struct mlx5_meter_domains_infos *
 }
 
 /**
- * Updates inplace the shared action configuration pointed by *action* handle
- * with the configuration provided as *action* argument.
- * The update of the shared action configuration effects all flow rules reusing
- * the action via handle.
+ * Updates inplace the indirect action configuration pointed by *handle*
+ * with the configuration provided as *update* argument.
+ * The update of the indirect action configuration effects all flow rules
+ * reusing the action via handle.
  *
  * @param dev
  *   Pointer to Ethernet device structure.
- * @param[in] shared_action
- *   Handle for the shared action to be updated.
- * @param[in] action
+ * @param[in] handle
+ *   Handle for the indirect action to be updated.
+ * @param[in] update
  *   Action specification used to modify the action pointed by handle.
- *   *action* should be of same type with the action pointed by the *action*
- *   handle argument, otherwise considered as invalid.
+ *   *update* could be of same type with the action pointed by the *handle*
+ *   handle argument, or some other structures like a wrapper, depending on
+ *   the indirect action type.
  * @param[out] error
  *   Perform verbose error reporting if not NULL. PMDs initialize this
  *   structure in case of error only.
@@ -7372,9 +7375,9 @@ struct mlx5_meter_domains_infos *
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 static int
-mlx5_shared_action_update(struct rte_eth_dev *dev,
-		struct rte_flow_shared_action *shared_action,
-		const struct rte_flow_action *action,
+mlx5_action_handle_update(struct rte_eth_dev *dev,
+		struct rte_flow_action_handle *handle,
+		const void *update,
 		struct rte_flow_error *error)
 {
 	struct rte_flow_attr attr = { .transfer = 0 };
@@ -7382,26 +7385,27 @@ struct mlx5_meter_domains_infos *
 			flow_get_drv_ops(flow_get_drv_type(dev, &attr));
 	int ret;
 
-	ret = flow_drv_action_validate(dev, NULL, action, fops, error);
+	ret = flow_drv_action_validate(dev, NULL,
+			(const struct rte_flow_action *)update, fops, error);
 	if (ret)
 		return ret;
-	return flow_drv_action_update(dev, shared_action, action->conf, fops,
+	return flow_drv_action_update(dev, handle, update, fops,
 				      error);
 }
 
 /**
- * Query the shared action by handle.
+ * Query the indirect action by handle.
  *
  * This function allows retrieving action-specific data such as counters.
  * Data is gathered by special action which may be present/referenced in
  * more than one flow rule definition.
  *
- * \see RTE_FLOW_ACTION_TYPE_COUNT
+ * see @RTE_FLOW_ACTION_TYPE_COUNT
  *
  * @param dev
  *   Pointer to Ethernet device structure.
- * @param[in] action
- *   Handle for the shared action to query.
+ * @param[in] handle
+ *   Handle for the indirect action to query.
  * @param[in, out] data
  *   Pointer to storage for the associated query data type.
  * @param[out] error
@@ -7412,8 +7416,8 @@ struct mlx5_meter_domains_infos *
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 static int
-mlx5_shared_action_query(struct rte_eth_dev *dev,
-			 const struct rte_flow_shared_action *action,
+mlx5_action_handle_query(struct rte_eth_dev *dev,
+			 const struct rte_flow_action_handle *handle,
 			 void *data,
 			 struct rte_flow_error *error)
 {
@@ -7421,11 +7425,11 @@ struct mlx5_meter_domains_infos *
 	const struct mlx5_flow_driver_ops *fops =
 			flow_get_drv_ops(flow_get_drv_type(dev, &attr));
 
-	return flow_drv_action_query(dev, action, data, fops, error);
+	return flow_drv_action_query(dev, handle, data, fops, error);
 }
 
 /**
- * Destroy all shared actions.
+ * Destroy all indirect actions (shared RSS).
  *
  * @param dev
  *   Pointer to Ethernet device.
@@ -7434,7 +7438,7 @@ struct mlx5_meter_domains_infos *
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 int
-mlx5_shared_action_flush(struct rte_eth_dev *dev)
+mlx5_action_handle_flush(struct rte_eth_dev *dev)
 {
 	struct rte_flow_error error;
 	struct mlx5_priv *priv = dev->data->dev_private;
@@ -7444,8 +7448,8 @@ struct mlx5_meter_domains_infos *
 
 	ILIST_FOREACH(priv->sh->ipool[MLX5_IPOOL_RSS_SHARED_ACTIONS],
 		      priv->rss_shared_actions, idx, shared_rss, next) {
-		ret |= mlx5_shared_action_destroy(dev,
-		       (struct rte_flow_shared_action *)(uintptr_t)idx, &error);
+		ret |= mlx5_action_handle_destroy(dev,
+		       (struct rte_flow_action_handle *)(uintptr_t)idx, &error);
 	}
 	return ret;
 }
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index ec673c2..56674eb 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -39,11 +39,11 @@ enum mlx5_rte_flow_action_type {
 	MLX5_RTE_FLOW_ACTION_TYPE_AGE,
 };
 
-#define MLX5_SHARED_ACTION_TYPE_OFFSET 30
+#define MLX5_INDIRECT_ACTION_TYPE_OFFSET 30
 
 enum {
-	MLX5_SHARED_ACTION_TYPE_RSS,
-	MLX5_SHARED_ACTION_TYPE_AGE,
+	MLX5_INDIRECT_ACTION_TYPE_RSS,
+	MLX5_INDIRECT_ACTION_TYPE_AGE,
 };
 
 /* Matches on selected register. */
@@ -1152,7 +1152,7 @@ struct mlx5_shared_action_rss {
 	rte_spinlock_t action_rss_sl; /**< Shared RSS action spinlock. */
 };
 
-struct rte_flow_shared_action {
+struct rte_flow_action_handle {
 	uint32_t id;
 };
 
@@ -1233,26 +1233,26 @@ typedef int (*mlx5_flow_get_aged_flows_t)
 					 struct rte_flow_error *error);
 typedef int (*mlx5_flow_action_validate_t)
 				(struct rte_eth_dev *dev,
-				 const struct rte_flow_shared_action_conf *conf,
+				 const struct rte_flow_indir_action_conf *conf,
 				 const struct rte_flow_action *action,
 				 struct rte_flow_error *error);
-typedef struct rte_flow_shared_action *(*mlx5_flow_action_create_t)
+typedef struct rte_flow_action_handle *(*mlx5_flow_action_create_t)
 				(struct rte_eth_dev *dev,
-				 const struct rte_flow_shared_action_conf *conf,
+				 const struct rte_flow_indir_action_conf *conf,
 				 const struct rte_flow_action *action,
 				 struct rte_flow_error *error);
 typedef int (*mlx5_flow_action_destroy_t)
 				(struct rte_eth_dev *dev,
-				 struct rte_flow_shared_action *action,
+				 struct rte_flow_action_handle *action,
 				 struct rte_flow_error *error);
 typedef int (*mlx5_flow_action_update_t)
 			(struct rte_eth_dev *dev,
-			 struct rte_flow_shared_action *action,
-			 const void *action_conf,
+			 struct rte_flow_action_handle *action,
+			 const void *update,
 			 struct rte_flow_error *error);
 typedef int (*mlx5_flow_action_query_t)
 			(struct rte_eth_dev *dev,
-			 const struct rte_flow_shared_action *action,
+			 const struct rte_flow_action_handle *action,
 			 void *data,
 			 struct rte_flow_error *error);
 typedef int (*mlx5_flow_sync_domain_t)
@@ -1483,7 +1483,7 @@ int mlx5_flow_destroy_policer_rules(struct rte_eth_dev *dev,
 int mlx5_flow_meter_flush(struct rte_eth_dev *dev,
 			  struct rte_mtr_error *error);
 int mlx5_flow_dv_discover_counter_offset_support(struct rte_eth_dev *dev);
-int mlx5_shared_action_flush(struct rte_eth_dev *dev);
+int mlx5_action_handle_flush(struct rte_eth_dev *dev);
 void mlx5_release_tunnel_hub(struct mlx5_dev_ctx_shared *sh, uint16_t port_id);
 int mlx5_alloc_tunnel_hub(struct mlx5_dev_ctx_shared *sh);
 
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 1818895..86a59b1 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -12873,7 +12873,7 @@ struct mlx5_cache_entry *
  */
 static uint32_t
 __flow_dv_action_rss_create(struct rte_eth_dev *dev,
-			    const struct rte_flow_shared_action_conf *conf,
+			    const struct rte_flow_indir_action_conf *conf,
 			    const struct rte_flow_action_rss *rss,
 			    struct rte_flow_error *error)
 {
@@ -12896,7 +12896,7 @@ struct mlx5_cache_entry *
 				   "cannot allocate resource memory");
 		goto error_rss_init;
 	}
-	if (idx > (1u << MLX5_SHARED_ACTION_TYPE_OFFSET)) {
+	if (idx > (1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET)) {
 		rte_flow_error_set(error, E2BIG,
 				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
 				   "rss action number out of range");
@@ -13009,7 +13009,7 @@ struct mlx5_cache_entry *
 }
 
 /**
- * Create shared action, lock free,
+ * Create indirect action, lock free,
  * (mutex should be acquired by caller).
  * Dispatcher for action type specific call.
  *
@@ -13018,7 +13018,7 @@ struct mlx5_cache_entry *
  * @param[in] conf
  *   Shared action configuration.
  * @param[in] action
- *   Action specification used to create shared action.
+ *   Action specification used to create indirect action.
  * @param[out] error
  *   Perform verbose error reporting if not NULL. Initialized in case of
  *   error only.
@@ -13027,9 +13027,9 @@ struct mlx5_cache_entry *
  *   A valid shared action handle in case of success, NULL otherwise and
  *   rte_errno is set.
  */
-static struct rte_flow_shared_action *
+static struct rte_flow_action_handle *
 flow_dv_action_create(struct rte_eth_dev *dev,
-		      const struct rte_flow_shared_action_conf *conf,
+		      const struct rte_flow_indir_action_conf *conf,
 		      const struct rte_flow_action *action,
 		      struct rte_flow_error *err)
 {
@@ -13039,13 +13039,13 @@ struct mlx5_cache_entry *
 	switch (action->type) {
 	case RTE_FLOW_ACTION_TYPE_RSS:
 		ret = __flow_dv_action_rss_create(dev, conf, action->conf, err);
-		idx = (MLX5_SHARED_ACTION_TYPE_RSS <<
-		       MLX5_SHARED_ACTION_TYPE_OFFSET) | ret;
+		idx = (MLX5_INDIRECT_ACTION_TYPE_RSS <<
+		       MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret;
 		break;
 	case RTE_FLOW_ACTION_TYPE_AGE:
 		ret = flow_dv_translate_create_aso_age(dev, action->conf, err);
-		idx = (MLX5_SHARED_ACTION_TYPE_AGE <<
-		       MLX5_SHARED_ACTION_TYPE_OFFSET) | ret;
+		idx = (MLX5_INDIRECT_ACTION_TYPE_AGE <<
+		       MLX5_INDIRECT_ACTION_TYPE_OFFSET) | ret;
 		if (ret) {
 			struct mlx5_aso_age_action *aso_age =
 					      flow_aso_age_get_by_idx(dev, ret);
@@ -13060,19 +13060,19 @@ struct mlx5_cache_entry *
 				   NULL, "action type not supported");
 		break;
 	}
-	return ret ? (struct rte_flow_shared_action *)(uintptr_t)idx : NULL;
+	return ret ? (struct rte_flow_action_handle *)(uintptr_t)idx : NULL;
 }
 
 /**
- * Destroy the shared action.
+ * Destroy the indirect action.
  * Release action related resources on the NIC and the memory.
  * Lock free, (mutex should be acquired by caller).
  * Dispatcher for action type specific call.
  *
  * @param[in] dev
  *   Pointer to the Ethernet device structure.
- * @param[in] action
- *   The shared action object to be removed.
+ * @param[in] handle
+ *   The indirect action object handle to be removed.
  * @param[out] error
  *   Perform verbose error reporting if not NULL. Initialized in case of
  *   error only.
@@ -13082,25 +13082,25 @@ struct mlx5_cache_entry *
  */
 static int
 flow_dv_action_destroy(struct rte_eth_dev *dev,
-		       struct rte_flow_shared_action *action,
+		       struct rte_flow_action_handle *handle,
 		       struct rte_flow_error *error)
 {
-	uint32_t act_idx = (uint32_t)(uintptr_t)action;
-	uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
-	uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+	uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+	uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+	uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
 	int ret;
 
 	switch (type) {
-	case MLX5_SHARED_ACTION_TYPE_RSS:
+	case MLX5_INDIRECT_ACTION_TYPE_RSS:
 		return __flow_dv_action_rss_release(dev, idx, error);
-	case MLX5_SHARED_ACTION_TYPE_AGE:
+	case MLX5_INDIRECT_ACTION_TYPE_AGE:
 		ret = flow_dv_aso_age_release(dev, idx);
 		if (ret)
 			/*
 			 * In this case, the last flow has a reference will
 			 * actually release the age action.
 			 */
-			DRV_LOG(DEBUG, "Shared age action %" PRIu32 " was"
+			DRV_LOG(DEBUG, "Indirect age action %" PRIu32 " was"
 				" released with references %d.", idx, ret);
 		return 0;
 	default:
@@ -13183,12 +13183,13 @@ struct mlx5_cache_entry *
  *
  * @param[in] dev
  *   Pointer to the Ethernet device structure.
- * @param[in] action
- *   The shared action object to be updated.
- * @param[in] action_conf
- *   Action specification used to modify *action*.
- *   *action_conf* should be of type correlating with type of the *action*,
- *   otherwise considered as invalid.
+ * @param[in] handle
+ *   The indirect action object handle to be updated.
+ * @param[in] update
+ *   Action specification used to modify the action pointed by *handle*.
+ *   *update* could be of same type with the action pointed by the *handle*
+ *   handle argument, or some other structures like a wrapper, depending on
+ *   the indirect action type.
  * @param[out] error
  *   Perform verbose error reporting if not NULL. Initialized in case of
  *   error only.
@@ -13198,16 +13199,18 @@ struct mlx5_cache_entry *
  */
 static int
 flow_dv_action_update(struct rte_eth_dev *dev,
-			struct rte_flow_shared_action *action,
-			const void *action_conf,
+			struct rte_flow_action_handle *handle,
+			const void *update,
 			struct rte_flow_error *err)
 {
-	uint32_t act_idx = (uint32_t)(uintptr_t)action;
-	uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
-	uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+	uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+	uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+	uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
+	const void *action_conf;
 
 	switch (type) {
-	case MLX5_SHARED_ACTION_TYPE_RSS:
+	case MLX5_INDIRECT_ACTION_TYPE_RSS:
+		action_conf = ((const struct rte_flow_action *)update)->conf;
 		return __flow_dv_action_rss_update(dev, idx, action_conf, err);
 	default:
 		return rte_flow_error_set(err, ENOTSUP,
@@ -13219,17 +13222,17 @@ struct mlx5_cache_entry *
 
 static int
 flow_dv_action_query(struct rte_eth_dev *dev,
-		     const struct rte_flow_shared_action *action, void *data,
+		     const struct rte_flow_action_handle *handle, void *data,
 		     struct rte_flow_error *error)
 {
 	struct mlx5_age_param *age_param;
 	struct rte_flow_query_age *resp;
-	uint32_t act_idx = (uint32_t)(uintptr_t)action;
-	uint32_t type = act_idx >> MLX5_SHARED_ACTION_TYPE_OFFSET;
-	uint32_t idx = act_idx & ((1u << MLX5_SHARED_ACTION_TYPE_OFFSET) - 1);
+	uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+	uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
+	uint32_t idx = act_idx & ((1u << MLX5_INDIRECT_ACTION_TYPE_OFFSET) - 1);
 
 	switch (type) {
-	case MLX5_SHARED_ACTION_TYPE_AGE:
+	case MLX5_INDIRECT_ACTION_TYPE_AGE:
 		age_param = &flow_aso_age_get_by_idx(dev, idx)->age_params;
 		resp = data;
 		resp->aged = __atomic_load_n(&age_param->state,
@@ -14005,7 +14008,7 @@ struct mlx5_cache_entry *
 }
 
 /**
- * Validate shared action.
+ * Validate indirect action.
  * Dispatcher for action type specific validation.
  *
  * @param[in] dev
@@ -14013,7 +14016,7 @@ struct mlx5_cache_entry *
  * @param[in] conf
  *   Shared action configuration.
  * @param[in] action
- *   The shared action object to validate.
+ *   The indirect action object to validate.
  * @param[out] error
  *   Perform verbose error reporting if not NULL. Initialized in case of
  *   error only.
@@ -14023,7 +14026,7 @@ struct mlx5_cache_entry *
  */
 static int
 flow_dv_action_validate(struct rte_eth_dev *dev,
-			const struct rte_flow_shared_action_conf *conf,
+			const struct rte_flow_indir_action_conf *conf,
 			const struct rte_flow_action *action,
 			struct rte_flow_error *err)
 {
-- 
1.8.3.1


  parent reply	other threads:[~2021-04-10 14:04 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1615967952-228321-1-git-send-email-bingz@nvidia.com>
2021-03-17  8:28 ` [dpdk-dev] [RFC] ethdev: introduce action context APIs Thomas Monjalon
2021-03-17 16:10   ` Bing Zhao
2021-03-22 14:59     ` Andrew Rybchenko
2021-04-06  9:05       ` Bing Zhao
2021-03-22 14:54   ` Andrew Rybchenko
2021-04-06  9:07     ` Bing Zhao
2021-04-06  9:48       ` Thomas Monjalon
2021-04-06 11:02         ` Bing Zhao
2021-04-06 12:18           ` Thomas Monjalon
2021-04-07  3:16         ` Ajit Khaparde
2021-04-07  6:11           ` Bing Zhao
2021-04-08 14:46 ` [dpdk-dev] [RFC PATCH v2] ethdev: introduce indirect action APIs Bing Zhao
2021-04-09  3:54 ` [dpdk-dev] [PATCH] " Bing Zhao
2021-04-10 14:03   ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Bing Zhao
2021-04-10 14:03     ` [dpdk-dev] [PATCH v2 1/4] ethdev: introduce indirect action APIs Bing Zhao
2021-04-12 19:42       ` Ferruh Yigit
2021-04-13  1:26         ` Bing Zhao
2021-04-13 14:00           ` Ori Kam
2021-04-13 12:36       ` Andrey Vesnovaty
2021-04-15 13:55       ` Andrew Rybchenko
2021-04-15 14:10         ` Thomas Monjalon
2021-04-15 16:02           ` Andrew Rybchenko
2021-04-10 14:03     ` [dpdk-dev] [PATCH v2 2/4] app/test-pmd: change to indirect action command Bing Zhao
2021-04-10 14:03     ` [dpdk-dev] [PATCH v2 3/4] doc: update user guide for indirect action Bing Zhao
2021-04-10 14:03     ` Bing Zhao [this message]
2021-04-12 19:40     ` [dpdk-dev] [PATCH v2 0/4] Change shared action API to action handle API Ferruh Yigit
2021-04-13  1:22       ` Bing Zhao
2021-04-13  7:23         ` Thomas Monjalon
2021-04-13  7:24           ` Bing Zhao
2021-04-15 15:51   ` [dpdk-dev] [PATCH v3 0/1] " Bing Zhao
2021-04-15 15:51     ` [dpdk-dev] [PATCH v3 1/1] ethdev: introduce indirect action APIs Bing Zhao
2021-04-15 15:56       ` Ori Kam
2021-04-15 17:59       ` Ajit Khaparde
2021-04-16  6:58         ` Bing Zhao
2021-04-16  7:03         ` Thomas Monjalon
2021-04-16 15:00           ` Ajit Khaparde
2021-04-16 17:33   ` [dpdk-dev] [PATCH v4 0/1] Change shared action API to action handle API Bing Zhao
2021-04-16 17:33     ` [dpdk-dev] [PATCH v4 1/1] ethdev: introduce indirect action APIs Bing Zhao
2021-04-19 12:26       ` Thomas Monjalon
2021-04-19 15:05         ` Bing Zhao
2021-04-19 14:28   ` [dpdk-dev] [PATCH v5] Change shared action API to action handle API Bing Zhao
2021-04-19 14:28     ` [dpdk-dev] [PATCH v5] ethdev: introduce indirect action APIs Bing Zhao
2021-04-19 14:38   ` [dpdk-dev] [PATCH v5 0/1] Change shared action API to action handle API Bing Zhao
2021-04-19 14:38     ` [dpdk-dev] [PATCH v5 1/1] ethdev: introduce indirect action APIs Bing Zhao
2021-04-19 14:50       ` Thomas Monjalon
2021-04-19 15:09         ` Ferruh Yigit

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=1618063428-206842-5-git-send-email-bingz@nvidia.com \
    --to=bingz@nvidia.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=andreyv@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=getelson@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=thomas@monjalon.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.