Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ethtool: eee: Remove legacy _u32 from keee

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 <horms@kernel.org>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Andrew Lunn and committed by
David S. Miller
292fac46 1e45b5f2

+14 -49
-3
include/linux/ethtool.h
··· 226 226 __ETHTOOL_DECLARE_LINK_MODE_MASK(supported); 227 227 __ETHTOOL_DECLARE_LINK_MODE_MASK(advertised); 228 228 __ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertised); 229 - u32 supported_u32; 230 - u32 advertised_u32; 231 - u32 lp_advertised_u32; 232 229 u32 tx_lpi_timer; 233 230 bool tx_lpi_enabled; 234 231 bool eee_active;
+4 -27
net/ethtool/eee.c
··· 4 4 #include "common.h" 5 5 #include "bitset.h" 6 6 7 - #define EEE_MODES_COUNT \ 8 - (sizeof_field(struct ethtool_keee, supported_u32) * BITS_PER_BYTE) 9 - 10 7 struct eee_req_info { 11 8 struct ethnl_req_info base; 12 9 }; ··· 38 41 ret = dev->ethtool_ops->get_eee(dev, eee); 39 42 ethnl_ops_complete(dev); 40 43 41 - if (!ret && !ethtool_eee_use_linkmodes(eee)) { 42 - ethtool_convert_legacy_u32_to_link_mode(eee->supported, 43 - eee->supported_u32); 44 - ethtool_convert_legacy_u32_to_link_mode(eee->advertised, 45 - eee->advertised_u32); 46 - ethtool_convert_legacy_u32_to_link_mode(eee->lp_advertised, 47 - eee->lp_advertised_u32); 48 - } 49 - 50 44 return ret; 51 45 } 52 46 ··· 49 61 const struct ethtool_keee *eee = &data->eee; 50 62 int len = 0; 51 63 int ret; 52 - 53 - BUILD_BUG_ON(sizeof(eee->advertised_u32) * BITS_PER_BYTE != 54 - EEE_MODES_COUNT); 55 - BUILD_BUG_ON(sizeof(eee->lp_advertised_u32) * BITS_PER_BYTE != 56 - EEE_MODES_COUNT); 57 64 58 65 /* MODES_OURS */ 59 66 ret = ethnl_bitset_size(eee->advertised, eee->supported, ··· 137 154 if (ret < 0) 138 155 return ret; 139 156 140 - if (ethtool_eee_use_linkmodes(&eee)) { 141 - ret = ethnl_update_bitset(eee.advertised, 142 - __ETHTOOL_LINK_MODE_MASK_NBITS, 143 - tb[ETHTOOL_A_EEE_MODES_OURS], 144 - link_mode_names, info->extack, &mod); 145 - } else { 146 - ret = ethnl_update_bitset32(&eee.advertised_u32, EEE_MODES_COUNT, 147 - tb[ETHTOOL_A_EEE_MODES_OURS], 148 - link_mode_names, info->extack, &mod); 149 - } 157 + ret = ethnl_update_bitset(eee.advertised, 158 + __ETHTOOL_LINK_MODE_MASK_NBITS, 159 + tb[ETHTOOL_A_EEE_MODES_OURS], 160 + link_mode_names, info->extack, &mod); 150 161 if (ret < 0) 151 162 return ret; 152 163 ethnl_update_bool(&eee.eee_enabled, tb[ETHTOOL_A_EEE_ENABLED], &mod);
+10 -19
net/ethtool/ioctl.c
··· 1514 1514 { 1515 1515 memset(keee, 0, sizeof(*keee)); 1516 1516 1517 - keee->supported_u32 = eee->supported; 1518 - keee->advertised_u32 = eee->advertised; 1519 - keee->lp_advertised_u32 = eee->lp_advertised; 1520 1517 keee->eee_active = eee->eee_active; 1521 1518 keee->eee_enabled = eee->eee_enabled; 1522 1519 keee->tx_lpi_enabled = eee->tx_lpi_enabled; ··· 1530 1533 static void keee_to_eee(struct ethtool_eee *eee, 1531 1534 const struct ethtool_keee *keee) 1532 1535 { 1536 + bool overflow; 1537 + 1533 1538 memset(eee, 0, sizeof(*eee)); 1534 1539 1535 1540 eee->eee_active = keee->eee_active; ··· 1539 1540 eee->tx_lpi_enabled = keee->tx_lpi_enabled; 1540 1541 eee->tx_lpi_timer = keee->tx_lpi_timer; 1541 1542 1542 - if (ethtool_eee_use_linkmodes(keee)) { 1543 - bool overflow; 1544 - 1545 - overflow = !ethtool_convert_link_mode_to_legacy_u32(&eee->supported, 1546 - keee->supported); 1547 - ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, 1548 - keee->advertised); 1549 - ethtool_convert_link_mode_to_legacy_u32(&eee->lp_advertised, 1550 - keee->lp_advertised); 1551 - if (overflow) 1552 - pr_warn("Ethtool ioctl interface doesn't support passing EEE linkmodes beyond bit 32\n"); 1553 - } else { 1554 - eee->supported = keee->supported_u32; 1555 - eee->advertised = keee->advertised_u32; 1556 - eee->lp_advertised = keee->lp_advertised_u32; 1557 - } 1543 + overflow = !ethtool_convert_link_mode_to_legacy_u32(&eee->supported, 1544 + keee->supported); 1545 + ethtool_convert_link_mode_to_legacy_u32(&eee->advertised, 1546 + keee->advertised); 1547 + ethtool_convert_link_mode_to_legacy_u32(&eee->lp_advertised, 1548 + keee->lp_advertised); 1549 + if (overflow) 1550 + pr_warn("Ethtool ioctl interface doesn't support passing EEE linkmodes beyond bit 32\n"); 1558 1551 } 1559 1552 1560 1553 static int ethtool_get_eee(struct net_device *dev, char __user *useraddr)