Skip to content
/ linux Public

Commit c6e6ad7

Browse files
vadimp-nvidiakuba-moo
authored andcommitted
mlxsw: reg: Extend MTBR register with new slot number field
Extend MTBR (Management Temperature Bulk Register) with new field specifying the slot number. The purpose of this field is to support access to MTBR register for reading temperature sensors on modular system. For non-modular systems the 'sensor_index' uniquely identifies the cage sensors. For modular systems the sensors are identified by two indexes: - 'slot_index', specifying the slot number, where line card is located; - 'sensor_index', specifying cage sensor within the line card. Signed-off-by: Vadim Pasternak <vadimp@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Ido Schimmel <idosch@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent d30bed2 commit c6e6ad7

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,8 @@ static int mlxsw_env_module_has_temp_sensor(struct mlxsw_core *mlxsw_core,
660660
u16 temp;
661661
int err;
662662

663-
mlxsw_reg_mtbr_pack(mtbr_pl, MLXSW_REG_MTBR_BASE_MODULE_INDEX + module,
664-
1);
663+
mlxsw_reg_mtbr_pack(mtbr_pl, 0,
664+
MLXSW_REG_MTBR_BASE_MODULE_INDEX + module, 1);
665665
err = mlxsw_reg_query(mlxsw_core, MLXSW_REG(mtbr), mtbr_pl);
666666
if (err)
667667
return err;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ static ssize_t mlxsw_hwmon_module_temp_fault_show(struct device *dev,
271271
int err;
272272

273273
module = mlxsw_hwmon_attr->type_index - mlxsw_hwmon->sensor_count;
274-
mlxsw_reg_mtbr_pack(mtbr_pl, MLXSW_REG_MTBR_BASE_MODULE_INDEX + module,
275-
1);
274+
mlxsw_reg_mtbr_pack(mtbr_pl, 0,
275+
MLXSW_REG_MTBR_BASE_MODULE_INDEX + module, 1);
276276
err = mlxsw_reg_query(mlxsw_hwmon->core, MLXSW_REG(mtbr), mtbr_pl);
277277
if (err) {
278278
dev_err(dev, "Failed to query module temperature sensor\n");

drivers/net/ethernet/mellanox/mlxsw/reg.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9887,6 +9887,12 @@ MLXSW_ITEM_BIT_ARRAY(reg, mtwe, sensor_warning, 0x0, 0x10, 1);
98879887

98889888
MLXSW_REG_DEFINE(mtbr, MLXSW_REG_MTBR_ID, MLXSW_REG_MTBR_LEN);
98899889

9890+
/* reg_mtbr_slot_index
9891+
* Slot index (0: Main board).
9892+
* Access: Index
9893+
*/
9894+
MLXSW_ITEM32(reg, mtbr, slot_index, 0x00, 16, 4);
9895+
98909896
/* reg_mtbr_base_sensor_index
98919897
* Base sensors index to access (0 - ASIC sensor, 1-63 - ambient sensors,
98929898
* 64-127 are mapped to the SFP+/QSFP modules sequentially).
@@ -9919,10 +9925,11 @@ MLXSW_ITEM32_INDEXED(reg, mtbr, rec_max_temp, MLXSW_REG_MTBR_BASE_LEN, 16,
99199925
MLXSW_ITEM32_INDEXED(reg, mtbr, rec_temp, MLXSW_REG_MTBR_BASE_LEN, 0, 16,
99209926
MLXSW_REG_MTBR_REC_LEN, 0x00, false);
99219927

9922-
static inline void mlxsw_reg_mtbr_pack(char *payload, u16 base_sensor_index,
9923-
u8 num_rec)
9928+
static inline void mlxsw_reg_mtbr_pack(char *payload, u8 slot_index,
9929+
u16 base_sensor_index, u8 num_rec)
99249930
{
99259931
MLXSW_REG_ZERO(mtbr, payload);
9932+
mlxsw_reg_mtbr_slot_index_set(payload, slot_index);
99269933
mlxsw_reg_mtbr_base_sensor_index_set(payload, base_sensor_index);
99279934
mlxsw_reg_mtbr_num_rec_set(payload, num_rec);
99289935
}

0 commit comments

Comments
 (0)