sim,dev: Get rid of the global retryTime constant.
authorGabe Black <gabeblack@google.com>
Sat, 23 May 2020 14:19:48 +0000 (07:19 -0700)
committerGabe Black <gabeblack@google.com>
Mon, 25 May 2020 12:44:38 +0000 (12:44 +0000)
This constant isn't in normalized units, ie doesn't scale when the time
value of a Tick changes, is global, has an extremely generic name even
though it's only used by a few ethernet devices, and has an arbitrary
value.

Get rid of it, and replace it with 1ns, what it would typically be
equivalent to when using the default 1ps time scale.

Change-Id: I31d9dad438f854b4152cd53c9a7042a25d13e0a6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29398
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/dev/net/etherswitch.cc
src/dev/net/ethertap.cc
src/dev/net/ns_gige.cc
src/sim/core.hh

index e7a60a17d96e03323ff7ddadb8facd6d4461b163..972cf56b85146335a9bd6cf799e7cd1b02885fde 100644 (file)
@@ -184,7 +184,7 @@ EtherSwitch::Interface::transmit()
     if (!sendPacket(outputFifo.front())) {
         DPRINTF(Ethernet, "output port busy...retry later\n");
         if (!txEvent.scheduled())
-            parent->schedule(txEvent, curTick() + retryTime);
+            parent->schedule(txEvent, curTick() + SimClock::Int::ns);
     } else {
         DPRINTF(Ethernet, "packet sent: len=%d\n", outputFifo.front()->length);
         outputFifo.pop();
index 33bafb7013644010da03833696e7439ddb2e3ff9..f4aba21aa91ace98206f75072ca7ae5138d9e2eb 100644 (file)
@@ -196,7 +196,7 @@ EtherTapBase::sendSimulated(void *data, size_t len)
         DPRINTF(Ethernet, "bus busy...buffer for retransmission\n");
         packetBuffer.push(packet);
         if (!txEvent.scheduled())
-            schedule(txEvent, curTick() + retryTime);
+            schedule(txEvent, curTick() + SimClock::Int::ns);
     } else if (dump) {
         dump->dump(packet);
     }
@@ -218,7 +218,7 @@ EtherTapBase::retransmit()
     }
 
     if (!packetBuffer.empty() && !txEvent.scheduled())
-        schedule(txEvent, curTick() + retryTime);
+        schedule(txEvent, curTick() + SimClock::Int::ns);
 }
 
 
index 68c449747afd1c69f9abf2698602b1f6baa09515..71f449a4d8abe3b2bdf6ec394cf6b70c41e77f47 100644 (file)
@@ -1395,7 +1395,7 @@ NSGigE::transmit()
 
    if (!txFifo.empty() && !txEvent.scheduled()) {
        DPRINTF(Ethernet, "reschedule transmit\n");
-       schedule(txEvent, curTick() + retryTime);
+       schedule(txEvent, curTick() + SimClock::Int::ns);
    }
 }
 
index 7a7e911317fb88372f364e6102b39b6020026661..48b70960b23015c8e9d6ba6743f6d58dd6727333 100644 (file)
@@ -43,8 +43,6 @@
 /// The universal simulation clock.
 inline Tick curTick() { return _curEventQueue->getCurTick(); }
 
-const Tick retryTime = 1000;
-
 /// These are variables that are set based on the simulator frequency
 ///@{
 namespace SimClock {