• David Thompson's avatar
    mlxbf_gige: fix receive packet race condition · dcea1bd4
    David Thompson authored
    Under heavy traffic, the BlueField Gigabit interface can
    become unresponsive. This is due to a possible race condition
    in the mlxbf_gige_rx_packet function, where the function exits
    with producer and consumer indices equal but there are remaining
    packet(s) to be processed. In order to prevent this situation,
    read receive consumer index *before* the HW replenish so that
    the mlxbf_gige_rx_packet function returns an accurate return
    value even if a packet is received into just-replenished buffer
    prior to exiting this routine. If the just-replenished buffer
    is received and occupies the last RX ring entry, the interface
    would not recover and instead would encounter RX packet drops
    related to internal buffer shortages since the driver RX logic
    is not being triggered to drain the RX ring. This patch will
    address and prevent this "ring full" condition.
    
    Fixes: f92e1869 ("Add Mellanox BlueField Gigabit Ethernet driver")
    Reviewed-by: default avatarAsmaa Mnebhi <asmaa@nvidia.com>
    Signed-off-by: default avatarDavid Thompson <davthompson@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    dcea1bd4
mlxbf_gige_rx.c 9.54 KB