]> git.dujemihanovic.xyz Git - u-boot.git/commit
net: sun8i_emac: Simplify and fix error handling for RX
authorAndre Przywara <andre.przywara@arm.com>
Mon, 6 Jul 2020 00:40:43 +0000 (01:40 +0100)
committerJagan Teki <jagan@amarulasolutions.com>
Wed, 21 Oct 2020 18:15:06 +0000 (23:45 +0530)
commit7edcb4e288efb9eb4412373638dab87cd78d92ba
treed7de1c5f288aa2a5236c8e2481da286a167ac7fc
parent2c5600c38ce642e1763afe4f3b5fb6dd8f442aa5
net: sun8i_emac: Simplify and fix error handling for RX

The error handling in recv() is somewhat broken, for instance
good_packet isn't really used, and it's hardly readable. Also we try
to check for short or too big packets, but those are actually filtered
out by the hardware.

Simplify the whole routine and improve the error handling:
- Bail out early if the current RX descriptor is not ready.
- Enable propagation of runt, huge and broken packets.
- Check for runt and huge packets, and return 0 to indicate this.
  This will force the framework to call free_pkt for cleanup.
- Avoid aligning the packet buffer for invalidation again.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Tested-by: Amit Singh Tomar <amittomer25@gmail.com> # Pine64+
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
drivers/net/sun8i_emac.c