Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2095819pxb; Mon, 12 Apr 2021 14:21:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7/GtGHDvpbRIax4mbIxQOSp7qVVRnGffD1unhgNyXc+3Sx0s9gcHdZrzOb61C/rJ4Frv8 X-Received: by 2002:a50:8d8a:: with SMTP id r10mr17890490edh.132.1618262513505; Mon, 12 Apr 2021 14:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618262513; cv=none; d=google.com; s=arc-20160816; b=bJyQObIXEkzLT5AjDRXSVg/Pj9OhvWFGnczXgthuZ8Yq+so58LeslZqgitXZ2IdeQg cQGJShNek1TpRH/SR2OYup4gSv5+lGU2MNtSLyKwzDSA9FGKvaVhoF5SDzwXtPcd153h xZZdL2twOXCLHJNPnH+ynpHY+rH6L64MLXNN/Ty79b+oOG/MejR5TfvhEOavUWKeX+60 bQfcvo1QvvdcQX3WlNpeHjLdX90c1NdN+49+3Zl+Rgl3PLfGZ7Z9wGGXh+5zuMmQ2As9 foJD+FflHHm6Wzx77+QHP+17WQtbnma4mN6yrPBJ2D3leZptb6EumTxCaCOKzJZ/L4PW j/jA== 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=1pR5LYyk82VKLCGrY58WgOgZBItxZkkmgaO+D1JSU+s=; b=cZs9cztmUXDigozV/PorTzwy6+mv3vhpT0YJCPl/cwjCW+85gsGPG0mlX/gJJDcC01 d1vHcxhcB+VMPHVXe8d92/xHu7SBgEEMwKfWEf7ECh5xH5r3h8MdxPOCwhlkz+A4dshI iWQUJGHfUtHJRcgodMvmYRvTnk/o3BA23trd0m1Nx29RWVEmUooJIM/+50IvSx8X5kNd GqhV7e37YsHNoyErphWBQA1Rkg+d9jlpmfSvdhTLkP8Lfwdf7ITTdi4Zou/7M6Bz1oWG xDetvQ0G+tMdkgk1OIr9F/CIRpoHSdlD9Sd0E0cGU3r7DS9Rm+NG17tVu6Ull5JLT08F cvRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TXChfNES; 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 bc15si8586060edb.552.2021.04.12.14.21.30; Mon, 12 Apr 2021 14:21:53 -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=@linuxfoundation.org header.s=korg header.b=TXChfNES; 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 S240982AbhDLJLU (ORCPT + 99 others); Mon, 12 Apr 2021 05:11:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:49450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238092AbhDLI4N (ORCPT ); Mon, 12 Apr 2021 04:56:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 716A16127B; Mon, 12 Apr 2021 08:55:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618217756; bh=amPiYROyG1HCnSZccnfRBhCL98vW6QU/hQL4up/hrCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TXChfNES7sVkSRvXk5EWMPkbARKgS1EiW4EiCPNXb/6OXIcRBlpMPOpAF+1eHfRjk iTae0MX/Co3rX3UGmfvaEpat6A5GHDUFWu/0xc4oDUTse23qeQvxJzpUChZLVTlMsR 3z9B/5LQewAzvMcyjmkE2NwJd7KPvEsUGIUE4mkA= 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 , Sasha Levin Subject: [PATCH 5.10 132/188] net/mlx5e: Fix ethtool indication of connector type Date: Mon, 12 Apr 2021 10:40:46 +0200 Message-Id: <20210412084018.029890092@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210412084013.643370347@linuxfoundation.org> References: <20210412084013.643370347@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 3211434dfe7a66fcf55e43961ea524b78336c04c ] Use connector_type read from PTYS register when it's valid, based on corresponding capability bit. Fixes: 5b4793f81745 ("net/mlx5e: Add support for reading connector type from PTYS") Signed-off-by: Aya Levin Reviewed-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin --- .../ethernet/mellanox/mlx5/core/en_ethtool.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index bcd05457647e..986f0d86e94d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -744,11 +744,11 @@ static int get_fec_supported_advertised(struct mlx5_core_dev *dev, return 0; } -static void ptys2ethtool_supported_advertised_port(struct ethtool_link_ksettings *link_ksettings, - u32 eth_proto_cap, - u8 connector_type, bool ext) +static void ptys2ethtool_supported_advertised_port(struct mlx5_core_dev *mdev, + struct ethtool_link_ksettings *link_ksettings, + u32 eth_proto_cap, u8 connector_type) { - if ((!connector_type && !ext) || connector_type >= MLX5E_CONNECTOR_TYPE_NUMBER) { + if (!MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) { if (eth_proto_cap & (MLX5E_PROT_MASK(MLX5E_10GBASE_CR) | MLX5E_PROT_MASK(MLX5E_10GBASE_SR) | MLX5E_PROT_MASK(MLX5E_40GBASE_CR4) @@ -884,9 +884,9 @@ static int ptys2connector_type[MLX5E_CONNECTOR_TYPE_NUMBER] = { [MLX5E_PORT_OTHER] = PORT_OTHER, }; -static u8 get_connector_port(u32 eth_proto, u8 connector_type, bool ext) +static u8 get_connector_port(struct mlx5_core_dev *mdev, u32 eth_proto, u8 connector_type) { - if ((connector_type || ext) && connector_type < MLX5E_CONNECTOR_TYPE_NUMBER) + if (MLX5_CAP_PCAM_FEATURE(mdev, ptys_connector_type)) return ptys2connector_type[connector_type]; if (eth_proto & @@ -987,11 +987,11 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, data_rate_oper, link_ksettings); eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; - - link_ksettings->base.port = get_connector_port(eth_proto_oper, - connector_type, ext); - ptys2ethtool_supported_advertised_port(link_ksettings, eth_proto_admin, - connector_type, ext); + connector_type = connector_type < MLX5E_CONNECTOR_TYPE_NUMBER ? + connector_type : MLX5E_PORT_UNKNOWN; + link_ksettings->base.port = get_connector_port(mdev, eth_proto_oper, connector_type); + ptys2ethtool_supported_advertised_port(mdev, link_ksettings, eth_proto_admin, + connector_type); get_lp_advertising(mdev, eth_proto_lp, link_ksettings); if (an_status == MLX5_AN_COMPLETE) -- 2.30.2