Skip to contentSkip to conversation

net/mlxfw: Drop hard coded max FW flash image size

PATCH Applied Moshe Shemesh 4 participants 4 messages Jan 16, 2025 – Jan 18, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlxfw: Drop hard coded max FW flash image size

From: Maher Sanalla <[email protected]>

Currently, mlxfw kernel module limits FW flash image size to be 10MB at most, preventing the ability to burn recent BlueField-3 FW that exceeds the said size limit.

Thus, drop the hard coded limit. Instead, rely on FW's max_component_size threshold that is reported in MCQI register as the size limit for FW image.

Fixes 410ed13cae39 ("Add the mlxfw module for Mellanox firmware flash process")
Cc Ido Schimmel <[email protected]>
---
 drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c +0 -2
index 46245e0b2462..43c84900369a 100644
@@ -14,7 +14,6 @@
 #define MLXFW_FSM_STATE_WAIT_TIMEOUT_MS 30000
 #define MLXFW_FSM_STATE_WAIT_ROUNDS \
 	(MLXFW_FSM_STATE_WAIT_TIMEOUT_MS / MLXFW_FSM_STATE_WAIT_CYCLE_MS)
-#define MLXFW_FSM_MAX_COMPONENT_SIZE (10 * (1 << 20))
 
 static const int mlxfw_fsm_state_errno[] = {
 	[MLXFW_FSM_STATE_ERR_ERROR] = -EIO,
@@ -229,7 +228,6 @@ static int mlxfw_flash_component(struct mlxfw_dev *mlxfw_dev,
 		return err;
 	}
 
-	comp_max_size = min_t(u32, comp_max_size, MLXFW_FSM_MAX_COMPONENT_SIZE);
 	if (comp->data_size > comp_max_size) {
 		MLXFW_ERR_MSG(mlxfw_dev, extack,
 			      "Component size is bigger than limit", -EINVAL);
Signature · 1 line
2.18.2
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 6 lines · Moshe Shemesh

From: Maher Sanalla <[email protected]>

Currently, mlxfw kernel module limits FW flash image size to be 10MB at most, preventing the ability to burn recent BlueField-3 FW that exceeds the said size limit.

Quoted 8 lines

Thus, drop the hard coded limit. Instead, rely on FW's max_component_size threshold that is reported in MCQI register as the size limit for FW image.

Fixes 410ed13cae39 ("Add the mlxfw module for Mellanox firmware flash process")
Cc Ido Schimmel <[email protected]>

Tested on Spectrum-{1,2,3,4}.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Moshe Shemesh
Quoted 31 lines · Moshe Shemesh

From: Maher Sanalla <[email protected]>

Currently, mlxfw kernel module limits FW flash image size to be 10MB at most, preventing the ability to burn recent BlueField-3 FW that exceeds the said size limit.

Thus, drop the hard coded limit. Instead, rely on FW's max_component_size threshold that is reported in MCQI register as the size limit for FW image.

Fixes 410ed13cae39 ("Add the mlxfw module for Mellanox firmware flash process")
Cc Ido Schimmel <[email protected]>
---
 drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c +0 -1
index 46245e0b2462..43c84900369a 100644
@@ -14,7 +14,6 @@
 #define MLXFW_FSM_STATE_WAIT_TIMEOUT_MS 30000
 #define MLXFW_FSM_STATE_WAIT_ROUNDS \
 	(MLXFW_FSM_STATE_WAIT_TIMEOUT_MS / MLXFW_FSM_STATE_WAIT_CYCLE_MS)
-#define MLXFW_FSM_MAX_COMPONENT_SIZE (10 * (1 << 20))
 
 static const int mlxfw_fsm_state_errno[] = {
 	[MLXFW_FSM_STATE_ERR_ERROR] = -EIO,

drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c static int mlxfw_flash_component(struct mlxfw_dev *mlxfw_dev, · line 233

Quoted 7 lines
drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c +0 -1
@@ -229,7 +228,6 @@ static int mlxfw_flash_component(struct mlxfw_dev *mlxfw_dev,
 		return err;
 	}
 
-	comp_max_size = min_t(u32, comp_max_size, MLXFW_FSM_MAX_COMPONENT_SIZE);
 	if (comp->data_size > comp_max_size) {
 		MLXFW_ERR_MSG(mlxfw_dev, extack,
 			      "Component size is bigger than limit", -EINVAL);
Quoted 2 lines
Signature · 1 line
2.18.2
#3 lore raw
In reply to Moshe Shemesh
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Thu, 16 Jan 2025 14:33:16 +0200 you wrote:

From: Maher Sanalla <[email protected]>

Currently, mlxfw kernel module limits FW flash image size to be 10MB at most, preventing the ability to burn recent BlueField-3 FW that exceeds the said size limit.

Thus, drop the hard coded limit. Instead, rely on FW's max_component_size threshold that is reported in MCQI register as the size limit for FW image.

[...]

Here is the summary with links:
- [net] net/mlxfw: Drop hard coded max FW flash image size

    https://git.kernel.org/netdev/net/c/70d81f25cc92

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html