From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
Russell King <rmk+kernel@armlinux.org.uk>,
David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH net-next 5/5] net: phy: c45: extend genphy_c45_ethtool_[set|get]_eee
Date: Mon, 1 Jan 2024 22:28:50 +0100 [thread overview]
Message-ID: <e7b66d99-e51b-4c8f-83da-99184e5f41ec@gmail.com> (raw)
In-Reply-To: <783d4a61-2f08-41fc-b91d-bd5f512586a2@gmail.com>
Extend both functions to use the linkmode bitmap extension if available.
Note: The linkmode extension for now is supported only if ethtool uses
netlink. It's not supported for ioctl.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/phy-c45.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 9d8b2b5eb..e276dba19 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -1454,6 +1454,7 @@ int genphy_c45_ethtool_get_eee(struct phy_device *phydev,
__ETHTOOL_DECLARE_LINK_MODE_MASK(adv) = {};
__ETHTOOL_DECLARE_LINK_MODE_MASK(lp) = {};
bool overflow = false, is_enabled;
+ struct ethtool_keee *keee;
int ret;
ret = genphy_c45_eee_is_active(phydev, adv, lp, &is_enabled);
@@ -1463,6 +1464,16 @@ int genphy_c45_ethtool_get_eee(struct phy_device *phydev,
data->eee_enabled = is_enabled;
data->eee_active = ret;
+ keee = ethtool_eee2keee(data);
+ if (keee) {
+ linkmode_copy(keee->link_modes.supported,
+ phydev->supported_eee);
+ linkmode_copy(keee->link_modes.advertising, adv);
+ linkmode_copy(keee->link_modes.lp_advertising, lp);
+ keee->use_link_modes = 1;
+ return 0;
+ }
+
if (!ethtool_convert_link_mode_to_legacy_u32(&data->supported,
phydev->supported_eee))
overflow = true;
@@ -1494,6 +1505,7 @@ int genphy_c45_ethtool_set_eee(struct phy_device *phydev,
{
__ETHTOOL_DECLARE_LINK_MODE_MASK(adv);
__ETHTOOL_DECLARE_LINK_MODE_MASK(tmp);
+ struct ethtool_keee *keee;
bool unsupported;
int ret;
@@ -1501,7 +1513,11 @@ int genphy_c45_ethtool_set_eee(struct phy_device *phydev,
if (!data->eee_enabled)
goto eee_aneg;
- ethtool_convert_legacy_u32_to_link_mode(adv, data->advertised);
+ keee = ethtool_eee2keee(data);
+ if (keee && keee->use_link_modes)
+ linkmode_copy(adv, keee->link_modes.advertising);
+ else
+ ethtool_convert_legacy_u32_to_link_mode(adv, data->advertised);
if (linkmode_empty(adv)) {
linkmode_copy(phydev->advertising_eee, phydev->supported_eee);
--
2.43.0
next prev parent reply other threads:[~2024-01-01 21:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-01 21:22 [PATCH net-next 0/5] ethtool: add support for EEE linkmodes beyond bit 32 Heiner Kallweit
2024-01-01 21:23 ` [PATCH net-next 1/5] ethtool: add struct ethtool_keee and extend struct ethtool_eee Heiner Kallweit
2024-01-04 16:27 ` Marek Behún
2024-01-04 16:46 ` Heiner Kallweit
2024-01-04 17:16 ` Andrew Lunn
2024-01-04 20:30 ` Heiner Kallweit
2024-01-05 22:35 ` Heiner Kallweit
2024-01-05 23:15 ` Andrew Lunn
2024-01-08 15:38 ` Russell King (Oracle)
2024-01-01 21:24 ` [PATCH net-next 2/5] ethtool: add basic handling of struct ethtool_keee Heiner Kallweit
2024-01-01 21:25 ` [PATCH net-next 3/5] ethtool: send EEE linkmode bitmaps to userspace Heiner Kallweit
2024-01-01 21:26 ` [PATCH net-next 4/5] net: phy: c45: prepare genphy_c45_ethtool_set_eee for follow-up extension Heiner Kallweit
2024-01-01 21:28 ` Heiner Kallweit [this message]
2024-01-06 19:44 ` [PATCH net-next 0/5] ethtool: add support for EEE linkmodes beyond bit 32 Heiner Kallweit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e7b66d99-e51b-4c8f-83da-99184e5f41ec@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rmk+kernel@armlinux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).