Skip to content

Commit a9176f7

Browse files
committed
Merge branch 'mlxsw-fixes'
Petr Machata says: ==================== mlxsw: Fixes This patchset fixes the following issues: - During driver de-initialization the driver unregisters the EMAD response trap by setting its action to DISCARD. However the manual only permits TRAP and FORWARD, and future firmware versions will enforce this. In patch #1, suppress the error message by aligning the driver to the manual and use a FORWARD (NOP) action when unregistering the trap. - The driver queries the Management Capabilities Mask (MCAM) register during initialization to understand if certain features are supported. However, not all firmware versions support this register, leading to the driver failing to load. Patches #2 and #3 fix this issue by treating an error in the register query as an indication that the feature is not supported. v2: - Patch #2: - Make mlxsw_env_max_module_eeprom_len_query() void ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 9f898fc + 773501d commit a9176f7

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ static void mlxsw_emad_rx_listener_func(struct sk_buff *skb, u16 local_port,
849849

850850
static const struct mlxsw_listener mlxsw_emad_rx_listener =
851851
MLXSW_RXL(mlxsw_emad_rx_listener_func, ETHEMAD, TRAP_TO_CPU, false,
852-
EMAD, DISCARD);
852+
EMAD, FORWARD);
853853

854854
static int mlxsw_emad_tlv_enable(struct mlxsw_core *mlxsw_core)
855855
{

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:

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,7 @@ mlxsw_pci_reset(struct mlxsw_pci *mlxsw_pci, const struct pci_device_id *id)
15301530
{
15311531
struct pci_dev *pdev = mlxsw_pci->pdev;
15321532
char mcam_pl[MLXSW_REG_MCAM_LEN];
1533-
bool pci_reset_supported;
1533+
bool pci_reset_supported = false;
15341534
u32 sys_status;
15351535
int err;
15361536

@@ -1548,11 +1548,9 @@ mlxsw_pci_reset(struct mlxsw_pci *mlxsw_pci, const struct pci_device_id *id)
15481548
mlxsw_reg_mcam_pack(mcam_pl,
15491549
MLXSW_REG_MCAM_FEATURE_GROUP_ENHANCED_FEATURES);
15501550
err = mlxsw_reg_query(mlxsw_pci->core, MLXSW_REG(mcam), mcam_pl);
1551-
if (err)
1552-
return err;
1553-
1554-
mlxsw_reg_mcam_unpack(mcam_pl, MLXSW_REG_MCAM_PCI_RESET,
1555-
&pci_reset_supported);
1551+
if (!err)
1552+
mlxsw_reg_mcam_unpack(mcam_pl, MLXSW_REG_MCAM_PCI_RESET,
1553+
&pci_reset_supported);
15561554

15571555
if (pci_reset_supported) {
15581556
pci_dbg(pdev, "Starting PCI reset flow\n");

0 commit comments

Comments
 (0)