[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 5/8] e1000: Fixing the received/transmitted packe
From: |
Leonid Bloch |
Subject: |
[Qemu-devel] [PATCH v5 5/8] e1000: Fixing the received/transmitted packets' counters |
Date: |
Mon, 9 Nov 2015 16:59:27 +0200 |
According to Intel's specs, these counters (as the other Statistic
registers) stick at 0xffffffff when this maximal value is reached.
Previously, they would reset after the max. value.
Signed-off-by: Leonid Bloch <address@hidden>
Signed-off-by: Dmitry Fleytman <address@hidden>
---
hw/net/e1000.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 28fa59c..c301637 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -580,6 +580,14 @@ putsum(uint8_t *data, uint32_t n, uint32_t sloc, uint32_t
css, uint32_t cse)
}
}
+static inline void
+inc_reg_if_not_full(E1000State *s, int index)
+{
+ if (s->mac_reg[index] != 0xffffffff) {
+ s->mac_reg[index]++;
+ }
+}
+
static inline int
vlan_enabled(E1000State *s)
{
@@ -677,8 +685,8 @@ xmit_seg(E1000State *s)
e1000_send_packet(s, tp->data, tp->size);
}
- s->mac_reg[TPT]++;
- s->mac_reg[GPTC]++;
+ inc_reg_if_not_full(s, TPT);
+ s->mac_reg[GPTC] = s->mac_reg[TPT];
n = s->mac_reg[TOTL];
if ((s->mac_reg[TOTL] += s->tx.size) < n)
s->mac_reg[TOTH]++;
@@ -1091,8 +1099,8 @@ e1000_receive_iov(NetClientState *nc, const struct iovec
*iov, int iovcnt)
}
} while (desc_offset < total_size);
- s->mac_reg[GPRC]++;
- s->mac_reg[TPR]++;
+ inc_reg_if_not_full(s, TPR);
+ s->mac_reg[GPRC] = s->mac_reg[TPR];
/* TOR - Total Octets Received:
* This register includes bytes received in a packet from the <Destination
* Address> field through the <CRC> field, inclusively.
--
2.4.3
- [Qemu-devel] [PATCH v5 0/8] e1000: Various fixes and registers' implementation, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 2/8] e1000: Add support for migrating the entire MAC registers' array, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 1/8] e1000: Cosmetic and alignment fixes, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 4/8] e1000: Trivial implementation of various MAC registers, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 3/8] e1000: Introduced an array to control the access to the MAC registers, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 6/8] e1000: Fixing the received/transmitted octets' counters, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 5/8] e1000: Fixing the received/transmitted packets' counters,
Leonid Bloch <=
- [Qemu-devel] [PATCH v5 7/8] e1000: Fixing the packet address filtering procedure, Leonid Bloch, 2015/11/09
- [Qemu-devel] [PATCH v5 8/8] e1000: Implementing various counters, Leonid Bloch, 2015/11/09
- Re: [Qemu-devel] [PATCH v5 0/8] e1000: Various fixes and registers' implementation, Jason Wang, 2015/11/10
- Re: [Qemu-devel] [PATCH v5 0/8] e1000: Various fixes and registers' implementation, Leonid Bloch, 2015/11/10
- Re: [Qemu-devel] [PATCH v5 0/8] e1000: Various fixes and registers' implementation, Jason Wang, 2015/11/10
- Re: [Qemu-devel] [PATCH v5 0/8] e1000: Various fixes and registers' implementation, Leonid Bloch, 2015/11/10
- Re: [Qemu-devel] [PATCH v5 0/8] e1000: Various fixes and registers' implementation, Leonid Bloch, 2015/11/10
- Re: [Qemu-devel] [PATCH v5 0/8] e1000: Various fixes and registers' implementation, Jason Wang, 2015/11/10
- Re: [Qemu-devel] [PATCH v5 0/8] e1000: Various fixes and registers' implementation, Leonid Bloch, 2015/11/11
- Re: [Qemu-devel] [PATCH v5 0/8] e1000: Various fixes and registers' implementation, Jason Wang, 2015/11/11