Thank you for working on this! I revised your patch as follows:
http://www.netbsd.org/~rin/if_mue_20181204.patch
(1) We need to check bits 30 and 31 of rx_cmd_a, which indicate
checksum error detected by H/W for L4 and L3, respectively.
Otherwise, broken packets bypass any checksumming.
(2) Mask csum by ifp->if_csum_flags_rx in mue_rxeof() for safety.
(3) Some style changes.
I've tested the patch with Z-TEK ZE582 (LAN7500). It works fine
as far as I can see, although no checksum errors were detected
during test.
I've updated the patch:
http://www.netbsd.org/~rin/if_mue_20181204-1.patch
(a) We cannot use bit 22 of rx_cmd_a (MUE_RX_CMD_A_RED) to drop
wrong packets, since it is turned on in the cases of L3/L4
checksum errors. Use bits 16--21 instead.
(b) For (3), undo renaming MUE_RX_CMD_A_FOO in the previous patch
in favor of ones in Robert's original patch, that are taken
from the data sheet. Sorry Robert, you were right.
Now, the driver can handle checksum errors correctly!