From patchwork Thu Jan 16 18:30:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shoaib Rao X-Patchwork-Id: 11337557 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4212492A for ; Thu, 16 Jan 2020 18:32:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 20835206D9 for ; Thu, 16 Jan 2020 18:32:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="gAhyUALY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404885AbgAPScn (ORCPT ); Thu, 16 Jan 2020 13:32:43 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:39086 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404304AbgAPSck (ORCPT ); Thu, 16 Jan 2020 13:32:40 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00GI8ZCg056130; Thu, 16 Jan 2020 18:32:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2019-08-05; bh=Y7GYug0Y8XatejflsaiCwFHDIXRQgLFG06sMutgJGzc=; b=gAhyUALYvQYG/zDXlYZ3mvsab23rl3qGeP7/7OQVldBgergTPHSrMcEjEUFvIq4R7DEg 3Gjuaacl3ZByuSErbpcdUm7WJhdj1ODv4cPtyclAoM9Y0Fc0cT3uJ11LyMZkrVmgllv2 KyHHaEmtxuo0kd/JQnaQoN8sIBSjejjIuoa/a3SroS2ddygA+dHw1OaaT+1g2l/qvhdc 8w+Hp/LSZzjahXtQjuYlmuz4QCr3bpBuTyE9si5CgUTfLusknBHAC/F7ZLhn/bs//Mgk dY9wJtjGnEFNqJmd6dJbsj1QfplvqlaPaSNoel6JFviqzSW1JFMKbTFy4RUigE5/VI2q mw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2xf74sm9r3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jan 2020 18:32:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00GI9PML124446; Thu, 16 Jan 2020 18:30:31 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3020.oracle.com with ESMTP id 2xj1ptje07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 16 Jan 2020 18:30:31 +0000 Received: from userp3020.oracle.com (userp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id 00GIU9ew190457; Thu, 16 Jan 2020 18:30:30 GMT Received: from ca-dev107.us.oracle.com (ca-dev107.us.oracle.com [10.129.135.36]) by userp3020.oracle.com with ESMTP id 2xj1ptjdxt-2; Thu, 16 Jan 2020 18:30:30 +0000 From: rao Shoaib To: linux-rdma@vger.kernel.org Cc: jgg@ziepe.ca, monis@mellanox.com, dledford@redhat.com, sean.hefty@intel.com, hal.rosenstock@gmail.com, linux-kernel@vger.kernel.org, Rao Shoaib Subject: [PATCH v4 1/2] RDMA/rxe: use RXE_MAX_WQE_SIZE to enforce limits Date: Thu, 16 Jan 2020 10:30:11 -0800 Message-Id: <1579199412-15741-2-git-send-email-rao.shoaib@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1579199412-15741-1-git-send-email-rao.shoaib@oracle.com> References: <1579199412-15741-1-git-send-email-rao.shoaib@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9502 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=983 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001160147 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Rao Shoaib Introduce RXE_MAX_WQE_SIZE to impose limits on max SGE's and inline data size Signed-off-by: Rao Shoaib --- drivers/infiniband/sw/rxe/rxe_param.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h index 353c666..f59616b 100644 --- a/drivers/infiniband/sw/rxe/rxe_param.h +++ b/drivers/infiniband/sw/rxe/rxe_param.h @@ -34,6 +34,8 @@ #ifndef RXE_PARAM_H #define RXE_PARAM_H +#include + static inline enum ib_mtu rxe_mtu_int_to_enum(int mtu) { if (mtu < 256) @@ -64,7 +66,6 @@ enum rxe_device_param { RXE_PAGE_SIZE_CAP = 0xfffff000, 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 @@ -77,6 +78,10 @@ enum rxe_device_param { | IB_DEVICE_MEM_MGT_EXTENSIONS | IB_DEVICE_ALLOW_USER_UNREG, RXE_MAX_SGE = 32, + RXE_MAX_WQE_SIZE = sizeof(struct rxe_send_wqe) + + sizeof(struct ib_sge) * RXE_MAX_SGE, + RXE_MAX_INLINE_DATA = RXE_MAX_WQE_SIZE - + sizeof(struct rxe_send_wqe), RXE_MAX_SGE_RD = 32, RXE_MAX_CQ = 16384, RXE_MAX_LOG_CQE = 15, From patchwork Thu Jan 16 18:30:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shoaib Rao X-Patchwork-Id: 11337549 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 53FB4138D for ; Thu, 16 Jan 2020 18:30:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3295B2073A for ; Thu, 16 Jan 2020 18:30:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="BcoFKpG0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390764AbgAPSao (ORCPT ); Thu, 16 Jan 2020 13:30:44 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:37188 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388586AbgAPSan (ORCPT ); Thu, 16 Jan 2020 13:30:43 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00GI9Bg5056514; Thu, 16 Jan 2020 18:30:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2019-08-05; bh=W/xYyZuMQPUL8LywibdGc89gLisK7pTjwntsImkArLA=; b=BcoFKpG0AhmSGp9T+AI8JFScG9IIIytr2ntC33jVBVN4NeBq5TLiaFnK3DUe2/Rmhkdy bHwYJhQshTIdEDpYDX7XpNieDotmeBjXBHBYKKpbfk5HcNUWuzzaJVYZqyxnVQesrfyx uJVl5Zt901JcaDsmM2CIXfGp5uDZX4BmsryjCQc9bBJYgJaJBENrq6GJYV29MrX1s5j5 0bGerW/fjc2dbebgEoqV2R8vi3pJA8wGaYEkalF7SsHmqdL8WssBaRbWPv8v2wY8dfRT cexNqUHvIQTlA/7pjteT+IWOL9b+Tc41rKXlAowbX0FdoMDOnZNF4tbw41HrxLUFdLAW Dg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2xf74sm9ev-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jan 2020 18:30:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00GI9OLa124401; Thu, 16 Jan 2020 18:30:31 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3020.oracle.com with ESMTP id 2xj1ptje0p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 16 Jan 2020 18:30:31 +0000 Received: from userp3020.oracle.com (userp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id 00GIU9f0190457; Thu, 16 Jan 2020 18:30:31 GMT Received: from ca-dev107.us.oracle.com (ca-dev107.us.oracle.com [10.129.135.36]) by userp3020.oracle.com with ESMTP id 2xj1ptjdxt-3; Thu, 16 Jan 2020 18:30:31 +0000 From: rao Shoaib To: linux-rdma@vger.kernel.org Cc: jgg@ziepe.ca, monis@mellanox.com, dledford@redhat.com, sean.hefty@intel.com, hal.rosenstock@gmail.com, linux-kernel@vger.kernel.org, Rao Shoaib Subject: [PATCH v4 2/2] RDMA/rxe: SGE buffer and max_inline data must have same size Date: Thu, 16 Jan 2020 10:30:12 -0800 Message-Id: <1579199412-15741-3-git-send-email-rao.shoaib@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1579199412-15741-1-git-send-email-rao.shoaib@oracle.com> References: <1579199412-15741-1-git-send-email-rao.shoaib@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9502 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001160147 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org 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 | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c index e2c6d1c..d29d1a8 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -238,18 +238,22 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp, qp->src_port = RXE_ROCE_V2_SPORT + (hash_32_generic(qp_num(qp), 14) & 0x3fff); - 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); + /* values for max_send_sge and max_inline_data have already been + * checked in rxe_qp_chk_cap() to make sure they are within limits. + */ + 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; + init->cap.max_inline_data = qp->sq.max_inline; + init->cap.max_send_sge = qp->sq.max_sge; + + wqe_size += sizeof(struct rxe_send_wqe); + + qp->sq.max_wr = init->cap.max_send_wr; + + qp->sq.queue = rxe_queue_init(rxe, &qp->sq.max_wr, wqe_size); + if (!qp->sq.queue) return -ENOMEM;