From f97f8a2804b528b110644303e3317c2bcc09889b Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 28 Mar 2018 16:23:26 -0700 Subject: [PATCH] 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 Maintainer: Gabe Black --- src/dev/net/ethertap.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) -- 2.30.2