Commit c87dc6f8 authored by shengjh's avatar shengjh 🇨🇳
Browse files

Finish all source files correction and compile successfully.

parent 758c4c07
[General]
simtime-scale = -15
sim-time-limit = 100000ms
warmup-period = 0ms
network=dcn
*.host*.eth[0].typename = "LayeredEthernetInterface"
......
......@@ -65,7 +65,7 @@ uint32_t HomaPktHelper::getDataBytes(Ptr<const HomaPkt> homaChunk)
return 0;
}
uint32_t getFirstByte(Ptr<const HomaPkt> homaChunk)
uint32_t HomaPktHelper::getFirstByte(Ptr<const HomaPkt> homaChunk)
{
switch(homaChunk->getPktType()) {
case PktType::SCHED_DATA:
......
......@@ -19,6 +19,10 @@ public:
static uint32_t getDataBytes(Ptr<const HomaPkt> homaChunk);
static uint32_t getFirstByte(Ptr<const HomaPkt> homaChunk);
~HomaPktHelper();
static uint32_t maxEthFrameSize() {
return ETHERNET_PREAMBLE_SIZE + ETHERNET_HDR_SIZE +
MAX_ETHERNET_PAYLOAD_BYTES + ETHERNET_CRC_SIZE + INTER_PKT_GAP;
}
};
/**
......
......@@ -1006,7 +1006,7 @@ HomaTransport::OutboundMessage::prepareRequestAndUnsched()
}
}
unschedDataPart->setUnschedFields(unschedFields);
unschedDataPart->setChunkLength(b(HomaPktHelper::getHeaderSize(unschedDataPart) + HomaPktHelper::getDataBytes(unschedDataPart)));
unschedDataPart->setChunkLength(b(B(HomaPktHelper::getHeaderSize(unschedDataPart) + HomaPktHelper::getDataBytes(unschedDataPart) )));
packet->insertAtBack(unschedDataPart);
txPkts.push(packet);
/**
......@@ -1055,7 +1055,7 @@ HomaTransport::OutboundMessage::prepareSchedPkt(uint32_t offset, uint16_t numByt
dataFields.firstByte = offset;
dataFields.lastByte = dataFields.firstByte + bytesToSend - 1;
dataPkt->setSchedDataFields(dataFields);
dataPkt->setChunkLength(b(bytesToSend + HomaPktHelper::getHeaderSize(dataPkt)));
dataPkt->setChunkLength(b(B(bytesToSend + HomaPktHelper::getHeaderSize(dataPkt))));
packet->insertAtBack(dataPkt);
txPkts.push(packet);
txSchedPkts.insert(packet);
......@@ -1850,10 +1850,10 @@ HomaTransport::ReceiveScheduler::SenderState::sendAndScheduleGrant(
std::min(topMesg->bytesToGrant, homaConfig->grantMaxBytes);
Packet* grantPkt = topMesg->prepareGrant(grantSize, grantPrio);
lastGrantPrio = grantPrio;
auto grantChunk = grantPkt->peekAtFront<HomaPkt>();
// update stats and send a grant
grantSize = grantPkt->getGrantFields().grantBytes;
uint16_t prio = grantPkt->getGrantFields().schedPrio;
grantSize = grantChunk->getGrantFields().grantBytes;
uint16_t prio = grantChunk->getGrantFields().schedPrio;
rxScheduler->addPendingGrantedBytes(prio, grantSize);
topMesg->updatePerPrioStats();
rxScheduler->transport->sxController.sendOrQueue(grantPkt);
......@@ -2009,8 +2009,8 @@ HomaTransport::ReceiveScheduler::SenderState*
HomaTransport::ReceiveScheduler::SchedSenders::removeAt(uint32_t rmIdx)
{
if (rmIdx < headIdx || rmIdx >= (headIdx + numSenders)) {
EV << "Objects are within range [" << headIdx << ", " <<
headIdx + numSenders << "). Can't remove at rmIdx " << rmIdx;
// EV << "Objects are within range [" << headIdx << ", " <<
// headIdx + numSenders << "). Can't remove at rmIdx " << rmIdx;
return NULL;
}
numSenders--;
......@@ -2086,8 +2086,8 @@ HomaTransport::ReceiveScheduler::SchedSenders::insPoint(SenderState* s)
uint32_t hIdx = headIdx;
uint32_t numSxAfterIns = numSenders;
EV << "insIdx: " << insIdx << ", hIdx: " << hIdx << ", last index: " <<
s->lastIdx << endl;
// EV << "insIdx: " << insIdx << ", hIdx: " << hIdx << ", last index: " <<
// s->lastIdx << endl;
if (insIdx == hIdx) {
if (insIdx > 0 && insIdx != s->lastIdx) {
hIdx--;
......@@ -2100,9 +2100,9 @@ HomaTransport::ReceiveScheduler::SchedSenders::insPoint(SenderState* s)
int leftShift = (int)std::min(numSxAfterIns,
(uint32_t)std::min(numToGrant, schedPrios)) - (schedPrios - hIdx);
EV << "numSenders: " << numSxAfterIns << ", numToGrant: " << numToGrant <<
", insIdx: " << insIdx << ", hIdx: " << hIdx << ", Left shift: " <<
leftShift << endl;
// EV << "numSenders: " << numSxAfterIns << ", numToGrant: " << numToGrant <<
// ", insIdx: " << insIdx << ", hIdx: " << hIdx << ", Left shift: " <<
// leftShift << endl;
if (leftShift > 0) {
ASSERT(!senders[hIdx - leftShift] && (int)hIdx >= leftShift);
......@@ -2309,8 +2309,8 @@ HomaTransport::ReceiveScheduler::SchedSenders::handleGrantSentEvent(
ASSERT (cur.sInd < cur.headIdx + cur.numToGrant);
insert(cur.s);
EV << "SchedState before handleGrantSent:\n\t" << old << endl;
EV << "SchedState after handleGrantSent:\n\t" << cur << endl;
// EV << "SchedState before handleGrantSent:\n\t" << old << endl;
// EV << "SchedState after handleGrantSent:\n\t" << cur << endl;
return;
}
......@@ -2341,8 +2341,8 @@ HomaTransport::ReceiveScheduler::SchedSenders::handleGrantSentEvent(
cur.s = sToGrant;
handleGrantSentEvent(old, cur);
}
EV << "SchedState before handleGrantSent:\n\t" << old << endl;
EV << "SchedState after handleGrantSent:\n\t" << cur << endl;
// EV << "SchedState before handleGrantSent:\n\t" << old << endl;
// EV << "SchedState after handleGrantSent:\n\t" << cur << endl;
return;
}
......@@ -2410,7 +2410,7 @@ HomaTransport::ReceiveScheduler::SchedSenders::handleBwUtilTimerEvent(
" schedBwUtilTimer is disabled!");
}
EV << "\n\n################Process BwUtil Timer###############\n\n" << endl;
// EV << "\n\n################Process BwUtil Timer###############\n\n" << endl;
simtime_t timeNow = simTime();
SchedState old;
SchedState cur;
......@@ -2471,9 +2471,9 @@ HomaTransport::ReceiveScheduler::SchedSenders::getPrioForMesg(SchedState& st)
int grantPrio =
st.sInd + homaConfig->allPrio - homaConfig->adaptiveSchedPrioLevels;
grantPrio = std::min(homaConfig->allPrio - 1, grantPrio);
EV << "Get prio for mesg. sInd: " << st.sInd << ", grantPrio: " <<
grantPrio << ", allPrio: " << homaConfig->allPrio << ", schedPrios: " <<
homaConfig->adaptiveSchedPrioLevels << endl;
// EV << "Get prio for mesg. sInd: " << st.sInd << ", grantPrio: " <<
// grantPrio << ", allPrio: " << homaConfig->allPrio << ", schedPrios: " <<
// homaConfig->adaptiveSchedPrioLevels << endl;
return grantPrio;
}
......@@ -2613,9 +2613,9 @@ HomaTransport::InboundMessage::InboundMessage(Packet* rxPkt,
ReceiveScheduler* rxScheduler, HomaConfigDepot* homaConfig)
: rxScheduler(rxScheduler)
, homaConfig(homaConfig)
, srcAddr(rxPkt->getSrcAddr())
, destAddr(rxPkt->getDestAddr())
, msgIdAtSender(rxPkt->getMsgId())
// , srcAddr(rxPkt->getSrcAddr())
// , destAddr(rxPkt->getDestAddr())
// , msgIdAtSender(rxPkt->getMsgId())
, bytesToGrant(0)
, offset(0)
, bytesGrantedInFlight(0)
......@@ -2634,6 +2634,9 @@ HomaTransport::InboundMessage::InboundMessage(Packet* rxPkt,
, unschedToRecvPerPrio()
{
auto homaChunk = rxPkt->peekAtFront<HomaPkt>();
this->srcAddr = homaChunk->getSrcAddr();
this->destAddr = homaChunk->getDestAddr();
this->msgIdAtSender = homaChunk->getMsgId();
switch (homaChunk->getPktType()) {
case PktType::REQUEST:
......@@ -2671,8 +2674,7 @@ HomaTransport::InboundMessage::fillinRxBytes(uint32_t byteStart,
uint32_t byteEnd, PktType pktType)
{
uint32_t bytesReceived = byteEnd - byteStart + 1;
uint32_t bytesReceivedOnWire =
HomaPkt::getBytesOnWire(bytesReceived, pktType);
uint32_t bytesReceivedOnWire = HomaPktHelper::getBytesOnWire(bytesReceived, pktType);
bytesToReceive -= bytesReceived;
totalBytesInFlight -= bytesReceivedOnWire;
totalBytesOnWire += bytesReceivedOnWire;
......@@ -2704,8 +2706,8 @@ HomaTransport::InboundMessage::fillinRxBytes(uint32_t byteStart,
}
ASSERT(grant != inflightGrants.end());
ASSERT(std::get<1>(*grant) == bytesReceived);
if (bytesReceivedOnWire == HomaPkt::maxEthFrameSize()) {
rxScheduler->transport->trackRTTs.updateRTTSample(srcAddr.toIPv4().getInt(),
if (bytesReceivedOnWire == HomaPktHelper::maxEthFrameSize()) {
rxScheduler->transport->trackRTTs.updateRTTSample(srcAddr.toIpv4().getInt(),
simTime() - std::get<2>(*grant));
}
inflightGrants.erase(grant);
......@@ -2713,9 +2715,9 @@ HomaTransport::InboundMessage::fillinRxBytes(uint32_t byteStart,
bytesGrantedInFlight -= bytesReceived;
rxScheduler->transport->outstandingGrantBytes -= bytesReceivedOnWire;
}
EV << "Received " << bytesReceived << " bytes from " << srcAddr.str()
<< " for msgId " << msgIdAtSender << " (" << bytesToReceive <<
" bytes left to receive)" << endl;
// EV << "Received " << bytesReceived << " bytes from " << srcAddr.str()
// << " for msgId " << msgIdAtSender << " (" << bytesToReceive <<
// " bytes left to receive)" << endl;
}
/**
......@@ -2749,7 +2751,7 @@ HomaTransport::InboundMessage::prepareGrant(uint16_t grantSize, uint16_t schedPr
grantPkt->setDestAddr(this->srcAddr);
grantPkt->setSrcAddr(this->destAddr);
grantPkt->setMsgId(this->msgIdAtSender);
grantPkt->setChunkLength(grantPkt->headerSize());
grantPkt->setChunkLength(b(B(HomaPktHelper::getHeaderSize(grantPkt))));
grantPkt->setPriority(0);
packet->insertAtBack(grantPkt);
packet->addTagIfAbsent<UserPriorityReq>()->setUserPriority(0);
......@@ -2787,7 +2789,7 @@ HomaTransport::InboundMessage::prepareRxMsgForApp()
const auto &rxMsg = makeShared<AppMessage>();
rxMsg->setDestAddr(this->destAddr);
rxMsg->setSrcAddr(this->srcAddr);
rxMsg->setByteLength(this->msgSize);
rxMsg->setChunkLength(b(B(this->msgSize)));
rxMsg->setMsgCreationTime(this->msgCreationTime);
rxMsg->setMsgBytesOnWire(this->totalBytesOnWire);
......@@ -2803,9 +2805,8 @@ HomaTransport::InboundMessage::prepareRxMsgForApp()
simtime_t totalSchedTime = lastGrantTime - reqArrivalTime;
simtime_t minSchedulingTime;
uint32_t bytesGranted = msgSize - totalUnschedBytes;
uint32_t bytesGrantedOnWire = HomaPkt::getBytesOnWire(bytesGranted,
PktType::SCHED_DATA);
int minSchedTimeInBytes = (int)bytesGrantedOnWire - HomaPkt::maxEthFrameSize();
uint32_t bytesGrantedOnWire = HomaPktHelper::getBytesOnWire(bytesGranted, PktType::SCHED_DATA);
int minSchedTimeInBytes = (int)bytesGrantedOnWire - HomaPktHelper::maxEthFrameSize();
minSchedulingTime = SIMTIME_ZERO;
if (minSchedTimeInBytes > 0) {
minSchedulingTime = SimTime(
......
......@@ -81,8 +81,7 @@ PriorityResolver::getSchedPktPrio(const InboundMessage* inbndMsg)
{
uint32_t msgSize = inbndMsg->msgSize;
uint32_t bytesToGrant = inbndMsg->bytesToGrant;
uint32_t bytesToGrantOnWire = HomaPkt::getBytesOnWire(bytesToGrant,
PktType::SCHED_DATA);
uint32_t bytesToGrantOnWire = HomaPktHelper::getBytesOnWire(bytesToGrant, PktType::SCHED_DATA);
uint32_t bytesTreatedUnsched = homaConfig->boostTailBytesPrio;
switch (prioResMode) {
case PrioResolutionMode::EXPLICIT:
......
......@@ -13,20 +13,24 @@ UnschedByteAllocator::UnschedByteAllocator(HomaConfigDepot* homaConfig)
, homaConfig(homaConfig)
{
// //SJH
// //SJH is it necessary to use payload1 and payload2?
// HomaPkt reqPkt = HomaPkt();
// reqPkt.setPktType(PktType::REQUEST);
// maxReqPktDataBytes = MAX_ETHERNET_PAYLOAD_BYTES -
// IP_HEADER_SIZE - UDP_HEADER_SIZE - reqPkt.headerSize();
const auto& payload1 = makeShared<HomaPkt>();
payload1->setPktType(PktType::REQUEST);
maxReqPktDataBytes = MAX_ETHERNET_PAYLOAD_BYTES -
IP_HEADER_SIZE - UDP_HEADER_SIZE - HomaPktHelper::getHomaPktHeaderSize(PktType::REQUEST);
IP_HEADER_SIZE - UDP_HEADER_SIZE - HomaPktHelper::getHeaderSize(payload1);
// HomaPkt unschedPkt = HomaPkt();
// unschedPkt.setPktType(PktType::UNSCHED_DATA);
// maxUnschedPktDataBytes = MAX_ETHERNET_PAYLOAD_BYTES -
// IP_HEADER_SIZE - UDP_HEADER_SIZE - unschedPkt.headerSize();
const auto& payload2 = makeShared<HomaPkt>();
payload2->setPktType(PktType::UNSCHED_DATA);
maxUnschedPktDataBytes = MAX_ETHERNET_PAYLOAD_BYTES -
IP_HEADER_SIZE - UDP_HEADER_SIZE - HomaPktHelper::getHomaPktHeaderSize(PktType::UNSCHED_DATA);
IP_HEADER_SIZE - UDP_HEADER_SIZE - HomaPktHelper::getHeaderSize(payload2);
}
UnschedByteAllocator::~UnschedByteAllocator()
......
......@@ -84,8 +84,10 @@ WorkloadEstimator::WorkloadEstimator(HomaConfigDepot* homaConfig)
if (strcmp(workloadType, "DCTCP") == 0) {
uint32_t maxDataBytesPerEthFrame = MAX_ETHERNET_PAYLOAD_BYTES -
IP_HEADER_SIZE - UDP_HEADER_SIZE;
const auto& payload = makeShared<HomaPkt>();
payload->setPktType(PktType::UNSCHED_DATA);
uint32_t maxDataBytesPerPkt = maxDataBytesPerEthFrame -
HomaPktHelper::getHomaPktHeaderSize(PktType::UNSCHED_DATA);
HomaPktHelper::getHeaderSize(payload);
avgSizeFromFile *= maxDataBytesPerPkt; // AvgSize in bytes.
}
......@@ -140,14 +142,16 @@ void WorkloadEstimator::getRemainSizeCdfCbf(CdfVector& cdf, uint32_t cbfCapMsgSi
//homaReqPkt.setPktType(PktType::REQUEST);
//uint32_t reqHdr = hdrs + homaReqPkt.headerSize();
const auto& homaUnschedChunk = makeShared<HomaPkt>();
homaUnschedChunk ->setPktType(PktType::UNSCHED_DATA);
uint32_t unschedPerPkt = MAX_ETHERNET_PAYLOAD_BYTES - IP_HEADER_SIZE -
UDP_HEADER_SIZE - HomaPktHelper::getHomaPktHeaderSize(PktType::UNSCHED_DATA);
UDP_HEADER_SIZE - HomaPktHelper::getHeaderSize(homaUnschedChunk);
//uint32_t unschedHdr = hdrs + homaUnschedPkt.headerSize();
const auto& homaSchedChunk = makeShared<HomaPkt>();
homaSchedChunk ->setPktType(PktType::SCHED_DATA);
uint32_t schedPerPkt = MAX_ETHERNET_PAYLOAD_BYTES - IP_HEADER_SIZE -
UDP_HEADER_SIZE - HomaPktHelper::getHomaPktHeaderSize(PktType::SCHED_DATA);
UDP_HEADER_SIZE - HomaPktHelper::getHeaderSize(homaSchedChunk);
//uint32_t schedHdr = hdrs + homaSchedPkt.headerSize();
//HomaPkt homaGrantPkt = HomaPkt();
......@@ -295,13 +299,15 @@ void WorkloadEstimator::getCbfFromCdf(CdfVector& cdf, uint32_t cbfCapMsgSize, ui
uint32_t maxEthFrame = MAX_ETHERNET_PAYLOAD_BYTES + ETHERNET_CRC_SIZE +
ETHERNET_PREAMBLE_SIZE + ETHERNET_HDR_SIZE + INTER_PKT_GAP;
const auto& homaUnschedChunk = makeShared<HomaPkt>();
homaUnschedChunk->setPktType(PktType::UNSCHED_DATA);
uint32_t unschedPerPkt = MAX_ETHERNET_PAYLOAD_BYTES - IP_HEADER_SIZE -
UDP_HEADER_SIZE - HomaPktHelper::getHomaPktHeaderSize(PktType::UNSCHED_DATA);
UDP_HEADER_SIZE - HomaPktHelper::getHeaderSize(homaUnschedChunk);
const auto& homaSchedChunk = makeShared<HomaPkt>();
homaSchedChunk ->setPktType(PktType::SCHED_DATA);
uint32_t schedPerPkt = MAX_ETHERNET_PAYLOAD_BYTES - IP_HEADER_SIZE -
UDP_HEADER_SIZE - HomaPktHelper::getHomaPktHeaderSize(PktType::SCHED_DATA);
UDP_HEADER_SIZE - HomaPktHelper::getHeaderSize(homaSchedChunk);
if (homaConfig->accountForGrantTraffic) {
// grant traffic included as a message of size zero at the begining of
......
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