Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1591909rdb; Wed, 31 Jan 2024 03:31:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IGs+oYANj5uulRILKB0IHxV44c0b6DzRqSBW5QyabLqY9gEKjUhh26op/o3CvgmJ5yC5UL8 X-Received: by 2002:a05:6a20:816:b0:19c:9da5:191b with SMTP id z22-20020a056a20081600b0019c9da5191bmr4069131pza.8.1706700677066; Wed, 31 Jan 2024 03:31:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706700677; cv=pass; d=google.com; s=arc-20160816; b=rHuC/6r290AEwB6QO15jsBHA20EjSpLdft24wi2E7wsL3kOWaCReZiCTkKj1XikB7i 4nUujLdIMsyPMix5sFjpOv8Py1pI3sKJZ3LplSH1DtoP9aV02acykQT2CE6skfPRwYka 22RyzjUVsRko9UUFrpxF58VJS1YA3zxbj0I5Fa3BoDDxeh6OaG4+7bq855An5zmuxw0h Va3OH1wgf69uGYgrr4FNwngcNc9tMI1fs5RS7SG1RG7JB6Xoc2sm3z1y6DkFoK/KBvpO wJPFjTT4Nrw6YkkvN9aXMnw0cBQPHduT8z5LmR9CCYlwHNzjX01NjSnQWA+hCOcOSrGJ Vndg== 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=saDdL5sYNRP0RdrEfccKfGdzxJcVkUQ2VWnSyr2q/F4=; fh=Py0mZNNIi7rQ85AXfNaDXAKBdwtxxJbfx1rfLR313oI=; b=dyHRb8gzCKucGpQAOrCefqNTRJvfX24z9TKEg2lUe0ox26QPWq6EhMg44HdpxVuaKH TPV0TqvS74S1xd3U31ghHjRqcyaN5bkBTDadIB24tF5dcu2mNobJazTJ40uGc8/aE+jo QQBe7ExPvn7dOSBcPigtRn5cZnYhHRc40EiaNhj0TiKXy4ssQqllsPbaxbNKiNVmQCcH fxuAhXZFrO0yslI1+759AAicY2uWxOTJnCdZEvV9t71EWnB0pORqogkjdrV5udMYuMBq ImEsaIzrl6zP3i9Yu72W8kzCTyzqs0ooB/Bhfpv9mzPpHisxo9rp0lbJEhyRUdbSreqw EnwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=gNepmmLp; 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-46275-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46275-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com X-Forwarded-Encrypted: i=1; AJvYcCVQOx7GVr1eqYQ3WEgRa5n1i45SKbopCsBgcSk1Mlj05zNsViw1lHKFfj5cz2aySApd3aI6Nyem88ZKcB93VhGp/fa+iOUa549HrIJ5Wg== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 138-20020a630290000000b005d818072f2esi8713028pgc.874.2024.01.31.03.31.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 03:31:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46275-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=gNepmmLp; 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-46275-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46275-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 4BD4CB303AF for ; Wed, 31 Jan 2024 10:56:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6ACB6762E0; Wed, 31 Jan 2024 10:56:00 +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="gNepmmLp" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 063D669E07; Wed, 31 Jan 2024 10:55:57 +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=1706698559; cv=none; b=GxojwrV6PbypJhb3zmdRK4UuI1H9YqYrNe0eSx/Wx0s8JhnJ9pnRlPP2CqEI8Jg1q4f8vh3sh6IgZoRbXgZJN9Wq3tEDT75e3ORJ/par+Hq+Xjg63ouExhay1QTaQ9s2WLQVwx+GcsulkPLTarSoJx9Syuxb6bUejK8cASqpOxc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706698559; c=relaxed/simple; bh=4ZmPsc+rDgX7rX3N3RoK8DZaj+dzW3V5EQi2cFZw9c4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=bVrNBZfi1uQCvvq3ggLbGPkwx1IRUfzzmqvR/N9RV+7yp9stIyUdEFlQVD/jnvXi7nfyAgD+aZsGmBPPyCwl/IBvZroTYihxIMJbjS6vm956y3DO0d0rA7ZXBlRUkealJIwwWFCtvotfYhkP+vrSGlpeD1Eb/jPOmUWL1dlpvXQ= 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=gNepmmLp; 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 AAE0720B2001; Wed, 31 Jan 2024 02:55:57 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AAE0720B2001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1706698557; bh=saDdL5sYNRP0RdrEfccKfGdzxJcVkUQ2VWnSyr2q/F4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gNepmmLp+bdtSeHkAgPlZ4++Kj2eo3GdZt371DiIVOMy8sQ1+PqN8T2ayv+z3lwCZ wJnazxG3Z5n5Ciy28iJO2vQV406v9lcRpGeKmWBtopB1rYZ0P5mxtNZzYz58Dj/SA2 uNVMXBcu1KV4fa2RVkJ5852mtYi9wuwMcJbWwTWA= 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 v1 1/5] RDMA/mana_ib: Add EQ creation for rnic adapter Date: Wed, 31 Jan 2024 02:55:48 -0800 Message-Id: <1706698552-25383-2-git-send-email-kotaranov@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1706698552-25383-1-git-send-email-kotaranov@linux.microsoft.com> References: <1706698552-25383-1-git-send-email-kotaranov@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: This patch introduces functions for RNIC creation and creates one EQ for RNIC creation. Signed-off-by: Konstantin Taranov --- drivers/infiniband/hw/mana/device.c | 9 ++++-- drivers/infiniband/hw/mana/main.c | 53 ++++++++++++++++++++++++++++++++++++ drivers/infiniband/hw/mana/mana_ib.h | 5 ++++ 3 files changed, 64 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/mana/device.c b/drivers/infiniband/hw/mana/device.c index 6fa902e..d8e8b10 100644 --- a/drivers/infiniband/hw/mana/device.c +++ b/drivers/infiniband/hw/mana/device.c @@ -92,15 +92,19 @@ static int mana_ib_probe(struct auxiliary_device *adev, goto deregister_device; } + mana_ib_gd_create_rnic_adapter(dev); + ret = ib_register_device(&dev->ib_dev, "mana_%d", mdev->gdma_context->dev); if (ret) - goto deregister_device; + goto destroy_rnic_adapter; dev_set_drvdata(&adev->dev, dev); return 0; +destroy_rnic_adapter: + mana_ib_gd_destroy_rnic_adapter(dev); deregister_device: mana_gd_deregister_device(dev->gdma_dev); free_ib_device: @@ -113,9 +117,8 @@ static void mana_ib_remove(struct auxiliary_device *adev) struct mana_ib_dev *dev = dev_get_drvdata(&adev->dev); ib_unregister_device(&dev->ib_dev); - + mana_ib_gd_destroy_rnic_adapter(dev); mana_gd_deregister_device(dev->gdma_dev); - ib_dealloc_device(&dev->ib_dev); } diff --git a/drivers/infiniband/hw/mana/main.c b/drivers/infiniband/hw/mana/main.c index 29dd243..c64d569 100644 --- a/drivers/infiniband/hw/mana/main.c +++ b/drivers/infiniband/hw/mana/main.c @@ -548,3 +548,56 @@ int mana_ib_gd_query_adapter_caps(struct mana_ib_dev *dev) return 0; } + +static int mana_ib_create_eqs(struct mana_ib_dev *mdev) +{ + struct gdma_context *gc = mdev_to_gc(mdev); + struct gdma_queue_spec spec = {}; + int err; + + spec.type = GDMA_EQ; + spec.monitor_avl_buf = false; + spec.queue_size = EQ_SIZE; + spec.eq.callback = NULL; + spec.eq.context = mdev; + spec.eq.log2_throttle_limit = LOG2_EQ_THROTTLE; + spec.eq.msix_index = 0; + + err = mana_gd_create_mana_eq(&gc->mana_ib, &spec, &mdev->fatal_err_eq); + if (err) + return err; + + return 0; +} + +static void mana_ib_destroy_eqs(struct mana_ib_dev *mdev) +{ + if (!mdev->fatal_err_eq) + return; + + mana_gd_destroy_queue(mdev_to_gc(mdev), mdev->fatal_err_eq); + mdev->fatal_err_eq = NULL; +} + +void mana_ib_gd_create_rnic_adapter(struct mana_ib_dev *mdev) +{ + int err; + + err = mana_ib_create_eqs(mdev); + if (err) { + ibdev_err(&mdev->ib_dev, "Failed to create EQs for RNIC err %d", err); + goto cleanup; + } + + return; + +cleanup: + ibdev_warn(&mdev->ib_dev, + "RNIC is not available. Only RAW QPs are supported"); + mana_ib_destroy_eqs(mdev); +} + +void mana_ib_gd_destroy_rnic_adapter(struct mana_ib_dev *mdev) +{ + mana_ib_destroy_eqs(mdev); +} diff --git a/drivers/infiniband/hw/mana/mana_ib.h b/drivers/infiniband/hw/mana/mana_ib.h index 6a03ae6..a4b94ee 100644 --- a/drivers/infiniband/hw/mana/mana_ib.h +++ b/drivers/infiniband/hw/mana/mana_ib.h @@ -48,6 +48,7 @@ struct mana_ib_adapter_caps { struct mana_ib_dev { struct ib_device ib_dev; struct gdma_dev *gdma_dev; + struct gdma_queue *fatal_err_eq; struct mana_ib_adapter_caps adapter_caps; }; @@ -228,4 +229,8 @@ int mana_ib_query_gid(struct ib_device *ibdev, u32 port, int index, void mana_ib_disassociate_ucontext(struct ib_ucontext *ibcontext); int mana_ib_gd_query_adapter_caps(struct mana_ib_dev *mdev); + +void mana_ib_gd_create_rnic_adapter(struct mana_ib_dev *mdev); + +void mana_ib_gd_destroy_rnic_adapter(struct mana_ib_dev *mdev); #endif -- 1.8.3.1