changes v8:
- fix comment for linkmode_to_mii_eee_cap1_t() function
- add Acked-by: Arun Ramadoss [off-list ref]
- add Reviewed-by: Alexander Duyck [off-list ref]
changes v7:
- update documentation for genphy_c45_eee_is_active()
- address review comments on "net: dsa: microchip: enable EEE support"
patch
changes v6:
- split patch set and send only first 9 patches
- Add Reviewed-by: Andrew Lunn [off-list ref]
- use 0xffff instead of GENMASK
- Document @supported_eee
- use "()" with function name in comments
changes v5:
- spell fixes
- move part of genphy_c45_read_eee_abilities() to
genphy_c45_read_eee_cap1()
- validate MDIO_PCS_EEE_ABLE register against 0xffff val.
- rename *eee_100_10000* to *eee_cap1*
- use linkmode_intersects(phydev->supported, PHY_EEE_CAP1_FEATURES)
instead of !linkmode_empty()
- add documentation to linkmode/register helpers
changes v4:
- remove following helpers:
mmd_eee_cap_to_ethtool_sup_t
mmd_eee_adv_to_ethtool_adv_t
ethtool_adv_to_mmd_eee_adv_t
and port drivers from this helpers to linkmode helpers.
- rebase against latest net-next
- port phy_init_eee() to genphy_c45_eee_is_active()
changes v3:
- rework some parts of EEE infrastructure and move it to c45 code.
- add supported_eee storage and start using it in EEE code and by the
micrel driver.
- add EEE support for ar8035 PHY
- add SmartEEE support to FEC i.MX series.
changes v2:
- use phydev->supported instead of reading MII_BMSR regiaster
- fix @get_eee > @set_eee
With this patch series we provide EEE control for KSZ9477 family of
switches and
AR8035 with i.MX6 configuration.
According to my tests, on a system with KSZ8563 switch and 100Mbit idle
link,
we consume 0,192W less power per port if EEE is enabled.
Oleksij Rempel (9):
net: dsa: microchip: enable EEE support
net: phy: add genphy_c45_read_eee_abilities() function
net: phy: micrel: add ksz9477_get_features()
net: phy: export phy_check_valid() function
net: phy: add genphy_c45_ethtool_get/set_eee() support
net: phy: c22: migrate to genphy_c45_write_eee_adv()
net: phy: c45: migrate to genphy_c45_write_eee_adv()
net: phy: migrate phy_init_eee() to genphy_c45_eee_is_active()
net: phy: start using genphy_c45_ethtool_get/set_eee()
drivers/net/dsa/microchip/ksz_common.c | 66 +++++
drivers/net/phy/micrel.c | 21 ++
drivers/net/phy/phy-c45.c | 319 ++++++++++++++++++++++++-
drivers/net/phy/phy.c | 153 ++----------
drivers/net/phy/phy_device.c | 26 +-
include/linux/mdio.h | 84 +++++++
include/linux/phy.h | 14 ++
include/uapi/linux/mdio.h | 8 +
8 files changed, 554 insertions(+), 137 deletions(-)
--
2.30.2
All preparations are done. Now we can start using new functions and remove
the old code.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/phy/phy.c | 60 ++-----------------------------------------
1 file changed, 2 insertions(+), 58 deletions(-)
@@ -1517,33 +1517,10 @@ EXPORT_SYMBOL(phy_get_eee_err);*/intphy_ethtool_get_eee(structphy_device*phydev,structethtool_eee*data){-intval;-if(!phydev->drv)return-EIO;-/* Get Supported EEE */-val=phy_read_mmd(phydev,MDIO_MMD_PCS,MDIO_PCS_EEE_ABLE);-if(val<0)-returnval;-data->supported=mmd_eee_cap_to_ethtool_sup_t(val);--/* Get advertisement EEE */-val=phy_read_mmd(phydev,MDIO_MMD_AN,MDIO_AN_EEE_ADV);-if(val<0)-returnval;-data->advertised=mmd_eee_adv_to_ethtool_adv_t(val);-data->eee_enabled=!!data->advertised;--/* Get LP advertisement EEE */-val=phy_read_mmd(phydev,MDIO_MMD_AN,MDIO_AN_EEE_LPABLE);-if(val<0)-returnval;-data->lp_advertised=mmd_eee_adv_to_ethtool_adv_t(val);--data->eee_active=!!(data->advertised&data->lp_advertised);--return0;+returngenphy_c45_ethtool_get_eee(phydev,data);}EXPORT_SYMBOL(phy_ethtool_get_eee);
@@ -1556,43 +1533,10 @@ EXPORT_SYMBOL(phy_ethtool_get_eee);*/intphy_ethtool_set_eee(structphy_device*phydev,structethtool_eee*data){-intcap,old_adv,adv=0,ret;-if(!phydev->drv)return-EIO;-/* Get Supported EEE */-cap=phy_read_mmd(phydev,MDIO_MMD_PCS,MDIO_PCS_EEE_ABLE);-if(cap<0)-returncap;--old_adv=phy_read_mmd(phydev,MDIO_MMD_AN,MDIO_AN_EEE_ADV);-if(old_adv<0)-returnold_adv;--if(data->eee_enabled){-adv=!data->advertised?cap:-ethtool_adv_to_mmd_eee_adv_t(data->advertised)∩-/* Mask prohibited EEE modes */-adv&=~phydev->eee_broken_modes;-}--if(old_adv!=adv){-ret=phy_write_mmd(phydev,MDIO_MMD_AN,MDIO_AN_EEE_ADV,adv);-if(ret<0)-returnret;--/* Restart autonegotiation so the new modes get sent to the-*linkpartner.-*/-if(phydev->autoneg==AUTONEG_ENABLE){-ret=phy_restart_aneg(phydev);-if(ret<0)-returnret;-}-}--return0;+returngenphy_c45_ethtool_set_eee(phydev,data);}EXPORT_SYMBOL(phy_ethtool_set_eee);
@@ -1493,62 +1469,25 @@ static void mmd_eee_adv_to_linkmode(unsigned long *advertising, u16 eee_adv)*/intphy_init_eee(structphy_device*phydev,boolclk_stop_enable){+intret;+if(!phydev->drv)return-EIO;-/* According to 802.3az,the EEE is supported only in full duplex-mode.-*/-if(phydev->duplex==DUPLEX_FULL){-__ETHTOOL_DECLARE_LINK_MODE_MASK(common);-__ETHTOOL_DECLARE_LINK_MODE_MASK(lp);-__ETHTOOL_DECLARE_LINK_MODE_MASK(adv);-inteee_lp,eee_cap,eee_adv;-intstatus;-u32cap;--/* Read phy status to properly get the right settings */-status=phy_read_status(phydev);-if(status)-returnstatus;--/* First check if the EEE ability is supported */-eee_cap=phy_read_mmd(phydev,MDIO_MMD_PCS,MDIO_PCS_EEE_ABLE);-if(eee_cap<=0)-gotoeee_exit_err;--cap=mmd_eee_cap_to_ethtool_sup_t(eee_cap);-if(!cap)-gotoeee_exit_err;--/* Check which link settings negotiated and verify it in-*theEEEadvertisingregisters.-*/-eee_lp=phy_read_mmd(phydev,MDIO_MMD_AN,MDIO_AN_EEE_LPABLE);-if(eee_lp<=0)-gotoeee_exit_err;--eee_adv=phy_read_mmd(phydev,MDIO_MMD_AN,MDIO_AN_EEE_ADV);-if(eee_adv<=0)-gotoeee_exit_err;--mmd_eee_adv_to_linkmode(adv,eee_adv);-mmd_eee_adv_to_linkmode(lp,eee_lp);-linkmode_and(common,adv,lp);--if(!phy_check_valid(phydev->speed,phydev->duplex,common))-gotoeee_exit_err;+ret=genphy_c45_eee_is_active(phydev,NULL,NULL,NULL);+if(ret<0)+returnret;+if(!ret)+return-EPROTONOSUPPORT;-if(clk_stop_enable)-/* Configure the PHY to stop receiving xMII-*clockwhileitissignalingLPI.-*/-phy_set_bits_mmd(phydev,MDIO_MMD_PCS,MDIO_CTRL1,-MDIO_PCS_CTRL1_CLKSTOP_EN);+if(clk_stop_enable)+/* Configure the PHY to stop receiving xMII+*clockwhileitissignalingLPI.+*/+ret=phy_set_bits_mmd(phydev,MDIO_MMD_PCS,MDIO_CTRL1,+MDIO_PCS_CTRL1_CLKSTOP_EN);-return0;/* EEE supported */-}-eee_exit_err:-return-EPROTONOSUPPORT;+returnret<0?ret:0;}EXPORT_SYMBOL(phy_init_eee);
This function will be needed for genphy_c45_ethtool_get_eee() provided
by next patch.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
---
drivers/net/phy/phy.c | 4 ++--
include/linux/phy.h | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
Add generic function for EEE abilities defined by IEEE 802.3
specification. For now following registers are supported:
- IEEE 802.3-2018 45.2.3.10 EEE control and capability 1 (Register 3.20)
- IEEE 802.3cg-2019 45.2.1.186b 10BASE-T1L PMA status register
(Register 1.2295)
Since I was not able to find any flag signaling support of these
registers, we should detect link mode abilities first and then based on
these abilities doing EEE link modes detection.
Results of EEE ability detection will be stored into new variable
phydev->supported_eee.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/phy/phy-c45.c | 70 ++++++++++++++++++++++++++++++++++++
drivers/net/phy/phy_device.c | 16 +++++++++
include/linux/mdio.h | 26 ++++++++++++++
include/linux/phy.h | 6 ++++
4 files changed, 118 insertions(+)
@@ -661,6 +661,76 @@ int genphy_c45_read_mdix(struct phy_device *phydev)}EXPORT_SYMBOL_GPL(genphy_c45_read_mdix);+/**+*genphy_c45_read_eee_cap1-readsupportedEEElinkmodesfromregister3.20+*@phydev:targetphy_devicestruct+*/+staticintgenphy_c45_read_eee_cap1(structphy_device*phydev)+{+intval;++/* IEEE 802.3-2018 45.2.3.10 EEE control and capability 1+*(Register3.20)+*/+val=phy_read_mmd(phydev,MDIO_MMD_PCS,MDIO_PCS_EEE_ABLE);+if(val<0)+returnval;++/* The 802.3 2018 standard says the top 2 bits are reserved and should+*readas0.Also,itseemsunlikelyanybodywillbuildaPHYwhich+*supports100GBASE-Rdeepsleepallthewaydownto100BASE-TXEEE.+*IfMDIO_PCS_EEE_ABLEis0xffffassumeEEEisnotsupported.+*/+if(val==0xffff)+return0;++mii_eee_cap1_mod_linkmode_t(phydev->supported_eee,val);++/* Some buggy devices indicate EEE link modes in MDIO_PCS_EEE_ABLE+*whichtheydon'tsupportasindicatedbyBMSR,ESTATUSetc.+*/+linkmode_and(phydev->supported_eee,phydev->supported_eee,+phydev->supported);++return0;+}++/**+*genphy_c45_read_eee_abilities-readsupportedEEElinkmodes+*@phydev:targetphy_devicestruct+*/+intgenphy_c45_read_eee_abilities(structphy_device*phydev)+{+intval;++/* There is not indicator whether optional register+*"EEE control and capability 1"(3.20)issupported.Readitonly+*ondeviceswithappropriatelinkmodes.+*/+if(linkmode_intersects(phydev->supported,PHY_EEE_CAP1_FEATURES)){+val=genphy_c45_read_eee_cap1(phydev);+if(val)+returnval;+}++if(linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT,+phydev->supported)){+/* IEEE 802.3cg-2019 45.2.1.186b 10BASE-T1L PMA status register+*(Register1.2295)+*/+val=phy_read_mmd(phydev,MDIO_MMD_PMAPMD,MDIO_PMA_10T1L_STAT);+if(val<0)+returnval;++linkmode_mod_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT,+phydev->supported_eee,+val&MDIO_PMA_10T1L_STAT_EEE);+}++return0;+}+EXPORT_SYMBOL_GPL(genphy_c45_read_eee_abilities);+/***genphy_c45_pma_read_abilities-readsupportedlinkmodesfromPMA*@phydev:targetphy_devicestruct
@@ -676,6 +679,8 @@ struct phy_device {__ETHTOOL_DECLARE_LINK_MODE_MASK(lp_advertising);/* used with phy_speed_down */__ETHTOOL_DECLARE_LINK_MODE_MASK(adv_old);+/* used for eee validation */+__ETHTOOL_DECLARE_LINK_MODE_MASK(supported_eee);/* Host supported PHY interface types. Should be ignored if empty. */DECLARE_PHY_INTERFACE_MASK(host_interfaces);
@@ -1737,6 +1742,7 @@ int genphy_c45_an_config_aneg(struct phy_device *phydev);intgenphy_c45_an_disable_aneg(structphy_device*phydev);intgenphy_c45_read_mdix(structphy_device*phydev);intgenphy_c45_pma_read_abilities(structphy_device*phydev);+intgenphy_c45_read_eee_abilities(structphy_device*phydev);intgenphy_c45_pma_baset1_read_master_slave(structphy_device*phydev);intgenphy_c45_read_status(structphy_device*phydev);intgenphy_c45_baset1_read_status(structphy_device*phydev);
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/phy/phy_device.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
@@ -2231,7 +2231,10 @@ int __genphy_config_aneg(struct phy_device *phydev, bool changed){interr;-if(genphy_config_eee_advert(phydev))+err=genphy_c45_write_eee_adv(phydev,phydev->supported_eee);+if(err<0)+returnerr;+elseif(err)changed=true;err=genphy_setup_master_slave(phydev);
@@ -2653,6 +2656,11 @@ int genphy_read_abilities(struct phy_device *phydev)phydev->supported,val&ESTATUS_1000_XFULL);}+/* This is optional functionality. If not supported, we may get an error+*whichshouldbeignored.+*/+genphy_c45_read_eee_abilities(phydev);+return0;}EXPORT_SYMBOL(genphy_read_abilities);
Some of KSZ9477 family switches provides EEE support. To enable it, we
just need to register set_mac_eee/set_mac_eee handlers and validate
supported chip version and port.
Currently supported chip variants are: KSZ8563, KSZ9477, KSZ9563,
KSZ9567, KSZ9893, KSZ9896, KSZ9897. KSZ8563 supports EEE only with
100BaseTX/Full. Other chips support 100BaseTX/Full and 1000BaseTX/Full.
Low Power Idle configuration is not supported and currently not
documented in the datasheets.
EEE PHY specific tunings are not documented in the switch datasheets, but can
overlap with KSZ9131 specification.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
---
drivers/net/dsa/microchip/ksz_common.c | 66 ++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
@@ -2673,6 +2673,70 @@ static int ksz_max_mtu(struct dsa_switch *ds, int port)return-EOPNOTSUPP;}+staticintksz_validate_eee(structdsa_switch*ds,intport)+{+structksz_device*dev=ds->priv;++if(!dev->info->internal_phy[port])+return-EOPNOTSUPP;++switch(dev->chip_id){+caseKSZ8563_CHIP_ID:+caseKSZ9477_CHIP_ID:+caseKSZ9563_CHIP_ID:+caseKSZ9567_CHIP_ID:+caseKSZ9893_CHIP_ID:+caseKSZ9896_CHIP_ID:+caseKSZ9897_CHIP_ID:+return0;+}++return-EOPNOTSUPP;+}++staticintksz_get_mac_eee(structdsa_switch*ds,intport,+structethtool_eee*e)+{+intret;++ret=ksz_validate_eee(ds,port);+if(ret)+returnret;++/* There is no documented control of Tx LPI configuration. */+e->tx_lpi_enabled=true;++/* There is no documented control of Tx LPI timer. According to tests+*TxLPItimerseemstobesetbydefaulttominimalvalue.+*/+e->tx_lpi_timer=0;++return0;+}++staticintksz_set_mac_eee(structdsa_switch*ds,intport,+structethtool_eee*e)+{+structksz_device*dev=ds->priv;+intret;++ret=ksz_validate_eee(ds,port);+if(ret)+returnret;++if(!e->tx_lpi_enabled){+dev_err(dev->dev,"Disabling EEE Tx LPI is not supported\n");+return-EINVAL;+}++if(e->tx_lpi_timer){+dev_err(dev->dev,"Setting EEE Tx LPI timer is not supported\n");+return-EINVAL;+}++return0;+}+staticvoidksz_set_xmii(structksz_device*dev,intport,phy_interface_tinterface){
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/phy/phy-c45.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
@@ -262,7 +262,11 @@ int genphy_c45_an_config_aneg(struct phy_device *phydev)linkmode_and(phydev->advertising,phydev->advertising,phydev->supported);-changed=genphy_config_eee_advert(phydev);+ret=genphy_c45_write_eee_adv(phydev,phydev->supported_eee);+if(ret<0)+returnret;+elseif(ret)+changed=true;if(genphy_c45_baset1_able(phydev))returngenphy_c45_baset1_an_config_aneg(phydev);
@@ -968,6 +972,11 @@ int genphy_c45_pma_read_abilities(struct phy_device *phydev)}}+/* This is optional functionality. If not supported, we may get an error+*whichshouldbeignored.+*/+genphy_c45_read_eee_abilities(phydev);+return0;}EXPORT_SYMBOL_GPL(genphy_c45_pma_read_abilities);
KSZ8563R, which has same PHYID as KSZ9477 family, will change "EEE control
and capability 1" (Register 3.20) content depending on configuration of
"EEE advertisement 1" (Register 7.60). Changes on the 7.60 will affect
3.20 register.
So, instead of depending on register 3.20, driver should set supported_eee.
Proper supported_eee configuration is needed to make use of generic
PHY c45 set/get_eee functions provided by next patches.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
drivers/net/phy/micrel.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
Add replacement for phy_ethtool_get/set_eee() functions.
Current phy_ethtool_get/set_eee() implementation is great and it is
possible to make it even better:
- this functionality is for devices implementing parts of IEEE 802.3
specification beyond Clause 22. The better place for this code is
phy-c45.c
- currently it is able to do read/write operations on PHYs with
different abilities to not existing registers. It is better to
use stored supported_eee abilities to avoid false read/write
operations.
- the eee_active detection will provide wrong results on not supported
link modes. It is better to validate speed/duplex properties against
supported EEE link modes.
- it is able to support only limited amount of link modes. We have more
EEE link modes...
By refactoring this code I address most of this point except of the last
one. Adding additional EEE link modes will need more work.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
drivers/net/phy/phy-c45.c | 238 ++++++++++++++++++++++++++++++++++++++
include/linux/mdio.h | 58 ++++++++++
include/linux/phy.h | 7 ++
include/uapi/linux/mdio.h | 8 ++
4 files changed, 311 insertions(+)
@@ -661,6 +661,129 @@ int genphy_c45_read_mdix(struct phy_device *phydev)}EXPORT_SYMBOL_GPL(genphy_c45_read_mdix);+/**+*genphy_c45_write_eee_adv-writeadvertisedEEElinkmodes+*@phydev:targetphy_devicestruct+*@adv:thelinkmodeadvertisementsettings+*/+intgenphy_c45_write_eee_adv(structphy_device*phydev,unsignedlong*adv)+{+intval,changed;++if(linkmode_intersects(phydev->supported,PHY_EEE_CAP1_FEATURES)){+val=linkmode_to_mii_eee_cap1_t(adv);++/* In eee_broken_modes are stored MDIO_AN_EEE_ADV specific raw+*registervalues.+*/+val&=~phydev->eee_broken_modes;++/* IEEE 802.3-2018 45.2.7.13 EEE advertisement 1+*(Register7.60)+*/+val=phy_modify_mmd_changed(phydev,MDIO_MMD_AN,+MDIO_AN_EEE_ADV,+MDIO_EEE_100TX|MDIO_EEE_1000T|+MDIO_EEE_10GT|MDIO_EEE_1000KX|+MDIO_EEE_10GKX4|MDIO_EEE_10GKR,+val);+if(val<0)+returnval;+if(val>0)+changed=1;+}++if(linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT,+phydev->supported_eee)){+val=linkmode_adv_to_mii_10base_t1_t(adv);+/* IEEE 802.3cg-2019 45.2.7.25 10BASE-T1 AN control register+*(Register7.526)+*/+val=phy_modify_mmd_changed(phydev,MDIO_MMD_AN,+MDIO_AN_10BT1_AN_CTRL,+MDIO_AN_10BT1_AN_CTRL_ADV_EEE_T1L,+val);+if(val<0)+returnval;+if(val>0)+changed=1;+}++returnchanged;+}++/**+*genphy_c45_read_eee_adv-readadvertisedEEElinkmodes+*@phydev:targetphy_devicestruct+*@adv:thelinkmodeadvertisementstatus+*/+staticintgenphy_c45_read_eee_adv(structphy_device*phydev,+unsignedlong*adv)+{+intval;++if(linkmode_intersects(phydev->supported,PHY_EEE_CAP1_FEATURES)){+/* IEEE 802.3-2018 45.2.7.13 EEE advertisement 1+*(Register7.60)+*/+val=phy_read_mmd(phydev,MDIO_MMD_AN,MDIO_AN_EEE_ADV);+if(val<0)+returnval;++mii_eee_cap1_mod_linkmode_t(adv,val);+}++if(linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT,+phydev->supported_eee)){+/* IEEE 802.3cg-2019 45.2.7.25 10BASE-T1 AN control register+*(Register7.526)+*/+val=phy_read_mmd(phydev,MDIO_MMD_AN,MDIO_AN_10BT1_AN_CTRL);+if(val<0)+returnval;++mii_10base_t1_adv_mod_linkmode_t(adv,val);+}++return0;+}++/**+*genphy_c45_read_eee_lpa-readadvertisedLPEEElinkmodes+*@phydev:targetphy_devicestruct+*@lpa:thelinkmodeLPadvertisementstatus+*/+staticintgenphy_c45_read_eee_lpa(structphy_device*phydev,+unsignedlong*lpa)+{+intval;++if(linkmode_intersects(phydev->supported,PHY_EEE_CAP1_FEATURES)){+/* IEEE 802.3-2018 45.2.7.14 EEE link partner ability 1+*(Register7.61)+*/+val=phy_read_mmd(phydev,MDIO_MMD_AN,MDIO_AN_EEE_LPABLE);+if(val<0)+returnval;++mii_eee_cap1_mod_linkmode_t(lpa,val);+}++if(linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1L_Full_BIT,+phydev->supported_eee)){+/* IEEE 802.3cg-2019 45.2.7.26 10BASE-T1 AN status register+*(Register7.527)+*/+val=phy_read_mmd(phydev,MDIO_MMD_AN,MDIO_AN_10BT1_AN_STAT);+if(val<0)+returnval;++mii_10base_t1_adv_mod_linkmode_t(lpa,val);+}++return0;+}+/***genphy_c45_read_eee_cap1-readsupportedEEElinkmodesfromregister3.20*@phydev:targetphy_devicestruct
@@ -1194,6 +1317,121 @@ int genphy_c45_plca_get_status(struct phy_device *phydev,}EXPORT_SYMBOL_GPL(genphy_c45_plca_get_status);+/**+*genphy_c45_eee_is_active-getEEEstatus+*@phydev:targetphy_devicestruct+*@adv:variabletostoreadvertisedlinkmodes+*@lp:variabletostoreLPadvertisedlinkmodes+*@is_enabled:variabletostoreEEEenabled/disabledconfigurationvalue+*+*Description:thisfunctionwillreadlocalandlinkpartnerPHY+*advertisements.ComparethemreturncurrentEEEstate.+*/+intgenphy_c45_eee_is_active(structphy_device*phydev,unsignedlong*adv,+unsignedlong*lp,bool*is_enabled)+{+__ETHTOOL_DECLARE_LINK_MODE_MASK(tmp_adv)={};+__ETHTOOL_DECLARE_LINK_MODE_MASK(tmp_lp)={};+__ETHTOOL_DECLARE_LINK_MODE_MASK(common);+booleee_enabled,eee_active;+intret;++ret=genphy_c45_read_eee_adv(phydev,tmp_adv);+if(ret)+returnret;++ret=genphy_c45_read_eee_lpa(phydev,tmp_lp);+if(ret)+returnret;++eee_enabled=!linkmode_empty(tmp_adv);+linkmode_and(common,tmp_adv,tmp_lp);+if(eee_enabled&&!linkmode_empty(common))+eee_active=phy_check_valid(phydev->speed,phydev->duplex,+common);+else+eee_active=false;++if(adv)+linkmode_copy(adv,tmp_adv);+if(lp)+linkmode_copy(lp,tmp_lp);+if(is_enabled)+*is_enabled=eee_enabled;++returneee_active;+}+EXPORT_SYMBOL(genphy_c45_eee_is_active);++/**+*genphy_c45_ethtool_get_eee-getEEEsupportedandstatus+*@phydev:targetphy_devicestruct+*@data:ethtool_eeedata+*+*Description:itreportstheSupported/Advertisement/LPAdvertisement+*capabilities.+*/+intgenphy_c45_ethtool_get_eee(structphy_device*phydev,+structethtool_eee*data)+{+__ETHTOOL_DECLARE_LINK_MODE_MASK(adv)={};+__ETHTOOL_DECLARE_LINK_MODE_MASK(lp)={};+booloverflow=false,is_enabled;+intret;++ret=genphy_c45_eee_is_active(phydev,adv,lp,&is_enabled);+if(ret<0)+returnret;++data->eee_enabled=is_enabled;+data->eee_active=ret;++if(!ethtool_convert_link_mode_to_legacy_u32(&data->supported,+phydev->supported_eee))+overflow=true;+if(!ethtool_convert_link_mode_to_legacy_u32(&data->advertised,adv))+overflow=true;+if(!ethtool_convert_link_mode_to_legacy_u32(&data->lp_advertised,lp))+overflow=true;++if(overflow)+phydev_warn(phydev,"Not all supported or advertised EEE link modes were passed to the user space\n");++return0;+}+EXPORT_SYMBOL(genphy_c45_ethtool_get_eee);++/**+*genphy_c45_ethtool_set_eee-getEEEsupportedandstatus+*@phydev:targetphy_devicestruct+*@data:ethtool_eeedata+*+*Description:itreportestheSupported/Advertisement/LPAdvertisement+*capabilities.+*/+intgenphy_c45_ethtool_set_eee(structphy_device*phydev,+structethtool_eee*data)+{+__ETHTOOL_DECLARE_LINK_MODE_MASK(adv)={};+intret;++if(data->eee_enabled){+if(data->advertised)+adv[0]=data->advertised;+else+linkmode_copy(adv,phydev->supported_eee);+}++ret=genphy_c45_write_eee_adv(phydev,adv);+if(ret<0)+returnret;+if(ret>0)+returnphy_restart_aneg(phydev);++return0;+}+EXPORT_SYMBOL(genphy_c45_ethtool_set_eee);+structphy_drivergenphy_c45_driver={.phy_id=0xffffffff,.phy_id_mask=0xffffffff,
@@ -79,6 +79,8 @@#define MDIO_AN_T1_LP_L 517 /* BASE-T1 AN LP Base Page ability register [15:0] */#define MDIO_AN_T1_LP_M 518 /* BASE-T1 AN LP Base Page ability register [31:16] */#define MDIO_AN_T1_LP_H 519 /* BASE-T1 AN LP Base Page ability register [47:32] */+#define MDIO_AN_10BT1_AN_CTRL 526 /* 10BASE-T1 AN control register */+#define MDIO_AN_10BT1_AN_STAT 527 /* 10BASE-T1 AN status register */#define MDIO_PMA_PMD_BT1_CTRL 2100 /* BASE-T1 PMA/PMD control register *//* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */
@@ -340,6 +342,12 @@#define MDIO_AN_T1_LP_H_10L_TX_HI_REQ 0x1000 /* 10BASE-T1L High Level LP Transmit Request */#define MDIO_AN_T1_LP_H_10L_TX_HI 0x2000 /* 10BASE-T1L High Level LP Transmit Ability */+/* 10BASE-T1 AN control register */+#define MDIO_AN_10BT1_AN_CTRL_ADV_EEE_T1L 0x4000 /* 10BASE-T1L EEE ability advertisement */++/* 10BASE-T1 AN status register */+#define MDIO_AN_10BT1_AN_STAT_LPA_EEE_T1L 0x4000 /* 10BASE-T1L LP EEE ability advertisement */+/* BASE-T1 PMA/PMD control register */#define MDIO_PMA_PMD_BT1_CTRL_CFG_MST 0x4000 /* MASTER-SLAVE config value */
On Sat, Feb 11, 2023 at 08:41:10AM +0100, Oleksij Rempel wrote:
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This patch causes network interface failures with all my xtensa qemu
emulations. Reverting it fixes the problem. Bisect log is attached
for reference.
Guenter
---
# bad: [e4bc15889506723d7b93c053ad4a75cd58248d74] Merge tag 'leds-next-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds
# good: [c9c3395d5e3dcc6daee66c6908354d47bf98cb0c] Linux 6.2
git bisect start 'HEAD' 'c9c3395d5e3d'
# bad: [5b7c4cabbb65f5c469464da6c5f614cbd7f730f2] Merge tag 'net-next-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
git bisect bad 5b7c4cabbb65f5c469464da6c5f614cbd7f730f2
# good: [877934769e5b91798d304d4641647900ee614ce8] Merge tag 'x86_cpu_for_v6.3_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect good 877934769e5b91798d304d4641647900ee614ce8
# good: [c5ebba75c7625e5cb62cb5423883cc3764779420] net: ipa: use bitmasks for GSI IRQ values
git bisect good c5ebba75c7625e5cb62cb5423883cc3764779420
# bad: [871489dd01b67483248edc8873c389a66e469f30] Merge tag 'ieee802154-for-net-next-2023-02-20' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan-next
git bisect bad 871489dd01b67483248edc8873c389a66e469f30
# good: [986e43b19ae9176093da35e0a844e65c8bf9ede7] wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces
git bisect good 986e43b19ae9176093da35e0a844e65c8bf9ede7
# bad: [ca0df43d211039dded5a8f8553356414c9a74731] Merge tag 'wireless-next-2023-03-16' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next
git bisect bad ca0df43d211039dded5a8f8553356414c9a74731
# bad: [388a9c907a51489bf566165c72e4e8aa4d62ab49] Merge branch 'devlink-cleanups-and-move-devlink-health-functionality-to-separate-file'
git bisect bad 388a9c907a51489bf566165c72e4e8aa4d62ab49
# bad: [1a940b00013a468c0c9dd79dbb485c3ad273939e] net: stmmac: dwc-qos: Make struct dwc_eth_dwmac_data::remove return void
git bisect bad 1a940b00013a468c0c9dd79dbb485c3ad273939e
# good: [8024edf3590c83f467374857d7c3082d4b3bf079] Merge branch 'net-ipa-GSI-regs'
git bisect good 8024edf3590c83f467374857d7c3082d4b3bf079
# bad: [9b01c885be364526d8c05794f8358b3e563b7ff8] net: phy: c22: migrate to genphy_c45_write_eee_adv()
git bisect bad 9b01c885be364526d8c05794f8358b3e563b7ff8
# good: [79cdf17e5131ccdee0792f6f25d3db0e34861998] Merge branch 'ionic-on-chip-desc'
git bisect good 79cdf17e5131ccdee0792f6f25d3db0e34861998
# good: [48fb19940f2ba6b50dfea70f671be9340fb63d60] net: phy: micrel: add ksz9477_get_features()
git bisect good 48fb19940f2ba6b50dfea70f671be9340fb63d60
# good: [022c3f87f88e2d68e90be7687d981c9cb893a3b1] net: phy: add genphy_c45_ethtool_get/set_eee() support
git bisect good 022c3f87f88e2d68e90be7687d981c9cb893a3b1
# first bad commit: [9b01c885be364526d8c05794f8358b3e563b7ff8] net: phy: c22: migrate to genphy_c45_write_eee_adv()
On Thu, Feb 23, 2023 at 07:55:55PM -0800, Guenter Roeck wrote:
On Sat, Feb 11, 2023 at 08:41:10AM +0100, Oleksij Rempel wrote:
quoted
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This patch causes network interface failures with all my xtensa qemu
emulations. Reverting it fixes the problem. Bisect log is attached
for reference.
Also affected are arm:cubieboard emulations, with same symptom.
arm:bletchley-bmc emulations crash. In both cases, reverting this patch
fixes the problem.
Guenter
Hallo Guenter,
On Thu, Feb 23, 2023 at 08:16:04PM -0800, Guenter Roeck wrote:
On Thu, Feb 23, 2023 at 07:55:55PM -0800, Guenter Roeck wrote:
quoted
On Sat, Feb 11, 2023 at 08:41:10AM +0100, Oleksij Rempel wrote:
quoted
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This patch causes network interface failures with all my xtensa qemu
emulations. Reverting it fixes the problem. Bisect log is attached
for reference.
Also affected are arm:cubieboard emulations, with same symptom.
arm:bletchley-bmc emulations crash. In both cases, reverting this patch
fixes the problem.
Hallo Guenter,
On Thu, Feb 23, 2023 at 08:16:04PM -0800, Guenter Roeck wrote:
quoted
On Thu, Feb 23, 2023 at 07:55:55PM -0800, Guenter Roeck wrote:
quoted
On Sat, Feb 11, 2023 at 08:41:10AM +0100, Oleksij Rempel wrote:
quoted
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This patch causes network interface failures with all my xtensa qemu
emulations. Reverting it fixes the problem. Bisect log is attached
for reference.
Also affected are arm:cubieboard emulations, with same symptom.
arm:bletchley-bmc emulations crash. In both cases, reverting this patch
fixes the problem.
Applied and tested
77c39beb5efa (HEAD -> master) net: phy: c45: genphy_c45_ethtool_set_eee: validate EEE link modes
068a35a8d62c net: phy: do not force EEE support
66d358a5fac6 net: phy: c45: add genphy_c45_an_config_eee_aneg() function
ecea1bf8b04c net: phy: c45: use "supported_eee" instead of supported for access validation
on top of
d2980d8d8265 (upstream/master, origin/master, origin/HEAD, local/master) Merge tag 'mm-nonmm-stable-2023-02-20-15-29' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
No change for xtensa and arm:cubieboard; network interfaces still fail.
On the plus side, the failures with arm:bletchley-bmc (warnings, crash)
are longer seen.
Guenter
On Fri, Feb 24, 2023 at 08:00:57AM -0800, Guenter Roeck wrote:
On 2/23/23 20:53, Oleksij Rempel wrote:
quoted
Hallo Guenter,
On Thu, Feb 23, 2023 at 08:16:04PM -0800, Guenter Roeck wrote:
quoted
On Thu, Feb 23, 2023 at 07:55:55PM -0800, Guenter Roeck wrote:
quoted
On Sat, Feb 11, 2023 at 08:41:10AM +0100, Oleksij Rempel wrote:
quoted
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This patch causes network interface failures with all my xtensa qemu
emulations. Reverting it fixes the problem. Bisect log is attached
for reference.
Also affected are arm:cubieboard emulations, with same symptom.
arm:bletchley-bmc emulations crash. In both cases, reverting this patch
fixes the problem.
Applied and tested
77c39beb5efa (HEAD -> master) net: phy: c45: genphy_c45_ethtool_set_eee: validate EEE link modes
068a35a8d62c net: phy: do not force EEE support
66d358a5fac6 net: phy: c45: add genphy_c45_an_config_eee_aneg() function
ecea1bf8b04c net: phy: c45: use "supported_eee" instead of supported for access validation
on top of
d2980d8d8265 (upstream/master, origin/master, origin/HEAD, local/master) Merge tag 'mm-nonmm-stable-2023-02-20-15-29' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
No change for xtensa and arm:cubieboard; network interfaces still fail.
Huh, interesting.
can you please send me the kernel logs.
On the plus side, the failures with arm:bletchley-bmc (warnings, crash)
are longer seen.
Copying regzbot.
#regzbot ^introduced 9b01c885be36
#regzbot title Network interface initialization failures on xtensa, arm:cubieboard
#regzbot ignore-activity
On Thu, Feb 23, 2023 at 08:16:06PM -0800, Guenter Roeck wrote:
On Thu, Feb 23, 2023 at 07:55:55PM -0800, Guenter Roeck wrote:
quoted
On Sat, Feb 11, 2023 at 08:41:10AM +0100, Oleksij Rempel wrote:
quoted
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This patch causes network interface failures with all my xtensa qemu
emulations. Reverting it fixes the problem. Bisect log is attached
for reference.
Also affected are arm:cubieboard emulations, with same symptom.
arm:bletchley-bmc emulations crash. In both cases, reverting this patch
fixes the problem.
Guenter
On Fri, Feb 24, 2023 at 05:52:13PM +0100, Oleksij Rempel wrote:
On Fri, Feb 24, 2023 at 08:00:57AM -0800, Guenter Roeck wrote:
quoted
On 2/23/23 20:53, Oleksij Rempel wrote:
quoted
Hallo Guenter,
On Thu, Feb 23, 2023 at 08:16:04PM -0800, Guenter Roeck wrote:
quoted
On Thu, Feb 23, 2023 at 07:55:55PM -0800, Guenter Roeck wrote:
quoted
On Sat, Feb 11, 2023 at 08:41:10AM +0100, Oleksij Rempel wrote:
quoted
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This patch causes network interface failures with all my xtensa qemu
emulations. Reverting it fixes the problem. Bisect log is attached
for reference.
Also affected are arm:cubieboard emulations, with same symptom.
arm:bletchley-bmc emulations crash. In both cases, reverting this patch
fixes the problem.
Applied and tested
77c39beb5efa (HEAD -> master) net: phy: c45: genphy_c45_ethtool_set_eee: validate EEE link modes
068a35a8d62c net: phy: do not force EEE support
66d358a5fac6 net: phy: c45: add genphy_c45_an_config_eee_aneg() function
ecea1bf8b04c net: phy: c45: use "supported_eee" instead of supported for access validation
on top of
d2980d8d8265 (upstream/master, origin/master, origin/HEAD, local/master) Merge tag 'mm-nonmm-stable-2023-02-20-15-29' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
No change for xtensa and arm:cubieboard; network interfaces still fail.
Huh, interesting.
can you please send me the kernel logs.
On Fri, Feb 24, 2023 at 09:41:32AM -0800, Guenter Roeck wrote:
On Fri, Feb 24, 2023 at 05:52:13PM +0100, Oleksij Rempel wrote:
quoted
On Fri, Feb 24, 2023 at 08:00:57AM -0800, Guenter Roeck wrote:
quoted
On 2/23/23 20:53, Oleksij Rempel wrote:
quoted
Hallo Guenter,
On Thu, Feb 23, 2023 at 08:16:04PM -0800, Guenter Roeck wrote:
quoted
On Thu, Feb 23, 2023 at 07:55:55PM -0800, Guenter Roeck wrote:
quoted
On Sat, Feb 11, 2023 at 08:41:10AM +0100, Oleksij Rempel wrote:
quoted
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This patch causes network interface failures with all my xtensa qemu
emulations. Reverting it fixes the problem. Bisect log is attached
for reference.
Also affected are arm:cubieboard emulations, with same symptom.
arm:bletchley-bmc emulations crash. In both cases, reverting this patch
fixes the problem.
Applied and tested
77c39beb5efa (HEAD -> master) net: phy: c45: genphy_c45_ethtool_set_eee: validate EEE link modes
068a35a8d62c net: phy: do not force EEE support
66d358a5fac6 net: phy: c45: add genphy_c45_an_config_eee_aneg() function
ecea1bf8b04c net: phy: c45: use "supported_eee" instead of supported for access validation
on top of
d2980d8d8265 (upstream/master, origin/master, origin/HEAD, local/master) Merge tag 'mm-nonmm-stable-2023-02-20-15-29' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
No change for xtensa and arm:cubieboard; network interfaces still fail.
Huh, interesting.
can you please send me the kernel logs.
OK, interesting. These are emulated PHYs. QEMU seems to return 0 or
0xFFFF on unsupported registers. May be I'm wrong.
All EEE read/write accesses depend on initial capability read
genphy_c45_read_eee_cap1()
Can you please add this trace:
On Fri, Feb 24, 2023 at 09:41:32AM -0800, Guenter Roeck wrote:
quoted
On Fri, Feb 24, 2023 at 05:52:13PM +0100, Oleksij Rempel wrote:
quoted
On Fri, Feb 24, 2023 at 08:00:57AM -0800, Guenter Roeck wrote:
quoted
On 2/23/23 20:53, Oleksij Rempel wrote:
quoted
Hallo Guenter,
On Thu, Feb 23, 2023 at 08:16:04PM -0800, Guenter Roeck wrote:
quoted
On Thu, Feb 23, 2023 at 07:55:55PM -0800, Guenter Roeck wrote:
quoted
On Sat, Feb 11, 2023 at 08:41:10AM +0100, Oleksij Rempel wrote:
quoted
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This patch causes network interface failures with all my xtensa qemu
emulations. Reverting it fixes the problem. Bisect log is attached
for reference.
Also affected are arm:cubieboard emulations, with same symptom.
arm:bletchley-bmc emulations crash. In both cases, reverting this patch
fixes the problem.
Applied and tested
77c39beb5efa (HEAD -> master) net: phy: c45: genphy_c45_ethtool_set_eee: validate EEE link modes
068a35a8d62c net: phy: do not force EEE support
66d358a5fac6 net: phy: c45: add genphy_c45_an_config_eee_aneg() function
ecea1bf8b04c net: phy: c45: use "supported_eee" instead of supported for access validation
on top of
d2980d8d8265 (upstream/master, origin/master, origin/HEAD, local/master) Merge tag 'mm-nonmm-stable-2023-02-20-15-29' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
No change for xtensa and arm:cubieboard; network interfaces still fail.
Huh, interesting.
can you please send me the kernel logs.
OK, interesting. These are emulated PHYs. QEMU seems to return 0 or
0xFFFF on unsupported registers. May be I'm wrong.
All EEE read/write accesses depend on initial capability read
genphy_c45_read_eee_cap1()
Can you please add this trace:
For cubieboard:
MDIO_PCS_EEE_ABLE = 0x0000
qemu reports attempts to access unsupported registers.
I had a look at the Allwinner mdio driver. There is no indication suggesting
what the real hardware would return when trying to access unsupported registers,
and the Ethernet controller datasheet is not public.
For xtensa:
MDIO_PCS_EEE_ABLE = 0x0014
I didn't try to find out what that means.
qemu did not report attempts to access unsupported registers.
Guenter
On Fri, Feb 24, 2023 at 11:17:24AM -0800, Guenter Roeck wrote:
On 2/24/23 10:36, Oleksij Rempel wrote:
quoted
On Fri, Feb 24, 2023 at 09:41:32AM -0800, Guenter Roeck wrote:
quoted
On Fri, Feb 24, 2023 at 05:52:13PM +0100, Oleksij Rempel wrote:
quoted
On Fri, Feb 24, 2023 at 08:00:57AM -0800, Guenter Roeck wrote:
quoted
On 2/23/23 20:53, Oleksij Rempel wrote:
quoted
Hallo Guenter,
On Thu, Feb 23, 2023 at 08:16:04PM -0800, Guenter Roeck wrote:
quoted
On Thu, Feb 23, 2023 at 07:55:55PM -0800, Guenter Roeck wrote:
quoted
On Sat, Feb 11, 2023 at 08:41:10AM +0100, Oleksij Rempel wrote:
quoted
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This patch causes network interface failures with all my xtensa qemu
emulations. Reverting it fixes the problem. Bisect log is attached
for reference.
Also affected are arm:cubieboard emulations, with same symptom.
arm:bletchley-bmc emulations crash. In both cases, reverting this patch
fixes the problem.
Applied and tested
77c39beb5efa (HEAD -> master) net: phy: c45: genphy_c45_ethtool_set_eee: validate EEE link modes
068a35a8d62c net: phy: do not force EEE support
66d358a5fac6 net: phy: c45: add genphy_c45_an_config_eee_aneg() function
ecea1bf8b04c net: phy: c45: use "supported_eee" instead of supported for access validation
on top of
d2980d8d8265 (upstream/master, origin/master, origin/HEAD, local/master) Merge tag 'mm-nonmm-stable-2023-02-20-15-29' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
No change for xtensa and arm:cubieboard; network interfaces still fail.
Huh, interesting.
can you please send me the kernel logs.
OK, interesting. These are emulated PHYs. QEMU seems to return 0 or
0xFFFF on unsupported registers. May be I'm wrong.
All EEE read/write accesses depend on initial capability read
genphy_c45_read_eee_cap1()
Can you please add this trace:
For cubieboard:
MDIO_PCS_EEE_ABLE = 0x0000
qemu reports attempts to access unsupported registers.
I had a look at the Allwinner mdio driver. There is no indication suggesting
what the real hardware would return when trying to access unsupported registers,
and the Ethernet controller datasheet is not public.
These are PHY accesses over MDIO bus. Ethernet controller should not
care about content of this operations. But on qemu side, it is implemented as
part of Ethernet controller emulation...
Since MDIO_PCS_EEE_ABLE == 0x0000, phydev->supported_eee should prevent
other EEE related operations. But may be actual phy_read_mmd() went
wrong. It is a combination of simple phy_read/write to different
registers.
For xtensa:
MDIO_PCS_EEE_ABLE = 0x0014
I didn't try to find out what that means.
These will be interpreted as the PHY supports 1000KX and 1000T EEE modes.
Starting from this point all EEE read write operations will be allowed.
qemu did not report attempts to access unsupported registers.
Hm. What is the best way to proceed? Remove genphy_c45_read_eee_abilities()
out of genphy_read_abilities() and let add it to PHYs known to support
it? Or go deeper and fix QEMU if needed?
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
For cubieboard:
MDIO_PCS_EEE_ABLE = 0x0000
qemu reports attempts to access unsupported registers.
I had a look at the Allwinner mdio driver. There is no indication suggesting
what the real hardware would return when trying to access unsupported registers,
and the Ethernet controller datasheet is not public.
These are PHY accesses over MDIO bus. Ethernet controller should not
care about content of this operations. But on qemu side, it is implemented as
part of Ethernet controller emulation...
Since MDIO_PCS_EEE_ABLE == 0x0000, phydev->supported_eee should prevent
other EEE related operations. But may be actual phy_read_mmd() went
wrong. It is a combination of simple phy_read/write to different
registers.
Adding MDD read/write support in qemu doesn't help. Something else in your patch
prevents the PHY from coming up. After reverting your patch, I see
sun4i-emac 1c0b000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
in the log. This is missing with your patch in place.
Anyway, the key difference is not really the qemu emulation, but the added
unconditional call to genphy_c45_write_eee_adv() in your patch. If you look
closely into that function, you may notice that the 'changed' variable is
never set to 0.
On Fri, Feb 24, 2023 at 04:09:40PM -0800, Guenter Roeck wrote:
quoted hunk
On 2/24/23 12:02, Oleksij Rempel wrote:
[ ... ]
quoted
quoted
For cubieboard:
MDIO_PCS_EEE_ABLE = 0x0000
qemu reports attempts to access unsupported registers.
I had a look at the Allwinner mdio driver. There is no indication suggesting
what the real hardware would return when trying to access unsupported registers,
and the Ethernet controller datasheet is not public.
These are PHY accesses over MDIO bus. Ethernet controller should not
care about content of this operations. But on qemu side, it is implemented as
part of Ethernet controller emulation...
Since MDIO_PCS_EEE_ABLE == 0x0000, phydev->supported_eee should prevent
other EEE related operations. But may be actual phy_read_mmd() went
wrong. It is a combination of simple phy_read/write to different
registers.
Adding MDD read/write support in qemu doesn't help. Something else in your patch
prevents the PHY from coming up. After reverting your patch, I see
sun4i-emac 1c0b000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
in the log. This is missing with your patch in place.
Anyway, the key difference is not really the qemu emulation, but the added
unconditional call to genphy_c45_write_eee_adv() in your patch. If you look
closely into that function, you may notice that the 'changed' variable is
never set to 0.
fixes the problem, both for cubieboard and xtensa.
Good point! Thx for finding it!
Do you wont to send the fix against net?
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
On Fri, Feb 24, 2023 at 04:09:40PM -0800, Guenter Roeck wrote:
quoted
On 2/24/23 12:02, Oleksij Rempel wrote:
[ ... ]
quoted
quoted
For cubieboard:
MDIO_PCS_EEE_ABLE = 0x0000
qemu reports attempts to access unsupported registers.
I had a look at the Allwinner mdio driver. There is no indication suggesting
what the real hardware would return when trying to access unsupported registers,
and the Ethernet controller datasheet is not public.
These are PHY accesses over MDIO bus. Ethernet controller should not
care about content of this operations. But on qemu side, it is implemented as
part of Ethernet controller emulation...
Since MDIO_PCS_EEE_ABLE == 0x0000, phydev->supported_eee should prevent
other EEE related operations. But may be actual phy_read_mmd() went
wrong. It is a combination of simple phy_read/write to different
registers.
Adding MDD read/write support in qemu doesn't help. Something else in your patch
prevents the PHY from coming up. After reverting your patch, I see
sun4i-emac 1c0b000.ethernet eth0: Link is Up - 100Mbps/Full - flow control off
IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
in the log. This is missing with your patch in place.
Anyway, the key difference is not really the qemu emulation, but the added
unconditional call to genphy_c45_write_eee_adv() in your patch. If you look
closely into that function, you may notice that the 'changed' variable is
never set to 0.
From: Mark Brown <broonie@kernel.org> Date: 2023-02-26 18:07:04
On Sat, Feb 11, 2023 at 08:41:09AM +0100, Oleksij Rempel wrote:
Add replacement for phy_ethtool_get/set_eee() functions.
Current phy_ethtool_get/set_eee() implementation is great and it is
possible to make it even better:
- this functionality is for devices implementing parts of IEEE 802.3
specification beyond Clause 22. The better place for this code is
phy-c45.c
Currently mainline is failing to bring up networking on the Libre
Computer AML-S905X-CC, with a bisect pointing at this commit,
022c3f87f88 upstream (although I'm not 100% sure I trust the bisect it
seems to be in roughly the right place). I've not dug into what's going
on more than running the bisect yet.
The boot dies with:
[ 15.532108] meson8b-dwmac c9410000.ethernet end0: Register
M the information provided will be safe.
[ 15.569305] meson8b-dwmac c9410000.ethernet end0: PHY [mdio_mux-0.e40908ff:08] driver [Meson GXL Internal PHY] (irq=45)
[ 15.585168] meson8b-dwmac c9410000.ethernet end0: No Safety Features support found
[ 15.587169] meson8b-dwmac c9410000.ethernet end0: PTP not supported by HW
[ 15.594673] meson8b-dwmac c9410000.ethernet end0: configuring for phy/rmii link mode
[ 15.601802] ------------[ cut here ]---------that are being provided
--- [ 15.606093] WARNING: CPU: 1 PID: 57 at drivers/net/phy/phy.c:1168
phy_error+0x14/0x60 [ 15.613854] Modules linked in: snd_soc_hdmi_codec
dw_hdmi_i2s_audio meson_gxl dwmac_generic meson_drm lima
drm_shmem_helper gpu_sched dwmac_meson8b stmmac_platform crct10dif_ce
stmmac amlogic_gxl_crypto pcs_xpcs drm_dma_helper crypto_engine
meson_canvas meson_gxbb_wdt meson_rng meson_dw_hdmi rng_core dw_hdmi cec
drm_display_helper meson_ir rc_core snd_soc_meson_aiu
snd_soc_meson_codec_glue snd_soc_meson_t9015 snd_soc_meson_gx_sound_card
snd_soc_meson_card_utils snd_soc_simple_amplifier display_conne
drm_kms_helper drm nvmem_meson_efuse [ 15.661291] CPU: 1 PID: 57 Comm:
kworker/u8:2 Not tainted 6.2.0-rc7-01626-g8b68710a3121 #10
[ 15.669568] Hardware name: Libre Computer AML-S905X-CC (DT)
[ 15.675090] Workqueue: events_power_efficient phy_state_machine
[ 15.680954] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 15.687853] pc : phy_error+0x14/0x60
[ 15.691389] lr : phy_state_machine+0xa0/0x280
[ 15.695701] sp : ffff80000a8a3d40
[ 15.698979] x29: ffff80000a8a3d40 x28: 0000000000000000 x27: 0000000000000000
[ 15.706051] x26: ffff80000a170000 x25: ffff00007ba884b0 x24: ffff000001009105
[ 15.713124] x23: 00000000ffffffa1 x22: ffff00007ba884a8 x21: ffff00007ba88500
[ 15.720196] x20: 0000000000000003 x19: ffff00007ba88000 x18: 0000000000000000
[ 15.727269] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
[ 15.734341] x14: 00000000000001d6 x13: 00000000000001d6 x12: 0000000000000001
[ 15.741414] x11: 0000000000000001 x10: ffff00007ba88420 x9 : ffff00007ba88418
[ 15.748487] x8 : 0000000000000000 x7 : 0000000000000020 x6 : 0000000000000040
[ 15.755559] x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff00007ba88500
[ 15.762631] x2 : 0000000000000000 x1 : ffff000001105700 x0 : ffff00007ba88000
[ 15.769705] Call trace:
[ 15.772120] phy_error+0x14/. It didn't really cross my mind that
something would be hard coded like this.
[ 15.786868] kthread+0x108/0x10c
[ 15.790059] ret_from_fork+0x10/0x20
[ 15.793596] ---[ end trace 0000000000000000 ]---
followed by there being no network so no NFS root. Bisect log:
git bisect start
# good: [c9c3395d5e3dcc6daee66c6908354d47bf98cb0c] Linux 6.2
git bisect good c9c3395d5e3dcc6daee66c6908354d47bf98cb0c
# bad: [2fcd07b7ccd5fd10b2120d298363e4e6c53ccf9c] mm/mprotect: Fix successful vma_merge() of next in do_mprotect_pkey()
git bisect bad 2fcd07b7ccd5fd10b2120d298363e4e6c53ccf9c
# bad: [d5176cdbf64ce7d4eebfbec23118e9f72] Merge tag 'pinctrl-v6.3-1' of
# git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
git bisect bad d5176cdbf64ce7d4eebf339205f17c23118e9f72
# skip: [69308402ca6f5b80a5a090ade0b13bd146891420] Merge tag
# 'platform-drivers-x86-v6.3-1' of
# git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
git bisect skip 69308402ca6f5b80a5a090ade0b13bd146891420
# good: [bc61761394ce0f0cc35c6fc60426f08d83d0d488] ipv6: ICMPV6: Use
# swap() instead of open coding it
git bisect good bc61761394ce0f0cc35c6fc60426f08d83d0d488
# good: [1b72607d7321e66829e11148712b3a2ba1dc83e7] Merge tag 'thermal-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
git bisect good 1b72607d7321e66829e11148712b3a2ba1dc83e7
# bad: [d1fabc68f8e0541d41657096dc713cb01775652d] Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
git bisect bad d1fabc68f8e0541d41657096dc713cb01775652d
# good: [31de4105f00d64570139bc5494a20 after figuring out what system
# it's on1b0bdf] bpf: Add BPF_FIB_LOOKUP_SKIP_NEIGH for bpf_fib_lookup
git bisect good 31de4105f00d64570139bc5494a201b0bd57349f
# good: [1a30a6b25f263686dbf2028d56041ac012b10dcb] wifi: brcmfmac: p2p:.
git bisect good 1a30a6b25f263686dbf2028d56041ac012b10dcb
# bad: [14743ddd2495c96caa18e382625c034e49a812e2] sfc: add devlink info support for ef100
git bisect bad 14743ddd2495c96caa18e382625c034e49a812e2
# bad: [1daa8e25ed971eca8cd8c8dfd4d6d6541b1d62a2] Merge branch 'net-make-kobj_type-structures-constant'
git bisect bad 1daa8e25ed971eca8cd8c8dfd4d6d6541b1d62a2
# bad: [1daa8e25ed971eca8cd8c8dfd4d6d6541b1d62a2] Merge branch 'net-make-kobj_type-structures-constant'
git bisect bad 1daa8e25ed971eca8cd8c8dfd4d6d6541b1d62a2
# good: [75da437a2f172759b227309 (or whatever)1a938772e687242d0] Merge
# branch '40GbE' of
# git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
git bisect good 75da437a2f172759b2273091a938772e687242d0
# bad: [8b68710a3121e0475b123a20c4220f66a728770e] net: phy: start using genphy_c45_ethtool_get/set_eee()
git bisect bad 8b68710a3121e0475b123a20c4220f66a728770e
# good: [d1ce6395d4648b41cf762714934e34ae57f0d1a4] net: ipa: define IPA v3.1 GSI event ring register offsets
git bisect good d1ce6395d4648b41cf762714934e34ae57f0d1a4
# good: [79cdf17e5131ccdee0792f6f25d3db0e34861998] Merge branch 'ionic-on-chip-desc'
git bisect good 79cdf17e5131ccdee0792f6f25d3db0e34861998
# bad: [ when the device is
# registered022c3f87f88e2d68e90be7687d981c9cb893a3b1] net: phy: add
# genphy_c45_ethtool_get/set_eee() support
git bisect bad 022c3f87f88e2d68e90be7687d981c9cb893a3b1
# good: [14e47d1fb8f9596acc90a06a66808657a9c512b5] net: phy: add
# genphy_c45_read_eee_abilities() function
git bisect good 14e47d1fb8f9596acc90a06a66808657a9c512b5
# good: [48fb19940f2ba6b50dfea70f671be9340fb63d60] net: phy: micrel: add ksz9477_get_features()
git bisect good cf9f6079696840093aa6ea3c0ee405a553afe2fb
# first bad commit: [022c3f87f88e2d68e90be7687d981c9cb893a3b1] net: phy: add genphy_c45_ethtool_get/set_eee() support
Hi Mark,
On Sun, Feb 26, 2023 at 06:06:48PM +0000, Mark Brown wrote:
On Sat, Feb 11, 2023 at 08:41:09AM +0100, Oleksij Rempel wrote:
quoted
Add replacement for phy_ethtool_get/set_eee() functions.
Current phy_ethtool_get/set_eee() implementation is great and it is
possible to make it even better:
- this functionality is for devices implementing parts of IEEE 802.3
specification beyond Clause 22. The better place for this code is
phy-c45.c
Currently mainline is failing to bring up networking on the Libre
Computer AML-S905X-CC, with a bisect pointing at this commit,
022c3f87f88 upstream (although I'm not 100% sure I trust the bisect it
seems to be in roughly the right place). I've not dug into what's going
on more than running the bisect yet.
From: Mark Brown <broonie@kernel.org> Date: 2023-02-27 13:06:57
On Mon, Feb 27, 2023 at 06:52:41AM +0100, Oleksij Rempel wrote:
On Sun, Feb 26, 2023 at 06:06:48PM +0000, Mark Brown wrote:
quoted
Currently mainline is failing to bring up networking on the Libre
Computer AML-S905X-CC, with a bisect pointing at this commit,
022c3f87f88 upstream (although I'm not 100% sure I trust the bisect it
seems to be in roughly the right place). I've not dug into what's going
on more than running the bisect yet.
They seem to work, thanks! I had found and tried the second patch but
it doesn't apply without the first series. Will those patches be going
to Linus for -rc1? It's pretty disruptive to a bunch of the test
infrastructure to not be able to NFS boot.
For cubieboard:
MDIO_PCS_EEE_ABLE = 0x0000
qemu reports attempts to access unsupported registers.
MDIO is a serial bus with two lines, clock driven by the bus master
and data. There is a pull up on the data line, so if the device does
not respond to a read request, you get 0xffff. That value is all i've
ever seen a real PHY do when asked to read a register which does not
exist. So i would say QEMU could be better emulate this.
The code actually looks for the value 0xffff and then decides that EEE
is not supporting in the PHY.
The value of 0x0 is probably being interpreted as meaning EEE is
supported, but none of the link modes, 10Mbps, 100Mbps etc support
EEE. I would say it is then legitimate to read/write other EEE
registers, so long as those writes take into account that no link
modes are actually supported.
Reading the other messages in this thread, a bug has been found in the
patches. But i would also say QEMU could do better.
Andrew
For cubieboard:
MDIO_PCS_EEE_ABLE = 0x0000
qemu reports attempts to access unsupported registers.
MDIO is a serial bus with two lines, clock driven by the bus master
and data. There is a pull up on the data line, so if the device does
not respond to a read request, you get 0xffff. That value is all i've
ever seen a real PHY do when asked to read a register which does not
exist. So i would say QEMU could be better emulate this.
The code actually looks for the value 0xffff and then decides that EEE
is not supporting in the PHY.
The value of 0x0 is probably being interpreted as meaning EEE is
supported, but none of the link modes, 10Mbps, 100Mbps etc support
EEE. I would say it is then legitimate to read/write other EEE
registers, so long as those writes take into account that no link
modes are actually supported.
Reading the other messages in this thread, a bug has been found in the
patches. But i would also say QEMU could do better.
Sure, it could. Always. That is why I checked the qemu code and
actually tried to implement some of the EEE handling, only to
realize that it didn't help. The emulated PHY does support EEE
and would return either 0x0001 or 0x0003 depending on the
underlying hardware. However, returning that and returning/
accepting reasonable values for other EEE registers didn't make
a difference due to the kernel bug.
Thanks,
Guenter
From: Jakub Kicinski <kuba@kernel.org> Date: 2023-02-27 18:49:24
On Mon, 27 Feb 2023 13:06:10 +0000 Mark Brown wrote:
They seem to work, thanks! I had found and tried the second patch but
it doesn't apply without the first series. Will those patches be going
to Linus for -rc1? It's pretty disruptive to a bunch of the test
infrastructure to not be able to NFS boot.
Letting regzbot know about the fix:
#regzbot fixed-by: 972074ea8840
On Fri, Feb 24, 2023 at 09:20:04AM -0800, Guenter Roeck wrote:
Copying regzbot.
#regzbot ^introduced 9b01c885be36
#regzbot title Network interface initialization failures on xtensa, arm:cubieboard
#regzbot ignore-activity
On Thu, Feb 23, 2023 at 08:16:06PM -0800, Guenter Roeck wrote:
quoted
On Thu, Feb 23, 2023 at 07:55:55PM -0800, Guenter Roeck wrote:
quoted
On Sat, Feb 11, 2023 at 08:41:10AM +0100, Oleksij Rempel wrote:
quoted
Migrate from genphy_config_eee_advert() to genphy_c45_write_eee_adv().
It should work as before except write operation to the EEE adv registers
will be done only if some EEE abilities was detected.
If some driver will have a regression, related driver should provide own
.get_features callback. See micrel.c:ksz9477_get_features() as example.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This patch causes network interface failures with all my xtensa qemu
emulations. Reverting it fixes the problem. Bisect log is attached
for reference.
Also affected are arm:cubieboard emulations, with same symptom.
arm:bletchley-bmc emulations crash. In both cases, reverting this patch
fixes the problem.
Guenter