With the commit 3a9b76fd0db9 ("tcp: allow drivers to tweak TSQ logic") a network device driver can tune the number of bytes that TCP can queue in the qdisc/devices. The tuning is done through changing the log scale used to derive the TSQ credit from the current pacing rate (given in B/s). By default, it is 10 (equivalent to 1/1024 of a second), but drivers can select smaller values (from 1/512 to 1/64 of a second) that reflects in a higher number of bytes that can be enqueued.
The approach has three inherent problems: 0. The values that can be chosen are on a logarithmic scale; 1. It assumes that drivers maintainer will test different values and select the best one, putting it in the stone of the driver source code; 2. It prevents end users unable to recompile the kernel from experimenting other values. The users that rely on out-of-tree drivers should have a good knowledge of the WiFi ecosystem, and be able to patch their driver, to benefit from the approach: not everyone is a C expert. This series reverts the above approach and adds sysctl knobs for the tuning. Firstly, we added the option to disable the TSQ with the magic value -1 on tcp_limit_output_bytes. Then, we added two sysctl knobs to allow tuning the number of packets or the ms value that can be enqueued. So, the user (or the drivers, assuming they can modify sysctl values) can easily use other values without recompiling the kernel. A driver that right now has chosen to use a value of 64 for the shifting, with this patch should put in the sysctl_tcp_limit_output_ms variable a value of 16 (which corresponds to ~16 ms of bytes that can be enqueued) to obtain the same effect. The advantage of our series is that the driver developer (or the end user) can also test (without recompiling the kernel) values from 9 to 15 ms, which with the current kernel approach cannot be tested. Ref: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1670041 Cc: Eric Dumazet <eduma...@google.com> Cc: Toke Høiland-Jørgensen <t...@toke.dk> Cc: Carlo Augusto Grazia <carloaugusto.gra...@unimore.it> Natale Patriciello (3): Revert "tcp: allow drivers to tweak TSQ logic" tcp: Negative values of sysctl_tcp_limit_output_bytes disable TSQ tcp: Add tunable parameters for TSQ Documentation/networking/ip-sysctl.txt | 22 ++++++++++++++++++++++ include/net/netns/ipv4.h | 2 ++ include/net/sock.h | 2 -- net/core/sock.c | 1 - net/ipv4/sysctl_net_ipv4.c | 14 ++++++++++++++ net/ipv4/tcp_output.c | 10 ++++++++-- 6 files changed, 46 insertions(+), 5 deletions(-) -- 2.15.1