From: Gabe Black Date: Wed, 28 Mar 2018 23:23:26 +0000 (-0700) Subject: dev: Make sure the EtherTap device uses the right event queue. X-Git-Tag: v19.0.0.0~2187 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f97f8a2804b528b110644303e3317c2bcc09889b;p=gem5.git 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 --- 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)