From: Dotan Barak Date: Wed, 2 May 2012 07:13:20 +0000 (+0300) Subject: mlx4_core: limit min profile numbers X-Git-Tag: v4.1.12-92~319^2^2~6^2~19 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=03d8d9fafc6385b7b90e8d1c0154df7c463559da;p=users%2Fjedix%2Flinux-maple.git mlx4_core: limit min profile numbers We can't use arbitrarily low profile numbers for resources since the device needs some of its own. The best way to do it is to query the device and then set the minimum values, but the values chosen here are good enough and do not complicate the implementation. Signed-off-by: Eli Cohen Signed-off-by: Dotan Barak Reviewed-by: Jack Morgenstein Signed-off-by: Vladimir Sokolovsky (Ported from Mellanox OFED 2.4) Signed-off-by: Mukesh Kacker --- diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 41b7c220d4a8..7622ffd1fa87 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -3781,6 +3781,36 @@ static int __init mlx4_verify_params(void) return -1; } + if (mod_param_profile.num_qp < 12 || mod_param_profile.num_qp > 23) { + pr_warning("mlx4_core: bad log_num_qp: %d\n", + mod_param_profile.num_qp); + return -1; + } + + if (mod_param_profile.num_srq < 10) { + pr_warning("mlx4_core: too low log_num_srq: %d\n", + mod_param_profile.num_srq); + return -1; + } + + if (mod_param_profile.num_cq < 10) { + pr_warning("mlx4_core: too low log_num_cq: %d\n", + mod_param_profile.num_cq); + return -1; + } + + if (mod_param_profile.num_mpt < 10) { + pr_warning("mlx4_core: too low log_num_mpt: %d\n", + mod_param_profile.num_mpt); + return -1; + } + + if (mod_param_profile.num_mtt && mod_param_profile.num_mtt < 15) { + pr_warning("mlx4_core: too low log_num_mtt: %d\n", + mod_param_profile.num_mtt); + return -1; + } + return 0; }