mlxsw: hwmon: Provide optimization for QSFP modules number detection
authorVadim Pasternak <vadimp@mellanox.com>
Sun, 6 Oct 2019 06:34:49 +0000 (09:34 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 6 Oct 2019 16:31:39 +0000 (18:31 +0200)
commitea30a92a4674eab955aee7bb8a017791f0e7d002
tree5f183155be214c17f480678b8ccb776268fbd856
parent5cfa030a1c2cf70e2fb0815a74fab1b459bc2a2b
mlxsw: hwmon: Provide optimization for QSFP modules number detection

Use new field "num_of_modules" of MGPIR register for "hwmon" interface
in order to get the number of modules supported by system directly from
the system configuration, instead of getting it from port to module
mapping info.

Reading this info through MGPIR register is faster and does not depend
on possible dynamic re-configuration of ports.
In case of port dynamic re-configuration some modules can logically
"disappear" as a result of port split and un-spilt operations, which
can cause missing of some modules, in case this info is taken from port
to module mapping info.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Acked-by: Jiri Pirko <jiri@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_hwmon.c