update for new reschedule semantics
authorAli Saidi <saidi@eecs.umich.edu>
Thu, 10 May 2007 02:34:54 +0000 (22:34 -0400)
committerAli Saidi <saidi@eecs.umich.edu>
Thu, 10 May 2007 02:34:54 +0000 (22:34 -0400)
--HG--
extra : convert_revision : 8c18b2513d638f67cc096e7f1483b47390a374ca

src/dev/i8254xGBe.cc
src/dev/io_device.cc
src/dev/ns_gige.cc
src/dev/sinic.cc
src/sim/eventq.hh
src/sim/pseudo_inst.cc

index e54249deecabf0ed9a61d81ded604ef8ac9bf977..680e31656a1f19de6bd1540d616adad52c5bbea2 100644 (file)
@@ -727,12 +727,8 @@ IGbE::RxDescCache::pktComplete()
     if (igbe->regs.rdtr.delay()) {
         DPRINTF(EthernetSM, "RXS: Scheduling DTR for %d\n",
                 igbe->regs.rdtr.delay() * igbe->intClock());
-        if (igbe->rdtrEvent.scheduled())
-            igbe->rdtrEvent.reschedule(curTick + igbe->regs.rdtr.delay() *
-                    igbe->intClock());
-        else
-            igbe->rdtrEvent.schedule(curTick + igbe->regs.rdtr.delay() *
-                    igbe->intClock());
+        igbe->rdtrEvent.reschedule(curTick + igbe->regs.rdtr.delay() *
+                    igbe->intClock(),true);
     }
 
     if (igbe->regs.radv.idv() && igbe->regs.rdtr.delay()) {
@@ -946,12 +942,8 @@ IGbE::TxDescCache::pktComplete()
         DPRINTF(EthernetDesc, "Descriptor had IDE set\n");
         if (igbe->regs.tidv.idv()) {
             DPRINTF(EthernetDesc, "setting tidv\n");
-            if (igbe->tidvEvent.scheduled())
-                igbe->tidvEvent.reschedule(curTick + igbe->regs.tidv.idv() *
-                        igbe->intClock());
-            else
-                igbe->tidvEvent.schedule(curTick + igbe->regs.tidv.idv() *
-                        igbe->intClock());
+            igbe->tidvEvent.reschedule(curTick + igbe->regs.tidv.idv() *
+                        igbe->intClock(), true);
         }
 
         if (igbe->regs.tadv.idv() && igbe->regs.tidv.idv()) {
index 9384c4b9241f20b41ee55d093a18b435833875ea..d430ace7226fc4a9dd660848b1190fd0e101eb47 100644 (file)
@@ -111,10 +111,7 @@ DmaPort::recvTiming(PacketPtr pkt)
         else if (backoffTime < device->maxBackoffDelay)
             backoffTime <<= 1;
 
-        if (backoffEvent.scheduled())
-            backoffEvent.reschedule(curTick + backoffTime);
-        else
-            backoffEvent.schedule(curTick + backoffTime);
+        backoffEvent.reschedule(curTick + backoffTime, true);
 
         DPRINTF(DMA, "Backoff time set to %d ticks\n", backoffTime);
 
index bec1fb848d2bde5436633f1fce20b325779804b6..d9985f80858e0fc0a8cb11d29a3b7fbce3ad592a 100644 (file)
@@ -2310,10 +2310,7 @@ NSGigE::transferDone()
 
     DPRINTF(Ethernet, "transfer complete: data in txFifo...schedule xmit\n");
 
-    if (txEvent.scheduled())
-        txEvent.reschedule(curTick + cycles(1));
-    else
-        txEvent.schedule(curTick + cycles(1));
+    txEvent.reschedule(curTick + cycles(1), true);
 }
 
 bool
index 1a72652da2c7d3706be1f14d4aefd93661b34796..420761620e7d5ccefa80ea3e51559ea441de9559 100644 (file)
@@ -1199,10 +1199,7 @@ Device::transferDone()
 
     DPRINTF(Ethernet, "transfer complete: data in txFifo...schedule xmit\n");
 
-    if (txEvent.scheduled())
-        txEvent.reschedule(curTick + cycles(1));
-    else
-        txEvent.schedule(curTick + cycles(1));
+    txEvent.reschedule(curTick + cycles(1), true);
 }
 
 bool
index a57e9077e538104687f651f2fee2d64a6abe6b08..974313968d38e74bc22e511f15bc178d40ca368c 100644 (file)
@@ -210,7 +210,8 @@ class Event : public Serializable, public FastAlloc
     void schedule(Tick t);
 
     /// Reschedule the event with the current priority
-    void reschedule(Tick t);
+    // always parameter means to schedule if not already scheduled
+    void reschedule(Tick t, bool always = false);
 
     /// Remove the event from the current schedule
     void deschedule();
@@ -402,16 +403,22 @@ Event::deschedule()
 }
 
 inline void
-Event::reschedule(Tick t)
+Event::reschedule(Tick t, bool always)
 {
-    assert(scheduled());
-    clearFlags(Squashed);
+    assert(scheduled() || always);
 
 #if TRACING_ON
     when_scheduled = curTick;
 #endif
     _when = t;
-    queue->reschedule(this);
+
+    if (scheduled()) {
+        clearFlags(Squashed);
+        queue->reschedule(this);
+    } else {
+        setFlags(Scheduled);
+        queue->schedule(this);
+    }
 }
 
 inline void
index 56a7796749e316bd2ae34ce8699a6de9f0c972d8..10127aa5ff407959afea48d0ca9da3e35ba15360 100644 (file)
@@ -87,10 +87,7 @@ namespace PseudoInst
 
         Tick resume = curTick + Clock::Int::ns * ns;
 
-        if (quiesceEvent->scheduled())
-            quiesceEvent->reschedule(resume);
-        else
-            quiesceEvent->schedule(resume);
+        quiesceEvent->reschedule(resume, true);
 
         DPRINTF(Quiesce, "%s: quiesceNs(%d) until %d\n",
                 tc->getCpuPtr()->name(), ns, resume);
@@ -110,10 +107,7 @@ namespace PseudoInst
 
         Tick resume = curTick + tc->getCpuPtr()->cycles(cycles);
 
-        if (quiesceEvent->scheduled())
-            quiesceEvent->reschedule(resume);
-        else
-            quiesceEvent->schedule(resume);
+        quiesceEvent->reschedule(resume, true);
 
         DPRINTF(Quiesce, "%s: quiesceCycles(%d) until %d\n",
                 tc->getCpuPtr()->name(), cycles, resume);