From patchwork Tue Feb 27 01:29:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13573076 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 0EDCC5C96; Tue, 27 Feb 2024 01:29: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=1708997387; cv=none; b=mmNDfAwhdApmqBN45J9bZSPbFvhGTOnChQwYsga/66Td/ICsXrb3+63SP/D/F94OwcEtxGkWh873q8MBDHV+2NpLsZ0Osa/T79PQrxYWlHnJt/RkN6GvGVgaS7JjYOBA/2v9kA0Q3FPKSLFtOuxB8cBPuphwIjhTcf8uBAOzmOY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708997387; c=relaxed/simple; bh=n7KfKlNsBYdc2g7FNM0n6Q/PGUf1/ncJ+o7X6b7qkV0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PYylP8j4tQS1enP/uvh7sPzvVPzK43CEj6jXGICHcL8NnQzh3ztdfGOGuyvFF2J/JPRd0nBBSGUEAtM4Lri0BvzirtCCjNZtkgMPxoDHHpGi4pFWIjRn3F/gJMIirHve821dxeSKEXwbjX9yOaYJ9ajEMaQgBbG10waRCHbrrcI= 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=Swerx0G6; 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="Swerx0G6" 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=zpy9vbBSw1Tk3nbAyfJ7JT6iwuk27LQXKHWZXYNnPtQ=; b=Sw erx0G6JfQ3aYVj5RFtMpyGbT27JcvCaw/nw+ACk23xn9Jh4RgYEwzUyNwIRIpROspmgUcl855jiSg 5h1xSHtva7ASt7UsFu6wNiWQ6ioPrE6EOwwgVmfUCG3aLxwT20GlwPgXaDErKCgx/+N0hB+QKK7Aw 8T68kB9ZdpQWJcU=; 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 1remI5-008mef-0w; Tue, 27 Feb 2024 02:29:53 +0100 From: Andrew Lunn Date: Mon, 26 Feb 2024 19:29:07 -0600 Subject: [PATCH net-next v5 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: <20240226-keee-u32-cleanup-v5-1-9e7323c41c38@lunn.ch> References: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@lunn.ch> In-Reply-To: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@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 , Simon Horman X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3813; i=andrew@lunn.ch; h=from:subject:message-id; bh=n7KfKlNsBYdc2g7FNM0n6Q/PGUf1/ncJ+o7X6b7qkV0=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl3Tr1xHyCpzaQdb/ipZ49qz9WLcw33+M7s8v0p TsSq7zXhFyJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZd069QAKCRDmvw3LpmlM hG81D/46mRrR59p9YrJI2LJuGQ32YqfFXObTrgKuhlO0xKCMp9VKuUfNMn/vok/u0iBOa3rg4vy 04iMZBuxpZEXB1Na8LijP5GFzTX0hSvuIM60lh4mYjeNAvN8pxEZyZ3OJRD3ol8jfcnxS03XLju 2vvEGLS/dodcwT2B/VWckjmQ31emxY+4196wLh4P1BOLbP5KMiZfZRNYsk+CUBkt9fKVvUu1Lzd m0LnJUwZMis42gbxSXziWEEqt8UbdHtyltxZ3kruCUN73NsQAMtkrEHcr1KBes5wANNwrEfiPpj pARCelDdI4sxdujTHjwxsKixFTUVS//lanz20ob092628FKK2500Vspmbnp0kT1xmzIbj2uhf9v ytx6BYMu7KNmuKep4qWINiGq+By72JbvaNcpy9wWj4cHdJqueS5YaJ32zp4CQpabskwBrVj6hMK ChX0GMSh2ZxT71XHFdvQBChP5iwd16pC4sFC/765ssXnajIDPlD8AjMu613KjwmahV1OQ6CAk6H 2cmzkuzHTJlxZHgiLANQ/u/G51f/6hQ35ORbbJvZCy+B86b2ZdeqD+fYcjuO4hQGTMhQneH841l waJ5vboYI65ni4uV/uNYDPA6jQnAlgbR0KHoG3UwpCO587AyYkp+qMUvVxEWMo1NWWi6irPo2T8 M7BejpKOv55Kp6w== 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. Reviewed-by: Simon Horman Signed-off-by: Andrew Lunn --- 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 Tue Feb 27 01:29:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13573075 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 0C6A65C8B; Tue, 27 Feb 2024 01:29: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=1708997387; cv=none; b=dh+fucx1ktkEyrxQKffK9jr1aG2b2XVfInbLHpKaP1s1PK+LT7JfpJn2YsereVlO5sbO/vjz9d0mqt2OqTXPTzfqPJcU6tM/2fsd6mUc+kodCRtOxOsSQxkkswEytZwwegdUKe0Wnm0nbpmgKCX+mRi3Ev1oLyfDnQFGVV6iVcY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708997387; c=relaxed/simple; bh=tbNUdk4209inAM5nR1Lk8nxebvhajOxhY6zmxiVGHvA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r1vCEyZV40617jqbQrO++1Lu5VUz8q/6MteKtEj6fcCQ0JsRNWV3pQEGPhH0DGrYRIR0Oec7WGLdHJLDpH9GHy5Jn+COv/zt/TTu3NEoQJdS85gUUDVxKqpiEBc+kDAHy+zWa7ruFfQAqhunETg2UgoqwHV1huTXCIQK4HR8T4k= 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=l7HPmpAV; 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="l7HPmpAV" 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=VVdXr7I14QOocq6jRP2h+Z57I1rBZSPhsTVLK5lp4fE=; b=l7 HPmpAV3g/st4btel2J2b7OMOj+bFAVS5UfLoA6yFZvdsqDFYsA1H6sirNds6e6Olz3UxJsMiNiqg+ SuSACMS24bmkuh3ajEAG3UqGxWIFsgR1uFu5J6tUdNHwApUTT+FmP+AWffQ+KBVV2nAUByVmzbfh4 wkCv3jE/kzsUquI=; 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 1remI8-008mef-9t; Tue, 27 Feb 2024 02:29:56 +0100 From: Andrew Lunn Date: Mon, 26 Feb 2024 19:29:08 -0600 Subject: [PATCH net-next v5 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: <20240226-keee-u32-cleanup-v5-2-9e7323c41c38@lunn.ch> References: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@lunn.ch> In-Reply-To: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@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=2059; i=andrew@lunn.ch; h=from:subject:message-id; bh=tbNUdk4209inAM5nR1Lk8nxebvhajOxhY6zmxiVGHvA=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl3Tr2eIaiGXypoUp9oCQXVEYmyqhvXAb29q12x J15CkgcQJ2JAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZd069gAKCRDmvw3LpmlM hIDzEACLNwNGGNT5das6TnT4sCDrrJeJUjKp7sLWGXNg7h6WkXOOJeemcYcchdHCme/e6ctzPC0 jDH26i8zKkFBpaEoZd+1zBibqgK1TXbYnoXhNOC1brGF6uYaaa1aJW40VIBomWrSHz0oCoxCjax LV/uQrLsIUx3T11YYeYzayFZGRX/uNc/aF1p6yX4+08oE1l81ysqLFLxYLWfh4Az94QB4IDQHhA XUGjQLC+ZcJW55fjsCxY6nJ1vZ+3zDGwmWmp+tged7i2asppgPi9UtSWHRSL+rG96nkgPqfk6+w cQs4sLelJFU2CyI52bgWUzH4waPc5s6dBBbfLFJoC87XczZIny+cmd2ndM61lsppVKEsQ0yblyI Z+xh8WS2B5YFkRwuATTsYUHCULOQWQi2tZZy3qqMQEXQScNX07mqycuZAFYx6IgN/nr3UhBR21I Qmx1pQgoZb66qYGs1QNeNVFeYk1k7GjEoE4i4oKceJule31J8k0k9cWa9heYPlVs9ZAzXm9uBy9 Z0segKuB/v29nWh4cIplBOQlxFUMxlxBV3zvuhAQWqYLhcESq33DBmxhl1+F9MGoYhUNym+erPU YyFNy4Szxf5sorjlNEq7EOgf9ltq0CZpgObBsrPyp1Gfu5LLBXARFMRNB+NgtSsTlpyfTjQhKVD CL1j+Ogk+WwmSkw== 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/usb/ax88179_178a.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index d6168eaa286f..88e084534853 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,7 @@ static int ax88179_reset(struct usbnet *dev) ax88179_disable_eee(dev); ax88179_ethtool_get_eee(dev, &eee_data); - eee_data.advertised_u32 = 0; + linkmode_zero(eee_data.advertised); ax88179_ethtool_set_eee(dev, &eee_data); /* Restart autoneg */ From patchwork Tue Feb 27 01:29:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13573077 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 9D7C8CA6B; Tue, 27 Feb 2024 01:29:47 +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=1708997389; cv=none; b=Q4Ax2Ai8xmdQOvP4pGOWDolNuDWGvfN1Ur5Svly0px4azC8fOiVq5GNqwpdBdY7pXTgrk//Qfmwtsh37pGgsxsbllDL1D4J7a3rC2OBGGR94TYMmHozrGxrLzrzRy9IMd9KfZgH/PXDyfvnHsoI0fpEFHV/q80jwffmjilK79x8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708997389; c=relaxed/simple; bh=fCtThoZRHD+wc3a7N9uHBRhkO5QdG2fpNE4jqVzG/2k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lcCgH664KJHDgxF0dmv36+ZWFsMMetRPU5dJrldqxXVz/MNXvnoyPrSqV3Os+aEjdEPqMTNTVv7HeKMKfMGfXZagT1PxRtZnfmCtElijMnaVOHXs5BBTbeqEIT6BqxNov/T7DNlwCUfcY7qogfV/sFa5hyJ0mUO6jleArw98UFE= 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=qe02hNRj; 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="qe02hNRj" 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=lERX+b3AT2q0QSGG0BM1XWJZtJMmZ3hJB7DS1cgT0BM=; b=qe 02hNRjFAoIo4TGRPmt2zxd1gF8iywmOrUYRQ0uVT+yiQBw1TGabGtAoPymcO639FYBYVb2+YXm4Ba PcRg4IZ8+I66MIIrZxQ6h+SE9pnMc1JIXcLEInM8BNYkXJ1ZEi9n11w7IOlHn+xj09j02B36t3/bR NXOKe6lgfKbqsBQ=; 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 1remIB-008mef-PO; Tue, 27 Feb 2024 02:30:00 +0100 From: Andrew Lunn Date: Mon, 26 Feb 2024 19:29:09 -0600 Subject: [PATCH net-next v5 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: <20240226-keee-u32-cleanup-v5-3-9e7323c41c38@lunn.ch> References: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@lunn.ch> In-Reply-To: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@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 , Simon Horman X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=4476; i=andrew@lunn.ch; h=from:subject:message-id; bh=fCtThoZRHD+wc3a7N9uHBRhkO5QdG2fpNE4jqVzG/2k=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl3Tr216//DHYiTUuP5od8LffVJJ5y12f7LD/iS BvbjdRPWM+JAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZd069gAKCRDmvw3LpmlM hFzfEACgu81+/Q2ZXeNT0d9cJR1M62hFXup59skkANdbyASDGO9xsipT77rQp2memBMi+p+JXTH HeaPoKLnsgb3DWQD3G/OjITaF75+bIJN0/gVscxHvIIEe/0hgvxKMKsFhPE20cphna2rIxnxiQB 8pNMrUg3aBnGbdbswwh74ZtDNdyb/J9WVnea28K5m/3cJKJZPu7tn32RdgjZwgvYee9jcOmr7Nf b2YQKGY1C6jsQ4atcxAcWfxvGrELSifgyVnH2sS1MgvUX4ZA+9iOEWxho7Uwns4MT3Qb71yAlB3 0QMED9oMX0zSouWpTigti4qxddKcSQCx9AKH4f/V1e2m1HtxLy7P4I2gEPwWFQBQf/WxyGSSN79 Qzec9iMxP5bvpjtmNOto5GLkoq719pblS7NOMDWk4K4T7c6bW0ahZPG7z3m0XE47mSt8Vigs2xX 3wLKkI99SGp5HJK9c18i7UHmr/r2sIwDgpqnIRFNxdZFQuS4efFn3Yg19ZEvq7pI25PoDJKzrO2 PIGrnhex8z3dgjIDUQBB75W7QxxT7BCmyJAfQBgWepUqlwkf1MYyVhmg+AAZwgOmNlws6JMxYOo HFHXxAUIJl6BbfAv9Mnf5nxsCk6y+AAB4boVTRgl2MM9Qg5OlRr77fWu6hQRUH70f2qIIYx47AM 153+eylj40KYh6Q== 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. Reviewed-by: Simon Horman 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 Tue Feb 27 01:29:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13573078 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 3C40A38DD0; Tue, 27 Feb 2024 01:29:51 +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=1708997392; cv=none; b=qi8bAzceTQ+n3X9pAk8/rVskNpiIOgzOynGBvKFpgwwsNVTXpXXw2XENWBK068Ue8cwdtcLRIENL8ZInCWqObaIwpg9cGpe5VrpXoxsYlvVbOTnnoB8KeM8ZvRIDWScAAsK4LgcgjFpoMQbY1L0xKx8c+w3bLkEdjVeSHuelzYk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708997392; c=relaxed/simple; bh=qzIAAyMb6AAK3eQo8/dVF48ti1r2Gvyas8/2tpW/GfU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LL7td0SEzAvjjrlTE1+8i2Id9zuq0FKnTvffcbNekX6B6JXrDTBTT+cnDjzNtm36I3TvzH+8szWDBvRcMGdOpLACfj6SIKMJ+PPxxKX0QhlUcnDPW1NCx4pYI2/DFdaw5bJD8om3iLnuFNlCLtmxUfRVroWmPZHM4pSqXowzypM= 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=dz5tPcJ+; 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="dz5tPcJ+" 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=eXN0TkxTJoVreObPklqRaEkAXSE0TTrjDVg+OSjmGR4=; b=dz 5tPcJ+pyQW7JKel436aMGVSltpPEw+UnbCoL9szoDayfTumD5YmzhO+XUZH4HOW5OkkD1NMsaIplM RKqB6iMCCboI3PIpMSyicpHekrMAaKGf10BOty+Hae5TpIDUs01lKkLPWLZtTYWMinQvMROiDqNGp 16AxPvD9UlfOYOs=; 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 1remIF-008mef-2D; Tue, 27 Feb 2024 02:30:03 +0100 From: Andrew Lunn Date: Mon, 26 Feb 2024 19:29:10 -0600 Subject: [PATCH net-next v5 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: <20240226-keee-u32-cleanup-v5-4-9e7323c41c38@lunn.ch> References: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@lunn.ch> In-Reply-To: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@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=4484; i=andrew@lunn.ch; h=from:subject:message-id; bh=qzIAAyMb6AAK3eQo8/dVF48ti1r2Gvyas8/2tpW/GfU=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl3Tr3BJwDkUBmK92VIHTtHj3E3wz1BK/9R57+a BcNSrXHyBSJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZd069wAKCRDmvw3LpmlM hG/eD/9hIFe5zLvOlLrgzrNGpCWwboE5gO5V9JcKHzgeJ3ukI+nzTt1b11E3j+Adh4slEh6U3VB bnrfAO93QzlNXLR/xDleQrFvvtJ8bWdpZ5le4YHM7WXUX0Ma1WbkKDp8syrH+eWXFVsm3z0JbSk WUG2L0FLvVfASRpDJuJooLSfErA9cSbjk5VzbSM+gOYKQBetsLMKAh2B2Xfn/5p4dzEgibNNsfa FXuZBCAmY60hFnY8hssCaz6C80Y5V/HBawcX4/aH26EZhZCg6syDsgmrbrkTJWCUxLEFL368MPK +jH9uRHH+NWkErbtFKJG+yTw6jZAEElnO6NthQLAxP2cOKvjR0IdKdBJrPUAcsabDKOoSX1PKxX l3BU8kSBEtZhoJa+9np/RoNJtvX05HkLkN/Dbe3G2qouMXwRTYx4hw9PFvxqsm+FRTFGyugoQoV M3q26FzKcVLg+E5YKMTAMOcnEhJ9VW7GO48tCjsDqvyruOgPEEeQ/G1YYUm4D4b07dueR51Wq+b jnBCZwJEGZcyiH4GJc5PZSM68F46E4Gv6HJfrCwHchxpbBGRZZfFJnGzWujmaSZrFPNfXn+4Qdo knYrRBosuovqA+7L/lOeDmRZefIaBbL+5wqpkpKyBCgkhOKxagNhfaFIyyXCAiStKB4m5H2mURQ yvlqbuJc74S3luA== 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 Reviewed-by: Simon Horman --- 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..633bac1543dd 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->supported); } - 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 Tue Feb 27 01:29:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13573079 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 1C6294EB46; Tue, 27 Feb 2024 01:29:54 +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=1708997395; cv=none; b=J1rli8rXCApqHwuHgV3rjkVALfXLEcVK2Y3ydR1gbZXtRMZOVzKMELe+4q64QE/N30qVTwcJDApphSHRWHx6AUj5lwDlklE4iRoqvjvTAjxbhYNp2oHHC/ulrSxAJN0/UP0hg698vE7uQGOBdV1ZeZOp9tjOqK36SjtE6h2o494= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708997395; c=relaxed/simple; bh=jBShEoehGOiH3XARbTLV/6y5l6NHG5lC8OunACxocoE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SSEfeQY6XI4qA69t6EvULy1cyvJy5JruBL4ZnbNEe54YNDorvv7cWuDXb05T/IHUueRPkuyEy0C9NQJP7YwJjQfZxIoINZPp567prEQqlxzcZImdvOvhurzKAU2YANdHKa7vqSknJQZXRX91Vla/uUxkpgIgooZDHEm7S/0oyMc= 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=xYwaSpjG; 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="xYwaSpjG" 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=xY waSpjG/8yIZ04GvmfZkMkg0AMRp5Qwcw7r++vxTcroQBwcVxmufJRbde/Eb93KsSAekeappG34w0u LC6mW5461YzYAdRw+W5C99zW3LP7vioVYf5KrEDDhCQluAtKcswRrOCG21gWIs9RevN9Ylthr7RFn Lx39e8hKWnxpQz8=; 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 1remII-008mef-Ho; Tue, 27 Feb 2024 02:30:06 +0100 From: Andrew Lunn Date: Mon, 26 Feb 2024 19:29:11 -0600 Subject: [PATCH net-next v5 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: <20240226-keee-u32-cleanup-v5-5-9e7323c41c38@lunn.ch> References: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@lunn.ch> In-Reply-To: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@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/DcumaUyEAcsmYgBl3Tr3raubFQ8HFW2KFMLfIharnyWq1PxptRJUM z7IXujVVW+JAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZd069wAKCRDmvw3LpmlM hNyXD/9VFYCPWBbqLTi4Om5etVHiQ001TRUWzhHFvlb3TWiIKQOUwS2dbZ+Luvh2ZvGSGyId2on ObqVmwpvC0ZL3m3aBWYUVLSfTe0t1eIUlyaJNcv3EYdntFoqXAoGBhWyWL7g+eup38asKtdyTtn tLCRnyXdLBrEX3AFJeRwa+tTCirE1y+0VM9XpvHrvQJfQKupX6YUqePaVXXlH09gZP/r0P5Biop nJgQDkXdqPNJrdPVaScaOX1YTNQq3ljZ8AfL0yBfWh303Us5Efe+X8Rn4jaSGzTCKtiqlrCkw8G FsJrJFF4IjKrARtJ6VeAr73eajWqvgkWv2rxQzgGeOXz6BFL9gzGLjhDk8Q8TCXk37AGVntOuTF Yz4MKjgKArUAy27QqhMiLBnznt/vfCa2AkJaEy2g47veGtLwR1xzNIVbKrHc9bFTSjwLir7BBk7 kxK7395KMTk+JJvCi6NUdBg5ElP14Z6EOu2J9MhCKDgYR+CymGrLOCEKJecH59XGk4r/8jN3wml Mnj7qfkgHNcenWy4IJisF6N5dJeXqyVQ9xygP4utKZKBCOUnTqSpmSb/t7XaGogto/ZL3kGrkIj ccBSjnNt2Y6lg7yesENubADlJgcaMOEIDOHTc2mhQsvVgjNpdiu92ghOXxbDVT03RacDxm13IC4 6u0QWGVHRfSl/DQ== 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 Tue Feb 27 01:29:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13573080 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 EF2AF54BF7; Tue, 27 Feb 2024 01:29:57 +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=1708997399; cv=none; b=lO5awoiCeCM9hEnYCs43zQQ9rGBu0OGSbIwM3ThftRVRGbgb8Lki7XqlB/tn1yW4ZNtRKyOlxnLF2vx+/1GQuvXSHQm0eett8FdCyQErPNDzcGgspKpXLerStCYqpJGAo43LKUpEelCJYfQzsC5eBwM5LqFYK0u5jStVL53+PbQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708997399; c=relaxed/simple; bh=PX0276prl5bF0Zk/hDHop6Y8pnHyHYPG6F7vOSTrfII=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Q4bCXdJDi0aDl+1fVmTb8o6R1OILVJZG0zWsOuB49gkRNTZISHl0bTTUkXHozV4fj8arPNGLePiGYyXGctQGmkSP44fjvsvharAOn3NQktc7rWatbU+TFJGS7LUPs1fVnq7KT66rk6ubnWSdywOwKRbYuYsxMMFUHVH5TnDbSQM= 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=IhEe23WV; 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="IhEe23WV" 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=KBe7PSdB/4N4eh9woXxZp2COIAUibBjbd71nXWJwB2E=; b=Ih Ee23WVyNCiH6KwotDzZezOuA0Z6O1lLT7CqwQHrOIjC/6v4g6hr7U+ZA8brURnZ/DXXcsNg9FGHdW Ja+5ZXfPkJdbPI0spGyxxKwzPpI091XrT1dJeJ/N4Em1qU/fbr4lfNAYoKqmi9r7DJxeLx96Iul1d 0KwAu+2C1tnYpww=; 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 1remIM-008mef-0w; Tue, 27 Feb 2024 02:30:10 +0100 From: Andrew Lunn Date: Mon, 26 Feb 2024 19:29:12 -0600 Subject: [PATCH net-next v5 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: <20240226-keee-u32-cleanup-v5-6-9e7323c41c38@lunn.ch> References: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@lunn.ch> In-Reply-To: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@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 , Simon Horman X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2709; i=andrew@lunn.ch; h=from:subject:message-id; bh=PX0276prl5bF0Zk/hDHop6Y8pnHyHYPG6F7vOSTrfII=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl3Tr399O/qZLa+qtmk1D+wb8mIMB5uVkItxltd fQDjV+4iSGJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZd069wAKCRDmvw3LpmlM hGz4D/9gkS9mGuVikuYHJ7HYII28YAzZuB6JgiHmuKa7/lJQ1R21GGykTuZVZ27dMSwAamohMK4 zwKekSM6jCXpPgVQP/Qq0RKrpsD0J63h81tLjpTaOE/CFeY8NGFQQDT8NRUX1Kmbt29iRfTDTNw 8gu0aCYYmP3ElEu+pouz4+LFbY6qTlK3FS5TXQr4hD/bRi3ukpxe7X3ClwsK7eLFsA1V6xobEiH c3iRkpDgZ0pesibjPuD6r+T8G1TZsX0DoOxkfzESwru9AbpF7hyuV4Wv+Z+UgC/Xfdf9Cx9UQYL F3WK0/vNhCSnFmF6vs1pI4dO9XRdM7hCoJr4iiKAAE57yBOuM7zUbhk4HP+S4y8D39nA2AfF/gY PDBnbRIwdipEqnTQBzdW3lKlm39B/+vXavVXXEEACKCi4pdl9Hm24LacFTJA2upwsO+npis3vgQ IL/xVNwOz8Zqj2XTj9jh4Td3cegZ0giL9vnanhO7Ry/d96iH1pMJcqtt54C2U2GHUWP9AtV0V1z /jsQ4Hx1gy8EdIHTNwZgYalWVPjSg1VEDI2UyUtLDjF29wy6SNeWR8aqmdLEVSn3Uzmz94wTTSY MHEZcdnw9RyAlOkHad2Ci2EyM+hnvgeLApEm0pyTPh9iwEyglt4k/IlSxPRjsbsKresuNEh5gwO FXXgDhcSgzoY/NA== 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. Reviewed-by: Simon Horman 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 Tue Feb 27 01:29:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13573081 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 793185578E; Tue, 27 Feb 2024 01:30: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=1708997403; cv=none; b=p9AaPo3q+i0lU6JIcPLRMhGGjlc4rUzLClgjMf14/KWTrHiUZVFNmd1jVUVjK+prKw1KxIW13rDUjOKfUmMpdKMyH6RlkTR2S5h1Dxv217bavL41upWJ/l1PsCo3bPK1Z1I5RJn5auzyDr/wD7PWB89ZPBb/m5olIX9AAL2eUmE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708997403; c=relaxed/simple; bh=IRhXR5z1n16Mavr53VIIs+mDSvzV25uDJ9u/3/XGV6A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YFbfosdvrJ2iovBW6CjNMxhrUdZJ3tcnidsIG2fm94RlHr8fZhcBboQoAf9YhlGDLrXN604uO6pDS5TdbKS5otAyrNthxzxy9PBpf3S9oKZxdneeiFk3jZlg+6UVee6IYqwaOxDphvmbUxJrrUEJWXRGWr+W1AxJ0DyzkQha3wM= 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=xNnm/+CK; 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="xNnm/+CK" 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=VMAhDZ6j7g9miYPaWDxliHXLiq67TTyMdEfJfE6S4XM=; b=xN nm/+CKyNmo/q3ISvcn+r4O/QQnNTFWKGznnRdJVS+aZQE+W8jeOWdvGPYpyTgnbo3Avee6x7LuKA3 jYUShBH+W9n/so5wLaJIzl5KAE+d0yt1FP6juziqwMzhopIYiXYKNNa5SFk1pIPuIZN4AjhfAG23W NTih1k1q6dJJlYc=; 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 1remIP-008mef-Gb; Tue, 27 Feb 2024 02:30:13 +0100 From: Andrew Lunn Date: Mon, 26 Feb 2024 19:29:13 -0600 Subject: [PATCH net-next v5 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: <20240226-keee-u32-cleanup-v5-7-9e7323c41c38@lunn.ch> References: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@lunn.ch> In-Reply-To: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@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 , Simon Horman X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=4144; i=andrew@lunn.ch; h=from:subject:message-id; bh=IRhXR5z1n16Mavr53VIIs+mDSvzV25uDJ9u/3/XGV6A=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl3Tr4RLJWGoD9bdYDGtoVCUU3me+Qgj/1kvN92 UIoGUeYJRuJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZd06+AAKCRDmvw3LpmlM hJCSEACnODCL0C97yLuf7DQbQfuu1TaH3WGtgEGtCZ7+9ti9npEK5JBt+BCoetM+PqL2mgIl1tZ sBFbkz8Wj+2HKvwiOdcifZn/YZ6eZL0agVDPQMsUM3XJ3Au3BL8lrn9tBPTQWM9US533zrVw7Hd hBV+Np7fD+OQ5EizfzzWymUYR/QHcMxWLJHMdjo/uKmN8Gi7k+oDGxHJA8xingLQl7I+VS56Xby EOoOOwFPFZXS/pRt02i1iKK3g4fIghGTJfH9/gXA71C1fhoMqXTzEQh0RxFIvECrlqRMNUt9693 t2KPwcK90kmvhnC16RYKlsakHB/FU6gtN7J/A3/SGP2Mk75edJrJ9UXZxzzVW2E/FG+QhN8t8LS jbcFPYcRLtm50jYHYKkunJhMKsx64XjkdPcKskFYWd6F/cYmtF+y/eujBwh0EZbwpzi47Db1CES v0BxvikkyaczXFzULB8jrwDTUDYcfcpPZquWfTJT19Z7Wzlm2nu60CmuF3JlAPhl3sMJ/a3o9Is 79VRxMJFb+ESoRV94lE0uGCTqSZUyAnP2fDZwe37JqAwXcVhwQvg6sJh2mnAV/26k+47MROTmk0 V+VrxKn+gfDvqIIXmLrdzfWZoGi3fx3ubn4JlYoXeLzuiNHoS6jENMh39/qQR3uXofXXLhAFuJn f6fbSqLJiKjeMBw== 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. Reviewed-by: Simon Horman Signed-off-by: Andrew Lunn --- 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 Tue Feb 27 01:29:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13573082 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 993E25F843; Tue, 27 Feb 2024 01:30: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=1708997407; cv=none; b=hBm43XXCor6eBbFYhAMqwo7zrWJoi5NUYUgC6l+mpWb6WkglQ7eoD0ajIaJb+G1EH8NVEjVLsYRR+P9qTUQbsnTcSfA361y6xAEOtdz9zvHOI+i6HxiW9S8NmDZJyRUM7NhOE0To1+J/AP+sBQIdnCp2BV+nWlC3GHUqG4kXcFM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708997407; c=relaxed/simple; bh=GLbpN+b7fMBqkKjjmSHSV3wUD/JZDYXsfXRADsHf3lg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uquoOJ+dePCbtIChlVmhyOETu79WJB4hJmeFb1f71rsOQUOMusoH1EIYHtLG1VSlwiVM2IpDa8Ia31oc6CY5NddvTtSYrl+lpI1JFPPHQa9fNzltocM3vH7KG/Er+fm8lIrGJUqnkKk1/HO6B17URah5lPcBmWrDwU1KV8/vQg4= 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=t4OdcNFL; 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="t4OdcNFL" 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=j7WYc5BzjQwZP7iBz9OnwnkxvlP37ESIju8ZWgAQlho=; b=t4 OdcNFLj+zXpkW3FNqm+geAzwHTeWjn1j9BtBIWQOHK/CRtNac9RVnxFVONYXrhIOaw7UfJ0OL/ehn tVq8cfUNWS5fucQ3kE9tvlk1g9RMyrGwQCqB0DxVuWkTYiCvF03gyji5bml0m2m01CrVg38M+TZCx vxas57mRZkVIIuI=; 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 1remIS-008mef-Vz; Tue, 27 Feb 2024 02:30:17 +0100 From: Andrew Lunn Date: Mon, 26 Feb 2024 19:29:14 -0600 Subject: [PATCH net-next v5 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: <20240226-keee-u32-cleanup-v5-8-9e7323c41c38@lunn.ch> References: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@lunn.ch> In-Reply-To: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@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 , Simon Horman X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1684; i=andrew@lunn.ch; h=from:subject:message-id; bh=GLbpN+b7fMBqkKjjmSHSV3wUD/JZDYXsfXRADsHf3lg=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl3Tr4FL68PUOtdpjKHIPxxcexRCI1y4UMd6Vlr rSihWxrcCaJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZd06+AAKCRDmvw3LpmlM hP6ZD/92rT0gKDX7pqllheXiCM8p+u2G+QJdNENffYdQYlQoBxfqyPxkjGUzFdxb4shj4lB6Th4 TYWtB4GP6JqMZjF8WyVCsMoBtk2naQmvlx/ZiJAtlez33qAP5dxVzyliGkttt8yPzszdM3k43XS Jqteqs6QSIGLV5cCzbFQjKN/rmvh/nUo1TeZbtVny2GaxCTLrkRtf4+YmzjumeqTLON/QyUyMvi a9HX1XfxT2d2Ma+aGx5evt3W4lwrXXXOVxxmzNv7i/ZD6IolovhsyVYI9gUsWILgjVBW4D+DQrU XO2dAq9nCwWALBFDRqrZZH2hYJO8qy2YEvxtwivOlQdDu7Luz9xhnjLJWNgMdg9Teyz/6wcXdjp PYMjgiXcfl2lBroeyviIxzCQjqa/vpyyuXKPC3b8irAI7p0RI6zA2yw6gWa2izIsgHduvATA4es /27pvw5+jCgN+X3Il/ALjzDuE8YNhOJe/i+sfTh9WfSDv7tsVDJnqZxvp/3hBbNxpniAsApDA2D HvvaasZdaeAUI4z9H2t8q193+Cr2bmmzz8L0Z3gcilVooVu6Hqt84oH7Q0R8bPk/L3bt3iBCvLN tF4KDHOwcQaFmWEdDPXpDz+TmxkT8sYSABRIU7xysRK3ZHQE9KixbdmYgi+mQhkEY3AKpID4gyr KwHp+THDbG0XsOQ== 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. Reviewed-by: Simon Horman 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; From patchwork Tue Feb 27 01:29:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 13573083 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 764B55F843; Tue, 27 Feb 2024 01:30:10 +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=1708997412; cv=none; b=uoCJtB5K5SwaLnimoRlpVDdVRrUIc2uVR3MKmq/8zzbkexnmv7MBCxRHJiBrqMG1riTPw58OCT+7xzwSnpmhxtFab+dnOKkw7LWSBnPyXVJjYH+jbHvF5t1B9TfHE4KS/lXMswCM7T64GAL7hqbDeS+EQzwXt23h8Xang78dUv4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708997412; c=relaxed/simple; bh=5UVxVNfHiA0++FWexHxcJ07Y9z6b+yzUVmqRkNhmezY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NH6tBWhV7blrz9QZyRBK0+AvKhgQ9RathZH3L+Inhl9S1+OGEzcyTPb+KGWZURqqlY3aW8vtkdHywLCDpz7634wyP4uLceKYarqe+Z438BSL4MJduTxghjA32P8ijRz0TFjIAojDA7jwOx2iBIs73YhkorYmtPEVqAUZFqBvTeQ= 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=xccAaaeC; 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="xccAaaeC" 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=dlWosYEl5DyVPkmkUpp8E4kMoFve7mS4xHfsaci4cI8=; b=xc cAaaeCdh07Px5HbStQedb4PTTG0L3o0cTpgvkNkCkWt5tqK9DH8WQ9AMR4J9UdXrUI7nVu/Kfg9pH IjVRy+CROR5iilXz5c4gbPqh7pts1daXGcIyGng0BdsK80Eup3DlCfWitSG8omYMMPRlUqpCHWoZF shFPzEhNSdgl64I=; 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 1remIW-008mef-FC; Tue, 27 Feb 2024 02:30:20 +0100 From: Andrew Lunn Date: Mon, 26 Feb 2024 19:29:15 -0600 Subject: [PATCH net-next v5 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: <20240226-keee-u32-cleanup-v5-9-9e7323c41c38@lunn.ch> References: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@lunn.ch> In-Reply-To: <20240226-keee-u32-cleanup-v5-0-9e7323c41c38@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 , Simon Horman X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=5173; i=andrew@lunn.ch; h=from:subject:message-id; bh=5UVxVNfHiA0++FWexHxcJ07Y9z6b+yzUVmqRkNhmezY=; b=owEBbQKS/ZANAwAKAea/DcumaUyEAcsmYgBl3Tr4u9xn6AoQC66Hw8FvhwDiyA1JzuD/uIEMl T6hs8CDA0KJAjMEAAEKAB0WIQRh+xAly1MmORb54bfmvw3LpmlMhAUCZd06+AAKCRDmvw3LpmlM hFuDEADbMV10f0w4q9NW0+WK26n/0hTfAoyDi/htQNBEKponnUa4QypgvPzSfIT1oPDh19yO/nO leKwKU1jwbE9s780IEK5P8M33KFH5CeOBjqhprOHSOXS0iBagJxqSXiiOEzIShVfmy0bRLbZUvk +GljhQT0V4xg58w9dXtAHzSRQ/Nuv/vXGgd91W89Xh0FWPKzOoan6EPV4i25P9+igWdU9XmhjPF NDi6YblkxXOcgsjh4sj0bjNqVvgRirx9xy3k9HqnBgKzE0npnA8i8Q2Fyprt69rhBYj00nV7Rao fqsCnJ0BICOuscvsFl+rj0XjbdNZywuEkyzM6Dd1pp+axOi137qns5B2RWa4JKbhhrjgzDEnj96 88VjENswrrWLfaAfSJ1qc6FXkG4YeDu7yebMkRVGuZs/jNtygFp83GQ8+4A0cK8GqnT5ota4nPI hptVwiJCfxHCnrwZJZ1qZNgdcOu0bekBbZ+ApKewohNnD7FFOvX01idFmWs7CoyjFqpPq0TPP2s Fy7FDTaKH1ZOKFYbKxCsKj4GyzYPsmNT9Cm+i5g5Hc13XEuZwnnu0vWPO/65msXs8o385O6NIW1 i48imSV8YhsMv0dQixVsizfxAfyP356zTagy7NZwQsGtTsfc5Uv5Z7giMz7e2wtbe2AmLyUOt7y fvAeLKL9XucDPIA== 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. Reviewed-by: Simon Horman Signed-off-by: Andrew Lunn --- 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 b419969c0dcb..317308bdbda9 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -1514,9 +1514,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; @@ -1533,6 +1530,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; @@ -1540,22 +1539,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)