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:
Nathan Binkert 2004-11-13 16:33:16 -05:00
parent bd3e3c0230
commit acb98fb0f6
7 changed files with 22 additions and 22 deletions

View file

@ -31,8 +31,8 @@
* components.
*/
#ifndef __ETHERINT_HH__
#define __ETHERINT_HH__
#ifndef __DEV_ETHERINT_HH__
#define __DEV_ETHERINT_HH__
#include <string>
@ -54,13 +54,13 @@ class EtherInt : public SimObject
virtual ~EtherInt() {}
void setPeer(EtherInt *p);
virtual bool recvPacket(PacketPtr &packet) = 0;
void recvDone() { peer->sendDone(); }
bool sendPacket(PacketPtr &packet)
{
return peer ? peer->recvPacket(packet) : true;
}
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__

View file

@ -105,7 +105,7 @@ EtherLink::unserialize(Checkpoint *cp, const string &section)
}
void
EtherLink::Link::txComplete(PacketPtr &packet)
EtherLink::Link::txComplete(PacketPtr packet)
{
DPRINTF(Ethernet, "packet received: len=%d\n", packet->length);
DDUMP(EthernetData, packet->data, packet->length);
@ -122,7 +122,7 @@ class LinkDelayEvent : public Event
LinkDelayEvent(EtherLink::Link *link);
public:
LinkDelayEvent(EtherLink::Link *link, PacketPtr &pkt, Tick when);
LinkDelayEvent(EtherLink::Link *link, PacketPtr pkt, Tick when);
void process();
@ -153,7 +153,7 @@ EtherLink::Link::txDone()
}
bool
EtherLink::Link::transmit(PacketPtr &pkt)
EtherLink::Link::transmit(PacketPtr pkt)
{
if (busy()) {
DPRINTF(Ethernet, "packet not sent, link busy\n");
@ -217,7 +217,7 @@ LinkDelayEvent::LinkDelayEvent(EtherLink::Link *l)
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)
{
setFlags(AutoSerialize);

View file

@ -75,7 +75,7 @@ class EtherLink : public SimObject
DoneEvent doneEvent;
friend class LinkDelayEvent;
void txComplete(PacketPtr &packet);
void txComplete(PacketPtr packet);
public:
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; }
bool busy() const { return (bool)packet; }
bool transmit(PacketPtr &packet);
bool transmit(PacketPtr packet);
void setTxInt(Interface *i) { assert(!txint); txint = i; }
void setRxInt(Interface *i) { assert(!rxint); rxint = i; }
@ -104,7 +104,7 @@ class EtherLink : public SimObject
public:
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(); }
};

View file

@ -169,7 +169,7 @@ EtherTap::detach()
}
bool
EtherTap::recvPacket(PacketPtr &packet)
EtherTap::recvPacket(PacketPtr packet)
{
if (dump)
dump->dump(packet);

View file

@ -94,7 +94,7 @@ class EtherTap : public EtherInt
EtherTap(const std::string &name, EtherDump *dump, int port, int bufsz);
virtual ~EtherTap();
virtual bool recvPacket(PacketPtr &packet);
virtual bool recvPacket(PacketPtr packet);
virtual void sendDone();
virtual void serialize(std::ostream &os);

View file

@ -1979,7 +1979,7 @@ NSGigE::transferDone()
}
bool
NSGigE::rxFilter(PacketPtr &packet)
NSGigE::rxFilter(const PacketPtr &packet)
{
EthPtr eth = packet;
bool drop = true;
@ -2019,7 +2019,7 @@ NSGigE::rxFilter(PacketPtr &packet)
}
bool
NSGigE::recvPacket(PacketPtr &packet)
NSGigE::recvPacket(PacketPtr packet)
{
rxBytes += packet->length;
rxPackets++;

View file

@ -295,7 +295,7 @@ class NSGigE : public PciDev
* receive address filter
*/
bool rxFilterEnable;
bool rxFilter(PacketPtr &packet);
bool rxFilter(const PacketPtr &packet);
bool acceptBroadcast;
bool acceptMulticast;
bool acceptUnicast;
@ -360,7 +360,7 @@ class NSGigE : public PciDev
bool cpuIntrPending() const;
void cpuIntrAck() { cpuIntrClear(); }
bool recvPacket(PacketPtr &packet);
bool recvPacket(PacketPtr packet);
void transferDone();
void setInterface(NSGigEInt *i) { assert(!interface); interface = i; }
@ -407,7 +407,7 @@ class NSGigEInt : public EtherInt
NSGigEInt(const std::string &name, NSGigE *d)
: 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(); }
};