aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-01-30 22:25:39 +0000
committerPeter Maydell <peter.maydell@linaro.org>2014-01-30 22:25:39 +0000
commit8e02b359267f8919de799525a4ccd4d37ef2d127 (patch)
tree55b0fe1bc24b7eb5b00324327da16e7685e6a0b6 /hw
parentdc08f85188b5976d93bff25ab9e68cf3ce62b12f (diff)
parent1f149e721feb617d14a3ee4f5911c47b29866a54 (diff)
Merge remote-tracking branch 'stefanha/tags/net-pull-request' into staging
Net patches # gpg: Signature made Mon 27 Jan 2014 14:45:35 GMT using RSA key ID 81AB73C8 # gpg: Can't check signature: public key not found * stefanha/tags/net-pull-request: tap-linux: Get features once and use it many times Fix lan9118 buffer length handling Fix lan9118 TX "CMD A" handling net: Use g_strdup_printf instead of snprintf. Message-id: 1390834129-19625-1-git-send-email-stefanha@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/net/lan9118.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
index 2315f996d4..e528290b41 100644
--- a/hw/net/lan9118.c
+++ b/hw/net/lan9118.c
@@ -727,14 +727,14 @@ static void tx_fifo_push(lan9118_state *s, uint32_t val)
s->txp->cmd_a = val & 0x831f37ff;
s->txp->fifo_used++;
s->txp->state = TX_B;
+ s->txp->buffer_size = extract32(s->txp->cmd_a, 0, 11);
+ s->txp->offset = extract32(s->txp->cmd_a, 16, 5);
break;
case TX_B:
if (s->txp->cmd_a & 0x2000) {
/* First segment */
s->txp->cmd_b = val;
s->txp->fifo_used++;
- s->txp->buffer_size = s->txp->cmd_a & 0x7ff;
- s->txp->offset = (s->txp->cmd_a >> 16) & 0x1f;
/* End alignment does not include command words. */
n = (s->txp->buffer_size + s->txp->offset + 3) >> 2;
switch ((n >> 24) & 3) {
@@ -763,7 +763,7 @@ static void tx_fifo_push(lan9118_state *s, uint32_t val)
if (s->txp->buffer_size <= 0 && s->txp->pad != 0) {
s->txp->pad--;
} else {
- n = 4;
+ n = MIN(4, s->txp->buffer_size + s->txp->offset);
while (s->txp->offset) {
val >>= 8;
n--;