From patchwork Fri Feb 16 00:39:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adit Ranadive X-Patchwork-Id: 10223959 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 2B71A60325 for ; Fri, 16 Feb 2018 00:45:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C3562957A for ; Fri, 16 Feb 2018 00:45:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10EFB2957C; Fri, 16 Feb 2018 00:45:47 +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 5964C2957A for ; Fri, 16 Feb 2018 00:45:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756844AbeBPApo (ORCPT ); Thu, 15 Feb 2018 19:45:44 -0500 Received: from mail-cys01nam02on0043.outbound.protection.outlook.com ([104.47.37.43]:20352 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756813AbeBPApl (ORCPT ); Thu, 15 Feb 2018 19:45:41 -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=Z1JyOFIpcRgxtPu4OAoYNjsepEOP6ohSXQ6ap7+HqRo=; b=bNE1ohLzcoEbihOD4mRvVMEfcmzvU96fV0aouMmFe9lQFGjIwrEczA1YV7wwYpvaqZg4YOINRGGOFX+RmhS7L/gDWZVUXPcafLlRKcr9x+ERtofL6tnnq6/rb1zlAcZolbQZxKRywJXiGUbL2oN4v0DhdCu3y1/O+kvfZM0pnPk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aditr@vmware.com; Received: from gandalf.eng.vmware.com (208.91.1.34) by BN1PR05MB486.namprd05.prod.outlook.com (2a01:111:e400:31::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.6; Fri, 16 Feb 2018 00:45:35 +0000 From: Adit Ranadive To: dledford@redhat.com, jgg@mellanox.com, linux-rdma@vger.kernel.org Cc: Adit Ranadive , stable@linux-rdma.org Subject: [PATCH] vmw_pvrdma: Avoid rounding up of sge count to power of 2 Date: Thu, 15 Feb 2018 16:39:52 -0800 Message-Id: <1518741592-12723-1-git-send-email-aditr@vmware.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [208.91.1.34] X-ClientProxiedBy: CY1PR07CA0027.namprd07.prod.outlook.com (2a01:111:e400:c60a::37) To BN1PR05MB486.namprd05.prod.outlook.com (2a01:111:e400:31::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dee6b411-aba8-4780-af76-08d574d697ad X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:BN1PR05MB486; X-Microsoft-Exchange-Diagnostics: 1; BN1PR05MB486; 3:PspGzt0KJ95IFSiOirzxD2dpOlz0gSX/vFNXGLIpFbg7qw2CZ+Ul/4bwj8SXKZAmI/BOgK0yPNkDZ0sknDE0xVPB/HVkiHtcURcbRhMA4hwMwfi2K9GrnM+6Kyxt+hAhcdTVGv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pirpJyTebiN+Ga+vkg1lZWlAi1Uzyg6z0nlR+Q8NorpBB0252MmeLz9SN4XYUSm5h1NBZxWuCEkGRhpAs2w/4YmF6c7Ia0gl8hYuXKuDPIMPp/RFPH28w80nDzqVzxJdANunhXhqk+0q2tQ8YhgDnd3TsfrKSg+3ejp0T9Y3ADvCqmu8y2NjIMN0d31eI3QoByBq5MgYtgZKLKVZ4n5xOpUWkFylju+/4PH; 4:898gECr/pYIwj5WZV6fF/kXOnzMC3CCnHckYk8YW1itFgoYk1F8rAZyhPkUrR2EzpFXWCcC6CVAOgp8v2LfOOLRVG+RqIMIBqbgBM/+nnLS042Owtu4a0oAz8TaN8xTQU6AAMj3X0kjlJa/H1GHDNp1d2QD+NM130TDZc7icUJQI62M3S3+XRfnMeIsIleykVYH99keaVFziz7Szj0NFFF6zjqafIabvLd4fP3e7h2WvehGYGxPp+WhGcsBbPfmEVCWJFVcxhv/mIqmGegVi6BHdxBBOsXHQklFJ5lD/Y6vWUu58Ba6Cg4msAzWx3AO8 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231101)(944501161)(10201501046)(3002001)(6041288)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:BN1PR05MB486; BCL:0; PCL:0; RULEID:; SRVR:BN1PR05MB486; X-Forefront-PRVS: 0585417D7B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(346002)(39380400002)(376002)(366004)(396003)(189003)(199004)(97736004)(48376002)(4326008)(50226002)(6666003)(6486002)(8676002)(8936002)(68736007)(106356001)(53936002)(478600001)(81156014)(81166006)(2906002)(105586002)(316002)(5660300001)(25786009)(1857600001)(51416003)(52116002)(7736002)(7696005)(305945005)(386003)(16586007)(26005)(186003)(6116002)(3846002)(36756003)(86362001)(66066001)(50466002)(16526019)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR05MB486; H:gandalf.eng.vmware.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR05MB486; 23:DH8DWZwRMM7vRIdSPWB6Jh+/V5Mb4y3BZXhQl+NpQl?= =?us-ascii?Q?Sc8EISigtnkqXvX5q9O7PHgcxT7DwbOAk3WWFDC/1FalaVVjfL9zsnxojDeU?= =?us-ascii?Q?Ojcomln+LjtYkaMMJo5h7dT8ZGsm6PHlo7OrsdOIteFGwYPL3uSw7uK0bxRt?= =?us-ascii?Q?1kyPGp+k0iYXaK/jeJqwjGmIHU6VMGXXcHv89pyBNURf5/OLXst63KDwOf0M?= =?us-ascii?Q?szxQ3pXV5S/GUGnhSg2W//0hio/g3Q2XBtOmnUD5pXnsv/qMftldMCn4SKrA?= =?us-ascii?Q?oGXW9PtgwMJZADsa1KDz/5iCVcxrot36kFdbSRTDPaIm457pT+0zHiLNk4Cj?= =?us-ascii?Q?AO02VwdenLJaLs9ED4oikQ5dANZLu5nnEGYjph2KzJPGgnWHpBLaZKBjvKQl?= =?us-ascii?Q?Wu/IjYjKzlkOvkbRteKjNlfx7CkVhnEeGtyM9V2scbsKYRD0zgYXfb1DoAWy?= =?us-ascii?Q?RW88P9bvks48qzyPnsiFxELzsfeDYw7AZajVijHGO6c5AhPDCzkSSPwr9EMW?= =?us-ascii?Q?OYb6cn6jrqKD22gV9DwKy7U7rrut2yTopBNGsQ2gY3VgVhoMM5UeDcYwFlpi?= =?us-ascii?Q?CDbalIto4kzbQ5r0I9inZyuCUgQJaL5Rf4999LQkO2zF9N/cwcSOBhMeVsxO?= =?us-ascii?Q?RCrTnktiqfZQDNuq00uD4rav4DXp7ROpxQRlMDV6cuy7XPLAXfQu61lAz1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1hzKMrs2+iYIkzHXf7S4sFyVnmrGiEaC6jGZ2SrPwnoVVo+BMjlRYp+o4/BxfU=; 7:N2IiWFvMjnLVwKctp5ZvJGWvSWWAO+/GgMzJjLubgoko2WOPPlU/CNo6FvLoqZu2QawV4XStjFTh9fUD5XzkCVBdVQLS76UU2FI3EtpIj48Ndt906HGxWZBZS78XEMGEm5dhrcU/ca9ekPQIfyd/hjt13kmE1ylPhKV8tfgpFJspLY0ruv1GVq386ECM4mM4cCR0BDXxkbaPekFgVH+p95wvsMCTl4J0GDdmWgvdiW/9NKC2900CUyQh1Qt7GX0D SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR05MB486; 20:OHXIMoQJSh5VYFxaqpT+UvKMZR/nkUc+wYwobMHyFHNOJsoc5vt1aiJOJQoENxOGZAwrklEE34SGWh9zME+e/yA7RjZs8lMs3ySqFaG2/2oLvw7aeU0FoVgsslSTsF1O2ytBsoOROjIICSzHkIREFNQrHTgRKyz0ApEMj+gvxbo= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2018 00:45:35.0296 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dee6b411-aba8-4780-af76-08d574d697ad X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR05MB486 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 Creation of resources can fail if the rounding up exceeds provider supported values. Fixes: 4c8ed14eb6b7 ("vmw_pvrdma: Add SRQ support") Reviewed-by: Bryan Tan Reviewed-by: Nitish Bhat Signed-off-by: Adit Ranadive Cc: stable@linux-rdma.org --- providers/vmw_pvrdma/qp.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/providers/vmw_pvrdma/qp.c b/providers/vmw_pvrdma/qp.c index efcc99b..4b9f897 100644 --- a/providers/vmw_pvrdma/qp.c +++ b/providers/vmw_pvrdma/qp.c @@ -113,7 +113,7 @@ struct ibv_srq *pvrdma_create_srq(struct ibv_pd *pd, int ret; attr->attr.max_wr = align_next_power2(max_t(uint32_t, 1U, attr->attr.max_wr)); - attr->attr.max_sge = align_next_power2(max_t(uint32_t, 1U, attr->attr.max_sge)); + attr->attr.max_sge = max_t(uint32_t, 1U, attr->attr.max_sge); srq = malloc(sizeof(*srq)); if (!srq) @@ -216,14 +216,12 @@ struct ibv_qp *pvrdma_create_qp(struct ibv_pd *pd, int ret; int is_srq = !!(attr->srq); - attr->cap.max_send_sge = - align_next_power2(max_t(uint32_t, 1U, attr->cap.max_send_sge)); + attr->cap.max_send_sge = max_t(uint32_t, 1U, attr->cap.max_send_sge); attr->cap.max_send_wr = align_next_power2(max_t(uint32_t, 1U, attr->cap.max_send_wr)); if (!is_srq) { - attr->cap.max_recv_sge = - align_next_power2(max_t(uint32_t, 1U, attr->cap.max_recv_sge)); + attr->cap.max_recv_sge = max_t(uint32_t, 1U, attr->cap.max_recv_sge); attr->cap.max_recv_wr = align_next_power2(max_t(uint32_t, 1U, attr->cap.max_recv_wr)); } else {