mlxsw: core: Prevent duplication during QSFP module initialization
authorVadim Pasternak <vadimp@mellanox.com>
Tue, 12 Mar 2019 08:40:41 +0000 (08:40 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 12 Mar 2019 21:55:16 +0000 (14:55 -0700)
commit6bab45b4de0d70f56ac163fd0b105c0c76451515
tree0bf310e1a2a44858b4ebbaf5210c2aae0b232633
parent4ec850e5dfec092b26cf3b7d5a6c9e444ea4babd
mlxsw: core: Prevent duplication during QSFP module initialization

Verify during thermal initialization if QSFP module's entry is already
configured in order to prevent duplication.
Such scenario could happen in case two switch drivers (PCI and I2C
based) coexist and if after boot, splitting configuration is applied
for some ports and then I2C based driver is re-probed.
In such case after reboot same QSFP module, associated with split will
be discovered by I2C based driver few times, and it will cause a crash.

It could happen for example on system equipped with BMC (Baseboard
Management Controller), running I2C based driver, when the next steps
are performed:
- System boot
- Host side configures port spilt.
- BMC side is rebooted.

Fixes: 6a79507cfe94 ("mlxsw: core: Extend thermal module with per QSFP module thermal zones")
Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c