summaryrefslogtreecommitdiff
path: root/src/dev/net/etherpkt.hh
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/etherpkt.hh
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/etherpkt.hh')
-rw-r--r--src/dev/net/etherpkt.hh24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/dev/net/etherpkt.hh b/src/dev/net/etherpkt.hh
index 457563293..f84c03a4c 100644
--- a/src/dev/net/etherpkt.hh
+++ b/src/dev/net/etherpkt.hh
@@ -49,33 +49,37 @@
class EthPacketData
{
public:
- /*
+ /**
* Pointer to packet data will be deleted
*/
uint8_t *data;
- /*
- * Length of the current packet
+ /**
+ * Amount of space occupied by the payload in the data buffer
*/
unsigned length;
- public:
+ /**
+ * Effective length, used for modeling timing in the simulator.
+ * This could be different from length if the packets are assumed
+ * to use a tightly packed or compressed format, but it's not worth
+ * the performance/complexity hit to perform that packing or compression
+ * in the simulation.
+ */
+ unsigned simLength;
+
EthPacketData()
- : data(NULL), length(0)
+ : data(nullptr), length(0), simLength(0)
{ }
explicit EthPacketData(unsigned size)
- : data(new uint8_t[size]), length(0)
+ : data(new uint8_t[size]), length(0), simLength(0)
{ }
~EthPacketData() { if (data) delete [] data; }
- public:
-
void serialize(const std::string &base, CheckpointOut &cp) const;
void unserialize(const std::string &base, CheckpointIn &cp);
-
- unsigned size() const { return length; }
};
typedef std::shared_ptr<EthPacketData> EthPacketPtr;