]> git.ipfire.org Git - thirdparty/iproute2.git/commit
tc/skbmod: Introduce SKBMOD_F_ECN option
authorPeilin Ye <peilin.ye@bytedance.com>
Wed, 4 Aug 2021 18:15:16 +0000 (11:15 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 1 Sep 2021 19:51:44 +0000 (12:51 -0700)
commit7e7270bb1f18dadbfcf6d4799aee9a85fecd95d9
tree28e34c8624993011ca424bc2588e72b2454ce14d
parent86c596ed91ec4e4cf4fa99c6555464c8b79786ac
tc/skbmod: Introduce SKBMOD_F_ECN option

Recently we added SKBMOD_F_ECN option support to the kernel; support it in
the tc-skbmod(8) front end, and update its man page accordingly.

The 2 least significant bits of the Traffic Class field in IPv4 and IPv6
headers are used to represent different ECN states [1]:

0b00: "Non ECN-Capable Transport", Non-ECT
0b10: "ECN Capable Transport", ECT(0)
0b01: "ECN Capable Transport", ECT(1)
0b11: "Congestion Encountered", CE

This new option, "ecn", marks ECT(0) and ECT(1) IPv{4,6} packets as CE,
which is useful for ECN-based rate limiting.  For example:

$ tc filter add dev eth0 parent 1: protocol ip prio 10 \
u32 match ip protocol 1 0xff flowid 1:2 \
action skbmod \
ecn

The updated tc-skbmod SYNOPSIS looks like the following:

tc ... action skbmod { set SETTABLE | swap SWAPPABLE | ecn } ...

Only one of "set", "swap" or "ecn" shall be used in a single tc-skbmod
command.  Trying to use more than one of them at a time is considered
undefined behavior; pipe multiple tc-skbmod commands together instead.
"set" and "swap" only affect Ethernet packets, while "ecn" only affects
IP packets.

Depends on kernel patch "net/sched: act_skbmod: Add SKBMOD_F_ECN option
support", as well as iproute2 patch "tc/skbmod: Remove misinformation
about the swap action".

[1] https://en.wikipedia.org/wiki/Explicit_Congestion_Notification

Reviewed-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Peilin Ye <peilin.ye@bytedance.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
man/man8/tc-skbmod.8
tc/m_skbmod.c