Skip to content

Commit 7e2050a

Browse files
idoschkuba-moo
authored andcommitted
mlxsw: core_env: Fix driver initialization with old firmware
The driver queries the Management Capabilities Mask (MCAM) register during initialization to understand if it can read up to 128 bytes from transceiver modules. However, not all firmware versions support this register, leading to the driver failing to load. Fix by treating an error in the register query as an indication that the feature is not supported. Fixes: 1f4aea1 ("mlxsw: core_env: Read transceiver module EEPROM in 128 bytes chunks") Reported-by: Tim 'mithro' Ansell <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Petr Machata <[email protected]> Signed-off-by: Petr Machata <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/0afa8b2e8bac178f5f88211344429176dcc72281.1713446092.git.petrm@nvidia.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 976c44a commit 7e2050a

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

drivers/net/ethernet/mellanox/mlxsw/core_env.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,24 +1357,20 @@ static struct mlxsw_linecards_event_ops mlxsw_env_event_ops = {
13571357
.got_inactive = mlxsw_env_got_inactive,
13581358
};
13591359

1360-
static int mlxsw_env_max_module_eeprom_len_query(struct mlxsw_env *mlxsw_env)
1360+
static void mlxsw_env_max_module_eeprom_len_query(struct mlxsw_env *mlxsw_env)
13611361
{
13621362
char mcam_pl[MLXSW_REG_MCAM_LEN];
1363-
bool mcia_128b_supported;
1363+
bool mcia_128b_supported = false;
13641364
int err;
13651365

13661366
mlxsw_reg_mcam_pack(mcam_pl,
13671367
MLXSW_REG_MCAM_FEATURE_GROUP_ENHANCED_FEATURES);
13681368
err = mlxsw_reg_query(mlxsw_env->core, MLXSW_REG(mcam), mcam_pl);
1369-
if (err)
1370-
return err;
1371-
1372-
mlxsw_reg_mcam_unpack(mcam_pl, MLXSW_REG_MCAM_MCIA_128B,
1373-
&mcia_128b_supported);
1369+
if (!err)
1370+
mlxsw_reg_mcam_unpack(mcam_pl, MLXSW_REG_MCAM_MCIA_128B,
1371+
&mcia_128b_supported);
13741372

13751373
mlxsw_env->max_eeprom_len = mcia_128b_supported ? 128 : 48;
1376-
1377-
return 0;
13781374
}
13791375

13801376
int mlxsw_env_init(struct mlxsw_core *mlxsw_core,
@@ -1445,15 +1441,11 @@ int mlxsw_env_init(struct mlxsw_core *mlxsw_core,
14451441
if (err)
14461442
goto err_type_set;
14471443

1448-
err = mlxsw_env_max_module_eeprom_len_query(env);
1449-
if (err)
1450-
goto err_eeprom_len_query;
1451-
1444+
mlxsw_env_max_module_eeprom_len_query(env);
14521445
env->line_cards[0]->active = true;
14531446

14541447
return 0;
14551448

1456-
err_eeprom_len_query:
14571449
err_type_set:
14581450
mlxsw_env_module_event_disable(env, 0);
14591451
err_mlxsw_env_module_event_enable:

0 commit comments

Comments
 (0)