diff options
author | Gabe Black <gabeblack@google.com> | 2018-03-28 16:23:26 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-04-05 02:49:49 +0000 |
commit | f97f8a2804b528b110644303e3317c2bcc09889b (patch) | |
tree | 8644c1e4438714b064ab0c1bfa2726fd02f9d68b | |
parent | a82283ddbcc3f1d3b801a7c8b6b0980465bf8167 (diff) | |
download | gem5-f97f8a2804b528b110644303e3317c2bcc09889b.tar.xz |
dev: Make sure the EtherTap device uses the right event queue.
The EtherTap device may be called into from an event on the PollQueue when
some event queue other than its own is active. This change ensures that it
switches event queues if necessary before doing anything that may cause more
events to be scheduled.
Change-Id: If8666542d7664780c0b371230e1e5fba93fbc1c0
Reviewed-on: https://gem5-review.googlesource.com/9521
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
-rw-r--r-- | src/dev/net/ethertap.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/dev/net/ethertap.cc b/src/dev/net/ethertap.cc index ca19b4884..8d08cc2d2 100644 --- a/src/dev/net/ethertap.cc +++ b/src/dev/net/ethertap.cc @@ -79,7 +79,16 @@ class TapEvent : public PollEvent public: TapEvent(EtherTapBase *_tap, int fd, int e) : PollEvent(fd, e), tap(_tap) {} - virtual void process(int revent) { tap->recvReal(revent); } + + void + process(int revent) override + { + // Ensure that our event queue is active. It may not be since we get + // here from the PollQueue whenever a real packet happens to arrive. + EventQueue::ScopedMigration migrate(tap->eventQueue()); + + tap->recvReal(revent); + } }; EtherTapBase::EtherTapBase(const Params *p) |