Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp991189ybc; Tue, 19 Nov 2019 12:35:38 -0800 (PST) X-Google-Smtp-Source: APXvYqwIX+MRgslqc690Pf8/8v0RXTLwMVVvDBBE3fkQqTAHmDA+hSts9yaBkZqJNgUJq9y8pHZN X-Received: by 2002:adf:e803:: with SMTP id o3mr40185646wrm.326.1574195738568; Tue, 19 Nov 2019 12:35:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574195738; cv=none; d=google.com; s=arc-20160816; b=cvNuJRb64EWLFgGetLEH6jnRkJk084Q8ChnHmuVEu4V+JfxWz3Bz/RieisWoib8Hbv DHZ0cWfTqzk0QdASil92oetCkyaLoNHHJxb/d/duLTwte+JGTyL6Uv6gi4NcSbVodv/G gpiX4dOSC0FN7JUW9UzhiLRmftxx+MAo3spAysxq6s/rB5t8vXTAzVx3fWJJHKQXSBbn uCzxyxlWM8PiXUnfrJ74jsIN77eQMO7YA/C5/BjZ0Zu9kReVwUNQN2oyOxKIbXlK8+Fk fJVOwjXvMRHC++VfvbW7jGb4D9gqozlN2FTCphCP3gYXtt8a+4V0/6JxwmpT8+DW4Ovl uAoQ== 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=ffL3XiM0LtkLjeoyTC4fynmObhqLJBu0oAAkB1Sv6bg=; b=e2PxGrlUsV/zADnOYffGxNelR7q8zNR0iKZAIzU6smAps2mI+xmmT3jxFMsBZmb3HM x3TMIxyTLiii6Qc0jjORdwm5rC/spozXVHhEV1A/8ei6Q0zRATjvBEBBrtNNKCjM4BZI JJVBh4cTePb3aDpznfFz4AAIqoSKObNAg4hLqcTLmggrLVxIPHXHb3UiBgGIcZitvPms fUvjl439O2WfKP0NSapsvdfIe114PxRIFbTyNET74bqW9EhuDkkLcjyYw0hiYyVNUI4v RDTo5UCR/1dBsm5lTcRZ/EThDEOzTVLLeJ+SgS33MKupzTG5mw/6o5roI3XIMHfGU8ki 3/6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=QQpEdvQr; 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 c31si16225268edb.56.2019.11.19.12.35.13; Tue, 19 Nov 2019 12:35:38 -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=QQpEdvQr; 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 S1727348AbfKSUbl (ORCPT + 99 others); Tue, 19 Nov 2019 15:31:41 -0500 Received: from mail-qk1-f195.google.com ([209.85.222.195]:37238 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726711AbfKSUbl (ORCPT ); Tue, 19 Nov 2019 15:31:41 -0500 Received: by mail-qk1-f195.google.com with SMTP id e187so19141078qkf.4 for ; Tue, 19 Nov 2019 12:31:39 -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=ffL3XiM0LtkLjeoyTC4fynmObhqLJBu0oAAkB1Sv6bg=; b=QQpEdvQrv3VxEyEYawc6fHFuZTPgaWu6FsHVD1e1ezyhaWuRpUshlK+MeazAk2Yb5c WdHqQAt7ivBcTNSFX+SeqsrF/JATfpYGHbtKF9ZWf/kyX3NaiwyEQMwEL1nkfMSCAwYZ t4OIx6yol25quBvST7aX7t+bwogjXEt24v+18KV7WVflf5ZgdKKOBb1IJsebR8NVP7MP 03sq5wcV+rHoLsGqOZhto/2fT/FHkbdJD+L0KtvgjAaXKCGBqOT1pcW4JFQcZWrCjMLx ADqyaSIsUC/Vs7bEx9q9hfSBfSAD83fckZKmhgYBNkAHRMgRj9Teu0ct9fKFBDZsDIhs MmZQ== 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=ffL3XiM0LtkLjeoyTC4fynmObhqLJBu0oAAkB1Sv6bg=; b=CyB75FRiApcRuSlPpekRAo4OQbqysrCwKGD5wJFTw4in6uVBpdXOcgk1hnLoNZq+yZ siAyWGDeaU6y/bDMft2BWshoqwRlP1ggZDoqb1HrWZtD/lcRg1mcC6DRxyFeOJZH01mE +PaOm7kP0TUBpEjw11uKRiXPlXJ8VyebZsoaZdC7WBTKDOu8OsJ5AkPhxWIWHm9XbHQn AdxRnesY1Zd9uQbuSqXeBrfpq6wQxlcUrRi4uEaPfbvTPMi+oX2ZvmFMNlPC8FaiWrNq QHb51lWDT2LaeRlseRasU6MpWaNQEshgN6qwgmV7JBCutBLDmBza78jRkSt/wsOz2zLn xFxg== X-Gm-Message-State: APjAAAXw5NwPzKxFcTJBS8idHbjGtKSSRgHi2vwTzHOIIYgPCpFG8Qr/ CW50ldZM8enHE4YmcYDMDUOVEA== X-Received: by 2002:a05:620a:1375:: with SMTP id d21mr1191457qkl.285.1574195499276; Tue, 19 Nov 2019 12:31:39 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-113-180.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.113.180]) by smtp.gmail.com with ESMTPSA id k199sm10614778qke.0.2019.11.19.12.31.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Nov 2019 12:31:38 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1iXA9y-0003RM-6w; Tue, 19 Nov 2019 16:31:38 -0400 Date: Tue, 19 Nov 2019 16:31:38 -0400 From: Jason Gunthorpe To: rao Shoaib Cc: monis@mellanox.com, dledford@redhat.com, sean.hefty@intel.com, hal.rosenstock@gmail.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] Introduce maximum WQE size to check limits Message-ID: <20191119203138.GA13145@ziepe.ca> References: <1574106879-19211-1-git-send-email-rao.shoaib@oracle.com> <1574106879-19211-2-git-send-email-rao.shoaib@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1574106879-19211-2-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, Nov 18, 2019 at 11:54:38AM -0800, rao Shoaib wrote: > From: Rao Shoaib > > Introduce maximum WQE size to impose limits on max SGE's and inline data > > Signed-off-by: Rao Shoaib > drivers/infiniband/sw/rxe/rxe_param.h | 3 ++- > drivers/infiniband/sw/rxe/rxe_qp.c | 7 +++++-- > 2 files changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h > index 1b596fb..31fb5c7 100644 > +++ b/drivers/infiniband/sw/rxe/rxe_param.h > @@ -68,7 +68,6 @@ enum rxe_device_param { > RXE_HW_VER = 0, > RXE_MAX_QP = 0x10000, > RXE_MAX_QP_WR = 0x4000, > - RXE_MAX_INLINE_DATA = 400, > RXE_DEVICE_CAP_FLAGS = IB_DEVICE_BAD_PKEY_CNTR > | IB_DEVICE_BAD_QKEY_CNTR > | IB_DEVICE_AUTO_PATH_MIG > @@ -79,7 +78,9 @@ enum rxe_device_param { > | IB_DEVICE_RC_RNR_NAK_GEN > | IB_DEVICE_SRQ_RESIZE > | IB_DEVICE_MEM_MGT_EXTENSIONS, > + RXE_MAX_WQE_SIZE = 0x2d0, /* For RXE_MAX_SGE */ This shouldn't just be a random constant, I think you are trying to say: RXE_MAX_WQE_SIZE = sizeof(struct rxe_send_wqe) + sizeof(struct ib_sge)*RXE_MAX_SGE Just say that > RXE_MAX_SGE = 32, > + RXE_MAX_INLINE_DATA = RXE_MAX_WQE_SIZE, This is mixed up now, it should be RXE_MAX_INLINE_DATA = RXE_MAX_WQE_SIZE - sizeof(rxe_send_wqe) > diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c > index aeea994..323e43d 100644 > +++ b/drivers/infiniband/sw/rxe/rxe_qp.c > @@ -78,9 +78,12 @@ static int rxe_qp_chk_cap(struct rxe_dev *rxe, struct ib_qp_cap *cap, > } > } > > - if (cap->max_inline_data > rxe->max_inline_data) { > + if (cap->max_inline_data > > + rxe->max_inline_data - sizeof(struct rxe_send_wqe)) { > pr_warn("invalid max inline data = %d > %d\n", > - cap->max_inline_data, rxe->max_inline_data); > + cap->max_inline_data, > + rxe->max_inline_data - > + (u32)sizeof(struct rxe_send_wqe)); Then this isn't needed And this code in the other patch: + 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; Makes sense as both max_inline_data and 'init->cap.max_send_sge * sizeof(struct ib_sge)' are exclusive of the wqe header Jason