From patchwork Wed Feb 14 23:13:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13557174 X-Patchwork-Delegate: kuba@kernel.org 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 54F3513F008; Wed, 14 Feb 2024 23:14:01 +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=1707952445; cv=none; b=PAa4BgPpOQ6a5Vv25Szp7k2fwBlPSullYdSdv2aPg6m5hw4PUA+jCHjnBukq6ZUuCoqcYTVX8hnii76XJnGoaUDEC7zERh9IBwQYdf0FMB2UNgoe+N5BOtLP+3qU8ADg+3Hryem9hbJlVcQXRk2SQqQojopbNrNaojy0+5BAc8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952445; c=relaxed/simple; bh=F0mfdZrj/FgaIdcQuHDCEsazFz0S4bAcsGtKqN8CFVA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rOkCNVGJp+GiWZYaGesJPcAaCLylKupCiJZOU7rCOGEMGbB2yK+LAYyj9tmLmSdvXLmjXy3xMwJ5AQkcT7wD2BHO9pIMbcfqwTcSfomG7w4ikACTAQDQAyExoLY++GH+r3XYHPU2L5Sf60g4parJHZ1BKBSdQVY+FGgVYQ/1lXc= 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=uP0qoXg4; 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="uP0qoXg4" 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=cy2kGO2U2TPr1pnz3CApIMBYaE8Xib0u+l8VUL1Ic70=; b=uP 0qoXg4dx5oMZc0Iv6uyhdgoe9Ru9lQnFBArmstvh6Ryh545tHEHsdaY3ugqKteu7Y1IOCXWMp9rgO GgdqlDrQ6q11AmTyzf0j5+alk0NHrVjEKz5z73x5x+bXLrUNPYPLNS194Z6nFiWY9Pa40aG/QSQYy 6fYdFNkbXS9dGmU=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOS0-007pqx-Dd; Thu, 15 Feb 2024 00:14:00 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:18 -0600 Subject: [PATCH net-next v2 1/8] net: usb: r8152: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-keee-u32-cleanup-v2-1-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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=3506; i=andrew@lunn.ch; h=from:subject:message-id; bh=F0mfdZrj/FgaIdcQuHDCEsazFz0S4bAcsGtKqN8CFVA=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBlzUkjfDOiT7wmdGuQ6MHVBZSDeJjy+AriB0xgA Q20DCz14HaJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JIwAKCRDmvw3LpmlM hC+QD/41sRM9msf8/LaoNjawjEnqaKsUrkZRMAvhFdGWnakR1s85yBU4WSovRcxZgqZcvQpT5Uz t/lrAFTqQmkF+hwXQfIO70vA7rMKPQlwYHwo9LeCjPDLzToxyS/Ra0X7IL4B1xL4QkF6Ur64AlG lULMuLf+N4ZLMAOS49qCoy4hGhF0SYABPcNWPUisiTIB5DVCUfLXjftf4N920mW4S2bujFV2tHm PLaK+OPgTS+KQC+h8QT/2NtGOeQYkXmTXOt1+hTe2ub1l10aaK0+g9aXZ/43OJ4to5IPmVlFb9f W5+bd1Ty90uUqbRJgtAYWI8g3g3HNIRUCa+ULq6gupZjpiI6TT02lOKzIxE0J5ZWjz5jRm5+C3c yQ/iwHjvbYEtIdDVB3K+QRFuqMbZQ7c6soKqXblCCsUq/P/eIa0WInxJLiBy5Dm//ULswC9eoIn ouOtWo8WmLFtiHNXTUk6Ir1u0qhKxNniIdGuo4/5Aq/itlC0VNEuiDobO+m6GTo/Y1IbSeFjK8c r4JxtIvEirQgNc+Jab0LMkkztvc2uzi8JOcxbEn/mhYmc2iXI6cfZsOf5HTiWfTXI79VUnTJAKe sDO2P4elnZ6tOVyWiYqp0xRrS/mLpyTSNyFxMHt8Q2vMEGb6uVYqmFdPgwn3FtcoSyDXDH+yV0a GBSR1XKBtcAxH+A== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-Patchwork-Delegate: kuba@kernel.org 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 --- drivers/net/usb/Kconfig | 1 + drivers/net/usb/r8152.c | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 16 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..fa5e9b7f3bb4 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,23 +8925,22 @@ 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; } @@ -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 Wed Feb 14 23:13:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13557173 X-Patchwork-Delegate: kuba@kernel.org 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 96CA68662D; Wed, 14 Feb 2024 23:14:02 +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=1707952444; cv=none; b=pTDRFHkih9ch9ql+gDcMvAJugZH4K7K0muGDbWN3LEVoKvpHRU7QEeO1coIbO/nOCkWkwEYSoNN55Tpy51/lVsE2e8yq6u5Bhvcb9OLdeP7ymIV/7Rh/uURPIGbjAzMTvJZ5busFHe5meElnRdGDqhcuKSSPkHl5keIrjoc/gy0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952444; c=relaxed/simple; bh=Cpjch1b1D9Jp2vWORWgwbDnErRScd5QZqvv0qT6yMzg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GJFPHdY45EVHKi2h0NAfgn/nNKAa6eE0vmVsEhcyz+w+AfKJlDq2avYRW0FB86Nl8CDnQ27QYkDjORyDTlRi9ZIbs7NHobL+sboWBSn3oxeqiv0TmVWhzbcKGAym+WmxbV0QVEdgptQv3IVvRUszX2sMpM2rcVZkyTPosVmdBRE= 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=EcmZlUX1; 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="EcmZlUX1" 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=Ec mZlUX1UNq6CGMMG95w8sPC14i27KZlqTSZGKA57NsJlVIjQ9FwBDhHwxtaz0l7cr9Rq8uq8kM0WZ3 92UOvFqNHTCZ4SfH3RNOO5NPv6bFmkB0tAfrilrUSTg7Va5DRXNIWvPu2njlgshDVWGx3ylPCQDkf BsYBfLxCM0LqDK8=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOS3-007pqx-Ma; Thu, 15 Feb 2024 00:14:03 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:19 -0600 Subject: [PATCH net-next v2 2/8] net: usb: ax88179_178a: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-keee-u32-cleanup-v2-2-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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/DcumaUyEAcsmYgBlzUkjg41ZWDOkDbY4cl40Mp4plWC8lPr7urE1Y xR07ZdFiaeJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JIwAKCRDmvw3LpmlM hN6FD/9iVloxbhIqi9a5XdLaZHPNJhtehuPbEtTJcduK9CjOBQJo3/YJ61KGd5GbWhYvcbJUM3p 4ORL4n3zpsPJLCUpmyb5AaBpHGVpl2jVow+BXmYTq3ak0SAFy6sZEE9jH5csHzwd3VLbG4Aaxey YCYCdG/Lev2aCsILsqNXLSVlW4pe6bx8qGmhulchBIj6VfjJfbWJjC1DiIRtuUKvQ9SFLm27TvB sQTf6/jPPT4O2AlgHq+DtIie2a16S0KezI75fuNiBzY2g5/uefVcHq9H++6tAKo6D8ySCG/lP5f NVpTZA0/7h8yDd70FNNOxb89bjpEnWUlJrE/bS8ujD3LU83Ii02+e4z7jrwTCnhc6HeiByrWMVm soxaZ/7BEhvn0D3tQEwjRrQyWizBT6Q1P2M1pAGPq1rVPoqC206dBW7YdZ2Gx60O94+NACvUvYE DmJZ6yE07Xfnec7nQKx44bqjfO1Z5ciykD7+m8QlfJ3hGgaS6B5raS1q5t3qP8NnHU/4JMNvp72 R2vojGJspg8mEglMV6ZY5zzHE39B02NfEPQTqBGz9k+dgO7TtfTVADuCnO8AzvUAoYuvC1fwht0 2rVfbJluv7EynpimelGOXDCkEURXHWnmD9calR7xXpQmbKJs5ol+gtF0Th+v4CSxDiAxBVrl0pQ T0gvmhUd+Tq087w== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-Patchwork-Delegate: kuba@kernel.org 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 Wed Feb 14 23:13:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13557175 X-Patchwork-Delegate: kuba@kernel.org 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 EEFCF145332; Wed, 14 Feb 2024 23:14:05 +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=1707952448; cv=none; b=GWFhL2SPy6ijQLIfiQsJ/M80VK88O8wvZopKjMcXnI9FOMYRD/fEbG/GgF7jnRCbg5L7OloApnBqFwC66RF+4rchC+R8aClYCkAUPDf+Bx/aQglPOt9NsAIf1OMvJQvsH+4N4HD5mhMyzy+75s75HkmpF5P+sMgy8naztQCOJgU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952448; c=relaxed/simple; bh=w1DJYkt9FTZRnNhfN8ZM1D8JVVgGCSqPVVQnR9uVLaE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fx8hYuOy5QMxA0F3mCDCbjmij1mR8grD0PqxvFzdEatsLCEX7+tc9mBjIN8A3HGI8p5jqRuwqLpuReCyuDN6Oubl7SsuEI9awQoFAtH8g4VEHInM4BZqo4DdYsEkblcQDAAbd9OzyX39eYEGmQHwbgmuZsANFaz9GvrWz2D4Mcg= 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=dIqo28Ti; 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="dIqo28Ti" 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=dI qo28TiVHsgnDlCbxnh68GM9Zatv6Sci78O0cUQy2nNvNRJOu5GGXgTmeiJKd69Fww1IFBXthHNpmz fjyLfZZFSh8TxB81ZUS+W3CXRgHnT7FQfuKn5nxjlKu/Ajmv7gKP8cdBUvoBLcSl8KsWovh3sMxtq sVaH3tsLT1XzcVs=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOS6-007pqx-Vb; Thu, 15 Feb 2024 00:14:07 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:20 -0600 Subject: [PATCH net-next v2 3/8] net: qlogic: qede: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-keee-u32-cleanup-v2-3-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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/DcumaUyEAcsmYgBlzUkkII+d18nk9TsjScFtFJDnDHC6I2nLalnU0 zBCp3NJkTuJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JJAAKCRDmvw3LpmlM hGTQD/9padJ5okLCRydr6Wbzfdd810RJWCKYWF+vx0xycV5WdEaNoKa4AHigiBEcpnhS1umpB4z CfmZyHOVZVBsYgwiqPqFRFNCtqx3XPXfgt7eifpr7kN6M/kji/gIL3YI04Ju0oyjQ6CkDnQYOlD jVdef55dc8kgI9wPxPNEk7a37qKr8r+ZKO5ZpFmE82yYuFrzMbJtKsynd/H0LD7h9COt3n2o30a NfoSQRbwMV0/9tJrOapAQprbL2YnI6kzfCumMH1zpG0fLk95JTIt0k5pVTp4bNAdhg/bYqQwIy4 dNDtEuClGKFfKTCYAr0w8BsbaefFGqvEkq/4Q/fyV1Q17misQdDgzN2Fm+GRVg5oe3S/4icgjOX XbbAz6J+W7t19mmLieCTLgkmfO6rjX0cYIeV0d3o150D5EtIGWpVtdw/0Qe2fgQUWWV1WCxO5/e JSB5MPGuUySE+h1TyrudJIWM/Aa4FySmQXmDReesi1T1HoYhhNLW13rIOL15o2nctnjO8TcK+nW kK/TdzZf+cKUImzxMcSSKvl598E/EByvVC6/2xOHz4ZV6ymtdlerJPplgVrmh0y3ISeCmI7VMWx 8iiFSRigWoKJe+y+JubyjJfGhzIqPqVTgo/fjB8zUmTZ94AUXas9L1gagTP7vhWySqZN5dY7Zj2 m9KMHVuknOrgKOA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-Patchwork-Delegate: kuba@kernel.org 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 --- 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 Wed Feb 14 23:13:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13557176 X-Patchwork-Delegate: kuba@kernel.org 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 93766145B18; Wed, 14 Feb 2024 23:14:08 +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=1707952450; cv=none; b=KRn74UQgUeWE/Z2edL2FYs5QPJd2l7tLro8WIwVEomK3BlBhoSKU98V9Jpw4h/HpuFH/h1oDz8AyfuqSupZLuuNBEQsyY3IgMojdjpdFdAJbKSiinH6Hq1kn6p8qruBYrPiY760D82xX2XLMNCPQZo7DPxjUjSYDNw1swhS1oM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952450; 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=ARkK3Z+QcvSuvFkcqAVjHZoURfZrSsXG76KCkjvx/Sm+ik6bFcawvaVfatQtxpuNLtYiQYy95PCwBwj82eTeOyLhwUzl7S8+G6Qud7HUGRkYx2Nuzxa1Di97JSWUPogHLiZw/5LLggZznm6JxjmlBAwlsFiPY9Ps8IM7cfXshSY= 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=zemVsAkM; 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="zemVsAkM" 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=ze mVsAkM42tVnaeAhCmEdTmT2utCzw4dvfivzVxx4c2xvMHO+8FgMraPMDso2wUwPxcJUPkP6+uRyll 0OIoF1ofJTFP+S4XNtQP+oyY45oUwuvdspzd4LynSj/K82Zt5NPtfHoIgOJCiWJ92VOiBsuJh6G6T GiauQ6Vi4ve5CJY=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOSA-007pqx-Be; Thu, 15 Feb 2024 00:14:10 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:21 -0600 Subject: [PATCH net-next v2 4/8] net: ethernet: ixgbe: Convert EEE to use linkmodes Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-keee-u32-cleanup-v2-4-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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/DcumaUyEAcsmYgBlzUkkpnErWegm/hSZ07cibEcmZhVFuZh0VmzwH yKKGsm+iR2JAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JJAAKCRDmvw3LpmlM hPNGEADaErtOXgBoRPoBdcW946pa6SsqV7GkF3amERUOi2by2ZZL0a1l/DKUy21dxJk3Jqhqdvy xQz9ytLj+BoSQ3pkP6boKqTEc2h66Xft9MJkn0WEDlrh4hv1gDDvrEG+r2oqpS3BzIRQ6HDv+UI Onxye18e5AYhM1TLl3M3zqsj/rP2AV60tCmGxfiKpmnNfeXQoDsAzjTgR6ddqUYJk94wOS38BAc IqD9WYERvj+MCPjTO9cYFxZR8MWFExDwFtsH4viE0yiMnrczZuMqAqixzlsj0TJAY4qLzpaNQA3 1z/Dtms7OWjPPXtxtg+Bqzi86K0eRMetNz4tsZG7qmdRcKu7jfFw3rTvIgtYQTJ6Hhv4IKkkJ64 +aVN+ejcgnpltjq19ACrig2Bo1L64ZT+JI0JohbW9PUfChB/qiZjyv1SuoKz6hgWijv7FSKFJ9C 9D5jkZBKWR/UYThQmztZWcOK9D0knyi7bsZ1TzA2uYpHcrAcmBcWzyZxWFJSi0xmfMJsZp757Es aEhfMHpzsrYeB5Z/Vp1X96EtjSazjo+F7edCYXeB2PeZPrW9PcSMAcZLmDH7HJDyCnvKyXNBUKB tEdCJsGDQeekrpQ3uXW5BBf/JuQidxQGztguFJD4XTTaxMB7DisHH0X1iK72TdMT03lOlcb9Jjo WWWpe3OcHwTsCiA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-Patchwork-Delegate: kuba@kernel.org 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 Wed Feb 14 23:13:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13557177 X-Patchwork-Delegate: kuba@kernel.org 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 7F19F145FF3; Wed, 14 Feb 2024 23:14:11 +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=1707952453; cv=none; b=OkX/nqt8tJhGzU1f4qjoLfKjZG7HWzVpr0iZ34uJVWYCRGiB08fydIwlsKL/YTVSfTqTOg6mRmOOqx2VmlxoP2Cw/V5Y8ZyDErLmfMhHiBYDjCLjCMn1LA54ZKLstymT37AvZXAvWL6S1OYnP1+dvjJbYsumng02UnGkAcU2xFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952453; c=relaxed/simple; bh=9+M44JGWsDWJYIbg9x3Eie/quc/6CSKv3btaL1mRVk8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mK9++Vr8qwFZuwCS1NtY2iEMV1qgaaSOV9Gip6Q5bHe3156UPnbr0XzQKCQWluywXjMwPbsyXfL8qRzezyIG5osgbK+GAdL6EDHI5bjMFCvGM+cfhYG2iSP6U5a4DvQJPbQx8hB/EYl/5FjKu6ROv4UgyTCuelMD3OYPH1kQb9o= 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=nYISlLWx; 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="nYISlLWx" 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=49iqTWfS/7oGaeehgWp7vgxQU4YHET0VID5+MapWGoc=; b=nY ISlLWxsAC6LYs872WEaIwPQGL6ohm+NGpCk3V02m6hb0+iElzuP54/oahiBRVEUL7KKFXZuFtrc2M D8kJcxZzzgKydkEWgg79f2HdeA4AKHCNCGypqZe+IKjmZCOh6RqhKgAlsU50/sSMdL0dHazSyM4Sn PFgbk8YgbySfDD4=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOSD-007pqx-KV; Thu, 15 Feb 2024 00:14:13 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:22 -0600 Subject: [PATCH net-next v2 5/8] net: intel: i40e/igc: Remove setting Autoneg in EEE capabilities Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-keee-u32-cleanup-v2-5-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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=2657; i=andrew@lunn.ch; h=from:subject:message-id; bh=9+M44JGWsDWJYIbg9x3Eie/quc/6CSKv3btaL1mRVk8=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBlzUkk+rR68hA2G2PyV777v/AUcs9UNwvnxswYZ A2Rl6AaeMqJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JJAAKCRDmvw3LpmlM hKLQD/9T1pxSQXqLaiLLzt97eAe5eh4P4BlIJxZg5HlocwxaIeSSoaLGERNr/OWaT4TIKyGRSh/ lZirct/22D1jAULjbl9oYWmQB9d8OOy9gXWKqp/80sCszIHwXJI0X6918X1bNsl2A390Wil7wSa 2Ooi2TvFjVLveS7RDsggmbplfNeKdLQp7VmCWB38g9F4PmF2dh2EjSYX4d925lVwUt3kvXvI53G WlCNpJsZpt3VELBsJacfYDoYaFXhOAvXUwl/XnFVw9effCslhGDxGhKYKWZP88rBRDTN/P7iDyy dqQCRdgKqSbSDErdgHgrL87BCuf7zi7y4l0zb3g3L6Qk08AwkOh3Ct0cvm8DBFdisvtfFj09z37 Peh4XLIPMRS9PbHiJUaus/LEim9eNkNZevLOEYG6RsRp0IoRrodKhGdFkNXh1RfC3oJJJPtxLXn rSz1K4nqFO9X2g9Yq7XZ/kEKTaajs7Ec3GQ/8Iaea/5V67HwgD2LA+bBCZfMhxOLJXiomLSrPJK qfqXSwBLPmKiU0iKISe9X5QNeHE9bi0u8LhwP7vHzR09cW7z/f+jH8pL0MeLxLRv3bdcmP6mzOp 1UfSIvRKDjhnDyDCo+K4F925AKdrHB7XI0w57CqJZIGR1n8aGJp4OjbBgnlQ1Op0SQolefAhA1l TWVacQfReSV1M4A== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-Patchwork-Delegate: kuba@kernel.org 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. Signed-off-by: Andrew Lunn Reviewed-by: Jacob Keller --- 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 Wed Feb 14 23:13:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13557178 X-Patchwork-Delegate: kuba@kernel.org 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 CD9311468F0; Wed, 14 Feb 2024 23:14:15 +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=1707952457; cv=none; b=atVTJ5YZnhy3aaeeT7tip7rY9VCvV8j9UJn4TbmfufsrlLRrjWtuqsVYddbKN6cXVa9CGUNLdnUwef4jLWYN5N0a19G7KNZmms/zFcba2UIfb8LcKJrACVYtOalp5bBsMDqrCBTR2RcS179jfsGaobsjN3Ee7iZLRWLvf8eDo50= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952457; c=relaxed/simple; bh=nLsygJVJCduLk95szsdKOpEa7GzGsR0GfRGWNH5oTU4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=G3QwPGIuS8n+9/hn5CkDjXgb/8iPrd+DNw6KM9KG75OtH08RMn43LNG22emFwd+TVmFGkT5wNE56xQyMX6wR0ADrWfRWjUH2bz15izKyxdc7zVgR3lZUZElCAU3EBbgn4wVXqL8d0wyjZCGSFDHKdmgodfqx1mSHYzj1KaLB70A= 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=RUUb3Myx; 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="RUUb3Myx" 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=RU Ub3MyxHW0OHnH2+JYo4k9foRknGy5oKWm0apnay6fyshEe7Y86ypbdPNMO/j/U2E3/2kAd72ZnFya 6iLKJIRn2MqU8Hm0ZwOAA0CaLYoUENL0w9TCzLEGz+n8VGvPtI754yU7J5Sv3UGM/mxXL1DQvow5e vxgLUpohAcI7wD8=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOSG-007pqx-TN; Thu, 15 Feb 2024 00:14:17 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:23 -0600 Subject: [PATCH net-next v2 6/8] net: intel: e1000e: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-keee-u32-cleanup-v2-6-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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/DcumaUyEAcsmYgBlzUklucfkw4BIxR2M2JoZU1CZik7uA1zJsjtcw dtVu/ZqVcuJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JJQAKCRDmvw3LpmlM hJQqD/4iP8C+aiskVBclRtSTU9R6l288uCkWHl3gTi1cKG8A6dyYIgaAqcZNT9X5I7V6SM7yVnO 06pGErLm1KP3RDoiDtHd/Ao9XJ9hAcnD13YSdxKT0ymNSZ4xePQij/mGtZkJ2RoiqIqTgzBirne lwdDxzGgStv3OaZPdmxHnqq9r+dBX7zG4FGR3I33DBGkgwasWYbDKRbHVYxBc3rw5Tc3pskN2lx Wfl7vH6L14U+F4QZ6wXERHtN3WZl9JQWgMDLzgM/DwTckwGOtWShMObkU1Wr6KCQ1u8V24TlR55 MZ++jUcjCvpCcQXrQDGMeUdkQ5XhspK82eHzCB4QjOtgRssMyJX824yFk+kikq2gHL3wS0cwFsb OUXI969Wu/mctH7xc9+65hen1X1W2zAp5g1n9dell/PJ0gkUrFegF+qWks6cEdqhR5blVxZFc0U qysb4EejFzNWRmfXl9NbjcJ1HnRA/eG1kNksSIYXlGu3iD9HjfPrIw2u+hIiZD4PNoDUYHqgPV/ wXtT+h2XkJYzqJwkXI1txBW+2yGpHY9PQn1AyHH0jYhSNVGhe8mDn/n28BIxft2itNaVoC0VpUK dQkFYoIT6FTdAHvK/YAYUikQPlmHvqjlWxh9NEa+UWpzQAuBkdd6HaNEyEbT4M1X96wsnVB6Owo FdmUbmcDA0cGpCA== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-Patchwork-Delegate: kuba@kernel.org 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/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 Wed Feb 14 23:13:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13557179 X-Patchwork-Delegate: kuba@kernel.org 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 EFC26146910; Wed, 14 Feb 2024 23:14:18 +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=1707952460; cv=none; b=CkITx/o7x88BRKo/4X3d4ah4HCYzUC3qdtxqewDKzPlSEzum1iRLsjzjoexgHEvX5HQfW+VQ1pc+nKbvwDQggQBIm2/8HwNs/cXuB+xmu++tCbxTEsLjutu4myBi5V3wEA41N2QHysVWO3/Ea5YbB26MTf4dR48eg6fNB1zHKKU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952460; c=relaxed/simple; bh=JAaXmFLPL7MF52z7W5bakKctdf1rOc6D32Y12paOGJs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FdXeUYkBmIHbOnoQy39C/ZvgJvkMUuNjZWK1cGTeiYpZniFK0U2drXNRyi5H8VzW9r1ofpHRK/GA9UBbFOos7MDjyDiJwTTgotb2ZeC353EshqC12RSXAwfcKBaNmFgnJyq6aILA23+jEdNZjY8esrrdH2poUp650JkvVwC18zc= 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=yYvr0HZB; 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="yYvr0HZB" 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=4VBrx1qM6Gzjf/dZj0JHXBU4KIuERNSMCLhowQQxEkc=; b=yY vr0HZBqvrauJsxjToICtsqe65J5iyJVMVOpkM0HE6Q18WSpF3X0KcTW6LdKQeEwd97UksOlIuIA3i lI4zlN82bM2oB5fqSDLrIrTWCPdkJWOEkhM6O153yRL0AUUYmY+WBZC2wpyXCC45iJtkyUgOsTliX up/XhO4uqpS2tSk=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOSK-007pqx-65; Thu, 15 Feb 2024 00:14:20 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:24 -0600 Subject: [PATCH net-next v2 7/8] net: intel: igb: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-keee-u32-cleanup-v2-7-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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=3793; i=andrew@lunn.ch; h=from:subject:message-id; bh=JAaXmFLPL7MF52z7W5bakKctdf1rOc6D32Y12paOGJs=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBlzUkl6bCIJsuq7uQBOYjilp8H2Mc3zzEENWGYb MCFQq2u2xaJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JJQAKCRDmvw3LpmlM hMUzD/4pN42aAVrMi68wrLcT4Yavlv/tqf6KXGJhjQAiOJQUeR/4OGZInc1i2zK4vJuZipO9xIm 0ZadbJHSZ09NML3NPztSN0ShX/BLW8p7EW3y9kur4/+j+zoPQ2H2vlkL0KOAoMEXouADNM4Z8N0 daiRGodsxguANENju/n8NP58WtOkLTwnZ1yjtlxvFgPrGSMb3zThyf6KZQq3xqF2bgzTJsmK6YE sQehiGAhUMyA5VQqTlS2pZ4BYa5c9qJvgmrCJSOgwdL5wffKGqpFlxdz/nOrLutVZ253xM3NzkU eohPeP85zU9bfBt+l55P35oEm/52xLFwxF8e2e+r5ES3MncE5TfNWdLh7X9r6E9UcdrXywHRLo3 BAfDlG6v6tCAP7hlFTLBQzRUkhfJ1e7RV9u8Xgtn7W0t4JXHjvsQYt6eESkiTDTqXbMyEBE6c3g SjlahGsXzmlYMAWt+i9U/cYHIbifW089bGhCmbqsA7Ya2TCJyb33ZGwn8IWLEh4+vXOljdewW1/ a0NrTuk41WViJ9wj2h8gM/nl5BbT79sWa2nQSsnQDFwdmxJ0Bv3k3RwZ+20DpJafFCbZhp8ouaS 9GzTx2GWRXdNDoe3Fv52tyO37UERPptmt6zT2wGrtiNluF+pUVhqJL3E66XLQRZo6xE/YzxM18g TAF01T6FlbQaZqg== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-Patchwork-Delegate: kuba@kernel.org 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/ethernet/intel/igb/igb_ethtool.c | 33 ++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c index b87b23d2151c..5da50574a28c 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: @@ -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 Wed Feb 14 23:13:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13557180 X-Patchwork-Delegate: kuba@kernel.org 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 DC696250F6; Wed, 14 Feb 2024 23:14: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=1707952474; cv=none; b=nv2MJhMd9zgzQZtFYHHGyuDl7nSKaSImE9/7Wn2SQaEngwA27BKqAjg9FkFoN2YuRZ/1aG3H2l+Ro/zOm1vGHA5Mlnjw9Pvz7GgeE8PoH4SJ7tuqwTT8KiAlR5tR5EAP0ElMZEPxvesLEDZEYbeB6u9yWKTSTx/7+ezk404LpVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707952474; c=relaxed/simple; bh=JUBlNHQ9KEInXfv/Ts82d6LWLEYOujFvKhAve8sOAdY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mXkHEeDPZPWuiSw00XBrIWfbJxVaZ165Aw35Fex/jrft4JoT/9dcobI31tzBO/2SopNFWH6XTCZiP9RkzslwdkjGZrGgEU64fr+bNJsxAahURStpBoK0nbXlRGlHvVBbqm4/8pET2ecMqCMvrF88VwSuPLOc/v4pKqq50zWY2Uc= 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=KTKfCbqz; 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="KTKfCbqz" 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=KT KfCbqzHMlot+Qw4VoK7sWzsR5eTkkxy5tkQyuR836xwuSc8UenUGk1NAo3ocYCvRF3J2LZrUOm+zW o9JCPCeth3907YcUiVNDjKnk5Hgl3JtsqUG0RIBr0w2QeUiTwrqJjxgAX5wr68pBYWr4Sl8An2U9s jE8NNWhAtTtyv5U=; Received: from c-76-156-77-114.hsd1.mn.comcast.net ([76.156.77.114] 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 1raOSN-007pqx-IF; Thu, 15 Feb 2024 00:14:23 +0100 From: Andrew Lunn Date: Wed, 14 Feb 2024 17:13:25 -0600 Subject: [PATCH net-next v2 8/8] net: intel: igc: Use linkmode helpers for EEE Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-keee-u32-cleanup-v2-8-4ac534b83d66@lunn.ch> References: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@lunn.ch> In-Reply-To: <20240214-keee-u32-cleanup-v2-0-4ac534b83d66@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/DcumaUyEAcsmYgBlzUklKe7j/H8r+mEvYMjo5M5wQh5Gdw3q5KAH6 L4whiI972WJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZc1JJQAKCRDmvw3LpmlM hM1xD/4lxlo53phEXX7A+P7upo21SlhwgWCNZMC87FoevHKp68+yAODJhTyHVO3yo4u23qG+2+3 wNMfeQuHGf3WU3WLoZI19M3MXvOvpaRuORsWD2dQE7RfWyTc96Y/+6nFRTJkHuPAF28DdbPT7dg du/5w20lBhkS6IP0IcJP0HBrdVysT45EHnfEBd+94BWl3V8ObTcboi3LOswuQzqUGcl/ODndHmc LRWGNt10pa4KnGYVN01LcghbfJxPWqf5WQeIPtIQew1+kCwkA/wtWRuDzG7qwrdVUXi+08sZfnz 9U1SrZQT+bgCaUC07pmkLMhvmIJMgppqgNHPNcRhuw6d8bkLLsVIquS0OAScGxlaIQBzzP56I7y 3PaphJ2FTOeNzVVbzpudFftXfa2y/7dJhiTVwajYimZ3sYTkOyTdhEuS+nJwLHVCBkNUN3MVOyc A59iMSl8qVyEZm5x+7/zrqcN17CEIiXkQQcnc1F94IvhUpj86R2WdsVKoMl0KJq3GAAe3D9YhAK ClQLSYI5P5Ld4msk2tuDKc8SAddHjnGNYrsjDuw7njYUNbzVuQjyiuBSvfrKClGVtFSRuJ7+YFM ARcRM8h671nefDkpmgYUmaE1ltPGHsWXymsy8Zbs1lVSOP98rMbc3wVr3pVFgmBsrzFZKYguQV8 qIgXgkNp3fpbajw== X-Developer-Key: i=andrew@lunn.ch; a=openpgp; fpr=61FB1025CB53263916F9E1B7E6BF0DCBA6694C84 X-Patchwork-Delegate: kuba@kernel.org 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/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;