From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEB0FC433DF for ; Mon, 12 Oct 2020 13:50:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6EE8D20757 for ; Mon, 12 Oct 2020 13:50:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510624; bh=Lz38F2htKW8lqyS4IEjzMtC5yF0YCQOCPlgyXQRaPeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gmyQHeCNCTKz2JeErLAI33Ut+ZPo3mXN7C5pT2aHo0AjokPayfwK9Jswbz6ssDxdP OkUGR1LD4blPEFw4lxhYsBpnw9notJLkgbdxjC6MA+RgJ9ef4ILfRQVq7vonBzIjBH 5fyWshgVGKOqRlb5x0N1yssh3MHALX7sgsSDqeS8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390044AbgJLNuX (ORCPT ); Mon, 12 Oct 2020 09:50:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:55730 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731903AbgJLNsT (ORCPT ); Mon, 12 Oct 2020 09:48:19 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 62C242227F; Mon, 12 Oct 2020 13:48:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1602510486; bh=Lz38F2htKW8lqyS4IEjzMtC5yF0YCQOCPlgyXQRaPeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qWWnrHcS65RNgJZ7eL++67wF0irDpnXIXh4O58FrCljuOE5XjBRvi4fwMvYB0/kqc zjIPkeAj0lgySE9Q3NcxP3dfOjbiSGSmQDnc6KJflNMj+R+6+8EYmhHEFTIPsl4GeK +QfVIE9fQyfCatPXAn+fE2MA/IbjhK4+VSILl6e8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Eran Ben Elisha , Moshe Shemesh , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.8 090/124] net/mlx5e: Fix return status when setting unsupported FEC mode Date: Mon, 12 Oct 2020 15:31:34 +0200 Message-Id: <20201012133151.210002525@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012133146.834528783@linuxfoundation.org> References: <20201012133146.834528783@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aya Levin [ Upstream commit 2608a2f831c47dfdf18885a7289be5af97182b05 ] Verify the configured FEC mode is supported by at least a single link mode before applying the command. Otherwise fail the command and return "Operation not supported". Prior to this patch, the command was successful, yet it falsely set all link modes to FEC auto mode - like configuring FEC mode to auto. Auto mode is the default configuration if a link mode doesn't support the configured FEC mode. Fixes: b5ede32d3329 ("net/mlx5e: Add support for FEC modes based on 50G per lane links") Signed-off-by: Aya Levin Reviewed-by: Eran Ben Elisha Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/en/port.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/port.c b/drivers/net/ethernet/mellanox/mlx5/core/en/port.c index 98e909bf3c1ec..3e32264cf6131 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en/port.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port.c @@ -566,6 +566,9 @@ int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u16 fec_policy) if (fec_policy >= (1 << MLX5E_FEC_LLRS_272_257_1) && !fec_50g_per_lane) return -EOPNOTSUPP; + if (fec_policy && !mlx5e_fec_in_caps(dev, fec_policy)) + return -EOPNOTSUPP; + MLX5_SET(pplm_reg, in, local_port, 1); err = mlx5_core_access_reg(dev, in, sz, out, sz, MLX5_REG_PPLM, 0, 0); if (err) -- 2.25.1