Compare commits

...

3 Commits

Author SHA1 Message Date
cyp0633 f12eb9e624
fix typo 2024-04-03 11:11:13 +08:00
cyp0633 281afc20f5
Change back to timestep 2024-04-03 11:08:49 +08:00
cyp0633 e06bc70505
move rdma qp comments to .h 2024-04-03 09:59:10 +08:00
4 changed files with 34 additions and 33 deletions

View File

@ -135,7 +135,7 @@ SwiftCalcEndpointDelay(Ptr<Packet> p)
{ // sending an ACK
qbbHeader qh;
p->RemoveHeader(qh);
auto t4 = (uint32_t)Simulator::Now().GetNanoSeconds();
auto t4 = (uint32_t)Simulator::Now().GetTimeStep();
qh.SetSwiftEndDelay(t4);
p->AddHeader(qh);
}

View File

@ -18,6 +18,7 @@
#include <ns3/udp-header.h>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdint>
#include <iostream>
@ -2039,19 +2040,16 @@ RdmaHw::HandleAckSwift(Ptr<RdmaQueuePair> qp, Ptr<Packet> p, CustomHeader& ch)
std::min(swift_min_cwnd, std::max(swift_max_cwnd, std::min(fab_cwnd, endpoint_cwnd)));
if (cwnd < qp->swift.m_cwnd_prev)
{
qp->swift.m_t_last_decrease = Simulator::Now().GetNanoSeconds();
qp->swift.m_t_last_decrease = Simulator::Now().GetTimeStep();
}
if (cwnd < 1)
{
qp->swift.m_pacing_delay = rtt * 1.0 / cwnd;
qp->SetWin(INT_MAX); // to make sure sending is only pacing-bound, but not window-bound
}
else
{
qp->swift.m_pacing_delay = 0;
}
// set cwnd
if (cwnd > 1)
{
qp->SetWin((uint32_t)cwnd);
}
}

View File

