[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SA6PR21MB4231EF74ABA149C87531E749CEE02@SA6PR21MB4231.namprd21.prod.outlook.com>
Date: Thu, 23 Jan 2025 05:25:02 +0000
From: Long Li <longli@...rosoft.com>
To: Konstantin Taranov <kotaranov@...ux.microsoft.com>, Konstantin Taranov
<kotaranov@...rosoft.com>, Shiraz Saleem <shirazsaleem@...rosoft.com>,
"pabeni@...hat.com" <pabeni@...hat.com>, Haiyang Zhang
<haiyangz@...rosoft.com>, KY Srinivasan <kys@...rosoft.com>,
"edumazet@...gle.com" <edumazet@...gle.com>, "kuba@...nel.org"
<kuba@...nel.org>, "davem@...emloft.net" <davem@...emloft.net>, Dexuan Cui
<decui@...rosoft.com>, "wei.liu@...nel.org" <wei.liu@...nel.org>,
"sharmaajay@...rosoft.com" <sharmaajay@...rosoft.com>, "jgg@...pe.ca"
<jgg@...pe.ca>, "leon@...nel.org" <leon@...nel.org>
CC: "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>
Subject: RE: [PATCH rdma-next 03/13] RDMA/mana_ib: helpers to allocate kernel
queues
> Subject: [PATCH rdma-next 03/13] RDMA/mana_ib: helpers to allocate kernel
> queues
>
> From: Konstantin Taranov <kotaranov@...rosoft.com>
>
> Introduce helpers to allocate queues for kernel-level use.
>
> Signed-off-by: Konstantin Taranov <kotaranov@...rosoft.com>
> Reviewed-by: Shiraz Saleem <shirazsaleem@...rosoft.com>
Reviewed-by: Long Li <longli@...rosoft.com>
> ---
> drivers/infiniband/hw/mana/main.c | 23 +++++++++++++++++++
> drivers/infiniband/hw/mana/mana_ib.h | 3 +++
> .../net/ethernet/microsoft/mana/gdma_main.c | 1 +
> 3 files changed, 27 insertions(+)
>
> diff --git a/drivers/infiniband/hw/mana/main.c
> b/drivers/infiniband/hw/mana/main.c
> index 45b251b..f2f6bb3 100644
> --- a/drivers/infiniband/hw/mana/main.c
> +++ b/drivers/infiniband/hw/mana/main.c
> @@ -240,6 +240,27 @@ void mana_ib_dealloc_ucontext(struct ib_ucontext
> *ibcontext)
> ibdev_dbg(ibdev, "Failed to destroy doorbell page %d\n", ret); }
>
> +int mana_ib_create_kernel_queue(struct mana_ib_dev *mdev, u32 size, enum
> gdma_queue_type type,
> + struct mana_ib_queue *queue)
> +{
> + struct gdma_context *gc = mdev_to_gc(mdev);
> + struct gdma_queue_spec spec = {};
> + int err;
> +
> + queue->id = INVALID_QUEUE_ID;
> + queue->gdma_region = GDMA_INVALID_DMA_REGION;
> + spec.type = type;
> + spec.monitor_avl_buf = false;
> + spec.queue_size = size;
> + err = mana_gd_create_mana_wq_cq(&gc->mana_ib, &spec, &queue-
> >kmem);
> + if (err)
> + return err;
> + /* take ownership into mana_ib from mana */
> + queue->gdma_region = queue->kmem->mem_info.dma_region_handle;
> + queue->kmem->mem_info.dma_region_handle =
> GDMA_INVALID_DMA_REGION;
> + return 0;
> +}
> +
> int mana_ib_create_queue(struct mana_ib_dev *mdev, u64 addr, u32 size,
> struct mana_ib_queue *queue)
> {
> @@ -279,6 +300,8 @@ void mana_ib_destroy_queue(struct mana_ib_dev
> *mdev, struct mana_ib_queue *queue
> */
> mana_ib_gd_destroy_dma_region(mdev, queue->gdma_region);
> ib_umem_release(queue->umem);
> + if (queue->kmem)
> + mana_gd_destroy_queue(mdev_to_gc(mdev), queue->kmem);
> }
>
> static int
> diff --git a/drivers/infiniband/hw/mana/mana_ib.h
> b/drivers/infiniband/hw/mana/mana_ib.h
> index b53a5b4..79ebd95 100644
> --- a/drivers/infiniband/hw/mana/mana_ib.h
> +++ b/drivers/infiniband/hw/mana/mana_ib.h
> @@ -52,6 +52,7 @@ struct mana_ib_adapter_caps {
>
> struct mana_ib_queue {
> struct ib_umem *umem;
> + struct gdma_queue *kmem;
> u64 gdma_region;
> u64 id;
> };
> @@ -388,6 +389,8 @@ int mana_ib_create_dma_region(struct mana_ib_dev
> *dev, struct ib_umem *umem, int mana_ib_gd_destroy_dma_region(struct
> mana_ib_dev *dev,
> mana_handle_t gdma_region);
>
> +int mana_ib_create_kernel_queue(struct mana_ib_dev *mdev, u32 size, enum
> gdma_queue_type type,
> + struct mana_ib_queue *queue);
> int mana_ib_create_queue(struct mana_ib_dev *mdev, u64 addr, u32 size,
> struct mana_ib_queue *queue);
> void mana_ib_destroy_queue(struct mana_ib_dev *mdev, struct
> mana_ib_queue *queue); diff --git
> a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> index e97af7a..3cb0543 100644
> --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> @@ -867,6 +867,7 @@ free_q:
> kfree(queue);
> return err;
> }
> +EXPORT_SYMBOL_NS(mana_gd_create_mana_wq_cq, NET_MANA);
>
> void mana_gd_destroy_queue(struct gdma_context *gc, struct gdma_queue
> *queue) {
> --
> 2.43.0
Powered by blists - more mailing lists