Adding congestion control protocols
The linux kernel comes with a number of different congestion control algorithms. To test new congestion control methods we to be able to:
- Dynamically select new protocols
- Recompile and install new protocols
Selecting an protocol
For any protocol that has already been installed as a kernel module, it should be possible to set that protocol as the current default using the following:
sudo net.ipv4.tcp_congestion_control=cubic
sudo sysctl -p
sudo sysctl net.ipv4.tcp_congestion_control # check the active protocol
Adding or Modifying Source code additions
The goal here is to A) create new protcols or B) install multiple versions of the same protocols with different names. This will allow user to switch between protocols without rebooting the client machines.
The general process is as follows:
Add or modify a new file int
/net/ipv4/
for the congestion control protocolThis file should contain the main code for the congestion control protocol.
The important parts are defined in the
struct tcp_congestion_ops
. This is defined ininclude/net/tcp.h
. This specifies the init function and the main function and event handlers for this protocols.Create an ‘info’ struct to hold the state in
include/uapi/linux/inet_diag.h
This must be added to the
union tcp_cc_info
ininclude/uapi/linux/inet_diag.h
.note: if you are modifying the bbr stack, you can probably just reuse the existing bbr struct
Modify the
net/ipv4/Kconfig
I believe this is used to to specify which modules should be built into the image. So, this is force the new modules you create to be compiled.
Add the .o file to
net/ipv4/Makefile
the line should look like:
obj-$(CONFIG_TCP_CONG_BBR2) += tcp_bbr2.o
As kernel version changes, the old bbr code has to be modified to work with the newer kernel api. So, running multiple different versions of BBR in the same kernel is difficult.
Installing a kernel module
Note: it should be possible to just install the kernel module for the new congestion control protocol
User space congestion control
This SIGCOMM Paper published by Akshay Narayan et. al. at MIT discusses using a user space agent to implement congestion control protocols. This has interesting implications on the development of these protocols.