Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4852046rdb; Fri, 15 Sep 2023 14:32:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFF1FBYQjAUSe45ayw8GGjLUEtY5MVcfdl5sRlOjuccnvyLUX/6TA/U4BducaZduyCu66Lc X-Received: by 2002:a05:6a20:1581:b0:13d:17cc:5bca with SMTP id h1-20020a056a20158100b0013d17cc5bcamr3530175pzj.18.1694813544223; Fri, 15 Sep 2023 14:32:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694813544; cv=none; d=google.com; s=arc-20160816; b=hZmA4sHwD8PwjPea7tRy5euw/1wqJXaTNEsgG50FfudLgeMihH6if0jrT7476zYJNs zXZ9DBb5wWMvEMWnd53NSRiDnqgEB/8PewT1jm+oE9sa78AEsrWgfS7j7nIudzymG6XA nsMywulhkSlvAWaL8q2OTE5nX/B67GTj4dmsXScawFtmZPeMqzDhWn8V6gbFq+KqI5ze lYYvIv+/lUIEjXKdchND5UyNpq4/6aFefTUyllO/MgF/Qt8wQ86lk4nULrAobl5FCRrf MHvCR9k70O2Yzpnwm+qtd38Gm7d+4Cyd0m6YEWAP9RPOshpzARenDYAYBFyicGrazPLu CwyA== 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=NkCMp454GTUcOtiLH5kTM0L3OzT2pp424P12IBewYiE=; fh=EwOlXWsBMUW0kp6PQ4notv7d3oMCrnB/CqKZMn6ZxlE=; b=0GsTC16Q32B1ymQqMIihSHwsJNeKaI10bXAJXRh6y4NUp+gRKxN9UCcTbPVbf3K7ma IZAligJr5dp6wEOdW09THKJIkPQOERmIQz1n+WiwHG1zWAjsnSPmM5f+kjuu3KTkIXXS z4aCXs5+SDrmGYDVaX0xL7rEMKiYGSmjO6+6AGcpBdTEbY/r0sdXU7JP1FNkF7pzR10t /2LnGta6abQXX21+qSLqPGI7Vt2i7jWiismbuHw0VvJ0ymZYiuowiYmM5eLGAKKQlUoF wAJfM6McqDZvbjxzOvmRJPubDXTb9FZRiMqfJTo+epn8pvewYvEx0faCUTpehlnFKPg2 tbKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxonhyperv.com header.s=default header.b=MbUX4Cy6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id f27-20020a63101b000000b005648b1d63aasi3617778pgl.553.2023.09.15.14.32.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 14:32:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxonhyperv.com header.s=default header.b=MbUX4Cy6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 7F20C8042704; Fri, 15 Sep 2023 11:25:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236201AbjIOSY7 (ORCPT + 99 others); Fri, 15 Sep 2023 14:24:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231775AbjIOSYo (ORCPT ); Fri, 15 Sep 2023 14:24:44 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EAE822105; Fri, 15 Sep 2023 11:24:37 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1174) id 84094212BE7A; Fri, 15 Sep 2023 11:24:37 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 84094212BE7A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1694802277; bh=NkCMp454GTUcOtiLH5kTM0L3OzT2pp424P12IBewYiE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MbUX4Cy6Iqcf0q594bx8T3XtF82itDGaw9+YgiDKsAvXowgOXriTMKvuuum4aL3f8 j7daVjq4fjNpUJRff6GMuGr4+ukFeQY0/RDlXS+gvkUqRMiQwHi5uRuz2no4e2vzZy qEozz8G6/nJm0Jb8xX9FTNvimKQ4rSMxCWvWzosA= 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 v6 2/5] RDMA/mana_ib : Register Mana IB device with Management SW Date: Fri, 15 Sep 2023 11:24:27 -0700 Message-Id: <1694802270-17452-3-git-send-email-sharmaajay@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1694802270-17452-1-git-send-email-sharmaajay@linuxonhyperv.com> References: <1694802270-17452-1-git-send-email-sharmaajay@linuxonhyperv.com> X-Spam-Status: No, score=-0.9 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 morse.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 (morse.vger.email [0.0.0.0]); Fri, 15 Sep 2023 11:25:35 -0700 (PDT) From: Ajay Sharma Each of the MANA infiniband devices must be registered with the management software to request services/resources. Register the Mana IB device with Management which would later help get an adapter handle. Signed-off-by: Ajay Sharma --- drivers/infiniband/hw/mana/device.c | 20 +++++-- drivers/infiniband/hw/mana/main.c | 58 ++++++------------- drivers/infiniband/hw/mana/mana_ib.h | 1 + drivers/infiniband/hw/mana/mr.c | 17 ++---- drivers/infiniband/hw/mana/qp.c | 8 +-- .../net/ethernet/microsoft/mana/gdma_main.c | 5 ++ include/net/mana/gdma.h | 3 + 7 files changed, 54 insertions(+), 58 deletions(-) diff --git a/drivers/infiniband/hw/mana/device.c b/drivers/infiniband/hw/mana/device.c index 083f27246ba8..ea4c8c8fc10d 100644 --- a/drivers/infiniband/hw/mana/device.c +++ b/drivers/infiniband/hw/mana/device.c @@ -78,22 +78,34 @@ static int mana_ib_probe(struct auxiliary_device *adev, mib_dev->ib_dev.num_comp_vectors = 1; mib_dev->ib_dev.dev.parent = mdev->gdma_context->dev; - ret = ib_register_device(&mib_dev->ib_dev, "mana_%d", - mdev->gdma_context->dev); + ret = mana_gd_register_device(&mib_dev->gc->mana_ib); if (ret) { - ib_dealloc_device(&mib_dev->ib_dev); - return ret; + ibdev_err(&mib_dev->ib_dev, "Failed to register device, ret %d", + ret); + goto free_ib_device; } + ret = ib_register_device(&mib_dev->ib_dev, "mana_%d", + mdev->gdma_context->dev); + if (ret) + goto deregister_device; + dev_set_drvdata(&adev->dev, mib_dev); return 0; + +deregister_device: + mana_gd_deregister_device(&mib_dev->gc->mana_ib); +free_ib_device: + ib_dealloc_device(&mib_dev->ib_dev); + return ret; } static void mana_ib_remove(struct auxiliary_device *adev) { struct mana_ib_dev *mib_dev = dev_get_drvdata(&adev->dev); + mana_gd_deregister_device(&mib_dev->gc->mana_ib); ib_unregister_device(&mib_dev->ib_dev); ib_dealloc_device(&mib_dev->ib_dev); } diff --git a/drivers/infiniband/hw/mana/main.c b/drivers/infiniband/hw/mana/main.c index 189e774cdab6..2c4e3c496644 100644 --- a/drivers/infiniband/hw/mana/main.c +++ b/drivers/infiniband/hw/mana/main.c @@ -8,7 +8,7 @@ void mana_ib_uncfg_vport(struct mana_ib_dev *mib_dev, struct mana_ib_pd *pd, u32 port) { - struct gdma_dev *gd = mib_dev->gdma_dev; + struct gdma_dev *gd = &mib_dev->gc->mana; struct mana_port_context *mpc; struct net_device *ndev; struct mana_context *mc; @@ -32,7 +32,7 @@ int mana_ib_cfg_vport(struct mana_ib_dev *mib_dev, u32 port, struct mana_ib_pd *pd, u32 doorbell_id) { - struct gdma_dev *mdev = mib_dev->gdma_dev; + struct gdma_dev *mdev = &mib_dev->gc->mana; struct mana_port_context *mpc; struct mana_context *mc; struct net_device *ndev; @@ -81,17 +81,16 @@ int mana_ib_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) struct gdma_create_pd_req req = {}; enum gdma_pd_flags flags = 0; struct mana_ib_dev *mib_dev; - struct gdma_dev *mdev; + int err; mib_dev = container_of(ibdev, struct mana_ib_dev, ib_dev); - mdev = mib_dev->gdma_dev; mana_gd_init_req_hdr(&req.hdr, GDMA_CREATE_PD, sizeof(req), sizeof(resp)); req.flags = flags; - err = mana_gd_send_request(mdev->gdma_context, sizeof(req), &req, + err = mana_gd_send_request(mib_dev->gc, sizeof(req), &req, sizeof(resp), &resp); if (err || resp.hdr.status) { @@ -121,17 +120,15 @@ int mana_ib_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) struct gdma_destory_pd_resp resp = {}; struct gdma_destroy_pd_req req = {}; struct mana_ib_dev *mib_dev; - struct gdma_dev *mdev; int err; mib_dev = container_of(ibdev, struct mana_ib_dev, ib_dev); - mdev = mib_dev->gdma_dev; mana_gd_init_req_hdr(&req.hdr, GDMA_DESTROY_PD, sizeof(req), sizeof(resp)); req.pd_handle = pd->pd_handle; - err = mana_gd_send_request(mdev->gdma_context, sizeof(req), &req, + err = mana_gd_send_request(mib_dev->gc, sizeof(req), &req, sizeof(resp), &resp); if (err || resp.hdr.status) { @@ -207,17 +204,13 @@ int mana_ib_alloc_ucontext(struct ib_ucontext *ibcontext, container_of(ibcontext, struct mana_ib_ucontext, ibucontext); struct ib_device *ibdev = ibcontext->device; struct mana_ib_dev *mib_dev; - struct gdma_context *gc; - struct gdma_dev *dev; int doorbell_page; int ret; mib_dev = container_of(ibdev, struct mana_ib_dev, ib_dev); - dev = mib_dev->gdma_dev; - gc = dev->gdma_context; /* Allocate a doorbell page index */ - ret = mana_gd_allocate_doorbell_page(gc, &doorbell_page); + ret = mana_gd_allocate_doorbell_page(mib_dev->gc, &doorbell_page); if (ret) { ibdev_dbg(ibdev, "Failed to allocate doorbell page %d\n", ret); return ret; @@ -236,20 +229,17 @@ void mana_ib_dealloc_ucontext(struct ib_ucontext *ibcontext) container_of(ibcontext, struct mana_ib_ucontext, ibucontext); struct ib_device *ibdev = ibcontext->device; struct mana_ib_dev *mib_dev; - struct gdma_context *gc; int ret; mib_dev = container_of(ibdev, struct mana_ib_dev, ib_dev); - gc = mib_dev->gdma_dev->gdma_context; - ret = mana_gd_destroy_doorbell_page(gc, mana_ucontext->doorbell); + ret = mana_gd_destroy_doorbell_page(mib_dev->gc, mana_ucontext->doorbell); if (ret) ibdev_dbg(ibdev, "Failed to destroy doorbell page %d\n", ret); } static int mana_ib_gd_first_dma_region(struct mana_ib_dev *mib_dev, - struct gdma_context *gc, struct gdma_create_dma_region_req *create_req, size_t num_pages, mana_handle_t *gdma_region, u32 expected_status) @@ -262,7 +252,7 @@ mana_ib_gd_first_dma_region(struct mana_ib_dev *mib_dev, struct_size(create_req, page_addr_list, num_pages); create_req->page_addr_list_len = num_pages; - err = mana_gd_send_request(gc, create_req_msg_size, create_req, + err = mana_gd_send_request(mib_dev->gc, create_req_msg_size, create_req, sizeof(create_resp), &create_resp); if (err || create_resp.hdr.status != expected_status) { ibdev_dbg(&mib_dev->ib_dev, @@ -282,7 +272,7 @@ mana_ib_gd_first_dma_region(struct mana_ib_dev *mib_dev, } static int -mana_ib_gd_add_dma_region(struct mana_ib_dev *mib_dev, struct gdma_context *gc, +mana_ib_gd_add_dma_region(struct mana_ib_dev *mib_dev, struct gdma_dma_region_add_pages_req *add_req, unsigned int num_pages, u32 expected_status) { @@ -295,7 +285,7 @@ mana_ib_gd_add_dma_region(struct mana_ib_dev *mib_dev, struct gdma_context *gc, add_req_msg_size, sizeof(add_resp)); add_req->page_addr_list_len = num_pages; - err = mana_gd_send_request(gc, add_req_msg_size, add_req, + err = mana_gd_send_request(mib_dev->gc, add_req_msg_size, add_req, sizeof(add_resp), &add_resp); if (err || add_resp.hdr.status != expected_status) { ibdev_dbg(&mib_dev->ib_dev, @@ -323,18 +313,14 @@ int mana_ib_gd_create_dma_region(struct mana_ib_dev *mib_dev, struct ib_block_iter biter; size_t max_pgs_add_cmd = 0; size_t max_pgs_create_cmd; - struct gdma_context *gc; size_t num_pages_total; - struct gdma_dev *mdev; unsigned long page_sz; unsigned int tail = 0; u64 *page_addr_list; void *request_buf; int err; - mdev = mib_dev->gdma_dev; - gc = mdev->gdma_context; - hwc = gc->hwc.driver_data; + hwc = mib_dev->gc->hwc.driver_data; /* Hardware requires dma region to align to chosen page size */ page_sz = ib_umem_find_best_pgsz(umem, PAGE_SZ_BM, 0); @@ -388,7 +374,7 @@ int mana_ib_gd_create_dma_region(struct mana_ib_dev *mib_dev, if (!num_pages_processed) { /* First create message */ - err = mana_ib_gd_first_dma_region(mib_dev, gc, create_req, + err = mana_ib_gd_first_dma_region(mib_dev, create_req, tail, gdma_region, expected_status); if (err) @@ -403,7 +389,7 @@ int mana_ib_gd_create_dma_region(struct mana_ib_dev *mib_dev, page_addr_list = add_req->page_addr_list; } else { /* Subsequent create messages */ - err = mana_ib_gd_add_dma_region(mib_dev, gc, add_req, tail, + err = mana_ib_gd_add_dma_region(mib_dev, add_req, tail, expected_status); if (err) break; @@ -429,13 +415,9 @@ int mana_ib_gd_create_dma_region(struct mana_ib_dev *mib_dev, int mana_ib_gd_destroy_dma_region(struct mana_ib_dev *mib_dev, u64 gdma_region) { - struct gdma_dev *mdev = mib_dev->gdma_dev; - struct gdma_context *gc; - - gc = mdev->gdma_context; ibdev_dbg(&mib_dev->ib_dev, "destroy dma region 0x%llx\n", gdma_region); - return mana_gd_destroy_dma_region(gc, gdma_region); + return mana_gd_destroy_dma_region(mib_dev->gc, gdma_region); } int mana_ib_mmap(struct ib_ucontext *ibcontext, struct vm_area_struct *vma) @@ -444,13 +426,11 @@ int mana_ib_mmap(struct ib_ucontext *ibcontext, struct vm_area_struct *vma) container_of(ibcontext, struct mana_ib_ucontext, ibucontext); struct ib_device *ibdev = ibcontext->device; struct mana_ib_dev *mib_dev; - struct gdma_context *gc; phys_addr_t pfn; pgprot_t prot; int ret; mib_dev = container_of(ibdev, struct mana_ib_dev, ib_dev); - gc = mib_dev->gdma_dev->gdma_context; if (vma->vm_pgoff != 0) { ibdev_dbg(ibdev, "Unexpected vm_pgoff %lu\n", vma->vm_pgoff); @@ -458,18 +438,18 @@ int mana_ib_mmap(struct ib_ucontext *ibcontext, struct vm_area_struct *vma) } /* Map to the page indexed by ucontext->doorbell */ - pfn = (gc->phys_db_page_base + - gc->db_page_size * mana_ucontext->doorbell) >> + pfn = (mib_dev->gc->phys_db_page_base + + mib_dev->gc->db_page_size * mana_ucontext->doorbell) >> PAGE_SHIFT; prot = pgprot_writecombine(vma->vm_page_prot); - ret = rdma_user_mmap_io(ibcontext, vma, pfn, gc->db_page_size, prot, - NULL); + ret = rdma_user_mmap_io(ibcontext, vma, pfn, mib_dev->gc->db_page_size, + prot, NULL); if (ret) ibdev_dbg(ibdev, "can't rdma_user_mmap_io ret %d\n", ret); else ibdev_dbg(ibdev, "mapped I/O pfn 0x%llx page_size %u, ret %d\n", - pfn, gc->db_page_size, ret); + pfn, mib_dev->gc->db_page_size, ret); return ret; } diff --git a/drivers/infiniband/hw/mana/mana_ib.h b/drivers/infiniband/hw/mana/mana_ib.h index ee4efd0af278..3a2ba6b96f15 100644 --- a/drivers/infiniband/hw/mana/mana_ib.h +++ b/drivers/infiniband/hw/mana/mana_ib.h @@ -30,6 +30,7 @@ struct mana_ib_dev { struct ib_device ib_dev; struct gdma_dev *gdma_dev; + struct gdma_context *gc; }; struct mana_ib_wq { diff --git a/drivers/infiniband/hw/mana/mr.c b/drivers/infiniband/hw/mana/mr.c index f6a53906204d..3106d1bce837 100644 --- a/drivers/infiniband/hw/mana/mr.c +++ b/drivers/infiniband/hw/mana/mr.c @@ -29,13 +29,10 @@ static int mana_ib_gd_create_mr(struct mana_ib_dev *mib_dev, struct mana_ib_mr *mr, struct gdma_create_mr_params *mr_params) { - struct gdma_dev *mdev = mib_dev->gdma_dev; struct gdma_create_mr_response resp = {}; struct gdma_create_mr_request req = {}; - struct gdma_context *gc; int err; - gc = mdev->gdma_context; mana_gd_init_req_hdr(&req.hdr, GDMA_CREATE_MR, sizeof(req), sizeof(resp)); @@ -56,7 +53,8 @@ static int mana_ib_gd_create_mr(struct mana_ib_dev *mib_dev, return -EINVAL; } - err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp), &resp); + err = mana_gd_send_request(mib_dev->gc, sizeof(req), &req, + sizeof(resp), &resp); if (err || resp.hdr.status) { ibdev_dbg(&mib_dev->ib_dev, "Failed to create mr %d, %u", err, @@ -77,22 +75,19 @@ static int mana_ib_gd_create_mr(struct mana_ib_dev *mib_dev, static int mana_ib_gd_destroy_mr(struct mana_ib_dev *mib_dev, u64 mr_handle) { struct gdma_destroy_mr_response resp = {}; - struct gdma_dev *mdev = mib_dev->gdma_dev; struct gdma_destroy_mr_request req = {}; - struct gdma_context *gc; int err; - gc = mdev->gdma_context; - mana_gd_init_req_hdr(&req.hdr, GDMA_DESTROY_MR, sizeof(req), sizeof(resp)); req.mr_handle = mr_handle; - err = mana_gd_send_request(gc, sizeof(req), &req, sizeof(resp), &resp); + err = mana_gd_send_request(mib_dev->gc, sizeof(req), &req, + sizeof(resp), &resp); if (err || resp.hdr.status) { - dev_err(gc->dev, "Failed to destroy MR: %d, 0x%x\n", err, - resp.hdr.status); + dev_err(mib_dev->gc->dev, "Failed to destroy MR: %d, 0x%x\n", + err, resp.hdr.status); if (!err) err = -EPROTO; return err; diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c index 3540bf5bb497..ef3275ac92a0 100644 --- a/drivers/infiniband/hw/mana/qp.c +++ b/drivers/infiniband/hw/mana/qp.c @@ -21,7 +21,7 @@ static int mana_ib_cfg_vport_steering(struct mana_ib_dev *mib_dev, u32 req_buf_size; int i, err; - mdev = mib_dev->gdma_dev; + mdev = &mib_dev->gc->mana; gc = mdev->gdma_context; req_buf_size = @@ -267,7 +267,7 @@ static int mana_ib_create_qp_raw(struct ib_qp *ibqp, struct ib_pd *ibpd, rdma_udata_to_drv_context(udata, struct mana_ib_ucontext, ibucontext); struct mana_ib_create_qp_resp resp = {}; - struct gdma_dev *gd = mib_dev->gdma_dev; + struct gdma_dev *gd = &mib_dev->gc->mana; struct mana_ib_create_qp ucmd = {}; struct mana_obj_spec wq_spec = {}; struct mana_obj_spec cq_spec = {}; @@ -437,7 +437,7 @@ static int mana_ib_destroy_qp_rss(struct mana_ib_qp *qp, { struct mana_ib_dev *mib_dev = container_of(qp->ibqp.device, struct mana_ib_dev, ib_dev); - struct gdma_dev *gd = mib_dev->gdma_dev; + struct gdma_dev *gd = &mib_dev->gc->mana; struct mana_port_context *mpc; struct mana_context *mc; struct net_device *ndev; @@ -464,7 +464,7 @@ static int mana_ib_destroy_qp_raw(struct mana_ib_qp *qp, struct ib_udata *udata) { struct mana_ib_dev *mib_dev = container_of(qp->ibqp.device, struct mana_ib_dev, ib_dev); - struct gdma_dev *gd = mib_dev->gdma_dev; + struct gdma_dev *gd = &mib_dev->gc->mana; struct ib_pd *ibpd = qp->ibqp.pd; struct mana_port_context *mpc; struct mana_context *mc; diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c index 8f3f78b68592..9fa7a2d6c2b2 100644 --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c @@ -139,6 +139,9 @@ static int mana_gd_detect_devices(struct pci_dev *pdev) if (dev_type == GDMA_DEVICE_MANA) { gc->mana.gdma_context = gc; gc->mana.dev_id = dev; + } else if (dev_type == GDMA_DEVICE_MANA_IB) { + gc->mana_ib.dev_id = dev; + gc->mana_ib.gdma_context = gc; } } @@ -940,6 +943,7 @@ int mana_gd_register_device(struct gdma_dev *gd) return 0; } +EXPORT_SYMBOL(mana_gd_register_device); int mana_gd_deregister_device(struct gdma_dev *gd) { @@ -970,6 +974,7 @@ int mana_gd_deregister_device(struct gdma_dev *gd) return err; } +EXPORT_SYMBOL(mana_gd_deregister_device); u32 mana_gd_wq_avail_space(struct gdma_queue *wq) { diff --git a/include/net/mana/gdma.h b/include/net/mana/gdma.h index 96c120160f15..e2b212dd722b 100644 --- a/include/net/mana/gdma.h +++ b/include/net/mana/gdma.h @@ -63,6 +63,7 @@ enum { GDMA_DEVICE_NONE = 0, GDMA_DEVICE_HWC = 1, GDMA_DEVICE_MANA = 2, + GDMA_DEVICE_MANA_IB = 3, }; struct gdma_resource { @@ -384,6 +385,8 @@ struct gdma_context { /* Azure network adapter */ struct gdma_dev mana; + /* rdma device */ + struct gdma_dev mana_ib; }; #define MAX_NUM_GDMA_DEVICES 4 -- 2.25.1