summaryrefslogtreecommitdiff
path: root/src/dev/net/ns_gige.cc
diff options
context:
space:
mode:
authormlebeane <michael.lebeane@amd.com>2016-10-26 22:48:33 -0400
committermlebeane <michael.lebeane@amd.com>2016-10-26 22:48:33 -0400
commit96905971f26e5218baebf8f953f05a9b341f9cc6 (patch)
tree4f2d06b18a4fc4bc92a4303e02e5c7668e2ec043 /src/dev/net/ns_gige.cc
parentde72e36619350f9b3e3a3dc8de63b490c4cecf2d (diff)
downloadgem5-96905971f26e5218baebf8f953f05a9b341f9cc6.tar.xz
dev: Add 'simLength' parameter in EthPacketData
Currently, all the network devices create a 16K buffer for the 'data' field in EthPacketData, and use 'length' to keep track of the size of the packet in the buffer. This patch introduces the 'simLength' parameter to EthPacketData, which is used to hold the effective length of the packet used for all timing calulations in the simulator. Serialization is performed using only the useful data in the packet ('length') and not necessarily the entire original buffer.
Diffstat (limited to 'src/dev/net/ns_gige.cc')
-rw-r--r--src/dev/net/ns_gige.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dev/net/ns_gige.cc b/src/dev/net/ns_gige.cc
index 3bf048972..91a0da7a9 100644
--- a/src/dev/net/ns_gige.cc
+++ b/src/dev/net/ns_gige.cc
@@ -1738,6 +1738,7 @@ NSGigE::txKick()
}
}
+ txPacket->simLength = txPacketBufPtr - txPacket->data;
txPacket->length = txPacketBufPtr - txPacket->data;
// this is just because the receive can't handle a
// packet bigger want to make sure
@@ -2186,6 +2187,7 @@ NSGigE::serialize(CheckpointOut &cp) const
bool txPacketExists = txPacket != nullptr;
SERIALIZE_SCALAR(txPacketExists);
if (txPacketExists) {
+ txPacket->simLength = txPacketBufPtr - txPacket->data;
txPacket->length = txPacketBufPtr - txPacket->data;
txPacket->serialize("txPacket", cp);
uint32_t txPktBufPtr = (uint32_t) (txPacketBufPtr - txPacket->data);
@@ -2350,7 +2352,7 @@ NSGigE::unserialize(CheckpointIn &cp)
bool txPacketExists;
UNSERIALIZE_SCALAR(txPacketExists);
if (txPacketExists) {
- txPacket = make_shared<EthPacketData>(16384);
+ txPacket = make_shared<EthPacketData>();
txPacket->unserialize("txPacket", cp);
uint32_t txPktBufPtr;
UNSERIALIZE_SCALAR(txPktBufPtr);
@@ -2362,7 +2364,7 @@ NSGigE::unserialize(CheckpointIn &cp)
UNSERIALIZE_SCALAR(rxPacketExists);
rxPacket = 0;
if (rxPacketExists) {
- rxPacket = make_shared<EthPacketData>(16384);
+ rxPacket = make_shared<EthPacketData>();
rxPacket->unserialize("rxPacket", cp);
uint32_t rxPktBufPtr;
UNSERIALIZE_SCALAR(rxPktBufPtr);