Commit 17b3222e authored by Yevgeny Kliteynik's avatar Yevgeny Kliteynik Committed by Saeed Mahameed
Browse files

net/mlx5: DR, Fix 'stack frame size exceeds limit' error in dr_rule



If the kernel configuration asks the compiler to check frame limit of 1K,
dr_rule_create_rule_nic exceed this limit:
    "stack frame size (1184) exceeds limit (1024)"

Fixing this issue by checking configured frame limit and using the
optimization STE array only for cases with the usual 2K (or larger)
stack size warning.

Fixes: b9b81e1e ("net/mlx5: DR, For short chains of STEs, avoid allocating ste_arr dynamically")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
parent 2ea26b4d
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -3,7 +3,12 @@

#include "dr_types.h"

#if defined(CONFIG_FRAME_WARN) && (CONFIG_FRAME_WARN < 2048)
/* don't try to optimize STE allocation if the stack is too constaraining */
#define DR_RULE_MAX_STES_OPTIMIZED 0
#else
#define DR_RULE_MAX_STES_OPTIMIZED 5
#endif
#define DR_RULE_MAX_STE_CHAIN_OPTIMIZED (DR_RULE_MAX_STES_OPTIMIZED + DR_ACTION_MAX_STES)

static int dr_rule_append_to_miss_list(struct mlx5dr_domain *dmn,
@@ -1218,10 +1223,7 @@ dr_rule_create_rule_nic(struct mlx5dr_rule *rule,

	mlx5dr_domain_nic_unlock(nic_dmn);

	if (unlikely(!hw_ste_arr_is_opt))
		kfree(hw_ste_arr);

	return 0;
	goto out;

free_rule:
	dr_rule_clean_rule_members(rule, nic_rule);
@@ -1238,6 +1240,7 @@ dr_rule_create_rule_nic(struct mlx5dr_rule *rule,
free_hw_ste:
	mlx5dr_domain_nic_unlock(nic_dmn);

out:
	if (unlikely(!hw_ste_arr_is_opt))
		kfree(hw_ste_arr);