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: 772816 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: linux-usb@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 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: 772815 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: linux-usb@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 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: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: 772814 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: linux-usb@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 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: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: 772813 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: linux-usb@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 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: 772812 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: linux-usb@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 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;