编译bbrplus内核前需要做好准备工作
bbrplus编译环境准备
centos环境
yum install -y screen wget curl zip unzip tar rsync ncurses-devel make gcc bc bison flex elfutils-libelf-devel openssl-devel rpm-build git python3 dwarves file-devel libarchive-devel
debian/ubuntu环境
apt install -y screen wget curl zip unzip tar rsync build-essential libncurses-dev flex bc bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf pkg-config fakeroot dpkg-dev kmod cpio git python3 dwarves debhelper libarchive-dev
下载4.14版内核
bbrplus目前只适用于4.14内核,其他内核暂时无人修改
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.174.tar.xz tar xf linux-4.14.*.tar.xz
修改内核代码
./include/net/inet_connection_sock.h
136行修改以下数字 激进参数88->112 11->14 [保守参数(88->104 11->13)]
u64 icsk_ca_priv[112 / sizeof(u64)]; #define ICSK_CA_PRIV_SIZE (14 * sizeof(u64))
./net/ipv4/tcp_output.c
1834行修改
tcp_snd_wnd_test 函数大括号后}
换行添加
EXPORT_SYMBOL(tcp_snd_wnd_test);
/* Trim TSO SKB to LEN bytes, put the remaining data into a new packet * which is put after SKB on the list. It is very much like * tcp_fragment() except that it may make several kinds of assumptions * in order to speed up the splitting operation. In particular, we * know that all the data is in scatter-gather pages, and that the * packet has never been sent out before (and thus is not cloned). */
./net/ipv4/Makefile
44行替换参数
obj-$(CONFIG_TCP_CONG_BBR) += tcp_bbrplus.o
下载tcp_bbrplus源码
请参考末尾源代码,自行修改内核bbr源码
wget -P ./net/ipv4/ https://raw.githubusercontent.com/cx9208/bbrplus/master/tcp_bbrplus.c
开启编译选项并开启编译bbr为模块
#make oldconfig 可以直接使用系统配置文件 make menuconfig
禁用签名调试及编译
scripts/config --disable MODULE_SIG scripts/config --disable DEBUG_INFO
编译内核生成centos rpm或ubuntu deb包,注意如果使用make rpm-pkg则每次编译前会先clean,如果重复编译会很慢!
make binrpm-pkg make bindeb-pkg
开启bbrplus
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf echo "net.ipv4.tcp_congestion_control=bbrplus" >> /etc/sysctl.conf sysctl -p
魔改参数设置(可选)
./net/ipv4/tcp_bbrplus.c 或者 ./net/ipv4/tcp_bbr.c
134: static const int bbr_bw_rtts = CYCLE_LEN + 7; 136: static const u32 bbr_min_rtt_win_sec = 20; 152: static const int bbr_drain_gain = BBR_UNIT * 1200 / 2885; 164: BBR_UNIT * 3 / 2, /* probe for more available bw */ BBR_UNIT * 3 / 4, /* drain queue and/or yield bw to other flows */ BBR_UNIT * 9 / 8, BBR_UNIT * 9 / 8, BBR_UNIT * 9 / 8, /* cruise at 1.0*bw to utilize pipe, */ BBR_UNIT * 9 / 8, BBR_UNIT * 9 / 8, BBR_UNIT * 9 / 8 /* without creating excess queue... */
来源:
https://www.hostloc.com/thread-652002-1-1.html
https://github.com/liberal-boy/tcp_tsunami
https://github.com/ylx2016/kernel/releases/download/4.14.166-bbrplus/linux-4.14.166bbrplus.zip
此处评论已关闭