]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/mlx5: Add vhca_id_type support to IPsec alias creation
authorPatrisious Haddad <phaddad@nvidia.com>
Thu, 30 Apr 2026 06:19:58 +0000 (09:19 +0300)
committerJakub Kicinski <kuba@kernel.org>
Sat, 2 May 2026 17:19:08 +0000 (10:19 -0700)
When creating an alias FT for MPV IPsec, if alias creation with
sw_vhca_id is supported use it instead of using the hw_vhca_id.

This in turn allows IPsec to work properly after live migration,
in case a VF was live migrated and his hw_vhca_id changed due to
migration which can happen if you migrate to a VF with a different index
than yours, IPsec would fail to start post migration, this patch
resolves the issue by using sw_vhca_id instead which doesn't change post
migration.

Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260430061958.225245-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
drivers/net/ethernet/mellanox/mlx5/core/lib/ipsec_fs_roce.c
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h

index c89417c1a1f96dbfdf27971d799be40a1d17405d..b5c8fbfb0eedc6c867609ef64b3a171338893951 100644 (file)
@@ -2306,6 +2306,7 @@ int mlx5_cmd_alias_obj_create(struct mlx5_core_dev *dev,
 
        attr = MLX5_ADDR_OF(create_alias_obj_in, in, alias_ctx);
        MLX5_SET(alias_context, attr, vhca_id_to_be_accessed, alias_attr->vhca_id);
+       MLX5_SET(alias_context, attr, vhca_id_type, alias_attr->vhca_id_type);
        MLX5_SET(alias_context, attr, object_id_to_be_accessed, alias_attr->obj_id);
 
        key = MLX5_ADDR_OF(alias_context, attr, access_key);
index 28cb670ba33e1d688fc94f51e8575fe175b6b479..9aadb20b8b8ea6426b172896cc3208656fdeb591 100644 (file)
@@ -116,6 +116,16 @@ static int ipsec_fs_create_aliased_ft(struct mlx5_core_dev *ibv_owner,
        memcpy(alias_attr.access_key, alias_key, ACCESS_KEY_LEN);
        alias_attr.obj_id = aliased_object_id;
        alias_attr.obj_type = MLX5_GENERAL_OBJECT_TYPES_FLOW_TABLE_ALIAS;
+       if (MLX5_CAP_GEN_2(ibv_owner, sw_vhca_id_valid) &&
+           MLX5_CAP_GEN(ibv_allowed, ft_alias_sw_vhca_id)) {
+               vhca_id_to_be_accessed = MLX5_CAP_GEN_2(ibv_owner, sw_vhca_id);
+               alias_attr.vhca_id_type = VHCA_ID_TYPE_SW;
+       } else {
+               vhca_id_to_be_accessed = MLX5_CAP_GEN(ibv_owner, vhca_id);
+               alias_attr.vhca_id_type = VHCA_ID_TYPE_HW;
+               if (MLX5_CAP_GEN_2(ibv_owner, sw_vhca_id_valid))
+                       mlx5_core_warn(ibv_owner, "IPsec with migration isn't supported, if migration is required update FW.\n");
+       }
        alias_attr.vhca_id = vhca_id_to_be_accessed;
        ret = mlx5_cmd_alias_obj_create(ibv_allowed, &alias_attr, obj_id);
        if (ret) {
index 87f01c4e8d658b7eeb5eca9a0982ae1dc52974fc..d70907f499a915a8f85ec2f3c0e42397e87a47b3 100644 (file)
@@ -110,6 +110,7 @@ struct mlx5_cmd_allow_other_vhca_access_attr {
 struct mlx5_cmd_alias_obj_create_attr {
        u32 obj_id;
        u16 vhca_id;
+       u8 vhca_id_type;
        u16 obj_type;
        u8 access_key[ACCESS_KEY_LEN];
 };