Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp130876rdb; Mon, 18 Sep 2023 10:04:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFqdsUVqBZ0nTnoDUV2QHDvRDf+Wl6ftjlIJyZ99QeD/54TPRYHF0SlrkOKXlI89dzChFj X-Received: by 2002:a05:6a20:9385:b0:14c:76bd:10df with SMTP id x5-20020a056a20938500b0014c76bd10dfmr10441900pzh.19.1695056689268; Mon, 18 Sep 2023 10:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695056689; cv=none; d=google.com; s=arc-20160816; b=je4g76tNc6KjXWJ+je3BnODd9dHYrYWG6cxSNqMY0axo5GlbDzh7BU+CVmyYekZEgQ ovU0yYa9qQwyE0G667CDiUm2R0TR8TGDCav/zWus1yMZLn/KMag/Xo3ACf+iZ6Rb59Dx 0iukXc6hmf0VeSidRmFPQPE4YQ08in6bGZKXCdHjEWylvMbX4wdwOUE/Ld2vzEhuATXw 1h9l+LYrTqwGTP7CscveOINo0AtmBF47+Cu8v8cuyFVav2Ae0xRWeXRAUPujOf9UfRPo xlASJ4qpjCghAvk/jquZgJptpCoGHpfxj2iG/ST0R/7FZpHL839NFPNQ//uPQ1uO1UVB 7BWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=H8c5CBfB94IG65Z7aCQ18QdTPXeJHW8ZtqujllC7ufM=; fh=KWvyQxL3Ff+3WPSMjlYu+P4255AmcMULAsFol6M1vNI=; b=H1jkZoejnh431ayAR9g1L+/6o9gdvAsB859Mmh4h3+sXqCwNylzic5/BePDiWm/V/W UxAsBAs+a0/pz7jw+0O3pEQ7RydZIvpRBnPGd7dED0XLybmk6IfvWd4fBlAlDw6WtlGx R8SSIrj6zEcJl13mVujGVzj7ErpuPJCem+brQ7SX1CUNkDbM65O/nK8Oy+jK6wwoa5Fe 2EAQjg7bESOnRcLjjDMva3Qtw8QFNZCQU0f8rHLzhBc8uiQKsX7YOb8+I3faKixaQs35 RyEPcN2azv5AzLkgGix8he/pPp9DsfejApZOZZfeVbCDqqmb1IeY8TZ80ZY7GebxjVoR PHGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=hisilicon.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id az1-20020a056a02004100b0057745d87b53si8133216pgb.686.2023.09.18.10.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 10:04:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=hisilicon.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C9CF2801C7C7; Mon, 18 Sep 2023 09:51:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230292AbjIRQvx (ORCPT + 99 others); Mon, 18 Sep 2023 12:51:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230129AbjIRQvv (ORCPT ); Mon, 18 Sep 2023 12:51:51 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0DC2AC; Mon, 18 Sep 2023 09:51:45 -0700 (PDT) Received: from kwepemi500006.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rq4tY02syzVk3Y; Mon, 18 Sep 2023 21:11:16 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemi500006.china.huawei.com (7.221.188.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 18 Sep 2023 21:14:11 +0800 From: Junxian Huang To: , CC: , , , Subject: [PATCH RFC for-next 1/3] RDMA/core: Add dedicated SRQ resource tracker function Date: Mon, 18 Sep 2023 21:11:08 +0800 Message-ID: <20230918131110.3987498-2-huangjunxian6@hisilicon.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230918131110.3987498-1-huangjunxian6@hisilicon.com> References: <20230918131110.3987498-1-huangjunxian6@hisilicon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500006.china.huawei.com (7.221.188.68) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 18 Sep 2023 09:51:55 -0700 (PDT) From: wenglianfa Add a dedicated callback function for SRQ resource tracker. Signed-off-by: wenglianfa --- drivers/infiniband/core/device.c | 1 + drivers/infiniband/core/nldev.c | 9 ++++++++- include/rdma/ib_verbs.h | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index a666847bd714..05b37050e842 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -2651,6 +2651,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops) SET_DEVICE_OP(dev_ops, fill_res_mr_entry_raw); SET_DEVICE_OP(dev_ops, fill_res_qp_entry); SET_DEVICE_OP(dev_ops, fill_res_qp_entry_raw); + SET_DEVICE_OP(dev_ops, fill_res_srq_entry); SET_DEVICE_OP(dev_ops, fill_stat_mr_entry); SET_DEVICE_OP(dev_ops, get_dev_fw_str); SET_DEVICE_OP(dev_ops, get_dma_mr); diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c index d5d3e4f0de77..bebe6adeb533 100644 --- a/drivers/infiniband/core/nldev.c +++ b/drivers/infiniband/core/nldev.c @@ -818,6 +818,7 @@ static int fill_res_srq_entry(struct sk_buff *msg, bool has_cap_net_admin, struct rdma_restrack_entry *res, uint32_t port) { struct ib_srq *srq = container_of(res, struct ib_srq, res); + struct ib_device *dev = srq->device; if (nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_SRQN, srq->res.id)) goto err; @@ -837,7 +838,13 @@ static int fill_res_srq_entry(struct sk_buff *msg, bool has_cap_net_admin, if (fill_res_srq_qps(msg, srq)) goto err; - return fill_res_name_pid(msg, res); + if (fill_res_name_pid(msg, res)) + goto err; + + if (dev->ops.fill_res_srq_entry) + return dev->ops.fill_res_srq_entry(msg, srq); + + return 0; err: return -EMSGSIZE; diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 533ab92684d8..3cbb6141a9ce 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2608,6 +2608,7 @@ struct ib_device_ops { int (*fill_res_qp_entry)(struct sk_buff *msg, struct ib_qp *ibqp); int (*fill_res_qp_entry_raw)(struct sk_buff *msg, struct ib_qp *ibqp); int (*fill_res_cm_id_entry)(struct sk_buff *msg, struct rdma_cm_id *id); + int (*fill_res_srq_entry)(struct sk_buff *msg, struct ib_srq *ib_srq); /* Device lifecycle callbacks */ /* -- 2.30.0