Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4341657pxu; Mon, 12 Oct 2020 16:52:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzR1L9NFGm9/F1Fxa0r1aYuUss4RdWd8aFEzc5GyeJM78A9v6bXNUuRBT5VdDlc9eDPjPV1 X-Received: by 2002:a17:906:6c82:: with SMTP id s2mr31800502ejr.182.1602546731773; Mon, 12 Oct 2020 16:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602546731; cv=none; d=google.com; s=arc-20160816; b=F9U0xIt4kBQzuoZjeIj7KQF22XT5qWsGrx1JOmDON9A+nxTg5KxreJ6wdgoehZAShL W/YzaLf5dLyHfhFc0qYzHmBV04JiZ4NyyHuLYYEe0RAbK4thD4lVtQlxp18FvqCihytQ a8z4dIx/TuSmNSAJPVa0vixSy6W7aaD1eFHL0sxrgvqtMxErFY2vfaFgfCaJC9ujCqi3 c8pXoFlz/rLqXFEMn6rHCr4uQjJqBJV6MG/i4SaAacAb0v85p7s7f1nnXrUSDPNBn+Bw nA11qHu6Prb3+u76boTa0Nioq5PNd/46RbWQDb4SaXufAtdLnu4HgWslspJl0hmOxEXc koYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ahNYdz6KzfLpaPj8RZfwmcmVg4StucAJfHSo4RfRt7M=; b=hc59vq5IRnUhlH8jewozeAzlEEB803NvVdSudurAvuTjRno6hEZ1z7O94ZGoaICrUf u095+HsLgbjvL1HHrEgl0zVGCnM4OMdQIzf/eGJ9UOuWSaovPDZWecbEnE0HeDogxxiU lwhooxKnifvyFjr3UEp153+PHLqcGBlDgj4jQq7XZbth+jArpqzYbIlc7D2jF7ovxAjg Sqf2ZF15AtXuRnby+tQHpfRlUNy/svEY41s2k+7H3OvsmEZbmQZfJFlsipwPmgFZ3+t0 0p7GovZgEODXqTujaDsCY4Pd8QHwn/O7a3DqXooqosjB/n3MbLVYtpn0Oqa63WJ4Kyfe /hNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qWWnrHcS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cd12si11842714ejb.745.2020.10.12.16.51.49; Mon, 12 Oct 2020 16:52:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qWWnrHcS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390035AbgJLNuU (ORCPT + 99 others); Mon, 12 Oct 2020 09:50:20 -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