summaryrefslogtreecommitdiff
path: root/src/dev/net/etherpkt.hh
diff options
context:
space:
mode:
authorMichael LeBeane <michael.lebeane@amd.com>2016-11-29 13:04:45 -0500
committerMichael LeBeane <michael.lebeane@amd.com>2016-11-29 13:04:45 -0500
commitcd4b26b6ae984a75e16f4d71152d99b6c063d366 (patch)
tree33248f61326415ea11ff30dce527ed8fa5121231 /src/dev/net/etherpkt.hh
parent4b7bc5b1e1915915a746af16d36de1d006db8700 (diff)
downloadgem5-cd4b26b6ae984a75e16f4d71152d99b6c063d366.tar.xz
dev: Fix buffer length when unserializing an eth pkt
Changeset 11701 only serialized the useful portion of of an ethernet packets' payload. However, the device models expect each ethernet packet to contain a 16KB buffer, even if there is no data in it. This patch adds a 'bufLength' field to EthPacketData so the original size of the packet buffer can always be unserialized. Reported-by: Gabor Dozsa <Gabor.Dozsa@arm.com>
Diffstat (limited to 'src/dev/net/etherpkt.hh')
-rw-r--r--src/dev/net/etherpkt.hh9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dev/net/etherpkt.hh b/src/dev/net/etherpkt.hh
index f84c03a4c..a9cc79b80 100644
--- a/src/dev/net/etherpkt.hh
+++ b/src/dev/net/etherpkt.hh
@@ -55,6 +55,11 @@ class EthPacketData
uint8_t *data;
/**
+ * Total size of the allocated data buffer.
+ */
+ unsigned bufLength;
+
+ /**
* Amount of space occupied by the payload in the data buffer
*/
unsigned length;
@@ -69,11 +74,11 @@ class EthPacketData
unsigned simLength;
EthPacketData()
- : data(nullptr), length(0), simLength(0)
+ : data(nullptr), bufLength(0), length(0), simLength(0)
{ }
explicit EthPacketData(unsigned size)
- : data(new uint8_t[size]), length(0), simLength(0)
+ : data(new uint8_t[size]), bufLength(size), length(0), simLength(0)
{ }
~EthPacketData() { if (data) delete [] data; }