Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6807115ybl; Wed, 15 Jan 2020 10:28:31 -0800 (PST) X-Google-Smtp-Source: APXvYqyKE1mmCLIIPH0/ZyyYUNxGX6Wruh8Y80Ci3k7Lw8E2gQ+BnlSr8+LHbB78cqNe9UonFzoY X-Received: by 2002:a05:6830:11d2:: with SMTP id v18mr3870541otq.151.1579112911135; Wed, 15 Jan 2020 10:28:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579112911; cv=none; d=google.com; s=arc-20160816; b=IqJLIrI5Iq4xx7yHwU3/X6W/2i10QnjIS7THC/EEqh1X4+K1UdiJOEY9FwQCDxgMwz qAzSYxEkvXAsd9wl0I9JauNYm5WNpOFobxyCVX0FcVt6AIcaxL3Wc5tG5A0/c8qHnEe7 ptKAm/O/LqeyTN+of/Vy3lZ7LiIEOBzjOwUxLehgvxflokcJK0eYxhaza2kPId7bn1O5 2f4JNgR8QjGl2gzWDj6MXEeXDlvqdmeZNfiW9rOGcD7uEMWQXND8J97qV+GSGgqspp7B suli+rffWkco7pmzCz07ipDk1fDTpBOmJQ/xiQH7Roip/2dGjjki7VKLNtoHBLdNuYmP lENA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=nQJ4n7Imvc45CINTxiOSO7su9csn5NiNHGyhEXcXKpA=; b=yewYyoOa0iO4vHNeuRFfPXj1T4e1gYa5aeYjLmv2eA0u4Rbf7boDk1TawKp57ErB6Y ULMxQWpLyJWegGqILd3D9bTt4GdvoMyn7g9xUref4VOcOtp2hshZUK1dRaJA++10VWxp e3k/rZNZ7i8D2awpH/F44SQ2SGzy6MuExw0yBX8EBPlkpW2QRo7wbu4QDSYX7CluiQ/e xcPNsu7FsUhmUzibGKsl3TEHtJiv9N97RNBWjgkL0zpAFdHhCODtvnS/Bgs4IJ+mGE5M QzXDdcyHzL3hfMrHKkCPWhdfeG/7kRVfaZwUO7iBxjBSBbv19tKDqTb0ONal57qSDjON l8LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="PWfe/8B1"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si11586000otk.185.2020.01.15.10.28.19; Wed, 15 Jan 2020 10:28:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="PWfe/8B1"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729214AbgAOS1Y (ORCPT + 99 others); Wed, 15 Jan 2020 13:27:24 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:43525 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729081AbgAOS1X (ORCPT ); Wed, 15 Jan 2020 13:27:23 -0500 Received: by mail-qt1-f194.google.com with SMTP id d18so16614236qtj.10 for ; Wed, 15 Jan 2020 10:27:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nQJ4n7Imvc45CINTxiOSO7su9csn5NiNHGyhEXcXKpA=; b=PWfe/8B1+aSqhrwQGQmtkMFUT5fR4OyKzUJlXMFoPW6bmaGMdbpBAwiMekAoGR486w ERc4rKwrgN8NhKWCPBemLfh3viO7WUy/r/66W2AwS/aF++kvAk9aZPNapJZQHYxw5UYA cZgjs4jOglZqmBlOdzNAWjL3jxc9OB7/kQ/RAQjEPACY9zWh+ZW5JW0LELCvHDOS8Zam 6Tg95meXrJ9LlxsISeKrzyC3tzO+8TBa7I5Xd4eMfyCKBWE3vVh4fP3PJbNftkqzyGGa CaOKFDy3QlZ8YKYI57vmda7sHqIVjffIXbBjYqBTJIbwjxAViuNsjB8Q1v+L3jtTwCRi njTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nQJ4n7Imvc45CINTxiOSO7su9csn5NiNHGyhEXcXKpA=; b=rBg7xMmIdZcFpcnWLruG+4De0Dx8AfV6ldimBWiiqnCXLKVOloSC/gHU6CNZ5AkQco mplGSRQKB+YWoHdz6DiqQsERxvzhqn8/LEzMpPH8FU15+tkIAIGwzjvhWs/mAxz/XfU7 jF5QlEMJPnX5BRn1bNaTdRHDxxcxfgGl531uV83NcO1TtA+qeFeCiiihKTpvcdthnAH5 YawHfA+IkPOmTRrHWObEjKM1PZsARospS52LHnuhRy73BadxXrUse6ocVfpC7d2hIICQ gdylrJT33+m0FgDhw2/5mP7zeOHVdtKZyCPJTjUqhCdZHaaVWU+imoMDlZT/nm6WD0oO yupw== X-Gm-Message-State: APjAAAUEZUuUIeDHSjrvNeRMabsmnLK9LilYdB8daAd/qo+YkB3+Ifak PctR9vRYFd3L9HCTSgE5G9NvT3CNcpU= X-Received: by 2002:ac8:7586:: with SMTP id s6mr4834838qtq.309.1579112842544; Wed, 15 Jan 2020 10:27:22 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-68-57-212.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.57.212]) by smtp.gmail.com with ESMTPSA id b24sm9783378qto.71.2020.01.15.10.27.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Jan 2020 10:27:22 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1irnNx-000721-Kr; Wed, 15 Jan 2020 14:27:21 -0400 Date: Wed, 15 Jan 2020 14:27:21 -0400 From: Jason Gunthorpe To: rao Shoaib Cc: linux-rdma@vger.kernel.org, monis@mellanox.com, dledford@redhat.com, sean.hefty@intel.com, hal.rosenstock@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/2] SGE buffer and max_inline data must have same size Message-ID: <20200115182721.GE25201@ziepe.ca> References: <1578962480-17814-1-git-send-email-rao.shoaib@oracle.com> <1578962480-17814-3-git-send-email-rao.shoaib@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1578962480-17814-3-git-send-email-rao.shoaib@oracle.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 13, 2020 at 04:41:20PM -0800, rao Shoaib wrote: > From: Rao Shoaib > > SGE buffer size and max_inline data should be same. Maximum of the > two values requested is used. > > Signed-off-by: Rao Shoaib > drivers/infiniband/sw/rxe/rxe_qp.c | 23 +++++++++++------------ > 1 file changed, 11 insertions(+), 12 deletions(-) > > diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c > index aeea994..41c669c 100644 > +++ b/drivers/infiniband/sw/rxe/rxe_qp.c > @@ -235,18 +235,17 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, > return err; > qp->sk->sk->sk_user_data = qp; > > - qp->sq.max_wr = init->cap.max_send_wr; > - qp->sq.max_sge = init->cap.max_send_sge; > - qp->sq.max_inline = init->cap.max_inline_data; > - > - wqe_size = max_t(int, sizeof(struct rxe_send_wqe) + > - qp->sq.max_sge * sizeof(struct ib_sge), > - sizeof(struct rxe_send_wqe) + > - qp->sq.max_inline); > - > - qp->sq.queue = rxe_queue_init(rxe, > - &qp->sq.max_wr, > - wqe_size); > + wqe_size = max_t(int, init->cap.max_send_sge * sizeof(struct ib_sge), > + init->cap.max_inline_data); > + qp->sq.max_sge = wqe_size/sizeof(struct ib_sge); > + qp->sq.max_inline = wqe_size; > + > + wqe_size += sizeof(struct rxe_send_wqe); Where does this limit the user's request to RXE_MAX_WQE_SIZE ? I seem to recall the if the requested max can't be satisified then that is an EINVAL? And the init->cap should be updated with the actual allocation. So more like: if (init->cap.max_send_sge > RXE_MAX_SGE || init->cap.max_inline_data > RXE_MAX_INLINE) return -EINVAL; wqe_size = max_t(int, init->cap.max_sge * sizeof(struct ib_sge), init->cap.max_inline_data) sizeof(struct rxe_send_wqe); qp->sq.max_sge = init->cap.max_send_sge = wqe_size/sizeof(struct ib_sge); qp->sq.max_inline = init->cap.max_inline_data = wqe_size; wqe_size += sizeof(struct rxe_send_wqe); Jason