Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1010804lqt; Tue, 19 Mar 2024 10:06:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVHtiVBMk0tpR+xVCtujVUR23NPpz4yZzy2tayBtFiyILCF22bbzdscWT84xwFs103C3sYSq/QN5vfmUTfKZVsxVAapbJDx95qbQFqvHw== X-Google-Smtp-Source: AGHT+IH6TD/5gJdUtfFRbJEgmayc4N3CpuHgXd+Lh7kYZjKSiKTzJ5iDmu3DZmSYFFc4v2vLJvS4 X-Received: by 2002:a05:6a20:2489:b0:1a3:2de0:b00d with SMTP id m9-20020a056a20248900b001a32de0b00dmr11086330pzd.59.1710867981398; Tue, 19 Mar 2024 10:06:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710867981; cv=pass; d=google.com; s=arc-20160816; b=T7D1wd1cXILyc0BZpoSgOpqrMvHuFDIaPgfJyi6wEModc9Mvq3oCKWgCltN/hnKjWA wBHugn3xdwEy/wzphCgVQX2E8JuidY8jECcx+IOq0Fl81O7+JwAuVQwHR420VRCTweHB tLw9Uj3MAuLeAeuHtUviMGihFqlKx5zkUdbOrsqtQiG0nMlQ82JHOoS6zJadumyhJXFy FToolwP3YIy6SnIgQD5En4FZm7l8A+bK/TcM57grf8bH0yxV8TNkFhh7ADNGe2PU5XTv 17BR7vLcSmJd0r8RPDy43fUkQGc6svR30cfzGdm/MFhTNwUTsFnmP/qXd4J/P/XoB9QQ yuew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=ufX/U1zNv09Ri+oL2azvLywYnvh8PET/KeZx2M1KecA=; fh=ujksmUrBEjpGhQjWbrjZMx9PDXUXbYR/j4y8MAq1x1o=; b=T7KR6mN9bf2qGrEPrDCq6UN6yvr67rlvoAdTf1HImgd0S4SlToCnug80UcDChPDFdz xAuV/i64fwKOF6UM2bGBaUdSIAbldx/Rx+VaBgLgdAk9Os5Ap4Ee+Q3lQNY9lzX99KMA zAq7QfS0as2Hxsh8QcvDPM6zhr3aF1AnVyUi4uCoh+gJ699VyKurnyv/WejN0F8fRVQy 5YUK7sSLwcybVmleAQcfkdxjOZg0/5zUW+UH1EjtH2OgjRGOtNfPsUEhhWJoMFDZ3tP9 R1wt9TMmhObJPv351hnzsKD0mFkXKDV2bz0RPE5h8Tgw6zyEDN2OHD1c9rzcqeAtX1K3 So0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=ScJnI+e9; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-107877-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107877-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i13-20020a63e90d000000b005dc4bdd113fsi10595061pgh.168.2024.03.19.10.06.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 10:06:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107877-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=ScJnI+e9; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-107877-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107877-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2D786B23496 for ; Tue, 19 Mar 2024 17:01:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FDC520B21; Tue, 19 Mar 2024 17:00:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="ScJnI+e9" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E40E322325; Tue, 19 Mar 2024 17:00:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710867627; cv=none; b=VXUwt+2pNkp8TW5WXfAnk6ZgEJgFHtJfJZZ82C5NbHYvqpIfg2LlImzBxRV0SmuAD7QUCRzZKHOZwRCoOMzX0u7vy99AFsxDvgNvKABGgkqAEXPSiJdYjILf/M7h5TgHZXIZvwrHQbDThn5u2KYigVJf7JmguyVkhFx/pXad0Js= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710867627; c=relaxed/simple; bh=VYWbTKvwiXxX5MoDZMS5LsE+7Y09WRO1EMZa66vY0S0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ByITyodrx8pQwQ7awfYdLK2F+eYp+nMqj59ET5iUJcyGBbozfBEX77N8UWiTK5Yely3C+oE0LJ1l4bYY+7ybP5RaTgbiGk0fELnMDU6H6WTHkxu80g6ZE4COYst/g5MvFCx1YZ3gQtv2mxlHGkmHPor0d1vnCK0LhbH2iZ29YUc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=ScJnI+e9; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 8479F20B74C3; Tue, 19 Mar 2024 10:00:25 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8479F20B74C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1710867625; bh=ufX/U1zNv09Ri+oL2azvLywYnvh8PET/KeZx2M1KecA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ScJnI+e9AxKQQNkLjqlO2M58+kbyQdF1aNVzw+qlfwsgOk5K5UY2ROXvFL0Zo69aP uQfCy7jpvDfIdlwrmw6Ex5n6FM5hQiM/kn8cg3wKfE6/QCd2OQdm+HQLAoz2XVg3QB rXZewXt/1Rhp2JwjLQgLPw+TiSchUZkWWtYfRdbM= From: Konstantin Taranov To: kotaranov@microsoft.com, sharmaajay@microsoft.com, longli@microsoft.com, jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH rdma-next v2 3/4] RDMA/mana_ib: Use struct mana_ib_queue for WQs Date: Tue, 19 Mar 2024 10:00:12 -0700 Message-Id: <1710867613-4798-4-git-send-email-kotaranov@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1710867613-4798-1-git-send-email-kotaranov@linux.microsoft.com> References: <1710867613-4798-1-git-send-email-kotaranov@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Konstantin Taranov Use struct mana_ib_queue and its helpers for WQs Signed-off-by: Konstantin Taranov --- drivers/infiniband/hw/mana/mana_ib.h | 4 +--- drivers/infiniband/hw/mana/qp.c | 10 ++++----- drivers/infiniband/hw/mana/wq.c | 31 ++++------------------------ 3 files changed, 10 insertions(+), 35 deletions(-) diff --git a/drivers/infiniband/hw/mana/mana_ib.h b/drivers/infiniband/hw/mana/mana_ib.h index 6acb5c281..a8953ee80 100644 --- a/drivers/infiniband/hw/mana/mana_ib.h +++ b/drivers/infiniband/hw/mana/mana_ib.h @@ -59,11 +59,9 @@ struct mana_ib_dev { struct mana_ib_wq { struct ib_wq ibwq; - struct ib_umem *umem; + struct mana_ib_queue queue; int wqe; u32 wq_buf_size; - u64 gdma_region; - u64 id; mana_handle_t rx_object; }; diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c index d7485ee6a..f606caa75 100644 --- a/drivers/infiniband/hw/mana/qp.c +++ b/drivers/infiniband/hw/mana/qp.c @@ -194,7 +194,7 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd, ibcq = ibwq->cq; cq = container_of(ibcq, struct mana_ib_cq, ibcq); - wq_spec.gdma_region = wq->gdma_region; + wq_spec.gdma_region = wq->queue.gdma_region; wq_spec.queue_size = wq->wq_buf_size; cq_spec.gdma_region = cq->queue.gdma_region; @@ -212,18 +212,18 @@ static int mana_ib_create_qp_rss(struct ib_qp *ibqp, struct ib_pd *pd, } /* The GDMA regions are now owned by the WQ object */ - wq->gdma_region = GDMA_INVALID_DMA_REGION; + wq->queue.gdma_region = GDMA_INVALID_DMA_REGION; cq->queue.gdma_region = GDMA_INVALID_DMA_REGION; - wq->id = wq_spec.queue_index; + wq->queue.id = wq_spec.queue_index; cq->queue.id = cq_spec.queue_index; ibdev_dbg(&mdev->ib_dev, "ret %d rx_object 0x%llx wq id %llu cq id %llu\n", - ret, wq->rx_object, wq->id, cq->queue.id); + ret, wq->rx_object, wq->queue.id, cq->queue.id); resp.entries[i].cqid = cq->queue.id; - resp.entries[i].wqid = wq->id; + resp.entries[i].wqid = wq->queue.id; mana_ind_table[i] = wq->rx_object; diff --git a/drivers/infiniband/hw/mana/wq.c b/drivers/infiniband/hw/mana/wq.c index 7c9c69962..f959f4b92 100644 --- a/drivers/infiniband/hw/mana/wq.c +++ b/drivers/infiniband/hw/mana/wq.c @@ -13,7 +13,6 @@ struct ib_wq *mana_ib_create_wq(struct ib_pd *pd, container_of(pd->device, struct mana_ib_dev, ib_dev); struct mana_ib_create_wq ucmd = {}; struct mana_ib_wq *wq; - struct ib_umem *umem; int err; if (udata->inlen < sizeof(ucmd)) @@ -32,39 +31,18 @@ struct ib_wq *mana_ib_create_wq(struct ib_pd *pd, ibdev_dbg(&mdev->ib_dev, "ucmd wq_buf_addr 0x%llx\n", ucmd.wq_buf_addr); - umem = ib_umem_get(pd->device, ucmd.wq_buf_addr, ucmd.wq_buf_size, - IB_ACCESS_LOCAL_WRITE); - if (IS_ERR(umem)) { - err = PTR_ERR(umem); + err = mana_ib_create_queue(mdev, ucmd.wq_buf_addr, ucmd.wq_buf_size, &wq->queue); + if (err) { ibdev_dbg(&mdev->ib_dev, - "Failed to get umem for create wq, err %d\n", err); + "Failed to create queue for create wq, %d\n", err); goto err_free_wq; } - wq->umem = umem; wq->wqe = init_attr->max_wr; wq->wq_buf_size = ucmd.wq_buf_size; wq->rx_object = INVALID_MANA_HANDLE; - - err = mana_ib_create_zero_offset_dma_region(mdev, wq->umem, &wq->gdma_region); - if (err) { - ibdev_dbg(&mdev->ib_dev, - "Failed to create dma region for create wq, %d\n", - err); - goto err_release_umem; - } - - ibdev_dbg(&mdev->ib_dev, - "create_dma_region ret %d gdma_region 0x%llx\n", - err, wq->gdma_region); - - /* WQ ID is returned at wq_create time, doesn't know the value yet */ - return &wq->ibwq; -err_release_umem: - ib_umem_release(umem); - err_free_wq: kfree(wq); @@ -86,8 +64,7 @@ int mana_ib_destroy_wq(struct ib_wq *ibwq, struct ib_udata *udata) mdev = container_of(ib_dev, struct mana_ib_dev, ib_dev); - mana_ib_gd_destroy_dma_region(mdev, wq->gdma_region); - ib_umem_release(wq->umem); + mana_ib_destroy_queue(mdev, &wq->queue); kfree(wq); -- 2.43.0