From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
Russell King - ARM Linux <linux@armlinux.org.uk>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH net-next v4 6/6] net: phy: c45: change genphy_c45_ethtool_[get|set]_eee to use EEE linkmode bitmaps
Date: Sat, 27 Jan 2024 14:30:29 +0100 [thread overview]
Message-ID: <5047dcc7-534c-4570-97d2-9ed4f4397406@gmail.com> (raw)
In-Reply-To: <7d82de21-9bde-4f66-99ce-f03ff994ef34@gmail.com>
Change genphy_c45_ethtool_[get|set]_eee to use EEE linkmode bitmaps.
This is a prerequisite for adding support for EEE modes beyond bit 31.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/phy-c45.c | 36 +++++++++++++-----------------------
1 file changed, 13 insertions(+), 23 deletions(-)
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 99c84af25..46c87a903 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -1453,7 +1453,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;
+ bool is_enabled;
int ret;
ret = genphy_c45_eee_is_active(phydev, adv, lp, &is_enabled);
@@ -1462,17 +1462,9 @@ int genphy_c45_ethtool_get_eee(struct phy_device *phydev,
data->eee_enabled = is_enabled;
data->eee_active = ret;
-
- if (!ethtool_convert_link_mode_to_legacy_u32(&data->supported_u32,
- phydev->supported_eee))
- overflow = true;
- if (!ethtool_convert_link_mode_to_legacy_u32(&data->advertised_u32, adv))
- overflow = true;
- if (!ethtool_convert_link_mode_to_legacy_u32(&data->lp_advertised_u32, lp))
- overflow = true;
-
- if (overflow)
- phydev_warn(phydev, "Not all supported or advertised EEE link modes were passed to the user space\n");
+ linkmode_copy(data->supported, phydev->supported_eee);
+ linkmode_copy(data->advertised, adv);
+ linkmode_copy(data->lp_advertised, lp);
return 0;
}
@@ -1495,24 +1487,22 @@ int genphy_c45_ethtool_set_eee(struct phy_device *phydev,
int ret;
if (data->eee_enabled) {
- if (data->advertised_u32) {
- __ETHTOOL_DECLARE_LINK_MODE_MASK(adv);
+ unsigned long *adv = data->advertised;
- ethtool_convert_legacy_u32_to_link_mode(adv,
- data->advertised_u32);
- linkmode_andnot(adv, adv, phydev->supported_eee);
- if (!linkmode_empty(adv)) {
+ if (!linkmode_empty(adv)) {
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp);
+ bool unsupp;
+
+ unsupp = linkmode_andnot(tmp, adv, phydev->supported_eee);
+ if (unsupp) {
phydev_warn(phydev, "At least some EEE link modes are not supported.\n");
return -EINVAL;
}
-
- ethtool_convert_legacy_u32_to_link_mode(phydev->advertising_eee,
- data->advertised_u32);
} else {
- linkmode_copy(phydev->advertising_eee,
- phydev->supported_eee);
+ adv = phydev->supported_eee;
}
+ linkmode_copy(phydev->advertising_eee, adv);
phydev->eee_enabled = true;
} else {
phydev->eee_enabled = false;
--
2.43.0
next prev parent reply other threads:[~2024-01-27 13:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-27 13:24 [PATCH net-next v4 0/6] ethtool: switch EEE netlink interface to use EEE linkmode bitmaps Heiner Kallweit
2024-01-27 13:25 ` [PATCH net-next v4 1/6] ethtool: replace struct ethtool_eee with a new struct ethtool_keee on kernel side Heiner Kallweit
2024-01-28 23:54 ` Andrew Lunn
2024-01-27 13:26 ` [PATCH net-next v4 2/6] ethtool: switch back from ethtool_keee to ethtool_eee for ioctl Heiner Kallweit
2024-01-28 23:57 ` Andrew Lunn
2024-01-27 13:26 ` [PATCH net-next v4 3/6] ethtool: adjust struct ethtool_keee to kernel needs Heiner Kallweit
2024-01-27 13:28 ` [PATCH net-next v4 4/6] ethtool: add suffix _u32 to legacy bitmap members of struct ethtool_keee Heiner Kallweit
2024-01-29 0:13 ` Andrew Lunn
2024-01-27 13:29 ` [PATCH net-next v4 5/6] ethtool: add linkmode bitmap support to " Heiner Kallweit
2024-01-29 0:12 ` Andrew Lunn
2024-01-27 13:30 ` Heiner Kallweit [this message]
2024-01-29 0:10 ` [PATCH net-next v4 6/6] net: phy: c45: change genphy_c45_ethtool_[get|set]_eee to use EEE linkmode bitmaps Andrew Lunn
2024-01-29 0:10 ` [PATCH net-next v4 0/6] ethtool: switch EEE netlink interface " Andrew Lunn
2024-01-29 10:13 ` Heiner Kallweit
2024-01-31 12:40 ` patchwork-bot+netdevbpf
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=5047dcc7-534c-4570-97d2-9ed4f4397406@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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).