mlxsw: Provide enhancements and new feature
Subsystems (3)
Petr Machata
maintainercover mlxsw: Provide enhancements and new feature
Vadim Pasternak writes:
Patch #1 - Optimize transaction size for efficient retrieval of module
data.
Patch #3 - Enable thermal zone binding with new cooling device. Patch #4 - Employ standard macros for dividing buffer into the chunks.
Vadim Pasternak (3):
mlxsw: reg: Limit MTBR register payload to a single data record
mlxsw: core: Extend allowed list of external cooling devices for
thermal zone binding
mlxsw: i2c: Utilize standard macros for dividing buffer into chunks
drivers/net/ethernet/mellanox/mlxsw/core_env.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 1 + drivers/net/ethernet/mellanox/mlxsw/i2c.c | 4 +--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 6 +++--- 5 files changed, 7 insertions(+), 8 deletions(-)
Signature · 1 line
2.41.0
Petr Machata
maintainerPATCH 1/3 mlxsw: reg: Limit MTBR register payload to a single data record
From: Vadim Pasternak <[email protected]>
The MTBR register is used to read temperatures from multiple sensors in one transaction, but the driver only reads from a single sensor in each transaction.
Rrestrict the payload size of the MTBR register to prevent the transmission of redundant data to the firmware.
--- drivers/net/ethernet/mellanox/mlxsw/core_env.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/reg.h | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_env.c +1 -1
@@ -775,7 +775,7 @@ static int mlxsw_env_module_has_temp_sensor(struct mlxsw_core *mlxsw_core,int err;mlxsw_reg_mtbr_pack (mtbr_pl, slot_index, -MLXSW_REG_MTBR_BASE_MODULE_INDEX + module,1 ); +MLXSW_REG_MTBR_BASE_MODULE_INDEX + module); err =mlxsw_reg_query (mlxsw_core,MLXSW_REG (mtbr), mtbr_pl);if (err)return err;
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c +1 -1
@@ -293,7 +293,7 @@ static ssize_t mlxsw_hwmon_module_temp_fault_show(struct device *dev, module = mlxsw_hwmon_attr->type_index - mlxsw_hwmon_dev->sensor_count;mlxsw_reg_mtbr_pack (mtbr_pl, mlxsw_hwmon_dev->slot_index, -MLXSW_REG_MTBR_BASE_MODULE_INDEX + module,1 ); +MLXSW_REG_MTBR_BASE_MODULE_INDEX + module); 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 +3 -3
@@ -9551,7 +9551,7 @@ MLXSW_ITEM_BIT_ARRAY(reg, mtwe, sensor_warning, 0x0, 0x10, 1);#define MLXSW_REG_MTBR_ID 0x900F#define MLXSW_REG_MTBR_BASE_LEN 0x10/* base length, without records */ #define MLXSW_REG_MTBR_REC_LEN 0x04/* record length */ -#define MLXSW_REG_MTBR_REC_MAX_COUNT 47/* firmware limitation */ +#define MLXSW_REG_MTBR_REC_MAX_COUNT 1#define MLXSW_REG_MTBR_LEN (MLXSW_REG_MTBR_BASE_LEN + \ MLXSW_REG_MTBR_REC_LEN * \ MLXSW_REG_MTBR_REC_MAX_COUNT)
@@ -9597,12 +9597,12 @@ 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,u8 slot_index, -u16 base_sensor_index,u8 num_rec) +u16 base_sensor_index) {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); +mlxsw_reg_mtbr_num_rec_set (payload,1 ); }/* Error codes from temperatute reading */
Signature · 1 line
2.41.0
Petr Machata
maintainerPATCH 2/3 mlxsw: core: Extend allowed list of external cooling devices for thermal zone binding
In reply to Petr MachataFrom: Vadim Pasternak <[email protected]>
Extend the list of allowed external cooling devices for thermal zone binding to include devices of type "emc2305".
The motivation is to provide support for the system SN2201, which is equipped with the Spectrum-1 ASIC.
The system's airflow control is managed by the EMC2305 RPM-based PWM Fan Speed Controller as the cooling device.
--- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +1 -0
@@ -31,6 +31,7 @@/* External cooling devices, allowed for binding to mlxsw thermal zones. */ static char *const mlxsw_thermal_external_allowed_cdev[] = {"mlxreg_fan" , +"emc2305" , };struct mlxsw_cooling_states {
Signature · 1 line
2.41.0
Petr Machata
maintainerPATCH 3/3 mlxsw: i2c: Utilize standard macros for dividing buffer into chunks
In reply to Petr MachataFrom: Vadim Pasternak <[email protected]>
Use standard macro DIV_ROUND_UP() to determine the number of chunks required for a given buffer.
--- drivers/net/ethernet/mellanox/mlxsw/i2c.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/i2c.c +1 -3
@@ -424,9 +424,7 @@ mlxsw_i2c_cmd(struct device *dev, u16 opcode, u32 in_mod, size_t in_mbox_size,if (in_mbox) { reg_size =mlxsw_i2c_get_reg_size (in_mbox); - num = reg_size / mlxsw_i2c->block_size; -if (reg_size % mlxsw_i2c->block_size) - num++; + num =DIV_ROUND_UP (reg_size, mlxsw_i2c->block_size);if (mutex_lock_interruptible (&mlxsw_i2c->cmd.lock) <0 ) {dev_err (&client->dev,"Could not acquire lock" );
Signature · 1 line
2.41.0
Quoted 13 lines · Petr Machata
Vadim Pasternak writes:
Patch #1 - Optimize transaction size for efficient retrieval of module
data.
Patch #3 - Enable thermal zone binding with new cooling device. Patch #4 - Employ standard macros for dividing buffer into the chunks.Vadim Pasternak (3):
mlxsw: reg: Limit MTBR register payload to a single data record
mlxsw: core: Extend allowed list of external cooling devices for
thermal zone binding
mlxsw: i2c: Utilize standard macros for dividing buffer into chunks
Quoted 6 lines
drivers/net/ethernet/mellanox/mlxsw/core_env.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 2 +- drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 1 + drivers/net/ethernet/mellanox/mlxsw/i2c.c | 4 +--- drivers/net/ethernet/mellanox/mlxsw/reg.h | 6 +++--- 5 files changed, 7 insertions(+), 8 deletions(-)
For series,
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 8 lines · On Fri, 22 Sep 2023 19:18:35 +0200 you wrote:
Vadim Pasternak writes:
Patch #1 - Optimize transaction size for efficient retrieval of module
data.
Patch #3 - Enable thermal zone binding with new cooling device. Patch #4 - Employ standard macros for dividing buffer into the chunks.[...]
Here is the summary with links:
- [net-next,1/3] mlxsw: reg: Limit MTBR register payload to a single data record
https://git.kernel.org/netdev/net-next/c/c755655c3d8b - [net-next,2/3] mlxsw: core: Extend allowed list of external cooling devices for thermal zone binding https://git.kernel.org/netdev/net-next/c/7afc79e20e22 - [net-next,3/3] mlxsw: i2c: Utilize standard macros for dividing buffer into chunks https://git.kernel.org/netdev/net-next/c/1f73286371c2
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html