projects
/
gem5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge gblack@m5.eecs.umich.edu:/bk/multiarch
[gem5.git]
/
dev
/
ethertap.cc
diff --git
a/dev/ethertap.cc
b/dev/ethertap.cc
index db1b3660f0c7e107f8d20d5d56f92a43f46726b7..7589991ef7fd3ec1ec84bda413e7bf63ddcddc87 100644
(file)
--- a/
dev/ethertap.cc
+++ b/
dev/ethertap.cc
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2003 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
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@
-30,7
+30,7
@@
* Interface to connect a simulated ethernet device to the real world
*/
* Interface to connect a simulated ethernet device to the real world
*/
-#if defined(__OpenBSD__)
+#if defined(__OpenBSD__)
|| defined(__APPLE__)
#include <sys/param.h>
#endif
#include <netinet/in.h>
#include <sys/param.h>
#endif
#include <netinet/in.h>
@@
-169,7
+169,7
@@
EtherTap::detach()
}
bool
}
bool
-EtherTap::recvPacket(PacketPtr
&
packet)
+EtherTap::recvPacket(PacketPtr packet)
{
if (dump)
dump->dump(packet);
{
if (dump)
dump->dump(packet);
@@
-219,8
+219,7
@@
EtherTap::process(int revent)
while (data_len != 0 && buffer_offset >= data_len + sizeof(u_int32_t)) {
PacketPtr packet;
while (data_len != 0 && buffer_offset >= data_len + sizeof(u_int32_t)) {
PacketPtr packet;
- packet = new EtherPacket;
- packet->data = new uint8_t[data_len];
+ packet = new PacketData(data_len);
packet->length = data_len;
memcpy(packet->data, data, data_len);
packet->length = data_len;
memcpy(packet->data, data, data_len);
@@
-238,9
+237,10
@@
EtherTap::process(int revent)
DPRINTF(Ethernet, "bus busy...buffer for retransmission\n");
packetBuffer.push(packet);
if (!txEvent.scheduled())
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);
dump->dump(packet);
+ }
}
}
}
}
@@
-260,7
+260,7
@@
EtherTap::retransmit()
}
if (!packetBuffer.empty() && !txEvent.scheduled())
}
if (!packetBuffer.empty() && !txEvent.scheduled())
- txEvent.schedule(curTick +
1000
);
+ txEvent.schedule(curTick +
retryTime
);
}
//=====================================================================
}
//=====================================================================
@@
-270,7
+270,8
@@
EtherTap::serialize(ostream &os)
{
SERIALIZE_SCALAR(socket);
SERIALIZE_SCALAR(buflen);
{
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);
SERIALIZE_SCALAR(buffer_offset);
SERIALIZE_SCALAR(data_len);
@@
-290,7
+291,8
@@
EtherTap::unserialize(Checkpoint *cp, const std::string §ion)
{
UNSERIALIZE_SCALAR(socket);
UNSERIALIZE_SCALAR(buflen);
{
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);
UNSERIALIZE_SCALAR(buffer_offset);
UNSERIALIZE_SCALAR(data_len);
@@
-312,7
+314,7
@@
EtherTap::unserialize(Checkpoint *cp, const std::string §ion)
BEGIN_DECLARE_SIM_OBJECT_PARAMS(EtherTap)
SimObjectParam<EtherInt *> peer;
BEGIN_DECLARE_SIM_OBJECT_PARAMS(EtherTap)
SimObjectParam<EtherInt *> peer;
- SimObjectParam<EtherDump *>
packet_
dump;
+ SimObjectParam<EtherDump *> dump;
Param<unsigned> port;
Param<unsigned> bufsz;
Param<unsigned> port;
Param<unsigned> bufsz;
@@
-321,7
+323,7
@@
END_DECLARE_SIM_OBJECT_PARAMS(EtherTap)
BEGIN_INIT_SIM_OBJECT_PARAMS(EtherTap)
INIT_PARAM_DFLT(peer, "peer interface", NULL),
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)
INIT_PARAM_DFLT(port, "tap port", 3500),
INIT_PARAM_DFLT(bufsz, "tap buffer size", 10000)
@@
-330,7
+332,7
@@
END_INIT_SIM_OBJECT_PARAMS(EtherTap)
CREATE_SIM_OBJECT(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);
if (peer) {
tap->setPeer(peer);