From: Finn Thain Date: Wed, 29 Jan 2020 09:27:49 +0000 (+1100) Subject: dp8393x: Don't clobber packet checksum X-Git-Tag: v4.2.1~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d50aa8acbc6f4bd83d0d0b5958d49ac6baf254a5;p=thirdparty%2Fqemu.git dp8393x: Don't clobber packet checksum A received packet consumes pkt_size bytes in the buffer and the frame checksum that's appended to it consumes another 4 bytes. The Receive Buffer Address register takes the former quantity into account but not the latter. So the next packet written to the buffer overwrites the frame checksum. Fix this. Signed-off-by: Finn Thain Reviewed-by: Philippe Mathieu-Daudé Tested-by: Laurent Vivier Signed-off-by: Jason Wang (cherry picked from commit bae112b80c9c42cea21ee7623c283668c3451c2e) *drop context dep. on 19f70347731 Signed-off-by: Michael Roth --- diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index ca8088c8392..315b4ad8441 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -816,6 +816,7 @@ static ssize_t dp8393x_receive(NetClientState *nc, const uint8_t * buf, address += rx_len; address_space_rw(&s->as, address, MEMTXATTRS_UNSPECIFIED, (uint8_t *)&checksum, 4, 1); + address += 4; rx_len += 4; s->regs[SONIC_CRBA1] = address >> 16; s->regs[SONIC_CRBA0] = address & 0xffff;