]> git.proxmox.com Git - mirror_qemu.git/commitdiff
dp8393x: Don't clobber packet checksum
authorFinn Thain <fthain@telegraphics.com.au>
Wed, 29 Jan 2020 09:27:49 +0000 (20:27 +1100)
committerJason Wang <jasowang@redhat.com>
Tue, 3 Mar 2020 10:04:47 +0000 (18:04 +0800)
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 <fthain@telegraphics.com.au>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Jason Wang <jasowang@redhat.com>
hw/net/dp8393x.c

index 911f59e0c91528f62d934b4b82bc793f1c6fee7c..63293411db9957b3afb106bd87f4971a0e50c0ed 100644 (file)
@@ -818,6 +818,7 @@ static ssize_t dp8393x_receive(NetClientState *nc, const uint8_t * buf,
     address += rx_len;
     address_space_write(&s->as, address, MEMTXATTRS_UNSPECIFIED,
                         &checksum, 4);
+    address += 4;
     rx_len += 4;
     s->regs[SONIC_CRBA1] = address >> 16;
     s->regs[SONIC_CRBA0] = address & 0xffff;