From: Mukesh Kacker Date: Tue, 29 Mar 2016 02:12:50 +0000 (-0700) Subject: mlx4_core: bump default scaled value of num of cqs and srqs X-Git-Tag: v4.1.12-92~174^2~1 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=072d745d9468d8af0154fa8a53d03bc268977361;p=users%2Fjedix%2Flinux-maple.git mlx4_core: bump default scaled value of num of cqs and srqs Bump up the number of cqs and srqs when scale_profile parameter is set or log_num_cq/log_num_srq are zero implying a scaled default profile. This allows higher scalability needed for cloud based platforms running higher number of processes per hca. If the individual parameters log_num_srq and/or log_num_cq are set, they take precedence and scale_profile is ignored. (Fixes for style problems with quoted strings split across lines and and block comment format are also piggybacked in this commit!) Orabug: 23078966 Signed-off-by: Mukesh Kacker Reviewed-by: Wengang Wang Reviewed-by: Santosh Shilimkar --- diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index e521497fed62..f7176894c46e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -150,6 +150,8 @@ module_param_named(scale_profile, mlx4_scale_profile, int, 0644); MODULE_PARM_DESC(scale_profile, "Dynamically adjust default profile" "parameters based on system resources"); #define MLX4_SCALE_LOG_NUM_QP 20 /* 1 Meg */ +#define MLX4_SCALE_LOG_NUM_SRQ 18 /* 256K */ +#define MLX4_SCALE_LOG_NUM_CQ 18 /* 256K */ static bool use_prio; module_param_named(use_prio, use_prio, bool, 0444); @@ -222,37 +224,64 @@ enum { MLX4_IF_STATE_BASIC, MLX4_IF_STATE_EXTENDED }; + static void process_mod_param_profile(struct mlx4_profile *profile) { struct sysinfo si; if (mod_param_profile.num_qp) { if (mlx4_scale_profile) - pr_warn("mlx4_core: Both scale_profile and log_num_qp " - "are set. Ignore scale_profile.\n"); - profile->num_qp = 1 << mod_param_profile.num_qp; + pr_warn("mlx4_core: Both scale_profile and log_num_qp are set. Ignore scale_profile.\n"); + profile->num_qp = 1 << mod_param_profile.num_qp; } else { - /* - * Note: This could be set dynamically based on system/HCA + /* Note: This could be set dynamically based on system/HCA + * resources in future. A constant for now. + */ + profile->num_qp = 1 << MLX4_SCALE_LOG_NUM_QP; + if (mlx4_scale_profile) + pr_info("mlx4_core: Scalable default profile parameters are enabled. Effective log_num_qp is now set to %d.\n", + MLX4_SCALE_LOG_NUM_QP); + else + pr_info("mlx4_core: log_num_qp not set and scaled dynamically. Effective log_num_qp is now set to %d.\n", + MLX4_SCALE_LOG_NUM_QP); + } + if (mod_param_profile.num_srq) { + if (mlx4_scale_profile) + pr_warn("mlx4_core: Both scale_profile and log_num_srq are set. Ignore scale_profile.\n"); + profile->num_srq = 1 << mod_param_profile.num_srq; + } else { + /* Note: This could be set dynamically based on system/HCA * resources in future. A constant for now. */ - profile->num_qp = 1 << MLX4_SCALE_LOG_NUM_QP; + profile->num_srq = 1 << MLX4_SCALE_LOG_NUM_SRQ; if (mlx4_scale_profile) - pr_info("mlx4_core: Scalable default profile " - "parameters are enabled. Effective log_num_qp" - " is now set to %d.\n", MLX4_SCALE_LOG_NUM_QP); + pr_info("mlx4_core: Scalable default profile parameters are enabled. Effective log_num_srq is now set to %d.\n", + MLX4_SCALE_LOG_NUM_SRQ); else - pr_info("mlx4_core: log_num_qp not set and scaled" - "dynamically. Effective log_num_qp" - " is now set to %d.\n", MLX4_SCALE_LOG_NUM_QP); + pr_info("mlx4_core: log_num_srq not set and scaled dynamically. Effective log_num_srq is now set to %d.\n", + MLX4_SCALE_LOG_NUM_SRQ); } - profile->num_srq = 1 << mod_param_profile.num_srq; profile->rdmarc_per_qp = 1 << mod_param_profile.rdmarc_per_qp; - profile->num_cq = 1 << mod_param_profile.num_cq; + if (mod_param_profile.num_cq) { + if (mlx4_scale_profile) + pr_warn("mlx4_core: Both scale_profile and log_num_cq are set. Ignore scale_profile.\n"); + profile->num_cq = 1 << mod_param_profile.num_cq; + } else { + /* Note: This could be set dynamically based on system/HCA + * resources in future. A constant for now. + */ + profile->num_cq = 1 << MLX4_SCALE_LOG_NUM_CQ; + if (mlx4_scale_profile) + pr_info("mlx4_core: Scalable default profile parameters are enabled. Effective log_num_cq is now set to %d.\n", + MLX4_SCALE_LOG_NUM_CQ); + else + pr_info("mlx4_core: log_num_cq not set and scaled dynamically. Effective log_num_cq is now set to %d.\n", + MLX4_SCALE_LOG_NUM_CQ); + } profile->num_mcg = 1 << mod_param_profile.num_mcg; profile->num_mpt = 1 << mod_param_profile.num_mpt; - /* - * We want to scale the number of MTTs with the size of the + + /* We want to scale the number of MTTs with the size of the * system memory, since it makes sense to register a lot of * memory on a system with a lot of memory. As a heuristic, * make sure we have enough MTTs to register twice the system @@ -266,8 +295,7 @@ static void process_mod_param_profile(struct mlx4_profile *profile) */ if (mod_param_profile.num_mtt_segs) { if (mlx4_scale_profile) - pr_warn("mlx4_core: Both scale_profile and log_num_mtt " - "are set. Ignore scale_profile.\n"); + pr_warn("mlx4_core: Both scale_profile and log_num_mtt are set. Ignore scale_profile.\n"); profile->num_mtt_segs = 1 << mod_param_profile.num_mtt_segs; } else { si_meminfo(&si); @@ -284,14 +312,10 @@ static void process_mod_param_profile(struct mlx4_profile *profile) using the sysfs */ mod_param_profile.num_mtt_segs = ilog2(profile->num_mtt_segs); if (mlx4_scale_profile) - pr_info("mlx4_core: Scalable default profile " - "parameters are enabled. Effective log_num_mtt" - " is now set to %d.\n", + pr_info("mlx4_core: Scalable default profile parameters are enabled. Effective log_num_mtt is now set to %d.\n", mod_param_profile.num_mtt_segs); else - pr_info("mlx4_core: log_num_mtt not set and scaled " - "dynamically. Effective log_num_mtt" - " is now set to %d.\n", + pr_info("mlx4_core: log_num_mtt not set and scaled dynamically. Effective log_num_mtt is now set to %d.\n", mod_param_profile.num_mtt_segs); } } @@ -3881,19 +3905,20 @@ static int __init mlx4_verify_params(void) return -1; } - if (mod_param_profile.num_qp < 18 || mod_param_profile.num_qp > 23) { + if (mod_param_profile.num_qp && + (mod_param_profile.num_qp < 18 || 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) { + if (mod_param_profile.num_srq && 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) { + if (mod_param_profile.num_cq && mod_param_profile.num_cq < 10) { pr_warning("mlx4_core: too low log_num_cq: %d\n", mod_param_profile.num_cq); return -1;