diff options
author | Nathan Binkert <binkertn@umich.edu> | 2004-11-13 16:33:16 -0500 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2004-11-13 16:33:16 -0500 |
commit | acb98fb0f64a3b6a4f2f3151b0d4fb14fdfcf7cf (patch) | |
tree | 4daefdaf22007eb42f30043334447de27e8aa7cb | |
parent | bd3e3c02300312ae8d00ae9abf3fa009a2cddbc7 (diff) | |
download | gem5-acb98fb0f64a3b6a4f2f3151b0d4fb14fdfcf7cf.tar.xz |
we shouldn't ever pass around references to PacketPtrs,
const references are ok, or pass by value.
--HG--
extra : convert_revision : 7280a1c7d22b9294fddbe50f02f6f4c6ca9b2e5b
-rw-r--r-- | dev/etherint.hh | 16 | ||||
-rw-r--r-- | dev/etherlink.cc | 8 | ||||
-rw-r--r-- | dev/etherlink.hh | 6 | ||||
-rw-r--r-- | dev/ethertap.cc | 2 | ||||
-rw-r--r-- | dev/ethertap.hh | 2 | ||||
-rw-r--r-- | dev/ns_gige.cc | 4 | ||||
-rw-r--r-- | dev/ns_gige.hh | 6 |
7 files changed, 22 insertions, 22 deletions
diff --git a/dev/etherint.hh b/dev/etherint.hh index ddfe16d88..bcdf0ae06 100644 --- a/dev/etherint.hh +++ b/dev/etherint.hh @@ -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__ diff --git a/dev/etherlink.cc b/dev/etherlink.cc index ccb18d363..a361713cd 100644 --- a/dev/etherlink.cc +++ b/dev/etherlink.cc @@ -105,7 +105,7 @@ EtherLink::unserialize(Checkpoint *cp, const string §ion) } 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); diff --git a/dev/etherlink.hh b/dev/etherlink.hh index 204348c6d..e998a006f 100644 --- a/dev/etherlink.hh +++ b/dev/etherlink.hh @@ -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(); } }; diff --git a/dev/ethertap.cc b/dev/ethertap.cc index b40a93c1b..03f2724b1 100644 --- a/dev/ethertap.cc +++ b/dev/ethertap.cc @@ -169,7 +169,7 @@ EtherTap::detach() } bool -EtherTap::recvPacket(PacketPtr &packet) +EtherTap::recvPacket(PacketPtr packet) { if (dump) dump->dump(packet); diff --git a/dev/ethertap.hh b/dev/ethertap.hh index 9c77a4a4f..5f760ed34 100644 --- a/dev/ethertap.hh +++ b/dev/ethertap.hh @@ -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); diff --git a/dev/ns_gige.cc b/dev/ns_gige.cc index 8f233c433..79b128025 100644 --- a/dev/ns_gige.cc +++ b/dev/ns_gige.cc @@ -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++; diff --git a/dev/ns_gige.hh b/dev/ns_gige.hh index 5f023dccc..fc2c88a6c 100644 --- a/dev/ns_gige.hh +++ b/dev/ns_gige.hh @@ -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(); } }; |