From patchwork Wed Nov 10 12:52:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 314202 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oAACqefF012824 for ; Wed, 10 Nov 2010 12:52:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755853Ab0KJMwj (ORCPT ); Wed, 10 Nov 2010 07:52:39 -0500 Received: from mail-wy0-f174.google.com ([74.125.82.174]:61693 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755784Ab0KJMwj (ORCPT ); Wed, 10 Nov 2010 07:52:39 -0500 Received: by wyb36 with SMTP id 36so638992wyb.19 for ; Wed, 10 Nov 2010 04:52:36 -0800 (PST) Received: by 10.216.235.211 with SMTP id u61mr7578565weq.91.1289393555775; Wed, 10 Nov 2010 04:52:35 -0800 (PST) Received: from localhost ([82.166.227.17]) by mx.google.com with ESMTPS id w84sm402757weq.44.2010.11.10.04.52.34 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 10 Nov 2010 04:52:35 -0800 (PST) Date: Wed, 10 Nov 2010 14:52:37 +0200 From: Eli Cohen To: Roland Dreier Cc: RDMA list Subject: [PATCH] mlx4_core: Workaround firmware bug in query dev cap Message-ID: <20101110125237.GA12324@mtldesk30> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 (demeter1.kernel.org [140.211.167.41]); Wed, 10 Nov 2010 12:52:40 +0000 (UTC) diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c index 2327f9e..f1bfa8d 100644 --- a/drivers/net/mlx4/fw.c +++ b/drivers/net/mlx4/fw.c @@ -299,6 +299,10 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) MLX4_GET(field, outbox, QUERY_DEV_CAP_LOG_BF_REG_SZ_OFFSET); dev_cap->bf_reg_size = 1 << (field & 0x1f); MLX4_GET(field, outbox, QUERY_DEV_CAP_LOG_MAX_BF_REGS_PER_PAGE_OFFSET); + if ((1 << (field & 0x3f)) > (PAGE_SIZE / dev_cap->bf_reg_size)) { + mlx4_warn(dev, "log blue flame is invalid (%d), forcing 3\n", field & 0x1f); + field = 3; + } dev_cap->bf_regs_per_page = 1 << (field & 0x3f); mlx4_dbg(dev, "BlueFlame available (reg size %d, regs/page %d)\n", dev_cap->bf_reg_size, dev_cap->bf_regs_per_page);