Skip to contentSkip to conversation

net/mlx5: fix RSS expansion compilation

PATCH In review Gregory Etelson 2 participants 2 messages Jan 14, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix RSS expansion compilation

For each item in flow rule pattern that can be expanded, RSS expansion scheme returns ether specific next item flow item type or RTE_FLOW_ITEM_TYPE_VOID or RTE_FLOW_ITEM_TYPE_END. RTE_FLOW_ITEM_TYPE_END means that expansion has completed. RTE_FLOW_ITEM_TYPE_VOID means that next flow item was not located yet and the procedure will continue.

Current expansion scheme assigns RTE_FLOW_ITEM_TYPE_END for L2, L3 and L4 rule items that set next protocol value to 0 in flow item mask. The correct value in that case is RTE_FLOW_ITEM_TYPE_VOID.

Fixes 342a22ef3928 ("net/mlx5: fix RSS expansion with explicit next protocol")
---
 drivers/net/mlx5/mlx5_flow.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/mlx5/mlx5_flow.c +8 -0
index 4e2ff16e30..e067087272 100644
@@ -261,18 +261,26 @@ mlx5_flow_expand_rss_item_complete(const struct rte_flow_item *item)
 	switch (item->type) {
 	case RTE_FLOW_ITEM_TYPE_ETH:
 		MLX5_XSET_ITEM_MASK_SPEC(eth, type);
+		if (!mask)
+			return RTE_FLOW_ITEM_TYPE_VOID;
 		ret = mlx5_ethertype_to_item_type(spec, mask, false);
 		break;
 	case RTE_FLOW_ITEM_TYPE_VLAN:
 		MLX5_XSET_ITEM_MASK_SPEC(vlan, inner_type);
+		if (!mask)
+			return RTE_FLOW_ITEM_TYPE_VOID;
 		ret = mlx5_ethertype_to_item_type(spec, mask, false);
 		break;
 	case RTE_FLOW_ITEM_TYPE_IPV4:
 		MLX5_XSET_ITEM_MASK_SPEC(ipv4, hdr.next_proto_id);
+		if (!mask)
+			return RTE_FLOW_ITEM_TYPE_VOID;
 		ret = mlx5_inet_proto_to_item_type(spec, mask);
 		break;
 	case RTE_FLOW_ITEM_TYPE_IPV6:
 		MLX5_XSET_ITEM_MASK_SPEC(ipv6, hdr.proto);
+		if (!mask)
+			return RTE_FLOW_ITEM_TYPE_VOID;
 		ret = mlx5_inet_proto_to_item_type(spec, mask);
 		break;
 	case RTE_FLOW_ITEM_TYPE_GENEVE:
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines · Gregory Etelson

For each item in flow rule pattern that can be expanded, RSS expansion scheme returns ether specific next item flow item type or RTE_FLOW_ITEM_TYPE_VOID or RTE_FLOW_ITEM_TYPE_END. RTE_FLOW_ITEM_TYPE_END means that expansion has completed. RTE_FLOW_ITEM_TYPE_VOID means that next flow item was not located yet and the procedure will continue.

Quoted 6 lines

Current expansion scheme assigns RTE_FLOW_ITEM_TYPE_END for L2, L3 and L4 rule items that set next protocol value to 0 in flow item mask. The correct value in that case is RTE_FLOW_ITEM_TYPE_VOID.

Fixes 342a22ef3928 ("net/mlx5: fix RSS expansion with explicit next protocol")

Squashed into relevant commit in next-net, thanks.

Please double check the code in next-net.

Quoted 2 lines

<...>