18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci================================ 48c2ecf20Sopenharmony_ciTC Actions - Environmental Rules 58c2ecf20Sopenharmony_ci================================ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ciThe "environmental" rules for authors of any new tc actions are: 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci1) If you stealeth or borroweth any packet thou shalt be branching 118c2ecf20Sopenharmony_ci from the righteous path and thou shalt cloneth. 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci For example if your action queues a packet to be processed later, 148c2ecf20Sopenharmony_ci or intentionally branches by redirecting a packet, then you need to 158c2ecf20Sopenharmony_ci clone the packet. 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci2) If you munge any packet thou shalt call pskb_expand_head in the case 188c2ecf20Sopenharmony_ci someone else is referencing the skb. After that you "own" the skb. 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci3) Dropping packets you don't own is a no-no. You simply return 218c2ecf20Sopenharmony_ci TC_ACT_SHOT to the caller and they will drop it. 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciThe "environmental" rules for callers of actions (qdiscs etc) are: 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#) Thou art responsible for freeing anything returned as being 268c2ecf20Sopenharmony_ci TC_ACT_SHOT/STOLEN/QUEUED. If none of TC_ACT_SHOT/STOLEN/QUEUED is 278c2ecf20Sopenharmony_ci returned, then all is great and you don't need to do anything. 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciPost on netdev if something is unclear. 30