Merge gblack@m5.eecs.umich.edu:/bk/multiarch
[gem5.git] / dev / ethertap.cc
index 1603a9bd3a25f5a37cd59c6122a53630e3c56d9f..7589991ef7fd3ec1ec84bda413e7bf63ddcddc87 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003-2004 The Regents of The University of Michigan
+ * Copyright (c) 2003-2005 The Regents of The University of Michigan
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -237,9 +237,10 @@ EtherTap::process(int revent)
             DPRINTF(Ethernet, "bus busy...buffer for retransmission\n");
             packetBuffer.push(packet);
             if (!txEvent.scheduled())
-                txEvent.schedule(curTick + 1000);
-        } else if (dump)
+                txEvent.schedule(curTick + retryTime);
+        } else if (dump) {
             dump->dump(packet);
+        }
     }
 }
 
@@ -259,7 +260,7 @@ EtherTap::retransmit()
     }
 
     if (!packetBuffer.empty() && !txEvent.scheduled())
-        txEvent.schedule(curTick + 1000);
+        txEvent.schedule(curTick + retryTime);
 }
 
 //=====================================================================
@@ -269,7 +270,8 @@ EtherTap::serialize(ostream &os)
 {
     SERIALIZE_SCALAR(socket);
     SERIALIZE_SCALAR(buflen);
-    SERIALIZE_ARRAY((uint8_t *)buffer,buflen);
+    uint8_t *buffer = (uint8_t *)this->buffer;
+    SERIALIZE_ARRAY(buffer, buflen);
     SERIALIZE_SCALAR(buffer_offset);
     SERIALIZE_SCALAR(data_len);
 
@@ -289,7 +291,8 @@ EtherTap::unserialize(Checkpoint *cp, const std::string &section)
 {
     UNSERIALIZE_SCALAR(socket);
     UNSERIALIZE_SCALAR(buflen);
-    UNSERIALIZE_ARRAY((uint8_t *)buffer,buflen);
+    uint8_t *buffer = (uint8_t *)this->buffer;
+    UNSERIALIZE_ARRAY(buffer, buflen);
     UNSERIALIZE_SCALAR(buffer_offset);
     UNSERIALIZE_SCALAR(data_len);
 
@@ -311,7 +314,7 @@ EtherTap::unserialize(Checkpoint *cp, const std::string &section)
 BEGIN_DECLARE_SIM_OBJECT_PARAMS(EtherTap)
 
     SimObjectParam<EtherInt *> peer;
-    SimObjectParam<EtherDump *> packet_dump;
+    SimObjectParam<EtherDump *> dump;
     Param<unsigned> port;
     Param<unsigned> bufsz;
 
@@ -320,7 +323,7 @@ END_DECLARE_SIM_OBJECT_PARAMS(EtherTap)
 BEGIN_INIT_SIM_OBJECT_PARAMS(EtherTap)
 
     INIT_PARAM_DFLT(peer, "peer interface", NULL),
-    INIT_PARAM_DFLT(packet_dump, "object to dump network packets to", NULL),
+    INIT_PARAM_DFLT(dump, "object to dump network packets to", NULL),
     INIT_PARAM_DFLT(port, "tap port", 3500),
     INIT_PARAM_DFLT(bufsz, "tap buffer size", 10000)
 
@@ -329,7 +332,7 @@ END_INIT_SIM_OBJECT_PARAMS(EtherTap)
 
 CREATE_SIM_OBJECT(EtherTap)
 {
-    EtherTap *tap = new EtherTap(getInstanceName(), packet_dump, port, bufsz);
+    EtherTap *tap = new EtherTap(getInstanceName(), dump, port, bufsz);
 
     if (peer) {
         tap->setPeer(peer);