@ -85,56 +85,42 @@ RdmaQueuePair::RdmaQueuePair(uint16_t pg,
swift.m_cwnd_prev = 0;
}
// Sets the size of the data to be transferred over this queue pair, which is crucial for knowing
// when the data transfer is complete.
void
RdmaQueuePair::SetSize(uint64_t size)
{
m_size = size;
}
// Sets the size of the congestion window (cwnd), affecting how many packets can be on-the-fly
// before waiting for acknowledgments.
void
RdmaQueuePair::SetWin(uint32_t win)
{
m_win = win;
}
// Sets the base Round-Trip Time (RTT), which can be used for calculating the optimal sending rate
// or adjusting the congestion window.
void
RdmaQueuePair::SetBaseRtt(uint64_t baseRtt)
{
m_baseRtt = baseRtt;
}
// Enables or disables the variable window size feature, potentially for experimental congestion
// control algorithms.
void
RdmaQueuePair::SetVarWin(bool v)
{
m_var_win = v;
}
// Sets a callback function that will be called when the application-level transfer is finished,
// allowing for cleanup or further actions.
void
RdmaQueuePair::SetAppNotifyCallback(Callback<void> notifyAppFinish)
{
m_notifyAppFinish = notifyAppFinish;
}
// Returns the amount of data left to send, which can be used to determine if the transfer is
// complete.
uint64_t
RdmaQueuePair::GetBytesLeft() const
{
return m_size >= snd_nxt ? m_size - snd_nxt : 0;
}
// Generates a hash value based on the queue pair's source and destination IP addresses and ports,
// likely used for efficiently looking up queue pairs.
uint32_t
RdmaQueuePair::GetHash(void) const
{
@ -155,8 +141,6 @@ RdmaQueuePair::GetHash(void) const
return Hash32(buf.c, 12);
}
// Updates the highest sequence number acknowledged by the receiver, which is crucial for tracking
// which packets have been successfully received and adjusting the congestion window accordingly.
void
RdmaQueuePair::Acknowledge(uint64_t ack)
{
@ -166,16 +150,12 @@ RdmaQueuePair::Acknowledge(uint64_t ack)
}
}
// Calculates the number of packets (or bytes) that have been sent but not yet acknowledged, useful
// for congestion control and flow control decisions.
uint64_t
RdmaQueuePair::GetOnTheFly() const
{
return snd_nxt - snd_una;
}
// Determines if the number of packets on-the-fly has reached the congestion window limit,
// indicating whether it's necessary to pause sending further packets.
bool
RdmaQueuePair::IsWinBound() const
{
@ -183,8 +163,6 @@ RdmaQueuePair::IsWinBound() const
return w != 0 && GetOnTheFly() >= w;
}
// Calculates the current effective window size, potentially adjusting for variable window
// algorithms or rate-based congestion control.
uint64_t
RdmaQueuePair::GetWin() const
{
@ -220,9 +198,6 @@ RdmaQueuePair::GetWin() const
return w;
}
// A similar function to GetWin but specifically for HPCC (High Precision Congestion Control) or
// another specialized congestion control algorithm, adjusting the window based on different
// criteria.
uint64_t
RdmaQueuePair::HpGetCurWin() const
{
@ -246,8 +221,6 @@ RdmaQueuePair::HpGetCurWin() const
return w;
}
// Checks if the data transfer for this queue pair is complete, which could be based on whether all
// data has been acknowledged or a stop time has been reached.
bool
RdmaQueuePair::IsFinished() const
{

View File

@ -156,19 +156,49 @@ class RdmaQueuePair : public Object
Ipv4Address _dip,
uint16_t _sport,
uint16_t _dport);
// Sets the size of the data to be transferred over this queue pair, which is crucial for
// knowing when the data transfer is complete.
void SetSize(uint64_t size);
// Sets the size of the congestion window (cwnd), affecting how many packets can be on-the-fly
// before waiting for acknowledgments.
void SetWin(uint32_t win);
// Sets the base Round-Trip Time (RTT), which can be used for calculating the optimal sending
// rate
// or adjusting the congestion window.
void SetBaseRtt(uint64_t baseRtt);
// Enables or disables the variable window size feature, potentially for experimental congestion
// control algorithms.
void SetVarWin(bool v);
// Sets a callback function that will be called when the application-level transfer is finished,
// allowing for cleanup or further actions.
void SetAppNotifyCallback(Callback<void> notifyAppFinish);
// Returns the amount of data left to send, which can be used to determine if the transfer is
// complete.
uint64_t GetBytesLeft() const;
// Generates a hash value based on the queue pair's source and destination IP addresses and
// ports,
// likely used for efficiently looking up queue pairs.
uint32_t GetHash(void) const;
// Updates the highest sequence number acknowledged by the receiver, which is crucial for
// tracking which packets have been successfully received and adjusting the congestion window
// accordingly.
void Acknowledge(uint64_t ack);
// Calculates the number of packets (or bytes) that have been sent but not yet acknowledged,
// useful for congestion control and flow control decisions.
uint64_t GetOnTheFly() const;
// Determines if the number of packets on-the-fly has reached the congestion window limit,
// indicating whether it's necessary to pause sending further packets.
bool IsWinBound() const;
// Calculates the current effective window size, potentially adjusting for variable window
// algorithms or rate-based congestion control.
uint64_t GetWin() const; // window size calculated from m_rate
// Checks if the data transfer for this queue pair is complete, which could be based on whether
// all data has been acknowledged or a stop time has been reached.
bool IsFinished() const;
// A similar function to GetWin but specifically for HPCC (High Precision Congestion Control) or
// another specialized congestion control algorithm, adjusting the window based on different
// criteria.
uint64_t HpGetCurWin() const; // window size calculated from hp.m_curRate, used by HPCC
uint32_t incastFlow;
};