From patchwork Thu Feb 23 01:22:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adit Ranadive X-Patchwork-Id: 9587633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8781E6057F for ; Thu, 23 Feb 2017 01:24:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70BD428670 for ; Thu, 23 Feb 2017 01:24:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65B1528725; Thu, 23 Feb 2017 01:24:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5A8228733 for ; Thu, 23 Feb 2017 01:24:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932638AbdBWBYm (ORCPT ); Wed, 22 Feb 2017 20:24:42 -0500 Received: from mail-bl2nam02on0040.outbound.protection.outlook.com ([104.47.38.40]:25312 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933325AbdBWBYZ (ORCPT ); Wed, 22 Feb 2017 20:24:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onevmw.onmicrosoft.com; s=selector1-vmware-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=g688Iy3otkGXRV8CuoMRt//7x4fscAR9yXzm9oLgS6s=; b=aYdZtdF6QGCAYUWl6dqdcQSFQTztOxsFFBnfmrMynqz+1mg3WcFTWrIeLi85iCdEQAfLts7P1p7NiONaLXfWxzAmJOIMy8TxXI+rlQzWJselO9KQpbW/r0M/AjEbIpYSi5Hh+u704zlUpzHT4s26AzuFwGFd+u1MgY2RqB7yHw4= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=vmware.com; Received: from promb-2s-dhcp95-136.eng.vmware.com (208.91.1.34) by CO2PR05MB2421.namprd05.prod.outlook.com (10.166.95.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.933.7; Thu, 23 Feb 2017 01:23:19 +0000 From: Adit Ranadive To: , CC: Adit Ranadive , Subject: [PATCH 2/3] RDMA/vmw_pvrdma: Dont hardcode QP header page Date: Wed, 22 Feb 2017 17:22:57 -0800 Message-ID: X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [208.91.1.34] X-ClientProxiedBy: CY1PR1201CA0032.namprd12.prod.outlook.com (10.169.17.170) To CO2PR05MB2421.namprd05.prod.outlook.com (10.166.95.21) X-MS-Office365-Filtering-Correlation-Id: d87b987d-14fb-4e7b-733c-08d45b8a8cf3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CO2PR05MB2421; X-Microsoft-Exchange-Diagnostics: 1; CO2PR05MB2421; 3:poLYx3heZmpqBGwuL8s6M/vLD/zCygIvd5Cu5xFxQDiE9qYYdKisRG+5l0ldzLWt1xBwpF6OEGOMkmrZ+Pfl/agUpV4k4cfvZBCJYdu5s/4J4FouQdHc4hl5eul7qwmmB5KMyHbS8WVqJRKh2N4jjpbabQG2KQ87QRBvV6RY1UoTsf6lmab2mY0lkOP8uxOEq+lsZEQzzRJ4YnFmK12sf6zAZHuZVizwMeup5Y3cf1xBz/jiPA4P4dA4Gb/1a5BvX8I5e6F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/0Y4L9p4vYFqvAAtHj9nI5QtiV0awcBKL6glV3bqZXHyLrTwBxh9qgvolIrwYX4LOswMQbPv4RWA4e4gX3oEo/q5ZXLK6J8CVMCIN+USZHE6UluvcKfd8qmblI4RxIrvqpKlb+ujYLWXGjIdMn2cwTSB4hJsaCo7nnoSBjjVlvou/hmvi1HWNx7C58iMH45qgGT+B3Otk1Fv3b0pfSV4UC4z4TCoRCBAz6ExbGsbCcu80h X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150)(146099531331640); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123558025)(20161123560025)(20161123564025)(20161123555025)(20161123562025)(6072148); SRVR:CO2PR05MB2421; BCL:0; PCL:0; RULEID:; SRVR:CO2PR05MB2421; X-Microsoft-Exchange-Diagnostics: 1; CO2PR05MB2421; 4:mk0o/OqNichhLg+bBm99/yyB3nUnfcpVeBLhwnhYNcZA9hd5AEHhY7uNYvDn4iBJVUwAWITspK0qcpbFxZtvfHWW56vcI3XJj7D4pRK34a8Pq/WTHjdhV6F0IBtrnwuXittAlF60SAd3iQZZl46ZKlx4nErtoKEg6Hbg2malTZpu/BEUkSLuY8q1o/On+HDC4GBtsrE4/eBSJkFQbtM1iLmkiEXVNpCS8cTd1JP2mq8DyDjfQPNe8QnGEsHUV9B4a/I2ozr1xWYV5OO6ACPLfON2PnJNXbmM6ANMxn9kWDrn3HbVK9yo9QcGjadIPbcpQhDu5fWVCWKHY+GQ3i8NxIAACT6vEj1rI+3OiSWp7HP2Ver1Pj98MS5BAONTBRhhOIaegixDrKaPDHe5ay2bCY/t0z6u1okLWHqqZsGZy3GUxx/U2fEL7qkZcgjsC/b2t62f/fMCScaq885mpHXdUA8qAfuSrOLPwlfZZXVF5yKfrVP/sQW08zQf3earJtsaBsbUigvKlggcDR2ElKCi614T8MkelbZ5LxC/X1/58NBgEaW8mis2I/r/F+Vs+T2hxHTNprX3AuzfoO98m854CPLQOkJC7Xk5Tg7QZJ17MO/c+5opF9nVXVvrPmnSP8DgQDcYGEtxEQm+0T3++gG+Pmw11BDez+58x45z78QLqzK6KINq9K5PEHHQZVur0Omi X-Forefront-PRVS: 02272225C5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(36756003)(5660300001)(4326007)(47776003)(305945005)(66066001)(118296001)(50986999)(76176999)(7736002)(50226002)(2906002)(6486002)(8676002)(81166006)(25786008)(54906002)(3846002)(6116002)(48376002)(50466002)(42186005)(86362001)(92566002)(38730400002)(33646002)(107886003)(189998001)(5003940100001)(2950100002)(6666003)(53936002)(7099028)(192303002); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR05MB2421; H:promb-2s-dhcp95-136.eng.vmware.com; FPR:; SPF:None; MLV:nspm; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR05MB2421; 23:R0D0JDOwJQlYC1/XoHDzgh0WWYtuyMgDRF/t7nm4+?= =?us-ascii?Q?X5ym8SjThm8HeiE/SGi+Cj/gGLpVOxxVMVfp5oQnKsVrczBh4Eo0AKTaV/jU?= =?us-ascii?Q?FbcdXZeTUPIcqGI4mZ4x44iNwJflmOVnQ2tKAezSX44hT+4q9eW0mG0kZ6VC?= =?us-ascii?Q?RCRvxj0NhiSD/qs8nKhqq5zLqbCXS2MN4UaBEl20+4IQT5JAaFfz541jgj6m?= =?us-ascii?Q?Y4PzZEFkCuXtWvX6j8qukbWxeKbcWjx8ehKSeWuDYxhhsH22sGEaq1/R8jx0?= =?us-ascii?Q?ytp0tQ7GE9i5oOJb4XYDv64NY1KLL7p1/0daef8HCgOxak+RdF9kpib1UPKk?= =?us-ascii?Q?74Q+ASSjlq2imPo5XqAwSe/8dzmWp3rYGYYvG9yZxSkr+QAX2/HK7YEsTnfu?= =?us-ascii?Q?zDzfnhHj+hKXGD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toBwmI7pV3rJyt/uiEdR5PPI3N2Tz8phOoJn8fuXIlxhWM+M0RiqYP/5d8LA9v/A==; 5:tOQLJndGYK9k0ThvddDgmpPwkiIMjBRNlMZqX3YC+sj8KDBQVowYKSnK1Ej2be6VreBLLJfFK2a650229LDe8mmcMyjlHnjlwoq9NE3vYu/rJpIe1zkjR68tAd8q6v7++/tgzkUer+uuJey1hV4l9raCFRNt/VCuZXYX149VTeM=; 24:WnR8qyBgPytUWVxFJeDxt/QQSKHSZqzPlmct6tKEG8cTtBTuWKZO2N4cNyq5TU1qpHrPvMSN6O7LU71onLYLMV7r1H3ktmP85h4noz1//mA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR05MB2421; 7:jCmNrNe7vs7e/A6XjtrqmArJIrPzLvPm76/K8SMZgufUfEblCKhT2g27aQ3mG6SUFM8dPuqsApX+s0NAr7MtaPRjjiL6xftmSOmNaE1qBLv6ZrgF9FPCELan00bhatYdPAhEQy1w2SF9VJ3C3dEiBTpHXpif1GJJNvH2d0vnD51/lOf0ZlpeDc02b0/BsrQ9WL6KG8wk9s8wE2UUqjJulSdniUk4hbzbO2E16fEhlnrWxcYLidKSToiN15cZLiz8MSzZ2TnouNJAZDy+n3gGe1KZnA0fPbPS0xuZOgzJSvZMahxSEMzCkY4iQ4hyzlQJnEW480PNRAACnDodQpBkkA==; 20:T7hvmQbEUFnl4Hk0YYYrw9dAzKogqm4mXTO2AKohubQhIM+y8ftX7i8ipShPNHHqKkPLxFXvyOJs46S8a1NeOSOy0wNbRCt/ew4T7cBYxc5C6mMUAFHZDqnjTV4XbuToyS1Ba4dQZFbWfayRfDClKmGqMJ0KWJnCN/HJZTeEIdM= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2017 01:23:19.0598 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR05MB2421 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Moved the header page count to a macro. Reported-by: Yuval Shaia Signed-off-by: Adit Ranadive Reviewed-by: Aditya Sarwade Tested-by: Andrew Boyer --- drivers/infiniband/hw/vmw_pvrdma/pvrdma.h | 1 + drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h index dbf61c3..9fbe22d 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h @@ -70,6 +70,7 @@ #define PCI_DEVICE_ID_VMWARE_PVRDMA 0x0820 #define PVRDMA_NUM_RING_PAGES 4 +#define PVRDMA_QP_NUM_HEADER_PAGES 1 struct pvrdma_dev; diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c index 3ffbb2d..30062aa 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c @@ -170,8 +170,9 @@ static int pvrdma_set_sq_size(struct pvrdma_dev *dev, struct ib_qp_cap *req_cap, sizeof(struct pvrdma_sge) * qp->sq.max_sg); /* Note: one extra page for the header. */ - qp->npages_send = 1 + (qp->sq.wqe_cnt * qp->sq.wqe_size + - PAGE_SIZE - 1) / PAGE_SIZE; + qp->npages_send = PVRDMA_QP_NUM_HEADER_PAGES + + (qp->sq.wqe_cnt * qp->sq.wqe_size + PAGE_SIZE - 1) / + PAGE_SIZE; return 0; } @@ -288,7 +289,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd, qp->npages = qp->npages_send + qp->npages_recv; /* Skip header page. */ - qp->sq.offset = PAGE_SIZE; + qp->sq.offset = PVRDMA_QP_NUM_HEADER_PAGES * PAGE_SIZE; /* Recv queue pages are after send pages. */ qp->rq.offset = qp->npages_send * PAGE_SIZE; @@ -341,7 +342,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd, cmd->qp_type = ib_qp_type_to_pvrdma(init_attr->qp_type); cmd->access_flags = IB_ACCESS_LOCAL_WRITE; cmd->total_chunks = qp->npages; - cmd->send_chunks = qp->npages_send - 1; + cmd->send_chunks = qp->npages_send - PVRDMA_QP_NUM_HEADER_PAGES; cmd->pdir_dma = qp->pdir.dir_dma; dev_dbg(&dev->pdev->dev, "create queuepair with %d, %d, %d, %d\n",