• Anssi Hannula's avatar
    net: macb: fix dropped RX frames due to a race · 8159ecab
    Anssi Hannula authored
    Bit RX_USED set to 0 in the address field allows the controller to write
    data to the receive buffer descriptor.
    
    The driver does not ensure the ctrl field is ready (cleared) when the
    controller sees the RX_USED=0 written by the driver. The ctrl field might
    only be cleared after the controller has already updated it according to
    a newly received frame, causing the frame to be discarded in gem_rx() due
    to unexpected ctrl field contents.
    
    A message is logged when the above scenario occurs:
    
      macb ff0b0000.ethernet eth0: not whole frame pointed by descriptor
    
    Fix the issue by ensuring that when the controller sees RX_USED=0 the
    ctrl field is already cleared.
    
    This issue was observed on a ZynqMP based system.
    
    Fixes: 4df95131 ("net/macb: change RX path for GEM")
    Signed-off-by: default avatarAnssi Hannula <anssi.hannula@bitwise.fi>
    Tested-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
    Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8159ecab
macb_main.c 108 KB