OSDN Git Service

hw/net/stellaris_enet: Correct handling of packet padding
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 13 May 2014 15:09:36 +0000 (16:09 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 13 May 2014 15:09:36 +0000 (16:09 +0100)
The PADEN bit in the transmit control register enables padding of short
data packets out to the required minimum length. However a typo here
meant we were adjusting tx_fifo_len rather than tx_frame_len, so the
padding didn't actually happen. Fix this bug.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: qemu-stable@nongnu.org
hw/net/stellaris_enet.c

index bd844cd..d0da819 100644 (file)
@@ -265,7 +265,7 @@ static void stellaris_enet_write(void *opaque, hwaddr offset,
                     s->tx_frame_len -= 4;
                 if ((s->tctl & SE_TCTL_PADEN) && s->tx_frame_len < 60) {
                     memset(&s->tx_fifo[s->tx_frame_len], 0, 60 - s->tx_frame_len);
-                    s->tx_fifo_len = 60;
+                    s->tx_frame_len = 60;
                 }
                 qemu_send_packet(qemu_get_queue(s->nic), s->tx_fifo,
                                  s->tx_frame_len);