Commit 8712a4e6 authored by shengjh's avatar shengjh 🇨🇳
Browse files

change sentPkt type in HomaTransport to Packet.

parent a3e71b7b
......@@ -435,7 +435,8 @@ HomaTransport::SendController::handlePktTransmitEnd()
// chooses one for transmission over the others, the sender has imposed a
// delay in transmitting the other packets. Here we collect the statistics
// related those trasmssion delays.
uint32_t lastDestAddr = sentPkt.getDestAddr().toIpv4().getInt();
auto chunk = sentPkt.peekAtFront<HomaPkt>();
uint32_t lastDestAddr = chunk->getDestAddr().toIpv4().getInt();
for (auto it = rxAddrMsgMap.begin(); it != rxAddrMsgMap.end(); ++it) {
uint32_t rxAddr = it->first;
if (rxAddr != lastDestAddr) {
......@@ -619,16 +620,16 @@ HomaTransport::SendController::sendOrQueue(cMessage* msg)
ASSERT(sxPkt->getPktType() == PktType::GRANT);
if (transport->sendTimer->isScheduled()) {
// NIC tx link is busy sending another packet
EV << "Grant timer is scheduled! Grant to " <<
sxPkt->getDestAddr().toIPv4().str() << ", mesgId: " << sxPkt->getMsgId() << " is queued!"<< endl;
// EV << "Grant timer is scheduled! Grant to " <<
// sxPkt->getDestAddr().toIPv4().str() << ", mesgId: " << sxPkt->getMsgId() << " is queued!"<< endl;
outGrantQueue.push(sxPkt);
return;
} else {
ASSERT(outGrantQueue.empty());
EV << "Send grant to: " << sxPkt->getDestAddr().toIpv4().str()
<< ", mesgId: " << sxPkt->getMsgId() << ", prio: " <<
sxPkt->getGrantFields().schedPrio<< endl;
// EV << "Send grant to: " << sxPkt->getDestAddr().toIpv4().str()
// << ", mesgId: " << sxPkt->getMsgId() << ", prio: " <<
// sxPkt->getGrantFields().schedPrio<< endl;
sendPktAndScheduleNext(sxPkt);
return;
}
......@@ -671,9 +672,9 @@ void
HomaTransport::SendController::sendPktAndScheduleNext(Packet* sxPkt)
{
PktType pktType = (PktType)sxPkt->getPktType();
auto chunk = sxPkt->peekAtFront<AppMessage>();
uint32_t numDataBytes = chunk->getDataBytes();
auto chunk = sxPkt->peekAtFront<HomaPkt>();
PktType pktType = (PktType)chunk->getPktType();
uint32_t numDataBytes = HomaPktHelper::getDataBytes(chunk);
uint32_t bytesSentOnWire = HomaPktHelper::getBytesOnWire(numDataBytes, pktType);
simtime_t currentTime = simTime();
simtime_t sxPktDuration = SimTime(1e-9 * (bytesSentOnWire * 8.0 / homaConfig->nicLinkSpeed));
......@@ -719,7 +720,7 @@ HomaTransport::SendController::sendPktAndScheduleNext(Packet* sxPkt)
simtime_t nextSendTime = sxPktDuration + currentTime;
sentPkt = *sxPkt;
sentPktDuration = sxPktDuration;
transport->socket.sendTo(sxPkt, sxPkt->getDestAddr(), homaConfig->destPort);
transport->socket.sendTo(sxPkt, chunk->getDestAddr(), homaConfig->destPort);
transport->scheduleAt(nextSendTime, transport->sendTimer);
}
......
......@@ -198,7 +198,7 @@ public:
typedef std::set<OutboundMessage*, OutbndMsgSorter> SortedOutboundMsg;
protected:
void sendPktAndScheduleNext(HomaPkt* sxPkt);
void sendPktAndScheduleNext(Packet* sxPkt);
void msgTransmitComplete(OutboundMessage* msg);
protected:
......@@ -216,7 +216,7 @@ public:
uint64_t msgId;
// Keeps a copy of last packet transmitted by this module
HomaPkt sentPkt;
Packet sentPkt;
// Serialization time of sentPkt at nic link speed
simtime_t sentPktDuration;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment