From patchwork Thu Sep 1 06:59:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Knut Omang X-Patchwork-Id: 9308415 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 7731E607D2 for ; Thu, 1 Sep 2016 07:00:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63033291E9 for ; Thu, 1 Sep 2016 07:00:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 575FE291FC; Thu, 1 Sep 2016 07:00:38 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 979BC291F0 for ; Thu, 1 Sep 2016 07:00:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754392AbcIAHAc (ORCPT ); Thu, 1 Sep 2016 03:00:32 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:40487 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754378AbcIAHA3 (ORCPT ); Thu, 1 Sep 2016 03:00:29 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8170RQR011487 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 1 Sep 2016 07:00:27 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u8170RCh018530 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 1 Sep 2016 07:00:27 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u8170L1m010600; Thu, 1 Sep 2016 07:00:26 GMT Received: from abi.no.oracle.com (/10.172.144.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 01 Sep 2016 00:00:21 -0700 From: Knut Omang To: Doug Ledford Cc: linux-rdma@vger.kernel.org, Mukesh Kacker , Knut Omang Subject: [PATCH libibverbs 2/3] Add padding to get proper end alignment of ibv_reg_mr_resp Date: Thu, 1 Sep 2016 08:59:52 +0200 Message-Id: <1472713193-22397-3-git-send-email-knut.omang@oracle.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1472713193-22397-1-git-send-email-knut.omang@oracle.com> References: <1472713193-22397-1-git-send-email-knut.omang@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] 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 The user/kernel level API requires all parameter blocks to be 64 bit end aligned. Also clean up some valgrind/memory initialization issues. Signed-off-by: Knut Omang Reviewed-by: Mukesh Kacker --- include/infiniband/kern-abi.h | 1 + src/cmd.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/infiniband/kern-abi.h b/include/infiniband/kern-abi.h index f70fa44..8bdeef5 100644 --- a/include/infiniband/kern-abi.h +++ b/include/infiniband/kern-abi.h @@ -367,6 +367,7 @@ struct ibv_reg_mr_resp { __u32 mr_handle; __u32 lkey; __u32 rkey; + __u32 reserved; }; struct ibv_rereg_mr { diff --git a/src/cmd.c b/src/cmd.c index 12d8640..a418ee1 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1470,6 +1470,7 @@ int ibv_cmd_create_ah_ex(struct ibv_pd *pd, struct ibv_ah *ah, struct ibv_ah_att IBV_INIT_CMD_RESP(cmd, cmd_size, CREATE_AH, resp, resp_size); cmd->user_handle = (uintptr_t) ah; cmd->pd_handle = pd->handle; + cmd->reserved = 0; cmd->attr.dlid = attr->dlid; cmd->attr.sl = attr->sl; cmd->attr.src_path_bits = attr->src_path_bits; @@ -1480,12 +1481,14 @@ int ibv_cmd_create_ah_ex(struct ibv_pd *pd, struct ibv_ah *ah, struct ibv_ah_att cmd->attr.grh.sgid_index = attr->grh.sgid_index; cmd->attr.grh.hop_limit = attr->grh.hop_limit; cmd->attr.grh.traffic_class = attr->grh.traffic_class; + cmd->attr.grh.reserved = 0; + cmd->attr.reserved = 0; memcpy(cmd->attr.grh.dgid, attr->grh.dgid.raw, 16); if (write(pd->context->cmd_fd, cmd, cmd_size) != cmd_size) return errno; - (void) VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp); + (void) VALGRIND_MAKE_MEM_DEFINED(resp, resp_size); ah->handle = resp->handle; ah->context = pd->context;