• V
    net: enetc: take the MDIO lock only once per NAPI poll cycle · cfce9813
    Vladimir Oltean 提交于
    stable inclusion
    from stable-5.10.24
    commit bf9c564716a13dde6a990d3b02c27cd6e39608bf
    bugzilla: 51348
    
    --------------------------------
    
    commit 6d36ecdb upstream.
    
    The workaround for the ENETC MDIO erratum caused a performance
    degradation of 82 Kpps (seen with IP forwarding of two 1Gbps streams of
    64B packets). This is due to excessive locking and unlocking in the fast
    path, which can be avoided.
    
    By taking the MDIO read-side lock only once per NAPI poll cycle, we are
    able to regain 54 Kpps (65%) of the performance hit. The rest of the
    performance degradation comes from the TX data path, but unfortunately
    it doesn't look like we can optimize that away easily, even with
    netdev_xmit_more(), there just isn't any skb batching done, to help with
    taking the MDIO lock less often than once per packet.
    
    We need to change the register accessor type for enetc_get_tx_tstamp,
    because it now runs under the enetc_lock_mdio as per the new call path
    detailed below:
    
    enetc_msix
    -> napi_schedule
       -> enetc_poll
          -> enetc_lock_mdio
          -> enetc_clean_tx_ring
             -> enetc_get_tx_tstamp
          -> enetc_clean_rx_ring
          -> enetc_unlock_mdio
    
    Fixes: fd5736bf ("enetc: Workaround for MDIO register access issue")
    Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: NChen Jun <chenjun102@huawei.com>
    Acked-by: N  Weilong Chen <chenweilong@huawei.com>
    Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
    cfce9813
enetc.c 45.4 KB