• Yonglong Liu's avatar
    net: hns3: add Asym Pause support to fix autoneg problem · 724dffdf
    Yonglong Liu authored
    [ Upstream commit bc3781ed ]
    
    Local device and link partner config auto-negotiation on both,
    local device config pause frame use as: rx on/tx off,
    link partner config pause frame use as: rx off/tx on.
    
    We except the result is:
    Local device:
    Autonegotiate:  on
    RX:             on
    TX:             off
    RX negotiated:  on
    TX negotiated:  off
    
    Link partner:
    Autonegotiate:  on
    RX:             off
    TX:             on
    RX negotiated:  off
    TX negotiated:  on
    
    But actually, the result of Local device and link partner is both:
    Autonegotiate:  on
    RX:             off
    TX:             off
    RX negotiated:  off
    TX negotiated:  off
    
    The root cause is that the supported flag is has only Pause,
    reference to the function genphy_config_advert():
    static int genphy_config_advert(struct phy_device *phydev)
    {
    	...
    	linkmode_and(phydev->advertising, phydev->advertising,
    		     phydev->supported);
    	...
    }
    The pause frame use of link partner is rx off/tx on, so its
    advertising only set the bit Asym_Pause, and the supported is
    only set the bit Pause, so the result of linkmode_and(), is
    rx off/tx off.
    
    This patch adds Asym_Pause to the supported flag to fix it.
    Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
    Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
    Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    724dffdf
hclge_mdio.c 6.26 KB