Skip to contentSkip to conversation

net/mlx5: fix unsupported port ID action

PATCH In review Maayan Kashani 3 participants 3 messages Aug 7, 2025 – Aug 18, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix unsupported port ID action

When dv_flow_en=2, the port ID action is not supported. Although a rule can be created successfully in non-template mode, the specified action will be silently ignored and not applied.

To prevent this ambiguous behavior, explicitly return an error when a port ID action is used with dv_flow_en=2,
and recommend using a represented port action instead.

Fixes f1fecffa88df ("net/mlx5: support Direct Rules action template API")
---
 drivers/net/mlx5/mlx5_flow_hw.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow_hw.c +9 -1
index 6dc16f80d32..58d4882cb96 100644
@@ -2913,6 +2913,10 @@ __flow_hw_translate_actions_template(struct rte_eth_dev *dev,
 		case RTE_FLOW_ACTION_TYPE_END:
 			actions_end = true;
 			break;
+		case RTE_FLOW_ACTION_TYPE_PORT_ID:
+			DRV_LOG(ERR, "RTE_FLOW_ACTION_TYPE_PORT_ID action is not supported. "
+				"Use RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT instead.");
+			goto err;
 		default:
 			break;
 		}
@@ -7644,7 +7648,11 @@ flow_hw_parse_flow_actions_to_dr_actions(struct rte_eth_dev *dev,
 		case MLX5_RTE_FLOW_ACTION_TYPE_MIRROR:
 			at->dr_off[i] = curr_off;
 			action_types[curr_off++] = MLX5DR_ACTION_TYP_DEST_ARRAY;
-				break;
+			break;
+		case RTE_FLOW_ACTION_TYPE_PORT_ID:
+			DRV_LOG(ERR, "RTE_FLOW_ACTION_TYPE_PORT_ID action is not supported. "
+				"Use RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT instead.");
+			return -EINVAL;
 		default:
 			type = mlx5_hw_dr_action_types[at->actions[i].type];
 			at->dr_off[i] = curr_off;
Signature · 1 line
2.21.0
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Maayan Kashani

When dv_flow_en=2, the port ID action is not supported. Although a rule can be created successfully in non-template mode, the specified action will be silently ignored and not applied.

To prevent this ambiguous behavior, explicitly return an error when a port ID action is used with dv_flow_en=2,
and recommend using a represented port action instead.

Quoted 5 lines
Fixes f1fecffa88df ("net/mlx5: support Direct Rules action template API")
Quoted 36 lines

---
drivers/net/mlx5/mlx5_flow_hw.c | 10 +++++++++-

1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow_hw.c +9 -1
index 6dc16f80d32..58d4882cb96 100644
@@ -2913,6 +2913,10 @@ __flow_hw_translate_actions_template(struct rte_eth_dev *dev,
 		case RTE_FLOW_ACTION_TYPE_END:
 			actions_end = true;
 			break;
+		case RTE_FLOW_ACTION_TYPE_PORT_ID:
+			DRV_LOG(ERR, "RTE_FLOW_ACTION_TYPE_PORT_ID action is not supported. "
+				"Use RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT instead.");
+			goto err;
 		default:
 			break;
 		}
@@ -7644,7 +7648,11 @@ flow_hw_parse_flow_actions_to_dr_actions(struct rte_eth_dev *dev,
 		case MLX5_RTE_FLOW_ACTION_TYPE_MIRROR:
 			at->dr_off[i] = curr_off;
 			action_types[curr_off++] = MLX5DR_ACTION_TYP_DEST_ARRAY;
-				break;
+			break;
+		case RTE_FLOW_ACTION_TYPE_PORT_ID:
+			DRV_LOG(ERR, "RTE_FLOW_ACTION_TYPE_PORT_ID action is not supported. "
+				"Use RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT instead.");
+			return -EINVAL;
 		default:
 			type = mlx5_hw_dr_action_types[at->actions[i].type];
 			at->dr_off[i] = curr_off;
Signature · 1 line
2.21.0
#2 lore raw
In reply to Maayan Kashani

Hi,

Quoted 8 lines · Maayan Kashani

When dv_flow_en=2, the port ID action is not supported. Although a rule can be created successfully in non-template mode, the specified action will be silently ignored and not applied.

To prevent this ambiguous behavior, explicitly return an error when a port ID action is used with dv_flow_en=2,
and recommend using a represented port action instead.

Quoted 5 lines
Fixes f1fecffa88df ("net/mlx5: support Direct Rules action template API")

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh