Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2786815rdg; Mon, 16 Oct 2023 15:13:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEnhg1DM0Jwf8ZLaAOoRvMpglJ/eQlXQqpL1KEwV3SW8N2MBj/5xEpzZLjrT4olXTOStM7I X-Received: by 2002:a05:6a20:3d95:b0:15f:b5:bfee with SMTP id s21-20020a056a203d9500b0015f00b5bfeemr394974pzi.5.1697494396576; Mon, 16 Oct 2023 15:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697494396; cv=none; d=google.com; s=arc-20160816; b=DXvWZhujvLSdCrDGjNa4FmKf0N7naIbycjgmU892ztQg150ZWqsU6SzDr5XmOdqWdM cGN9Fd2ePJAeVyNpXPwfJf+hTTCWjVlYDmGmVe+/N8lZvT0EiqcrrDDvgz8PKyLSHIrT qGooShK9Nd7gCludy9fHnK83QmWfxGJOg2EZ1I8f201sGzInkuv9tmQW89UVdwZM7abJ lQA7NdqO8UhWMvcQdAo68PV1l0ng5+pDw5RoqhMCcFDLRAPHB8l5UfJmUP1AR/5gKqFw hCO9mozB/VNj6QK5uTijnJljP1TNHC9E8iwu9bvMtfxWbZyfrUpfbM28MVVoEQlV/9cM 8RSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature:dkim-filter; bh=TGsvvgWpwhxqiST3JXUN8KZ0za3/WKQ/h15qpNdLHjA=; fh=EwOlXWsBMUW0kp6PQ4notv7d3oMCrnB/CqKZMn6ZxlE=; b=BKv2XXoC4YW0sHajxwVle1WxLaK6r/yRU032GVwLwIRLnYNuPv5oj2OrOK0URS+n2J 6C7QWQZ6XL/AKNpbkeL7QV5Sn4YY694/ESp8EHTBZnrDpJWKjF4pjmKisBHzWZLxZi5n 4fEvt39vliiUP2u0Dmhm9/IIQkxkfwb7XzMrius5Z8ZFf2UonqX7qQy3DZsEgiQ7CpBd JV3eGi2yBNXGbW+/oAj2aeQ/8H0eN/KqsdHUcYY9AcaUvRYQelo+vx2HhamupSe5n/6I c1KTw3aeEYsZ5ApsolOTx5IV8bSf3SqZm6XDo4k79HTxTKei1IiMs2t0qIIT7USDiFy5 UmHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxonhyperv.com header.s=default header.b=r6v1Qnxd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxonhyperv.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id g5-20020a170902740500b001bde9e8a29fsi266989pll.183.2023.10.16.15.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 15:13:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxonhyperv.com header.s=default header.b=r6v1Qnxd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxonhyperv.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A65D080530DE; Mon, 16 Oct 2023 15:13:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234293AbjJPWMY (ORCPT + 99 others); Mon, 16 Oct 2023 18:12:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234185AbjJPWMK (ORCPT ); Mon, 16 Oct 2023 18:12:10 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9E69FAC; Mon, 16 Oct 2023 15:12:08 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1174) id 3E00220B74C5; Mon, 16 Oct 2023 15:12:08 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3E00220B74C5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1697494328; bh=TGsvvgWpwhxqiST3JXUN8KZ0za3/WKQ/h15qpNdLHjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r6v1QnxdFDWroju7tiyPWnIv6e5qsGg8TpfEGLUGBT1zUrsdie6TXy71KH3SL5kVu zB4FugAW17ux/G1MML55xmJWsd7JVaSNYdT60Vz27UfvjyCVGacfvyi5KSQMphHz5H TECriKidM4tDWtUtflnq4hWIP+9+TT0yc1Pfwa2Y= From: sharmaajay@linuxonhyperv.com To: Long Li , Jason Gunthorpe , Leon Romanovsky , Dexuan Cui , Wei Liu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-rdma@vger.kernel.org, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ajay Sharma Subject: [Patch v7 5/5] RDMA/mana_ib: Send event to qp Date: Mon, 16 Oct 2023 15:12:02 -0700 Message-Id: <1697494322-26814-6-git-send-email-sharmaajay@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1697494322-26814-1-git-send-email-sharmaajay@linuxonhyperv.com> References: <1697494322-26814-1-git-send-email-sharmaajay@linuxonhyperv.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Mon, 16 Oct 2023 15:13:13 -0700 (PDT) From: Ajay Sharma Send the QP fatal error event to only the context that created the qp. Signed-off-by: Ajay Sharma --- drivers/infiniband/hw/mana/device.c | 4 ++++ drivers/infiniband/hw/mana/main.c | 11 ++++++++--- drivers/infiniband/hw/mana/mana_ib.h | 18 +++++++++--------- drivers/infiniband/hw/mana/qp.c | 2 ++ 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/hw/mana/device.c b/drivers/infiniband/hw/mana/device.c index e15da43c73a0..fcc8083e2783 100644 --- a/drivers/infiniband/hw/mana/device.c +++ b/drivers/infiniband/hw/mana/device.c @@ -101,6 +101,8 @@ static int mana_ib_probe(struct auxiliary_device *adev, if (ret) ibdev_dbg(&mib_dev->ib_dev, "Failed to get caps, use defaults"); + xa_init(&mib_dev->rq_to_qp_lookup_table); + ret = ib_register_device(&mib_dev->ib_dev, "mana_%d", mdev->gdma_context->dev); if (ret) @@ -112,6 +114,7 @@ static int mana_ib_probe(struct auxiliary_device *adev, destroy_adapter: mana_ib_destroy_adapter(mib_dev); + xa_destroy(&mib_dev->rq_to_qp_lookup_table); free_error_eq: mana_gd_destroy_queue(mib_dev->gc, mib_dev->fatal_err_eq); deregister_device: @@ -129,6 +132,7 @@ static void mana_ib_remove(struct auxiliary_device *adev) mana_ib_destroy_adapter(mib_dev); mana_gd_deregister_device(&mib_dev->gc->mana_ib); ib_unregister_device(&mib_dev->ib_dev); + xa_destroy(&mib_dev->rq_to_qp_lookup_table); ib_dealloc_device(&mib_dev->ib_dev); } diff --git a/drivers/infiniband/hw/mana/main.c b/drivers/infiniband/hw/mana/main.c index 82923475267d..29be8fd1ec7f 100644 --- a/drivers/infiniband/hw/mana/main.c +++ b/drivers/infiniband/hw/mana/main.c @@ -556,13 +556,18 @@ static void mana_ib_critical_event_handler(void *ctx, struct gdma_queue *queue, { struct mana_ib_dev *mib_dev = (struct mana_ib_dev *)ctx; struct ib_event mib_event; + struct mana_ib_qp *qp; + u64 rq_id; switch (event->type) { case GDMA_EQE_SOC_EVENT_NOTIFICATION: + rq_id = event->details[0] & 0xFFFFFF; + qp = xa_load(&mib_dev->rq_to_qp_lookup_table, rq_id); mib_event.event = IB_EVENT_QP_FATAL; mib_event.device = &mib_dev->ib_dev; - mib_event.element.qp = - (struct ib_qp*)(event->details[0] & 0xFFFFFF); - ib_dispatch_event(&mib_event); + if (qp && qp->ibqp.event_handler) + qp->ibqp.event_handler(&mib_event, qp->ibqp.qp_context); + else + ibdev_dbg(&mib_dev->ib_dev, "found no qp or event handler"); ibdev_dbg(&mib_dev->ib_dev, "Received critical notification"); break; default: diff --git a/drivers/infiniband/hw/mana/mana_ib.h b/drivers/infiniband/hw/mana/mana_ib.h index 6b9406738cb2..243572b52336 100644 --- a/drivers/infiniband/hw/mana/mana_ib.h +++ b/drivers/infiniband/hw/mana/mana_ib.h @@ -48,15 +48,6 @@ struct mana_ib_adapter_caps { u32 max_inline_data_size; }; -struct mana_ib_dev { - struct ib_device ib_dev; - struct gdma_dev *gdma_dev; - struct gdma_context *gc; - struct gdma_queue *fatal_err_eq; - mana_handle_t adapter_handle; - struct mana_ib_adapter_caps adapter_caps; -}; - struct mana_ib_wq { struct ib_wq ibwq; struct ib_umem *umem; @@ -113,6 +104,15 @@ struct mana_ib_ucontext { u32 doorbell; }; +struct mana_ib_dev { + struct ib_device ib_dev; + struct gdma_dev *gdma_dev; + struct gdma_context *gc; + struct gdma_queue *fatal_err_eq; + mana_handle_t adapter_handle; + struct mana_ib_adapter_caps adapter_caps; + struct xarray rq_to_qp_lookup_table; +}; struct mana_ib_rwq_ind_table { struct ib_rwq_ind_table ib_ind_table; }; diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c index ef3275ac92a0..19fae28985c3 100644 --- a/drivers/infiniband/hw/mana/qp.c +++ b/drivers/infiniband/hw/mana/qp.c @@ -210,6 +210,8 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd, wq->id = wq_spec.queue_index; cq->id = cq_spec.queue_index; + xa_store(&mib_dev->rq_to_qp_lookup_table, wq->id, qp, GFP_KERNEL); + ibdev_dbg(&mib_dev->ib_dev, "ret %d rx_object 0x%llx wq id %llu cq id %llu\n", ret, wq->rx_object, wq->id, cq->id); -- 2.25.1