Skip to contentSkip to conversation

net/mlx5: fix raw encap validation

PATCH In review Gregory Etelson 3 participants 3 messages Oct 27, 2024 – Oct 30, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix raw encap validation

In SWS, mlx5_flow_dv_validate_action_raw_encap_decap is called for flow action. The action validation checks for both size and data parameters.

In HWS, mlx5_flow_dv_validate_action_raw_encap_decap is called for the action template and validates the action mask.

The patch separates encap validation in mlx5_flow_dv_validate_action_raw_encap_decap for SWS and HWS cases.

Fixes cbfa4ed03913 ("net/mlx5: update flow actions validation before template creation")
---
 drivers/net/mlx5/mlx5_flow_dv.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/net/mlx5/mlx5_flow_dv.c +13 -4
index 89057edbcf..294e23de98 100644
@@ -4047,10 +4047,19 @@ mlx5_flow_dv_validate_action_raw_encap_decap
 	const struct mlx5_priv *priv = dev->data->dev_private;
 	int ret;
 
-	if (encap && (!encap->size || !encap->data))
-		return rte_flow_error_set(error, EINVAL,
-					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-					  "raw encap data cannot be empty");
+	if (encap) {
+		if (!mlx5_hws_active(dev)) {
+			if (!encap->size || !encap->data)
+				return rte_flow_error_set
+					(error, EINVAL,
+					 RTE_FLOW_ERROR_TYPE_ACTION, NULL, "raw encap data cannot be empty");
+		} else {
+			if (!encap->size)
+				return rte_flow_error_set
+					(error, EINVAL,
+					 RTE_FLOW_ERROR_TYPE_ACTION, NULL, "raw encap size cannot be 0");
+		}
+	}
 	if (decap && encap) {
 		if (decap->size <= MLX5_ENCAPSULATION_DECISION_SIZE &&
 		    encap->size > MLX5_ENCAPSULATION_DECISION_SIZE)
Signature · 1 line
2.43.0
Acked-by on v1 1/1
#1 lore raw
Quoted 18 lines

-----Original Message-----
From: Gregory Etelson <[email protected]>
Sent: Sunday, October 27, 2024 06:26
To: [email protected]
Cc: Gregory Etelson <[email protected]>; Maayan Kashani <[email protected]>; Raslan Darawsheh <[email protected]>; Dariusz Sosnowski <[email protected]>; Slava Ovsiienko <[email protected]>; Bing Zhao <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Subject: [PATCH] net/mlx5: fix raw encap validation

In SWS, mlx5_flow_dv_validate_action_raw_encap_decap is called for flow action. The action validation checks for both size and data parameters.

In HWS, mlx5_flow_dv_validate_action_raw_encap_decap is called for the action template and validates the action mask.

Quoted 6 lines

The patch separates encap validation in mlx5_flow_dv_validate_action_raw_encap_decap for SWS and HWS cases.

Fixes cbfa4ed03913 ("net/mlx5: update flow actions validation before

template creation")

Best regards,
Dariusz Sosnowski

#2 lore raw
In reply to Gregory Etelson

Hi,

From: Gregory Etelson <[email protected]>
Sent: Sunday, October 27, 2024 7:26 AM
To: [email protected]
Cc: Gregory Etelson; Maayan Kashani; Raslan Darawsheh; Dariusz Sosnowski; Slava Ovsiienko; Bing Zhao; Ori Kam; Suanming Mou; Matan Azrad
Subject: [PATCH] net/mlx5: fix raw encap validation

In SWS, mlx5_flow_dv_validate_action_raw_encap_decap is called for flow action. The action validation checks for both size and data parameters.

In HWS, mlx5_flow_dv_validate_action_raw_encap_decap is called for the action template and validates the action mask.

The patch separates encap validation in mlx5_flow_dv_validate_action_raw_encap_decap for SWS and HWS cases.

Fixes cbfa4ed03913 ("net/mlx5: update flow actions validation before template creation")

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh