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")
Cc: sta...@dpdk.org

Signed-off-by: Maayan Kashani <mkash...@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnow...@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 6dc16f80d32..58d4882cb96 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -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;
-- 
2.21.0

Reply via email to