• Vladimir Oltean's avatar
    net: enetc: take the MDIO lock only once per NAPI poll cycle · 6d36ecdb
    Vladimir Oltean authored
    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: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    6d36ecdb
enetc_hw.h 24.3 KB