From patchwork Sun Feb 18 17:06:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13561910 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 7E48B6EB42; Sun, 18 Feb 2024 17:07:23 +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=1708276045; cv=none; b=ezAJuar3fD0dpOZDD+bIM5O3IHljQCGoo8u+LrdH2P/0sLOL0Nbf96JSlqJp/mUBMgWbl9C1oR8zf3b3dQUiNn4yNUHsi6mYAgx6te/E1lt2ATYNrh0Y4b3ZWH1F7GJv7b1okQ9OhkwbK+z7Vab9vBMuD6Xz7SvnW65AmOn6cGU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276045; c=relaxed/simple; bh=z58vyTAiVnpmwvSd4SKmRIwa1d8hKd2eZxCGc/JbUCY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Hdr8rwM0qSsrpCL/IYh8GlidHEWTjl4nn09JWMWxPLey8PPWi1coXoFEl9qvQHTCrwuqiwnLQxEiUXeT5tzqz4MedYE6N99ghjrJ1iBZpjUNOV7XGf96Ph0X5cPp3xXvHx54BRBDnoPtA9S0QdztF7sn5iDlbv2EV8prMQHyMRg= 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=y0gADhJ2; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="y0gADhJ2" 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=ITSb7tuO3rZ7WMe+oWG0eu6CGb3PGXPtHfF5HKSz74c=; b=y0 gADhJ2nD+VD9ntRO9+pSVxVJihJK4ztWvpbQT+YUmhgc27/lQ9rjQQphUj3hxL+PJCuNIKPdzKbi1 rUGnm4R/3Hwqk2iC8ixQgLaBYjUlLK4FC9qTGSAuRJ8dYRYn1MHx4jXwVArH0FGXI1UHYkmaGIN8U VXZgplhxfv6RcXE=; 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 1rbkdb-0088HX-KK; Sun, 18 Feb 2024 18:07:35 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:06:58 -0600 Subject: [PATCH net-next v4 1/9] net: usb: r8152: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-1-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=3767; i=andrew@lunn.ch; h=from:subject:message-id; bh=z58vyTAiVnpmwvSd4SKmRIwa1d8hKd2eZxCGc/JbUCY=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jk+HKMQyW8jTLx8fFX5+cCFso8ByjcOJIMo6 4/TbkAqzP6JAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5PgAKCRDmvw3LpmlM hDhsD/0VZtueu7oG2OuUQZRxFFuP7MW5xydhYoEO8SwuZpie8b6OSGQMWIdzj32QN4FH2nHITYu mBIzCn8TTC3uKWKLeLdnxXKawDjdK40k68UuFMwQe/8OKy1c9aYg4932yAeofhFVbVPxc3vjlC1 ObWYqjERxRibMJ1tFLRWVN7I3t8MmRUtqp1JFI68QsbAGVDqhlrZ49Sjqqz4LGXx3UTHhzawCmj MN5uFD6TMjqPQgs7J06udrzQS4N9CcvCJxDdMCY5QlA6V4F9jUhHZbBpDk+c21z+M5vKlgFtXSB NAG+ExOmAuZbpl9RedvuvryPHgHRMVJ9Qo3yeuGwcbE6hbt7pyIFR8EI/YUkQuZ4f8i7XmRqtyZ tLlUa6/t+0yzBnVj9+J8/i4BLc0b4C2Unsc6+OdBZhatd8k+G0z2LgraMf8Abm3J4f8BoVBKbE3 XWBRqSCqAs8qlfaWdSxUViw/D9VIm/saVr8iGOSb17ngu8IIfJopzk1JYfGPisTASYr5YgByBxc hjM5KMVxnEmCHpHKfOaLzv8+ZFrM7OCYdjMik9m8JF1FTrloC+ePsvFagnx+zh7Nn68fvW8YDQK BxtVSjnGegqvMFIcPtDuYOuz4ygcL0M5qc8lQq6Db3uX4zTVV8bUiUuEMy4BnRZLrIWSDNseCbV Uaczba5fABF/EtQ== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 Make use of the existing linkmode helpers for converting PHY EEE register values into links modes, now that ethtool_keee uses link modes, rather than u32 values. Rework determining if EEE is active to make is similar as to how phylib decides, and make use of a phylib helper to validate if EEE is valid in for the current link mode. This then requires that PHYLIB is selected. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman --- drivers/net/usb/Kconfig | 1 + drivers/net/usb/r8152.c | 33 ++++++++++++++++----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index 3fd7dccf0f9c..3c360d4f0635 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig @@ -99,6 +99,7 @@ config USB_RTL8150 config USB_RTL8152 tristate "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" select MII + select PHYLIB select CRC32 select CRYPTO select CRYPTO_HASH diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 3d806b3ff425..6d0dc2c967c4 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -8924,30 +8925,29 @@ static void rtl8152_get_strings(struct net_device *dev, u32 stringset, u8 *data) static int r8152_get_eee(struct r8152 *tp, struct ethtool_keee *eee) { - u32 lp, adv, supported = 0; + __ETHTOOL_DECLARE_LINK_MODE_MASK(common); u16 val; val = r8152_mmd_read(tp, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE); - supported = mmd_eee_cap_to_ethtool_sup_t(val); + mii_eee_cap1_mod_linkmode_t(eee->supported, val); val = r8152_mmd_read(tp, MDIO_MMD_AN, MDIO_AN_EEE_ADV); - adv = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(eee->advertised, val); val = r8152_mmd_read(tp, MDIO_MMD_AN, MDIO_AN_EEE_LPABLE); - lp = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(eee->lp_advertised, val); eee->eee_enabled = tp->eee_en; - eee->eee_active = !!(supported & adv & lp); - eee->supported_u32 = supported; - eee->advertised_u32 = tp->eee_adv; - eee->lp_advertised_u32 = lp; + + linkmode_and(common, eee->advertised, eee->lp_advertised); + eee->eee_active = phy_check_valid(tp->speed, tp->duplex, common); return 0; } static int r8152_set_eee(struct r8152 *tp, struct ethtool_keee *eee) { - u16 val = ethtool_adv_to_mmd_eee_adv_t(eee->advertised_u32); + u16 val = linkmode_to_mii_eee_cap1_t(eee->advertised); tp->eee_en = eee->eee_enabled; tp->eee_adv = val; @@ -8959,23 +8959,22 @@ static int r8152_set_eee(struct r8152 *tp, struct ethtool_keee *eee) static int r8153_get_eee(struct r8152 *tp, struct ethtool_keee *eee) { - u32 lp, adv, supported = 0; + __ETHTOOL_DECLARE_LINK_MODE_MASK(common); u16 val; val = ocp_reg_read(tp, OCP_EEE_ABLE); - supported = mmd_eee_cap_to_ethtool_sup_t(val); + mii_eee_cap1_mod_linkmode_t(eee->supported, val); val = ocp_reg_read(tp, OCP_EEE_ADV); - adv = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(eee->advertised, val); val = ocp_reg_read(tp, OCP_EEE_LPABLE); - lp = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(eee->lp_advertised, val); eee->eee_enabled = tp->eee_en; - eee->eee_active = !!(supported & adv & lp); - eee->supported_u32 = supported; - eee->advertised_u32 = tp->eee_adv; - eee->lp_advertised_u32 = lp; + + linkmode_and(common, eee->advertised, eee->lp_advertised); + eee->eee_active = phy_check_valid(tp->speed, tp->duplex, common); return 0; } From patchwork Sun Feb 18 17:06:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13561912 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 45FA26EB70; Sun, 18 Feb 2024 17:07:26 +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=1708276047; cv=none; b=Z6vKF4b3BNw6KorBSimjVP/7A/f4WpvrdF+QTM9he6tFgaLBOHr/plriemaBfI5EUA1GrC9v/ObxtfmoQC3R3na/mDfY/FBPv7LHUaj6HaqPXRTu2qjvgykbk9tgwMpdzBUxl02sXB441amFwFQw3fC1Heu8M7Z91FiTucaNNw0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276047; c=relaxed/simple; bh=Cpjch1b1D9Jp2vWORWgwbDnErRScd5QZqvv0qT6yMzg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cBvo8KuF6Ay61rNse+hUa51IaIg2xoOddgB/rPZpV+Bhh75mDHSEFRTI7iuZEE4RHqkB/jTFasSngYNLsZJB8m72QeinQZbFj8kY49RPFN+i18XPcmW/x0LresjzubJ7rrKoyMAEoqz23xkoBSeJ1c/7mru30nLBY8rKENh3Gf8= 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=2OCcl4n5; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="2OCcl4n5" 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=sauFk9hjjr6pfRUCRoWd8WYck0QUyoBECM2fduhdkgE=; b=2O Ccl4n55jUdwRe7EWrtEpeQbvEYWSaCFLsjWlnk/PNFz/j36fameT2OMiA5WABrYUcdnhoZ7MQGjn6 qNKH3EciRCsNogU0ZUmsUPKultQ7do8thkeajQaEOSgpKbF3pAI/uG4jlVo8plbOUzSos+Wwn7Ocf ptTb6tDXe+gw21A=; 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 1rbkde-0088HX-TH; Sun, 18 Feb 2024 18:07:39 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:06:59 -0600 Subject: [PATCH net-next v4 2/9] net: usb: ax88179_178a: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-2-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=2018; i=andrew@lunn.ch; h=from:subject:message-id; bh=Cpjch1b1D9Jp2vWORWgwbDnErRScd5QZqvv0qT6yMzg=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jk/F2ghMvHESY0ii+p6xLvRfuLi547nM6+PW XzeryVvpmaJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5PwAKCRDmvw3LpmlM hImtEACou5MOgMSpSoKsDBGzpdDNAR4w+EcZv+ZP4gwiptwXGhZmTI6O9i3noKdzuT6+XAzke3v pgZoDmx3JS+HifsFTz3nNFL1DXmbuZsnZH1Fo8rxo0EZlRVbry1x6DKiGjuttPI8M6KAEYMm7kC gU3Tsokri+d8YxEj5FA69kP6y7dIp67l9g0JMhttq53+5ckwmoyDQKfhGXRZl9kTDSBXaO9I462 xwCSbCj9tJuD+Wv63yLLunQbbwZzxdUcevB06u9B5GljdDsjAaV7GuqGDDOP95kHSvlahGT9PW/ efMRQwYms+6vHmeWnT23Oyig2WtUntvJvnVnhgBg26Q+RldejplSlAgpe6Wd3zH37IxkWJ/45rF QiP7P9oscACkPhiJlBS7ndsTZISSPLRvcjrhv/98Czar4qhSM6VXgl96YWS0sGt9VDS4/oU0vsV WslNc7Lqrw/ZpZxZQF3FKYlx9NrhhRVbtaViK+j6f4eBp4XoprBCn6j8kPWQl9zOXELPMCPMFGw qiIRX4P8Agzf4R5axmnt0daBoyq06mPrieH2ydyczzb/OLkIaQLzIqqqPityuHq4Ni3PrhCS31m iRfAOyYDg+21U3Y+YqyapOAyGEdJMvavQQnEWQpnIrbq/ECwrqeN/ExHRU0YFGpPGxq13+RuTpK ezQxjoPNwKgB93Q== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 Make use of the existing linkmode helpers for converting PHY EEE register values into links modes, now that ethtool_keee uses link modes, rather than u32 values. Signed-off-by: Andrew Lunn --- drivers/net/usb/ax88179_178a.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index d6168eaa286f..d4bf9865d87b 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -676,21 +676,21 @@ ax88179_ethtool_get_eee(struct usbnet *dev, struct ethtool_keee *data) MDIO_MMD_PCS); if (val < 0) return val; - data->supported_u32 = mmd_eee_cap_to_ethtool_sup_t(val); + mii_eee_cap1_mod_linkmode_t(data->supported, val); /* Get advertisement EEE */ val = ax88179_phy_read_mmd_indirect(dev, MDIO_AN_EEE_ADV, MDIO_MMD_AN); if (val < 0) return val; - data->advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(data->advertised, val); /* Get LP advertisement EEE */ val = ax88179_phy_read_mmd_indirect(dev, MDIO_AN_EEE_LPABLE, MDIO_MMD_AN); if (val < 0) return val; - data->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(val); + mii_eee_cap1_mod_linkmode_t(data->lp_advertised, val); return 0; } @@ -698,7 +698,7 @@ ax88179_ethtool_get_eee(struct usbnet *dev, struct ethtool_keee *data) static int ax88179_ethtool_set_eee(struct usbnet *dev, struct ethtool_keee *data) { - u16 tmp16 = ethtool_adv_to_mmd_eee_adv_t(data->advertised_u32); + u16 tmp16 = linkmode_to_mii_eee_cap1_t(data->advertised); return ax88179_phy_write_mmd_indirect(dev, MDIO_AN_EEE_ADV, MDIO_MMD_AN, tmp16); @@ -1663,7 +1663,6 @@ static int ax88179_reset(struct usbnet *dev) ax88179_disable_eee(dev); ax88179_ethtool_get_eee(dev, &eee_data); - eee_data.advertised_u32 = 0; ax88179_ethtool_set_eee(dev, &eee_data); /* Restart autoneg */ From patchwork Sun Feb 18 17:07:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13561913 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 8727D6F523; Sun, 18 Feb 2024 17:07:29 +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=1708276051; cv=none; b=OlblD4zTco3xEMOSqm4wstZqtoS8kTWgzfWye3LjLI2YZpRaGJW/FNps4PQIE4tZY0/tawEYcEk/tlgBJHX8mdk4kK97xx9F5l5Zxj2t/w4kX7CV80/aZtBMQa7/nQZO0Dyw1mDzk/D9S7ATo5EVDLnrJl5mjAjl+ElpZDd9umA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276051; c=relaxed/simple; bh=w1DJYkt9FTZRnNhfN8ZM1D8JVVgGCSqPVVQnR9uVLaE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HZsm3FeEX9KLQLexNunesXOKr+o3N9eQ8gN3L3gg+IXkMsU1Tlv6t11A16m2JOqZCgYq0z8SEPo5tbfrsxexH200MRhjX+SKnRpy6oqaXfo1MN9d+A87TGn69ODP5qb3WYduF/4qx32dyIcWKMK94QQ8qJkEZ29doMsy4sQbWkY= 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=1K1pI2yL; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="1K1pI2yL" 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=bgkZPYVA0V4hJb/XgJ4JlLp2dhut1zemAO++lcwUguU=; b=1K 1pI2yL1HTdd4PpgYvUcLr1D4ZokyrE+DqWWMehQALML51P/jeuKwecCH9Cz6s1wYB6ICqJlD3akYm tBR8tae4XKVKIDACd+alPVy20u1miv9CBMohRbqBnd+NvRjJXyACirbroxQ2aqSNhwz3tndH8k5cB YTKsTCgYx+7nRzU=; 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 1rbkdi-0088HX-5y; Sun, 18 Feb 2024 18:07:42 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:00 -0600 Subject: [PATCH net-next v4 3/9] net: qlogic: qede: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-3-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=4430; i=andrew@lunn.ch; h=from:subject:message-id; bh=w1DJYkt9FTZRnNhfN8ZM1D8JVVgGCSqPVVQnR9uVLaE=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jk/THr+M7mqP78nd5RzXdgWbvVTgHvJlsuzZ 7xMAtGlnIyJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5PwAKCRDmvw3LpmlM hJmqD/9WSvEPicM7UdEiBWGqw0w4cGuTLUuz25fQ3n29OdGUaVYCr2VYuHokkMHu+iDDzeKeGs1 GFn3hbEHUEu5uO4mId0kpOshj7qnLJkRF/GJD7gfDv5MRs/gn0W8KPt6AFzo/fMVLDowRyTRYLE 0kHmInQL0X3fZ0hXnFxruoCRocDSZetF3/dhXT0aL8TilTCGdDw8PxI1Rrd04utZQjcHaRcGvtz ZOnQWCgoVBXWJEj+f1Z1EJPod/rfSgMNwUdSQr2GFqh3S0Z5RTrhdzcVjxhosv19Qo+YWZIbkYo TvSzCGxj49H5KKyUC+wrKWmT+zamSdimTgKuGQKPJzsUJDaiKhnrYSzA7OLxBgSulMF6/DNiEPo WdH/pV0G0iVvqAG3FXHW3lXUKnbJIocMv+kWbWcPFQDRLQ1cyKWf6xruDzxpobvufh3ijZUBEJn /w8PtRojxHjkDJmaVXYBrOhneeIPKknMIRrV/HOtbswVZr9oQHcF/ncYh1n5exunSw3DxajAGqb WMetkaduMV4wDiMGcuYUB49tFuJAU7EvOpGlfamHRjH41lJxUPJ6Fh/soEmxkpRcBVTHdAjEIYH ci62RNrD/fw06aWHRp+WiY8wkGdRmoQE2B/F7B/QYktOTTQgXS0HtzDx4rywQt9Tdh7iih83BpJ gn0oVlqnxxNq0TA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 Make use of the existing linkmode helpers for bit manipulation of EEE advertise, support and link partner support. The aim is to drop the restricted _u32 variants in the near future. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman --- drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 60 ++++++++++++++++--------- 1 file changed, 38 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c index dfa15619fd78..ae3ebf0cf999 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c +++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c @@ -1789,18 +1789,26 @@ static int qede_get_eee(struct net_device *dev, struct ethtool_keee *edata) return -EOPNOTSUPP; } - if (current_link.eee.adv_caps & QED_EEE_1G_ADV) - edata->advertised_u32 = ADVERTISED_1000baseT_Full; - if (current_link.eee.adv_caps & QED_EEE_10G_ADV) - edata->advertised_u32 |= ADVERTISED_10000baseT_Full; - if (current_link.sup_caps & QED_EEE_1G_ADV) - edata->supported_u32 = ADVERTISED_1000baseT_Full; - if (current_link.sup_caps & QED_EEE_10G_ADV) - edata->supported_u32 |= ADVERTISED_10000baseT_Full; - if (current_link.eee.lp_adv_caps & QED_EEE_1G_ADV) - edata->lp_advertised_u32 = ADVERTISED_1000baseT_Full; - if (current_link.eee.lp_adv_caps & QED_EEE_10G_ADV) - edata->lp_advertised_u32 |= ADVERTISED_10000baseT_Full; + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + edata->advertised, + current_link.eee.adv_caps & QED_EEE_1G_ADV); + linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, + edata->advertised, + current_link.eee.adv_caps & QED_EEE_10G_ADV); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + edata->supported, + current_link.sup_caps & QED_EEE_1G_ADV); + linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, + edata->supported, + current_link.sup_caps & QED_EEE_10G_ADV); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + edata->lp_advertised, + current_link.eee.lp_adv_caps & QED_EEE_1G_ADV); + linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, + edata->lp_advertised, + current_link.eee.lp_adv_caps & QED_EEE_10G_ADV); edata->tx_lpi_timer = current_link.eee.tx_lpi_timer; edata->eee_enabled = current_link.eee.enable; @@ -1812,9 +1820,12 @@ static int qede_get_eee(struct net_device *dev, struct ethtool_keee *edata) static int qede_set_eee(struct net_device *dev, struct ethtool_keee *edata) { + __ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = {}; + __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp) = {}; struct qede_dev *edev = netdev_priv(dev); struct qed_link_output current_link; struct qed_link_params params; + bool unsupp; if (!edev->ops->common->can_link_change(edev->cdev)) { DP_INFO(edev, "Link settings are not allowed to be changed\n"); @@ -1832,21 +1843,26 @@ static int qede_set_eee(struct net_device *dev, struct ethtool_keee *edata) memset(¶ms, 0, sizeof(params)); params.override_flags |= QED_LINK_OVERRIDE_EEE_CONFIG; - if (!(edata->advertised_u32 & (ADVERTISED_1000baseT_Full | - ADVERTISED_10000baseT_Full)) || - ((edata->advertised_u32 & (ADVERTISED_1000baseT_Full | - ADVERTISED_10000baseT_Full)) != - edata->advertised_u32)) { + linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, + supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + supported); + + unsupp = linkmode_andnot(tmp, edata->advertised, supported); + if (unsupp) { DP_VERBOSE(edev, QED_MSG_DEBUG, - "Invalid advertised capabilities %d\n", - edata->advertised_u32); + "Invalid advertised capabilities %*pb\n", + __ETHTOOL_LINK_MODE_MASK_NBITS, edata->advertised); return -EINVAL; } - if (edata->advertised_u32 & ADVERTISED_1000baseT_Full) + if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + edata->advertised)) params.eee.adv_caps = QED_EEE_1G_ADV; - if (edata->advertised_u32 & ADVERTISED_10000baseT_Full) - params.eee.adv_caps |= QED_EEE_10G_ADV; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_10000baseT_Full_BIT, + edata->advertised)) + params.eee.adv_caps = QED_EEE_10G_ADV; + params.eee.enable = edata->eee_enabled; params.eee.tx_lpi_enable = edata->tx_lpi_enabled; params.eee.tx_lpi_timer = edata->tx_lpi_timer; From patchwork Sun Feb 18 17:07:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13561914 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="XxDDd35v" 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-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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; From patchwork Sun Feb 18 17:07:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13561915 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 5377271B51; Sun, 18 Feb 2024 17:07:36 +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=1708276057; cv=none; b=qxR8TUc5Ti74wwbnrtiaxu8O2KJfX9ommM1IZuzQEXTlQH3WBbRGWzXBAVRP2FSlYrtBd+/iemMN3TJqd8g3HbF9EosipkZh7ZMxDGjZTjmUbLN7c2XiCd7tN6luIzgSizoNG5IDWK4qaRdEQQXOGWXUDyh+n+wTsJX4KhP/Ipo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276057; c=relaxed/simple; bh=jBShEoehGOiH3XARbTLV/6y5l6NHG5lC8OunACxocoE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B1VMwOtoeXmCKY3d/Poa72YOjS0r0rQ5J9tH3pfpw5ibX6XADNnG3oi/rNApeXPx67iSXq/46Oas6e7s14Jnx1kYIURQJCJFjifvo2XuWvRL/uMYkaIkBD+CfHSh63/gUlfBbF6XvZtXtseS65jOrDJYZCCAHCcKvtMiDDLhgSw= 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=Pk89Yc2v; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="Pk89Yc2v" 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=aFRnThzSsM1GB0U7YhBosyITi6QEbbLLMwyncP4eReU=; b=Pk 89Yc2vBB0hkAtYM0op8l3WOsI6xtG01wblt7FLT7nJm/Ax+xLUurl/bd7tL9CH/WATasT/02Tq6qG T5ttc0zFldzTa44E3jZ1yo6f81BOsJLijYDA4FjL5MgefEFcd5tYIsaKHYA2KBANwwjCkTFUSA4WT uCacSp4xR/wSuiw=; 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 1rbkdo-0088HX-UQ; Sun, 18 Feb 2024 18:07:49 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:02 -0600 Subject: [PATCH net-next v4 5/9] net: intel: i40e/igc: Remove setting Autoneg in EEE capabilities Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-5-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 , Jacob Keller X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2711; i=andrew@lunn.ch; h=from:subject:message-id; bh=jBShEoehGOiH3XARbTLV/6y5l6NHG5lC8OunACxocoE=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jlAMT9Oz3fl2t1Fj5aWbUkFiXJyPsfMFfaXt ddsjRvTWY+JAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5QAAKCRDmvw3LpmlM hMRDEADZfbTifRtNPmUUkeYI81wNBVFF22R1hpdrqUQ4yOsirNebG6Lxb6yo5/tpVcagYOPhRP2 JtRRR8834buT3QWHcFEqG6HkAT2KomsSrgIpZxJISGMG4kIPqcWMdu2Ma1ulfETSLVe5C6FvSl7 jSfOafcJ4Dlp1DLvvmdPT0PNufPbzxH3jVptyuASzExmxApjQoKy+2Bv1WKZ/EN2betp3aYKpuW LdlXNiTTq0qSjDkFok++I9CxOuwlol5Ni8z6JpVsn1JPRP4o6867nzUXkCeiqplebMkxsBV0vgi 9aBv76el4AXAeF9q1Qclkb0HfYVHOJsYyMfAzcas/BPEGOOmEu88DlXfcP4LjAVPazeEN5zwDOs M0x5ofPejeGIefVduu6HeRUeLHuzm7MuUvImUSgAGTYcpZ+U4E28Ak5ifmUHEakS4luAhm0dw52 a8U9fd11NvneMvaFCtLYibcfYRzVRbbfgfoVAoSMu0W7uUep8baUw+tEz1AF78ZGGlbhuZ4rmsm IGf+5oEF1EdeVH2bqDshxYCxfWAheN8Jha8DMFpEPHa5L4xvlfDbCMvvrByrJ1lRdN4ObAi4bEY dEI3refN+CI6JlrPPsIk9DV+pprTjJ4yncawVxxFNvZ/a8BBPNbT9WNZHBvZWZsUb+IpUIjJB8T 4PhFdsczI68TF5w== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 Energy Efficient Ethernet should always be negotiated with the link peer. Don't include SUPPORTED_Autoneg in the results of get_eee() for supported, advertised or lp_advertised, since it is assumed. Additionally, ethtool(1) ignores the set bit, and no other driver sets this. Reviewed-by: Jacob Keller Signed-off-by: Andrew Lunn --- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 7 +------ drivers/net/ethernet/intel/igc/igc_ethtool.c | 4 ---- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 1b5473358e1a..42e7e6cdaa6d 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -5664,16 +5664,12 @@ static int i40e_get_eee(struct net_device *netdev, struct ethtool_keee *edata) if (phy_cfg.eee_capability == 0) return -EOPNOTSUPP; - edata->supported_u32 = SUPPORTED_Autoneg; - edata->lp_advertised_u32 = edata->supported_u32; - /* Get current configuration */ status = i40e_aq_get_phy_capabilities(hw, false, false, &phy_cfg, NULL); if (status) return -EAGAIN; - edata->advertised_u32 = phy_cfg.eee_capability ? SUPPORTED_Autoneg : 0U; - edata->eee_enabled = !!edata->advertised_u32; + edata->eee_enabled = !!phy_cfg.eee_capability; edata->tx_lpi_enabled = pf->stats.tx_lpi_status; edata->eee_active = pf->stats.tx_lpi_status && pf->stats.rx_lpi_status; @@ -5691,7 +5687,6 @@ static int i40e_is_eee_param_supported(struct net_device *netdev, u32 value; const char *name; } param[] = { - {edata->advertised_u32 & ~SUPPORTED_Autoneg, "advertise"}, {edata->tx_lpi_timer, "tx-timer"}, {edata->tx_lpi_enabled != pf->stats.tx_lpi_status, "tx-lpi"} }; diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index 47c797dd2cd9..ac92d10a3e97 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1634,7 +1634,6 @@ static int igc_ethtool_get_eee(struct net_device *netdev, mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert); *edata = adapter->eee; - edata->supported_u32 = SUPPORTED_Autoneg; eeer = rd32(IGC_EEER); @@ -1647,9 +1646,6 @@ static int igc_ethtool_get_eee(struct net_device *netdev, edata->eee_enabled = hw->dev_spec._base.eee_enable; - edata->advertised_u32 = SUPPORTED_Autoneg; - edata->lp_advertised_u32 = SUPPORTED_Autoneg; - /* Report correct negotiated EEE status for devices that * wrongly report EEE at half-duplex */ From patchwork Sun Feb 18 17:07:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13561916 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 EA8D773180; Sun, 18 Feb 2024 17:07:39 +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=1708276061; cv=none; b=FWFfJUkFC36JyR1tlFMhrrm/up8I6SKiSkAGSsZBx2XM/9OjB4ZdE5o6S7a2dvrsuholT0XYMG9FjvLAi/ir5mepj3kb+Wy4lVdVkkjAu9gIXs3lG6rzzPzFCe3yHVPCKlgjbHdEwEUV2wC6ernYwY53j0w0UTTntj1umuJnjFs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276061; c=relaxed/simple; bh=nLsygJVJCduLk95szsdKOpEa7GzGsR0GfRGWNH5oTU4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fh1BuX7+wJvdBp03R51kj5D4mwn2Z1D1Wr0RUhYnl3bYpYLWl7Pnw2rUljib2qCbNUKFH129EBSbx5uPE05KNoDJpuzJWSff/weMTxWk6mFYYVeSQj2KbsGr7/U+V/863WOfskWshHzJBpd7rLjkHSCXdd0Uci/R2LXzaFqU34M= 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=0zxWT03K; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="0zxWT03K" 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=SOMOZ6/FJXknA8+mFiIFxymCAEzF7Pi03pmztEUsl68=; b=0z xWT03KHkP9zKDDeKKuB8Ff0OyH7C2sAQ9EDmDYp08qF7ZwVGjtsPUgZOcu/2ZJD1EodMYNq3vPpLL y/8mhrwXdBg0yQJNouHaJDZ/lNxjlcc9XGi4U3P43/fQgwDJjSFZg1Ly9N4frWV+NdABuSYw4N/r8 dShCiZ5zqJ4P5BY=; 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 1rbkds-0088HX-73; Sun, 18 Feb 2024 18:07:52 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:03 -0600 Subject: [PATCH net-next v4 6/9] net: intel: e1000e: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-6-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=2663; i=andrew@lunn.ch; h=from:subject:message-id; bh=nLsygJVJCduLk95szsdKOpEa7GzGsR0GfRGWNH5oTU4=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jlA91EUO7alTOK9ZzIu3Ku6+PXdyh7P/mv9v OlgCS1389yJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5QAAKCRDmvw3LpmlM hJvFD/0eOvrHI2+H64ekgmZKRhSn6D1jRFWAc0f5We8soO8bazUkB0XJWS7Mm0DR6UL+o6IT5HC eqbssQOQDJ/zpn0uRvqL0VE64wijEyorFqmWAfZR22HIEe86CBtLd4Uh9oLO6gC59ZxTrmXCrHB S2j5QShvaGbV4a0zHR6OocJXDZIuflfr5nU5+R7+KNh4U+8T/Ypm9ASeQnbKyFEUPDYjRMp1i1N u5uO4z3k3RqcNDNEakFuqKMT8UjsINWNK3wXP16M9j0fxhFq8V6nVbhVeKOB3FylMGZngHOHNfP wXo/6QMJxtC+4iWdVu3bnRqbvVOZY7riJ5iAt934v8G4/zhdE/y6Zx04Fo2YKdH8EtYHbJPGBKi qv6sAnCG/On8yOBarSZ4/+9h/4l810BGYRn+Kz6N0/A+Fmjo3zhq2isp0KJ//pX1H0/Wbt5QSge pOg7QwEQsDYq2KbUSYTJe2bx3CgZJwhBp96EnplyrfDKmqhlz3+c1dZazTRFqX8y4MKqG9gu3Cr hkKzfnbvNKfaGBoPtM670Zq/J2wv42pf/Ph1cp1CKBHso3xDGramiY4LVHiX4PkeYVO7q2Tzrs8 B84dygIfydXG9eKXUf26P3p/p/zdVw8VixEGr6evoe6KWPiBbLghjqZZeHfRwuvkYAJLsYU+6oB fTerw2DwSfqPtKg== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 Make use of the existing linkmode helpers for converting PHY EEE register values into links modes, now that ethtool_keee uses link modes, rather than u32 values. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman --- drivers/net/ethernet/intel/e1000e/ethtool.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c index ff243ae71b78..dc553c51d79a 100644 --- a/drivers/net/ethernet/intel/e1000e/ethtool.c +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c @@ -2223,16 +2223,16 @@ static int e1000e_get_eee(struct net_device *netdev, struct ethtool_keee *edata) ret_val = e1000_read_emi_reg_locked(hw, cap_addr, &phy_data); if (ret_val) goto release; - edata->supported_u32 = mmd_eee_cap_to_ethtool_sup_t(phy_data); + mii_eee_cap1_mod_linkmode_t(edata->supported, phy_data); /* EEE Advertised */ - edata->advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert); + mii_eee_cap1_mod_linkmode_t(edata->advertised, adapter->eee_advert); /* EEE Link Partner Advertised */ ret_val = e1000_read_emi_reg_locked(hw, lpa_addr, &phy_data); if (ret_val) goto release; - edata->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(phy_data); + mii_eee_cap1_mod_linkmode_t(edata->lp_advertised, phy_data); /* EEE PCS Status */ ret_val = e1000_read_emi_reg_locked(hw, pcs_stat_addr, &phy_data); @@ -2265,6 +2265,8 @@ static int e1000e_get_eee(struct net_device *netdev, struct ethtool_keee *edata) static int e1000e_set_eee(struct net_device *netdev, struct ethtool_keee *edata) { struct e1000_adapter *adapter = netdev_priv(netdev); + __ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = {}; + __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp) = {}; struct e1000_hw *hw = &adapter->hw; struct ethtool_keee eee_curr; s32 ret_val; @@ -2283,12 +2285,17 @@ static int e1000e_set_eee(struct net_device *netdev, struct ethtool_keee *edata) return -EINVAL; } - if (edata->advertised_u32 & ~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL)) { + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, + supported); + + if (linkmode_andnot(tmp, edata->advertised, supported)) { e_err("EEE advertisement supports only 100TX and/or 1000T full-duplex\n"); return -EINVAL; } - adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised_u32); + adapter->eee_advert = linkmode_to_mii_eee_cap1_t(edata->advertised); hw->dev_spec.ich8lan.eee_disable = !edata->eee_enabled; From patchwork Sun Feb 18 17:07:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13561917 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 1535F7429B; Sun, 18 Feb 2024 17:07:42 +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=1708276064; cv=none; b=EDYfyHiA7QAMwLuqYFs9eR7gduWtYFFAbcuIm6B/gDwcBnCCl4BYQkWPgRtIkCC/lzjwlFI/Ovz510i4As54oHA/RMFN0Qhp/PkKitN1Ug89ByMhK3jUy1w2k7HWTA+Rb3T1KnzJbrlC8CBfTWMtPRsBFY14RAlapJ/DnRzE7b0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276064; c=relaxed/simple; bh=xffr0GXqel7jbZc8Ik+9TtbWrjhgJxXahNX++S1de6k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mFvCTuOFtcBUrqZHRNHcNOYxnNhuIsT8IDl1KX62Fm2YEuO9Io6ZJeLozTrV2Hs+Xg3seCe7PanfiWaW+OZ9YeAWyFReuaR0JSK3exa2lyl35ctANlRqlWGAtJJ9HmKCfob9LnFCUmGPP5i4buon5ylXBSX+WEcWxmdQeFkEviE= 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=5tkRDZNI; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="5tkRDZNI" 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=ZXONKmDn5sZIMxtipaagv56vEZFiWDyaXt+UaQErfVY=; b=5t kRDZNIv8LqY9BzcHg2fZgk6Bo8lUpMX9l4570v6gHvcOttKEqB/32jUA9t80992Ddnx8IeM3Nw3R9 YB4qzGKfjsWqsJzKL37Zyaacfu1iKhFTwCzo8p8WvBpXleX/ktmAri9JXlVo11V5KMUzqSOizEXzM 3b7nbAMih5lEXdM=; 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 1rbkdv-0088HX-G5; Sun, 18 Feb 2024 18:07:55 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:04 -0600 Subject: [PATCH net-next v4 7/9] net: intel: igb: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-7-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=4098; i=andrew@lunn.ch; h=from:subject:message-id; bh=xffr0GXqel7jbZc8Ik+9TtbWrjhgJxXahNX++S1de6k=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jlAaf/p+bCP3YC5GLSi2piZ2Lnuh9K6p/OH5 7GjWSxzhkKJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5QAAKCRDmvw3LpmlM hMzFEAClMXS6MM6wJcO2I2b80AcQRh2RBR4Qa1lZMF11IbFoPeU9VekKg26fjatWIgKOjZZg8Hx rOaOGX9ZVInHZlE9AQNreE5HzzxJkzzrVrLTVVre9pnNnG6OWvKSQIK0dMZcU8KVKqfuhd4Hh0t OtllpsIw34yFNr6GP9Wv6eA7PbsApeTu5MhRWwR6EyewIjJwN3qFLNcq+lXjUh/5ssPqMN3xaGO BabQhTkX1cT3b5iwT8Cwo/cR3+yLrGv21ztnA6OkF4rB3pleEqqrdBs5xNurQQr7b/og5BzJ6Zu frTECSNMpL5IIVhh0qMkmrbX+mtEFMWK46BBnw5Kd3F5EQElkmTGLJBcbznJCS+trqRaeWuCROE ZAdAGLx+nvFOzuMHWjUl0blfO5VwNXbAwtqR8n2O4TxjS6O6dhdPe10sPn/cEijS60cLVrQqoAU iEmVF8oMgU4wZkBgnEN7s17io3+bQjJ9OSW2HZ5tLuZ9ukpceWxUccbfSGxdmHTsZEuzjvs9Qgy r7xu+4qg6Z7sMhxxmVGygg+sj2lLHyp/uQ2hfcNI2I4UI7pLKWrqSjG4kjsXv7VYmz7bJ9Wkvtw vWzJ5edDdB1aFxPyIqOckldZ6PD0ObnbQElNTXnTRzKECVUciI3zvd/yjpjgH/kdx7LlzIKw9+t 0WGZB83/wBwjHyQ== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 Make use of the existing linkmode helpers for converting PHY EEE register values into links modes, now that ethtool_keee uses link modes, rather than u32 values. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman --- drivers/net/ethernet/intel/igb/igb_ethtool.c | 35 ++++++++++++++++++---------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index b87b23d2151c..99977a22b843 100644 --- a/drivers/net/ethernet/intel/igb/igb_ethtool.c +++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c @@ -3038,11 +3038,13 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_keee *edata) (hw->phy.media_type != e1000_media_type_copper)) return -EOPNOTSUPP; - edata->supported_u32 = (SUPPORTED_1000baseT_Full | - SUPPORTED_100baseT_Full); + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + edata->supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, + edata->supported); if (!hw->dev_spec._82575.eee_disable) - edata->advertised_u32 = - mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert); + mii_eee_cap1_mod_linkmode_t(edata->advertised, + adapter->eee_advert); /* The IPCNFG and EEER registers are not supported on I354. */ if (hw->mac.type == e1000_i354) { @@ -3068,7 +3070,7 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_keee *edata) if (ret_val) return -ENODATA; - edata->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(phy_data); + mii_eee_cap1_mod_linkmode_t(edata->lp_advertised, phy_data); break; case e1000_i354: case e1000_i210: @@ -3079,7 +3081,7 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_keee *edata) if (ret_val) return -ENODATA; - edata->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(phy_data); + mii_eee_cap1_mod_linkmode_t(edata->lp_advertised, phy_data); break; default: @@ -3099,7 +3101,7 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_keee *edata) edata->eee_enabled = false; edata->eee_active = false; edata->tx_lpi_enabled = false; - edata->advertised_u32 &= ~edata->advertised_u32; + linkmode_zero(edata->advertised); } return 0; @@ -3109,6 +3111,8 @@ static int igb_set_eee(struct net_device *netdev, struct ethtool_keee *edata) { struct igb_adapter *adapter = netdev_priv(netdev); + __ETHTOOL_DECLARE_LINK_MODE_MASK(supported) = {}; + __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp) = {}; struct e1000_hw *hw = &adapter->hw; struct ethtool_keee eee_curr; bool adv1g_eee = true, adv100m_eee = true; @@ -3138,14 +3142,21 @@ static int igb_set_eee(struct net_device *netdev, return -EINVAL; } - if (!edata->advertised_u32 || (edata->advertised_u32 & - ~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL))) { + linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + supported); + linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, + supported); + if (linkmode_andnot(tmp, edata->advertised, supported)) { dev_err(&adapter->pdev->dev, "EEE Advertisement supports only 100Tx and/or 100T full duplex\n"); return -EINVAL; } - adv100m_eee = !!(edata->advertised_u32 & ADVERTISE_100_FULL); - adv1g_eee = !!(edata->advertised_u32 & ADVERTISE_1000_FULL); + adv100m_eee = linkmode_test_bit( + ETHTOOL_LINK_MODE_100baseT_Full_BIT, + edata->advertised); + adv1g_eee = linkmode_test_bit( + ETHTOOL_LINK_MODE_1000baseT_Full_BIT, + edata->advertised); } else if (!edata->eee_enabled) { dev_err(&adapter->pdev->dev, @@ -3153,7 +3164,7 @@ static int igb_set_eee(struct net_device *netdev, return -EINVAL; } - adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised_u32); + adapter->eee_advert = linkmode_to_mii_eee_cap1_t(edata->advertised); if (hw->dev_spec._82575.eee_disable != !edata->eee_enabled) { hw->dev_spec._82575.eee_disable = !edata->eee_enabled; adapter->flags |= IGB_FLAG_EEE; From patchwork Sun Feb 18 17:07:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13561918 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 2D67C745E5; Sun, 18 Feb 2024 17:07:45 +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=1708276067; cv=none; b=ZQNH0vKoufrv+sqVT3FGJcZJGdeuuxw/RKo4tVSTMlY65vpO+qoPAJ+TDT+cO52JExf0db/yb4gA6BEM4krMApsrwaUoiTGaKCFU4fxUKZyr/jjDn73aj0OLXHWb3N99zPGzuG3cVoexDu8WklYbOFT7wySzUY2R70wp+Z0v8EI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276067; c=relaxed/simple; bh=JUBlNHQ9KEInXfv/Ts82d6LWLEYOujFvKhAve8sOAdY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tYYojPC2zFyBJpWVx16RIXm+WuXfMCYgzqOQQa3krPfW0jTnbNm5ihBuRz1udR+72fc905QNdVPJHe0IQ/dSKXW4q3FqTAOO4UmFYUZhDesQcq11Tyjn5WtU06Z+OtMZ1+RbHIsTsqL8y1uDOtbPe07DwXOP2KemeQwdIsbSto0= 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=Yc9l8/tk; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="Yc9l8/tk" 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=VwM8omFAb/USTaaRR/I+p2JFbh5V/UtXkfhHiw9cl4I=; b=Yc 9l8/tkSqwjaElYJZfu/XA3cfDIXOFmDg/swedEeAVmxB2mUAH5wfpsuwODQ3aF04gGwkswjntUjDc 7vK/K1lj4LIZMrJ2TxjfjX9P2fTYh/raj0jb83qv0C2E7akG3Gao8EjF/hZ1ad9yjQWIWACPfZB9j DsTqtqQDeTrRqO4=; 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 1rbkdy-0088HX-Oy; Sun, 18 Feb 2024 18:07:58 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:05 -0600 Subject: [PATCH net-next v4 8/9] net: intel: igc: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-8-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=1638; i=andrew@lunn.ch; h=from:subject:message-id; bh=JUBlNHQ9KEInXfv/Ts82d6LWLEYOujFvKhAve8sOAdY=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jlBR1jCpUGgmoGhhgBBTwtCSWKQdM++eFeLI 7FZYtP8Uc+JAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5QQAKCRDmvw3LpmlM hAd+EAC/o1GrNt9qRvp7CrUNHCoEMKRI7L8QKnx0ZtDef3lGW8PNHh0YcY4ovJUxUT929XeeAEf jOnF4K05TU72oBh3svHIwfED0592QpL8g5cNHR7FoPQL6+KaczbLzb+y3J4+A31+oBaw5pX/TGn h9c+oWpkQy4Ut6f4fVpo7gwaFmfH7FVUlnRnKYVi+rEEyw9qvZ/gNZteE5sRQlKDuw6B3SUjBfW JtLRWd6b06gsSwi8lZazLessKtZ7nzyZiS0X1g2jcj9i/QP9IJ+tudfMEYHFf63p1PRLSdnhA1k tQfB5QGhEB0XUFLPd0YB+uqtd6yUycjIBzahOVGuIUx2nIrnHjGcGkwuJ/q3CZHPgQqwAF0sHrf KgENrYLWdbB2Fmh52QEn2+Jy0xBaAqgTELz4rOzWZxViNCYYxtzsBV8bqtaRu29D8Jc4ceUBG0m XTxIfyI1BxROvoL5OkF6j4qhQzKJ8tUxXVUHT6DBfIoXVEESJQCEN8lUwLHEHkWlYM8NHyjAJfq LeXpl2TIewsM3LpifPVU329mmPKaWVAIxAnpq+Pnt0RZry7B+DS5W9nXMFmb/rNO3wteGFDoCof YMj/0GxrECMSjqKlEEaEdlLa56NPgh19J1Oe6S1FR8IEG8iI/2fHrUIaLVi3qCeQ+yj7nuhMt6D cUPj0P35gT2jjKA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 Make use of the existing linkmode helpers for converting PHY EEE register values into links modes, now that ethtool_keee uses link modes, rather than u32 values. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman --- drivers/net/ethernet/intel/igc/igc_ethtool.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c index ac92d10a3e97..1a64f1ca6ca8 100644 --- a/drivers/net/ethernet/intel/igc/igc_ethtool.c +++ b/drivers/net/ethernet/intel/igc/igc_ethtool.c @@ -1630,8 +1630,8 @@ static int igc_ethtool_get_eee(struct net_device *netdev, u32 eeer; if (hw->dev_spec._base.eee_enable) - edata->advertised_u32 = - mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert); + mii_eee_cap1_mod_linkmode_t(edata->advertised, + adapter->eee_advert); *edata = adapter->eee; @@ -1653,7 +1653,7 @@ static int igc_ethtool_get_eee(struct net_device *netdev, edata->eee_enabled = false; edata->eee_active = false; edata->tx_lpi_enabled = false; - edata->advertised_u32 &= ~edata->advertised_u32; + linkmode_zero(edata->advertised); } return 0; @@ -1695,7 +1695,8 @@ static int igc_ethtool_set_eee(struct net_device *netdev, return -EINVAL; } - adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised_u32); + adapter->eee_advert = linkmode_to_mii_eee_cap1_t(edata->advertised); + if (hw->dev_spec._base.eee_enable != edata->eee_enabled) { hw->dev_spec._base.eee_enable = edata->eee_enabled; adapter->flags |= IGC_FLAG_EEE; From patchwork Sun Feb 18 17:07:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13561919 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 878BA74E16; Sun, 18 Feb 2024 17:07:49 +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=1708276071; cv=none; b=nY8XlV0a4R8FtZYFCIbrb2rw8C6WDY6iGpnwoXUA5YIv1CGF93Z63JZJxj2B6K3kW5zXUXrpCAnalmDyeVe9Leqfcmk/mysPNNorp25ukTPNRG2DaE/A1npgQRHPdqxvoNDpRpgMQSDg2FPr06RbQLRMdB2QtmL9Ps7MDC4eiq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708276071; c=relaxed/simple; bh=RuYxKjCx1KM7jfq1OwKbVsYU1FZNAf3c6Gkohmi02zY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GD+nAXUsapvWqfUrgFzl1e2xk5PE0FZX1iyOopFm4yaECj9w6Z27A6XCfbhba7XeGypSraHLkta1vJan/ONX5/u2FPwktPmv7I7ff4ITRuz7NW7Z1qY2nYcEHrU1p/H2+ntBqAh3Lc4IihmvOYzBJ0vuet2xWYsDWA1y1cs5CIw= 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=joiWyt3w; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="joiWyt3w" 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=K1/H/lO2Y/ArsDeyXeOvrW6auZKE79iZc+y+GzqiREI=; b=jo iWyt3wNQkr0ba9NPQR49VGysSetZVYZl/Z3LSOWJ58Zi725VzyYwtoLdURcMQbR6gS0S9aDaKdLnR zVUCRJPldpVlHgwlfMSB+g1dtn/SnH5h5jGh6HUJIhlbdMefBGTxfBXIPrm0zEz6t5c5xifrGZxOX 6lg+9b1oTRUq0m8=; 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 1rbke2-0088HX-1c; Sun, 18 Feb 2024 18:08:02 +0100 From: Andrew Lunn Date: Sun, 18 Feb 2024 11:07:06 -0600 Subject: [PATCH net-next v4 9/9] net: ethtool: eee: Remove legacy _u32 from keee Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240218-keee-u32-cleanup-v4-9-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=5127; i=andrew@lunn.ch; h=from:subject:message-id; bh=RuYxKjCx1KM7jfq1OwKbVsYU1FZNAf3c6Gkohmi02zY=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl0jlBT9FVJM6jr1aNdxTyfnA2A/SCXlRGYnR35 FjwQd/txRKJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZdI5QQAKCRDmvw3LpmlM hEmiD/45OjbJdmoKPe3LT4Pn6JzQpmCkgG+uMi3Q8A+XS780OsviI9D2SJBTB9tUt9bS9mBq6CB b24ihU5CFCSOgNYlaAjJ7V3HQvueqM1YQRhxtVrcY9dgxZqbMqdS1jM5kEA/atcffWugNjIpd9l sB4GvqWhsEFZVLofmmIf+g2pl1E4yGcR4E9PNsOm3hDxRPs7Y0044FEvCMeM1FaF9q8jGUb4eAY v1nh72ooROoPtZ0O9JSaSCTdoNrLxjLOD6Iod/1PBrkmn37qc0O6QEh26JFgCKTVgn5Hs7Ubi69 Gt3fg6po+8nmeiL59eD155DwuyTqBLhoSs9vdonNpCuNhQBVtUU48esETVMGmShvbfKJo+NGV1x S5SeO5VE6ZrUGozQgl1lbANIzYRv9RjmChOh2WNK9aU329h2Pcm3YdkRgs+eB3sDUx2kixOZN2Q HrqPyMinxjko/SRQnr5G3RymMvvM2iGUSClC5iblmsiDlrc6dOgfdbuGjtOA4R/dfmS4JU9mGfC 2/P1LtxwPhpUYuLNQ8bP76NxN7Ox/sViWTiKs32UznzzZFQBeJNaTbiYCfIZ2Y6ul02AUHPupxO nCMK8OJbrS6VBrk0FRPJhgH/2OgrtRrNkb9L+I+LIror0v4DVw+lsopECstrrnryFvbYo/WadhE o2ewBq29LTRAYuQ== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 All MAC drivers have been converted to use the link mode members of keee. So remove the _u32 values, and the code in the ethtool core to convert the legacy _u32 values to link modes. Signed-off-by: Andrew Lunn Reviewed-by: Simon Horman --- include/linux/ethtool.h | 3 --- net/ethtool/eee.c | 31 ++++--------------------------- net/ethtool/ioctl.c | 29 ++++++++++------------------- 3 files changed, 14 insertions(+), 49 deletions(-) diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index b90c33607594..9901e563f706 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -226,9 +226,6 @@ struct ethtool_keee { __ETHTOOL_DECLARE_LINK_MODE_MASK(supported); __ETHTOOL_DECLARE_LINK_MODE_MASK(advertised); __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertised); - u32 supported_u32; - u32 advertised_u32; - u32 lp_advertised_u32; u32 tx_lpi_timer; bool tx_lpi_enabled; bool eee_active; diff --git a/net/ethtool/eee.c b/net/ethtool/eee.c index db6faa18fe41..bf398973eb8a 100644 --- a/net/ethtool/eee.c +++ b/net/ethtool/eee.c @@ -4,9 +4,6 @@ #include "common.h" #include "bitset.h" -#define EEE_MODES_COUNT \ - (sizeof_field(struct ethtool_keee, supported_u32) * BITS_PER_BYTE) - struct eee_req_info { struct ethnl_req_info base; }; @@ -41,15 +38,6 @@ static int eee_prepare_data(const struct ethnl_req_info *req_base, ret = dev->ethtool_ops->get_eee(dev, eee); ethnl_ops_complete(dev); - if (!ret && !ethtool_eee_use_linkmodes(eee)) { - ethtool_convert_legacy_u32_to_link_mode(eee->supported, - eee->supported_u32); - ethtool_convert_legacy_u32_to_link_mode(eee->advertised, - eee->advertised_u32); - ethtool_convert_legacy_u32_to_link_mode(eee->lp_advertised, - eee->lp_advertised_u32); - } - return ret; } @@ -62,11 +50,6 @@ static int eee_reply_size(const struct ethnl_req_info *req_base, int len = 0; int ret; - BUILD_BUG_ON(sizeof(eee->advertised_u32) * BITS_PER_BYTE != - EEE_MODES_COUNT); - BUILD_BUG_ON(sizeof(eee->lp_advertised_u32) * BITS_PER_BYTE != - EEE_MODES_COUNT); - /* MODES_OURS */ ret = ethnl_bitset_size(eee->advertised, eee->supported, __ETHTOOL_LINK_MODE_MASK_NBITS, @@ -154,16 +137,10 @@ ethnl_set_eee(struct ethnl_req_info *req_info, struct genl_info *info) if (ret < 0) return ret; - if (ethtool_eee_use_linkmodes(&eee)) { - ret = ethnl_update_bitset(eee.advertised, - __ETHTOOL_LINK_MODE_MASK_NBITS, - tb[ETHTOOL_A_EEE_MODES_OURS], - link_mode_names, info->extack, &mod); - } else { - ret = ethnl_update_bitset32(&eee.advertised_u32, EEE_MODES_COUNT, - tb[ETHTOOL_A_EEE_MODES_OURS], - link_mode_names, info->extack, &mod); - } + ret = ethnl_update_bitset(eee.advertised, + __ETHTOOL_LINK_MODE_MASK_NBITS, + tb[ETHTOOL_A_EEE_MODES_OURS], + link_mode_names, info->extack, &mod); if (ret < 0) return ret; ethnl_update_bool(&eee.eee_enabled, tb[ETHTOOL_A_EEE_ENABLED], &mod); diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 1763e8b697e1..5464f237d8dd 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -1513,9 +1513,6 @@ static void eee_to_keee(struct ethtool_keee *keee, { memset(keee, 0, sizeof(*keee)); - keee->supported_u32 = eee->supported; - keee->advertised_u32 = eee->advertised; - keee->lp_advertised_u32 = eee->lp_advertised; keee->eee_active = eee->eee_active; keee->eee_enabled = eee->eee_enabled; keee->tx_lpi_enabled = eee->tx_lpi_enabled; @@ -1532,6 +1529,8 @@ static void eee_to_keee(struct ethtool_keee *keee, static void keee_to_eee(struct ethtool_eee *eee, const struct ethtool_keee *keee) { + bool overflow; + memset(eee, 0, sizeof(*eee)); eee->eee_active = keee->eee_active; @@ -1539,22 +1538,14 @@ static void keee_to_eee(struct ethtool_eee *eee, eee->tx_lpi_enabled = keee->tx_lpi_enabled; eee->tx_lpi_timer = keee->tx_lpi_timer; - if (ethtool_eee_use_linkmodes(keee)) { - bool overflow; - - overflow = !ethtool_convert_link_mode_to_legacy_u32(&eee->supported, - keee->supported); - ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, - keee->advertised); - ethtool_convert_link_mode_to_legacy_u32(&eee->lp_advertised, - keee->lp_advertised); - if (overflow) - pr_warn("Ethtool ioctl interface doesn't support passing EEE linkmodes beyond bit 32\n"); - } else { - eee->supported = keee->supported_u32; - eee->advertised = keee->advertised_u32; - eee->lp_advertised = keee->lp_advertised_u32; - } + overflow = !ethtool_convert_link_mode_to_legacy_u32(&eee->supported, + keee->supported); + ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, + keee->advertised); + ethtool_convert_link_mode_to_legacy_u32(&eee->lp_advertised, + keee->lp_advertised); + if (overflow) + pr_warn("Ethtool ioctl interface doesn't support passing EEE linkmodes beyond bit 32\n"); } static int ethtool_get_eee(struct net_device *dev, char __user *useraddr)