DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] net/mlx5/hws: removing the table name from dest root table
@ 2023-06-13  5:28 Bar Neuman
  2023-06-13  5:28 ` [PATCH 2/2] net/mlx5: add support for send to kernel over HWS Bar Neuman
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bar Neuman @ 2023-06-13  5:28 UTC (permalink / raw)
  To: dev; +Cc: orika, rasland, matan, viacheslavo, mkashani, Itamar Gozlan

From: Itamar Gozlan <igozlan@nvidia.com>

Jumping to root (group 0) does not behave the same as jumping
to groups with level > 0.
To better emphasize that it is not the same action,
a rename is made to drop the name table.

Signed-off-by: Itamar Gozlan <igozlan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr.h        | 11 ++++-------
 drivers/net/mlx5/hws/mlx5dr_action.c | 27 ++++++++++-----------------
 drivers/net/mlx5/hws/mlx5dr_debug.c  |  2 +-
 3 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index c14fef7a6b..512d6095b9 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -45,7 +45,7 @@ enum mlx5dr_action_type {
 	MLX5DR_ACTION_TYP_PUSH_VLAN,
 	MLX5DR_ACTION_TYP_ASO_METER,
 	MLX5DR_ACTION_TYP_ASO_CT,
-	MLX5DR_ACTION_TYP_DEST_ROOT_TABLE,
+	MLX5DR_ACTION_TYP_DEST_ROOT,
 	MLX5DR_ACTION_TYP_MAX,
 };
 
@@ -570,8 +570,6 @@ mlx5dr_action_create_push_vlan(struct mlx5dr_context *ctx, uint32_t flags);
  * the given priority.
  * @param[in] ctx
  *	The context in which the new action will be created.
- * @param[in] tbl
- *	The root table to jump to.
  * @param[in] priority
  *	The priority of matcher in the root table to jump to.
  * @param[in] flags
@@ -579,10 +577,9 @@ mlx5dr_action_create_push_vlan(struct mlx5dr_context *ctx, uint32_t flags);
  * @return pointer to mlx5dr_action on success NULL otherwise.
  */
 struct mlx5dr_action *
-mlx5dr_action_create_dest_root_table(struct mlx5dr_context *ctx,
-				     struct mlx5dr_table *tbl,
-				     uint16_t priority,
-				     uint32_t flags);
+mlx5dr_action_create_dest_root(struct mlx5dr_context *ctx,
+				uint16_t priority,
+				uint32_t flags);
 
 /* Destroy direct rule action.
  *
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index df39be47da..01d30b8442 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -34,7 +34,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
 		BIT(MLX5DR_ACTION_TYP_MISS) |
 		BIT(MLX5DR_ACTION_TYP_TIR) |
 		BIT(MLX5DR_ACTION_TYP_DROP) |
-		BIT(MLX5DR_ACTION_TYP_DEST_ROOT_TABLE),
+		BIT(MLX5DR_ACTION_TYP_DEST_ROOT),
 		BIT(MLX5DR_ACTION_TYP_LAST),
 	},
 	[MLX5DR_TABLE_TYPE_NIC_TX] = {
@@ -51,7 +51,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
 		BIT(MLX5DR_ACTION_TYP_FT) |
 		BIT(MLX5DR_ACTION_TYP_MISS) |
 		BIT(MLX5DR_ACTION_TYP_DROP) |
-		BIT(MLX5DR_ACTION_TYP_DEST_ROOT_TABLE),
+		BIT(MLX5DR_ACTION_TYP_DEST_ROOT),
 		BIT(MLX5DR_ACTION_TYP_LAST),
 	},
 	[MLX5DR_TABLE_TYPE_FDB] = {
@@ -71,7 +71,7 @@ static const uint32_t action_order_arr[MLX5DR_TABLE_TYPE_MAX][MLX5DR_ACTION_TYP_
 		BIT(MLX5DR_ACTION_TYP_MISS) |
 		BIT(MLX5DR_ACTION_TYP_VPORT) |
 		BIT(MLX5DR_ACTION_TYP_DROP) |
-		BIT(MLX5DR_ACTION_TYP_DEST_ROOT_TABLE),
+		BIT(MLX5DR_ACTION_TYP_DEST_ROOT),
 		BIT(MLX5DR_ACTION_TYP_LAST),
 	},
 };
@@ -524,7 +524,7 @@ static void mlx5dr_action_fill_stc_attr(struct mlx5dr_action *action,
 		attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
 		attr->dest_table_id = obj->id;
 		break;
-	case MLX5DR_ACTION_TYP_DEST_ROOT_TABLE:
+	case MLX5DR_ACTION_TYP_DEST_ROOT:
 		attr->action_type = MLX5_IFC_STC_ACTION_TYPE_JUMP_TO_FT;
 		attr->action_offset = MLX5DR_ACTION_OFFSET_HIT;
 		attr->dest_table_id = action->root_tbl.sa->id;
@@ -1648,10 +1648,9 @@ mlx5dr_action_create_modify_header(struct mlx5dr_context *ctx,
 }
 
 struct mlx5dr_action *
-mlx5dr_action_create_dest_root_table(struct mlx5dr_context *ctx,
-				     struct mlx5dr_table *tbl,
-				     uint16_t priority,
-				     uint32_t flags)
+mlx5dr_action_create_dest_root(struct mlx5dr_context *ctx,
+			       uint16_t priority,
+			       uint32_t flags)
 {
 	struct mlx5dv_steering_anchor_attr attr = {0};
 	struct mlx5dv_steering_anchor *sa;
@@ -1664,12 +1663,6 @@ mlx5dr_action_create_dest_root_table(struct mlx5dr_context *ctx,
 		return NULL;
 	}
 
-	if (!mlx5dr_table_is_root(tbl)) {
-		DR_LOG(ERR, "Non root table cannot be set as destination");
-		rte_errno = ENOTSUP;
-		return NULL;
-	}
-
 	if (mlx5dr_context_shared_gvmi_used(ctx)) {
 		DR_LOG(ERR, "Cannot use this action in shared GVMI context");
 		rte_errno = ENOTSUP;
@@ -1687,7 +1680,7 @@ mlx5dr_action_create_dest_root_table(struct mlx5dr_context *ctx,
 		return NULL;
 	}
 
-	action = mlx5dr_action_create_generic(ctx, flags, MLX5DR_ACTION_TYP_DEST_ROOT_TABLE);
+	action = mlx5dr_action_create_generic(ctx, flags, MLX5DR_ACTION_TYP_DEST_ROOT);
 	if (!action)
 		goto free_steering_anchor;
 
@@ -1725,7 +1718,7 @@ static void mlx5dr_action_destroy_hws(struct mlx5dr_action *action)
 	case MLX5DR_ACTION_TYP_PUSH_VLAN:
 		mlx5dr_action_destroy_stcs(action);
 		break;
-	case MLX5DR_ACTION_TYP_DEST_ROOT_TABLE:
+	case MLX5DR_ACTION_TYP_DEST_ROOT:
 		mlx5dr_action_destroy_stcs(action);
 		mlx5_glue->destroy_steering_anchor(action->root_tbl.sa);
 		break;
@@ -2216,7 +2209,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
 		case MLX5DR_ACTION_TYP_DROP:
 		case MLX5DR_ACTION_TYP_TIR:
 		case MLX5DR_ACTION_TYP_FT:
-		case MLX5DR_ACTION_TYP_DEST_ROOT_TABLE:
+		case MLX5DR_ACTION_TYP_DEST_ROOT:
 		case MLX5DR_ACTION_TYP_VPORT:
 		case MLX5DR_ACTION_TYP_MISS:
 			/* Hit action */
diff --git a/drivers/net/mlx5/hws/mlx5dr_debug.c b/drivers/net/mlx5/hws/mlx5dr_debug.c
index c49b504317..d249f8d869 100644
--- a/drivers/net/mlx5/hws/mlx5dr_debug.c
+++ b/drivers/net/mlx5/hws/mlx5dr_debug.c
@@ -22,7 +22,7 @@ const char *mlx5dr_debug_action_type_str[] = {
 	[MLX5DR_ACTION_TYP_PUSH_VLAN] = "PUSH_VLAN",
 	[MLX5DR_ACTION_TYP_ASO_METER] = "ASO_METER",
 	[MLX5DR_ACTION_TYP_ASO_CT] = "ASO_CT",
-	[MLX5DR_ACTION_TYP_DEST_ROOT_TABLE] = "DEST_ROOT_TABLE",
+	[MLX5DR_ACTION_TYP_DEST_ROOT] = "DEST_ROOT",
 };
 
 static_assert(ARRAY_SIZE(mlx5dr_debug_action_type_str) == MLX5DR_ACTION_TYP_MAX,
-- 
2.25.1


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

* [PATCH 2/2] net/mlx5: add support for send to kernel over HWS
  2023-06-13  5:28 [PATCH 1/2] net/mlx5/hws: removing the table name from dest root table Bar Neuman
@ 2023-06-13  5:28 ` Bar Neuman
  2023-06-13  7:33   ` Slava Ovsiienko
  2023-06-13  7:30 ` [PATCH 1/2] net/mlx5/hws: removing the table name from dest root table Slava Ovsiienko
  2023-06-20  6:48 ` Raslan Darawsheh
  2 siblings, 1 reply; 5+ messages in thread
From: Bar Neuman @ 2023-06-13  5:28 UTC (permalink / raw)
  To: dev; +Cc: orika, rasland, matan, viacheslavo, mkashani

Added hws send to kernel action and root tbl in mlx5_priv.
Initialized in hws configure and used in hws actions translate.

Signed-off-by: Bar Neuman <bneuman@nvidia.com>
---
 drivers/net/mlx5/mlx5.h         |  2 ++
 drivers/net/mlx5/mlx5_flow_hw.c | 59 +++++++++++++++++++++++++++++++--
 2 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 021049ad2b..c3f1a49f86 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -1852,6 +1852,8 @@ struct mlx5_priv {
 	struct mlx5dr_action *hw_drop[2];
 	/* HW steering global tag action. */
 	struct mlx5dr_action *hw_tag[2];
+	/* HW steering global send to kernel action. */
+	struct mlx5dr_action *hw_send_to_kernel;
 	/* HW steering create ongoing rte flow table list header. */
 	LIST_HEAD(flow_hw_tbl_ongo, rte_flow_template_table) flow_hw_tbl_ongo;
 	struct mlx5_indexed_pool *acts_ipool; /* Action data indexed pool. */
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index f17a2a0522..74985009df 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -1620,8 +1620,18 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 			refmt_type = MLX5DR_ACTION_REFORMAT_TYPE_TNL_L2_TO_L2;
 			break;
 		case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL:
-			DRV_LOG(ERR, "send to kernel action is not supported in HW steering.");
-			goto err;
+			flow_hw_translate_group(dev, cfg, attr->group,
+						&target_grp, error);
+			if (target_grp == 0) {
+				__flow_hw_action_template_destroy(dev, acts);
+				return rte_flow_error_set(error, ENOTSUP,
+						RTE_FLOW_ERROR_TYPE_ACTION,
+						NULL,
+						"Send to kernel action on root table is not supported in HW steering mode");
+			}
+			action_pos = at->actions_off[actions - at->actions];
+			acts->rule_acts[action_pos].action = priv->hw_send_to_kernel;
+			break;
 		case RTE_FLOW_ACTION_TYPE_MODIFY_FIELD:
 			err = flow_hw_modify_field_compile(dev, attr, action_start,
 							   actions, masks, acts, &mhdr,
@@ -4031,6 +4041,7 @@ flow_hw_template_expand_modify_field(struct rte_flow_action actions[],
 		case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP:
 		case RTE_FLOW_ACTION_TYPE_RAW_ENCAP:
 		case RTE_FLOW_ACTION_TYPE_DROP:
+		case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL:
 		case RTE_FLOW_ACTION_TYPE_JUMP:
 		case RTE_FLOW_ACTION_TYPE_QUEUE:
 		case RTE_FLOW_ACTION_TYPE_RSS:
@@ -4179,6 +4190,21 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev *dev,
 			/* TODO: Validation logic */
 			action_flags |= MLX5_FLOW_ACTION_JUMP;
 			break;
+#ifdef HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE
+		case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL:
+			if (priv->shared_host)
+				return rte_flow_error_set(error, ENOTSUP,
+							  RTE_FLOW_ERROR_TYPE_ACTION,
+							  action,
+							  "action not supported in guest port");
+			if (!priv->hw_send_to_kernel)
+				return rte_flow_error_set(error, ENOTSUP,
+							  RTE_FLOW_ERROR_TYPE_ACTION,
+							  action,
+							  "action is not available");
+			action_flags |= MLX5_FLOW_ACTION_SEND_TO_KERNEL;
+			break;
+#endif
 		case RTE_FLOW_ACTION_TYPE_QUEUE:
 			/* TODO: Validation logic */
 			action_flags |= MLX5_FLOW_ACTION_QUEUE;
@@ -4320,6 +4346,7 @@ static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = {
 	[RTE_FLOW_ACTION_TYPE_CONNTRACK] = MLX5DR_ACTION_TYP_ASO_CT,
 	[RTE_FLOW_ACTION_TYPE_OF_POP_VLAN] = MLX5DR_ACTION_TYP_POP_VLAN,
 	[RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN] = MLX5DR_ACTION_TYP_PUSH_VLAN,
+	[RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL] = MLX5DR_ACTION_TYP_DEST_ROOT,
 };
 
 static int
@@ -5721,6 +5748,30 @@ flow_hw_free_vport_actions(struct mlx5_priv *priv)
 	priv->hw_vport = NULL;
 }
 
+static void
+flow_hw_create_send_to_kernel_actions(struct mlx5_priv *priv __rte_unused)
+{
+#ifdef HAVE_MLX5DV_DR_ACTION_CREATE_DEST_ROOT_TABLE
+	priv->hw_send_to_kernel =
+			mlx5dr_action_create_dest_root(priv->dr_ctx,
+						       MLX5_HW_LOWEST_PRIO_ROOT,
+						       MLX5DR_ACTION_FLAG_HWS_RX);
+	if (!priv->hw_send_to_kernel) {
+		DRV_LOG(WARNING, "Unable to create HWS send to kernel action");
+		return;
+	}
+#endif
+}
+
+static void
+flow_hw_destroy_send_to_kernel_action(struct mlx5_priv *priv)
+{
+	if (priv->hw_send_to_kernel) {
+		mlx5dr_action_destroy(priv->hw_send_to_kernel);
+		priv->hw_send_to_kernel = NULL;
+	}
+}
+
 /**
  * Create an egress pattern template matching on source SQ.
  *
@@ -7584,6 +7635,8 @@ flow_hw_configure(struct rte_eth_dev *dev,
 			goto err;
 		}
 	}
+	if (!priv->shared_host)
+		flow_hw_create_send_to_kernel_actions(priv);
 	if (port_attr->nb_conn_tracks || (host_priv && host_priv->hws_ctpool)) {
 		mem_size = sizeof(struct mlx5_aso_sq) * nb_q_updated +
 			   sizeof(*priv->ct_mng);
@@ -7646,6 +7699,7 @@ flow_hw_configure(struct rte_eth_dev *dev,
 		priv->hws_cpool = NULL;
 	}
 	mlx5_flow_quota_destroy(dev);
+	flow_hw_destroy_send_to_kernel_action(priv);
 	flow_hw_free_vport_actions(priv);
 	for (i = 0; i < MLX5_HW_ACTION_FLAG_MAX; i++) {
 		if (priv->hw_drop[i])
@@ -7726,6 +7780,7 @@ flow_hw_resource_release(struct rte_eth_dev *dev)
 			mlx5dr_action_destroy(priv->hw_tag[i]);
 	}
 	flow_hw_destroy_vlan(dev);
+	flow_hw_destroy_send_to_kernel_action(priv);
 	flow_hw_free_vport_actions(priv);
 	if (priv->acts_ipool) {
 		mlx5_ipool_destroy(priv->acts_ipool);
-- 
2.25.1


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

* RE: [PATCH 1/2] net/mlx5/hws: removing the table name from dest root table
  2023-06-13  5:28 [PATCH 1/2] net/mlx5/hws: removing the table name from dest root table Bar Neuman
  2023-06-13  5:28 ` [PATCH 2/2] net/mlx5: add support for send to kernel over HWS Bar Neuman
