From patchwork Wed Sep 29 10:09:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Cohen X-Patchwork-Id: 216832 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 o8TA8vRA011202 for ; Wed, 29 Sep 2010 10:09:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751478Ab0I2KJH (ORCPT ); Wed, 29 Sep 2010 06:09:07 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:35181 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750951Ab0I2KJH (ORCPT ); Wed, 29 Sep 2010 06:09:07 -0400 Received: by mail-fx0-f46.google.com with SMTP id 14so325107fxm.19 for ; Wed, 29 Sep 2010 03:09:06 -0700 (PDT) Received: by 10.223.124.4 with SMTP id s4mr1415356far.31.1285754946532; Wed, 29 Sep 2010 03:09:06 -0700 (PDT) Received: from localhost ([82.166.227.17]) by mx.google.com with ESMTPS id p2sm3673188fak.46.2010.09.29.03.09.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 29 Sep 2010 03:09:05 -0700 (PDT) Date: Wed, 29 Sep 2010 12:09:09 +0200 From: Eli Cohen To: Roland Dreier Cc: RDMA list Subject: [PATCH] libmlx4: Fix bug in mlx4_set_sq_sizes() Message-ID: <20100929100909.GB4960@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, 29 Sep 2010 10:09:08 +0000 (UTC) diff --git a/src/mlx4.h b/src/mlx4.h index 5223697..0d03e8e 100644 --- a/src/mlx4.h +++ b/src/mlx4.h @@ -367,4 +367,6 @@ int mlx4_alloc_av(struct mlx4_pd *pd, struct ibv_ah_attr *attr, struct mlx4_ah *ah); void mlx4_free_av(struct mlx4_ah *ah); +#define min(a, b) (a < b ? a : b) + #endif /* MLX4_H */ diff --git a/src/qp.c b/src/qp.c index 6ceb3ef..b70c54a 100644 --- a/src/qp.c +++ b/src/qp.c @@ -622,7 +622,8 @@ void mlx4_set_sq_sizes(struct mlx4_qp *qp, struct ibv_qp_cap *cap, { int wqe_size; - wqe_size = (1 << qp->sq.wqe_shift) - sizeof (struct mlx4_wqe_ctrl_seg); + wqe_size = min((1 << qp->sq.wqe_shift), MLX4_MAX_WQE_SIZE) - + sizeof (struct mlx4_wqe_ctrl_seg); switch (type) { case IBV_QPT_UD: wqe_size -= sizeof (struct mlx4_wqe_datagram_seg);