Skip to content

Commit 7b05c95

Browse files
committed
chore: add tcx info in BPF_PROG_TYPE_SCHED_CLS.md
1 parent 4e0bec5 commit 7b05c95

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

docs/linux/program-type/BPF_PROG_TYPE_SCHED_CLS.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ When attached in direct action mode, the eBPF program will act as both a classif
3636
* `TC_ACT_REPEAT` (6) - While defined, this action should not be used and holds no particular meaning for eBPF classifiers.
3737
* `TC_ACT_REDIRECT` (7) - Signals that the packet should be redirected, the details of how and where to are set as side effects by [helpers functions](../helper-function/index.md).
3838

39-
Classifiers in direct action mode can still set a class id by setting the `tc_classid` field
39+
Classifiers in direct action mode can still set a class id by setting the `tc_classid` field
4040

4141
## Context
4242

@@ -101,6 +101,47 @@ For more details on the `tc` command, see the general [man page](https://man7.or
101101

102102
For more details on the bpf filter options, see the `tc-bpf` [man page](https://man7.org/linux/man-pages/man8/tc-bpf.8.html).
103103

104+
In addition, the kernel supports the tcx (the new tc BPF fast path with BPF link support) since kernel v6.6, which allows for more advanced features like attaching multiple programs to a single qdisc, or attaching programs to a qdisc on the egress side:
105+
```
106+
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
107+
| Program Type | Attach Type | ELF Section Name | Sleepable |
108+
+===========================================+========================================+==================================+===========+
109+
| ``BPF_PROG_TYPE_SCHED_CLS`` | | ``classifier`` [#tc_legacy]_ | |
110+
+ + +----------------------------------+-----------+
111+
| | | ``tc`` [#tc_legacy]_ | |
112+
+ +----------------------------------------+----------------------------------+-----------+
113+
| | ``BPF_NETKIT_PRIMARY`` | ``netkit/primary`` | |
114+
+ +----------------------------------------+----------------------------------+-----------+
115+
| | ``BPF_NETKIT_PEER`` | ``netkit/peer`` | |
116+
+ +----------------------------------------+----------------------------------+-----------+
117+
| | ``BPF_TCX_INGRESS`` | ``tc/ingress`` | |
118+
+ +----------------------------------------+----------------------------------+-----------+
119+
| | ``BPF_TCX_EGRESS`` | ``tc/egress`` | |
120+
+ +----------------------------------------+----------------------------------+-----------+
121+
| | ``BPF_TCX_INGRESS`` | ``tcx/ingress`` | |
122+
+ +----------------------------------------+----------------------------------+-----------+
123+
| | ``BPF_TCX_EGRESS`` | ``tcx/egress`` | |
124+
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
125+
```
126+
127+
The definition of return codes for tcx programs can be found in the kernel sources:
128+
```c
129+
/* (Simplified) user return codes for tcx prog type.
130+
* A valid tcx program must return one of these defined values. All other
131+
* return codes are reserved for future use. Must remain compatible with
132+
* their TC_ACT_* counter-parts. For compatibility in behavior, unknown
133+
* return codes are mapped to TCX_NEXT.
134+
*/
135+
enum tcx_action_base {
136+
TCX_NEXT = -1,
137+
TCX_PASS = 0,
138+
TCX_DROP = 2,
139+
TCX_REDIRECT = 7,
140+
};
141+
```
142+
143+
For more details of tcx, see the [LSFMM+BPF Summit Recap and Video: Revamping Global Socket Iterator, Netkit and Next Steps](https://ebpf.foundation/lsfmmbpf-summit-recap-and-video-revamping-global-socket-iterator-netkit-next-steps/).
144+
104145
## Helper functions
105146

106147
Not all helper functions are available in all program types. These are the helper calls available for TC classifier programs:

0 commit comments

Comments
 (0)