From patchwork Tue Oct 8 07:41:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13825931 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.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 387041E32DD for ; Tue, 8 Oct 2024 08:02:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374564; cv=none; b=EKC2ru4e29KzifVfOKUSOICl1tcKa56wOBD0ocGkOgTbSzchtDn2JrsSVPIWMKCH5/p39C3PLzP8APjyTWXljMEYngsjVxpD/i/9uAZ3iR99WkcuBESOxT/4xAAwxavn1CH4jnEu4NDvdbcoHsdy7K3ynhkreBGDz4sUFo4j3Hk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374564; c=relaxed/simple; bh=diS55E6awTAYUhoOaKfgHQOliA2vXxFwudo0cn3R3TQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=u3U+6n2TD/mfLaMCiW6NjyUtvWGmc94AC0Jlpe2VPSkpR8nuyPfO824kvQZ4UEo4kcIQzrIOmKN5E/FqN4JfPmGxHI5kEAw5g/aEHwH6o9U9B5Sike1u+1jEJxvjdZr4kLsWA+99dO9cumirsweM6vqgmEgFYsKOJia5mZAZCDU= 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=NvWYPmMN; arc=none smtp.client-ip=209.85.214.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="NvWYPmMN" Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-20bcae5e482so46290565ad.0 for ; Tue, 08 Oct 2024 01:02:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1728374561; x=1728979361; 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=ACuz4S4P9KJ42l4wMrBRlMhNyXuBrVIndcKfsMl1Yxg=; b=NvWYPmMNDseYuJDp9HQCLLtcMhM2w38WJXxqqZV03GwsFT+kQFbE+od1cmMhM0nwAM 9N3OoAUWD8kIUBFxcbP8nxYiLUUHSXft6OcZQkO1p3SurwZ5OV0feqBF9141ceGzWkIh d8Z6Wa1GLisqqp8t2cj2ZOiyqRabPZGmH3Hl8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728374561; x=1728979361; 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=ACuz4S4P9KJ42l4wMrBRlMhNyXuBrVIndcKfsMl1Yxg=; b=COdRSzAf1M16DzlOx9Bdu8waC0FDYmWYZ2dfyedsQXpKgq4fGF1xLGD+SBv/W+nRfy tPuWXMeyuQwJ5G6wQLepQqut/lSeZIH+3Si7PMJWfoL6iMzfaudgODOnv8weinCTMx89 fNHJTo1OsqVktkwUko05snIIfojxtRc3c21JErTskjphx8BtpWDnt4c74motU0TDW/Hd E0IRSNNYdWvXkdoqJU5lCvtQ59LSPMU9A0iNQ+cR6nqZnsJ25BBtf7gq+wXaZI2F7YI5 7kF8yKa1S7bCy+7EHbzu1ZTeUzh3t2NGCr+v5QQc0irnaBSiXknxCaqnjf6uvJyfOhEL AigA== X-Gm-Message-State: AOJu0Yyjf8OkCHoN51NUWXZzoZz3sGorXwIimzUkQTT5n90e01xY4DSz 345Mu12+4qI0gAFYtTES+wlKRsyi1bC8OOIf4j+bQxMN3l4s8thJ4cpCaN6t0g== X-Google-Smtp-Source: AGHT+IHdPstX9BoKCiPv5/+jj32h8t79l3YxZktTXlfsPxM7PUypNgkCInnlvBfu78xa+8GhADLmFw== X-Received: by 2002:a17:902:f642:b0:205:6114:9628 with SMTP id d9443c01a7336-20bfe023d32mr245595045ad.7.1728374561303; Tue, 08 Oct 2024 01:02:41 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396d547sm50339915ad.223.2024.10.08.01.02.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2024 01:02:40 -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, Abhishek Mohapatra , Selvin Xavier Subject: [PATCH for-rc 01/10] RDMA/bnxt_re: Fix the max CQ WQEs for older adapters Date: Tue, 8 Oct 2024 00:41:33 -0700 Message-Id: <1728373302-19530-2-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1728373302-19530-1-git-send-email-selvin.xavier@broadcom.com> References: <1728373302-19530-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: Abhishek Mohapatra Older adapters doesn't support the MAX CQ WQEs reported by older FW. So restrict the value reported to 1M always for older adapters. Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver") Signed-off-by: Abhishek Mohapatra Reviewed-by: Chandramohan Akula Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 2 ++ drivers/infiniband/hw/bnxt_re/qplib_sp.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.c b/drivers/infiniband/hw/bnxt_re/qplib_sp.c index 4f75e7e..32c1cc7 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_sp.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.c @@ -140,6 +140,8 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, min_t(u32, sb->max_sge_var_wqe, BNXT_VAR_MAX_SGE) : 6; attr->max_cq = le32_to_cpu(sb->max_cq); attr->max_cq_wqes = le32_to_cpu(sb->max_cqe); + if (!bnxt_qplib_is_chip_gen_p7(rcfw->res->cctx)) + attr->max_cq_wqes = min_t(u32, BNXT_QPLIB_MAX_CQ_WQES, attr->max_cq_wqes); attr->max_cq_sges = attr->max_qp_sges; attr->max_mr = le32_to_cpu(sb->max_mr); attr->max_mw = le32_to_cpu(sb->max_mw); diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.h b/drivers/infiniband/hw/bnxt_re/qplib_sp.h index acd9c14..ecf3f45 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_sp.h +++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.h @@ -56,6 +56,7 @@ struct bnxt_qplib_dev_attr { u32 max_qp_wqes; u32 max_qp_sges; u32 max_cq; +#define BNXT_QPLIB_MAX_CQ_WQES 0xfffff u32 max_cq_wqes; u32 max_cq_sges; u32 max_mr; From patchwork Tue Oct 8 07:41:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13825932 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.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 D7B0F1EABCA for ; Tue, 8 Oct 2024 08:02:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374566; cv=none; b=m4azAMqtUVXcOx3PXrc3F3tGKValoq9DXTPzWjTy7DsWj6zbxb8x/lapL2iZneI85L4y8n8FA/KlCxo/c5JSbDht1rnDRf7J4vymOhCHCMb3GeD4vRDbcVQu6OAQ3hv+vQmbKJvic/jrV7dLomDejsULLwUAoarrAJrx5NfXBm0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374566; c=relaxed/simple; bh=p0Vuf8x9HnR2i6qSJvHNXYbQ4h47x3HbM7tF8vY9XKg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=Tv8XdP+bMRv/Qf/vqi1IQ4ePKDukQluLvcvSe0k7xRmRrkbyNRoPfAv1MLKJk0083abjaFUtzJBpCavScGK2Gf/fxdqUDzICzXBhPA78SPzpiEZKzdJC/kpqdI/tpCsr3RsyB3pN8EXn744gaN/7qzJxX/pRWkZgcW8LXWYKZDA= 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=UkAgWJmA; arc=none smtp.client-ip=209.85.214.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="UkAgWJmA" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-20b6c311f62so46454425ad.0 for ; Tue, 08 Oct 2024 01:02:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1728374564; x=1728979364; 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=8gQESwiKbsg3d8SZLPLfCVF8FKFvHGjRVR8DWlwfdtU=; b=UkAgWJmA/dKfSbhz5WFtOuPV0o47eb+fluwJVSaKHJdr+ZlooD/QbBdtQUXm72q95a nJfbWQ5FP6GFIMHt07bTG9R4OUEStQokfc0x12DjX3aJWWcGn1x/DBKGRF78iSKPA/dy UOlCoRnVfl5shWw3UdmPI+3wH0G88f1eiewnE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728374564; x=1728979364; 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=8gQESwiKbsg3d8SZLPLfCVF8FKFvHGjRVR8DWlwfdtU=; b=rDEx/XvYCoCwC8DUtgaPV5yHhEWjiNBSA4Qpn+xy6Y4egUuZP/2tMh0PYbGCZe223J zXTQThLaunyOx47tngKzOxVS2O6DLSXY/cGpkgy4s6uf5ZTBidauWQFjKAwBW3tWGnDP cGlo0lIGqik93v84wlx/QtDvJsdMKSf5PBSlu5AA94jE6O3I0t3teULTVhXsyhrmeNGE JpSfjkN+aIxms6lt/MGNjSQX4U+/Oy6gRvKkIYfTVmk/l6QNN0y3dQ0ZSmP04Z+4o4eW Rlcb0pKQkr5SDICE8R7ORzuO8YpzkajJHq3JY+Nzt9WY86iji9n4FRbcuHJMxp/KF2jV 5jqQ== X-Gm-Message-State: AOJu0YzVyjixAIH4AyIDLNTZ/t6nqW6nqQp2sLrvI7HeKV1+Nko5cA4P RIjo2SwyktzJNJod5SycKJp7QGnPdBtmnvo1s5t6r+ZYDb5QBvMU2FN+XSQ2fTnelvj+YHIIvUh s1w== X-Google-Smtp-Source: AGHT+IGvrnD+EmIMjnl8jyLU1rinL9RBcdChSQc7n9YH3YGpeC7sGn10E+SeRCGXRq+AguZ7gcXm4g== X-Received: by 2002:a17:902:e745:b0:20b:c1e4:2d70 with SMTP id d9443c01a7336-20bfe294c52mr223138335ad.23.1728374564075; Tue, 08 Oct 2024 01:02:44 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396d547sm50339915ad.223.2024.10.08.01.02.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2024 01:02:43 -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 for-rc 02/10] RDMA/bnxt_re: Fix out of bound check Date: Tue, 8 Oct 2024 00:41:34 -0700 Message-Id: <1728373302-19530-3-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1728373302-19530-1-git-send-email-selvin.xavier@broadcom.com> References: <1728373302-19530-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 Driver exports pacing stats only on GenP5 and P7 adapters. But while parsing the pacing stats, driver has a check for "rdev->dbr_pacing". This caused a trace when KASAN is enabled. BUG: KASAN: slab-out-of-bounds in bnxt_re_get_hw_stats+0x2b6a/0x2e00 [bnxt_re] Write of size 8 at addr ffff8885942a6340 by task modprobe/4809 Fixes: 8b6573ff3420 ("bnxt_re: Update the debug counters for doorbell pacing") Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/hw_counters.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/bnxt_re/hw_counters.c b/drivers/infiniband/hw/bnxt_re/hw_counters.c index 128651c..1e63f80 100644 --- a/drivers/infiniband/hw/bnxt_re/hw_counters.c +++ b/drivers/infiniband/hw/bnxt_re/hw_counters.c @@ -366,7 +366,7 @@ int bnxt_re_ib_get_hw_stats(struct ib_device *ibdev, goto done; } } - if (rdev->pacing.dbr_pacing) + if (rdev->pacing.dbr_pacing && bnxt_qplib_is_chip_gen_p5_p7(rdev->chip_ctx)) bnxt_re_copy_db_pacing_stats(rdev, stats); } From patchwork Tue Oct 8 07:41:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13825933 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 B0E141EABAD for ; Tue, 8 Oct 2024 08:02:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374569; cv=none; b=netkcX71BV17bghKGan0coKXt99nmCGXf9tg9lHuybtHuBQ/LU5Mc0n6l+VGNZWH2SLCWffOT5Un93D0e1ShBDEMnRtFOLi9nUgKvHtNYBGSYW/e6KmaUnSWF4/8jYNb9qQwsVtb2XqnlnlS/cDsQzvH/5FXQQjlSob2vhGFpME= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374569; c=relaxed/simple; bh=mxE1CMxdbwUh84nMv3LYKghSJGVfAGkJTlfPO2Z5728=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=CbuRVuqH+8qecNoLJVFmTeBKH+kfFaTMGsT6VuCB0ywmU5g0j82FQcXkPkoiSEbQBoxO+4FsYDf4vsrXO2bfRQJGjc8C1kBSv+RrJ3jlTqqzhJZlrtQ8iP/wmTlgQzh12FqsWi0Hbor8e08V98gL82CMIsxq0jtstzYiN6KRKmo= 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=Dof58cI6; arc=none smtp.client-ip=209.85.214.182 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="Dof58cI6" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-20b86298710so44835515ad.1 for ; Tue, 08 Oct 2024 01:02:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1728374567; x=1728979367; 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=oXzz12EuUqqvM4rco4/Hm7jIY1qtRAj1zqi3PtSyfVk=; b=Dof58cI6vma7BRb31AlbW3IcmVeoQ2uO6G3y0rocAAR84U1W+rgG7LW23oS53UUEH5 aurBUn3yTuUieb9R6NoEL6nzzpek93QsaQ0BOEVveviuFjd+NuOoq9KKVYlMR4hnBdtE dYGyWHiSW2np5vbDRm5y/PF95TPs7X/rjeUTQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728374567; x=1728979367; 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=oXzz12EuUqqvM4rco4/Hm7jIY1qtRAj1zqi3PtSyfVk=; b=aHKU3B/lqY2r8uoxrOdxcUSYfNItILJ3ItgrkXzlSecGuPDIbBiqKfPJVTtlATWdSY ghdgSKt4Vmwi3CE9erM913mbInnre4lk32Gz8S+GdlbmgZXKgltvII43v+J4L3WFUoqq HYGMTJvAJC1FJAPtVYmJod+oFRDAqAzkQyTDJmo5Gx9B0NW1ehU+m0hiX1VnYFm+GLIl 55xP0NxaooXEIpsUx2PX2hhiaKwKgv/vKiHzrsR46TvEZ0pjt4WPKgX5Qj2Qm8kpeags S2CgnzvVi0p7M5tpBF3y74qGmwYmPXvxyq59aPy9MOAb5U/Ir5ZgyKfuvDryNmiBsWn3 ZgwQ== X-Gm-Message-State: AOJu0Yx7bKYE6cJ9GozOFxpQuN4nRGST2DMGvweZjEYcOuDrcyhRwfxz RS5F3CVZCEwfDxn2RrSQ/3h5i8vyES2OUNDjFzlnb8k6uwXFSnQXEyK2lVmSjw== X-Google-Smtp-Source: AGHT+IG6ysyslI4OMgR+bO2YgZYZwladw+QSU/TMO6ZT7tBJE8Ks3PvPkYOlSOIh3mDyRHgA5TH0eg== X-Received: by 2002:a17:902:d4cc:b0:20b:c264:fde8 with SMTP id d9443c01a7336-20bfe03dbeemr201465955ad.22.1728374566944; Tue, 08 Oct 2024 01:02:46 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396d547sm50339915ad.223.2024.10.08.01.02.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2024 01:02:46 -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, Kashyap Desai , Selvin Xavier Subject: [PATCH for-rc 03/10] RDMA/bnxt_re: Fix incorrect dereference of srq in async event Date: Tue, 8 Oct 2024 00:41:35 -0700 Message-Id: <1728373302-19530-4-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1728373302-19530-1-git-send-email-selvin.xavier@broadcom.com> References: <1728373302-19530-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: Kashyap Desai Currently driver is not getting correct srq. Dereference only if qplib has a valid srq. Fixes: b02fd3f79ec3 ("RDMA/bnxt_re: Report async events and errors") Reviewed-by: Saravanan Vajravel Reviewed-by: Chandramohan Akula Signed-off-by: Kashyap Desai Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index 686e405..dd39948 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -1028,12 +1028,15 @@ static int bnxt_re_handle_unaffi_async_event(struct creq_func_event static int bnxt_re_handle_qp_async_event(struct creq_qp_event *qp_event, struct bnxt_re_qp *qp) { - struct bnxt_re_srq *srq = container_of(qp->qplib_qp.srq, struct bnxt_re_srq, - qplib_srq); struct creq_qp_error_notification *err_event; + struct bnxt_re_srq *srq = NULL; struct ib_event event = {}; unsigned int flags; + if (qp->qplib_qp.srq) + srq = container_of(qp->qplib_qp.srq, struct bnxt_re_srq, + qplib_srq); + if (qp->qplib_qp.state == CMDQ_MODIFY_QP_NEW_STATE_ERR && rdma_is_kernel_res(&qp->ib_qp.res)) { flags = bnxt_re_lock_cqs(qp); From patchwork Tue Oct 8 07:41:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13825934 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 68BCF1EABCA for ; Tue, 8 Oct 2024 08:02:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374571; cv=none; b=eC9764hqIB6JUMSWRNsiGSWXbj1cJnzydeaj6YuHXQ1wZbR7xPt6fQu7bZR0NAs7YjeYDOZhgPjx162e7bnxzSbnWekWPppyUdjiL+pOUkZ0N5+3tSvDfDgHuQ8JV0/SDoreVSHQxHe5f/8i03+29Lz4UcJUeDhhP+pvtL971nY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374571; c=relaxed/simple; bh=DQdPDfB9qxFI782O1RXj73wN7VGoBSzlzLW1DoGAwIo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=fHemEzn7dsr5VUL6D1oncfwMGzv1mZWRjOM/zZdPFnEGWAMoJ92sU4/G5QBPjvLP4SwxLq3bCaq48VuWCT76RJxs/Nho7RHiPE5lREN7Y5fnn5pCC4ePKzDO+a7MMHzz1IbM7VwvXJAtVuWFOV9zk8ZVQuIAr8/vr5VhpmgB8n0= 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=d7HwfAJL; arc=none smtp.client-ip=209.85.214.172 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="d7HwfAJL" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-20b6c311f62so46455215ad.0 for ; Tue, 08 Oct 2024 01:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1728374570; x=1728979370; 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=tep3ofrsFKIOdIBo+3GIMvnO+pPz26j8Ew16Jaxj+QA=; b=d7HwfAJLOxR9Twj5vc0Cx/717LKsrDhV0rumf83J4CP+E1/YVSFBN53iR53zuPELnh drti+ldmR8mLfER3U4cNaZ6oeEbsJZF8zQ6NotQVQ+e21L0ul76wbL0q1+DHfOVuk6pb Qsls5rpAJfoJl97YtA1ahFH3s/AOpbCKO/C3o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728374570; x=1728979370; 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=tep3ofrsFKIOdIBo+3GIMvnO+pPz26j8Ew16Jaxj+QA=; b=gr19/svBHWMumjGdlBnRnILvQRgXLv5ifEUew/Jt/E7Mz3XhloPk+b1p8toNHXoNNb LJTz11lbuumHLAuquQ6L4vFcCBNxOmWosSbbqZTDbAzbOxziqbrId+FfXzplsQFnA3Xn ry48VDz+Yy6Hkpd2NLVhFx5Z5SgSM2Li38QCKQdG+LOVtqhH3B5/BCkyqSkcY4ODvd4S yAGHm7T2sSgenF1GSRp5QYRcyUa17XzHlI1MKrungF3CeCPZVqys77C+Iea/v9ZspqXl OM28a4zhu9k1wcBh9eilzhzDjNzgUjEEJ5m9W2HmKl/B855vRD8v+CDX/lVXsducMMM5 rqzg== X-Gm-Message-State: AOJu0Yy91mU23v5xdUjjYcjyAznMErx2IsKt8Jm1pXZiRm/5hF55j9qZ 9ToEBLyzZA1p8sNbYpLxUR2ygezMnDEm4RDj2O3bKuMJUq8Omg3BXffh9XK2lI6EBYJkXX9OUTv y8Q== X-Google-Smtp-Source: AGHT+IG0SwcGWfQRPNX78/WhwyMGdZiOl8SqWpGG2iPMTjyo2VgsFE0cEt/5gcrAh9p493nIxyA+nw== X-Received: by 2002:a17:902:fb86:b0:20b:c287:204d with SMTP id d9443c01a7336-20bff1a9079mr150166645ad.40.1728374569644; Tue, 08 Oct 2024 01:02:49 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396d547sm50339915ad.223.2024.10.08.01.02.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2024 01:02:49 -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 for-rc 04/10] RDMA/ bnxt_re: Return more meaningful error Date: Tue, 8 Oct 2024 00:41:36 -0700 Message-Id: <1728373302-19530-5-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1728373302-19530-1-git-send-email-selvin.xavier@broadcom.com> References: <1728373302-19530-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 When the HWRM command fails, driver currently returns -EFAULT(Bad address). This does not look correct. Modified to return -EIO(I/O error). Fixes: cc1ec769b87c ("RDMA/bnxt_re: Fixing the Control path command and response handling") Fixes: 65288a22ddd8 ("RDMA/bnxt_re: use shadow qd while posting non blocking rcfw command") Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c index 3ffaef0c..7294221 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c @@ -525,7 +525,7 @@ static int __bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw, /* failed with status */ dev_err(&rcfw->pdev->dev, "cmdq[%#x]=%#x status %#x\n", cookie, opcode, evnt->status); - rc = -EFAULT; + rc = -EIO; } return rc; From patchwork Tue Oct 8 07:41:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13825935 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) (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 1DCD71EB9E1 for ; Tue, 8 Oct 2024 08:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374574; cv=none; b=ADsNOt4VtLR+qvPCq8ObbTVlP7PIt04eY98mTSPeUnVEIrZ6A2ExrkoMnZ0ZAuirU0kJTTdr42b9Mv/pd1Ly55FMSSi26ygsJ/OKAIZIoWeEAGaFuprs+UHyePW1nz6pJSSZg5/vDt5hZv0/3bvuGofbODoxw7o6z4hAfVuj7xQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374574; c=relaxed/simple; bh=cB7kzF/A7jdyCV8Jk+I5/0WsF9rU62Rx2kR2f3YJm0I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=aqDTUwNJK7DHEB86qDYrXDDzJWwqgYtDAe59eDqlHQiV92wwyA3n93eXRyLrNITj/VWXE7O0d1Beg0Y5tcXgQ/kGzvNh7dq/w8T416qn/o6SsQCYQ1NnrSzJsUqpqsEUTLHZJZVcpv/+fXvJLsXqBbVPH8FD4uarqKReBdaJNVo= 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=VxCz9ciD; arc=none smtp.client-ip=209.85.214.195 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="VxCz9ciD" Received: by mail-pl1-f195.google.com with SMTP id d9443c01a7336-20bb610be6aso59325305ad.1 for ; Tue, 08 Oct 2024 01:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1728374572; x=1728979372; 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=1s9Zs5Xqz1iLNK3m8YmXw/jR61f2Y0RI5m1vZEXtgH0=; b=VxCz9ciD3RPmX4H0kFPyP2/XRg+yJUS0Kn04ifYXa8VQbZEzQ24am7KqAz5KpN9YzG faA9bu3iM+8VJH0cCP7WhPO2+hErf6QGCZND5BuoIgzT9upUjqX+cM0cXTNLruKhCVTq tRrb60IhMpCX3G8/uBfdNt8g8CEnY2Zedu3Zs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728374572; x=1728979372; 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=1s9Zs5Xqz1iLNK3m8YmXw/jR61f2Y0RI5m1vZEXtgH0=; b=gat835as7b9RyBVSXlS3NSYGUJRoGjTx/stb2FrNLCIoiU5jW3QknOYZhwx6V2Tw0v /maOiIY0XDzJDFOJUKG+pPDluuME2bz4fxsDzkGbsDCagBMGinykndT2pFzq7m3X3Hsz 1ae3y3S7RUnUJVM61Fmro9Mvn4dCImqrV2DPcqvHIL1lwSdNRfYyCKlPuoccN0nFayfg NDLXTIzRuf9EFeW3itqWcyr37F0Vup9+fJ/kJaNdTpLQZwIY2RIbPIKZJPSQtuW0G/pb cblvvA24ymrgSRjMSo0kkiTb6HK93yooI619U4nD/BIIsb73aS3eGFsBd6nTJBbgsA70 OuqQ== X-Gm-Message-State: AOJu0YwMisvzxFe4sxws6kMwnOGiL/sqZl1uZ8gZ3qq+2YhcUcuTauPm IRuczG/OPppQSPn6srW9JmCKF2myOwVcGv6EQOKPtZkGeasKRyErUwFSi9zUIQ== X-Google-Smtp-Source: AGHT+IFkQkt9uFKFqJZxmdA/syMlAlRktXpY+8Mdc1n+4kZ6JE8RiI8my1ZjqkOkKSTbhGnzudoICQ== X-Received: by 2002:a17:902:f707:b0:20b:707c:d688 with SMTP id d9443c01a7336-20bfdfb84c6mr222585235ad.18.1728374572334; Tue, 08 Oct 2024 01:02:52 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396d547sm50339915ad.223.2024.10.08.01.02.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2024 01:02:51 -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 for-rc 05/10] RDMA/bnxt_re: Fix a possible NULL pointer dereference Date: Tue, 8 Oct 2024 00:41:37 -0700 Message-Id: <1728373302-19530-6-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1728373302-19530-1-git-send-email-selvin.xavier@broadcom.com> References: <1728373302-19530-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 There is a possibility of a NULL pointer dereference in the failure path of bnxt_re_add_device(). To address that, moved the update of "rdev->adev" to bnxt_re_dev_add(). Fixes: dee3da3422d5 ("RDMA/bnxt_re: Change aux driver data to en_info to hold more information") Reported-by: Dan Carpenter Closes: https://lore.kernel.org/linux-rdma/CAH-L+nMCwymKGqf5pd8-FZNhxEkDD=kb6AoCaE6fAVi7b3e5Qw@mail.gmail.com/T/#t Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index dd39948..915b0d3 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -960,7 +960,7 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev) return ib_register_device(ibdev, "bnxt_re%d", &rdev->en_dev->pdev->dev); } -static struct bnxt_re_dev *bnxt_re_dev_add(struct bnxt_aux_priv *aux_priv, +static struct bnxt_re_dev *bnxt_re_dev_add(struct auxiliary_device *adev, struct bnxt_en_dev *en_dev) { struct bnxt_re_dev *rdev; @@ -976,6 +976,7 @@ static struct bnxt_re_dev *bnxt_re_dev_add(struct bnxt_aux_priv *aux_priv, rdev->nb.notifier_call = NULL; rdev->netdev = en_dev->net; rdev->en_dev = en_dev; + rdev->adev = adev; rdev->id = rdev->en_dev->pdev->devfn; INIT_LIST_HEAD(&rdev->qp_list); mutex_init(&rdev->qp_lock); @@ -1829,7 +1830,6 @@ static void bnxt_re_update_en_info_rdev(struct bnxt_re_dev *rdev, */ rtnl_lock(); en_info->rdev = rdev; - rdev->adev = adev; rtnl_unlock(); } @@ -1846,7 +1846,7 @@ static int bnxt_re_add_device(struct auxiliary_device *adev, u8 op_type) en_dev = en_info->en_dev; - rdev = bnxt_re_dev_add(aux_priv, en_dev); + rdev = bnxt_re_dev_add(adev, en_dev); if (!rdev || !rdev_to_dev(rdev)) { rc = -ENOMEM; goto exit; From patchwork Tue Oct 8 07:41:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13825936 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 C34E01EB9E6 for ; Tue, 8 Oct 2024 08:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374577; cv=none; b=DYtL/Wp8YyBsRVvnqouxUTK+ef+vuop6xX1SPEgWSIqHsF7wMWIklOh/Nl+cNZvmE4BHiKjsICUOGZiDJEJ9aCPY3an7Qox0iwPxcTl04alTAogFrAC3BMygbya00DsKJH39on3CKwKdr/W3GklPVnrXAU41EVtEfcSnZCWv2Jc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374577; c=relaxed/simple; bh=nAV+0eS7jD+EKZqSJ/b02ozPRm5EnsunvJgYG9yZ0Cs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=PBPb2ZLMESXWDzGNBAT+vca8GaIJ1wzgVJVtDdlDNVJb6fUSy0Ptqiaiw9ABwQcj9eABDPkt3hgqupIqH+jcyV1vGe6q3DpMJWTWjnv8wCGlGE5qVxja2KtTAcvwIOiCoFhXoqFanZqknqWtnC71u24GfvQFdjP83CHt9TtHEA4= 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=c49CSh/q; arc=none smtp.client-ip=209.85.214.176 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="c49CSh/q" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-20ba9f3824fso39768735ad.0 for ; Tue, 08 Oct 2024 01:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1728374575; x=1728979375; 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=ZsHkK7dVKB9opsOPTD8A6ugJNxD1NTKwqHSYhTgYHQI=; b=c49CSh/qZzlIocTzSpSqnaNjYzWHEGqjATrgjkfFPoSYRhhBmCgPai/tLy5ISIxSgH +Msz5dDivciEDeNLiCe7EAjOp0KDe/yDq5cWQKshTQu5YvXIN1tOo7OP0yhK7cLNbAN+ XveoITRLN8c2G3N7Qat5T2Ijalxs1lpSPfQFo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728374575; x=1728979375; 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=ZsHkK7dVKB9opsOPTD8A6ugJNxD1NTKwqHSYhTgYHQI=; b=DON1Tza6UBb3X4Jxa5lDymszNo5AZBEfnmWRimY7HvAvIg8CMLm+EdqsRN/SK6+NAD rnyuLNpva6rS6NqK1JjYT37YVlycXJcKpgCElsg2HYChiptB85Tu+51G2lIhS4K4MuAW O6gvDvCaSNMIWktpkVMTUZXpU0k90Yt+HPzNRBb89VjKDzYoNLQTfrYhM3++37rwbJb/ LT18Ct98k/9rzq8O2HcyiGFN24HwKZfrfxbWMYUKLc36GnDUIBzTDT1c/GpaFdX0Q97B OOrNLcHutDD5e24JfMTZUsh/0q/aWOQ1LFoMMIeej/TOcX7YVLeRpohQnfNElCloV47z PWQw== X-Gm-Message-State: AOJu0YzdD/jyZZnsoToNHvbV+NB4nh3Ur3gf1jT7x95ymO8lTCDy7JIr LgrzIiMYn5kwFlLTC0jF1pLVezET07j5Rga9vSTsG8vpaRfvileuGAnI/6RWKcjUPGKFkisIYl0 FLg== X-Google-Smtp-Source: AGHT+IGRI6gXLPU/fz+NaQrqnw5I1tjSO+6mWkUdI+3HZY6x0ULmnA/frYDYDKCNq0C/2npjz5BNYQ== X-Received: by 2002:a17:903:2307:b0:20b:9088:6545 with SMTP id d9443c01a7336-20bfe95dbcfmr228124035ad.46.1728374575017; Tue, 08 Oct 2024 01:02:55 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396d547sm50339915ad.223.2024.10.08.01.02.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2024 01:02:54 -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 for-rc 06/10] RDMA/bnxt_re: Avoid CPU lockups due fifo occupancy check loop Date: Tue, 8 Oct 2024 00:41:38 -0700 Message-Id: <1728373302-19530-7-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1728373302-19530-1-git-send-email-selvin.xavier@broadcom.com> References: <1728373302-19530-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Driver waits indefinitely for the fifo occupancy to go below a threshold as soon as the pacing interrupt is received. This can cause soft lockup on one of the processors, if the rate of DB is very high. Add a loop count for FPGA and exit the __wait_for_fifo_occupancy_below_th if the loop is taking more time. Pacing will be continuing until the occupancy is below the threshold. This is ensured by the checks in bnxt_re_pacing_timer_exp and further scheduling the work for pacing based on the fifo occupancy. Fixes: 2ad4e6303a6d ("RDMA/bnxt_re: Implement doorbell pacing algorithm") Reviewed-by: Kalesh AP Reviewed-by: Chandramohan Akula Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index 915b0d3..b1dcb6b 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -534,6 +534,7 @@ static bool is_dbr_fifo_full(struct bnxt_re_dev *rdev) static void __wait_for_fifo_occupancy_below_th(struct bnxt_re_dev *rdev) { struct bnxt_qplib_db_pacing_data *pacing_data = rdev->qplib_res.pacing_data; + u32 retry_fifo_check = 1000; u32 fifo_occup; /* loop shouldn't run infintely as the occupancy usually goes @@ -547,6 +548,14 @@ static void __wait_for_fifo_occupancy_below_th(struct bnxt_re_dev *rdev) if (fifo_occup < pacing_data->pacing_th) break; + if (!retry_fifo_check--) { + dev_info_once(rdev_to_dev(rdev), + "%s: fifo_occup = 0x%xfifo_max_depth = 0x%x pacing_th = 0x%x\n", + __func__, fifo_occup, pacing_data->fifo_max_depth, + pacing_data->pacing_th); + break; + } + } } From patchwork Tue Oct 8 07:41:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13825937 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 89A681EABD4 for ; Tue, 8 Oct 2024 08:02:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374579; cv=none; b=SHQfFEOC/zqw1l82MQxOfjGWXf+cUILF+Z0SkKvtD2k3u+5RhdmM1iCu+qNgjCR0/K30aP8OYF6tG8v9I6moDyCmcf0NafQhnvrX9RduUEnp1Pd86cS7s/uGcf3eB5lvWeRepz+fZO0+W4EL8Yz2NbTUuH2k0kzETlyKo+HMImk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374579; c=relaxed/simple; bh=PredhI3R7q/9wimarm3W3vXbI8eHkpQn4ybHKU96fnw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=WuHIMhzSN6VlvQk0IYS0w8JHFUlyLPY8t3eCNyPvVCoRg0yCxOsJFUbNsrX3pWxqEG6KzVtciXcbly/+LrTQRzeV3dVfqjsqu0UMlTUlucSN8VQjO2MXlw/3I+fK+Lng7AQ1YaCKZLJuj3yBEFN7dExT8xHeF5zcUrQyWfie79s= 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=LY3AMfXw; arc=none smtp.client-ip=209.85.214.176 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="LY3AMfXw" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-20bb92346caso33996875ad.0 for ; Tue, 08 Oct 2024 01:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1728374578; x=1728979378; 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=Ygqgqmx8IGcgoxKYW9t9H7WPwtcBHsaY7P02/Ei0OSo=; b=LY3AMfXwbPZpPAr4+0povlj0fmViDMtaD5gWPCb6s3q8v4e3uebrUKsuKI+nYp/6ek zLRlW/RyQTztnMmFNEo9QdcCTxKCs2n4w1eTyAfT+Z3ZUWWGuc7U3Cme6YvgjyPonh4G lIyHiy4wu3GlZHxs0UqV+6m010Q7T2swQ2rSM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728374578; x=1728979378; 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=Ygqgqmx8IGcgoxKYW9t9H7WPwtcBHsaY7P02/Ei0OSo=; b=Hk28326+Q6MvMZNFo9rLltPZxa92dScsIf1FpwBmKV0yHjP+asr4cqawK0RCA01iqW 1npzJVFdytGVfslFf4NmQVWuj5G4J1FrhlzuhZwVG1Y3tjsVmHWS8Xhvum2Uis4NVZqy ZMicwpL1V1+JQlENrEmaV0uZNdN2tQZNv3+50qBdgQV0NM/WFps8UR6QnixxUy57cxt5 RHVscZRTpmQiK8/lpC5+T6dqlRBLIbU4FPYRvEad50EU3ruNmqHaI0KW1Qwmh7mMaaSl xnjphfBeLwGLPK1Zywj3fhxIrAZ9roRURW2Cp4/hwsnVsZYjuFxGP3OM0lQl13HzoKe1 q1jA== X-Gm-Message-State: AOJu0YyB/Gi9MWeMij+z4VXEp9vYSxIdNiZEOAnJJbj8po0qTF3wlCXT 0Z9D9RDXzjVYyPH30Pa5c1mPj1Czdpj8OrAITWZvnlDBxBVfisa7fAECHIh3vw== X-Google-Smtp-Source: AGHT+IHoMyA79OTWtZx28MH9FsnZVJaJTVWOr8UbRqf7mcwtoNrLimM/Gl7L8miCt+I8j3tyXuueBg== X-Received: by 2002:a17:902:c946:b0:20b:5c94:da0d with SMTP id d9443c01a7336-20c4e280041mr32267555ad.5.1728374577782; Tue, 08 Oct 2024 01:02:57 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396d547sm50339915ad.223.2024.10.08.01.02.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2024 01:02:57 -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 for-rc 07/10] RDMA/bnxt_re: Fix an error path in bnxt_re_add_device Date: Tue, 8 Oct 2024 00:41:39 -0700 Message-Id: <1728373302-19530-8-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1728373302-19530-1-git-send-email-selvin.xavier@broadcom.com> References: <1728373302-19530-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_add_device(), when register netdev notifier fails, driver is not unregistering the IB device in the error cleanup path. Also, removed the duplicate cleanup in error path of bnxt_re_probe. Fixes: 94a9dc6ac8f7 ("RDMA/bnxt_re: Group all operations under add_device and remove_device") Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/main.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index b1dcb6b..63ca600 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -1880,12 +1880,14 @@ static int bnxt_re_add_device(struct auxiliary_device *adev, u8 op_type) rdev->nb.notifier_call = NULL; pr_err("%s: Cannot register to netdevice_notifier", ROCE_DRV_MODULE_NAME); - return rc; + goto re_dev_unreg; } bnxt_re_setup_cc(rdev, true); return 0; +re_dev_unreg: + ib_unregister_device(&rdev->ibdev); re_dev_uninit: bnxt_re_update_en_info_rdev(NULL, en_info, adev); bnxt_re_dev_uninit(rdev, BNXT_RE_COMPLETE_REMOVE); @@ -2029,15 +2031,7 @@ static int bnxt_re_probe(struct auxiliary_device *adev, auxiliary_set_drvdata(adev, en_info); rc = bnxt_re_add_device(adev, BNXT_RE_COMPLETE_INIT); - if (rc) - goto err; mutex_unlock(&bnxt_re_mutex); - return 0; - -err: - mutex_unlock(&bnxt_re_mutex); - bnxt_re_remove(adev); - return rc; } From patchwork Tue Oct 8 07:41:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13825938 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) (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 A3FAA1EB9F3 for ; Tue, 8 Oct 2024 08:03:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374583; cv=none; b=EDJz7OvAqgjst0O7gUXbmqh6H3vxo8CA/FRr39M3JMiPHg0jQtTEjystDEvFI2sPDH4tDPGN/N9M2SysltQGI7/AMzo6MBemO5IdZQyPTRKQWds12uWLPrk4OfMcw1Yh0wN2GFY+r3m2zTjIENeDks+katJh5GYiYBIPcKruplQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374583; c=relaxed/simple; bh=I3TaePbqxQNesaz6t+eE88EC6Qx3LYvYIFaBxvvDvz8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=okRNGXhzk03t3VAOVSCZepGoqDnLN8xaqU2SVbAGNihr3T3e4rzmsIbzX/1KIu1iipMeKnA6wTz9JWyCLpYFk5lxIEpBdFVRMxZWpTKsRvzARkTT98endBaIdnnlYcLDIDVO4XMPBgahTrryUeS2tOegamzrtOmvoQu26NEWrOA= 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=NHSwYeQl; arc=none smtp.client-ip=209.85.216.49 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="NHSwYeQl" Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-2e078d28fe9so3641537a91.2 for ; Tue, 08 Oct 2024 01:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1728374581; x=1728979381; 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=+eL3fAkO5BkMvSeaU80mRU0m+i55ekGLKZTjD3DOAnw=; b=NHSwYeQl5ekF9HVj3F19/jvRyoKXLSA68Y5a6HmbYBpotqEuGAvdSAIHJPn9AfgSJS AIwsa+wGIC7uOfhUozSuNk6sOi6dpJPCoLFovxWDfElu/F1UyVUnj8OuI0DIuNeV1VLm 4UAHVL7IJZotUi1JcwmvXAxeUGDZoU/QlyAoU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728374581; x=1728979381; 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=+eL3fAkO5BkMvSeaU80mRU0m+i55ekGLKZTjD3DOAnw=; b=cuX/k7wbbaI5VrilOPFAmNT7P2BFBX0h/cDZ9CTAJ4lomJbMop69cbHmeGHhcXXMSK AbJc3csCnAK6FKZqB0oxZK4taH4Kt5lpEm/TIPuLwTmf2tc4sTg77QIWPB45M3bDLzHS SqHdv4tVQcvf0TSW0Ns7Q2wsDsZjGxcerdw5KXobfzKQO6jn8/TTzhRpzG6F5eN09Upl XDGjpQ11nNwjv3BmwfNVv0YmKoGSwZ2zC1CVdLhpVjuCI04W6y1jwKbDdyZULH5z8jtt 94ypS6TiAMH0fN4B1jtGzkBJSSoqdZKeUKh+i5LLn955uTfP7LPP00bLOZ2uTTziTuRF icCQ== X-Gm-Message-State: AOJu0YzalRrTCQ7xx7yq+wy6KM3bcqOLcPgM2HCRTNyuwT97DDgXi+/N CrdqYrmWp8Nf4yp2AjaR2qtocYxdzHuyNFZ2AMeLvijhi9ZL2S5ZjctTj+Uob0I6zBRxSGee6US 1lQ== X-Google-Smtp-Source: AGHT+IEyEjSggeNHsCxSPLXhovr/PA63mcSCCTeGLjHSKzOIq57rExwlCwKKQ7lxP9xox45D0tqPSw== X-Received: by 2002:a17:90b:1058:b0:2e2:9132:4c58 with SMTP id 98e67ed59e1d1-2e291324d7emr55424a91.34.1728374580788; Tue, 08 Oct 2024 01:03:00 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396d547sm50339915ad.223.2024.10.08.01.02.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2024 01:03:00 -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, Chandramohan Akula , Selvin Xavier Subject: [PATCH for-rc 08/10] RDMA/bnxt_re: Change the sequence of updating the CQ toggle value Date: Tue, 8 Oct 2024 00:41:40 -0700 Message-Id: <1728373302-19530-9-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1728373302-19530-1-git-send-email-selvin.xavier@broadcom.com> References: <1728373302-19530-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: Chandramohan Akula Currently the CQ toggle value in the shared page (read by the userlib) is updated as part of the cqn_handler. There is a potential race of application calling the CQ ARM doorbell immediately and using the old toggle value. Change the sequence of updating CQ toggle value to update in the bnxt_qplib_service_nq function immediately after reading the toggle value to be in sync with the HW updated value. Fixes: e275919d9669 ("RDMA/bnxt_re: Share a page to expose per CQ info with userspace") Signed-off-by: Chandramohan Akula Reviewed-by: Selvin Xavier Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/main.c | 8 +------- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 5 +++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index 63ca600..6715c96 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -1274,15 +1274,9 @@ static int bnxt_re_cqn_handler(struct bnxt_qplib_nq *nq, { struct bnxt_re_cq *cq = container_of(handle, struct bnxt_re_cq, qplib_cq); - u32 *cq_ptr; - if (cq->ib_cq.comp_handler) { - if (cq->uctx_cq_page) { - cq_ptr = (u32 *)cq->uctx_cq_page; - *cq_ptr = cq->qplib_cq.toggle; - } + if (cq->ib_cq.comp_handler) (*cq->ib_cq.comp_handler)(&cq->ib_cq, cq->ib_cq.cq_context); - } return 0; } diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c index 42e98e5..2ebcb2d 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c @@ -327,6 +327,7 @@ static void bnxt_qplib_service_nq(struct tasklet_struct *t) case NQ_BASE_TYPE_CQ_NOTIFICATION: { struct nq_cn *nqcne = (struct nq_cn *)nqe; + struct bnxt_re_cq *cq_p; q_handle = le32_to_cpu(nqcne->cq_handle_low); q_handle |= (u64)le32_to_cpu(nqcne->cq_handle_high) @@ -337,6 +338,10 @@ static void bnxt_qplib_service_nq(struct tasklet_struct *t) cq->toggle = (le16_to_cpu(nqe->info10_type) & NQ_CN_TOGGLE_MASK) >> NQ_CN_TOGGLE_SFT; cq->dbinfo.toggle = cq->toggle; + cq_p = container_of(cq, struct bnxt_re_cq, qplib_cq); + if (cq_p->uctx_cq_page) + *((u32 *)cq_p->uctx_cq_page) = cq->toggle; + bnxt_qplib_armen_db(&cq->dbinfo, DBC_DBC_TYPE_CQ_ARMENA); spin_lock_bh(&cq->compl_lock); From patchwork Tue Oct 8 07:41:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13825939 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 7096F1EB9F3 for ; Tue, 8 Oct 2024 08:03:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374585; cv=none; b=aqt1a8bx/Ii7abmzjeTaQ3I7k1gnrvKP6HZxaBKEyaea4D6PS0PAgW9aKHS72bNHSGbweq7+Ea6uKHL4AQiTBrNxx/C4Uy3sSZhjgSvctXVWOasMjnLRA/F00b2RIdKJwgfcxh8SbPfaU9fdZ7vUnJLkQwyOgnDEVYBxw2Y+q+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374585; c=relaxed/simple; bh=OCT11lcjA21jVWmrFYmXJ+ncbdW0sKC+AZk9S/UkfUY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=MeB3gANLpvFL1YIw/pLwOJLPXg35A3JXK4cI4nztMCUvue6HTujk/h2Mc6/4zGTfBt1SRAlmdcTUaBihsQ+buoKEiHigIN8Nxe8Bj8MqsgVYP9uDr5fmbbPlJaPrYH2YD4B7D33Xot3CM/UOpugL/o5s4AggLHk5kxIV+Y0i62s= 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=NS9z3awv; arc=none smtp.client-ip=209.85.216.53 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="NS9z3awv" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2e0a74ce880so4472816a91.2 for ; Tue, 08 Oct 2024 01:03:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1728374584; x=1728979384; 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=JgySFIZselsz4WY2/sAXKF7ImiI6hJAWKQh+nzp8Izw=; b=NS9z3awv4Ow9bcdDiIG7a1c8xS7e6R1h/4Z7w/T+DG5gMbayZp+NYVTizqaQ/jVd40 QwiyBwLCfFAYuXe+dKny9kSpX2Zwt/H8mVzp3wkyaeZ9Fmdz/Va3r1ESNOtVVWCNdoa5 YOD3Uo+y7qdMQpafhTx2zKUZ7ZJ3Wvr+maZfo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728374584; x=1728979384; 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=JgySFIZselsz4WY2/sAXKF7ImiI6hJAWKQh+nzp8Izw=; b=PmEaVCS4/178fElyTFlyFbEmw6ljVgPQj4uQBjU9cRDOKeJhXIfNlGIqAsHzt7k7FE nxDNfk80iaHaNo8hsPuWsOjzey4tOkjzm2ub//Log1xobp6IsJ+E0c/KIRiPA2Ah0Az5 n1niR+LLMAVopyinc85NpzeqqfcGf7VOsyf1LaAY6v11Iu4EbZv/MVsUokkBLlZ2CLRd YC6V+u00mWcar9ogSkNEHyifm9cvHgHA9e0wPfvvguKcarRiBfueRnjhbFvM/Eima7B5 Ph34BLA3tdMoX2k1dsziqfdMxpkMafsSSlu1LCjhj3IP0NIJH5usyXx3gPvSmoVi63fr zX1Q== X-Gm-Message-State: AOJu0Yz5rqpQK9b1nPl2D2kQPH5cvVzMKUigR69yAyD4tx38tRJKAEA6 Szxbhk0opwLegcK2FmEjiXiEJ9MmFsKQrJ/fCUFBFQL01yET4xZVR2D1wyp/saxXX1+8LMj5ebo uDw== X-Google-Smtp-Source: AGHT+IEGP2Sup5wP29t/vJsgzXqECp21sCEb55VZqnx9uOV2JtVSpI4bdPxKxB7JdlJbOrwxZle08Q== X-Received: by 2002:a17:90b:364f:b0:2e0:d8cd:195a with SMTP id 98e67ed59e1d1-2e1e6367761mr19135787a91.39.1728374583672; Tue, 08 Oct 2024 01:03:03 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396d547sm50339915ad.223.2024.10.08.01.03.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2024 01:03:03 -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, Bhargava Chenna Marreddy , Selvin Xavier Subject: [PATCH for-rc 09/10] RDMA/bnxt_re: Fix a bug while setting up Level-2 PBL pages Date: Tue, 8 Oct 2024 00:41:41 -0700 Message-Id: <1728373302-19530-10-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1728373302-19530-1-git-send-email-selvin.xavier@broadcom.com> References: <1728373302-19530-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: Bhargava Chenna Marreddy Avoid memory corruption while setting up Level-2 PBL pages for the non MR resources when num_pages > 256K. There will be a single PDE page address (contiguous pages in the case of > PAGE_SIZE), but, current logic assumes multiple pages, leading to invalid memory access after 256K PBL entries in the PDE. Fixes: 0c4dcd602817 ("RDMA/bnxt_re: Refactor hardware queue memory allocation") Signed-off-by: Bhargava Chenna Marreddy Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/qplib_res.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_res.c b/drivers/infiniband/hw/bnxt_re/qplib_res.c index 1fdffd6..96ceec1 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_res.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_res.c @@ -257,22 +257,9 @@ int bnxt_qplib_alloc_init_hwq(struct bnxt_qplib_hwq *hwq, dst_virt_ptr = (dma_addr_t **)hwq->pbl[PBL_LVL_0].pg_arr; src_phys_ptr = hwq->pbl[PBL_LVL_1].pg_map_arr; - if (hwq_attr->type == HWQ_TYPE_MR) { - /* For MR it is expected that we supply only 1 contigous - * page i.e only 1 entry in the PDL that will contain - * all the PBLs for the user supplied memory region - */ - for (i = 0; i < hwq->pbl[PBL_LVL_1].pg_count; - i++) - dst_virt_ptr[0][i] = src_phys_ptr[i] | - flag; - } else { - for (i = 0; i < hwq->pbl[PBL_LVL_1].pg_count; - i++) - dst_virt_ptr[PTR_PG(i)][PTR_IDX(i)] = - src_phys_ptr[i] | - PTU_PDE_VALID; - } + for (i = 0; i < hwq->pbl[PBL_LVL_1].pg_count; i++) + dst_virt_ptr[0][i] = src_phys_ptr[i] | flag; + /* Alloc or init PTEs */ rc = __alloc_pbl(res, &hwq->pbl[PBL_LVL_2], hwq_attr->sginfo); From patchwork Tue Oct 8 07:41:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13825940 X-Patchwork-Delegate: jgg@ziepe.ca Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 0B4021EB9F3 for ; Tue, 8 Oct 2024 08:03:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374588; cv=none; b=gJWcX9Ufe7tg5MfHRaG66SD9MiJtgraloI9choRUvkBsHavoBGmBk7yqvjlnCaDaC9AihBMsnWsZ62N2XhVIVRRdcObEMd9sIVoLYj87hVywPfyVGe08Z3e/jzjEpgCU5j1vcEWPFJVEGTqiD7w2vk3s6ZyCYKbA4Yv7csjKPOw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728374588; c=relaxed/simple; bh=WoFetQ+lEoo/WI6x9FdJLhKjxC/mjPpRlTC7nP9HVfU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=TIQUfKAC3qg+u7WZC5IqYyPxkRq7gxN1JowSpk3h9BaOuP+RAPk34G40NDTeby1gU/lsL1bXmRsODkCsvVlx07xKEGBjmZ5Jr7yorSL5LKcpKTxLAMaNFh5NijTxMUa1baWhXfwjmMEBphJWIpMyMpsThzvVj5OevZ8eYCwmE78= 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=dWgoc9iJ; arc=none smtp.client-ip=209.85.214.182 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="dWgoc9iJ" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-20bc506347dso42789065ad.0 for ; Tue, 08 Oct 2024 01:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1728374586; x=1728979386; 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=j46mP+TQ56aaAI0fNI6NQCzOnDlbfpbZeOA/S4sURz0=; b=dWgoc9iJXg1zDGi4t3pRtwZq4sQipQhhPGtTzB5dw+Au/K3RKOnQv6ahBK++DPZn5C fFiMMqLYxTW0xky0X9CXqNbxdL24/qc8FkFJ4niPDOB7vmkvYaPnVBURtnGhSPHkuSn0 lyG4HMsph+SrvcFFiy+YMOAxENnOZ19kzAPXI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728374586; x=1728979386; 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=j46mP+TQ56aaAI0fNI6NQCzOnDlbfpbZeOA/S4sURz0=; b=ZTl3p6rDDAHqxcX8o4GbtXBVAYbX//0FwqW69nHR//mtGditVB8vwC9QeFQNtsqw4w pNI1x7GrQmXNXT5TN6uH1/Gl+8jqgYcW+at4N0rRhbseges+KAVDGohuX5yRs4icxf1B xMVb19IfEjC7+Vwzk8QyS6VREPx6gi00gKO/kwcfBMPEg7JxEcA91ARQQrZ1oHWNE1xJ 2TX4azoNxhZZbZIDEbRpADl3fRUP3JdG8Cvx4youYmhwNDVXI76MvefAORBELzWzzsyz 6WSwDIo9Wx5pcsfJk7F46d33lI0G3YFW9ntzDcgRJ4v1CxNLiOtJA21uXJyHRFdcceEu tNGg== X-Gm-Message-State: AOJu0YwRB6QFbph9lk07/dYvHZB1fG/5hta5JcWI/LB0H+n5YCgPERce gx/7eRz+YzuwXKHHl3tRsHbFv1s3M32cY6qW2r3+ZXNOo40MZJaVoM2Y4/E3uA== X-Google-Smtp-Source: AGHT+IHN/dnVeRcHFQ1RvOdPLm9n3WRIRo6iZef5JlcoAYoJ/AZBwmEYDe4EPTBzhJ37C6dIW4Pbyg== X-Received: by 2002:a17:903:41ce:b0:20b:b39d:9735 with SMTP id d9443c01a7336-20bff1b044cmr197352665ad.54.1728374586283; Tue, 08 Oct 2024 01:03:06 -0700 (PDT) Received: from sxavier-dev.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c1396d547sm50339915ad.223.2024.10.08.01.03.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2024 01:03:05 -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 for-rc 10/10] RDMA/bnxt_re: Fix the GID table length Date: Tue, 8 Oct 2024 00:41:42 -0700 Message-Id: <1728373302-19530-11-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1728373302-19530-1-git-send-email-selvin.xavier@broadcom.com> References: <1728373302-19530-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 GID table length is reported by FW. The gid index which is passed to the driver during modify_qp/create_ah is restricted by the sgid_index field of struct ib_global_route. sgid_index is u8 and the max sgid possible is 256. Each GID entry in HW will have 2 GID entries in the kernel gid table. So we can support twice the gid table size reported by FW. Also, restrict the max GID to 256 also. Fixes: 847b97887ed4 ("RDMA/bnxt_re: Restrict the max_gids to 256") Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.c b/drivers/infiniband/hw/bnxt_re/qplib_sp.c index 32c1cc7..e29fbbd 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_sp.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.c @@ -159,7 +159,14 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, if (!bnxt_qplib_is_chip_gen_p7(rcfw->res->cctx)) attr->l2_db_size = (sb->l2_db_space_size + 1) * (0x01 << RCFW_DBR_BASE_PAGE_SHIFT); - attr->max_sgid = BNXT_QPLIB_NUM_GIDS_SUPPORTED; + /* + * Read the max gid supported by HW. + * For each entry in HW GID in HW table, we consume 2 + * GID entries in the kernel GID table. So max_gid reported + * to stack can be up to twice the value reported by the HW, up to 256 gids. + */ + attr->max_sgid = le32_to_cpu(sb->max_gid); + attr->max_sgid = min_t(u32, BNXT_QPLIB_NUM_GIDS_SUPPORTED, 2 * attr->max_sgid); attr->dev_cap_flags = le16_to_cpu(sb->dev_cap_flags); attr->dev_cap_flags2 = le16_to_cpu(sb->dev_cap_ext_flags_2);