• Yunsheng Lin's avatar
    net: hns3: optimize the rx clean process · 8c30e194
    Yunsheng Lin authored
    Currently HNS3_RING_RX_RING_FBDNUM_REG register is read to determine
    how many rx desc can be cleaned. To avoid the register read operation
    in the critical data path, use the valid bit in the rx desc to determine
    if a specific rx desc can be cleaned.
    
    The hns3 driver clear valid bit in the rx desc before notifying the
    rx desc to the hw, and hw will only set the valid bit of the rx desc
    after corresponding buffer is filled with packet data and other field
    in the rx desc is set accordingly.
    
    Add hns3_rx_ring_move_fw() function to clear the valid bit in the rx
    desc before moving rx ring's next_to_clean forward to avoid double
    cleaning a rx desc, also add a dma_rmb() barrier in hns3_handle_rx_bd()
    to make sure valid bit is set before reading other field in the rx desc.
    Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
    Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8c30e194
hns3_enet.c 118 KB