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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-phylib-eee-cleanups'

Russell King says:

====================
net: phylib EEE cleanups

Clean up phylib's EEE support. Patches previously posted as RFC as part
of the phylink EEE series.

Patch 1 changes the Marvell driver to use the state we store in
struct phy_device, rather than manually calling
phydev->eee_cfg.eee_enabled.

Patch 2 avoids genphy_c45_ethtool_get_eee() setting ->eee_enabled, as
we copy that from phydev->eee_cfg.eee_enabled later, and after patch 3
mo one uses this after calling genphy_c45_ethtool_get_eee(). In fact,
the only caller of this function now is phy_ethtool_get_eee().

As all callers to genphy_c45_eee_is_active() now pass NULL as its
is_enabled flag, this is no longer useful. Remove the argument in
patch 3.

Patch 4 updates the phylib documentation to make it absolutely clear
that phy_ethtool_get_eee() now fills in all members of struct
ethtool_keee, which is why we now have so many buggy network drivers.
====================

Link: https://patch.msgid.link/Z1GDZlFyF2fsFa3S@shell.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+10 -19
+1 -3
drivers/net/phy/marvell.c
··· 1550 1550 1551 1551 static int m88e1540_set_fld(struct phy_device *phydev, const u8 *msecs) 1552 1552 { 1553 - struct ethtool_keee eee; 1554 1553 int val, ret; 1555 1554 1556 1555 if (*msecs == ETHTOOL_PHY_FAST_LINK_DOWN_OFF) ··· 1559 1560 /* According to the Marvell data sheet EEE must be disabled for 1560 1561 * Fast Link Down detection to work properly 1561 1562 */ 1562 - ret = genphy_c45_ethtool_get_eee(phydev, &eee); 1563 - if (!ret && eee.eee_enabled) { 1563 + if (phydev->eee_cfg.eee_enabled) { 1564 1564 phydev_warn(phydev, "Fast Link Down detection requires EEE to be disabled!\n"); 1565 1565 return -EBUSY; 1566 1566 }
+4 -10
drivers/net/phy/phy-c45.c
··· 1469 1469 * @phydev: target phy_device struct 1470 1470 * @adv: variable to store advertised linkmodes 1471 1471 * @lp: variable to store LP advertised linkmodes 1472 - * @is_enabled: variable to store EEE enabled/disabled configuration value 1473 1472 * 1474 1473 * Description: this function will read local and link partner PHY 1475 1474 * advertisements. Compare them return current EEE state. 1476 1475 */ 1477 1476 int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *adv, 1478 - unsigned long *lp, bool *is_enabled) 1477 + unsigned long *lp) 1479 1478 { 1480 1479 __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp_adv) = {}; 1481 1480 __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp_lp) = {}; 1482 1481 __ETHTOOL_DECLARE_LINK_MODE_MASK(common); 1483 - bool eee_enabled, eee_active; 1482 + bool eee_active; 1484 1483 int ret; 1485 1484 1486 1485 ret = genphy_c45_read_eee_adv(phydev, tmp_adv); ··· 1490 1491 if (ret) 1491 1492 return ret; 1492 1493 1493 - eee_enabled = !linkmode_empty(tmp_adv); 1494 1494 linkmode_and(common, tmp_adv, tmp_lp); 1495 - if (eee_enabled && !linkmode_empty(common)) 1495 + if (!linkmode_empty(tmp_adv) && !linkmode_empty(common)) 1496 1496 eee_active = phy_check_valid(phydev->speed, phydev->duplex, 1497 1497 common); 1498 1498 else ··· 1501 1503 linkmode_copy(adv, tmp_adv); 1502 1504 if (lp) 1503 1505 linkmode_copy(lp, tmp_lp); 1504 - if (is_enabled) 1505 - *is_enabled = eee_enabled; 1506 1506 1507 1507 return eee_active; 1508 1508 } ··· 1517 1521 int genphy_c45_ethtool_get_eee(struct phy_device *phydev, 1518 1522 struct ethtool_keee *data) 1519 1523 { 1520 - bool is_enabled; 1521 1524 int ret; 1522 1525 1523 1526 ret = genphy_c45_eee_is_active(phydev, data->advertised, 1524 - data->lp_advertised, &is_enabled); 1527 + data->lp_advertised); 1525 1528 if (ret < 0) 1526 1529 return ret; 1527 1530 1528 - data->eee_enabled = is_enabled; 1529 1531 data->eee_active = phydev->eee_active; 1530 1532 linkmode_copy(data->supported, phydev->supported_eee); 1531 1533
+4 -5
drivers/net/phy/phy.c
··· 988 988 if (phydev->link && phydev->state != PHY_RUNNING) { 989 989 phy_check_downshift(phydev); 990 990 phydev->state = PHY_RUNNING; 991 - err = genphy_c45_eee_is_active(phydev, 992 - NULL, NULL, NULL); 991 + err = genphy_c45_eee_is_active(phydev, NULL, NULL); 993 992 phydev->eee_active = err > 0; 994 993 phydev->enable_tx_lpi = phydev->eee_cfg.tx_lpi_enabled && 995 994 phydev->eee_active; ··· 1657 1658 if (!phydev->drv) 1658 1659 return -EIO; 1659 1660 1660 - ret = genphy_c45_eee_is_active(phydev, NULL, NULL, NULL); 1661 + ret = genphy_c45_eee_is_active(phydev, NULL, NULL); 1661 1662 if (ret < 0) 1662 1663 return ret; 1663 1664 if (!ret) ··· 1701 1702 * @phydev: target phy_device struct 1702 1703 * @data: ethtool_keee data 1703 1704 * 1704 - * Description: reports the Supported/Advertisement/LP Advertisement 1705 - * capabilities, etc. 1705 + * Description: get the current EEE settings, filling in all members of 1706 + * @data. 1706 1707 */ 1707 1708 int phy_ethtool_get_eee(struct phy_device *phydev, struct ethtool_keee *data) 1708 1709 {
+1 -1
include/linux/phy.h
··· 1991 1991 int genphy_c45_plca_get_status(struct phy_device *phydev, 1992 1992 struct phy_plca_status *plca_st); 1993 1993 int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *adv, 1994 - unsigned long *lp, bool *is_enabled); 1994 + unsigned long *lp); 1995 1995 int genphy_c45_ethtool_get_eee(struct phy_device *phydev, 1996 1996 struct ethtool_keee *data); 1997 1997 int genphy_c45_ethtool_set_eee(struct phy_device *phydev,