162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci================================
462306a36Sopenharmony_ciTC Actions - Environmental Rules
562306a36Sopenharmony_ci================================
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciThe "environmental" rules for authors of any new tc actions are:
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci1) If you stealeth or borroweth any packet thou shalt be branching
1162306a36Sopenharmony_ci   from the righteous path and thou shalt cloneth.
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci   For example if your action queues a packet to be processed later,
1462306a36Sopenharmony_ci   or intentionally branches by redirecting a packet, then you need to
1562306a36Sopenharmony_ci   clone the packet.
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci2) If you munge any packet thou shalt call pskb_expand_head in the case
1862306a36Sopenharmony_ci   someone else is referencing the skb. After that you "own" the skb.
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci3) Dropping packets you don't own is a no-no. You simply return
2162306a36Sopenharmony_ci   TC_ACT_SHOT to the caller and they will drop it.
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ciThe "environmental" rules for callers of actions (qdiscs etc) are:
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#) Thou art responsible for freeing anything returned as being
2662306a36Sopenharmony_ci   TC_ACT_SHOT/STOLEN/QUEUED. If none of TC_ACT_SHOT/STOLEN/QUEUED is
2762306a36Sopenharmony_ci   returned, then all is great and you don't need to do anything.
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ciPost on netdev if something is unclear.
30