From a26cc30fa0463fb6707b0caea1a288dc54c09b0f Mon Sep 17 00:00:00 2001 From: Xiaoyu Min Date: Fri, 2 Jul 2021 16:34:48 +0800 Subject: [PATCH] net/mlx5: limit inner RSS expansion for MPLS If user wants to do MPLS inner RSS and only provides pattern till MPLS without inner items [1], RSS expansion will expand flows into 13 sub-flows[2] which is too many and it impacts flow insert rate, stack usage becomes large as well. This expansion into 13 sub-flows seems not worthy of and it can be significantly reduced (i.e, 7 sub-flows [3]) by user providing at least one inner L2/L3 item [4]. [1]: pattern eth / ipv4 / udp / mpls / end actions rss type tcp udp ip end level 2 / end [2]: eth / ipv4 / udp / mpls eth / ipv4 / udp / mpls / ipv4 eth / ipv4 / udp / mpls / ipv4 / udp eth / ipv4 / udp / mpls / ipv4 / tcp eth / ipv4 / udp / mpls / ipv6 eth / ipv4 / udp / mpls / ipv6 / udp eth / ipv4 / udp / mpls / ipv6 / tcp eth / ipv4 / udp / mpls / eth / ipv4 eth / ipv4 / udp / mpls / eth / ipv4 / udp eth / ipv4 / udp / mpls / eth / ipv4 / tcp eth / ipv4 / udp / mpls / eth / ipv6 eth / ipv4 / udp / mpls / eth / ipv6 / udp eth / ipv4 / udp / mpls / eth / ipv6 / tcp [3]: eth / ipv4 / udp / mpls / eth eth / ipv4 / udp / mpls / eth / ipv4 / udp eth / ipv4 / udp / mpls / eth / ipv4 / tcp eth / ipv4 / udp / mpls / eth / ipv6 eth / ipv4 / udp / mpls / eth / ipv6 / udp eth / ipv4 / udp / mpls / eth / ipv6 / tcp [4]: pattern eth / ipv4 / udp / mpls / eth / end actions rss type tcp udp ip level 2 / end Signed-off-by: Xiaoyu Min Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index 00fc37ed55..8b5315676b 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -1674,6 +1674,13 @@ mlx5_flow_validate_action_rss(const struct rte_flow_action *action, RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL, "RSS on eCPRI is not supported now"); } + if ((item_flags & MLX5_FLOW_LAYER_MPLS) && + !(item_flags & + (MLX5_FLOW_LAYER_INNER_L2 | MLX5_FLOW_LAYER_INNER_L3)) && + rss->level > 1) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, NULL, + "MPLS inner RSS needs to specify inner L2/L3 items after MPLS in pattern"); return 0; } -- 2.20.1