From patchwork Wed Aug 3 09:58:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erez Shitrit X-Patchwork-Id: 1030992 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p739wGpK013732 for ; Wed, 3 Aug 2011 09:58:16 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753250Ab1HCJ6P (ORCPT ); Wed, 3 Aug 2011 05:58:15 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:60568 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753197Ab1HCJ6O (ORCPT ); Wed, 3 Aug 2011 05:58:14 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from erezsh@dev.mellanox.co.il) with SMTP; 3 Aug 2011 12:58:10 +0300 Received: from vnc4.lab.mtl.com (vnc4.lab.mtl.com [10.4.45.4]) by mtlsws123.lab.mtl.com (8.13.8/8.13.8) with ESMTP id p739wAKx019015; Wed, 3 Aug 2011 12:58:10 +0300 Received: from vnc4.lab.mtl.com (localhost.localdomain [127.0.0.1]) by vnc4.lab.mtl.com (8.13.8/8.13.8) with ESMTP id p739w9fR011155; Wed, 3 Aug 2011 12:58:09 +0300 Received: from localhost (localhost [[UNIX: localhost]]) by vnc4.lab.mtl.com (8.13.8/8.13.8/Submit) id p739w61E011154; Wed, 3 Aug 2011 12:58:06 +0300 X-Authentication-Warning: vnc4.lab.mtl.com: erezsh set sender to erezsh@dev.mellanox.co.il using -f From: Erez Shitrit To: roland@kernel.org Subject: [PATCH 1/1] mlx4-core: enable changing default max HCA resource limits. Date: Wed, 3 Aug 2011 12:58:05 +0300 User-Agent: KMail/1.9.4 Cc: linux-rdma@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201108031258.05725.erezsh@dev.mellanox.co.il> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 03 Aug 2011 09:58:16 +0000 (UTC) Enable module-initialization time modification of default HCA maximum resource limits via module parameters, as is done in mthca. Specify the log of the parameter value, rather than the value itself to avoid the hidden side-effect of rounding up values to next power-of-2. Signed-off-by: Jack Morgenstein Signed-off-by: Erez Shitrit --- drivers/net/mlx4/main.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 51 insertions(+), 0 deletions(-) + int mlx4_check_port_params(struct mlx4_dev *dev, enum mlx4_port_type *port_type) { @@ -791,6 +841,7 @@ static int mlx4_init_hca(struct mlx4_dev *dev) goto err_stop_fw; } + process_mod_param_profile(); profile = default_profile; icm_size = mlx4_make_profile(dev, &profile, &dev_cap, &init_hca); diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index 3814fc9..0c36854 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c @@ -106,6 +106,56 @@ static int log_mtts_per_seg = ilog2 (MLX4_MTT_ENTRY_PER_SEG); module_param_named(log_mtts_per_seg, log_mtts_per_seg, int, 0444); MODULE_PARM_DESC(log_mtts_per_seg, "Log2 number of MTT entries per segment (1-7)"); +static struct mlx4_profile mod_param_profile = { 0 }; + +module_param_named(log_num_qp, mod_param_profile.num_qp, int, 0444); +MODULE_PARM_DESC(log_num_qp, "log maximum number of QPs per HCA "); + +module_param_named(log_num_srq, mod_param_profile.num_srq, int, 0444); +MODULE_PARM_DESC(log_num_srq, "log maximum number of SRQs per HCA "); + +module_param_named(log_rdmarc_per_qp, mod_param_profile.rdmarc_per_qp, int, 0444); +MODULE_PARM_DESC(log_rdmarc_per_qp, "log number of RDMARC buffers per QP "); + +module_param_named(log_num_cq, mod_param_profile.num_cq, int, 0444); +MODULE_PARM_DESC(log_num_cq, "log maximum number of CQs per HCA "); + +module_param_named(log_num_mcg, mod_param_profile.num_mcg, int, 0444); +MODULE_PARM_DESC(log_num_mcg, "log maximum number of multicast groups per HCA "); + +module_param_named(log_num_mpt, mod_param_profile.num_mpt, int, 0444); +MODULE_PARM_DESC(log_num_mpt, + "log maximum number of memory protection table entries per HCA "); + +module_param_named(log_num_mtt, mod_param_profile.num_mtt, int, 0444); +MODULE_PARM_DESC(log_num_mtt, + "log maximum number of memory translation table segments per HCA "); + +static void process_mod_param_profile(void) +{ + default_profile.num_qp = (mod_param_profile.num_qp ? + 1 << mod_param_profile.num_qp : + default_profile.num_qp); + default_profile.num_srq = (mod_param_profile.num_srq ? + 1 << mod_param_profile.num_srq : + default_profile.num_srq); + default_profile.rdmarc_per_qp = (mod_param_profile.rdmarc_per_qp ? + 1 << mod_param_profile.rdmarc_per_qp : + default_profile.rdmarc_per_qp); + default_profile.num_cq = (mod_param_profile.num_cq ? + 1 << mod_param_profile.num_cq : + default_profile.num_cq); + default_profile.num_mcg = (mod_param_profile.num_mcg ? + 1 << mod_param_profile.num_mcg : + default_profile.num_mcg); + default_profile.num_mpt = (mod_param_profile.num_mpt ? + 1 << mod_param_profile.num_mpt : + default_profile.num_mpt); + default_profile.num_mtt = (mod_param_profile.num_mtt ? + 1 << mod_param_profile.num_mtt : + default_profile.num_mtt); +}