Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp733376rdb; Sun, 18 Feb 2024 09:09:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV0NnC75iwyd6u7xfPmJxRnWfDbaLnCMDOo7jCL+9k3hqsZEZ+KgKlRSHPIq2+RjjkuoNA9zvBCPSynC90J0AlTyQsVQcn3v/AQmrp0FA== X-Google-Smtp-Source: AGHT+IGEnJJJ7dxh5/kUjJMSrZOS/r/ZmLrwhgHra5s3zL6TjbHZS1n6qmMCg4OnCS8kcKAd7loU X-Received: by 2002:a67:e985:0:b0:470:3db8:acd8 with SMTP id b5-20020a67e985000000b004703db8acd8mr2612479vso.1.1708276145243; Sun, 18 Feb 2024 09:09:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708276145; cv=pass; d=google.com; s=arc-20160816; b=Wi3YVZWHnoh7xjhNL9JWFrJa/K7zmSauGONnRPMyuMO4AR6SqQG2McnUWS8PV7Qgev U0WZUiM0hqrI/+292x0zuOBm/4guJAz3Z/Hq9hLPUF9jW5Tq4acxNn9URtyRSg7KMv3A OtbVSsl1aP9GezGLpLKAp3RhZFVmQsbNRdiwB8c5RAXm2PfCnwTK1z/1eUuS06kiXs7x fG3dTfd6k9G0djlrnY0HMQWQiPJzp+XifjjK/WvJ88KWOAKonnx+bOhYixBNiThYBPxB TFSDEE8FX+69JtTVQVcGFmSThriVKfjQ/ZkWlcYzBnYQmF42gbqpEpFSmmrgsgnW1FG+ C1vA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=N1CZYG16uNIIX1bzINMMJKicgWAqJc4xUccwHeGoHyI=; fh=7ogY8TTBnoDyVw0Ew02z/XaZICVahvk3b1eitAEneUQ=; b=z6FH1EpxN4quKjj6HYNs2BdyrAiGJgrrDpM0PQoIFTDqzBepge87zo3+wsVi9R61Ys h71uicu4u+nldLuzebv+IOyYbzzl8nxsrjr6UQ/c++1yD2qK0QkX8sw4fSm1j6RCKae0 S3qr9aRFp0uUZDgk+LFwWO1Bq/Ue4FzBwIbTS18MYZjviH2Pe6ANxxXxaSmYnL9OP/s2 2ayknpQQJvR2zHa5eez3jNUG1+yH8STs/sEnwgswb7HrkBArO8YpraQAyh2HBh62LhpG N8Vofp4iwoERO74MhmMBzPPxXdh8bYP1R8jZ+ZSGz42/u9cexXuQfjZSKnXqMAD8dS82 qdUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=XxDDd35v; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70451-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70451-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ik8-20020a0561025f0800b00470324838a8si672609vsb.262.2024.02.18.09.09.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 09:09:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70451-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=XxDDd35v; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-70451-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70451-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E37741C209BD for ; Sun, 18 Feb 2024 17:09:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DBC3971B49; Sun, 18 Feb 2024 17:07:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="XxDDd35v" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2D1371B2A; Sun, 18 Feb 2024 17:07:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276055; cv=none; b=rMbsHeW93AdOF82ogKYhT4/RG9hRQcBYvo2pCQupopZq3TNEuFY2nIgO/kU3GPPeRFY4o2xNsFB/L1zYFfmAYOAbi2VoAfj5Alcl7DjmS1FtqUfUVgLStGaCfM3y2xRLJTN/O9gf/egRtXZ81GuB0rqAo1vA+CnREpzNjhaS9vk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276055; c=relaxed/simple; bh=6WQbQolAq5WAPWukfrjltstk+z0qZj+AW55w271U/ic=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YFyxFyVXM/UUZsz05RiMLhRJwfr5g+KfbmCcwuB55EMWaQyl25ZojFUsJUStJZl9blgjfPb/h73jvuaAruvWV4z+MixKPAX9bpT8mvSHRQ6oRvJ/2Y3isfhAl2StOtKz6RK5ZWIVHAZgRSu2+Qu1oEE/WqS3tQXXLoCrgwfDcc0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=XxDDd35v; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=N1CZYG16uNIIX1bzINMMJKicgWAqJc4xUccwHeGoHyI=; b=Xx DDd35vWHSpe2eHQgGadIQYLkiyd/X9oZ56Su//nw0DIn/TVuzr6yb9V0JiquXhPu8wSaJU859Brz0 Tuhic6lp6/hJDJEJI41TRguDA69u1VgsbTrc9LChppOx7qvVsmzOQzjnKlObYh210/XWA5r4bWB7O s6LL7iYsboT3YNo=; Received: from c-76-156-36-110.hsd1.mn.comcast.net ([76.156.36.110] helo=thinkpad.home.lunn.ch) by vps0.lunn.ch with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rbkdl-0088HX-Eq; Sun, 18 Feb 2024 18:07:45 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:01 -0600 Subject: [PATCH net-next v4 4/9] net: ethernet: ixgbe: Convert EEE to use linkmodes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240218-keee-u32-cleanup-v4-4-71f13b7c3e60@lunn.ch> References: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> In-Reply-To: <20240218-keee-u32-cleanup-v4-0-71f13b7c3e60@lunn.ch> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Ariel Elior , Manish Chopra , Jesse Brandeburg , Tony Nguyen Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Andrew Lunn X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=4488; i=andrew@lunn.ch; h=from:subject:message-id; bh=6WQbQolAq5WAPWukfrjltstk+z0qZj+AW55w271U/ic=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jk/JERCgT2kg8FeEjUP6X0L62pRTwhM7DEPs 9WJvJelC/yJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5PwAKCRDmvw3LpmlM hJE0D/sG4wq05q/2ZX9eEb5KvXIuYsdHoSNXUJnEf5z0+/BaDswOC8aGxcT0zhxEvZ82AyqHARW r3PGnlOTahAFVkdDg8jo+zWDpQeIQz/o0uTPTq69aUCn4lWAE5LjOlskkN1H6i43QNjSxRTjHWs 3Q7Wa/73w2GBnsWYqDI1eeBhNxHgGcR5X85m0PMU2mBiBm1kUglcCB+6nkaA39SvrxHms5Xprop FCfDhSeUuQsT0nmibaa+bk9zQod90pVnP4/I+lT9mLotA/NfEe82P7LINr9lf9QBuEqvYDsn+4a 0wtooO1K8SWmgvBMD1uMsEFT0bLQGw/i6TwmiX5oKSamfi5Kpi/MJH6v1LF1HY8Smpg/uJzcL/a dppr5lcdlvdY/Cx/LFIEJhgQ0GrKI+l8Pdtdkl3hv5LuFr/UF/1KVlj4Sq8Nz2CMkNfy0lqwSyB k6LgwGGN9s73364DlFY/UGDNIiwJ7LcjREpS7fIiCTMqZ1cQPQLRHT6ujFAMByPe5dhVpBhUfFh LZqcDgUeFLSGO8hKjfEZbaDB3XgZEGPOPKjgsACpwDYqNAQK2hdH8Cc79j14Afzh1DXC+AYiURS 2VcRoxUiJJs73zQsKUfsALFj2betp6be4uQBvSDegthjGW9tcAxsiLj4/qIufVPjaCF0hR+7rVA v+0K2l5FCH9zAkw== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 Convert the tables to make use of ETHTOOL link mode bits, rather than the old u32 SUPPORTED speeds. Make use of the linkmode helps to set bits and compare linkmodes. As a result, the _u32 members of keee are no longer used, a step towards removing them. Signed-off-by: Andrew Lunn --- drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 48 ++++++++++++------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index b1e7338a4ed1..a0879f125146 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c @@ -3403,30 +3403,31 @@ static int ixgbe_get_module_eeprom(struct net_device *dev, static const struct { ixgbe_link_speed mac_speed; - u32 supported; + u32 link_mode; } ixgbe_ls_map[] = { - { IXGBE_LINK_SPEED_10_FULL, SUPPORTED_10baseT_Full }, - { IXGBE_LINK_SPEED_100_FULL, SUPPORTED_100baseT_Full }, - { IXGBE_LINK_SPEED_1GB_FULL, SUPPORTED_1000baseT_Full }, - { IXGBE_LINK_SPEED_2_5GB_FULL, SUPPORTED_2500baseX_Full }, - { IXGBE_LINK_SPEED_10GB_FULL, SUPPORTED_10000baseT_Full }, + { IXGBE_LINK_SPEED_10_FULL, ETHTOOL_LINK_MODE_10baseT_Full_BIT }, + { IXGBE_LINK_SPEED_100_FULL, ETHTOOL_LINK_MODE_100baseT_Full_BIT }, + { IXGBE_LINK_SPEED_1GB_FULL, ETHTOOL_LINK_MODE_1000baseT_Full_BIT }, + { IXGBE_LINK_SPEED_2_5GB_FULL, ETHTOOL_LINK_MODE_2500baseX_Full_BIT }, + { IXGBE_LINK_SPEED_10GB_FULL, ETHTOOL_LINK_MODE_10000baseT_Full_BIT }, }; static const struct { u32 lp_advertised; - u32 mac_speed; + u32 link_mode; } ixgbe_lp_map[] = { - { FW_PHY_ACT_UD_2_100M_TX_EEE, SUPPORTED_100baseT_Full }, - { FW_PHY_ACT_UD_2_1G_T_EEE, SUPPORTED_1000baseT_Full }, - { FW_PHY_ACT_UD_2_10G_T_EEE, SUPPORTED_10000baseT_Full }, - { FW_PHY_ACT_UD_2_1G_KX_EEE, SUPPORTED_1000baseKX_Full }, - { FW_PHY_ACT_UD_2_10G_KX4_EEE, SUPPORTED_10000baseKX4_Full }, - { FW_PHY_ACT_UD_2_10G_KR_EEE, SUPPORTED_10000baseKR_Full}, + { FW_PHY_ACT_UD_2_100M_TX_EEE, ETHTOOL_LINK_MODE_100baseT_Full_BIT }, + { FW_PHY_ACT_UD_2_1G_T_EEE, ETHTOOL_LINK_MODE_1000baseT_Full_BIT }, + { FW_PHY_ACT_UD_2_10G_T_EEE, ETHTOOL_LINK_MODE_10000baseT_Full_BIT }, + { FW_PHY_ACT_UD_2_1G_KX_EEE, ETHTOOL_LINK_MODE_1000baseKX_Full_BIT }, + { FW_PHY_ACT_UD_2_10G_KX4_EEE, ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT }, + { FW_PHY_ACT_UD_2_10G_KR_EEE, ETHTOOL_LINK_MODE_10000baseKR_Full_BIT}, }; static int ixgbe_get_eee_fw(struct ixgbe_adapter *adapter, struct ethtool_keee *edata) { + __ETHTOOL_DECLARE_LINK_MODE_MASK(common); u32 info[FW_PHY_ACT_DATA_COUNT] = { 0 }; struct ixgbe_hw *hw = &adapter->hw; int rc; @@ -3436,28 +3437,29 @@ ixgbe_get_eee_fw(struct ixgbe_adapter *adapter, struct ethtool_keee *edata) if (rc) return rc; - edata->lp_advertised_u32 = 0; for (i = 0; i < ARRAY_SIZE(ixgbe_lp_map); ++i) { if (info[0] & ixgbe_lp_map[i].lp_advertised) - edata->lp_advertised_u32 |= ixgbe_lp_map[i].mac_speed; + linkmode_set_bit(ixgbe_lp_map[i].link_mode, + edata->lp_advertised); } - edata->supported_u32 = 0; for (i = 0; i < ARRAY_SIZE(ixgbe_ls_map); ++i) { if (hw->phy.eee_speeds_supported & ixgbe_ls_map[i].mac_speed) - edata->supported_u32 |= ixgbe_ls_map[i].supported; + linkmode_set_bit(ixgbe_lp_map[i].link_mode, + edata->lp_advertised); } - edata->advertised_u32 = 0; for (i = 0; i < ARRAY_SIZE(ixgbe_ls_map); ++i) { if (hw->phy.eee_speeds_advertised & ixgbe_ls_map[i].mac_speed) - edata->advertised_u32 |= ixgbe_ls_map[i].supported; + linkmode_set_bit(ixgbe_lp_map[i].link_mode, + edata->advertised); } - edata->eee_enabled = !!edata->advertised_u32; + edata->eee_enabled = !linkmode_empty(edata->advertised); edata->tx_lpi_enabled = edata->eee_enabled; - if (edata->advertised_u32 & edata->lp_advertised_u32) - edata->eee_active = true; + + linkmode_and(common, edata->advertised, edata->lp_advertised); + edata->eee_active = !linkmode_empty(common); return 0; } @@ -3504,7 +3506,7 @@ static int ixgbe_set_eee(struct net_device *netdev, struct ethtool_keee *edata) return -EINVAL; } - if (eee_data.advertised_u32 != edata->advertised_u32) { + if (!linkmode_equal(eee_data.advertised, edata->advertised)) { e_err(drv, "Setting EEE advertised speeds is not supported\n"); return -EINVAL; -- 2.43.0