@ 2023-06-13  7:30 ` Slava Ovsiienko
  2023-06-20  6:48 ` Raslan Darawsheh
  2 siblings, 0 replies; 5+ messages in thread
From: Slava Ovsiienko @ 2023-06-13  7:30 UTC (permalink / raw)
  To: Bar Neuman, dev
  Cc: Ori Kam, Raslan Darawsheh, Matan Azrad, Maayan Kashani, Itamar Gozlan

> -----Original Message-----
> From: Bar Neuman <bneuman@nvidia.com>
> Sent: Tuesday, June 13, 2023 8:28 AM
> To: dev@dpdk.org
> Cc: Ori Kam <orika@nvidia.com>; Raslan Darawsheh <rasland@nvidia.com>;
> Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Maayan Kashani <mkashani@nvidia.com>; Itamar
> Gozlan <igozlan@nvidia.com>
> Subject: [PATCH 1/2] net/mlx5/hws: removing the table name from dest root
> table
> 
> From: Itamar Gozlan <igozlan@nvidia.com>
> 
> Jumping to root (group 0) does not behave the same as jumping to groups
> with level > 0.
> To better emphasize that it is not the same action, a rename is made to drop
> the name table.
> 
> Signed-off-by: Itamar Gozlan <igozlan@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>


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

