Re: [PATCH] [v2] mlx5: reduce stack usage in mlx5_setup_tc

From: Tariq Toukan
Date: Wed Jan 18 2023 - 02:34:44 EST




On 17/01/2023 23:01, Arnd Bergmann wrote:
From: Arnd Bergmann <arnd@xxxxxxxx>

Clang warns about excessive stack usage on 32-bit targets:

drivers/net/ethernet/mellanox/mlx5/core/en_main.c:3597:12: error: stack frame size (1184) exceeds limit (1024) in 'mlx5e_setup_tc' [-Werror,-Wframe-larger-than]
static int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type,

It turns out that both the mlx5e_setup_tc_mqprio_dcb() function and
the mlx5e_safe_switch_params() function it calls have a copy of
'struct mlx5e_params' on the stack, and this structure is fairly
large.

Use dynamic allocation for the inner one.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
v2: simplify the patch
---
.../net/ethernet/mellanox/mlx5/core/en_main.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)


Thanks for your patch.
Reviewed-by: Tariq Toukan <tariqt@xxxxxxxxxx>