we shouldn't ever pass around references to PacketPtrs,
const references are ok, or pass by value. --HG-- extra : convert_revision : 7280a1c7d22b9294fddbe50f02f6f4c6ca9b2e5b
This commit is contained in:
parent
bd3e3c0230
commit
acb98fb0f6
7 changed files with 22 additions and 22 deletions
|
@ -31,8 +31,8 @@
|
||||||
* components.
|
* components.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __ETHERINT_HH__
|
#ifndef __DEV_ETHERINT_HH__
|
||||||
#define __ETHERINT_HH__
|
#define __DEV_ETHERINT_HH__
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -54,13 +54,13 @@ class EtherInt : public SimObject
|
||||||
virtual ~EtherInt() {}
|
virtual ~EtherInt() {}
|
||||||
|
|
||||||
void setPeer(EtherInt *p);
|
void setPeer(EtherInt *p);
|
||||||
virtual bool recvPacket(PacketPtr &packet) = 0;
|
|
||||||
void recvDone() { peer->sendDone(); }
|
void recvDone() { peer->sendDone(); }
|
||||||
bool sendPacket(PacketPtr &packet)
|
|
||||||
{
|
|
||||||
return peer ? peer->recvPacket(packet) : true;
|
|
||||||
}
|
|
||||||
virtual void sendDone() = 0;
|
virtual void sendDone() = 0;
|
||||||
|
|
||||||
|
bool sendPacket(PacketPtr packet)
|
||||||
|
{ return peer ? peer->recvPacket(packet) : true; }
|
||||||
|
virtual bool recvPacket(PacketPtr packet) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __ETHERINT_HH__
|
#endif // __DEV_ETHERINT_HH__
|
||||||
|
|
|
@ -105,7 +105,7 @@ EtherLink::unserialize(Checkpoint *cp, const string §ion)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EtherLink::Link::txComplete(PacketPtr &packet)
|
EtherLink::Link::txComplete(PacketPtr packet)
|
||||||
{
|
{
|
||||||
DPRINTF(Ethernet, "packet received: len=%d\n", packet->length);
|
DPRINTF(Ethernet, "packet received: len=%d\n", packet->length);
|
||||||
DDUMP(EthernetData, packet->data, packet->length);
|
DDUMP(EthernetData, packet->data, packet->length);
|
||||||
|
@ -122,7 +122,7 @@ class LinkDelayEvent : public Event
|
||||||
LinkDelayEvent(EtherLink::Link *link);
|
LinkDelayEvent(EtherLink::Link *link);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LinkDelayEvent(EtherLink::Link *link, PacketPtr &pkt, Tick when);
|
LinkDelayEvent(EtherLink::Link *link, PacketPtr pkt, Tick when);
|
||||||
|
|
||||||
void process();
|
void process();
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ EtherLink::Link::txDone()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
EtherLink::Link::transmit(PacketPtr &pkt)
|
EtherLink::Link::transmit(PacketPtr pkt)
|
||||||
{
|
{
|
||||||
if (busy()) {
|
if (busy()) {
|
||||||
DPRINTF(Ethernet, "packet not sent, link busy\n");
|
DPRINTF(Ethernet, "packet not sent, link busy\n");
|
||||||
|
@ -217,7 +217,7 @@ LinkDelayEvent::LinkDelayEvent(EtherLink::Link *l)
|
||||||
setFlags(AutoDelete);
|
setFlags(AutoDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkDelayEvent::LinkDelayEvent(EtherLink::Link *l, PacketPtr &p, Tick when)
|
LinkDelayEvent::LinkDelayEvent(EtherLink::Link *l, PacketPtr p, Tick when)
|
||||||
: Event(&mainEventQueue), link(l), packet(p)
|
: Event(&mainEventQueue), link(l), packet(p)
|
||||||
{
|
{
|
||||||
setFlags(AutoSerialize);
|
setFlags(AutoSerialize);
|
||||||
|
|
|
@ -75,7 +75,7 @@ class EtherLink : public SimObject
|
||||||
DoneEvent doneEvent;
|
DoneEvent doneEvent;
|
||||||
|
|
||||||
friend class LinkDelayEvent;
|
friend class LinkDelayEvent;
|
||||||
void txComplete(PacketPtr &packet);
|
void txComplete(PacketPtr packet);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Link(const std::string &name, double rate, Tick delay,
|
Link(const std::string &name, double rate, Tick delay,
|
||||||
|
@ -85,7 +85,7 @@ class EtherLink : public SimObject
|
||||||
virtual const std::string name() const { return objName; }
|
virtual const std::string name() const { return objName; }
|
||||||
|
|
||||||
bool busy() const { return (bool)packet; }
|
bool busy() const { return (bool)packet; }
|
||||||
bool transmit(PacketPtr &packet);
|
bool transmit(PacketPtr packet);
|
||||||
|
|
||||||
void setTxInt(Interface *i) { assert(!txint); txint = i; }
|
void setTxInt(Interface *i) { assert(!txint); txint = i; }
|
||||||
void setRxInt(Interface *i) { assert(!rxint); rxint = i; }
|
void setRxInt(Interface *i) { assert(!rxint); rxint = i; }
|
||||||
|
@ -104,7 +104,7 @@ class EtherLink : public SimObject
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Interface(const std::string &name, Link *txlink, Link *rxlink);
|
Interface(const std::string &name, Link *txlink, Link *rxlink);
|
||||||
bool recvPacket(PacketPtr &packet) { return txlink->transmit(packet); }
|
bool recvPacket(PacketPtr packet) { return txlink->transmit(packet); }
|
||||||
void sendDone() { peer->sendDone(); }
|
void sendDone() { peer->sendDone(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ EtherTap::detach()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
EtherTap::recvPacket(PacketPtr &packet)
|
EtherTap::recvPacket(PacketPtr packet)
|
||||||
{
|
{
|
||||||
if (dump)
|
if (dump)
|
||||||
dump->dump(packet);
|
dump->dump(packet);
|
||||||
|
|
|
@ -94,7 +94,7 @@ class EtherTap : public EtherInt
|
||||||
EtherTap(const std::string &name, EtherDump *dump, int port, int bufsz);
|
EtherTap(const std::string &name, EtherDump *dump, int port, int bufsz);
|
||||||
virtual ~EtherTap();
|
virtual ~EtherTap();
|
||||||
|
|
||||||
virtual bool recvPacket(PacketPtr &packet);
|
virtual bool recvPacket(PacketPtr packet);
|
||||||
virtual void sendDone();
|
virtual void sendDone();
|
||||||
|
|
||||||
virtual void serialize(std::ostream &os);
|
virtual void serialize(std::ostream &os);
|
||||||
|
|
|
@ -1979,7 +1979,7 @@ NSGigE::transferDone()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
NSGigE::rxFilter(PacketPtr &packet)
|
NSGigE::rxFilter(const PacketPtr &packet)
|
||||||
{
|
{
|
||||||
EthPtr eth = packet;
|
EthPtr eth = packet;
|
||||||
bool drop = true;
|
bool drop = true;
|
||||||
|
@ -2019,7 +2019,7 @@ NSGigE::rxFilter(PacketPtr &packet)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
NSGigE::recvPacket(PacketPtr &packet)
|
NSGigE::recvPacket(PacketPtr packet)
|
||||||
{
|
{
|
||||||
rxBytes += packet->length;
|
rxBytes += packet->length;
|
||||||
rxPackets++;
|
rxPackets++;
|
||||||
|
|
|
@ -295,7 +295,7 @@ class NSGigE : public PciDev
|
||||||
* receive address filter
|
* receive address filter
|
||||||
*/
|
*/
|
||||||
bool rxFilterEnable;
|
bool rxFilterEnable;
|
||||||
bool rxFilter(PacketPtr &packet);
|
bool rxFilter(const PacketPtr &packet);
|
||||||
bool acceptBroadcast;
|
bool acceptBroadcast;
|
||||||
bool acceptMulticast;
|
bool acceptMulticast;
|
||||||
bool acceptUnicast;
|
bool acceptUnicast;
|
||||||
|
@ -360,7 +360,7 @@ class NSGigE : public PciDev
|
||||||
bool cpuIntrPending() const;
|
bool cpuIntrPending() const;
|
||||||
void cpuIntrAck() { cpuIntrClear(); }
|
void cpuIntrAck() { cpuIntrClear(); }
|
||||||
|
|
||||||
bool recvPacket(PacketPtr &packet);
|
bool recvPacket(PacketPtr packet);
|
||||||
void transferDone();
|
void transferDone();
|
||||||
|
|
||||||
void setInterface(NSGigEInt *i) { assert(!interface); interface = i; }
|
void setInterface(NSGigEInt *i) { assert(!interface); interface = i; }
|
||||||
|
@ -407,7 +407,7 @@ class NSGigEInt : public EtherInt
|
||||||
NSGigEInt(const std::string &name, NSGigE *d)
|
NSGigEInt(const std::string &name, NSGigE *d)
|
||||||
: EtherInt(name), dev(d) { dev->setInterface(this); }
|
: EtherInt(name), dev(d) { dev->setInterface(this); }
|
||||||
|
|
||||||
virtual bool recvPacket(PacketPtr &pkt) { return dev->recvPacket(pkt); }
|
virtual bool recvPacket(PacketPtr pkt) { return dev->recvPacket(pkt); }
|
||||||
virtual void sendDone() { dev->transferDone(); }
|
virtual void sendDone() { dev->transferDone(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue