]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net/mlx5e: Add a miss level for ipsec crypto offload
authorLama Kayal <lkayal@nvidia.com>
Mon, 15 Sep 2025 12:24:34 +0000 (15:24 +0300)
committerJakub Kicinski <kuba@kernel.org>
Wed, 17 Sep 2025 00:19:14 +0000 (17:19 -0700)
The cited commit adds a miss table for switchdev mode. But it
uses the same level as policy table. Will hit the following error
when running command:

 # ip xfrm state add src 192.168.1.22 dst 192.168.1.21 proto \
esp spi 1001 reqid 10001 aead 'rfc4106(gcm(aes))' \
0x3a189a7f9374955d3817886c8587f1da3df387ff 128 \
mode tunnel offload dev enp8s0f0 dir in
 Error: mlx5_core: Device failed to offload this state.

The dmesg error is:

 mlx5_core 0000:03:00.0: ipsec_miss_create:578:(pid 311797): fail to create IPsec miss_rule err=-22

Fix it by adding a new miss level to avoid the error.

Fixes: 7d9e292ecd67 ("net/mlx5e: Move IPSec policy check after decryption")
Signed-off-by: Jianbo Liu <jianbol@nvidia.com>
Signed-off-by: Chris Mi <cmi@nvidia.com>
Signed-off-by: Lama Kayal <lkayal@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/1757939074-617281-4-git-send-email-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.h
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

index 9560fcba643f50b1cb71963bd1d31e936b4d8957..ac65e3191480293bc6d439b9ce452e9cbbed7327 100644 (file)
@@ -92,6 +92,7 @@ enum {
        MLX5E_ACCEL_FS_ESP_FT_LEVEL = MLX5E_INNER_TTC_FT_LEVEL + 1,
        MLX5E_ACCEL_FS_ESP_FT_ERR_LEVEL,
        MLX5E_ACCEL_FS_POL_FT_LEVEL,
+       MLX5E_ACCEL_FS_POL_MISS_FT_LEVEL,
        MLX5E_ACCEL_FS_ESP_FT_ROCE_LEVEL,
 #endif
 };
index ffcd0cdeb775441eebb65952ffaeef5bb4e1db8b..23703f28386ad91ca9bc98ef6f0941d9a7d6b22b 100644 (file)
@@ -185,6 +185,7 @@ struct mlx5e_ipsec_rx_create_attr {
        u32 family;
        int prio;
        int pol_level;
+       int pol_miss_level;
        int sa_level;
        int status_level;
        enum mlx5_flow_namespace_type chains_ns;
index 98b6a3a623f995a460ac27f23ffc52ef6161a447..65dc3529283b6948cdebfa63230ef824b43f3923 100644 (file)
@@ -747,6 +747,7 @@ static void ipsec_rx_create_attr_set(struct mlx5e_ipsec *ipsec,
        attr->family = family;
        attr->prio = MLX5E_NIC_PRIO;
        attr->pol_level = MLX5E_ACCEL_FS_POL_FT_LEVEL;
+       attr->pol_miss_level = MLX5E_ACCEL_FS_POL_MISS_FT_LEVEL;
        attr->sa_level = MLX5E_ACCEL_FS_ESP_FT_LEVEL;
        attr->status_level = MLX5E_ACCEL_FS_ESP_FT_ERR_LEVEL;
        attr->chains_ns = MLX5_FLOW_NAMESPACE_KERNEL;
@@ -833,7 +834,7 @@ static int ipsec_rx_chains_create_miss(struct mlx5e_ipsec *ipsec,
 
        ft_attr.max_fte = 1;
        ft_attr.autogroup.max_num_groups = 1;
-       ft_attr.level = attr->pol_level;
+       ft_attr.level = attr->pol_miss_level;
        ft_attr.prio = attr->prio;
 
        ft = mlx5_create_auto_grouped_flow_table(attr->ns, &ft_attr);
index cb165085a4c10cfad575edd6fd84b0bec305676b..db552c012b4f4ff70a3bce12d133187b6c2e908a 100644 (file)
 #define ETHTOOL_NUM_PRIOS 11
 #define ETHTOOL_MIN_LEVEL (KERNEL_MIN_LEVEL + ETHTOOL_NUM_PRIOS)
 /* Vlan, mac, ttc, inner ttc, {UDP/ANY/aRFS/accel/{esp, esp_err}}, IPsec policy,
- * {IPsec RoCE MPV,Alias table},IPsec RoCE policy
+ * IPsec policy miss, {IPsec RoCE MPV,Alias table},IPsec RoCE policy
  */
-#define KERNEL_NIC_PRIO_NUM_LEVELS 10
+#define KERNEL_NIC_PRIO_NUM_LEVELS 11
 #define KERNEL_NIC_NUM_PRIOS 1
 /* One more level for tc, and one more for promisc */
 #define KERNEL_MIN_LEVEL (KERNEL_NIC_PRIO_NUM_LEVELS + 2)