Extract the remaining two fields from tc_verd and remove the __u16 completely. TC_AT and TC_FROM are converted to equivalent two-bit integer fields tc_at and tc_from. Where possible, use existing helper skb_at_tc_ingress when reading tc_at. Introduce helper skb_reset_tc to clear fields. Not documenting tc_from and tc_at, because they will be replaced with single bit fields in follow-on patches.
Showing the changes to include/uapi/linux (1 of 11 files). Show all
Unified · Split
| @@ -5,40 +5,9 @@ · 4 unmodified lines | |||
| 5 | #include <linux/pkt_sched.h> | 5 | #include <linux/pkt_sched.h> |
| 6 | 6 | ||
| 7 | #ifdef __KERNEL__ | 7 | #ifdef __KERNEL__ |
| 8 | /* I think i could have done better macros ; for now this is stolen from | ||
| 9 | * some arch/mips code - jhs | ||
| 10 | */ | ||
| 11 | #define _TC_MAKE32(x) ((x)) | ||
| 12 | |||
| 13 | #define _TC_MAKEMASK1(n) (_TC_MAKE32(1) << _TC_MAKE32(n)) | ||
| 14 | #define _TC_MAKEMASK(v,n) (_TC_MAKE32((_TC_MAKE32(1)<<(v))-1) << _TC_MAKE32(n)) | ||
| 15 | #define _TC_MAKEVALUE(v,n) (_TC_MAKE32(v) << _TC_MAKE32(n)) | ||
| 16 | #define _TC_GETVALUE(v,n,m) ((_TC_MAKE32(v) & _TC_MAKE32(m)) >> _TC_MAKE32(n)) | ||
| 17 | |||
| 18 | /* verdict bit breakdown | ||
| 19 | * | ||
| 20 | bit 6,7: Where this packet was last seen | ||
| 21 | 0: Above the transmit example at the socket level | ||
| 22 | 1: on the Ingress | ||
| 23 | 2: on the Egress | ||
| 24 | |||
| 25 | * | ||
| 26 | * */ | ||
| 27 | |||
| 28 | #define S_TC_FROM _TC_MAKE32(6) | ||
| 29 | #define M_TC_FROM _TC_MAKEMASK(2,S_TC_FROM) | ||
| 30 | #define G_TC_FROM(x) _TC_GETVALUE(x,S_TC_FROM,M_TC_FROM) | ||
| 31 | #define V_TC_FROM(x) _TC_MAKEVALUE(x,S_TC_FROM) | ||
| 32 | #define SET_TC_FROM(v,n) ((V_TC_FROM(n)) | (v & ~M_TC_FROM)) | ||
| 33 | #define AT_STACK 0x0 | 8 | #define AT_STACK 0x0 |
| 34 | #define AT_INGRESS 0x1 | 9 | #define AT_INGRESS 0x1 |
| 35 | #define AT_EGRESS 0x2 | 10 | #define AT_EGRESS 0x2 |
| 36 | |||
| 37 | #define S_TC_AT _TC_MAKE32(12) | ||
| 38 | #define M_TC_AT _TC_MAKEMASK(2,S_TC_AT) | ||
| 39 | #define G_TC_AT(x) _TC_GETVALUE(x,S_TC_AT,M_TC_AT) | ||
| 40 | #define V_TC_AT(x) _TC_MAKEVALUE(x,S_TC_AT) | ||
| 41 | #define SET_TC_AT(v,n) ((V_TC_AT(n)) | (v & ~M_TC_AT)) | ||
| 42 | #endif | 11 | #endif |
| 43 | 12 | ||
| 44 | /* Action attributes */ | 13 | /* Action attributes */ |