On Sun, Feb 18, 2024 at 11:07:06AM -0600, Andrew Lunn wrote:
> 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.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
> include/linux/ethtool.h | 3 ---
> net/ethtool/eee.c | 31 ++++---------------------------
> net/ethtool/ioctl.c | 29 ++++++++++-------------------
> 3 files changed, 14 insertions(+), 49 deletions(-)
Nice :)
Reviewed-by: Simon Horman <horms@kernel.org>
..
@@ -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;
@@ -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);
@@ -1513,9 +1513,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;
@@ -1532,6 +1529,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;
@@ -1539,22 +1538,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)