From patchwork Sun Oct 14 07:04:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shamir Rabinovitch X-Patchwork-Id: 10640563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 24DFF14BD for ; Sun, 14 Oct 2018 07:05:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16BA32A2BE for ; Sun, 14 Oct 2018 07:05:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B0662A2C7; Sun, 14 Oct 2018 07:05:13 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 A79FE2A2BE for ; Sun, 14 Oct 2018 07:05:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726362AbeJNOpM (ORCPT ); Sun, 14 Oct 2018 10:45:12 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:42574 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726385AbeJNOpM (ORCPT ); Sun, 14 Oct 2018 10:45:12 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9E742g7059583; Sun, 14 Oct 2018 07:05:08 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-2018-07-02; bh=v0DCn1qJdKuj70H7gqIZtBU/edMLDckcfJ+l/vEVmOo=; b=qDB9S1fstvLV3XbZA+0uXHtqm8YoNzjHBanBwMeO72s4X0ceUJU/AEs1tx4lIfE3LSR2 qmbtbnYP7xcwI9qmp7HjNal9n9S1dw0iK/MWyOS5eCWDhFdpAlOeyStCAi/xBvBcFwbc g42uh6tmNQWKXCKxjy8tll589eWsfjNgPiR5hjGTjlET9Brkftx2yf3Ct75zheVUyLb5 twnHhXCfTQ6sZQgTmz8rbBCTqE7XPfqsuEijfjRd0MXAlfW+m1r/PV0r1AUCMw40fq4k EnkzTFaWrvc00XVEI/S4Un4EzrOFPXPbC6bKCcDF6C/P7UcI3vVaDlu5I+20I+byBHDt ng== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2n384tmdyh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 14 Oct 2018 07:05:08 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w9E750hn015472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 14 Oct 2018 07:05:02 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9E750NK017733; Sun, 14 Oct 2018 07:05:00 GMT Received: from localhost.localdomain (/10.175.37.52) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 14 Oct 2018 07:04:59 +0000 From: Shamir Rabinovitch To: linux-rdma@vger.kernel.org Cc: dledford@redhat.com, jgg@ziepe.ca, leon@kernel.org, santosh.shilimkar@oracle.com, shamir.rabinovitch@oracle.com Subject: [PATCH v2 1/7] IB/verbs: add ib_ucontext to ib_udata Date: Sun, 14 Oct 2018 10:04:39 +0300 Message-Id: <20181014070445.4130-2-shamir.rabinovitch@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181014070445.4130-1-shamir.rabinovitch@oracle.com> References: <20181014070445.4130-1-shamir.rabinovitch@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9045 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810140068 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 ib_udata is used in (almost) all the places in the code that require ib_ucontext and can convey this information to the ib core and driver layers. Signed-off-by: Shamir Rabinovitch --- include/rdma/ib_verbs.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index ad116c5e6675..46fe51d0c6d1 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1532,8 +1532,36 @@ struct ib_udata { void __user *outbuf; size_t inlen; size_t outlen; + struct ib_ucontext *context; /* associated user context */ }; +/** + * _rdma_udata_context - Get ucontext from udata + * @udata: The udata object + * @warn: Warn true/false if ucontext is NULL + * + * NOTE: + * Most of the code should use rdma_udata_context which turn + * the NULL ucontext warning on. Use this function if you need + * to *test* if udata has ucontext and want to turn the warning + * off. + */ +static inline struct ib_ucontext *_rdma_udata_context(struct ib_udata *udata, + bool warn) +{ + WARN_ON(warn && !udata->context); + return udata->context; +} + +/** + * rdma_udata_context - Get ucontext from udata + * @udata: The udata object + * + * NOTE: Assume valid ucontext & warn if ucontext is NULL! + */ +#define rdma_udata_context(udata) \ + _rdma_udata_context(udata, true) + struct ib_pd { u32 local_dma_lkey; u32 flags;