mlxsw: Extend device registers for line cards support
Subsystems (3)
Ido Schimmel
maintainercover mlxsw: Extend device registers for line cards support
This patch set prepares mlxsw for line cards support by extending device registers with a slot index, which allows accessing components found on a line card at a given slot. Currently, only slot index 0 (main board) is used.
No user visible changes that I am aware of.
The next patchsets will:
1. Extend internal mlxsw interfaces and data structures for line cards support
2. Add line cards support in devlink and mlxsw_spectrum
3. Add hwmon/thermal support for components found on line cards
4. Extend devlink to expose line card info (e.g., HW revision) and devices found on line cards (e.g., gearboxes)
5. Extend devlink with the ability to flash devices found on line cards
6. Add line cards support in mlxsw_minimal
Vadim Pasternak (8):
mlxsw: reg: Extend MTMP register with new slot number field
mlxsw: reg: Extend MTBR register with new slot number field
mlxsw: reg: Extend MCIA register with new slot number field
mlxsw: reg: Extend MCION register with new slot number field
mlxsw: reg: Extend PMMP register with new slot number field
mlxsw: reg: Extend MGPIR register with new slot fields
mlxsw: core_env: Pass slot index during PMAOS register write call
mlxsw: reg: Add new field to Management General Peripheral Information
Register
.../net/ethernet/mellanox/mlxsw/core_env.c | 33 ++++---- .../net/ethernet/mellanox/mlxsw/core_hwmon.c | 24 +++--- .../ethernet/mellanox/mlxsw/core_thermal.c | 14 ++-- drivers/net/ethernet/mellanox/mlxsw/reg.h | 83 ++++++++++++++++--- 4 files changed, 108 insertions(+), 46 deletions(-)
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 1/8 mlxsw: reg: Extend MTMP register with new slot number field
From: Vadim Pasternak <[email protected]>
Extend MTMP (Management Temperature Register) with new field specifying the slot index. The purpose of this field is to support access to MTMP register for reading temperature sensors on modular systems. For non-modular systems the 'sensor_index' uniquely identifies the cage sensors, while 'slot_index' is always 0. For modular systems the sensors are identified by:
- 'slot_index', specifying the slot index, where line card is located;
- 'sensor_index', specifying cage sensor within the line card.
--- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 11 ++++++----- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 6 +++--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 11 +++++++++-- 4 files changed, 19 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +1 -1
@@ -177,7 +177,7 @@ int mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core, int module,int page;int err; -mlxsw_reg_mtmp_pack (mtmp_pl,MLXSW_REG_MTMP_MODULE_INDEX_MIN + module, +mlxsw_reg_mtmp_pack (mtmp_pl,0 ,MLXSW_REG_MTMP_MODULE_INDEX_MIN + module, false, false); err =mlxsw_reg_query (core,MLXSW_REG (mtmp), mtmp_pl);if (err)
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c +6 -5
@@ -66,7 +66,7 @@ static ssize_t mlxsw_hwmon_temp_show(struct device *dev, index =mlxsw_hwmon_get_attr_index (mlxsw_hwmon_attr->type_index, mlxsw_hwmon->module_sensor_max); -mlxsw_reg_mtmp_pack (mtmp_pl, index, false, false); +mlxsw_reg_mtmp_pack (mtmp_pl,0 , index, false, false); err =mlxsw_reg_query (mlxsw_hwmon->core,MLXSW_REG (mtmp), mtmp_pl);if (err) {dev_err (mlxsw_hwmon->bus_info->dev,"Failed to query temp sensor\n" );
@@ -89,7 +89,7 @@ static ssize_t mlxsw_hwmon_temp_max_show(struct device *dev, index =mlxsw_hwmon_get_attr_index (mlxsw_hwmon_attr->type_index, mlxsw_hwmon->module_sensor_max); -mlxsw_reg_mtmp_pack (mtmp_pl, index, false, false); +mlxsw_reg_mtmp_pack (mtmp_pl,0 , index, false, false); err =mlxsw_reg_query (mlxsw_hwmon->core,MLXSW_REG (mtmp), mtmp_pl);if (err) {dev_err (mlxsw_hwmon->bus_info->dev,"Failed to query temp sensor\n" );
@@ -232,8 +232,9 @@ static int mlxsw_hwmon_module_temp_get(struct device *dev,int err; module = mlxsw_hwmon_attr->type_index - mlxsw_hwmon->sensor_count; -mlxsw_reg_mtmp_pack (mtmp_pl,MLXSW_REG_MTMP_MODULE_INDEX_MIN + module, - false, false); +mlxsw_reg_mtmp_pack (mtmp_pl,0 , +MLXSW_REG_MTMP_MODULE_INDEX_MIN + module, false, + false); err =mlxsw_reg_query (mlxsw_hwmon->core,MLXSW_REG (mtmp), mtmp_pl);if (err) {dev_err (dev,"Failed to query module temperature\n" );
@@ -721,7 +722,7 @@ static int mlxsw_hwmon_gearbox_init(struct mlxsw_hwmon *mlxsw_hwmon)while (index < max_index) { sensor_index = index % mlxsw_hwmon->module_sensor_max +MLXSW_REG_MTMP_GBOX_INDEX_MIN ; -mlxsw_reg_mtmp_pack (mtmp_pl, sensor_index, true, true); +mlxsw_reg_mtmp_pack (mtmp_pl,0 , sensor_index, true, true); err =mlxsw_reg_write (mlxsw_hwmon->core,MLXSW_REG (mtmp), mtmp_pl);if (err) {
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +3 -3
@@ -271,7 +271,7 @@ static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev,int temp;int err; -mlxsw_reg_mtmp_pack (mtmp_pl,0 , false, false); +mlxsw_reg_mtmp_pack (mtmp_pl,0 ,0 , false, false); err =mlxsw_reg_query (thermal->core,MLXSW_REG (mtmp), mtmp_pl);if (err) {
@@ -431,7 +431,7 @@ mlxsw_thermal_module_temp_and_thresholds_get(struct mlxsw_core *core,int err;/* Read module temperature and thresholds. */ -mlxsw_reg_mtmp_pack (mtmp_pl, sensor_index, false, false); +mlxsw_reg_mtmp_pack (mtmp_pl,0 , sensor_index, false, false); err =mlxsw_reg_query (core,MLXSW_REG (mtmp), mtmp_pl);if (err) {/* Set temperature and thresholds to zero to avoid passing
@@ -576,7 +576,7 @@ static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,int err; index =MLXSW_REG_MTMP_GBOX_INDEX_MIN + tz->module; -mlxsw_reg_mtmp_pack (mtmp_pl, index, false, false); +mlxsw_reg_mtmp_pack (mtmp_pl,0 , index, false, false); err =mlxsw_reg_query (thermal->core,MLXSW_REG (mtmp), mtmp_pl);if (err)
drivers/net/ethernet/mellanox/mlxsw/reg.h +9 -2
@@ -9721,6 +9721,12 @@ MLXSW_ITEM32(reg, mtcap, sensor_count, 0x00, 0, 7);MLXSW_REG_DEFINE (mtmp,MLXSW_REG_MTMP_ID ,MLXSW_REG_MTMP_LEN ); +/* reg_mtmp_slot_index +* Slot index (0: Main board). +* Access: Index +*/ +MLXSW_ITEM32 (reg, mtmp, slot_index,0x00 ,16 ,4 ); +#define MLXSW_REG_MTMP_MODULE_INDEX_MIN 64#define MLXSW_REG_MTMP_GBOX_INDEX_MIN 256/* reg_mtmp_sensor_index
@@ -9810,11 +9816,12 @@ MLXSW_ITEM32(reg, mtmp, temperature_threshold_lo, 0x10, 0, 16);*/ MLXSW_ITEM_BUF (reg, mtmp, sensor_name,0x18 ,MLXSW_REG_MTMP_SENSOR_NAME_SIZE ); -static inline void mlxsw_reg_mtmp_pack (char *payload,u16 sensor_index, -bool max_temp_enable, +static inline void mlxsw_reg_mtmp_pack (char *payload,u8 slot_index, +u16 sensor_index,bool max_temp_enable,bool max_temp_reset) {MLXSW_REG_ZERO (mtmp, payload); +mlxsw_reg_mtmp_slot_index_set (payload, slot_index);mlxsw_reg_mtmp_sensor_index_set (payload, sensor_index);mlxsw_reg_mtmp_mte_set (payload, max_temp_enable);mlxsw_reg_mtmp_mtr_set (payload, max_temp_reset);
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 2/8 mlxsw: reg: Extend MTBR register with new slot number field
In reply to Ido SchimmelFrom: Vadim Pasternak <[email protected]>
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.
--- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 4 ++-- drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 4 ++-- drivers/net/ethernet/mellanox/mlxsw/reg.h | 11 +++++++++-- 3 files changed, 13 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +2 -2
@@ -660,8 +660,8 @@ static int mlxsw_env_module_has_temp_sensor(struct mlxsw_core *mlxsw_core,u16 temp;int err; -mlxsw_reg_mtbr_pack (mtbr_pl,MLXSW_REG_MTBR_BASE_MODULE_INDEX + module, -1 ); +mlxsw_reg_mtbr_pack (mtbr_pl,0 , +MLXSW_REG_MTBR_BASE_MODULE_INDEX + module,1 ); err =mlxsw_reg_query (mlxsw_core,MLXSW_REG (mtbr), mtbr_pl);if (err)return err;
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c +2 -2
@@ -271,8 +271,8 @@ static ssize_t mlxsw_hwmon_module_temp_fault_show(struct device *dev,int err; module = mlxsw_hwmon_attr->type_index - mlxsw_hwmon->sensor_count; -mlxsw_reg_mtbr_pack (mtbr_pl,MLXSW_REG_MTBR_BASE_MODULE_INDEX + module, -1 ); +mlxsw_reg_mtbr_pack (mtbr_pl,0 , +MLXSW_REG_MTBR_BASE_MODULE_INDEX + module,1 ); err =mlxsw_reg_query (mlxsw_hwmon->core,MLXSW_REG (mtbr), mtbr_pl);if (err) {dev_err (dev,"Failed to query module temperature sensor\n" );
drivers/net/ethernet/mellanox/mlxsw/reg.h +9 -2
@@ -9887,6 +9887,12 @@ MLXSW_ITEM_BIT_ARRAY(reg, mtwe, sensor_warning, 0x0, 0x10, 1);MLXSW_REG_DEFINE (mtbr,MLXSW_REG_MTBR_ID ,MLXSW_REG_MTBR_LEN ); +/* reg_mtbr_slot_index +* Slot index (0: Main board). +* Access: Index +*/ +MLXSW_ITEM32 (reg, mtbr, slot_index,0x00 ,16 ,4 ); +/* reg_mtbr_base_sensor_index * Base sensors index to access (0 - ASIC sensor, 1-63 - ambient sensors, * 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,MLXSW_ITEM32_INDEXED (reg, mtbr, rec_temp,MLXSW_REG_MTBR_BASE_LEN ,0 ,16 ,MLXSW_REG_MTBR_REC_LEN ,0x00 , false); -static inline void mlxsw_reg_mtbr_pack (char *payload,u16 base_sensor_index, -u8 num_rec) +static inline void mlxsw_reg_mtbr_pack (char *payload,u8 slot_index, +u16 base_sensor_index,u8 num_rec) {MLXSW_REG_ZERO (mtbr, payload); +mlxsw_reg_mtbr_slot_index_set (payload, slot_index);mlxsw_reg_mtbr_base_sensor_index_set (payload, base_sensor_index);mlxsw_reg_mtbr_num_rec_set (payload, num_rec); }
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 3/8 mlxsw: reg: Extend MCIA register with new slot number field
In reply to Ido SchimmelFrom: Vadim Pasternak <[email protected]>
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.
--- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 13 +++++++------ drivers/net/ethernet/mellanox/mlxsw/reg.h | 14 +++++++++++--- 2 files changed, 18 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +7 -6
@@ -69,8 +69,8 @@ mlxsw_env_validate_cable_ident(struct mlxsw_core *core, int id, bool *qsfp,if (err)return err; -mlxsw_reg_mcia_pack (mcia_pl, id,0 ,MLXSW_REG_MCIA_PAGE0_LO_OFF ,0 ,1 , -MLXSW_REG_MCIA_I2C_ADDR_LOW ); +mlxsw_reg_mcia_pack (mcia_pl,0 , id,0 ,MLXSW_REG_MCIA_PAGE0_LO_OFF ,0 , +1 ,MLXSW_REG_MCIA_I2C_ADDR_LOW ); err =mlxsw_reg_query (core,MLXSW_REG (mcia), mcia_pl);if (err)return err;
@@ -145,7 +145,8 @@ mlxsw_env_query_module_eeprom(struct mlxsw_core *mlxsw_core, int module, } } -mlxsw_reg_mcia_pack (mcia_pl, module,0 , page, offset, size, i2c_addr); +mlxsw_reg_mcia_pack (mcia_pl,0 , module,0 , page, offset, size, + i2c_addr); err =mlxsw_reg_query (mlxsw_core,MLXSW_REG (mcia), mcia_pl);if (err)
@@ -219,12 +220,12 @@ int mlxsw_env_module_temp_thresholds_get(struct mlxsw_core *core, int module, page =MLXSW_REG_MCIA_TH_PAGE_CMIS_NUM ; else page =MLXSW_REG_MCIA_TH_PAGE_NUM ; -mlxsw_reg_mcia_pack (mcia_pl, module,0 , page, +mlxsw_reg_mcia_pack (mcia_pl,0 , module,0 , page,MLXSW_REG_MCIA_TH_PAGE_OFF + off,MLXSW_REG_MCIA_TH_ITEM_SIZE ,MLXSW_REG_MCIA_I2C_ADDR_LOW ); }else { -mlxsw_reg_mcia_pack (mcia_pl, module,0 , +mlxsw_reg_mcia_pack (mcia_pl,0 , module,0 ,MLXSW_REG_MCIA_PAGE0_LO , off,MLXSW_REG_MCIA_TH_ITEM_SIZE ,MLXSW_REG_MCIA_I2C_ADDR_HIGH );
@@ -419,7 +420,7 @@ mlxsw_env_get_module_eeprom_by_page(struct mlxsw_core *mlxsw_core, u8 module, size =min_t (u8, page->length - bytes_read,MLXSW_REG_MCIA_EEPROM_SIZE ); -mlxsw_reg_mcia_pack (mcia_pl, module,0 , page->page, +mlxsw_reg_mcia_pack (mcia_pl,0 , module,0 , page->page, device_addr + bytes_read, size, page->i2c_address);mlxsw_reg_mcia_bank_number_set (mcia_pl, page->bank);
drivers/net/ethernet/mellanox/mlxsw/reg.h +11 -3
@@ -9978,6 +9978,12 @@ MLXSW_ITEM32(reg, mcia, l, 0x00, 31, 1);*/ MLXSW_ITEM32 (reg, mcia, module,0x00 ,16 ,8 ); +/* reg_mcia_slot_index +* Slot index (0: Main board) +* Access: Index +*/ +MLXSW_ITEM32 (reg, mcia, slot,0x00 ,12 ,4 ); +enum {MLXSW_REG_MCIA_STATUS_GOOD =0 ,/* No response from module's EEPROM. */
@@ -10077,11 +10083,13 @@ MLXSW_ITEM_BUF(reg, mcia, eeprom, 0x10, MLXSW_REG_MCIA_EEPROM_SIZE); MLXSW_REG_MCIA_EEPROM_PAGE_LENGTH) / \ MLXSW_REG_MCIA_EEPROM_UP_PAGE_LENGTH + 1) -static inline void mlxsw_reg_mcia_pack (char *payload,u8 module,u8 lock, -u8 page_number,u16 device_addr, -u8 size,u8 i2c_device_addr) +static inline void mlxsw_reg_mcia_pack (char *payload,u8 slot_index,u8 module, +u8 lock,u8 page_number, +u16 device_addr,u8 size, +u8 i2c_device_addr) {MLXSW_REG_ZERO (mcia, payload); +mlxsw_reg_mcia_slot_set (payload, slot_index);mlxsw_reg_mcia_module_set (payload, module);mlxsw_reg_mcia_l_set (payload, lock);mlxsw_reg_mcia_page_number_set (payload, page_number);
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 4/8 mlxsw: reg: Extend MCION register with new slot number field
In reply to Ido SchimmelFrom: Vadim Pasternak <[email protected]>
Extend MCION (Management Cable IO and Notifications Register) with new field specifying the slot number. The purpose of this field is to support access to MCION register for query cage transceiver 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.
--- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/reg.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +1 -1
@@ -520,7 +520,7 @@ mlxsw_env_get_module_power_mode(struct mlxsw_core *mlxsw_core, u8 module, params->policy = mlxsw_env->module_info[module].power_mode_policy; -mlxsw_reg_mcion_pack (mcion_pl, module); +mlxsw_reg_mcion_pack (mcion_pl,0 , module); err =mlxsw_reg_query (mlxsw_core,MLXSW_REG (mcion), mcion_pl);if (err) {NL_SET_ERR_MSG_MOD (extack,"Failed to retrieve module's power mode" );
drivers/net/ethernet/mellanox/mlxsw/reg.h +8 -1
@@ -10521,6 +10521,12 @@ MLXSW_REG_DEFINE(mcion, MLXSW_REG_MCION_ID, MLXSW_REG_MCION_LEN);*/ MLXSW_ITEM32 (reg, mcion, module,0x00 ,16 ,8 ); +/* reg_mcion_slot_index +* Slot index. +* Access: Index +*/ +MLXSW_ITEM32 (reg, mcion, slot_index,0x00 ,12 ,4 ); +enum {MLXSW_REG_MCION_MODULE_STATUS_BITS_PRESENT_MASK =BIT (0 ),MLXSW_REG_MCION_MODULE_STATUS_BITS_LOW_POWER_MASK =BIT (8 ),
@@ -10532,9 +10538,10 @@ enum {*/ MLXSW_ITEM32 (reg, mcion, module_status_bits,0x04 ,0 ,16 ); -static inline void mlxsw_reg_mcion_pack (char *payload,u8 module) +static inline void mlxsw_reg_mcion_pack (char *payload,u8 slot_index,u8 module) {MLXSW_REG_ZERO (mcion, payload); +mlxsw_reg_mcion_slot_index_set (payload, slot_index);mlxsw_reg_mcion_module_set (payload, module); }
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 5/8 mlxsw: reg: Extend PMMP register with new slot number field
In reply to Ido SchimmelFrom: Vadim Pasternak <[email protected]>
Extend PMMP (Port Module Memory Map Properties Register) with new field specifying the slot number. The purpose of this field is to enable overriding the cable/module memory map advertisement.
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.
--- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/reg.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +1 -1
@@ -563,7 +563,7 @@ static int mlxsw_env_module_low_power_set(struct mlxsw_core *mlxsw_core,u16 eeprom_override_mask, eeprom_override;char pmmp_pl[MLXSW_REG_PMMP_LEN ]; -mlxsw_reg_pmmp_pack (pmmp_pl, module); +mlxsw_reg_pmmp_pack (pmmp_pl,0 , module);mlxsw_reg_pmmp_sticky_set (pmmp_pl, true);/* Mask all the bits except low power mode. */ eeprom_override_mask = ~MLXSW_REG_PMMP_EEPROM_OVERRIDE_LOW_POWER_MASK ;
drivers/net/ethernet/mellanox/mlxsw/reg.h +8 -1
@@ -5984,6 +5984,12 @@ MLXSW_REG_DEFINE(pmmp, MLXSW_REG_PMMP_ID, MLXSW_REG_PMMP_LEN);*/ MLXSW_ITEM32 (reg, pmmp, module,0x00 ,16 ,8 ); +/* reg_pmmp_slot_index +* Slot index. +* Access: Index +*/ +MLXSW_ITEM32 (reg, pmmp, slot_index,0x00 ,24 ,4 ); +/* reg_pmmp_sticky * When set, will keep eeprom_override values after plug-out event. * Access: OP
@@ -6011,9 +6017,10 @@ enum {*/ MLXSW_ITEM32 (reg, pmmp, eeprom_override,0x04 ,0 ,16 ); -static inline void mlxsw_reg_pmmp_pack (char *payload,u8 module) +static inline void mlxsw_reg_pmmp_pack (char *payload,u8 slot_index,u8 module) {MLXSW_REG_ZERO (pmmp, payload); +mlxsw_reg_pmmp_slot_index_set (payload, slot_index);mlxsw_reg_pmmp_module_set (payload, module); }
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 6/8 mlxsw: reg: Extend MGPIR register with new slot fields
In reply to Ido SchimmelFrom: Vadim Pasternak <[email protected]>
Extend MGPIR (Management General Peripheral Information Register) with new fields specifying the slot number and number of the slots available on system. The purpose of these fields is:
- to support access to MPGIR register on modular system for getting the number of cages, equipped on the line card, inserted at specified slot. In case slot number is set zero, MGPIR will provide the information for the main board. For Top of the Rack (non-modular) system it will provide the same as before.
- to provide the number of slots supported by system. This data is relevant only in case slot number is set zero.
--- .../net/ethernet/mellanox/mlxsw/core_env.c | 4 ++-- .../net/ethernet/mellanox/mlxsw/core_hwmon.c | 9 +++++---- .../ethernet/mellanox/mlxsw/core_thermal.c | 8 ++++---- drivers/net/ethernet/mellanox/mlxsw/reg.h | 20 +++++++++++++++++-- 4 files changed, 29 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +2 -2
@@ -1060,12 +1060,12 @@ int mlxsw_env_init(struct mlxsw_core *mlxsw_core, struct mlxsw_env **p_env)u8 module_count;int i, err; -mlxsw_reg_mgpir_pack (mgpir_pl); +mlxsw_reg_mgpir_pack (mgpir_pl,0 ); err =mlxsw_reg_query (mlxsw_core,MLXSW_REG (mgpir), mgpir_pl);if (err)return err; -mlxsw_reg_mgpir_unpack (mgpir_pl,NULL ,NULL ,NULL , &module_count); +mlxsw_reg_mgpir_unpack (mgpir_pl,NULL ,NULL ,NULL , &module_count,NULL ); env =kzalloc (struct_size (env, module_info, module_count),GFP_KERNEL );if (!env)
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c +5 -4
@@ -656,13 +656,13 @@ static int mlxsw_hwmon_module_init(struct mlxsw_hwmon *mlxsw_hwmon)u8 module_sensor_max;int i, err; -mlxsw_reg_mgpir_pack (mgpir_pl); +mlxsw_reg_mgpir_pack (mgpir_pl,0 ); err =mlxsw_reg_query (mlxsw_hwmon->core,MLXSW_REG (mgpir), mgpir_pl);if (err)return err;mlxsw_reg_mgpir_unpack (mgpir_pl,NULL ,NULL ,NULL , - &module_sensor_max); + &module_sensor_max,NULL );/* Add extra attributes for module temperature. Sensor index is * assigned to sensor_count value, while all indexed before
@@ -707,12 +707,13 @@ static int mlxsw_hwmon_gearbox_init(struct mlxsw_hwmon *mlxsw_hwmon)u8 gbox_num;int err; -mlxsw_reg_mgpir_pack (mgpir_pl); +mlxsw_reg_mgpir_pack (mgpir_pl,0 ); err =mlxsw_reg_query (mlxsw_hwmon->core,MLXSW_REG (mgpir), mgpir_pl);if (err)return err; -mlxsw_reg_mgpir_unpack (mgpir_pl, &gbox_num, &device_type,NULL ,NULL ); +mlxsw_reg_mgpir_unpack (mgpir_pl, &gbox_num, &device_type,NULL ,NULL , +NULL );if (device_type !=MLXSW_REG_MGPIR_DEVICE_TYPE_GEARBOX_DIE || !gbox_num)return 0 ;
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +4 -4
@@ -746,13 +746,13 @@ mlxsw_thermal_modules_init(struct device *dev, struct mlxsw_core *core,char mgpir_pl[MLXSW_REG_MGPIR_LEN ];int i, err; -mlxsw_reg_mgpir_pack (mgpir_pl); +mlxsw_reg_mgpir_pack (mgpir_pl,0 ); err =mlxsw_reg_query (core,MLXSW_REG (mgpir), mgpir_pl);if (err)return err;mlxsw_reg_mgpir_unpack (mgpir_pl,NULL ,NULL ,NULL , - &thermal->tz_module_num); + &thermal->tz_module_num,NULL ); thermal->tz_module_arr = kcalloc(thermal->tz_module_num, sizeof(*thermal->tz_module_arr),
@@ -837,13 +837,13 @@ mlxsw_thermal_gearboxes_init(struct device *dev, struct mlxsw_core *core,int i;int err; -mlxsw_reg_mgpir_pack (mgpir_pl); +mlxsw_reg_mgpir_pack (mgpir_pl,0 ); err =mlxsw_reg_query (core,MLXSW_REG (mgpir), mgpir_pl);if (err)return err;mlxsw_reg_mgpir_unpack (mgpir_pl, &gbox_num, &device_type,NULL , -NULL ); +NULL ,NULL );if (device_type !=MLXSW_REG_MGPIR_DEVICE_TYPE_GEARBOX_DIE || !gbox_num)return 0 ;
drivers/net/ethernet/mellanox/mlxsw/reg.h +18 -2
@@ -11362,6 +11362,12 @@ enum mlxsw_reg_mgpir_device_type { MLXSW_REG_MGPIR_DEVICE_TYPE_GEARBOX_DIE, }; +/* mgpir_slot_index +* Slot index (0: Main board). +* Access: Index +*/ +MLXSW_ITEM32 (reg, mgpir, slot_index,0x00 ,28 ,4 ); +/* mgpir_device_type * Access: RO */
@@ -11379,21 +11385,29 @@ MLXSW_ITEM32(reg, mgpir, devices_per_flash, 0x00, 16, 8);*/ MLXSW_ITEM32 (reg, mgpir, num_of_devices,0x00 ,0 ,8 ); +/* mgpir_num_of_slots +* Number of slots in the system. +* Access: RO +*/ +MLXSW_ITEM32 (reg, mgpir, num_of_slots,0x04 ,8 ,8 ); +/* mgpir_num_of_modules * Number of modules. * Access: RO */ MLXSW_ITEM32 (reg, mgpir, num_of_modules,0x04 ,0 ,8 ); -static inline void mlxsw_reg_mgpir_pack (char *payload) +static inline void mlxsw_reg_mgpir_pack (char *payload,u8 slot_index) {MLXSW_REG_ZERO (mgpir, payload); +mlxsw_reg_mgpir_slot_index_set (payload, slot_index); }static inline void mlxsw_reg_mgpir_unpack (char *payload,u8 *num_of_devices,enum mlxsw_reg_mgpir_device_type *device_type, -u8 *devices_per_flash,u8 *num_of_modules) +u8 *devices_per_flash,u8 *num_of_modules, +u8 *num_of_slots) {if (num_of_devices) *num_of_devices =mlxsw_reg_mgpir_num_of_devices_get (payload);
@@ -11404,6 +11418,8 @@ mlxsw_reg_mgpir_unpack(char *payload, u8 *num_of_devices,mlxsw_reg_mgpir_devices_per_flash_get (payload);if (num_of_modules) *num_of_modules =mlxsw_reg_mgpir_num_of_modules_get (payload); +if (num_of_slots) + *num_of_slots =mlxsw_reg_mgpir_num_of_slots_get (payload); }/* MFDE - Monitoring FW Debug Register
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 7/8 mlxsw: core_env: Pass slot index during PMAOS register write call
In reply to Ido SchimmelFrom: Vadim Pasternak <[email protected]>
Pass the slot index down to PMAOS pack helper alongside with the module.
--- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 6 +++--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +3 -3
@@ -448,7 +448,7 @@ static int mlxsw_env_module_reset(struct mlxsw_core *mlxsw_core, u8 module) {char pmaos_pl[MLXSW_REG_PMAOS_LEN ]; -mlxsw_reg_pmaos_pack (pmaos_pl, module); +mlxsw_reg_pmaos_pack (pmaos_pl,0 , module);mlxsw_reg_pmaos_rst_set (pmaos_pl, true);return mlxsw_reg_write (mlxsw_core,MLXSW_REG (pmaos), pmaos_pl);
@@ -548,7 +548,7 @@ static int mlxsw_env_module_enable_set(struct mlxsw_core *mlxsw_core,enum mlxsw_reg_pmaos_admin_status admin_status;char pmaos_pl[MLXSW_REG_PMAOS_LEN ]; -mlxsw_reg_pmaos_pack (pmaos_pl, module); +mlxsw_reg_pmaos_pack (pmaos_pl,0 , module); admin_status = enable ?MLXSW_REG_PMAOS_ADMIN_STATUS_ENABLED :MLXSW_REG_PMAOS_ADMIN_STATUS_DISABLED ;mlxsw_reg_pmaos_admin_status_set (pmaos_pl, admin_status);
@@ -931,7 +931,7 @@ mlxsw_env_module_oper_state_event_enable(struct mlxsw_core *mlxsw_core)for (i =0 ; i <mlxsw_core_env (mlxsw_core)->module_count; i++) {char pmaos_pl[MLXSW_REG_PMAOS_LEN ]; -mlxsw_reg_pmaos_pack (pmaos_pl, i); +mlxsw_reg_pmaos_pack (pmaos_pl,0 , i);mlxsw_reg_pmaos_e_set (pmaos_pl,MLXSW_REG_PMAOS_E_GENERATE_EVENT );mlxsw_reg_pmaos_ee_set (pmaos_pl, true);
drivers/net/ethernet/mellanox/mlxsw/reg.h +2 -1
@@ -5769,9 +5769,10 @@ enum mlxsw_reg_pmaos_e {*/ MLXSW_ITEM32 (reg, pmaos, e,0x04 ,0 ,2 ); -static inline void mlxsw_reg_pmaos_pack (char *payload,u8 module) +static inline void mlxsw_reg_pmaos_pack (char *payload,u8 slot_index,u8 module) {MLXSW_REG_ZERO (pmaos, payload); +mlxsw_reg_pmaos_slot_index_set (payload, slot_index);mlxsw_reg_pmaos_module_set (payload, module); }
Signature · 1 line
2.33.1
Ido Schimmel
maintainerPATCH 8/8 mlxsw: reg: Add new field to Management General Peripheral Information Register
In reply to Ido SchimmelFrom: Vadim Pasternak <[email protected]>
Add new field 'max_modules_per_slot' to provide maximum number of modules that can be connected per slot. This field will always be zero, if 'slot_index' in query request is set to non-zero value, otherwise value in this field will provide maximum modules number, which can be equipped on device inserted at any slot.
--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/reg.h +6 -0
@@ -11386,6 +11386,12 @@ MLXSW_ITEM32(reg, mgpir, devices_per_flash, 0x00, 16, 8);*/ MLXSW_ITEM32 (reg, mgpir, num_of_devices,0x00 ,0 ,8 ); +/* max_modules_per_slot +* Maximum number of modules that can be connected per slot. +* Access: RO +*/ +MLXSW_ITEM32 (reg, mgpir, max_modules_per_slot,0x04 ,16 ,8 ); +/* mgpir_num_of_slots * Number of slots in the system. * Access: RO
Signature · 1 line
2.33.1
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Mon, 11 Apr 2022 17:46:49 +0300 you wrote:
This patch set prepares mlxsw for line cards support by extending device registers with a slot index, which allows accessing components found on a line card at a given slot. Currently, only slot index 0 (main board) is used.
No user visible changes that I am aware of.
[...]
Here is the summary with links:
- [net-next,1/8] mlxsw: reg: Extend MTMP register with new slot number field
https://git.kernel.org/netdev/net-next/c/d30bed29a718 - [net-next,2/8] mlxsw: reg: Extend MTBR register with new slot number field https://git.kernel.org/netdev/net-next/c/c6e6ad703ed2 - [net-next,3/8] mlxsw: reg: Extend MCIA register with new slot number field https://git.kernel.org/netdev/net-next/c/89dd6fcd07f9 - [net-next,4/8] mlxsw: reg: Extend MCION register with new slot number field https://git.kernel.org/netdev/net-next/c/655cbb1d7530 - [net-next,5/8] mlxsw: reg: Extend PMMP register with new slot number field https://git.kernel.org/netdev/net-next/c/7cb85d3c696e - [net-next,6/8] mlxsw: reg: Extend MGPIR register with new slot fields https://git.kernel.org/netdev/net-next/c/b691602c6f96 - [net-next,7/8] mlxsw: core_env: Pass slot index during PMAOS register write call https://git.kernel.org/netdev/net-next/c/64e65a540e6d - [net-next,8/8] mlxsw: reg: Add new field to Management General Peripheral Information Register https://git.kernel.org/netdev/net-next/c/e94295e0ed27
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html