From patchwork Wed Mar 14 22:01:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10283645 X-Patchwork-Delegate: jgg@ziepe.ca 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 4490760621 for ; Wed, 14 Mar 2018 22:02:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21669286AB for ; Wed, 14 Mar 2018 22:02:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15D4C286AE; Wed, 14 Mar 2018 22:02:03 +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 68EF5286AB for ; Wed, 14 Mar 2018 22:02:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751390AbeCNWCB (ORCPT ); Wed, 14 Mar 2018 18:02:01 -0400 Received: from mail-ve1eur01on0062.outbound.protection.outlook.com ([104.47.1.62]:49181 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750779AbeCNWCA (ORCPT ); Wed, 14 Mar 2018 18:02:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=pWdf9wK4c73XjcmqcA3Me7gbJd/RKbTbS42T8+KKSoA=; b=x6QJoRPKWHobyKMFRkC2Bd3ti5T+EBP35F1f4L/FAJEIPKVhvfTY8/5rq6wXsvjHS/wetNf8FQlPkCH5DtwrgEIgedi+gU6IVt20pjnp4BG2g2aNZ+dKL5hTMJb+lQH6euLM3FboMM/V6xhp8D8yZZW5N1JA/CGT0ueoiPhWYXc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jgg@mellanox.com; Received: from mlx.ziepe.ca (174.3.196.123) by DB6PR0501MB2853.eurprd05.prod.outlook.com (2603:10a6:4:83::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.567.14; Wed, 14 Mar 2018 22:01:56 +0000 Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1ewET0-0003xU-HP; Wed, 14 Mar 2018 16:01:50 -0600 Date: Wed, 14 Mar 2018 16:01:50 -0600 From: Jason Gunthorpe To: Steve Wise , linux-rdma@vger.kernel.org Subject: [PATCH] RDMA/cxgb4: Use structs to describe the uABI instead of opencoding Message-ID: <20180314220150.GA15197@ziepe.ca> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [174.3.196.123] X-ClientProxiedBy: VI1P18901CA0020.EURP189.PROD.OUTLOOK.COM (2603:10a6:801::30) To DB6PR0501MB2853.eurprd05.prod.outlook.com (2603:10a6:4:83::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 388d8f87-d417-4b4e-d6b6-08d589f733fd X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB6PR0501MB2853; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2853; 3:1wX/F1KMQOOioFc5QH0opqZeRU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DYGr7RFJcoQjcvX1eEznceSXLvEnrtneDMgkeLRGjncNIDrjuDrsoDECrvjvWMcjohmIoYspqapmF4CvFPz2tYlB5k7+nk42OqUKaLUUQhnvr+gUaBMgr8f1kRRqnqBKn2e/heeKefxCvhxFZymseBXgnQGJFoD3m5KWgkusKokeP6BimuC/yaSmdxMLbzXAJ2Omi3trOiTIkerZ0f2yDJUjp6s+yefOMN1BaOLbMbuhGbLosZduw+iG+moyf0Gp68HfF7cW0gFTMi1kkbpUld194HuslfdpCgF0+wlgUH9FfbBsIY2wn/Zf8LftedcXJP93aqJ+HFwhLIqrlZ; 4:CQQ3Ql6tOan2DRX4GZYQp8V9EERK3XVz4iQzZPg0Xa98ntlRRwsZtlKoWYy6TiWavntfz6athAff7MLUkFa0XuCEN7lwqvuuLsW8N9nBHm8pzAWQIeRK6A9h/y+jS3dMnfi5yBLhwvGrbYjdBMgKN6TXfcv6SPulWztpuBgOEdy95VqAs2UAGSUZomExjM6VNQRcSZqPm+3izZhf7W2nco+OfRX9NVapeaTKRS+ic59rUJ4Qbf9Ym4HobSMak47s85QbyRyLiChEspkMXDSBtw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501244)(52105095)(3002001)(10201501046)(6055026)(6041310)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:DB6PR0501MB2853; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0501MB2853; X-Forefront-PRVS: 0611A21987 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(346002)(39850400004)(396003)(376002)(366004)(189003)(199004)(186003)(8936002)(47776003)(57986006)(66066001)(3846002)(1076002)(26005)(1857600001)(81156014)(81166006)(23726003)(83796002)(97736004)(6116002)(105586002)(46656002)(9746002)(478600001)(9786002)(2906002)(106356001)(36756003)(122856001)(86362001)(68736007)(50466002)(33896004)(53936002)(305945005)(69596002)(7736002)(52116002)(5660300001)(58126008)(16586007)(386003)(8676002)(316002)(9686003)(59450400001)(33656002)(18370500001)(24400500001)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0501MB2853; H:mlx.ziepe.ca; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB6PR0501MB2853; 23:zQaw4vAVqmguHrW8V6hi5yHTH0xwehgqp4almyY?= =?us-ascii?Q?8B2/GbX32akUUKpl+QN6vzsu74h/wFpgOxAfidnF9PZOoKCkyNApaKilptIO?= =?us-ascii?Q?bXFWPTbfU+TAal3TI6s3QBVcKumu4eFuRM3GFHm9LOJelG7yL/bPN0ikRMif?= =?us-ascii?Q?wCzMxlapw+v2sw1ESOv0LSOmY98xkBaqAAO4KYLNfUbz0AOMuEMp7JHnfFdd?= =?us-ascii?Q?dby0hojzzHhxIuf/FUccnahVFwhSBwI6JqsqtpnoRMCM5hoAxmE3lmYQs1wb?= =?us-ascii?Q?+Qh3ZfCb9zARdSyqJTVXXvorpsqDsZ9b73v5gP2GS/xF60GgPRl4TRM5uOlF?= =?us-ascii?Q?qxzfu0igJNyDDWBZGaKKI5spadss/vDHcCE/VjfhAPaaur/YW352TTH9kaBv?= =?us-ascii?Q?oEiSPc+vb01wMvKUS42pk8gUUNNWJOanVuS2mroYdv2prCEmxighA1Fk0V/k?= =?us-ascii?Q?S4cVSC8yMUo0G6Z0tvPmB5KIXPp6OS2YnZU0AiPe4AURrvSvh05M0EefoJF7?= =?us-ascii?Q?OM6AyQH7x3vIPMHufqx+Uy8zcrT1AwxynramBi+qgU1xZbrU5DZiopcgw6Dx?= =?us-ascii?Q?TbMnTnpZ+8sRRsV7F/F7bnY6og65gJA8AHyUC6+m5wBmGSS9mJ8J6O0e+GLO?= =?us-ascii?Q?IqNbqypR4Y6JVFJYJFmDgPEWeyfLE/28TRi9OhMUvvAFvbkYfQEWyY8GXvqt?= =?us-ascii?Q?Td8mlPkRZ24RFGuBh+jB0zB7kQYLCvNrsssWwIN0jsG+S26UcM0XUanUrC3E?= =?us-ascii?Q?+051pre3tQh0nImHGd4V1GNwF+SPouji7bdAWtplor2G7thIk4kifQrKmKIJ?= =?us-ascii?Q?jttC/Au9aHvuJ/hmF3SQrS7RvArW8SCilyOk0doip760+0SzE9O9RQVO5v/g?= =?us-ascii?Q?xXNnnVqRBZUG35UFV4MNnFjzjIXtUfoj3Aq36Lmy0MlsoXD1s2oh9MtE8Q6V?= =?us-ascii?Q?8qpFXuvNPHpmjPiSyoEEuVCLJCtwLQsOYpB/gBYrgOWSn6jld3vYToGrc+1/?= =?us-ascii?Q?X3zaXaDepZb1eqJqxLZGC2Czx1cqSEQyG1ya5QtJ7pg8eNOWtCscDda2BGY8?= =?us-ascii?Q?o+AGkCHSiMYsa+Jr5WtdJ2/ayIm7g2AKlJVW8yyF4YDUDwSqSb7N/6qFyL/W?= =?us-ascii?Q?Z/gbyAcwR0d5xnaRZvnf/l0SD7FicvLPv+Fe2dCaTT4epd7iw+Q25vdgpuF0?= =?us-ascii?Q?Vo06yVzgJKwazqIoWbtIrGmMfIg143NRWnvxzlxazYyx/OnnscgzGGgy8WA?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Antispam-Message-Info: Bci3AvwXIaoZyx/9l+uSo2NeleiibRSONf3vgR0oXjsIBAaq4ETOEeTOwepL9B4Pxmp0ECC2Jw53T74WyfqeqfbFY+a/GGupW8uOMH6fbLgTS1oMK7lwGwkv+P0v0VeU6bJg9HeWGz8Sv9X5j2xM0rhgR247BImfWn6v5xL+XOjFvClYZwX2RN1J9851+izv X-Microsoft-Exchange-Diagnostics: 1; DB6PR0501MB2853; 6:0+cW7OYsm9bOLuj+dXCD1ZyNRCywW9bzJ0rRznS9xpMgbfRw/meQoFLlaII1qENAigxPf/8XWcvtf3irJJAMhUV/V+9Mi98Wbq5tZyRdJ/OLL1YyMpwiYent+Ib1DwSVPUJ7UEB3XDrbZMqgV3gNtrSLu+t2xq3VwaB/eA4vq5EdU2SLLYclROTKMvonOgSphPbDG/bbRtmxKj9f0FfvH3UXi5U0qLGHjb/rr0Izm6bw7qn+C3dsAW8//nMc3FlZJAKJvd6WTrs+BLF96IZ1SNhaFObf16upyh0dRJXKScR4Vh+DUSQ+5Wv9k/mluR9EYYKO0Zs2325wPEf+tarCQdlRi0dYx/i/9wN+NH5eyUs=; 5:SV50VT7ZK8CiNeTKIxpimoZjpp6ohZMKd/gG5MzMWmxAf/9sYBjOGwAbyPBrfnM624romV9TVtJE3uxB3j58gm/XIw++ATevBykWXmHRcyDrvTZoTlp6mM29h91UELTrdZ9auwJPwERSQM3+P8tkfncKj1klHdDuxqmfYCPaMf4=; 24:C42CCVF4K6HSX/jTKxBeTevzExxy9zhLXxMpOHILdacAEVXF6DquLaR97K/5G5Yj5yqIdo2Uh4zBdric25EtsYbJ109c0aZlKCXIUsL0QbY=; 7:E7m7b54rviAn6pZIWHlFO9pVys/sm0DMKDtj3u2NxtV0Ll+VjQvCrC+FYo2rnW27dVgaHQi0URUxM9z+771gWGM9cSv6o6Rsq4wjeEzS+UhipqTr3F9LSSUrzF28vRHLNrM3ug810qqVgkmYGx7wHiyr1G8jKq9Mt+EoZn7VNe1zEL/CA7Fss06i2tTs2Vvw4WtEYgTTYZI/KuO0DzXiU3rwBSzkBE69pSFBYargteV+6d+NDasDwAU9eBzFO2ok SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Mar 2018 22:01:56.2962 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 388d8f87-d417-4b4e-d6b6-08d589f733fd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0501MB2853 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 Open coding a loose value size is not acceptable for describing the uABI in RDMA. Provide the missing struct. Signed-off-by: Jason Gunthorpe Reviewed-by: Steve Wise --- drivers/infiniband/hw/cxgb4/provider.c | 4 +++- include/uapi/rdma/cxgb4-abi.h | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c index 1b5c6cd2ac4d5f..42568a4df3f83f 100644 --- a/drivers/infiniband/hw/cxgb4/provider.c +++ b/drivers/infiniband/hw/cxgb4/provider.c @@ -281,7 +281,9 @@ static struct ib_pd *c4iw_allocate_pd(struct ib_device *ibdev, php->pdid = pdid; php->rhp = rhp; if (context) { - if (ib_copy_to_udata(udata, &php->pdid, sizeof(u32))) { + struct c4iw_alloc_pd_resp uresp = {.pdid = php->pdid}; + + if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) { c4iw_deallocate_pd(&php->ibpd); return ERR_PTR(-EFAULT); } diff --git a/include/uapi/rdma/cxgb4-abi.h b/include/uapi/rdma/cxgb4-abi.h index 004e92b8366ef7..1fefd0140c26f6 100644 --- a/include/uapi/rdma/cxgb4-abi.h +++ b/include/uapi/rdma/cxgb4-abi.h @@ -79,4 +79,9 @@ struct c4iw_alloc_ucontext_resp { __u32 status_page_size; __u32 reserved; /* explicit padding (optional for i386) */ }; + +struct c4iw_alloc_pd_resp { + __u32 pdid; +}; + #endif /* CXGB4_ABI_USER_H */