Skip to content

Commit 89dd6fc

Browse files
vadimp-nvidiakuba-moo
authored andcommitted
mlxsw: reg: Extend MCIA register with new slot number field
Extend MCIA (Management Cable Info Access Register) with new field specifying the slot number. The purpose of this field is to support access to MCIA register for reading cage cable information on modular system. For non-modular systems the 'module' number uniquely identifies the transceiver location. For modular systems the transceivers are identified by two indexes: - 'slot_index', specifying the slot number, where line card is located; - 'module', specifying cage transceiver within the line card. Signed-off-by: Vadim Pasternak <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c6e6ad7 commit 89dd6fc

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

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

+7-6
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ mlxsw_env_validate_cable_ident(struct mlxsw_core *core, int id, bool *qsfp,
6969
if (err)
7070
return err;
7171

72-
mlxsw_reg_mcia_pack(mcia_pl, id, 0, MLXSW_REG_MCIA_PAGE0_LO_OFF, 0, 1,
73-
MLXSW_REG_MCIA_I2C_ADDR_LOW);
72+
mlxsw_reg_mcia_pack(mcia_pl, 0, id, 0, MLXSW_REG_MCIA_PAGE0_LO_OFF, 0,
73+
1, MLXSW_REG_MCIA_I2C_ADDR_LOW);
7474
err = mlxsw_reg_query(core, MLXSW_REG(mcia), mcia_pl);
7575
if (err)
7676
return err;
@@ -145,7 +145,8 @@ mlxsw_env_query_module_eeprom(struct mlxsw_core *mlxsw_core, int module,
145145
}
146146
}
147147

148-
mlxsw_reg_mcia_pack(mcia_pl, module, 0, page, offset, size, i2c_addr);
148+
mlxsw_reg_mcia_pack(mcia_pl, 0, module, 0, page, offset, size,
149+
i2c_addr);
149150

150151
err = mlxsw_reg_query(mlxsw_core, MLXSW_REG(mcia), mcia_pl);
151152
if (err)
@@ -219,12 +220,12 @@ int mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core, int module,
219220
page = MLXSW_REG_MCIA_TH_PAGE_CMIS_NUM;
220221
else
221222
page = MLXSW_REG_MCIA_TH_PAGE_NUM;
222-
mlxsw_reg_mcia_pack(mcia_pl, module, 0, page,
223+
mlxsw_reg_mcia_pack(mcia_pl, 0, module, 0, page,
223224
MLXSW_REG_MCIA_TH_PAGE_OFF + off,
224225
MLXSW_REG_MCIA_TH_ITEM_SIZE,
225226
MLXSW_REG_MCIA_I2C_ADDR_LOW);
226227
} else {
227-
mlxsw_reg_mcia_pack(mcia_pl, module, 0,
228+
mlxsw_reg_mcia_pack(mcia_pl, 0, module, 0,
228229
MLXSW_REG_MCIA_PAGE0_LO,
229230
off, MLXSW_REG_MCIA_TH_ITEM_SIZE,
230231
MLXSW_REG_MCIA_I2C_ADDR_HIGH);
@@ -419,7 +420,7 @@ mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core, u8 module,
419420
size = min_t(u8, page->length - bytes_read,
420421
MLXSW_REG_MCIA_EEPROM_SIZE);
421422

422-
mlxsw_reg_mcia_pack(mcia_pl, module, 0, page->page,
423+
mlxsw_reg_mcia_pack(mcia_pl, 0, module, 0, page->page,
423424
device_addr + bytes_read, size,
424425
page->i2c_address);
425426
mlxsw_reg_mcia_bank_number_set(mcia_pl, page->bank);

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

+11-3
Original file line numberDiff line numberDiff line change
@@ -9978,6 +9978,12 @@ MLXSW_ITEM32(reg, mcia, l, 0x00, 31, 1);
99789978
*/
99799979
MLXSW_ITEM32(reg, mcia, module, 0x00, 16, 8);
99809980

9981+
/* reg_mcia_slot_index
9982+
* Slot index (0: Main board)
9983+
* Access: Index
9984+
*/
9985+
MLXSW_ITEM32(reg, mcia, slot, 0x00, 12, 4);
9986+
99819987
enum {
99829988
MLXSW_REG_MCIA_STATUS_GOOD = 0,
99839989
/* No response from module's EEPROM. */
@@ -10077,11 +10083,13 @@ MLXSW_ITEM_BUF(reg, mcia, eeprom, 0x10, MLXSW_REG_MCIA_EEPROM_SIZE);
1007710083
MLXSW_REG_MCIA_EEPROM_PAGE_LENGTH) / \
1007810084
MLXSW_REG_MCIA_EEPROM_UP_PAGE_LENGTH + 1)
1007910085

10080-
static inline void mlxsw_reg_mcia_pack(char *payload, u8 module, u8 lock,
10081-
u8 page_number, u16 device_addr,
10082-
u8 size, u8 i2c_device_addr)
10086+
static inline void mlxsw_reg_mcia_pack(char *payload, u8 slot_index, u8 module,
10087+
u8 lock, u8 page_number,
10088+
u16 device_addr, u8 size,
10089+
u8 i2c_device_addr)
1008310090
{
1008410091
MLXSW_REG_ZERO(mcia, payload);
10092+
mlxsw_reg_mcia_slot_set(payload, slot_index);
1008510093
mlxsw_reg_mcia_module_set(payload, module);
1008610094
mlxsw_reg_mcia_l_set(payload, lock);
1008710095
mlxsw_reg_mcia_page_number_set(payload, page_number);

0 commit comments

Comments
 (0)