From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4133AC76192 for ; Tue, 16 Jul 2019 18:13:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2BBA920693 for ; Tue, 16 Jul 2019 18:13:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388368AbfGPSNi (ORCPT ); Tue, 16 Jul 2019 14:13:38 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:36948 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388036AbfGPSNi (ORCPT ); Tue, 16 Jul 2019 14:13:38 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x6GI9GAM115487; Tue, 16 Jul 2019 18:13:24 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2tq7xqx4cb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Jul 2019 18:13:24 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x6GICemj027858; Tue, 16 Jul 2019 18:13:23 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 2tq4du2u7t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 16 Jul 2019 18:13:23 +0000 Received: from abhmp0022.oracle.com (abhmp0022.oracle.com [141.146.116.28]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x6GIDM97021224; Tue, 16 Jul 2019 18:13:22 GMT Received: from host5.lan (/77.138.183.59) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 16 Jul 2019 18:13:22 +0000 From: Shamir Rabinovitch To: dledford@redhat.com, jgg@ziepe.ca, leon@kernel.org, monis@mellanox.com, parav@mellanox.com, danielj@mellanox.com, kamalheib1@gmail.com, markz@mellanox.com, swise@opengridcomputing.com, shamir.rabinovitch@oracle.com, johannes.berg@intel.com, willy@infradead.org, michaelgur@mellanox.com, markb@mellanox.com, yuval.shaia@oracle.com, dan.carpenter@oracle.com, bvanassche@acm.org, maxg@mellanox.com, israelr@mellanox.com, galpress@amazon.com, denisd@mellanox.com, yuvalav@mellanox.com, dennis.dalessandro@intel.com, will@kernel.org, ereza@mellanox.com, jgg@mellanox.com, linux-rdma@vger.kernel.org Cc: Shamir Rabinovitch Subject: [PATCH 09/25] IB/verbs: Prototype of HW object clone callback Date: Tue, 16 Jul 2019 21:11:44 +0300 Message-Id: <20190716181200.4239-10-srabinov7@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190716181200.4239-1-srabinov7@gmail.com> References: <20190716181200.4239-1-srabinov7@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9320 signatures=668688 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=887 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907160223 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9320 signatures=668688 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=949 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907160222 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Shamir Rabinovitch Define prototype for clone callback. The clone callback is used by the driver layer to supply the uverbs a way to clone IB HW object driver data to rdma-core user space provider. The clone callback is used when new IB HW object is created and every time it is imported to some ib_ucontext. Drivers that wish to enable share of some IB HW object (ib_pd, ib_mr, etc..) must supply valid clone callback for that type. Signed-off-by: Shamir Rabinovitch Signed-off-by: Shamir Rabinovitch Signed-off-by: Yuval Shaia --- include/rdma/ib_verbs.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index d19c0394b05a..6a3be5629e55 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2213,6 +2213,18 @@ struct iw_cm_conn_param; #define DECLARE_RDMA_OBJ_SIZE(ib_struct) size_t size_##ib_struct +/* + * Prototype for IB HW object clone callback + * + * Define prototype for clone callback. The clone callback is used + * by the driver layer to supply the uverbs a way to clone IB HW + * object driver data to rdma-core user space provider. The clone + * callback is used when new IB HW object is created and every time + * it is imported to some ib_ucontext. + */ +#define clone_callback(ib_type) \ + int (*clone_##ib_type)(struct ib_udata *udata, struct ib_type *obj) + /** * struct ib_device_ops - InfiniBand device operations * This structure defines all the InfiniBand device operations, providers will @@ -2523,6 +2535,9 @@ struct ib_device_ops { */ int (*counter_update_stats)(struct rdma_counter *counter); + /* Object sharing callbacks */ + clone_callback(ib_pd); + DECLARE_RDMA_OBJ_SIZE(ib_ah); DECLARE_RDMA_OBJ_SIZE(ib_cq); DECLARE_RDMA_OBJ_SIZE(ib_pd); @@ -2530,6 +2545,17 @@ struct ib_device_ops { DECLARE_RDMA_OBJ_SIZE(ib_ucontext); }; +/* Implementation of trivial clone callback */ +#define trivial_clone_callback(ib_type) \ +static inline int trivial_clone_##ib_type(struct ib_udata *udata, \ + struct ib_type *obj) \ +{ \ + return 0; \ +} + +/* Shared IB HW object support */ +trivial_clone_callback(ib_pd); + struct ib_core_device { /* device must be the first element in structure until, * union of ib_core_device and device exists in ib_device. -- 2.20.1