Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp1006387lqt; Tue, 19 Mar 2024 10:01:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWU+XIQcIxpAwBZVEeL2Zsuur/2Bi7Q7vR+QfM1FMGRpHdGKE3L8dfhFqI8E+DsHRTC749sLhywRLmRmhmLpauSSPiudJCLXaiSZmWPxg== X-Google-Smtp-Source: AGHT+IHd4WQnXxtGcZ0RFyLG6OVQyp9tN08zaWlOfkJ7lMb1BijFoJBvxYOzZVJTAbGEIA05LMuk X-Received: by 2002:a05:6870:d88e:b0:222:619f:9314 with SMTP id oe14-20020a056870d88e00b00222619f9314mr16595537oac.25.1710867663511; Tue, 19 Mar 2024 10:01:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710867663; cv=pass; d=google.com; s=arc-20160816; b=m65VHbBgP/ZskUSDzMl2kMcaNuIPxPC7IHGBOxZUTc5e6T5Q8ISn9mQsvtsnrL9wP4 R67y1YgYssE9kJeHtfuPLtc/wBu1AXP8iMStjPv0ai95oYY2EyzCaekF5JWdRb1YPggQ XSAcNnXcj2oAud3sx57HlBYlqtYGtMXwe9jgjGFJZpRdUVQId+SJz/veH5jnuFM0qo4n DB78pESAn01UNAO3hO7HF8r+tgYAL+MFOZsgJ5Q4fDLD87EqFrqYx+8cFM841oPCWHpE Lz0nJqtoXW5DmV8c5xeTk3glRFI+nt6oPbwV9htr7ALDU/SbR6lW6cGGadD96nN2bQeW 0f/w== 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=KQpc5b+IMDR1rbzinuEbYLwQYGgKN1HCmxsKitzyTkA=; fh=ujksmUrBEjpGhQjWbrjZMx9PDXUXbYR/j4y8MAq1x1o=; b=VcDIOqLgahm6JGcp25d9bH22a5vqHtMfYAA1Eli4uaDHICifubYqOsIilcbdFuRe/q 7Bl9pSb7xJv8TK1gjXqaUM7u1pRxVlo809ZuKYFO6fMalqyLLKNGybHKq1jh9BQ86Gqn 5uYV4l15G7Iz8cYxtheQJYKtzk/54cVBNyq8QDIOfobGJgMegHbTrpiiH8F8r41FaafF gpQcFVYJCe7GggEzXP33UdkyqTS//5CcvieKD0AEFJQYdN950V5AF4t7cEOpgM4oyoMB VYxuJtTaiKLzESSdGbIqSij/0taAFsTJKykO7THyeX6hkzAU7U5mQKUBZqRoUFYaJJJA XeKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=i5yvrjRO; 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-107878-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107878-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 ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id eb10-20020a05620a480a00b00789e7abed81si9446772qkb.253.2024.03.19.10.01.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 10:01:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107878-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=i5yvrjRO; 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-107878-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107878-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 2B9CD1C225D5 for ; Tue, 19 Mar 2024 17:01:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71A1721364; 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="i5yvrjRO" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D765224D0; 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=YU1UIUGtTeysQeCePyiIAsSCcwIemDn/KIh5vRSC51VrlametPUpPkh2jl8BXv5pjWjX0UZo+l1qgiYnp+95Nb8VjzWS0SVx61bEvbmULtbVmIvJSO6ij5E96GvdWqWlZQXwxs34yCGSpFWEyNRxsNKLO5ujOA1I7JLDZqmVKCY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710867627; c=relaxed/simple; bh=UBzp2+L5DZCxzkUt0BgNm18wsMT0W9aAtI+VywexiCs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=eW+LGppRqVcVT13os04qFQhC4N4vj6jbQw7dPwXd6iAJ+5stO8XvWqH9fZp+QBJQ71bN80O0fA6A205JqdzKBcvAzl0ZJlQY2b0OwUSyvj9iZ7NhRKTmlHCvVYsD8JXnRhexwjJEi4CVrZNTvHeomNLS/SyKbvekW1JocKd741Y= 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=i5yvrjRO; 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 9D2F120B74C4; Tue, 19 Mar 2024 10:00:25 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9D2F120B74C4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1710867625; bh=KQpc5b+IMDR1rbzinuEbYLwQYGgKN1HCmxsKitzyTkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i5yvrjROVnqBo1R2ENur/kTnwZ5bhwTIrcB3Yilmx70tqWflrD0+vj0Y21aIh/Rg+ 6fDaD0dfwZzvKpOtTX1U8i8O3SXvnSWz59GfIB9wqMI06gqihkdpurYOaeA6TXKWUm dUDMDJoBtz62Lrm/yC9MGK2oFfLa2Ji733YBW9j8= 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 4/4] RDMA/mana_ib: Use struct mana_ib_queue for RAW QPs Date: Tue, 19 Mar 2024 10:00:13 -0700 Message-Id: <1710867613-4798-5-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 RAW QPs Signed-off-by: Konstantin Taranov --- drivers/infiniband/hw/mana/mana_ib.h | 13 +++---- drivers/infiniband/hw/mana/qp.c | 54 ++++++++-------------------- 2 files changed, 22 insertions(+), 45 deletions(-) diff --git a/drivers/infiniband/hw/mana/mana_ib.h b/drivers/infiniband/hw/mana/mana_ib.h index a8953ee80..5d9a6e7cb 100644 --- a/drivers/infiniband/hw/mana/mana_ib.h +++ b/drivers/infiniband/hw/mana/mana_ib.h @@ -91,15 +91,16 @@ struct mana_ib_cq { u32 comp_vector; }; +struct mana_ib_raw_sq { + /* Work queue info */ + struct mana_ib_queue queue; + mana_handle_t tx_object; +}; + struct mana_ib_qp { struct ib_qp ibqp; - /* Work queue info */ - struct ib_umem *sq_umem; - int sqe; - u64 sq_gdma_region; - u64 sq_id; - mana_handle_t tx_object; + struct mana_ib_raw_sq sq; /* The port on the IB device, starting with 1 */ u32 port; diff --git a/drivers/infiniband/hw/mana/qp.c b/drivers/infiniband/hw/mana/qp.c index f606caa75..5818b665e 100644 --- a/drivers/infiniband/hw/mana/qp.c +++ b/drivers/infiniband/hw/mana/qp.c @@ -297,7 +297,6 @@ static int mana_ib_create_qp_raw(struct ib_qp *ibqp, struct ib_pd *ibpd, struct mana_obj_spec cq_spec = {}; struct mana_port_context *mpc; struct net_device *ndev; - struct ib_umem *umem; struct mana_eq *eq; int eq_vec; u32 port; @@ -346,32 +345,15 @@ static int mana_ib_create_qp_raw(struct ib_qp *ibqp, struct ib_pd *ibpd, ibdev_dbg(&mdev->ib_dev, "ucmd sq_buf_addr 0x%llx port %u\n", ucmd.sq_buf_addr, ucmd.port); - umem = ib_umem_get(ibpd->device, ucmd.sq_buf_addr, ucmd.sq_buf_size, - IB_ACCESS_LOCAL_WRITE); - if (IS_ERR(umem)) { - err = PTR_ERR(umem); - ibdev_dbg(&mdev->ib_dev, - "Failed to get umem for create qp-raw, err %d\n", - err); - goto err_free_vport; - } - qp->sq_umem = umem; - - err = mana_ib_create_zero_offset_dma_region(mdev, qp->sq_umem, - &qp->sq_gdma_region); + err = mana_ib_create_queue(mdev, ucmd.sq_buf_addr, ucmd.sq_buf_size, &qp->sq.queue); if (err) { ibdev_dbg(&mdev->ib_dev, - "Failed to create dma region for create qp-raw, %d\n", - err); - goto err_release_umem; + "Failed to create queue for create qp-raw, err %d\n", err); + goto err_free_vport; } - ibdev_dbg(&mdev->ib_dev, - "create_dma_region ret %d gdma_region 0x%llx\n", - err, qp->sq_gdma_region); - /* Create a WQ on the same port handle used by the Ethernet */ - wq_spec.gdma_region = qp->sq_gdma_region; + wq_spec.gdma_region = qp->sq.queue.gdma_region; wq_spec.queue_size = ucmd.sq_buf_size; cq_spec.gdma_region = send_cq->queue.gdma_region; @@ -382,19 +364,19 @@ static int mana_ib_create_qp_raw(struct ib_qp *ibqp, struct ib_pd *ibpd, cq_spec.attached_eq = eq->eq->id; err = mana_create_wq_obj(mpc, mpc->port_handle, GDMA_SQ, &wq_spec, - &cq_spec, &qp->tx_object); + &cq_spec, &qp->sq.tx_object); if (err) { ibdev_dbg(&mdev->ib_dev, "Failed to create wq for create raw-qp, err %d\n", err); - goto err_destroy_dma_region; + goto err_destroy_queue; } /* The GDMA regions are now owned by the WQ object */ - qp->sq_gdma_region = GDMA_INVALID_DMA_REGION; + qp->sq.queue.gdma_region = GDMA_INVALID_DMA_REGION; send_cq->queue.gdma_region = GDMA_INVALID_DMA_REGION; - qp->sq_id = wq_spec.queue_index; + qp->sq.queue.id = wq_spec.queue_index; send_cq->queue.id = cq_spec.queue_index; /* Create CQ table entry */ @@ -404,9 +386,9 @@ static int mana_ib_create_qp_raw(struct ib_qp *ibqp, struct ib_pd *ibpd, ibdev_dbg(&mdev->ib_dev, "ret %d qp->tx_object 0x%llx sq id %llu cq id %llu\n", err, - qp->tx_object, qp->sq_id, send_cq->queue.id); + qp->sq.tx_object, qp->sq.queue.id, send_cq->queue.id); - resp.sqid = qp->sq_id; + resp.sqid = qp->sq.queue.id; resp.cqid = send_cq->queue.id; resp.tx_vp_offset = pd->tx_vp_offset; @@ -425,13 +407,10 @@ static int mana_ib_create_qp_raw(struct ib_qp *ibqp, struct ib_pd *ibpd, gc->cq_table[send_cq->queue.id] = NULL; err_destroy_wq_obj: - mana_destroy_wq_obj(mpc, GDMA_SQ, qp->tx_object); + mana_destroy_wq_obj(mpc, GDMA_SQ, qp->sq.tx_object); -err_destroy_dma_region: - mana_ib_gd_destroy_dma_region(mdev, qp->sq_gdma_region); - -err_release_umem: - ib_umem_release(umem); +err_destroy_queue: + mana_ib_destroy_queue(mdev, &qp->sq.queue); err_free_vport: mana_ib_uncfg_vport(mdev, pd, port); @@ -505,12 +484,9 @@ static int mana_ib_destroy_qp_raw(struct mana_ib_qp *qp, struct ib_udata *udata) mpc = netdev_priv(ndev); pd = container_of(ibpd, struct mana_ib_pd, ibpd); - mana_destroy_wq_obj(mpc, GDMA_SQ, qp->tx_object); + mana_destroy_wq_obj(mpc, GDMA_SQ, qp->sq.tx_object); - if (qp->sq_umem) { - mana_ib_gd_destroy_dma_region(mdev, qp->sq_gdma_region); - ib_umem_release(qp->sq_umem); - } + mana_ib_destroy_queue(mdev, &qp->sq.queue); mana_ib_uncfg_vport(mdev, pd, qp->port); -- 2.43.0