diff options
author | Nathan Binkert <binkertn@umich.edu> | 2005-11-25 11:22:41 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2005-11-25 11:22:41 -0500 |
commit | 60e92986f739a025a6534972b8e1cf9498ce3fd2 (patch) | |
tree | 8a521054aa240858ed0f2840a53e361df4d2e269 /dev/etherpkt.hh | |
parent | c0a4836077425e03cc39dfba88bec7da21af950b (diff) | |
download | gem5-60e92986f739a025a6534972b8e1cf9498ce3fd2.tar.xz |
Add the capability to iterate through the packets in a pktfifo,
and to remove elements in the middle of the fifo. These elements
do not free space, they are just marked removed. Space is only
freed from the front of the fifo.
dev/etherpkt.cc:
serialize the current slack
dev/etherpkt.hh:
add "slack" to the ethernet packet. It is to be used by any fifo that
the packet is currently in to account for extra space that the packet
may be occupying due to the fifo organization.
--HG--
extra : convert_revision : 8e7c541ba316a9a76495c54cc5f707f8fc65b6d5
Diffstat (limited to 'dev/etherpkt.hh')
-rw-r--r-- | dev/etherpkt.hh | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/dev/etherpkt.hh b/dev/etherpkt.hh index 82d22bfad..cb9022d72 100644 --- a/dev/etherpkt.hh +++ b/dev/etherpkt.hh @@ -47,14 +47,30 @@ class Checkpoint; class PacketData : public RefCounted { public: + /* + * Pointer to packet data will be deleted + */ uint8_t *data; + + /* + * Length of the current packet + */ int length; + /* + * Extra space taken up by the packet in whatever data structure + * it is in. + * + * NOTE: This can only be use by *one* data structure at a time! + */ + int slack; + public: - PacketData() : data(NULL), length(0) { } - explicit PacketData(size_t size) : data(new uint8_t[size]), length(0) { } - PacketData(std::auto_ptr<uint8_t> d, int l) - : data(d.release()), length(l) { } + PacketData() : data(NULL), length(0), slack(0) { } + explicit PacketData(size_t size) + : data(new uint8_t[size]), length(0), slack(0) { } + PacketData(std::auto_ptr<uint8_t> d, int l, int s = 0) + : data(d.release()), length(l), slack(s) { } ~PacketData() { if (data) delete [] data; } public: |