* [PATCH net 0/3] mlxsw: Assorted fixes
@ 2023-08-24 13:43 Petr Machata
2023-08-24 13:43 ` [PATCH net 1/3] mlxsw: i2c: Fix chunk size setting in output mailbox buffer Petr Machata
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Petr Machata @ 2023-08-24 13:43 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev
Cc: Ido Schimmel, Petr Machata, Jiri Pirko, Vadim Pasternak, mlxsw
This patchset contains several fixes for the mlxsw driver.
Patch #1 - Fixes buffer size in I2C mailbox buffer.
Patch #2 - Sets limitation of chunk size in I2C transaction.
Patch #3 - Fixes module label names based on MTCAP sensor counter
Vadim Pasternak (3):
mlxsw: i2c: Fix chunk size setting in output mailbox buffer
mlxsw: i2c: Limit single transaction buffer size
mlxsw: core_hwmon: Adjust module label names based on MTCAP sensor
counter
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 3 ++-
drivers/net/ethernet/mellanox/mlxsw/i2c.c | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net 1/3] mlxsw: i2c: Fix chunk size setting in output mailbox buffer
2023-08-24 13:43 [PATCH net 0/3] mlxsw: Assorted fixes Petr Machata
@ 2023-08-24 13:43 ` Petr Machata
2023-08-24 13:43 ` [PATCH net 2/3] mlxsw: i2c: Limit single transaction buffer size Petr Machata
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Petr Machata @ 2023-08-24 13:43 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev
Cc: Ido Schimmel, Petr Machata, Jiri Pirko, Vadim Pasternak, mlxsw
From: Vadim Pasternak <vadimp@nvidia.com>
The driver reads commands output from the output mailbox. If the size
of the output mailbox is not a multiple of the transaction /
block size, then the driver will not issue enough read transactions
to read the entire output, which can result in driver initialization
errors.
Fix by determining the number of transactions using DIV_ROUND_UP().
Fixes: 3029a693beda ("mlxsw: i2c: Allow flexible setting of I2C transactions size")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlxsw/i2c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/i2c.c b/drivers/net/ethernet/mellanox/mlxsw/i2c.c
index 41298835a11e..47af7ef7e4ee 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/i2c.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/i2c.c
@@ -444,7 +444,7 @@ mlxsw_i2c_cmd(struct device *dev, u16 opcode, u32 in_mod, size_t in_mbox_size,
} else {
/* No input mailbox is case of initialization query command. */
reg_size = MLXSW_I2C_MAX_DATA_SIZE;
- num = reg_size / mlxsw_i2c->block_size;
+ 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");
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net 2/3] mlxsw: i2c: Limit single transaction buffer size
2023-08-24 13:43 [PATCH net 0/3] mlxsw: Assorted fixes Petr Machata
2023-08-24 13:43 ` [PATCH net 1/3] mlxsw: i2c: Fix chunk size setting in output mailbox buffer Petr Machata
@ 2023-08-24 13:43 ` Petr Machata
2023-08-24 13:43 ` [PATCH net 3/3] mlxsw: core_hwmon: Adjust module label names based on MTCAP sensor counter Petr Machata
2023-08-25 10:00 ` [PATCH net 0/3] mlxsw: Assorted fixes patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Petr Machata @ 2023-08-24 13:43 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev
Cc: Ido Schimmel, Petr Machata, Jiri Pirko, Vadim Pasternak, mlxsw
From: Vadim Pasternak <vadimp@nvidia.com>
Maximum size of buffer is obtained from underlying I2C adapter and in
case adapter allows I2C transaction buffer size greater than 100 bytes,
transaction will fail due to firmware limitation.
As a result driver will fail initialization.
Limit the maximum size of transaction buffer by 100 bytes to fit to
firmware.
Remove unnecessary calculation:
max_t(u16, MLXSW_I2C_BLK_DEF, quirk_size).
This condition can not happened.
Fixes: 3029a693beda ("mlxsw: i2c: Allow flexible setting of I2C transactions size")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlxsw/i2c.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/i2c.c b/drivers/net/ethernet/mellanox/mlxsw/i2c.c
index 47af7ef7e4ee..d23f293e285c 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/i2c.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/i2c.c
@@ -48,6 +48,7 @@
#define MLXSW_I2C_MBOX_SIZE_BITS 12
#define MLXSW_I2C_ADDR_BUF_SIZE 4
#define MLXSW_I2C_BLK_DEF 32
+#define MLXSW_I2C_BLK_MAX 100
#define MLXSW_I2C_RETRY 5
#define MLXSW_I2C_TIMEOUT_MSECS 5000
#define MLXSW_I2C_MAX_DATA_SIZE 256
@@ -653,7 +654,7 @@ static int mlxsw_i2c_probe(struct i2c_client *client)
return -EOPNOTSUPP;
}
- mlxsw_i2c->block_size = max_t(u16, MLXSW_I2C_BLK_DEF,
+ mlxsw_i2c->block_size = min_t(u16, MLXSW_I2C_BLK_MAX,
min_t(u16, quirks->max_read_len,
quirks->max_write_len));
} else {
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net 3/3] mlxsw: core_hwmon: Adjust module label names based on MTCAP sensor counter
2023-08-24 13:43 [PATCH net 0/3] mlxsw: Assorted fixes Petr Machata
2023-08-24 13:43 ` [PATCH net 1/3] mlxsw: i2c: Fix chunk size setting in output mailbox buffer Petr Machata
2023-08-24 13:43 ` [PATCH net 2/3] mlxsw: i2c: Limit single transaction buffer size Petr Machata
@ 2023-08-24 13:43 ` Petr Machata
2023-08-25 10:00 ` [PATCH net 0/3] mlxsw: Assorted fixes patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Petr Machata @ 2023-08-24 13:43 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev
Cc: Ido Schimmel, Petr Machata, Jiri Pirko, Vadim Pasternak, mlxsw
From: Vadim Pasternak <vadimp@nvidia.com>
Transceiver module temperature sensors are indexed after ASIC and
platform sensors. The current label printing method does not take this
into account and simply prints the index of the transceiver module
sensor.
On new systems that have platform sensors this results in incorrect
(shifted) transceiver module labels being printed:
$ sensors
[...]
front panel 002: +37.0°C (crit = +70.0°C, emerg = +75.0°C)
front panel 003: +47.0°C (crit = +70.0°C, emerg = +75.0°C)
[...]
Fix by taking the sensor count into account. After the fix:
$ sensors
[...]
front panel 001: +37.0°C (crit = +70.0°C, emerg = +75.0°C)
front panel 002: +47.0°C (crit = +70.0°C, emerg = +75.0°C)
[...]
Fixes: a53779de6a0e ("mlxsw: core: Add QSFP module temperature label attribute to hwmon")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Petr Machata <petrm@nvidia.com>
---
drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
index 70735068cf29..0fd290d776ff 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
@@ -405,7 +405,8 @@ mlxsw_hwmon_module_temp_label_show(struct device *dev,
container_of(attr, struct mlxsw_hwmon_attr, dev_attr);
return sprintf(buf, "front panel %03u\n",
- mlxsw_hwmon_attr->type_index);
+ mlxsw_hwmon_attr->type_index + 1 -
+ mlxsw_hwmon_attr->mlxsw_hwmon_dev->sensor_count);
}
static ssize_t
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net 0/3] mlxsw: Assorted fixes
2023-08-24 13:43 [PATCH net 0/3] mlxsw: Assorted fixes Petr Machata
` (2 preceding siblings ...)
2023-08-24 13:43 ` [PATCH net 3/3] mlxsw: core_hwmon: Adjust module label names based on MTCAP sensor counter Petr Machata
@ 2023-08-25 10:00 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-08-25 10:00 UTC (permalink / raw)
To: Petr Machata
Cc: davem, edumazet, kuba, pabeni, netdev, idosch, jiri, vadimp,
mlxsw
Hello:
This series was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Thu, 24 Aug 2023 15:43:07 +0200 you wrote:
> This patchset contains several fixes for the mlxsw driver.
>
> Patch #1 - Fixes buffer size in I2C mailbox buffer.
> Patch #2 - Sets limitation of chunk size in I2C transaction.
> Patch #3 - Fixes module label names based on MTCAP sensor counter
>
> Vadim Pasternak (3):
> mlxsw: i2c: Fix chunk size setting in output mailbox buffer
> mlxsw: i2c: Limit single transaction buffer size
> mlxsw: core_hwmon: Adjust module label names based on MTCAP sensor
> counter
>
> [...]
Here is the summary with links:
- [net,1/3] mlxsw: i2c: Fix chunk size setting in output mailbox buffer
https://git.kernel.org/netdev/net/c/146c7c330507
- [net,2/3] mlxsw: i2c: Limit single transaction buffer size
https://git.kernel.org/netdev/net/c/d7248f1cc835
- [net,3/3] mlxsw: core_hwmon: Adjust module label names based on MTCAP sensor counter
https://git.kernel.org/netdev/net/c/3fc134a07438
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-25 10:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-24 13:43 [PATCH net 0/3] mlxsw: Assorted fixes Petr Machata
2023-08-24 13:43 ` [PATCH net 1/3] mlxsw: i2c: Fix chunk size setting in output mailbox buffer Petr Machata
2023-08-24 13:43 ` [PATCH net 2/3] mlxsw: i2c: Limit single transaction buffer size Petr Machata
2023-08-24 13:43 ` [PATCH net 3/3] mlxsw: core_hwmon: Adjust module label names based on MTCAP sensor counter Petr Machata
2023-08-25 10:00 ` [PATCH net 0/3] mlxsw: Assorted fixes patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).