net: ravb: Fix RX error handling
authorMarek Vasut <marek.vasut+renesas@mailbox.org>
Sun, 20 Apr 2025 16:35:33 +0000 (18:35 +0200)
committerMarek Vasut <marek.vasut+renesas@mailbox.org>
Sun, 4 May 2025 18:23:31 +0000 (20:23 +0200)
commit6fae565f5477f0e1c8df2271cc8bedaca5b63759
tree6c47a2ada30b8634b2fa61451638857c60a56ff4
parentdcea465e5e299903b889f5f426eac6d6523cbf84
net: ravb: Fix RX error handling

Correctly handle RX errors in ravb_recv() by returning 0 instead
of -EAGAIN on RX error.

In case the RAVB driver detects an RX error in ravb_recv(), it must
not return the -EAGAIN, but instead must return 0. Both error codes
are handled in eth-uclass.c eth_rx() and -EAGAIN is rewritten to 0
at the end of eth_rx(), but negative return code from the .recv()
callback does not trigger .free_pkt() callback, which would clean
up and re-enqueue the descriptor which holds the currently received
corrupted packet. The .free_pkt() must be called for this descriptor,
otherwise the follow up received data become corrupted too, even if
those packets are correctly received. Returning 0 from the .recv()
callback assures the corrupted packet is not processed by the network
stack, but is skipped instead.

For TFTP loading, an RX error produces the timeout "T" output and
resumes the TFTP loading operation shortly afterward, without any
data corruption.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Paul Barker <paul.barker.ct@bp.renesas.com>
drivers/net/ravb.c