mlx5: reduce stack usage in mlx5_setup_tc
authorArnd Bergmann <arnd@arndb.de>
Tue, 17 Jan 2023 21:01:55 +0000 (22:01 +0100)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 8 Feb 2023 00:29:53 +0000 (16:29 -0800)
commit7802886274cc850a205e9e334c5a1b1b743ea71c
tree72e757c5354372361c3e8988663225f9ac301f26
parent383d9f87a06dd923c4fd0fdcb65b58258851f545
mlx5: reduce stack usage in mlx5_setup_tc

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@arndb.de>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c