xref: /linux/Documentation/networking/tc-actions-env-rules.rst (revision 2697b79a469b68e3ad3640f55284359c1396278d)
1.. SPDX-License-Identifier: GPL-2.0
2
3================================
4TC Actions - Environmental Rules
5================================
6
7
8The "environmental" rules for authors of any new tc actions are:
9
101) If you stealeth or borroweth any packet thou shalt be branching
11   from the righteous path and thou shalt cloneth.
12
13   For example if your action queues a packet to be processed later,
14   or intentionally branches by redirecting a packet, then you need to
15   clone the packet.
16
172) If you munge any packet thou shalt call pskb_expand_head in the case
18   someone else is referencing the skb. After that you "own" the skb.
19
203) Dropping packets you don't own is a no-no. You simply return
21   TC_ACT_SHOT to the caller and they will drop it.
22
23The "environmental" rules for callers of actions (qdiscs etc) are:
24
25#) Thou art responsible for freeing anything returned as being
26   TC_ACT_SHOT/STOLEN/QUEUED. If none of TC_ACT_SHOT/STOLEN/QUEUED is
27   returned, then all is great and you don't need to do anything.
28
29Post on netdev if something is unclear.
30