From patchwork Wed Feb 23 17:04:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12757212 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4E93C433EF for ; Wed, 23 Feb 2022 17:04:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243136AbiBWRFM (ORCPT ); Wed, 23 Feb 2022 12:05:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243124AbiBWRFI (ORCPT ); Wed, 23 Feb 2022 12:05:08 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC82250B23 for ; Wed, 23 Feb 2022 09:04:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6719260FE6 for ; Wed, 23 Feb 2022 17:04:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC56FC340F1; Wed, 23 Feb 2022 17:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645635880; bh=U9e7jCWAX927tzAzoTU1SUJ+qStw52GEagclpM2SylE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kIsZx+ga8JhpuAk9TSZ0rbajpGSr6T9RE9OCnAKHtD8/FaeYF8VluEe3T0qVVvfVP +4kKnyEvvIOVfCUdLQfhqibgx13Hn4NRhGeg608BpREBXpfCAGHbNJ+xniZqdQwFXK jkyMRX2gzZr1t36HP1H0RcBghWVcIKl3UFO4ai0P4WyYek110SYvWX2nDQZUbDmHqJ Iqegux5IZD8tN/7Yeb071BHnG5N3aEfLnJhIu5I5xfZhkAjLiJ/BZ059HPDzTwq/57 EFczw8u2czzG8INbfEoQ1h1M25xKHt9xpEsDgSc/bVHscFb8h7gXjNokSx21qu/99B pb863P08VzW7Q== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Maher Sanalla , Avihai Horon , Saeed Mahameed Subject: [net 06/19] net/mlx5: Update log_max_qp value to be 17 at most Date: Wed, 23 Feb 2022 09:04:17 -0800 Message-Id: <20220223170430.295595-7-saeed@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220223170430.295595-1-saeed@kernel.org> References: <20220223170430.295595-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Maher Sanalla Currently, log_max_qp value is dependent on what FW reports as its max capability. In reality, due to a bug, some FWs report a value greater than 17, even though they don't support log_max_qp > 17. This FW issue led the driver to exhaust memory on startup. Thus, log_max_qp value is set to be no more than 17 regardless of what FW reports, as it was before the cited commit. Fixes: f79a609ea6bf ("net/mlx5: Update log_max_qp value to FW max capability") Signed-off-by: Maher Sanalla Reviewed-by: Avihai Horon Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 13f913c13a2d..bba72b220cc3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -526,7 +526,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx) /* Check log_max_qp from HCA caps to set in current profile */ if (prof->log_max_qp == LOG_MAX_SUPPORTED_QPS) { - prof->log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp); + prof->log_max_qp = min_t(u8, 17, MLX5_CAP_GEN_MAX(dev, log_max_qp)); } else if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < prof->log_max_qp) { mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n", prof->log_max_qp,