aboutsummaryrefslogtreecommitdiff
path: root/hw/net/dp8393x.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2020-01-29 20:27:49 +1100
committerJason Wang <jasowang@redhat.com>2020-03-03 18:04:47 +0800
commitbae112b80c9c42cea21ee7623c283668c3451c2e (patch)
tree11e251c289243b6c1dc1ac855f8f8752a1b1a1f0 /hw/net/dp8393x.c
parentada74315270d1dcabf4c9d4fece19df7ef5b9577 (diff)
downloadqemu-bae112b80c9c42cea21ee7623c283668c3451c2e.zip
qemu-bae112b80c9c42cea21ee7623c283668c3451c2e.tar.gz
qemu-bae112b80c9c42cea21ee7623c283668c3451c2e.tar.bz2
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 <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>
Diffstat (limited to 'hw/net/dp8393x.c')
-rw-r--r--hw/net/dp8393x.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index 911f59e..6329341 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -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;