From patchwork Thu Sep 19 03:05:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13807308 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B7862F28 for ; Thu, 19 Sep 2024 03:26:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726716416; cv=none; b=BLyDouC3M+VDG2rp5dJAqqBQ/Tg3vLHwNcx8PpbMbPg8aM/k9JhtE464lydunZZUKj71uewH/sGb7y9Dss2f2PBE8rZwQ9kTMve6oUbBDx4+vIrf2PUlAlDaLf/oDCk0NKLl25MQgPZKHwjvplqzpBHEyrJt7fUEqYvqulVrpTQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726716416; c=relaxed/simple; bh=9L7/UMGLYd23DqnqG0vpJIms0XbZ75xz8nRJnSIrlDU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=o2PGRS8yUEOpwBJqE9Iy119o853SRh6WWiP/lTv7U4WFxRQI9SRCjvmo0aTsTF9CxJeSiwzYsrIf147NgqP1WR0oEcden70Uuch4TbLAp1hv35By8Yx4s/hjVmsCIOfnDHKH/wAXYSUAOevqvpLlHbQiYhXZR9caWX5IKcnDalk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=EBjm3a3P; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="EBjm3a3P" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-71971d20a95so280885b3a.3 for ; Wed, 18 Sep 2024 20:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1726716414; x=1727321214; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=ASJBR2WWDc5Ivil9kGHYQQCa3Eo0/d547rlwumu8ksM=; b=EBjm3a3PYqBkh6fjjAibwycMS6fUdFDZugxw+H2k0IBJx7mm7pk3dGN/PR/GeS+zIO RxSTsOsJd1PT7fdjSFbDoPBlarGHDk8BP72BQQ0O5u9NM8nb00jkWooNkU5PPPTfAAUO WHfZ+Xb0rqIzYzlmfUKQXbPXZSyr+NwAx/9Fg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726716414; x=1727321214; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ASJBR2WWDc5Ivil9kGHYQQCa3Eo0/d547rlwumu8ksM=; b=dg2hD5ZnoCxWD4FuMeWKSsVv2Xy/00az2Y/o44mdvZoua573vBgMRVrVzKjK1twi2v qbi5+3ssLu8HUFTL9iPatQuHMSGihZc8hl/b1yKNd2SBO0qJnOkOVAQRrJRHJy6XCglU 2iL9Hvxwm5xgkFzlowrOgKvkDNPY1mTLZNksPkLgru2AiwLsVtkxHlzc87gjZDWN14mf zhoN+g0Egxc0mQT/llCjYqg6j11Wdg25R8LTAKCvRtgQ27U2A/Yiw0pv/mxPwPV63RXa ST56RHNSbCVl6RIPUyVKLbs8WZ1IraDSaGOr5jjo0pj9TNVTorPBv6NYmw8FOI3vkN3h 9Mjw== X-Gm-Message-State: AOJu0YwDgZMnflCS17TeyRCh0w6NHXWjGUIXGeEdepNGhvIj1C0MJUnI jsHVKcCJqYxTr27fe6aWxE+ns1O2ERgieahlNeJKNciMvHHKcjUqvyXyPC76F34+dOPcyL+KJkY = X-Google-Smtp-Source: AGHT+IG1HVnvP2XQjnoOcQ/hkxScy2KKrDUiLK6YFlseiFhz3ioVyJ9PDB4QqAIwK5aLBRyA6YqopQ== X-Received: by 2002:a05:6a00:c8f:b0:70d:2ac8:c838 with SMTP id d2e1a72fcca58-71936a3ac34mr36359268b3a.4.1726716414302; Wed, 18 Sep 2024 20:26:54 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71944a980b4sm7400686b3a.34.2024.09.18.20.26.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2024 20:26:53 -0700 (PDT) From: Selvin Xavier To: leon@kernel.org, jgg@ziepe.ca Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, kalesh-anakkur.purayil@broadcom.com, Selvin Xavier Subject: [PATCH v2 for-rc 1/6] RDMA/bnxt_re: Fix a possible memory leak Date: Wed, 18 Sep 2024 20:05:56 -0700 Message-Id: <1726715161-18941-2-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1726715161-18941-1-git-send-email-selvin.xavier@broadcom.com> References: <1726715161-18941-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Kalesh AP In bnxt_re_setup_chip_ctx() when bnxt_qplib_map_db_bar() fails driver is not freeing the memory allocated for "rdev->chip_ctx". Fixes: 0ac20faf5d83 ("RDMA/bnxt_re: Reorg the bar mapping") Signed-off-by: Selvin Xavier Signed-off-by: Kalesh AP --- drivers/infiniband/hw/bnxt_re/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index 16a84ca..72719c8 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -186,8 +186,11 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev) bnxt_re_set_db_offset(rdev); rc = bnxt_qplib_map_db_bar(&rdev->qplib_res); - if (rc) + if (rc) { + kfree(rdev->chip_ctx); + rdev->chip_ctx = NULL; return rc; + } if (bnxt_qplib_determine_atomics(en_dev->pdev)) ibdev_info(&rdev->ibdev, From patchwork Thu Sep 19 03:05:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13807309 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 291182F28 for ; Thu, 19 Sep 2024 03:26:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726716419; cv=none; b=K1eAXm4ZLmI3ltHa4CuRnOiCVCRie8gflPpBQZtxzSsPRdvmNPA+61Oz5hP87kATnxA9JFnNQr/wS/xJd8kVi3Jy5WKz23Z9NP3VeoLx8gX3c8gbHNPqAfrjKxk7ndJRqoDkngnD33Dy6gios600qf3SSdw+JHMdzWCBqZe5gFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726716419; c=relaxed/simple; bh=RAHEbb/L3GHBY0KmyIFigaHmB+Zy8cl5UTiMWrSXoJ0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=MEAosZmwtooX/7CBtTCWR8kIC+KB0/d18FdpbFuKK1BlvBnQ3Ymlm4sQfMrOPLSDKwKRSKcrvuFnbGOkW4w1yMe3cU4uwR9g2rTKcQYrDi5gfRq8zwLAynNVwJKErZ70kHxtQ+GlotMmFhPrbs/25jfB3w1VKF7zOno8VNZsJqs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=H+tJPodZ; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="H+tJPodZ" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-7198cb6bb02so234984b3a.3 for ; Wed, 18 Sep 2024 20:26:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1726716417; x=1727321217; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=03ASqymI4RekJ50OKXabyHgax5n64huK2dd3ddiQAlM=; b=H+tJPodZ6c1vWWG8XqRww3otKWwcZGVv46sVRdw7umw0scHBojal5LOOThFAx7GDye 2/nHYJqDcmLy6SoFmOQixnjJSVAEAre3zwRCcYueP+xrRNJYutI1kYLsnAdQC/rr5oNz Al/AtLt+VKu1MQ6AxK37q+kiopsY+W2PDNcT4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726716417; x=1727321217; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=03ASqymI4RekJ50OKXabyHgax5n64huK2dd3ddiQAlM=; b=sofi2wJ5JU98MvUNAWatxKRfUjh3crCcJPawZcZPBzWqIGwuKIEd0mVfRk6MWqshQ0 jBt8IZrRGf/+8P1U6ESzKlFDXOs/SxnKqbEw+T0AgWhdNIMOVthIyO3lKPxYcLd/eaig qGRBTrpVKKMc2jOdKx3eiKjQVl5quBiGFSRaIxEcmKEnENtjSrOwHKPORPFFj/s5oENK 4Zp1oRorpdh2JHiugmzPPW2HRMlH1cZMAoKGbqNxxypC3JiY37s4rtZuSdVAk0RuNmA+ BCnKSv9HxOwG9fN2TkYXj6wQx7/ZRPx/3+DdKtuD0/QZAR3LxbFePyKfUDBSj+U0nzhC go1A== X-Gm-Message-State: AOJu0YwMkxI9DUDN3gtp8nwZtx5ZceKoGltoG9ItjnVMRju48BLJ+9WO WUZ641sUMGOyn8cRscFgeFFWrC/t9kBQYoTiiN6g2mf2KjFFRCa1gez7FQRMww== X-Google-Smtp-Source: AGHT+IFwKgyqVM7I4k/79WIz21ojm7LF4YsGTf2XikTkviSJoOtg7WZj+GydfuLDSAHzcZTieGRHtQ== X-Received: by 2002:a05:6a00:2d05:b0:714:1bcf:3d93 with SMTP id d2e1a72fcca58-719260562d7mr35171768b3a.5.1726716417286; Wed, 18 Sep 2024 20:26:57 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71944a980b4sm7400686b3a.34.2024.09.18.20.26.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2024 20:26:56 -0700 (PDT) From: Selvin Xavier To: leon@kernel.org, jgg@ziepe.ca Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, kalesh-anakkur.purayil@broadcom.com, Saravanan Vajravel , Selvin Xavier Subject: [PATCH v2 for-rc 2/6] RDMA/bnxt_re: Fix incorrect AVID type in WQE structure Date: Wed, 18 Sep 2024 20:05:57 -0700 Message-Id: <1726715161-18941-3-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1726715161-18941-1-git-send-email-selvin.xavier@broadcom.com> References: <1726715161-18941-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Saravanan Vajravel Driver uses internal data structure to construct WQE frame. It used avid type as u16 which can accommodate up to 64K AVs. When outstanding AVID crosses 64K, driver truncates AVID and hence it uses incorrect AVID to WR. This leads to WR failure due to invalid AV ID and QP is moved to error state with reason set to 19 (INVALID AVID). When RDMA CM path is used, this issue hits QP1 and it is moved to error state Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver") Reviewed-by: Selvin Xavier Reviewed-by: Chandramohan Akula Signed-off-by: Saravanan Vajravel Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.h b/drivers/infiniband/hw/bnxt_re/qplib_fp.h index b62df87..820611a 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_fp.h +++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.h @@ -170,7 +170,7 @@ struct bnxt_qplib_swqe { }; u32 q_key; u32 dst_qp; - u16 avid; + u32 avid; } send; /* Send Raw Ethernet and QP1 */ From patchwork Thu Sep 19 03:05:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13807310 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7CE92F28 for ; Thu, 19 Sep 2024 03:27:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726716422; cv=none; b=KGzySV4hUql5W6KGBpFNfdwweYLsxLKwauJUFlfEzsWZVBvNha3WdgEVO7w6E9uNI1wkiq4xL6X4CU3BLmT8wD87CCJyg8rwtMdiDVukuytFwpOWKL0SCAXVfX1IVzUd/xdLV+TVBrfSk2jxgZQZeGb6tdV0TB5PrSdkAC7MtjI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726716422; c=relaxed/simple; bh=yHJBT0zktJrwBrQeXQk5Sz2r4oLmjnHknn8GxycdboY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=YtX4HVrYdv92gvbwcerW2WYP3gmCfZCBCEDtxlxb6+e48ZuYwdL0JlnO6T63QatL4HgJUcoy1r6e62dPsDpudydTzgYXtcGD8GzuEMD8PXlc8AkvLFbfp08OKTliNGV0X1yJOqRoO5wMZ4IJY9lp8mzfBlc/1A7xx1r1zLLL7z4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=AM+Urz88; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="AM+Urz88" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-71970655611so329153b3a.0 for ; Wed, 18 Sep 2024 20:27:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1726716420; x=1727321220; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=zfPUA/rgj8ZO5zioWhOvpSaAURSYsjgbOH0/+cb7F4w=; b=AM+Urz88tEjeUUrPog/UWicz3lndXb2Ap82wUJarqxOrpGW6FVUYrAbzM2VzweyoIx 0FOeTabtii9EAlF6H6GQWsFaUKOcx1NIV5fIApAyLmWSBGCiMKHUsckBujlFxZjPm412 7NRtsQE8N6OVmkgt/bf8pFEf1ug3yNhEzttHk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726716420; x=1727321220; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zfPUA/rgj8ZO5zioWhOvpSaAURSYsjgbOH0/+cb7F4w=; b=egWB7tO0Qhd1o2VGwWXrgWA/qi2qczQVt2DvlB9SOz6AkLVNPqObjAEiecN268hdds npWJrRvkeS4fzj8+Juz0vLW82IJNISZIT5DJeJ2Q9oTynFxZ1LPntLbtr7X66YENzumM tpBGlAkAqSXKw1ffd6yuYJ6yjfIb7qNodZA9VMpg1TZQq6KFjVnAvkKYI09EUSJXv+bX xFGQykm9zRV2fru1lvaKs4nicxUJp0vDeJbXrABQsmwS+J1qMN03q8e1J+w3MApz8JYL 9AX+lh31jmSI/ePBOiiOqunFmnwe5D3AQGMcaG4ndXA69iPoWaHDkx23pkkWW23PTPPx 75hw== X-Gm-Message-State: AOJu0YxbxZi3It8u/Oj7Owh0s/mIJuUHXuO9mNhU5PBMtdVHnwxV1fSP BwndM9woGLcxDqjv8v9+NHNjTIHJB9UqsltrTo0SU296X5hSiSCrgY2LQ3cKag== X-Google-Smtp-Source: AGHT+IFPpTrJt1q+Woy31wmn/40UO/PHkIK5Gh8002BVb/chaV8MGFwqjoNAsz7nAjd+4ndhRY4Jdw== X-Received: by 2002:a05:6a00:1948:b0:717:8ee0:4ea1 with SMTP id d2e1a72fcca58-71925fa95c9mr42636634b3a.0.1726716420035; Wed, 18 Sep 2024 20:27:00 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71944a980b4sm7400686b3a.34.2024.09.18.20.26.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2024 20:26:59 -0700 (PDT) From: Selvin Xavier To: leon@kernel.org, jgg@ziepe.ca Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, kalesh-anakkur.purayil@broadcom.com, Selvin Xavier Subject: [PATCH v2 for-rc 3/6] RDMA/bnxt_re: Add a check for memory allocation Date: Wed, 18 Sep 2024 20:05:58 -0700 Message-Id: <1726715161-18941-4-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1726715161-18941-1-git-send-email-selvin.xavier@broadcom.com> References: <1726715161-18941-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Kalesh AP __alloc_pbl() can return error when memory allocation fails. Driver is not checking the status on one of the instances. Fixes: 0c4dcd602817 ("RDMA/bnxt_re: Refactor hardware queue memory allocation") Reviewed-by: Selvin Xavier Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/qplib_res.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c index dfc943f..1fdffd6 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c @@ -244,6 +244,8 @@ int bnxt_qplib_alloc_init_hwq(struct bnxt_qplib_hwq *hwq, sginfo.pgsize = npde * pg_size; sginfo.npages = 1; rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_0], &sginfo); + if (rc) + goto fail; /* Alloc PBL pages */ sginfo.npages = npbl; From patchwork Thu Sep 19 03:05:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13807311 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF3472F28 for ; Thu, 19 Sep 2024 03:27:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726716425; cv=none; b=QYWGC1YNG9GF1uhLQPy195LEE7yGSP7UDMWtcByI+VKS/R9K34mDFZAQBl65xrkBZ9wh/eK4LpREIR+nkZlmuRyNNr+iepMFxZ/x9MnDM7jALlPa5dFxVOBqWNhLKkQ2XxHmmPajpkpIKzrkdYVJUSSfHoVqOL+HdLy/Kcw2nKs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726716425; c=relaxed/simple; bh=7XPNX3fmyCYlnzLWIzzORE/WQptsVAlPRa3b9shmw1I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=OLLXuk22CmILvDbudzXZ7DWeDqkFM91PGi95q3cHs3h4nSlDuS/Lf7UoVcy3PK6mp69QVMK4lI0lTxTnU5nNbCugu28fRjrUxhsk+3ZVPjVtFiFqylq7/G7+Dwlo0XsqcEwDXYA5/nRwyOvZAl7ShyKC5a7AjK9t0//i+xKQjFg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=LHFRSIS8; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="LHFRSIS8" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-7198cb6bb02so235023b3a.3 for ; Wed, 18 Sep 2024 20:27:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1726716423; x=1727321223; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=wSkJDWnJKIbCs5q7SLBq9WfPGFHGoHkAEjyRoOKqySk=; b=LHFRSIS8zaOuUi2bVpkg0RovpedNMQs3hLnhxlhnudP+UFg2pgy0S92F95bkmj8Iv+ VH0dCHoqcJVYll2QcFHSqv81htWhiSc68gBEVWgjQZtjhFH75F0Gl0z/Q3K/votUKLAX IguOVc/sHy4WgBTTag83qrYmopUXPPZcJGFdA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726716423; x=1727321223; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wSkJDWnJKIbCs5q7SLBq9WfPGFHGoHkAEjyRoOKqySk=; b=m+nguEk7yV8Iwvoy5LzYUT/iLiLGyliWm7LyOHlx3rVWKVDRUHcZP1AU5OXzS8ggSK 3aMEB1uX2eUcT0XOLKRPikKdKcbs9xRoXHNdBo9xCsh439jYwz5E8ib+QhIUIZGQXVFN mz5dTM48LrPVQpdgX0IErP9ck91HcQqmJMmmqv3t1A6/Hp87BlbRm7bayt1MffxCRAKE 16kNHFzwRIEBwy3EnRxjUGkHCzjpMdMA9sJtns5mItEUVIH1mL+haeUwn+tcihGyZSnO feIsx1aC57boPpicOaWHEsFR95/hXKaV+PlzpQIXMyl6wO2nwMQf0S3YUiVKTMGY31Qn HVlA== X-Gm-Message-State: AOJu0YwcixW9lUVHX0PlcMm2mwmgnynyBWo4cLvI4eclIsyXdpikVSLb 3COkQgmzzm5njK8HEeU5c7kbvt9JWpw8mrl+gxXReU37ftLn2ZYgXHDifJByT12kBlVl7S5mkwk = X-Google-Smtp-Source: AGHT+IG7OxCLwHnoKrrSqSq5br2Wq5Tglio3xYdKoCuf9j57DiVtO1hkeS+XieqaU8KRKZkEHLMkIg== X-Received: by 2002:a05:6a00:2d05:b0:714:1bcf:3d93 with SMTP id d2e1a72fcca58-719260562d7mr35172042b3a.5.1726716422864; Wed, 18 Sep 2024 20:27:02 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71944a980b4sm7400686b3a.34.2024.09.18.20.27.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2024 20:27:02 -0700 (PDT) From: Selvin Xavier To: leon@kernel.org, jgg@ziepe.ca Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, kalesh-anakkur.purayil@broadcom.com, Selvin Xavier Subject: [PATCH v2 for-rc 4/6] RDMA/bnxt_re: Fix the usage of control path spin locks Date: Wed, 18 Sep 2024 20:05:59 -0700 Message-Id: <1726715161-18941-5-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1726715161-18941-1-git-send-email-selvin.xavier@broadcom.com> References: <1726715161-18941-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Control path completion processing always runs in tasklet context. To synchronize with the posting thread, there is no need to use the irq variant of spin lock. Use spin_lock_bh instead. Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver") Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c index 3ffaef0c..5bef9b4 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c @@ -290,7 +290,6 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, struct bnxt_qplib_hwq *hwq; u32 sw_prod, cmdq_prod; struct pci_dev *pdev; - unsigned long flags; u16 cookie; u8 *preq; @@ -301,7 +300,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, /* Cmdq are in 16-byte units, each request can consume 1 or more * cmdqe */ - spin_lock_irqsave(&hwq->lock, flags); + spin_lock_bh(&hwq->lock); required_slots = bnxt_qplib_get_cmd_slots(msg->req); free_slots = HWQ_FREE_SLOTS(hwq); cookie = cmdq->seq_num & RCFW_MAX_COOKIE_VALUE; @@ -311,7 +310,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, dev_info_ratelimited(&pdev->dev, "CMDQ is full req/free %d/%d!", required_slots, free_slots); - spin_unlock_irqrestore(&hwq->lock, flags); + spin_unlock_bh(&hwq->lock); return -EAGAIN; } if (msg->block) @@ -367,7 +366,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw, wmb(); writel(cmdq_prod, cmdq->cmdq_mbox.prod); writel(RCFW_CMDQ_TRIG_VAL, cmdq->cmdq_mbox.db); - spin_unlock_irqrestore(&hwq->lock, flags); + spin_unlock_bh(&hwq->lock); /* Return the CREQ response pointer */ return 0; } @@ -486,7 +485,6 @@ static int __bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw, { struct creq_qp_event *evnt = (struct creq_qp_event *)msg->resp; struct bnxt_qplib_crsqe *crsqe; - unsigned long flags; u16 cookie; int rc; u8 opcode; @@ -512,12 +510,12 @@ static int __bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw, rc = __poll_for_resp(rcfw, cookie); if (rc) { - spin_lock_irqsave(&rcfw->cmdq.hwq.lock, flags); + spin_lock_bh(&rcfw->cmdq.hwq.lock); crsqe = &rcfw->crsqe_tbl[cookie]; crsqe->is_waiter_alive = false; if (rc == -ENODEV) set_bit(FIRMWARE_STALL_DETECTED, &rcfw->cmdq.flags); - spin_unlock_irqrestore(&rcfw->cmdq.hwq.lock, flags); + spin_unlock_bh(&rcfw->cmdq.hwq.lock); return -ETIMEDOUT; } @@ -628,7 +626,6 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, u16 cookie, blocked = 0; bool is_waiter_alive; struct pci_dev *pdev; - unsigned long flags; u32 wait_cmds = 0; int rc = 0; @@ -659,8 +656,7 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, * */ - spin_lock_irqsave_nested(&hwq->lock, flags, - SINGLE_DEPTH_NESTING); + spin_lock_nested(&hwq->lock, SINGLE_DEPTH_NESTING); cookie = le16_to_cpu(qp_event->cookie); blocked = cookie & RCFW_CMD_IS_BLOCKING; cookie &= RCFW_MAX_COOKIE_VALUE; @@ -672,7 +668,7 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, dev_info(&pdev->dev, "rcfw timedout: cookie = %#x, free_slots = %d", cookie, crsqe->free_slots); - spin_unlock_irqrestore(&hwq->lock, flags); + spin_unlock(&hwq->lock); return rc; } @@ -720,7 +716,7 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, __destroy_timedout_ah(rcfw, (struct creq_create_ah_resp *) qp_event); - spin_unlock_irqrestore(&hwq->lock, flags); + spin_unlock(&hwq->lock); } *num_wait += wait_cmds; return rc; @@ -734,12 +730,11 @@ static void bnxt_qplib_service_creq(struct tasklet_struct *t) u32 type, budget = CREQ_ENTRY_POLL_BUDGET; struct bnxt_qplib_hwq *hwq = &creq->hwq; struct creq_base *creqe; - unsigned long flags; u32 num_wakeup = 0; u32 hw_polled = 0; /* Service the CREQ until budget is over */ - spin_lock_irqsave(&hwq->lock, flags); + spin_lock_bh(&hwq->lock); while (budget > 0) { creqe = bnxt_qplib_get_qe(hwq, hwq->cons, NULL); if (!CREQ_CMP_VALID(creqe, creq->creq_db.dbinfo.flags)) @@ -782,7 +777,7 @@ static void bnxt_qplib_service_creq(struct tasklet_struct *t) if (hw_polled) bnxt_qplib_ring_nq_db(&creq->creq_db.dbinfo, rcfw->res->cctx, true); - spin_unlock_irqrestore(&hwq->lock, flags); + spin_unlock_bh(&hwq->lock); if (num_wakeup) wake_up_nr(&rcfw->cmdq.waitq, num_wakeup); } From patchwork Thu Sep 19 03:06:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13807312 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 785E0134AB for ; Thu, 19 Sep 2024 03:27:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726716428; cv=none; b=EApBe5BBwnoHvH7TGwwU+ENhrwOhEJcqLDdkmWZV1wVkrB4YMVRwSAkY/LDMqDoYnuwM/622bCBesFCdmKZkcyVBkCNaFRvur8sxLgLso2Ua9GsjRhJEFEMoTC4VWvkW6bl43fiUv5jNJxPwfO37vmxJy6K+fF3PShiFOn9bJ3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726716428; c=relaxed/simple; bh=+dH/o625Wuunev4SjctbKJdZ1KZdmY7f9qgB0UlXDBs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=XuirrZ8iCw2PRAndbyrkGJCFjIKMSiUaBXASILiMHIrs+iIQuHHtO7OyD6W1Ip6GfOZoZxYaMNYtLt/ADtM+qYFAEGqg6c27Jjxz600v/qi30gDZS6lKvWBdJ0jfrAaU5AilTsEy+kVgw4527Fcac0ymCMRV4uEWya6McFGtECY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=bORREXrn; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="bORREXrn" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-7193010d386so284400b3a.1 for ; Wed, 18 Sep 2024 20:27:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1726716426; x=1727321226; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=Gc+IIfNrASI+jpmd9bQl5bjeRIt7G5gmpdvd7WW4FgA=; b=bORREXrnPpFFYNpbZuapSuniLE8IkWkyRsd5YeIRiykjP3c6ifs6M5nHHYVYaxhZhk E7jQLORVh50f94/m3+2qGMd8fEtXP5zCM9Z1OJZ7v2TnF8YE9gZwyyaKmazczPUlFEhA ibGIzJI29PvBsXyRu0mDPhFAG3UZIB4I8NROo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726716426; x=1727321226; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Gc+IIfNrASI+jpmd9bQl5bjeRIt7G5gmpdvd7WW4FgA=; b=dmtetTdHr8Bo964YR5ZUPfhMVa8VpXJSFC9SPCDXhrY875hd5FHuH2hgoJgDNiTih2 6IDx1p2vJqz9WDgZQSqejr3xVyHUELklu8NEupczXSK/KNxDlyDQUnlITjmE1SD2zxfu HYIxjy13X6t7eQF+kV+irjYOWa8ustPzN533VLbakUJbO1J3H949emVWlaJuPot5Em0O XRePN7wYZeFgQHVCfbyv+zv1xMauJIaeZJzPfj1dITxQ0+eGgPOt7MHC3bM1VhdLiumD iiwRlVU7JV7gP5wqr6EtbWZbIdeXcG09LI0ksPx5xFMKB1yjv7UHken+IqNd7LdCUrLo AuDA== X-Gm-Message-State: AOJu0YyKJ+2a2HNoMBCurWc85JgjNr4WYywZMOUZgvBpOSpjYFVNFOki gd3Do0tpyd6mH1xvxezNNHNsxjEZ1X/qwc5X8ePD/yLqjcMM2fSUu92Oqbg95A== X-Google-Smtp-Source: AGHT+IGhWD0PNcrnElNwdx0mqVccwyZIgC4gh8ZiSutdS70h5CKVAVrNhAQimNrKwxUjXP8mrsoacA== X-Received: by 2002:a05:6a00:179c:b0:706:29e6:2ed2 with SMTP id d2e1a72fcca58-71936a35d17mr32117360b3a.5.1726716425654; Wed, 18 Sep 2024 20:27:05 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71944a980b4sm7400686b3a.34.2024.09.18.20.27.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2024 20:27:04 -0700 (PDT) From: Selvin Xavier To: leon@kernel.org, jgg@ziepe.ca Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, kalesh-anakkur.purayil@broadcom.com, Selvin Xavier Subject: [PATCH v2 for-rc 5/6] RDMA/bnxt_re: synchronize the qp-handle table array Date: Wed, 18 Sep 2024 20:06:00 -0700 Message-Id: <1726715161-18941-6-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1726715161-18941-1-git-send-email-selvin.xavier@broadcom.com> References: <1726715161-18941-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: There is a race between the CREQ tasklet and destroy qp when accessing the qp-handle table. There is a chance of reading a valid qp-handle in the CREQ tasklet handler while the QP is already moving ahead with the destruction. Fixing this race by implementing a table-lock to synchronize the access. Fixes: f218d67ef004 ("RDMA/bnxt_re: Allow posting when QPs are in error") Fixes: 84cf229f4001 ("RDMA/bnxt_re: Fix the qp table indexing") Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier Reviewed-by: Zhu Yanjun --- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 4 ++++ drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 13 +++++++++---- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c index 42e98e5..bc358bd 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c @@ -1527,9 +1527,11 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, u32 tbl_indx; int rc; + spin_lock_bh(&rcfw->tbl_lock); tbl_indx = map_qp_id_to_tbl_indx(qp->id, rcfw); rcfw->qp_tbl[tbl_indx].qp_id = BNXT_QPLIB_QP_ID_INVALID; rcfw->qp_tbl[tbl_indx].qp_handle = NULL; + spin_unlock_bh(&rcfw->tbl_lock); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req, CMDQ_BASE_OPCODE_DESTROY_QP, @@ -1540,8 +1542,10 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, sizeof(resp), 0); rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); if (rc) { + spin_lock_bh(&rcfw->tbl_lock); rcfw->qp_tbl[tbl_indx].qp_id = qp->id; rcfw->qp_tbl[tbl_indx].qp_handle = qp; + spin_unlock_bh(&rcfw->tbl_lock); return rc; } diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c index 5bef9b4..85bfedc 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c @@ -634,17 +634,21 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION: err_event = (struct creq_qp_error_notification *)qp_event; qp_id = le32_to_cpu(err_event->xid); + spin_lock_nested(&rcfw->tbl_lock, SINGLE_DEPTH_NESTING); tbl_indx = map_qp_id_to_tbl_indx(qp_id, rcfw); qp = rcfw->qp_tbl[tbl_indx].qp_handle; + if (!qp) { + spin_unlock(&rcfw->tbl_lock); + break; + } + bnxt_qplib_mark_qp_error(qp); + rc = rcfw->creq.aeq_handler(rcfw, qp_event, qp); + spin_unlock(&rcfw->tbl_lock); dev_dbg(&pdev->dev, "Received QP error notification\n"); dev_dbg(&pdev->dev, "qpid 0x%x, req_err=0x%x, resp_err=0x%x\n", qp_id, err_event->req_err_state_reason, err_event->res_err_state_reason); - if (!qp) - break; - bnxt_qplib_mark_qp_error(qp); - rc = rcfw->creq.aeq_handler(rcfw, qp_event, qp); break; default: /* @@ -973,6 +977,7 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res, GFP_KERNEL); if (!rcfw->qp_tbl) goto fail; + spin_lock_init(&rcfw->tbl_lock); rcfw->max_timeout = res->cctx->hwrm_cmd_max_timeout; diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h index 45996e6..07779ae 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.h @@ -224,6 +224,8 @@ struct bnxt_qplib_rcfw { struct bnxt_qplib_crsqe *crsqe_tbl; int qp_tbl_size; struct bnxt_qplib_qp_node *qp_tbl; + /* To synchronize the qp-handle hash table */ + spinlock_t tbl_lock; u64 oos_prev; u32 init_oos_stats; u32 cmdq_depth; From patchwork Thu Sep 19 03:06:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13807313 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16EA912E78 for ; Thu, 19 Sep 2024 03:27:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726716430; cv=none; b=d0TYMc+3jjvMbMywk2ZOLF27aO79IwzCe+SkSjOI7+e7ugy1IA3Rr1ArIqosg0xjkIpyjHSTMH2KK3sduKMwCW77BTrmxtcE+sOhWpUFE2jj0X546HGYVRz516AUwLvLrPru3Fr229HMoEERpFNqyn8tR3nY2gPBngyABg+Dte8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726716430; c=relaxed/simple; bh=LEGuH4tSOoIsNwRghgKcYErGRomBiyo65BIFsSBqd1A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=UJEcXITJXWrjyOI0ISnuLdGMC9LvVOQiEOCkxxKPiQik4U4Jv6kflZqBPlBlkVNBjkIAGRtCx/ZTNEux2Jh9EXJkWW42+8tQwe9MaasGauciI0vJEWh99511K/RuMsCzzpFoOa+edFBPVHb+lyt5eJWzmN5rACxfiGRCtGs1nWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=Ke+kJanU; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Ke+kJanU" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-718e285544fso262246b3a.1 for ; Wed, 18 Sep 2024 20:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1726716428; x=1727321228; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=jvs8x34GuGbqFJA8MliJr5Q8W9/ZFBbyCkYLeglcrYc=; b=Ke+kJanUlTGvVJt+ib2S9W7FHgou8pjGzf/v0ZqWXENZ95jrZBXMzIeNMp0bku3NHb 9UmhhBj9mIekKdkPqqWoZeTfcCy96g0bp+P9rqHTMAUDsKDGz2oIc/5PY2YC1by6S+pH DTuU7uA7CzE/J5VBcxFhrKLYLovyvK8SCqXMg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726716428; x=1727321228; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jvs8x34GuGbqFJA8MliJr5Q8W9/ZFBbyCkYLeglcrYc=; b=oFRBIv2nyIt5n6J7Lx6uwScuu+aPJ2E0nLNMyAXaamrjZast9R2xFWqd2SgYFMQM+P LNdP9eOgD4z2GDVbq0wiZCaXICyk434mSnjmLkBCd6M5HVh1E53+o7VwR5e39Eiq9Win 9xM4H8/WSdna/q1cbQtiowsO7q2cK7oUbz+WNCEusW+NlYZvdb98OfCc49J/T++XZhBV UryjYjcqzVyzsa2oBUNcL0/yEnRF9UUOQAB5DdWZz/2f64F4OmzuC+nIESPHWIUjRRfy DnkzRjmlFlN2MD1OBTSNzcnjvWDgRcc7nw8mkd0efZlOlpZ/X5ALA1vuPJhYpe+Hb7jy RXQw== X-Gm-Message-State: AOJu0Yz4CDJWVVF6TkQbnjhlN+KO+SuWXj9FLjp2Ldqaun7puVmgZC7v 4Nu6yuUXcXukCfLTQGdf5i5snj5hlUD6iZwazi0dCGhZtO3FP7Xu7p5RJcCBUg== X-Google-Smtp-Source: AGHT+IGovtT04LGbAYJR+tX0Ez5roL5HmGiG6YsEAWGg0o5C6OUdHdOKqnUFMo5lqiis0FVhRdhDIg== X-Received: by 2002:a05:6a00:23c3:b0:70d:3337:7820 with SMTP id d2e1a72fcca58-71936a4d269mr30337660b3a.8.1726716428401; Wed, 18 Sep 2024 20:27:08 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71944a980b4sm7400686b3a.34.2024.09.18.20.27.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2024 20:27:07 -0700 (PDT) From: Selvin Xavier To: leon@kernel.org, jgg@ziepe.ca Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, kalesh-anakkur.purayil@broadcom.com, Selvin Xavier Subject: [PATCH v2 for-rc 6/6] RDMA/bnxt_re: Fix the max WQEs used in Static WQE mode Date: Wed, 18 Sep 2024 20:06:01 -0700 Message-Id: <1726715161-18941-7-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1726715161-18941-1-git-send-email-selvin.xavier@broadcom.com> References: <1726715161-18941-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: max_sw_wqe used for static wqe mode should be same as the max_wqe. Calculate the max_sw_wqe only for the variable WQE mode. Fixes: de1d364c3815 ("RDMA/bnxt_re: Add support for Variable WQE in Genp7 adapters") Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c index 460f339..e66ae9f 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -1307,7 +1307,11 @@ static int bnxt_re_init_sq_attr(struct bnxt_re_qp *qp, 0 : BNXT_QPLIB_RESERVED_QP_WRS; entries = bnxt_re_init_depth(entries + diff + 1, uctx); sq->max_wqe = min_t(u32, entries, dev_attr->max_qp_wqes + diff + 1); - sq->max_sw_wqe = bnxt_qplib_get_depth(sq, qplqp->wqe_mode, true); + if (qplqp->wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE) + sq->max_sw_wqe = bnxt_qplib_get_depth(sq, qplqp->wqe_mode, true); + else + sq->max_sw_wqe = sq->max_wqe; + } sq->q_full_delta = diff + 1; /*