Skip to contentSkip to conversation

net/mlx5: do not allow copy to mark via modify field

PATCH Superseded Alexander Kozyrev 3 participants 5 messages Jun 16, 2021 – Jul 22, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: do not allow copy to mark via modify field

Mark requires a tag resource to be registered as part of the value assigning. It is not possible during a copy operation from a packet field. Forbid this in MODIFY_FIELD.

---
 drivers/net/mlx5/mlx5_flow_dv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow_dv.c +3 -2
index dafd37ab93..26b901e32e 100644
@@ -4797,10 +4797,11 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 				"source and destination fields"
 				" cannot be the same");
 	if (action_modify_field->dst.field == RTE_FLOW_FIELD_VALUE ||
-	    action_modify_field->dst.field == RTE_FLOW_FIELD_POINTER)
+	    action_modify_field->dst.field == RTE_FLOW_FIELD_POINTER ||
+	    action_modify_field->dst.field == RTE_FLOW_FIELD_MARK)
 		return rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ACTION, action,
-				"immediate value or a pointer to it"
+				"mark, immediate value or a pointer to it"
 				" cannot be used as a destination");
 	if (action_modify_field->dst.field == RTE_FLOW_FIELD_START ||
 	    action_modify_field->src.field == RTE_FLOW_FIELD_START)
Signature · 1 line
2.18.2
#1 lore raw

Hi, Alexander

Quoted 11 lines

-----Original Message-----
From: Alexander Kozyrev <[email protected]>
Sent: Wednesday, June 16, 2021 21:35
To: [email protected]
Cc: Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Matan Azrad <[email protected]>
Subject: [PATCH] net/mlx5: do not allow copy to mark via modify field

Mark requires a tag resource to be registered as part of the value assigning. It is not possible during a copy operation from a packet field. Forbid this in MODIFY_FIELD.

Sorry, commit message seems not to be clear even for one who is in context. "tag resource" - is this hardware resource?
"not possible" - due to hardware limitation?

And I would add few words about the final table "match-set flow tag resource" - not too many details, just explain - if we copy packet field to MARK substitution register - we can't handle actual value copying in the "match-set" table.

With best regards,
Slava

Quoted 27 lines
---
 drivers/net/mlx5/mlx5_flow_dv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/mlx5/mlx5_flow_dv.c index dafd37ab93..26b901e32e 100644

drivers/net/mlx5/mlx5_flow_dv.c +3 -2
@@ -4797,10 +4797,11 @@ flow_dv_validate_action_modify_field(struct
 rte_eth_dev *dev,
 				"source and destination fields"
 				" cannot be the same");
 	if (action_modify_field->dst.field == RTE_FLOW_FIELD_VALUE ||
-	    action_modify_field->dst.field == RTE_FLOW_FIELD_POINTER)
+	    action_modify_field->dst.field == RTE_FLOW_FIELD_POINTER ||
+	    action_modify_field->dst.field == RTE_FLOW_FIELD_MARK)
 		return rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ACTION, action,
-				"immediate value or a pointer to it"
+				"mark, immediate value or a pointer to it"
 				" cannot be used as a destination");
 	if (action_modify_field->dst.field == RTE_FLOW_FIELD_START ||

action_modify_field->src.field == RTE_FLOW_FIELD_START)
--
2.18.2

#2 lore raw

PATCH v2 1/1 net/mlx5: do not allow copy to mark via modify field

In reply to Alexander Kozyrev

The Mark action is a two-stage process in the Mellanox driver. First, a hardware register is filled with the required value, then this value is registered in the software resource table.

The MODIFY_FIELD action can instruct a Mellanox NIC to copy some value from an arbitrary packet header field into the hardware register, associated with the Mark item. But there is no way NIC can modify the software resource table as well.

Due to these driver limitations the copying of arbitrary value to the MARK can not be supported and should be rejected in the MODIFY_FIELD action.

---
v2: Rewrote the commit message to clarify the limitation better.
v1: https://patchwork.dpdk.org/project/dpdk/patch/[email protected]/

 drivers/net/mlx5/mlx5_flow_dv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/mlx5/mlx5_flow_dv.c +3 -2
index d250486950..519c610e50 100644
@@ -4940,10 +4940,11 @@ flow_dv_validate_action_modify_field(struct rte_eth_dev *dev,
 				"source and destination fields"
 				" cannot be the same");
 	if (action_modify_field->dst.field == RTE_FLOW_FIELD_VALUE ||
-	    action_modify_field->dst.field == RTE_FLOW_FIELD_POINTER)
+	    action_modify_field->dst.field == RTE_FLOW_FIELD_POINTER ||
+	    action_modify_field->dst.field == RTE_FLOW_FIELD_MARK)
 		return rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_ACTION, action,
-				"immediate value or a pointer to it"
+				"mark, immediate value or a pointer to it"
 				" cannot be used as a destination");
 	if (action_modify_field->dst.field == RTE_FLOW_FIELD_START ||
 	    action_modify_field->src.field == RTE_FLOW_FIELD_START)
Signature · 1 line
2.18.2
Acked-by on v2 1/1
#3 lore raw
Quoted 12 lines

-----Original Message-----
From: Alexander Kozyrev <[email protected]>
Sent: Friday, July 16, 2021 11:43
To: [email protected]
Cc: Raslan Darawsheh <[email protected]>; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Subject: [PATCH v2] net/mlx5: do not allow copy to mark via modify field

The Mark action is a two-stage process in the Mellanox driver. First, a hardware register is filled with the required value, then this value is registered in the software resource table.

Quoted 8 lines

The MODIFY_FIELD action can instruct a Mellanox NIC to copy some value from an arbitrary packet header field into the hardware register, associated with the Mark item. But there is no way NIC can modify the software resource table as well.

Due to these driver limitations the copying of arbitrary value to the MARK can not be supported and should be rejected in the MODIFY_FIELD action.

Thank you, Alexander

Quoted 1 line
#4 lore raw

16/07/2021 12:47, Slava Ovsiienko:

Quoted 17 lines
Quoted 17 lines

-----Original Message-----
From: Alexander Kozyrev <[email protected]>
Sent: Friday, July 16, 2021 11:43
To: [email protected]
Cc: Raslan Darawsheh <[email protected]>; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Subject: [PATCH v2] net/mlx5: do not allow copy to mark via modify field

The Mark action is a two-stage process in the Mellanox driver. First, a hardware register is filled with the required value, then this value is registered in the software resource table.

The MODIFY_FIELD action can instruct a Mellanox NIC to copy some value from an arbitrary packet header field into the hardware register, associated with the Mark item. But there is no way NIC can modify the software resource table as well.

Quoted 7 lines
Quoted 3 lines

Due to these driver limitations the copying of arbitrary value to the MARK can not be supported and should be rejected in the MODIFY_FIELD action.

Thank you, Alexander

Quoted 1 line

Applied, thanks.