* RE: [PATCH 2/2] net/mlx5: add support for send to kernel over HWS
  2023-06-13  5:28 ` [PATCH 2/2] net/mlx5: add support for send to kernel over HWS Bar Neuman
@ 2023-06-13  7:33   ` Slava Ovsiienko
  0 siblings, 0 replies; 5+ messages in thread
From: Slava Ovsiienko @ 2023-06-13  7:33 UTC (permalink / raw)
  To: Bar Neuman, dev; +Cc: Ori Kam, Raslan Darawsheh, Matan Azrad, Maayan Kashani

> -----Original Message-----
> From: Bar Neuman <bneuman@nvidia.com>
> Sent: Tuesday, June 13, 2023 8:28 AM
> To: dev@dpdk.org
> Cc: Ori Kam <orika@nvidia.com>; Raslan Darawsheh <rasland@nvidia.com>;
> Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Maayan Kashani <mkashani@nvidia.com>
> Subject: [PATCH 2/2] net/mlx5: add support for send to kernel over HWS
> 
> Added hws send to kernel action and root tbl in mlx5_priv.
> Initialized in hws configure and used in hws actions translate.
> 
> Signed-off-by: Bar Neuman <bneuman@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>


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

* RE: [PATCH 1/2] net/mlx5/hws: removing the table name from dest root table
  2023-06-13  5:28 [PATCH 1/2] net/mlx5/hws: removing the table name from dest root table Bar Neuman
  2023-06-13  5:28 ` [PATCH 2/2] net/mlx5: add support for send to kernel over HWS Bar Neuman
  2023-06-13  7:30 ` [PATCH 1/2] net/mlx5/hws: removing the table name from dest root table Slava Ovsiienko
