• Song Yoong Siang's avatar
    net: stmmac: Fix overall budget calculation for rxtx_napi · 81d0885d
    Song Yoong Siang authored
    tx_done is not used for napi_complete_done(). Thus, NAPI busy polling
    mechanism by gro_flush_timeout and napi_defer_hard_irqs will not able
    be triggered after a packet is transmitted when there is no receive
    packet.
    
    Fix this by taking the maximum value between tx_done and rx_done as
    overall budget completed by the rxtx NAPI poll to ensure XDP Tx ZC
    operation is continuously polling for next Tx frame. This gives
    benefit of lower packet submission processing latency and jitter
    under XDP Tx ZC mode.
    
    Performance of tx-only using xdp-sock on Intel ADL-S platform is
    the same with and without this patch.
    
    root@intel-corei7-64:~# ./xdpsock -i enp0s30f4 -t -z -q 1 -n 10
     sock0@enp0s30f4:1 txonly xdp-drv
                       pps            pkts           10.00
    rx                 0              0
    tx                 511630         8659520
    
     sock0@enp0s30f4:1 txonly xdp-drv
                       pps            pkts           10.00
    rx                 0              0
    tx                 511625         13775808
    
     sock0@enp0s30f4:1 txonly xdp-drv
                       pps            pkts           10.00
    rx                 0              0
    tx                 511619         18892032
    
    Fixes: 132c32ee ("net: stmmac: Add TX via XDP zero-copy socket")
    Cc: <stable@vger.kernel.org> # 5.13.x
    Co-developed-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
    Signed-off-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
    Signed-off-by: default avatarSong Yoong Siang <yoong.siang.song@intel.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    81d0885d
stmmac_main.c 196 KB