net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Subsystems (5)
PATCH v2 1/1 net: phy: phy drivers should not set SUPPORTED_[Asym_]Pause
Instead of having individual PHY drivers set the SUPPORTED_Pause and SUPPORTED_Asym_Pause flags, phylib itself should set those flags. During autonegotiation, the PHYs will determine whether to enable pause frame support.
Pause frames are a feature that is supported by the MAC. It is the MAC that generates the frames and that processes them. The PHY can only be configured to allow them to pass through.
So the new process is:
1) Phylib sets the SUPPORTED_Pause and SUPPORTED_AsymPause bits in phydev->supported. This indicates that the PHY supports pause frames.
2) The MAC driver checks phydev->supported before it calls phy_start(). If (SUPPORTED_Pause | SUPPORTED_AsymPause) is set, then the MAC driver sets those bits in phydev->advertising, if it wants to enable pause frame support.
3) When the link state changes, the MAC driver checks phydev->pause and phydev->asym_pause, If the bits are set, then it enables the corresponding features in the MAC. The algorithm is:
if (phydev->pause)
The MAC should be programmed to receive and honor pause frames it receives, i.e. enable receive flow control.
if (phydev->pause != phydev->asym_pause)
The MAC should be programmed to transmit pause frames when needed, i.e. enable transmit flow control.
---
v2: set the Pause bits in phy_probe()
update broadcom.c which was recently changed
drivers/net/phy/bcm-cygnus.c | 3 +-- drivers/net/phy/bcm63xx.c | 5 ++--- drivers/net/phy/bcm7xxx.c | 6 ++---- drivers/net/phy/broadcom.c | 42 ++++++++++++++---------------------------- drivers/net/phy/icplus.c | 6 ++---- drivers/net/phy/intel-xway.c | 24 ++++++++---------------- drivers/net/phy/micrel.c | 30 ++++++++++++------------------ drivers/net/phy/microchip.c | 3 +-- drivers/net/phy/national.c | 2 +- drivers/net/phy/phy_device.c | 7 +++++++ drivers/net/phy/smsc.c | 18 ++++++------------ drivers/net/phy/ste10Xp.c | 4 ++-- 12 files changed, 58 insertions(+), 92 deletions(-)
drivers/net/phy/bcm-cygnus.c +1 -2
@@ -134,8 +134,7 @@ static int bcm_cygnus_resume(struct phy_device *phydev) .phy_id = PHY_ID_BCM_CYGNUS, .phy_id_mask = 0xfffffff0, .name = "Broadcom Cygnus PHY", - .features =PHY_GBIT_FEATURES | - SUPPORTED_Pause | SUPPORTED_Asym_Pause, + .features = PHY_GBIT_FEATURES, .config_init = bcm_cygnus_config_init, .config_aneg = genphy_config_aneg, .read_status = genphy_read_status,
drivers/net/phy/bcm63xx.c +2 -3
@@ -48,8 +48,7 @@ static int bcm63xx_config_init(struct phy_device *phydev) .phy_id = 0x00406000, .phy_id_mask = 0xfffffc00, .name = "Broadcom BCM63XX (1)", -/* ASYM_PAUSE bit is marked RO in datasheet, so don't cheat */ - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT | PHY_IS_INTERNAL, .config_init = bcm63xx_config_init, .config_aneg = genphy_config_aneg,
@@ -61,7 +60,7 @@ static int bcm63xx_config_init(struct phy_device *phydev) .phy_id = 0x002bdc00, .phy_id_mask = 0xfffffc00, .name = "Broadcom BCM63XX (2)", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT | PHY_IS_INTERNAL, .config_init = bcm63xx_config_init, .config_aneg = genphy_config_aneg,
drivers/net/phy/bcm7xxx.c +2 -4
@@ -308,8 +308,7 @@ static int bcm7xxx_suspend(struct phy_device *phydev) .phy_id = (_oui), \ .phy_id_mask = 0xfffffff0, \ .name = _name, \ - .features =PHY_GBIT_FEATURES | \ - SUPPORTED_Pause | SUPPORTED_Asym_Pause, \ + .features = PHY_GBIT_FEATURES, \ .flags = PHY_IS_INTERNAL, \ .config_init = bcm7xxx_28nm_config_init, \ .config_aneg = genphy_config_aneg, \
@@ -322,8 +321,7 @@ static int bcm7xxx_suspend(struct phy_device *phydev) .phy_id = (_oui), \ .phy_id_mask = 0xfffffff0, \ .name = _name, \ - .features =PHY_BASIC_FEATURES | \ - SUPPORTED_Pause | SUPPORTED_Asym_Pause, \ + .features = PHY_BASIC_FEATURES, \ .flags = PHY_IS_INTERNAL, \ .config_init = bcm7xxx_config_init, \ .config_aneg = genphy_config_aneg, \
drivers/net/phy/broadcom.c +14 -28
126 lines not on this page · raw message
drivers/net/phy/icplus.c +2 -4
@@ -225,8 +225,7 @@ static int ip101a_g_ack_interrupt(struct phy_device *phydev) .phy_id = 0x02430d90, .name = "ICPlus IP1001", .phy_id_mask = 0x0ffffff0, - .features =PHY_GBIT_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause, + .features = PHY_GBIT_FEATURES, .config_init = &ip1001_config_init, .config_aneg = &genphy_config_aneg, .read_status = &genphy_read_status,
@@ -236,8 +235,7 @@ static int ip101a_g_ack_interrupt(struct phy_device *phydev) .phy_id = 0x02430c54, .name = "ICPlus IP101A/G", .phy_id_mask = 0x0ffffff0, - .features =PHY_BASIC_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause, + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT, .ack_interrupt = ip101a_g_ack_interrupt, .config_init = &ip101a_g_config_init,
drivers/net/phy/intel-xway.c +8 -16
@@ -239,8 +239,7 @@ static int xway_gphy_config_intr(struct phy_device *phydev) .phy_id = PHY_ID_PHY11G_1_3, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.3", - .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause), + .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = xway_gphy_config_init, .config_aneg = xway_gphy14_config_aneg,
@@ -254,8 +253,7 @@ static int xway_gphy_config_intr(struct phy_device *phydev) .phy_id = PHY_ID_PHY22F_1_3, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY22F (PEF 7061) v1.3", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = xway_gphy_config_init, .config_aneg = xway_gphy14_config_aneg,
@@ -269,8 +267,7 @@ static int xway_gphy_config_intr(struct phy_device *phydev) .phy_id = PHY_ID_PHY11G_1_4, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.4", - .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause), + .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = xway_gphy_config_init, .config_aneg = xway_gphy14_config_aneg,
@@ -284,8 +281,7 @@ static int xway_gphy_config_intr(struct phy_device *phydev) .phy_id = PHY_ID_PHY22F_1_4, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY22F (PEF 7061) v1.4", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = xway_gphy_config_init, .config_aneg = xway_gphy14_config_aneg,
@@ -299,8 +295,7 @@ static int xway_gphy_config_intr(struct phy_device *phydev) .phy_id = PHY_ID_PHY11G_1_5, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY11G (PEF 7071/PEF 7072) v1.5 / v1.6", - .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause), + .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = xway_gphy_config_init, .config_aneg = genphy_config_aneg,
@@ -314,8 +309,7 @@ static int xway_gphy_config_intr(struct phy_device *phydev) .phy_id = PHY_ID_PHY22F_1_5, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY22F (PEF 7061) v1.5 / v1.6", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = xway_gphy_config_init, .config_aneg = genphy_config_aneg,
@@ -329,8 +323,7 @@ static int xway_gphy_config_intr(struct phy_device *phydev) .phy_id = PHY_ID_PHY11G_VR9, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY11G (xRX integrated)", - .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause), + .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = xway_gphy_config_init, .config_aneg = genphy_config_aneg,
@@ -344,8 +337,7 @@ static int xway_gphy_config_intr(struct phy_device *phydev) .phy_id = PHY_ID_PHY22F_VR9, .phy_id_mask = 0xffffffff, .name = "Intel XWAY PHY22F (xRX integrated)", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = xway_gphy_config_init, .config_aneg = genphy_config_aneg,
drivers/net/phy/micrel.c +12 -18
@@ -790,7 +790,7 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KS8737, .phy_id_mask = MICREL_PHY_ID_MASK, .name = "Micrel KS8737", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .driver_data = &ks8737_type, .config_init = kszphy_config_init,
@@ -807,8 +807,7 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KSZ8021, .phy_id_mask = 0x00ffffff, .name = "Micrel KSZ8021 or KSZ8031", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .driver_data = &ksz8021_type, .probe = kszphy_probe,
@@ -826,8 +825,7 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KSZ8031, .phy_id_mask = 0x00ffffff, .name = "Micrel KSZ8031", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | - SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .driver_data = &ksz8021_type, .probe = kszphy_probe,
@@ -845,8 +843,7 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KSZ8041, .phy_id_mask = MICREL_PHY_ID_MASK, .name = "Micrel KSZ8041", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause - | SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .driver_data = &ksz8041_type, .probe = kszphy_probe,
@@ -864,8 +861,7 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KSZ8041RNLI, .phy_id_mask = MICREL_PHY_ID_MASK, .name = "Micrel KSZ8041RNLI", - .features =PHY_BASIC_FEATURES | - SUPPORTED_Pause | SUPPORTED_Asym_Pause, + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .driver_data = &ksz8041_type, .probe = kszphy_probe,
@@ -883,8 +879,7 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KSZ8051, .phy_id_mask = MICREL_PHY_ID_MASK, .name = "Micrel KSZ8051", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause - | SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .driver_data = &ksz8051_type, .probe = kszphy_probe,
@@ -902,7 +897,7 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KSZ8001, .name = "Micrel KSZ8001 or KS8721", .phy_id_mask = 0x00fffffc, - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .driver_data = &ksz8041_type, .probe = kszphy_probe,
@@ -920,7 +915,7 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KSZ8081, .name = "Micrel KSZ8081 or KSZ8091", .phy_id_mask = MICREL_PHY_ID_MASK, - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .driver_data = &ksz8081_type, .probe = kszphy_probe,
@@ -938,7 +933,7 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KSZ8061, .name = "Micrel KSZ8061", .phy_id_mask = MICREL_PHY_ID_MASK, - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .config_init = kszphy_config_init, .config_aneg = genphy_config_aneg,
@@ -954,7 +949,7 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KSZ9021, .phy_id_mask = 0x000ffffe, .name = "Micrel KSZ9021 Gigabit PHY", - .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause), + .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .driver_data = &ksz9021_type, .config_init = ksz9021_config_init,
@@ -973,7 +968,7 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KSZ9031, .phy_id_mask = MICREL_PHY_ID_MASK, .name = "Micrel KSZ9031 Gigabit PHY", - .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause), + .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .driver_data = &ksz9021_type, .config_init = ksz9031_config_init,
@@ -990,7 +985,6 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KSZ8873MLL, .phy_id_mask = MICREL_PHY_ID_MASK, .name = "Micrel KSZ8873MLL Switch", - .features = (SUPPORTED_Pause | SUPPORTED_Asym_Pause), .flags = PHY_HAS_MAGICANEG, .config_init = kszphy_config_init, .config_aneg = ksz8873mll_config_aneg,
@@ -1004,7 +998,7 @@ static int kszphy_probe(struct phy_device *phydev) .phy_id = PHY_ID_KSZ886X, .phy_id_mask = MICREL_PHY_ID_MASK, .name = "Micrel KSZ886X Switch", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, .config_init = kszphy_config_init, .config_aneg = genphy_config_aneg,
drivers/net/phy/microchip.c +1 -2
@@ -112,8 +112,7 @@ static int lan88xx_set_wol(struct phy_device *phydev, .phy_id_mask = 0xfffffff0, .name = "Microchip LAN88xx", - .features = (PHY_GBIT_FEATURES | - SUPPORTED_Pause | SUPPORTED_Asym_Pause), + .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, .probe = lan88xx_probe,
drivers/net/phy/national.c +1 -1
@@ -133,7 +133,7 @@ static int ns_config_init(struct phy_device *phydev) .phy_id = DP83865_PHY_ID, .phy_id_mask = 0xfffffff0, .name = "NatSemi DP83865", - .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | SUPPORTED_Asym_Pause, + .features = PHY_GBIT_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = ns_config_init, .config_aneg = genphy_config_aneg,
drivers/net/phy/phy_device.c +7 -0
@@ -1598,6 +1598,13 @@ static int phy_probe(struct device *dev)of_set_phy_supported (phydev); phydev->advertising = phydev->supported; +/* Report that the PHYs can support passing pause frames. During +* autonegotiation, the PHYs will determine if they should allow +* pause frames to pass. The MAC driver should then use that result +* to determine whether to enable flow control via pause frames. +*/ + phydev->supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause; +/* Set the state to READY by default */ phydev->state =PHY_READY ;
drivers/net/phy/smsc.c +6 -12
@@ -168,8 +168,7 @@ static int smsc_phy_probe(struct phy_device *phydev) .phy_id_mask = 0xfffffff0, .name = "SMSC LAN83C185", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause - | SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, .probe = smsc_phy_probe,
@@ -191,8 +190,7 @@ static int smsc_phy_probe(struct phy_device *phydev) .phy_id_mask = 0xfffffff0, .name = "SMSC LAN8187", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause - | SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, .probe = smsc_phy_probe,
@@ -214,8 +212,7 @@ static int smsc_phy_probe(struct phy_device *phydev) .phy_id_mask = 0xfffffff0, .name = "SMSC LAN8700", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause - | SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, .probe = smsc_phy_probe,
@@ -237,8 +234,7 @@ static int smsc_phy_probe(struct phy_device *phydev) .phy_id_mask = 0xfffffff0, .name = "SMSC LAN911x Internal PHY", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause - | SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, .probe = smsc_phy_probe,
@@ -259,8 +255,7 @@ static int smsc_phy_probe(struct phy_device *phydev) .phy_id_mask = 0xfffffff0, .name = "SMSC LAN8710/LAN8720", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause - | SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, .probe = smsc_phy_probe,
@@ -282,8 +277,7 @@ static int smsc_phy_probe(struct phy_device *phydev) .phy_id_mask = 0xfffffff0, .name = "SMSC LAN8740", - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause - | SUPPORTED_Asym_Pause), + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT | PHY_HAS_MAGICANEG, .probe = smsc_phy_probe,
drivers/net/phy/ste10Xp.c +2 -2
@@ -86,7 +86,7 @@ static int ste10Xp_ack_interrupt(struct phy_device *phydev) .phy_id = STE101P_PHY_ID, .phy_id_mask = 0xfffffff0, .name = "STe101p", - .features = PHY_BASIC_FEATURES | SUPPORTED_Pause, + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = ste10Xp_config_init, .config_aneg = genphy_config_aneg,
@@ -99,7 +99,7 @@ static int ste10Xp_ack_interrupt(struct phy_device *phydev) .phy_id = STE100P_PHY_ID, .phy_id_mask = 0xffffffff, .name = "STe100p", - .features = PHY_BASIC_FEATURES | SUPPORTED_Pause, + .features = PHY_BASIC_FEATURES, .flags = PHY_HAS_INTERRUPT, .config_init = ste10Xp_config_init, .config_aneg = genphy_config_aneg,
Signature · 3 lines
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
David Miller
maintainerFrom: Timur Tabi <[email protected]>
Date: Thu, 10 Nov 2016 17:46:01 -0600
Quoted 10 lines
Instead of having individual PHY drivers set the
SUPPORTED_PauseandSUPPORTED_Asym_Pauseflags, phylib itself should set those flags. During autonegotiation, the PHYs will determine whether to enable pause frame support.Pause frames are a feature that is supported by the MAC. It is the MAC that generates the frames and that processes them. The PHY can only be configured to allow them to pass through.
So the new process is:
...
Quoted 5 lines
Signed-off-by Timur Tabi <[email protected]>---
v2: set the Pause bits in
phy_probe()
updatebroadcom.cwhich was recently changed
Florian please review this patch.
Thank you.
Quoted 39 lines · Timur Tabi
Instead of having individual PHY drivers set the
SUPPORTED_PauseandSUPPORTED_Asym_Pauseflags, phylib itself should set those flags. During autonegotiation, the PHYs will determine whether to enable pause frame support.Pause frames are a feature that is supported by the MAC. It is the MAC that generates the frames and that processes them. The PHY can only be configured to allow them to pass through.
So the new process is:
1) Phylib sets the
SUPPORTED_PauseandSUPPORTED_AsymPausebits inphydev->supported. This indicates that the PHY supports pause frames.2) The MAC driver checks
phydev->supportedbefore it callsphy_start(). If (SUPPORTED_Pause|SUPPORTED_AsymPause) is set, then the MAC driver sets those bits inphydev->advertising, if it wants to enable pause frame support.3) When the link state changes, the MAC driver checks
phydev->pauseandphydev->asym_pause, If the bits are set, then it enables the corresponding features in the MAC. The algorithm is:if (
phydev->pause)
The MAC should be programmed to receive and honor pause frames it receives, i.e. enable receive flow control.if (
phydev->pause!=phydev->asym_pause)
The MAC should be programmed to transmit pause frames when needed, i.e. enable transmit flow control.Signed-off-by Timur Tabi <[email protected]>---
drivers/net/phy/bcm63xx.c +0
-0
drivers/net/phy/bcm63xx.c static int bcm63xx_config_init(struct phy_device *phydev) · line 51
Quoted 6 lines
drivers/net/phy/bcm63xx.c +1
-2@@ -48,8 +48,7 @@ static int bcm63xx_config_init(struct phy_device *phydev) .phy_id = 0x00406000, .phy_id_mask = 0xfffffc00, .name = "Broadcom BCM63XX (1)", -/* ASYM_PAUSE bit is marked RO in datasheet, so don't cheat */ - .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), + .features = PHY_BASIC_FEATURES,
Humm that's actually a pretty important piece of information here that we are going to lose if we unconditionally move the setting of the SUPPORTED_Pause/Asym_Pause settings into the core. I don't have the HW in a state where I could try a mainline kernel, but I suspect that the following could happen though:
- we would try to set the SUPPORTED_AsymPause bit, and it would not be taken into account, since the bit is RO
- the auto-negotiation results should still show up as symmetric pause being supported only
- the driver would properly react to that
NB: this also applies to drivers/net/phy/ste10Xp.c.
So maybe, for theses drivers specifically, what we can do, is preserve the entry as-is, to convey that only symmetric Pause frames can be advertised, and have the logic in PHYLIB do something like this (pseudo-code):
if (!(drv->features & (SUPPORTED_Pause | SUPPORTED_AsymPause))
phydev->supported |= SUPPORTED_Pause | SUPPORTED_AsymPause; else if ((drv->features & (SUPPORTED_Pause) && (!(drv->features & (SUPPORTED_AsymPause))) phydev->supported |= SUPPORTED_Pause;
(there may be more efficient ways to do this of course).
Signature · 1 line
Florian
Quoted 2 lines · Florian Fainelli
if (!(drv->features & (
SUPPORTED_Pause|SUPPORTED_AsymPause))phydev->supported |= SUPPORTED_Pause | SUPPORTED_AsymPause;
How about, if either bit is set in drv->features, then assume the phy driver really knows what it's doing, and just copy those bits to phydev->supported?
if (drv->features & (SUPPORTED_Pause | SUPPORTED_AsymPause)) {
phydev->supported &= ~(SUPPORTED_Pause | SUPPORTED_AsymPause);
phydev->supported |= drv->features & (SUPPORTED_Pause |
SUPPORTED_AsymPause);
} else
phydev->supported |= SUPPORTED_Pause | SUPPORTED_AsymPause;Signature · 3 lines
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Quoted 7 lines · Timur Tabi
Quoted 2 lines · Florian Fainelli
if (!(drv->features & (
SUPPORTED_Pause|SUPPORTED_AsymPause))phydev->supported |= SUPPORTED_Pause | SUPPORTED_AsymPause;How about, if either bit is set in
drv->features, then assume the phy driver really knows what it's doing, and just copy those bits tophydev->supported?
Yes, that seems completely reasonable to me. Thanks!
Quoted 8 lines
if (drv->features & (SUPPORTED_Pause | SUPPORTED_AsymPause)) {
phydev->supported &= ~(SUPPORTED_Pause | SUPPORTED_AsymPause);
phydev->supported |= drv->features & (SUPPORTED_Pause |
SUPPORTED_AsymPause);
} else
phydev->supported |= SUPPORTED_Pause | SUPPORTED_AsymPause;Signature · 1 line
Florian