more swift fix

This commit is contained in:
cyp0633 2024-04-04 20:22:53 +08:00
parent 58b9e3bf22
commit 45b1591104
Signed by: cyp0633
GPG Key ID: CF90D09FB1FDCE45
3 changed files with 9 additions and 8 deletions

View File

@ -2025,11 +2025,15 @@ void
RdmaHw::HandleAckSwift(Ptr<RdmaQueuePair> qp, Ptr<Packet> p, CustomHeader& ch)
{
auto ih = ch.ack.ih.swift;
std::cout << "[SWIFT] Hops: " << ih.nhop << ", Remote Delay: " << ih.remote_delay << std::endl;
// std::cout << "[SWIFT] Hops: " << ih.nhop << ", Remote Delay: " << ih.remote_delay <<
// std::endl;
uint32_t ack_seq = ch.ack.seq;
auto rtt = Simulator::Now().GetNanoSeconds() - ih.ts;
auto fabric_delay = rtt - ih.remote_delay;
// update ack num
qp->swift.num_acked += ack_seq / 1000;
// on receiving ack
qp->swift.m_retransmit_cnt = 0;
auto target_fab_delay = TargetFabDelaySwift(qp, p, ch);
@ -2038,7 +2042,7 @@ RdmaHw::HandleAckSwift(Ptr<RdmaQueuePair> qp, Ptr<Packet> p, CustomHeader& ch)
// cap max and min cwnd, and get the lower one in fab and endpoint
auto cwnd =
std::max(swift_min_cwnd, std::min(swift_max_cwnd, std::min(fab_cwnd, endpoint_cwnd)));
if (cwnd < qp->swift.m_cwnd_prev)
if (cwnd < qp->m_win)
{
qp->swift.m_t_last_decrease = Simulator::Now();
}
@ -2053,7 +2057,7 @@ RdmaHw::HandleAckSwift(Ptr<RdmaQueuePair> qp, Ptr<Packet> p, CustomHeader& ch)
qp->swift.m_pacing_delay = 0;
qp->SetWin((uint32_t)cwnd);
}
std::cout << "[SWIFT] cwnd: " << cwnd << ", rate: " << qp->m_rate << std::endl;
// std::cout << "[SWIFT] cwnd: " << cwnd << ", rate: " << qp->m_rate << std::endl;
}
// calculate target fabric delay
@ -2084,11 +2088,11 @@ RdmaHw::GetCwndSwift(Ptr<RdmaQueuePair> qp,
{
if (cwnd >= 1)
{
cwnd = cwnd + (double)swift_ai / cwnd * 1; // TODO: num_acked
cwnd = cwnd + (double)swift_ai / cwnd * qp->swift.num_acked;
}
else
{
cwnd = cwnd + swift_ai * 1;
cwnd = cwnd + swift_ai * qp->swift.num_acked;
}
}
else if (canDecrease)

View File

@ -84,7 +84,6 @@ RdmaQueuePair::RdmaQueuePair(uint16_t pg,
swift.m_t_last_decrease = Time(0);
swift.m_curRate = 0;
swift.m_retransmit_cnt = 0;
swift.m_cwnd_prev = 0.0;
swift.m_pacing_delay = 0;
swift.num_acked = 0;
}

View File

@ -137,8 +137,6 @@ class RdmaQueuePair : public Object
DataRate m_curRate;
// retransmit time count
uint16_t m_retransmit_cnt;
// previous cwnd
double m_cwnd_prev;
// time (nanosecond) of last Multiple Decrease
Time m_t_last_decrease;
// pacing delay, i.e. sending interval