当前位置:网站首页>implement tcp bbr on ns3 (在ns3上实现TCP BBR)
implement tcp bbr on ns3 (在ns3上实现TCP BBR)
2022-08-02 14:12:00 【Soonyang Zhang】
After several days of work and debug, I implement TCP BBR algorithms on ns3.33.
One thing is to get instant rtt instead of smothed rtt.
The second is I notice some difference in tcp-rate-ops.cc (ns3) by comparison with tcp_rate.c (linux tcp stack).
const TcpRateOps::TcpRateSample &
TcpRateLinux::GenerateSample (uint32_t delivered, uint32_t lost, bool is_sack_reneg,
uint32_t priorInFlight, const Time &minRtt){
if (m_rateSample.m_priorTime == Seconds (0) || is_sack_reneg)
{
NS_LOG_INFO ("PriorTime is zero, invalidating sample");
m_rateSample.m_delivered = -1;
m_rateSample.m_interval = Seconds (0);
m_rateSampleTrace (m_rateSample);
return m_rateSample;
}
if (m_rateSample.m_interval < minRtt)
{
NS_LOG_INFO ("Sampling interval is invalid");
m_rateSample.m_interval = Seconds (0);
m_rateSample.m_priorTime = Seconds (0); // To make rate sample invalid
m_rateSampleTrace (m_rateSample);
return m_rateSample;
}
}
When m_priorTime is reset as zero in TcpRateSample, m_rateSample.m_ackElapsed will sample a time intervel equal to Simulator::Now (). And m_rateSample.m_priorTime will be update and the acked packet is valid (m_rateSample.m_priorTime!=Seconds(0)) in GenerateSample. A quite low bandwidth value will be sampled. Such low bandwidth will be used by long term bandwidth sampling in BBR algorithm. The flow will gain lower bandwidth here after and weird behavior will be observed.
void
TcpRateLinux::SkbDelivered (TcpTxItem * skb){
if (m_rateSample.m_priorDelivered == 0
|| skbInfo.m_delivered > m_rateSample.m_priorDelivered)
{
m_rateSample.m_ackElapsed = Simulator::Now () - m_rateSample.m_priorTime;
m_rateSample.m_priorDelivered = skbInfo.m_delivered;
m_rateSample.m_priorTime = skbInfo.m_deliveredTime;
m_rateSample.m_isAppLimited = skbInfo.m_isAppLimited;
m_rateSample.m_sendElapsed = skb->GetLastSent () - skbInfo.m_firstSent;
m_rateSampleTrace (m_rateSample);
m_rate.m_firstSentTime = skb->GetLastSent ();
}
}
So change is made on SkbDelivered function:
if (m_rateSample.m_priorDelivered == 0
|| skbInfo.m_delivered > m_rateSample.m_priorDelivered)
{
m_rateSample.m_priorDelivered = skbInfo.m_delivered;
m_rateSample.m_priorTime = skbInfo.m_deliveredTime;
m_rateSample.m_isAppLimited = skbInfo.m_isAppLimited;
m_rateSample.m_sendElapsed = skb->GetLastSent () - skbInfo.m_firstSent;
m_rate.m_firstSentTime = skb->GetLastSent ();
}
m_rateSample.m_ackElapsed = Simulator::Now () - m_rateSample.m_priorTime;
m_rateSampleTrace (m_rateSample);
The third change is in tcp_socket_base.cc
uint32_t
TcpSocketBase::SendDataPacket (SequenceNumber32 seq, uint32_t maxSize, bool withAck){
m_rateOps->SkbSent(outItem, isStartOfTransmission&&(m_tcb->m_highTxMark==m_tcb->m_nextTxSequence));
}
I test three TCP BBR flows on a 6Mbps, 50 one way propagation delay p2p link.
Result:
Estimated bandwidth at sender:
Taces rtt of each flow:
The code is uploaded to github [6].
Reference:
[1] Reproduce-TCP-BBR-in-ns-3
[2] linux bbr
[3] ns-3-dev-git
[4] test quic bbr on ns3
[5] evaluation BBRv2 on ns3
[6] tcp-bbr-ns3 code
边栏推荐
猜你喜欢
随机推荐
光波导应用中的真实光栅效应
项目:数据库表的梳理
4. Publish Posts, Comment on Posts
光栅区域衍射级数和效率的规范
7.Redis
Unity-Ads广告插件
饥荒联机版Mod开发——准备工具(一)
系统性能和TCP/UDP网络优化-学习大杂烩
光导布局设计工具
开心一下,9/28名场面合集
光学好书推荐
MATLAB绘图函数plot详解
shader 和 ray marching
LITESTAR 4D应用:室内植物照明模拟
Redis 学习part one
剑指offer:在O(1)时间删除链表结点
2. Log out, log in state examination, verification code
Introduction to C language function parameter passing mode
Unity-Post Processing
unity Domain Reload & scene Reload 静态变量重置