[v2,4/9] net/mlx5: fix flex item tunnel mode handling

Message ID 20240918134623.8441-5-viacheslavo@nvidia.com (mailing list archive)
State Awaiting Upstream
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: cumulative fix series for flex item |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Viacheslav Ovsiienko Sept. 18, 2024, 1:46 p.m. UTC
The RTE flex item can represent tunnel header itself,
and split inner and outer items, it should be reflected
in the item flags while PMD is processing the item array.

Fixes: 8c0ca7527bc8 ("net/mlx5/hws: support flex item matching")
Cc: stable@dpdk.org

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

Comments

Dariusz Sosnowski Sept. 18, 2024, 1:57 p.m. UTC | #1
> -----Original Message-----
> From: Slava Ovsiienko <viacheslavo@nvidia.com>
> Sent: Wednesday, September 18, 2024 15:46
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@nvidia.com>; Raslan Darawsheh
> <rasland@nvidia.com>; Ori Kam <orika@nvidia.com>; Dariusz Sosnowski
> <dsosnowski@nvidia.com>; stable@dpdk.org
> Subject: [PATCH v2 4/9] net/mlx5: fix flex item tunnel mode handling
> 
> The RTE flex item can represent tunnel header itself, and split inner and outer
> items, it should be reflected in the item flags while PMD is processing the item
> array.
> 
> Fixes: 8c0ca7527bc8 ("net/mlx5/hws: support flex item matching")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_flow_hw.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
> index 50888944a5..a275154d4b 100644
> --- a/drivers/net/mlx5/mlx5_flow_hw.c
> +++ b/drivers/net/mlx5/mlx5_flow_hw.c
> @@ -558,6 +558,7 @@ flow_hw_matching_item_flags_get(const struct
> rte_flow_item items[])
>  	uint64_t last_item = 0;
> 
>  	for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
> +		enum rte_flow_item_flex_tunnel_mode tunnel_mode =
> +FLEX_TUNNEL_MODE_SINGLE;
>  		int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
>  		int item_type = items->type;
> 
> @@ -606,6 +607,13 @@ flow_hw_matching_item_flags_get(const struct
> rte_flow_item items[])
>  		case RTE_FLOW_ITEM_TYPE_COMPARE:
>  			last_item = MLX5_FLOW_ITEM_COMPARE;
>  			break;
> +		case RTE_FLOW_ITEM_TYPE_FLEX:
> +			mlx5_flex_get_tunnel_mode(items, &tunnel_mode);
> +			last_item = tunnel_mode ==
> FLEX_TUNNEL_MODE_TUNNEL ?
> +					MLX5_FLOW_ITEM_FLEX_TUNNEL :
> +					tunnel ?
> MLX5_FLOW_ITEM_INNER_FLEX :
> +
> 	MLX5_FLOW_ITEM_OUTER_FLEX;
> +			break;
>  		default:
>  			break;
>  		}
> --
> 2.34.1

Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>

Resending the Ack for each patch separately, because patchwork assigned my Ack for the series to v1, not v2.

Best regards,
Dariusz Sosnowski
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 50888944a5..a275154d4b 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -558,6 +558,7 @@  flow_hw_matching_item_flags_get(const struct rte_flow_item items[])
 	uint64_t last_item = 0;
 
 	for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) {
+		enum rte_flow_item_flex_tunnel_mode tunnel_mode = FLEX_TUNNEL_MODE_SINGLE;
 		int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
 		int item_type = items->type;
 
@@ -606,6 +607,13 @@  flow_hw_matching_item_flags_get(const struct rte_flow_item items[])
 		case RTE_FLOW_ITEM_TYPE_COMPARE:
 			last_item = MLX5_FLOW_ITEM_COMPARE;
 			break;
+		case RTE_FLOW_ITEM_TYPE_FLEX:
+			mlx5_flex_get_tunnel_mode(items, &tunnel_mode);
+			last_item = tunnel_mode == FLEX_TUNNEL_MODE_TUNNEL ?
+					MLX5_FLOW_ITEM_FLEX_TUNNEL :
+					tunnel ? MLX5_FLOW_ITEM_INNER_FLEX :
+						MLX5_FLOW_ITEM_OUTER_FLEX;
+			break;
 		default:
 			break;
 		}