@ 2023-06-20  6:48 ` Raslan Darawsheh
  2 siblings, 0 replies; 5+ messages in thread
From: Raslan Darawsheh @ 2023-06-20  6:48 UTC (permalink / raw)
  To: Bar Neuman, dev
  Cc: Ori Kam, Matan Azrad, Slava Ovsiienko, Maayan Kashani, Itamar Gozlan

Hi,


> -----Original Message-----
> From: Bar Neuman <bneuman@nvidia.com>
> Sent: Tuesday, June 13, 2023 8:28 AM
> To: dev@dpdk.org
> Cc: Ori Kam <orika@nvidia.com>; Raslan Darawsheh <rasland@nvidia.com>;
> Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>; Maayan Kashani <mkashani@nvidia.com>; Itamar
> Gozlan <igozlan@nvidia.com>
> Subject: [PATCH 1/2] net/mlx5/hws: removing the table name from dest root
> table
> 
> From: Itamar Gozlan <igozlan@nvidia.com>
> 
> Jumping to root (group 0) does not behave the same as jumping to groups
> with level > 0.
> To better emphasize that it is not the same action, a rename is made to drop
> the name table.
> 
> Signed-off-by: Itamar Gozlan <igozlan@nvidia.com>

Series applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

end of thread, other threads:[~2023-06-20  6:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-13  5:28 [PATCH 1/2] net/mlx5/hws: removing the table name from dest root table Bar Neuman
2023-06-13  5:28 ` [PATCH 2/2] net/mlx5: add support for send to kernel over HWS Bar Neuman
2023-06-13  7:33   ` Slava Ovsiienko
2023-06-13  7:30 ` [PATCH 1/2] net/mlx5/hws: removing the table name from dest root table Slava Ovsiienko
2023-06-20  6:48 ` Raslan Darawsheh

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