OSDN Git Service

mlxsw: spectrum: Set KVH XLT cache mode for Spectrum2/3
authorJiri Pirko <jiri@nvidia.com>
Mon, 14 Dec 2020 11:30:40 +0000 (13:30 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 15 Dec 2020 03:09:55 +0000 (19:09 -0800)
Set a profile option to instruct FW to use 1/2 of KVH for XLT cache, not
the whole one.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlxsw/cmd.h
drivers/net/ethernet/mellanox/mlxsw/core.h
drivers/net/ethernet/mellanox/mlxsw/pci.c
drivers/net/ethernet/mellanox/mlxsw/spectrum.c

index 4de15c5..392ce3c 100644 (file)
@@ -674,6 +674,12 @@ MLXSW_ITEM32(cmd_mbox, config_profile, set_kvd_hash_double_size, 0x0C, 26, 1);
  */
 MLXSW_ITEM32(cmd_mbox, config_profile, set_cqe_version, 0x08, 0, 1);
 
+/* cmd_mbox_config_set_kvh_xlt_cache_mode
+ * Capability bit. Setting a bit to 1 configures the profile
+ * according to the mailbox contents.
+ */
+MLXSW_ITEM32(cmd_mbox, config_profile, set_kvh_xlt_cache_mode, 0x08, 3, 1);
+
 /* cmd_mbox_config_profile_max_vepa_channels
  * Maximum number of VEPA channels per port (0 through 16)
  * 0 - multi-channel VEPA is disabled
@@ -800,6 +806,13 @@ MLXSW_ITEM32(cmd_mbox, config_profile, adaptive_routing_group_cap, 0x4C, 0, 16);
  */
 MLXSW_ITEM32(cmd_mbox, config_profile, arn, 0x50, 31, 1);
 
+/* cmd_mbox_config_profile_kvh_xlt_cache_mode
+ * KVH XLT cache mode:
+ * 0 - XLT can use all KVH as best-effort
+ * 1 - XLT cache uses 1/2 KVH
+ */
+MLXSW_ITEM32(cmd_mbox, config_profile, kvh_xlt_cache_mode, 0x50, 8, 4);
+
 /* cmd_mbox_config_kvd_linear_size
  * KVD Linear Size
  * Valid for Spectrum only
index 6558f9c..6b3ccbf 100644 (file)
@@ -256,7 +256,8 @@ struct mlxsw_config_profile {
                used_max_pkey:1,
                used_ar_sec:1,
                used_adaptive_routing_group_cap:1,
-               used_kvd_sizes:1;
+               used_kvd_sizes:1,
+               used_kvh_xlt_cache_mode:1;
        u8      max_vepa_channels;
        u16     max_mid;
        u16     max_pgt;
@@ -278,6 +279,7 @@ struct mlxsw_config_profile {
        u32     kvd_linear_size;
        u8      kvd_hash_single_parts;
        u8      kvd_hash_double_parts;
+       u8      kvh_xlt_cache_mode;
        struct mlxsw_swid_config swid_config[MLXSW_CONFIG_PROFILE_SWID_COUNT];
 };
 
index aae472f..4eeae8d 100644 (file)
@@ -1196,6 +1196,12 @@ static int mlxsw_pci_config_profile(struct mlxsw_pci *mlxsw_pci, char *mbox,
                mlxsw_cmd_mbox_config_profile_kvd_hash_double_size_set(mbox,
                                        MLXSW_RES_GET(res, KVD_DOUBLE_SIZE));
        }
+       if (profile->used_kvh_xlt_cache_mode) {
+               mlxsw_cmd_mbox_config_profile_set_kvh_xlt_cache_mode_set(
+                       mbox, 1);
+               mlxsw_cmd_mbox_config_profile_kvh_xlt_cache_mode_set(
+                       mbox, profile->kvh_xlt_cache_mode);
+       }
 
        for (i = 0; i < MLXSW_CONFIG_PROFILE_SWID_COUNT; i++)
                mlxsw_pci_config_profile_swid_config(mlxsw_pci, mbox, i,
index 516d6cb..1650d98 100644 (file)
@@ -2936,6 +2936,8 @@ static const struct mlxsw_config_profile mlxsw_sp2_config_profile = {
        .max_ib_mc                      = 0,
        .used_max_pkey                  = 1,
        .max_pkey                       = 0,
+       .used_kvh_xlt_cache_mode        = 1,
+       .kvh_xlt_cache_mode             = 1,
        .swid_config                    = {
                {
                        .used_type      = 1,