Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp19934pxb; Fri, 15 Jan 2021 04:52:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwil29tmbFmNIwo1Qjw4WM24+RjxUfCQzUySG3XcaEajvIvGdo0sWiKNfV2+27e9sz+/juO X-Received: by 2002:a17:906:31cb:: with SMTP id f11mr8980349ejf.468.1610715147585; Fri, 15 Jan 2021 04:52:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715147; cv=none; d=google.com; s=arc-20160816; b=TZxIhEoURB4n0U194gLB+sj1z9uCvrIIiQ/XQmvcdWRBHjMKm5aiw1hmaXF02FfFL4 sdseHzPr2AVtGX9VYttgwHvJSTuRL6JhzVxAZ99jdEmQQ2F394IDT1sykvCyG9sup7Cw MhW/wUs/osHzF7cEocuDjuOuYN9ecL2oa6B/ZZ9owupnqZDZmqVfXqHDhR9v8G2FeRZm Au540ax8wDRHFUKUuyNAEBz6ZOdk+aJvpCKenq981RJxDbkolA1LDKLr2hNH41taG44F eQ7CmioqmuqCbY41KkIzSjTNK41G+CJcgpUNPbrAwkZIgHy1GH4ZDs0m31/gd8946fnb b9qQ== 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=auZKzBfnaPgNjN+bmbj6w27pNr9cem/mpPTWElLQPNk=; b=PbbM/Ib8neuBHFGLd2b1zd5drPbIyp1++ICuNFvSsk4sxEl6B3P4A2ruF6aheVExkC OFzBDCg04FY4ieNPrRZm/Sxw8er31TErkxQjSlp0/Jo63MbU7KGVqQcnpK0J2Unk2yHG uFMdT/bUp+/JKv1tHc1fPKYApYR4D5pgTQiTDCgfvE6yX5Su7grR/+7E6gHzQKPgZVeu 4/OzYsHmHaO+kVEVBRg/u+mYSxMY7AopCmQ2BhRCv9p6Gct8Yrg2V5w79YD8y9k7J0Py NfwUVQ+HG1R5phIJ39XhebCzCOxuZm/HDVVqSypjj+YDE9gjkhnXzzjDwOABXs+Nfem+ JvuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="p6Nx/gRr"; 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=pass (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 f13si3497871edc.38.2021.01.15.04.52.04; Fri, 15 Jan 2021 04:52:27 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b="p6Nx/gRr"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387473AbhAOMv0 (ORCPT + 99 others); Fri, 15 Jan 2021 07:51:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:42952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387742AbhAOMfu (ORCPT ); Fri, 15 Jan 2021 07:35:50 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 61002207C4; Fri, 15 Jan 2021 12:35:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714109; bh=v/kjQ/IhoMCLAS7xelL+qfowUwd0n9P16qMB9TK8QWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p6Nx/gRrztISOKwWubWP6tU6tX0pNjaIsPzE049gk0PaK5X23/aCaS7x342IhBtH8 aORAY3HKukvjnHFciXDhxwBWL2G7akOpjuHv/h1GjxhcmU7vwECsUgF1X4wsRAAYqb c0pufJlM1tm/wLrrNJcYJLrwtE1Qg2odOyY2gcbo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Eran Ben Elisha , Saeed Mahameed Subject: [PATCH 5.4 20/62] net/mlx5e: ethtool, Fix restriction of autoneg with 56G Date: Fri, 15 Jan 2021 13:27:42 +0100 Message-Id: <20210115121959.382383167@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@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 b1c0aca3d3ddeebeec57ada9c2df9ed647939249 ] Prior to this patch, configuring speed to 50G with autoneg off over devices supporting 50G per lane failed. Support for 50G per lane introduced a new set of link-modes, on which driver always performed a speed validation as if only legacy link-modes were configured. Fix driver speed validation to force setting autoneg over 56G only if in legacy link-mode. Fixes: 3d7cadae51f1 ("net/mlx5e: ethtool, Fix analysis of speed setting") Signed-off-by: Aya Levin Reviewed-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -976,6 +976,22 @@ static int mlx5e_get_link_ksettings(stru return mlx5e_ethtool_get_link_ksettings(priv, link_ksettings); } +static int mlx5e_speed_validate(struct net_device *netdev, bool ext, + const unsigned long link_modes, u8 autoneg) +{ + /* Extended link-mode has no speed limitations. */ + if (ext) + return 0; + + if ((link_modes & MLX5E_PROT_MASK(MLX5E_56GBASE_R4)) && + autoneg != AUTONEG_ENABLE) { + netdev_err(netdev, "%s: 56G link speed requires autoneg enabled\n", + __func__); + return -EINVAL; + } + return 0; +} + static u32 mlx5e_ethtool2ptys_adver_link(const unsigned long *link_modes) { u32 i, ptys_modes = 0; @@ -1068,13 +1084,9 @@ int mlx5e_ethtool_set_link_ksettings(str link_modes = autoneg == AUTONEG_ENABLE ? ethtool2ptys_adver_func(adver) : mlx5e_port_speed2linkmodes(mdev, speed, !ext); - if ((link_modes & MLX5E_PROT_MASK(MLX5E_56GBASE_R4)) && - autoneg != AUTONEG_ENABLE) { - netdev_err(priv->netdev, "%s: 56G link speed requires autoneg enabled\n", - __func__); - err = -EINVAL; + err = mlx5e_speed_validate(priv->netdev, ext, link_modes, autoneg); + if (err) goto out; - } link_modes = link_modes & eproto.cap; if (!link_modes) {