当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
Based on the matrix calculation in the linear regression equation of the coefficient estimates
仿真结果的格式&定制
Ubuntu通过apt安装Mysql
Detailed introduction to the hierarchical method of binary tree creation
队列与栈
第三十三章:图的基本概念与性质
永久更改pip源
光栅区域衍射级数和效率的规范
专硕与学硕
mysql学习总结 & 索引
Unity-PlayMaker
软件测试基础知识(背)
Project: combing the database table
C#高级教程
使用1D-1D EPE的光波导布局设计工具
unity-shader(入门)
MATLAB绘图函数plot详解
极简式 Unity 获取 bilibili 直播弹幕、SC、上舰、礼物等 插件
关于推荐系统的随想
1. Development community homepage, register