Skip to contentSkip to conversation

net/mlx5: fix matcher priority for esp item

PATCH In review Bassam ZaidAlKilani 3 participants 3 messages Jul 28, 2022 – Aug 17, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix matcher priority for esp item

ESP is one of IPSec protocols over both IPv4 and IPv6 and is considered a tunnel layer that cannot be followed by any other layer. Taking that into consideration, esp is considered as a 4 layer.

Not defining ESP's priority will make it match with the same priority as its prior IP layer, which has a layer 3 priority. This will lead to issues in matching and will match the packet with the first matching rule even if it doesn't have an esp layer in its pattern, disregarding any following rules that could have an esp item and can be actually a more accurate match since it will have a longer matching criterion.

This is fixed by defining the priority for the ESP item to have a layer 4 priority, making the match be for the rule with the more accurate and longer matching criteria.

Fixes 18ca4a4ec73a ("net/mlx5: support ESP SPI match and RSS hash")
---
 drivers/net/mlx5/mlx5_flow_dv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/mlx5/mlx5_flow_dv.c +1 -0
index bee9363515..47135a0208 100644
@@ -13756,6 +13756,7 @@ flow_dv_translate(struct rte_eth_dev *dev,
 		case RTE_FLOW_ITEM_TYPE_ESP:
 			flow_dv_translate_item_esp(match_mask, match_value,
 						   items, tunnel);
+			matcher.priority = MLX5_PRIORITY_MAP_L4;
 			last_item = MLX5_FLOW_ITEM_ESP;
 			break;
 		case RTE_FLOW_ITEM_TYPE_PORT_ID:
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 24 lines

-----Original Message-----
From: Bassam Zaid AlKilani <[email protected]>
Sent: Thursday, July 28, 2022 17:12
To: [email protected]
Cc: Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Subject: [PATCH] net/mlx5: fix matcher priority for esp item

ESP is one of IPSec protocols over both IPv4 and IPv6 and is considered a tunnel layer that cannot be followed by any other layer. Taking that into consideration, esp is considered as a 4 layer.

Not defining ESP's priority will make it match with the same priority as its prior IP layer, which has a layer 3 priority. This will lead to issues in matching and will match the packet with the first matching rule even if it doesn't have an esp layer in its pattern, disregarding any following rules that could have an esp item and can be actually a more accurate match since it will have a longer matching criterion.

This is fixed by defining the priority for the ESP item to have a layer 4 priority, making the match be for the rule with the more accurate and longer matching criteria.

Quoted 5 lines
Fixes 18ca4a4ec73a ("net/mlx5: support ESP SPI match and RSS hash")
Acked-by on v1 1/1
#2 lore raw
In reply to Bassam ZaidAlKilani

Hi,

Quoted 24 lines

-----Original Message-----
From: Bassam Zaid AlKilani <[email protected]>
Sent: Thursday, July 28, 2022 5:12 PM
To: [email protected]
Cc: Raslan Darawsheh <[email protected]>; [email protected]; [email protected]; Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Subject: [PATCH] net/mlx5: fix matcher priority for esp item

ESP is one of IPSec protocols over both IPv4 and IPv6 and is considered a tunnel layer that cannot be followed by any other layer. Taking that into consideration, esp is considered as a 4 layer.

Not defining ESP's priority will make it match with the same priority as its prior IP layer, which has a layer 3 priority. This will lead to issues in matching and will match the packet with the first matching rule even if it doesn't have an esp layer in its pattern, disregarding any following rules that could have an esp item and can be actually a more accurate match since it will have a longer matching criterion.

This is fixed by defining the priority for the ESP item to have a layer 4 priority, making the match be for the rule with the more accurate and longer matching criteria.

Quoted 5 lines
Fixes 18ca4a4ec73a ("net/mlx5: support ESP SPI match and RSS hash")

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh