net/mlx5: fix RSS expansion compilation

Message ID 20220114151606.25617-1-getelson@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/mlx5: fix RSS expansion compilation |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-testing warning apply patch failure

Commit Message

Gregory Etelson Jan. 14, 2022, 3:16 p.m. UTC
  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")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Ferruh Yigit Jan. 14, 2022, 7:16 p.m. UTC | #1
On 1/14/2022 3:16 PM, Gregory Etelson wrote:
> 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")
> 

Squashed into relevant commit in next-net, thanks.

Please double check the code in next-net.

> Signed-off-by: Gregory Etelson <getelson@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

<...>
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 4e2ff16e30..e067087272 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -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: