From: Peilin Ye <hidden> Date: 2021-07-21 23:21:06
From: Peilin Ye <redacted>
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 <redacted>
Signed-off-by: Peilin Ye <redacted>
---
Hi all,
The corresponding kernel patch is here, which is currently pending
for review:
https://lore.kernel.org/netdev/f5c5a81d6674a8f4838684ac52ed66da83f92499.1626899889.git.peilin.ye@bytedance.com/T/#u
It also depends on this iproute2 patch, which is also pending:
https://lore.kernel.org/netdev/20210720192145.20166-1-yepeilin.cs@gmail.com/
Thanks,
Peilin Ye
include/uapi/linux/tc_act/tc_skbmod.h | 1 +
man/man8/tc-skbmod.8 | 38 ++++++++++++++++++++-------
tc/m_skbmod.c | 8 +++++-
3 files changed, 37 insertions(+), 10 deletions(-)
@@ -37,6 +38,12 @@ action. Instead of having to manually edit 8-, 16-, or 32-bit chunks of an ethernet header, .Bskbmod allows complete substitution of supported elements.+Action must be one of+.BRset", "swap" and "ecn"."+.BRset" and "swap+only affect Ethernet packets, while+.Becn+only affects IP packets. .SHOPTIONS .TP .BIdmac" DMAC"
@@ -51,6 +58,10 @@ Change the ethertype to the specified value. .BImac Used to swap mac addresses. .TP+.Becn+Used to mark ECN Capable Transport (ECT) IP packets as Congestion Encountered (CE).+Does not affect Non ECN-Capable Transport (Non-ECT) packets.+.TP .ICONTROL The following keywords allow to control how the tree of qdisc, classes, filters and actions is further traversed after this action.
@@ -115,7 +126,7 @@ tc filter add dev eth5 parent 1: protocol ip prio 10 \\ .EE .RE-Finally, swap the destination and source mac addresses in the header:+To swap the destination and source mac addresses in the Ethernet header: .RS .EX
@@ -126,13 +137,22 @@ tc filter add dev eth3 parent 1: protocol ip prio 10 \\ .EE .RE-However, trying to-.Bset-and-.Bswap-in a single-.Bskbmod-command will cause undefined behavior.+Finally, to mark the CE codepoint in the IP header for ECN Capable Transport (ECT) packets:++.RS+.EX+tc filter add dev eth0 parent 1: protocol ip prio 10 \\+ u32 match ip protocol 1 0xff flowid 1:2 \\+ action skbmod \\+ ecn+.EE+.RE++Only one of+.BRset", "swap" and "ecn+shall be used in a single command.+Trying to use more than one of them in a single command is considered undefined behavior; pipe+multiple commands together instead. .SHSEEALSO .BRtc(8),
From: David Ahern <hidden> Date: 2021-08-02 16:28:47
On 7/21/21 5:20 PM, Peilin Ye wrote:
From: Peilin Ye <redacted>
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 <redacted>
Signed-off-by: Peilin Ye <redacted>
---
Hi all,
The corresponding kernel patch is here, which is currently pending
for review:
https://lore.kernel.org/netdev/f5c5a81d6674a8f4838684ac52ed66da83f92499.1626899889.git.peilin.ye@bytedance.com/T/#u
It also depends on this iproute2 patch, which is also pending:
https://lore.kernel.org/netdev/20210720192145.20166-1-yepeilin.cs@gmail.com/
Thanks,
Peilin Ye
man page update has conflicts; please rebase.
Thanks,
From: Peilin Ye <hidden> Date: 2021-08-02 17:55:03
From: Peilin Ye <redacted>
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 <redacted>
Signed-off-by: Peilin Ye <redacted>
---
Hi David,
Rebased on iproute2-next, should hunk now; thank you!
There will be a conflict next time you merge iproute2 into iproute2-next
because of this commit:
"tc/skbmod: Remove misinformation about the swap action"
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=c06d313d86c1acb8dd72589816301853ff5a4ac4
Please just ignore its code change since it is now superseded by this v2.
Thanks!
Peilin Ye
Change since v1:
- rebased on iproute2-next (David)
man/man8/tc-skbmod.8 | 46 ++++++++++++++++++++++++++++++++------------
tc/m_skbmod.c | 11 ++++++++---
2 files changed, 42 insertions(+), 15 deletions(-)
@@ -36,6 +38,12 @@ action. Instead of having to manually edit 8-, 16-, or 32-bit chunks of an ethernet header, .Bskbmod allows complete substitution of supported elements.+Action must be one of+.BRset", "swap" and "ecn"."+.BRset" and "swap+only affect Ethernet packets, while+.Becn+only affects IP packets. .SHOPTIONS .TP .BIdmac" DMAC"
@@ -48,10 +56,11 @@ Change the source mac to the specified address. Change the ethertype to the specified value. .TP .BImac-Used to swap mac addresses. The-.Bswapmac-directive is performed-after any outstanding D/SMAC changes.+Used to swap mac addresses.+.TP+.Becn+Used to mark ECN Capable Transport (ECT) IP packets as Congestion Encountered (CE).+Does not affect Non ECN-Capable Transport (Non-ECT) packets. .TP .ICONTROL The following keywords allow to control how the tree of qdisc, classes,
@@ -117,7 +126,7 @@ tc filter add dev eth5 parent 1: protocol ip prio 10 \\ .EE .RE-Finally, swap the destination and source mac addresses in the header:+To swap the destination and source mac addresses in the Ethernet header: .RS .EX
@@ -128,9 +137,22 @@ tc filter add dev eth3 parent 1: protocol ip prio 10 \\ .EE .RE-As mentioned above, the swap action will occur after any-.B" smac/dmac "-substitutions are executed, if they are present.+Finally, to mark the CE codepoint in the IP header for ECN Capable Transport (ECT) packets:++.RS+.EX+tc filter add dev eth0 parent 1: protocol ip prio 10 \\+ u32 match ip protocol 1 0xff flowid 1:2 \\+ action skbmod \\+ ecn+.EE+.RE++Only one of+.BRset", "swap" and "ecn+shall be used in a single command.+Trying to use more than one of them in a single command is considered undefined behavior; pipe+multiple commands together instead. .SHSEEALSO .BRtc(8),
From: Peilin Ye <hidden> Date: 2021-08-02 20:51:45
From: Peilin Ye <redacted>
If the ingress Qdisc is in use, currently it is not possible to add
another clsact egress mini-Qdisc to the same device without taking down
the ingress Qdisc, since both sch_ingress and sch_clsact use the same
handle (0xFFFF0000).
To solve this issue, recently we added a new clsact egress mini-Qdisc
option for sch_ingress in the kernel. Support it in the q_ingress front
end, and update the usage message accordingly.
To turn on the egress mini-Qdisc:
$ tc qdisc add dev eth0 ingress
$ tc qdisc change dev eth0 ingress clsact-on
Then users can add filters to the egress mini-Qdisc as usual:
$ tc filter add dev eth0 egress protocol ip prio 10 \
matchall action skbmod swap mac
Deleting the ingress Qdisc removes the egress mini-Qdisc as well. To
remove egress mini-Qdisc only, use:
$ tc qdisc change dev eth0 ingress clsact-off
Finally, if the egress mini-Qdisc is enabled, the "show" command will
print out a "clsact" flag to indicate it:
$ tc qdisc show ingress
qdisc ingress ffff: dev eth0 parent ffff:fff1 ----------------
$ tc qdisc change dev eth0 ingress clsact-on
$ tc qdisc show ingress
qdisc ingress ffff: dev eth0 parent ffff:fff1 ---------------- clsact
Reviewed-by: Cong Wang <redacted>
Signed-off-by: Peilin Ye <redacted>
---
include/uapi/linux/pkt_sched.h | 12 +++++++++
tc/q_ingress.c | 46 ++++++++++++++++++++++++++++++++--
2 files changed, 56 insertions(+), 2 deletions(-)
thanks for the heads up about the conflict, but let's not duplicate that
removal in this patch.
I just merged main into next. Please fix up this patch and re-send. In
the future, just ask for a merge in cases like this.
From: Peilin Ye <hidden> Date: 2021-08-04 18:15:38
From: Peilin Ye <redacted>
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 <redacted>
Signed-off-by: Peilin Ye <redacted>
---
Hi David,
I just merged main into next. Please fix up this patch and re-send. In
the future, just ask for a merge in cases like this.
Ah, I see; thanks!
Peilin Ye
Change since v2:
- re-rebased on iproute2-next (David)
man/man8/tc-skbmod.8 | 38 +++++++++++++++++++++++++++++---------
tc/m_skbmod.c | 8 +++++++-
2 files changed, 36 insertions(+), 10 deletions(-)
@@ -37,6 +38,12 @@ action. Instead of having to manually edit 8-, 16-, or 32-bit chunks of an ethernet header, .Bskbmod allows complete substitution of supported elements.+Action must be one of+.BRset", "swap" and "ecn"."+.BRset" and "swap+only affect Ethernet packets, while+.Becn+only affects IP packets. .SHOPTIONS .TP .BIdmac" DMAC"
@@ -51,6 +58,10 @@ Change the ethertype to the specified value. .BImac Used to swap mac addresses. .TP+.Becn+Used to mark ECN Capable Transport (ECT) IP packets as Congestion Encountered (CE).+Does not affect Non ECN-Capable Transport (Non-ECT) packets.+.TP .ICONTROL The following keywords allow to control how the tree of qdisc, classes, filters and actions is further traversed after this action.
@@ -115,7 +126,7 @@ tc filter add dev eth5 parent 1: protocol ip prio 10 \\ .EE .RE-Finally, swap the destination and source mac addresses in the header:+To swap the destination and source mac addresses in the Ethernet header: .RS .EX
@@ -126,13 +137,22 @@ tc filter add dev eth3 parent 1: protocol ip prio 10 \\ .EE .RE-However, trying to-.Bset-and-.Bswap-in a single-.Bskbmod-command will cause undefined behavior.+Finally, to mark the CE codepoint in the IP header for ECN Capable Transport (ECT) packets:++.RS+.EX+tc filter add dev eth0 parent 1: protocol ip prio 10 \\+ u32 match ip protocol 1 0xff flowid 1:2 \\+ action skbmod \\+ ecn+.EE+.RE++Only one of+.BRset", "swap" and "ecn+shall be used in a single command.+Trying to use more than one of them in a single command is considered undefined behavior; pipe+multiple commands together instead. .SHSEEALSO .BRtc(8),
From: David Ahern <hidden> Date: 2021-08-08 17:59:41
On 8/4/21 12:15 PM, Peilin Ye wrote:
From: Peilin Ye <redacted>
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 <redacted>
Signed-off-by: Peilin Ye <redacted>
---
Hi David,
quoted
I just merged main into next. Please fix up this patch and re-send. In
the future, just ask for a merge in cases like this.
Ah, I see; thanks!
Peilin Ye
Change since v2:
- re-rebased on iproute2-next (David)
man/man8/tc-skbmod.8 | 38 +++++++++++++++++++++++++++++---------
tc/m_skbmod.c | 8 +++++++-
2 files changed, 36 insertions(+), 10 deletions(-)
Hello:
This patch was applied to iproute2/iproute2-next.git (refs/heads/main):
On Wed, 4 Aug 2021 11:15:16 -0700 you wrote:
From: Peilin Ye <redacted>
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]:
[...]