Sean Wilson has submitted this change and it was merged. (
https://gem5-review.googlesource.com/3927 )
Change subject: net: Refactor some Event subclasses to lambdas
......................................................................
net: Refactor some Event subclasses to lambdas
Change-Id: I0e23f1529b26c36d749bf5211ee8623744d0b10f
Signed-off-by: Sean Wilson <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/3927
Maintainer: Jason Lowe-Power <[email protected]>
Reviewed-by: Jason Lowe-Power <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
---
M src/dev/net/etherbus.cc
M src/dev/net/etherbus.hh
M src/dev/net/ethertap.cc
M src/dev/net/ethertap.hh
4 files changed, 6 insertions(+), 30 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
Andreas Sandberg: Looks good to me, approved
diff --git a/src/dev/net/etherbus.cc b/src/dev/net/etherbus.cc
index 7ccb8a4..243e27b 100644
--- a/src/dev/net/etherbus.cc
+++ b/src/dev/net/etherbus.cc
@@ -52,7 +52,8 @@
EtherBus::EtherBus(const Params *p)
: EtherObject(p), ticksPerByte(p->speed), loopback(p->loopback),
- event(this), sender(0), dump(p->dump)
+ event([this]{ txDone(); }, "ethernet bus completion"),
+ sender(0), dump(p->dump)
{
}
diff --git a/src/dev/net/etherbus.hh b/src/dev/net/etherbus.hh
index 7395c28..1b26453 100644
--- a/src/dev/net/etherbus.hh
+++ b/src/dev/net/etherbus.hh
@@ -52,19 +52,7 @@
bool loopback;
protected:
- class DoneEvent : public Event
- {
- protected:
- EtherBus *bus;
-
- public:
- DoneEvent(EtherBus *b) : bus(b) {}
- virtual void process() { bus->txDone(); }
- virtual const char *description() const
- { return "ethernet bus completion"; }
- };
-
- DoneEvent event;
+ EventFunctionWrapper event;
EthPacketPtr packet;
EtherInt *sender;
EtherDump *dump;
diff --git a/src/dev/net/ethertap.cc b/src/dev/net/ethertap.cc
index 0c027b6..59314e5 100644
--- a/src/dev/net/ethertap.cc
+++ b/src/dev/net/ethertap.cc
@@ -84,7 +84,8 @@
EtherTapBase::EtherTapBase(const Params *p)
: EtherObject(p), buflen(p->bufsz), dump(p->dump), event(NULL),
- interface(NULL), txEvent(this)
+ interface(NULL),
+ txEvent([this]{ retransmit(); }, "EtherTapBase retransmit")
{
buffer = new uint8_t[buflen];
interface = new EtherTapInt(name() + ".interface", this);
diff --git a/src/dev/net/ethertap.hh b/src/dev/net/ethertap.hh
index 96cc471..9b4e175 100644
--- a/src/dev/net/ethertap.hh
+++ b/src/dev/net/ethertap.hh
@@ -109,21 +109,7 @@
protected:
std::queue<EthPacketPtr> packetBuffer;
void retransmit();
-
- class TxEvent : public Event
- {
- protected:
- EtherTapBase *tap;
-
- public:
- TxEvent(EtherTapBase *_tap) : tap(_tap) {}
- void process() { tap->retransmit(); }
- virtual const char *description() const
- { return "EtherTapBase retransmit"; }
- };
-
- friend class TxEvent;
- TxEvent txEvent;
+ EventFunctionWrapper txEvent;
};
class EtherTapInt : public EtherInt
--
To view, visit https://gem5-review.googlesource.com/3927
To unsubscribe, visit https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0e23f1529b26c36d749bf5211ee8623744d0b10f
Gerrit-Change-Number: 3927
Gerrit-PatchSet: 6
Gerrit-Owner: Sean Wilson <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Sean Wilson <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev