From patchwork Thu Jun 10 16:59:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Kepner X-Patchwork-Id: 105420 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5AGxOKA002647 for ; Thu, 10 Jun 2010 16:59:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759572Ab0FJQ7X (ORCPT ); Thu, 10 Jun 2010 12:59:23 -0400 Received: from relay3.sgi.com ([192.48.152.1]:49676 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759498Ab0FJQ7X (ORCPT ); Thu, 10 Jun 2010 12:59:23 -0400 Received: from localhost (sshcf.sgi.com [198.149.20.12]) by relay3.corp.sgi.com (Postfix) with ESMTP id 2CCB8AC003 for ; Thu, 10 Jun 2010 09:59:22 -0700 (PDT) Date: Thu, 10 Jun 2010 09:59:21 -0700 From: Arthur Kepner To: linux-rdma@vger.kernel.org Subject: [PATCH/RFC] mlx4_core: module param to limit msix vec allocation Message-ID: <20100610165921.GF22247@sgi.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) 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.3 (demeter.kernel.org [140.211.167.41]); Thu, 10 Jun 2010 16:59:24 +0000 (UTC) diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c index e3e0d54..0a316d0 100644 --- a/drivers/net/mlx4/main.c +++ b/drivers/net/mlx4/main.c @@ -68,6 +68,10 @@ static int msi_x = 1; module_param(msi_x, int, 0444); MODULE_PARM_DESC(msi_x, "attempt to use MSI-X if nonzero"); +static int max_msi_x_vec = 64; +module_param(max_msi_x_vec, int, 0444); +MODULE_PARM_DESC(max_msi_x_vec, "max MSI-X vectors we'll attempt to allocate"); + #else /* CONFIG_PCI_MSI */ #define msi_x (0) @@ -968,8 +972,10 @@ static void mlx4_enable_msi_x(struct mlx4_dev *dev) int i; if (msi_x) { + nreq = min_t(int, num_possible_cpus() + 1, max_msi_x_vec); nreq = min_t(int, dev->caps.num_eqs - dev->caps.reserved_eqs, - num_possible_cpus() + 1); + nreq); + entries = kcalloc(nreq, sizeof *entries, GFP_KERNEL); if (!entries) goto no_msi;