net/mlx5e: Verify flow_source cap before using it
authorRoi Dayan <roid@nvidia.com>
Tue, 31 Jan 2023 10:04:30 +0000 (12:04 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Fri, 24 Feb 2023 18:13:18 +0000 (10:13 -0800)
When adding send to vport rule verify flow_source matching is
supported by checking the flow_source cap.

Fixes: d04442540372 ("net/mlx5: E-Switch, set flow source for send to uplink rule")
Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Maor Dickman <maord@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

index 2a98375..d766a64 100644 (file)
@@ -869,7 +869,8 @@ mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *on_esw,
        dest.vport.flags |= MLX5_FLOW_DEST_VPORT_VHCA_ID;
        flow_act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
 
-       if (rep->vport == MLX5_VPORT_UPLINK)
+       if (MLX5_CAP_ESW_FLOWTABLE(on_esw->dev, flow_source) &&
+           rep->vport == MLX5_VPORT_UPLINK)
                spec->flow_context.flow_source = MLX5_FLOW_CONTEXT_FLOW_SOURCE_LOCAL_VPORT;
 
        flow_rule = mlx5_add_flow_rules(mlx5_eswitch_get_slow_fdb(on_esw),