1607ca46eSDavid Howells #ifndef __LINUX_PKT_SCHED_H 2607ca46eSDavid Howells #define __LINUX_PKT_SCHED_H 3607ca46eSDavid Howells 4607ca46eSDavid Howells #include <linux/types.h> 5607ca46eSDavid Howells 6607ca46eSDavid Howells /* Logical priority bands not depending on specific packet scheduler. 7607ca46eSDavid Howells Every scheduler will map them to real traffic classes, if it has 8607ca46eSDavid Howells no more precise mechanism to classify packets. 9607ca46eSDavid Howells 10607ca46eSDavid Howells These numbers have no special meaning, though their coincidence 11607ca46eSDavid Howells with obsolete IPv6 values is not occasional :-). New IPv6 drafts 12607ca46eSDavid Howells preferred full anarchy inspired by diffserv group. 13607ca46eSDavid Howells 14607ca46eSDavid Howells Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy 15607ca46eSDavid Howells class, actually, as rule it will be handled with more care than 16607ca46eSDavid Howells filler or even bulk. 17607ca46eSDavid Howells */ 18607ca46eSDavid Howells 19607ca46eSDavid Howells #define TC_PRIO_BESTEFFORT 0 20607ca46eSDavid Howells #define TC_PRIO_FILLER 1 21607ca46eSDavid Howells #define TC_PRIO_BULK 2 22607ca46eSDavid Howells #define TC_PRIO_INTERACTIVE_BULK 4 23607ca46eSDavid Howells #define TC_PRIO_INTERACTIVE 6 24607ca46eSDavid Howells #define TC_PRIO_CONTROL 7 25607ca46eSDavid Howells 26607ca46eSDavid Howells #define TC_PRIO_MAX 15 27607ca46eSDavid Howells 28607ca46eSDavid Howells /* Generic queue statistics, available for all the elements. 29607ca46eSDavid Howells Particular schedulers may have also their private records. 30607ca46eSDavid Howells */ 31607ca46eSDavid Howells 32607ca46eSDavid Howells struct tc_stats { 33607ca46eSDavid Howells __u64 bytes; /* Number of enqueued bytes */ 34607ca46eSDavid Howells __u32 packets; /* Number of enqueued packets */ 35607ca46eSDavid Howells __u32 drops; /* Packets dropped because of lack of resources */ 36607ca46eSDavid Howells __u32 overlimits; /* Number of throttle events when this 37607ca46eSDavid Howells * flow goes out of allocated bandwidth */ 38607ca46eSDavid Howells __u32 bps; /* Current flow byte rate */ 39607ca46eSDavid Howells __u32 pps; /* Current flow packet rate */ 40607ca46eSDavid Howells __u32 qlen; 41607ca46eSDavid Howells __u32 backlog; 42607ca46eSDavid Howells }; 43607ca46eSDavid Howells 44607ca46eSDavid Howells struct tc_estimator { 45607ca46eSDavid Howells signed char interval; 46607ca46eSDavid Howells unsigned char ewma_log; 47607ca46eSDavid Howells }; 48607ca46eSDavid Howells 49607ca46eSDavid Howells /* "Handles" 50607ca46eSDavid Howells --------- 51607ca46eSDavid Howells 52607ca46eSDavid Howells All the traffic control objects have 32bit identifiers, or "handles". 53607ca46eSDavid Howells 54607ca46eSDavid Howells They can be considered as opaque numbers from user API viewpoint, 55607ca46eSDavid Howells but actually they always consist of two fields: major and 56607ca46eSDavid Howells minor numbers, which are interpreted by kernel specially, 57607ca46eSDavid Howells that may be used by applications, though not recommended. 58607ca46eSDavid Howells 59607ca46eSDavid Howells F.e. qdisc handles always have minor number equal to zero, 60607ca46eSDavid Howells classes (or flows) have major equal to parent qdisc major, and 61607ca46eSDavid Howells minor uniquely identifying class inside qdisc. 62607ca46eSDavid Howells 63607ca46eSDavid Howells Macros to manipulate handles: 64607ca46eSDavid Howells */ 65607ca46eSDavid Howells 66607ca46eSDavid Howells #define TC_H_MAJ_MASK (0xFFFF0000U) 67607ca46eSDavid Howells #define TC_H_MIN_MASK (0x0000FFFFU) 68607ca46eSDavid Howells #define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK) 69607ca46eSDavid Howells #define TC_H_MIN(h) ((h)&TC_H_MIN_MASK) 70607ca46eSDavid Howells #define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK)) 71607ca46eSDavid Howells 72607ca46eSDavid Howells #define TC_H_UNSPEC (0U) 73607ca46eSDavid Howells #define TC_H_ROOT (0xFFFFFFFFU) 74607ca46eSDavid Howells #define TC_H_INGRESS (0xFFFFFFF1U) 75607ca46eSDavid Howells 768a8e3d84SJesper Dangaard Brouer /* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */ 778a8e3d84SJesper Dangaard Brouer enum tc_link_layer { 788a8e3d84SJesper Dangaard Brouer TC_LINKLAYER_UNAWARE, /* Indicate unaware old iproute2 util */ 798a8e3d84SJesper Dangaard Brouer TC_LINKLAYER_ETHERNET, 808a8e3d84SJesper Dangaard Brouer TC_LINKLAYER_ATM, 818a8e3d84SJesper Dangaard Brouer }; 828a8e3d84SJesper Dangaard Brouer #define TC_LINKLAYER_MASK 0x0F /* limit use to lower 4 bits */ 838a8e3d84SJesper Dangaard Brouer 84607ca46eSDavid Howells struct tc_ratespec { 85607ca46eSDavid Howells unsigned char cell_log; 868a8e3d84SJesper Dangaard Brouer __u8 linklayer; /* lower 4 bits */ 87607ca46eSDavid Howells unsigned short overhead; 88607ca46eSDavid Howells short cell_align; 89607ca46eSDavid Howells unsigned short mpu; 90607ca46eSDavid Howells __u32 rate; 91607ca46eSDavid Howells }; 92607ca46eSDavid Howells 93607ca46eSDavid Howells #define TC_RTAB_SIZE 1024 94607ca46eSDavid Howells 95607ca46eSDavid Howells struct tc_sizespec { 96607ca46eSDavid Howells unsigned char cell_log; 97607ca46eSDavid Howells unsigned char size_log; 98607ca46eSDavid Howells short cell_align; 99607ca46eSDavid Howells int overhead; 100607ca46eSDavid Howells unsigned int linklayer; 101607ca46eSDavid Howells unsigned int mpu; 102607ca46eSDavid Howells unsigned int mtu; 103607ca46eSDavid Howells unsigned int tsize; 104607ca46eSDavid Howells }; 105607ca46eSDavid Howells 106607ca46eSDavid Howells enum { 107607ca46eSDavid Howells TCA_STAB_UNSPEC, 108607ca46eSDavid Howells TCA_STAB_BASE, 109607ca46eSDavid Howells TCA_STAB_DATA, 110607ca46eSDavid Howells __TCA_STAB_MAX 111607ca46eSDavid Howells }; 112607ca46eSDavid Howells 113607ca46eSDavid Howells #define TCA_STAB_MAX (__TCA_STAB_MAX - 1) 114607ca46eSDavid Howells 115607ca46eSDavid Howells /* FIFO section */ 116607ca46eSDavid Howells 117607ca46eSDavid Howells struct tc_fifo_qopt { 118607ca46eSDavid Howells __u32 limit; /* Queue length: bytes for bfifo, packets for pfifo */ 119607ca46eSDavid Howells }; 120607ca46eSDavid Howells 121607ca46eSDavid Howells /* PRIO section */ 122607ca46eSDavid Howells 123607ca46eSDavid Howells #define TCQ_PRIO_BANDS 16 124607ca46eSDavid Howells #define TCQ_MIN_PRIO_BANDS 2 125607ca46eSDavid Howells 126607ca46eSDavid Howells struct tc_prio_qopt { 127607ca46eSDavid Howells int bands; /* Number of bands */ 128607ca46eSDavid Howells __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ 129607ca46eSDavid Howells }; 130607ca46eSDavid Howells 131607ca46eSDavid Howells /* MULTIQ section */ 132607ca46eSDavid Howells 133607ca46eSDavid Howells struct tc_multiq_qopt { 134607ca46eSDavid Howells __u16 bands; /* Number of bands */ 135607ca46eSDavid Howells __u16 max_bands; /* Maximum number of queues */ 136607ca46eSDavid Howells }; 137607ca46eSDavid Howells 138607ca46eSDavid Howells /* PLUG section */ 139607ca46eSDavid Howells 140607ca46eSDavid Howells #define TCQ_PLUG_BUFFER 0 141607ca46eSDavid Howells #define TCQ_PLUG_RELEASE_ONE 1 142607ca46eSDavid Howells #define TCQ_PLUG_RELEASE_INDEFINITE 2 143607ca46eSDavid Howells #define TCQ_PLUG_LIMIT 3 144607ca46eSDavid Howells 145607ca46eSDavid Howells struct tc_plug_qopt { 146607ca46eSDavid Howells /* TCQ_PLUG_BUFFER: Inset a plug into the queue and 147607ca46eSDavid Howells * buffer any incoming packets 148607ca46eSDavid Howells * TCQ_PLUG_RELEASE_ONE: Dequeue packets from queue head 149607ca46eSDavid Howells * to beginning of the next plug. 150607ca46eSDavid Howells * TCQ_PLUG_RELEASE_INDEFINITE: Dequeue all packets from queue. 151607ca46eSDavid Howells * Stop buffering packets until the next TCQ_PLUG_BUFFER 152607ca46eSDavid Howells * command is received (just act as a pass-thru queue). 153607ca46eSDavid Howells * TCQ_PLUG_LIMIT: Increase/decrease queue size 154607ca46eSDavid Howells */ 155607ca46eSDavid Howells int action; 156607ca46eSDavid Howells __u32 limit; 157607ca46eSDavid Howells }; 158607ca46eSDavid Howells 159607ca46eSDavid Howells /* TBF section */ 160607ca46eSDavid Howells 161607ca46eSDavid Howells struct tc_tbf_qopt { 162607ca46eSDavid Howells struct tc_ratespec rate; 163607ca46eSDavid Howells struct tc_ratespec peakrate; 164607ca46eSDavid Howells __u32 limit; 165607ca46eSDavid Howells __u32 buffer; 166607ca46eSDavid Howells __u32 mtu; 167607ca46eSDavid Howells }; 168607ca46eSDavid Howells 169607ca46eSDavid Howells enum { 170607ca46eSDavid Howells TCA_TBF_UNSPEC, 171607ca46eSDavid Howells TCA_TBF_PARMS, 172607ca46eSDavid Howells TCA_TBF_RTAB, 173607ca46eSDavid Howells TCA_TBF_PTAB, 174607ca46eSDavid Howells __TCA_TBF_MAX, 175607ca46eSDavid Howells }; 176607ca46eSDavid Howells 177607ca46eSDavid Howells #define TCA_TBF_MAX (__TCA_TBF_MAX - 1) 178607ca46eSDavid Howells 179607ca46eSDavid Howells 180607ca46eSDavid Howells /* TEQL section */ 181607ca46eSDavid Howells 182607ca46eSDavid Howells /* TEQL does not require any parameters */ 183607ca46eSDavid Howells 184607ca46eSDavid Howells /* SFQ section */ 185607ca46eSDavid Howells 186607ca46eSDavid Howells struct tc_sfq_qopt { 187607ca46eSDavid Howells unsigned quantum; /* Bytes per round allocated to flow */ 188607ca46eSDavid Howells int perturb_period; /* Period of hash perturbation */ 189607ca46eSDavid Howells __u32 limit; /* Maximal packets in queue */ 190607ca46eSDavid Howells unsigned divisor; /* Hash divisor */ 191607ca46eSDavid Howells unsigned flows; /* Maximal number of flows */ 192607ca46eSDavid Howells }; 193607ca46eSDavid Howells 194607ca46eSDavid Howells struct tc_sfqred_stats { 195607ca46eSDavid Howells __u32 prob_drop; /* Early drops, below max threshold */ 196607ca46eSDavid Howells __u32 forced_drop; /* Early drops, after max threshold */ 197607ca46eSDavid Howells __u32 prob_mark; /* Marked packets, below max threshold */ 198607ca46eSDavid Howells __u32 forced_mark; /* Marked packets, after max threshold */ 199607ca46eSDavid Howells __u32 prob_mark_head; /* Marked packets, below max threshold */ 200607ca46eSDavid Howells __u32 forced_mark_head;/* Marked packets, after max threshold */ 201607ca46eSDavid Howells }; 202607ca46eSDavid Howells 203607ca46eSDavid Howells struct tc_sfq_qopt_v1 { 204607ca46eSDavid Howells struct tc_sfq_qopt v0; 205607ca46eSDavid Howells unsigned int depth; /* max number of packets per flow */ 206607ca46eSDavid Howells unsigned int headdrop; 207607ca46eSDavid Howells /* SFQRED parameters */ 208607ca46eSDavid Howells __u32 limit; /* HARD maximal flow queue length (bytes) */ 209607ca46eSDavid Howells __u32 qth_min; /* Min average length threshold (bytes) */ 210607ca46eSDavid Howells __u32 qth_max; /* Max average length threshold (bytes) */ 211607ca46eSDavid Howells unsigned char Wlog; /* log(W) */ 212607ca46eSDavid Howells unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ 213607ca46eSDavid Howells unsigned char Scell_log; /* cell size for idle damping */ 214607ca46eSDavid Howells unsigned char flags; 215607ca46eSDavid Howells __u32 max_P; /* probability, high resolution */ 216607ca46eSDavid Howells /* SFQRED stats */ 217607ca46eSDavid Howells struct tc_sfqred_stats stats; 218607ca46eSDavid Howells }; 219607ca46eSDavid Howells 220607ca46eSDavid Howells 221607ca46eSDavid Howells struct tc_sfq_xstats { 222607ca46eSDavid Howells __s32 allot; 223607ca46eSDavid Howells }; 224607ca46eSDavid Howells 225607ca46eSDavid Howells /* RED section */ 226607ca46eSDavid Howells 227607ca46eSDavid Howells enum { 228607ca46eSDavid Howells TCA_RED_UNSPEC, 229607ca46eSDavid Howells TCA_RED_PARMS, 230607ca46eSDavid Howells TCA_RED_STAB, 231607ca46eSDavid Howells TCA_RED_MAX_P, 232607ca46eSDavid Howells __TCA_RED_MAX, 233607ca46eSDavid Howells }; 234607ca46eSDavid Howells 235607ca46eSDavid Howells #define TCA_RED_MAX (__TCA_RED_MAX - 1) 236607ca46eSDavid Howells 237607ca46eSDavid Howells struct tc_red_qopt { 238607ca46eSDavid Howells __u32 limit; /* HARD maximal queue length (bytes) */ 239607ca46eSDavid Howells __u32 qth_min; /* Min average length threshold (bytes) */ 240607ca46eSDavid Howells __u32 qth_max; /* Max average length threshold (bytes) */ 241607ca46eSDavid Howells unsigned char Wlog; /* log(W) */ 242607ca46eSDavid Howells unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ 243607ca46eSDavid Howells unsigned char Scell_log; /* cell size for idle damping */ 244607ca46eSDavid Howells unsigned char flags; 245607ca46eSDavid Howells #define TC_RED_ECN 1 246607ca46eSDavid Howells #define TC_RED_HARDDROP 2 247607ca46eSDavid Howells #define TC_RED_ADAPTATIVE 4 248607ca46eSDavid Howells }; 249607ca46eSDavid Howells 250607ca46eSDavid Howells struct tc_red_xstats { 251607ca46eSDavid Howells __u32 early; /* Early drops */ 252607ca46eSDavid Howells __u32 pdrop; /* Drops due to queue limits */ 253607ca46eSDavid Howells __u32 other; /* Drops due to drop() calls */ 254607ca46eSDavid Howells __u32 marked; /* Marked packets */ 255607ca46eSDavid Howells }; 256607ca46eSDavid Howells 257607ca46eSDavid Howells /* GRED section */ 258607ca46eSDavid Howells 259607ca46eSDavid Howells #define MAX_DPs 16 260607ca46eSDavid Howells 261607ca46eSDavid Howells enum { 262607ca46eSDavid Howells TCA_GRED_UNSPEC, 263607ca46eSDavid Howells TCA_GRED_PARMS, 264607ca46eSDavid Howells TCA_GRED_STAB, 265607ca46eSDavid Howells TCA_GRED_DPS, 266607ca46eSDavid Howells TCA_GRED_MAX_P, 267607ca46eSDavid Howells __TCA_GRED_MAX, 268607ca46eSDavid Howells }; 269607ca46eSDavid Howells 270607ca46eSDavid Howells #define TCA_GRED_MAX (__TCA_GRED_MAX - 1) 271607ca46eSDavid Howells 272607ca46eSDavid Howells struct tc_gred_qopt { 273607ca46eSDavid Howells __u32 limit; /* HARD maximal queue length (bytes) */ 274607ca46eSDavid Howells __u32 qth_min; /* Min average length threshold (bytes) */ 275607ca46eSDavid Howells __u32 qth_max; /* Max average length threshold (bytes) */ 276607ca46eSDavid Howells __u32 DP; /* up to 2^32 DPs */ 277607ca46eSDavid Howells __u32 backlog; 278607ca46eSDavid Howells __u32 qave; 279607ca46eSDavid Howells __u32 forced; 280607ca46eSDavid Howells __u32 early; 281607ca46eSDavid Howells __u32 other; 282607ca46eSDavid Howells __u32 pdrop; 283607ca46eSDavid Howells __u8 Wlog; /* log(W) */ 284607ca46eSDavid Howells __u8 Plog; /* log(P_max/(qth_max-qth_min)) */ 285607ca46eSDavid Howells __u8 Scell_log; /* cell size for idle damping */ 286607ca46eSDavid Howells __u8 prio; /* prio of this VQ */ 287607ca46eSDavid Howells __u32 packets; 288607ca46eSDavid Howells __u32 bytesin; 289607ca46eSDavid Howells }; 290607ca46eSDavid Howells 291607ca46eSDavid Howells /* gred setup */ 292607ca46eSDavid Howells struct tc_gred_sopt { 293607ca46eSDavid Howells __u32 DPs; 294607ca46eSDavid Howells __u32 def_DP; 295607ca46eSDavid Howells __u8 grio; 296607ca46eSDavid Howells __u8 flags; 297607ca46eSDavid Howells __u16 pad1; 298607ca46eSDavid Howells }; 299607ca46eSDavid Howells 300607ca46eSDavid Howells /* CHOKe section */ 301607ca46eSDavid Howells 302607ca46eSDavid Howells enum { 303607ca46eSDavid Howells TCA_CHOKE_UNSPEC, 304607ca46eSDavid Howells TCA_CHOKE_PARMS, 305607ca46eSDavid Howells TCA_CHOKE_STAB, 306607ca46eSDavid Howells TCA_CHOKE_MAX_P, 307607ca46eSDavid Howells __TCA_CHOKE_MAX, 308607ca46eSDavid Howells }; 309607ca46eSDavid Howells 310607ca46eSDavid Howells #define TCA_CHOKE_MAX (__TCA_CHOKE_MAX - 1) 311607ca46eSDavid Howells 312607ca46eSDavid Howells struct tc_choke_qopt { 313607ca46eSDavid Howells __u32 limit; /* Hard queue length (packets) */ 314607ca46eSDavid Howells __u32 qth_min; /* Min average threshold (packets) */ 315607ca46eSDavid Howells __u32 qth_max; /* Max average threshold (packets) */ 316607ca46eSDavid Howells unsigned char Wlog; /* log(W) */ 317607ca46eSDavid Howells unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */ 318607ca46eSDavid Howells unsigned char Scell_log; /* cell size for idle damping */ 319607ca46eSDavid Howells unsigned char flags; /* see RED flags */ 320607ca46eSDavid Howells }; 321607ca46eSDavid Howells 322607ca46eSDavid Howells struct tc_choke_xstats { 323607ca46eSDavid Howells __u32 early; /* Early drops */ 324607ca46eSDavid Howells __u32 pdrop; /* Drops due to queue limits */ 325607ca46eSDavid Howells __u32 other; /* Drops due to drop() calls */ 326607ca46eSDavid Howells __u32 marked; /* Marked packets */ 327607ca46eSDavid Howells __u32 matched; /* Drops due to flow match */ 328607ca46eSDavid Howells }; 329607ca46eSDavid Howells 330607ca46eSDavid Howells /* HTB section */ 331607ca46eSDavid Howells #define TC_HTB_NUMPRIO 8 332607ca46eSDavid Howells #define TC_HTB_MAXDEPTH 8 333607ca46eSDavid Howells #define TC_HTB_PROTOVER 3 /* the same as HTB and TC's major */ 334607ca46eSDavid Howells 335607ca46eSDavid Howells struct tc_htb_opt { 336607ca46eSDavid Howells struct tc_ratespec rate; 337607ca46eSDavid Howells struct tc_ratespec ceil; 338607ca46eSDavid Howells __u32 buffer; 339607ca46eSDavid Howells __u32 cbuffer; 340607ca46eSDavid Howells __u32 quantum; 341607ca46eSDavid Howells __u32 level; /* out only */ 342607ca46eSDavid Howells __u32 prio; 343607ca46eSDavid Howells }; 344607ca46eSDavid Howells struct tc_htb_glob { 345607ca46eSDavid Howells __u32 version; /* to match HTB/TC */ 346607ca46eSDavid Howells __u32 rate2quantum; /* bps->quantum divisor */ 347607ca46eSDavid Howells __u32 defcls; /* default class number */ 348607ca46eSDavid Howells __u32 debug; /* debug flags */ 349607ca46eSDavid Howells 350607ca46eSDavid Howells /* stats */ 351607ca46eSDavid Howells __u32 direct_pkts; /* count of non shaped packets */ 352607ca46eSDavid Howells }; 353607ca46eSDavid Howells enum { 354607ca46eSDavid Howells TCA_HTB_UNSPEC, 355607ca46eSDavid Howells TCA_HTB_PARMS, 356607ca46eSDavid Howells TCA_HTB_INIT, 357607ca46eSDavid Howells TCA_HTB_CTAB, 358607ca46eSDavid Howells TCA_HTB_RTAB, 3596906f4edSEric Dumazet TCA_HTB_DIRECT_QLEN, 360*df62cdf3SEric Dumazet TCA_HTB_RATE64, 361*df62cdf3SEric Dumazet TCA_HTB_CEIL64, 362607ca46eSDavid Howells __TCA_HTB_MAX, 363607ca46eSDavid Howells }; 364607ca46eSDavid Howells 365607ca46eSDavid Howells #define TCA_HTB_MAX (__TCA_HTB_MAX - 1) 366607ca46eSDavid Howells 367607ca46eSDavid Howells struct tc_htb_xstats { 368607ca46eSDavid Howells __u32 lends; 369607ca46eSDavid Howells __u32 borrows; 370607ca46eSDavid Howells __u32 giants; /* too big packets (rate will not be accurate) */ 371607ca46eSDavid Howells __u32 tokens; 372607ca46eSDavid Howells __u32 ctokens; 373607ca46eSDavid Howells }; 374607ca46eSDavid Howells 375607ca46eSDavid Howells /* HFSC section */ 376607ca46eSDavid Howells 377607ca46eSDavid Howells struct tc_hfsc_qopt { 378607ca46eSDavid Howells __u16 defcls; /* default class */ 379607ca46eSDavid Howells }; 380607ca46eSDavid Howells 381607ca46eSDavid Howells struct tc_service_curve { 382607ca46eSDavid Howells __u32 m1; /* slope of the first segment in bps */ 383607ca46eSDavid Howells __u32 d; /* x-projection of the first segment in us */ 384607ca46eSDavid Howells __u32 m2; /* slope of the second segment in bps */ 385607ca46eSDavid Howells }; 386607ca46eSDavid Howells 387607ca46eSDavid Howells struct tc_hfsc_stats { 388607ca46eSDavid Howells __u64 work; /* total work done */ 389607ca46eSDavid Howells __u64 rtwork; /* work done by real-time criteria */ 390607ca46eSDavid Howells __u32 period; /* current period */ 391607ca46eSDavid Howells __u32 level; /* class level in hierarchy */ 392607ca46eSDavid Howells }; 393607ca46eSDavid Howells 394607ca46eSDavid Howells enum { 395607ca46eSDavid Howells TCA_HFSC_UNSPEC, 396607ca46eSDavid Howells TCA_HFSC_RSC, 397607ca46eSDavid Howells TCA_HFSC_FSC, 398607ca46eSDavid Howells TCA_HFSC_USC, 399607ca46eSDavid Howells __TCA_HFSC_MAX, 400607ca46eSDavid Howells }; 401607ca46eSDavid Howells 402607ca46eSDavid Howells #define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1) 403607ca46eSDavid Howells 404607ca46eSDavid Howells 405607ca46eSDavid Howells /* CBQ section */ 406607ca46eSDavid Howells 407607ca46eSDavid Howells #define TC_CBQ_MAXPRIO 8 408607ca46eSDavid Howells #define TC_CBQ_MAXLEVEL 8 409607ca46eSDavid Howells #define TC_CBQ_DEF_EWMA 5 410607ca46eSDavid Howells 411607ca46eSDavid Howells struct tc_cbq_lssopt { 412607ca46eSDavid Howells unsigned char change; 413607ca46eSDavid Howells unsigned char flags; 414607ca46eSDavid Howells #define TCF_CBQ_LSS_BOUNDED 1 415607ca46eSDavid Howells #define TCF_CBQ_LSS_ISOLATED 2 416607ca46eSDavid Howells unsigned char ewma_log; 417607ca46eSDavid Howells unsigned char level; 418607ca46eSDavid Howells #define TCF_CBQ_LSS_FLAGS 1 419607ca46eSDavid Howells #define TCF_CBQ_LSS_EWMA 2 420607ca46eSDavid Howells #define TCF_CBQ_LSS_MAXIDLE 4 421607ca46eSDavid Howells #define TCF_CBQ_LSS_MINIDLE 8 422607ca46eSDavid Howells #define TCF_CBQ_LSS_OFFTIME 0x10 423607ca46eSDavid Howells #define TCF_CBQ_LSS_AVPKT 0x20 424607ca46eSDavid Howells __u32 maxidle; 425607ca46eSDavid Howells __u32 minidle; 426607ca46eSDavid Howells __u32 offtime; 427607ca46eSDavid Howells __u32 avpkt; 428607ca46eSDavid Howells }; 429607ca46eSDavid Howells 430607ca46eSDavid Howells struct tc_cbq_wrropt { 431607ca46eSDavid Howells unsigned char flags; 432607ca46eSDavid Howells unsigned char priority; 433607ca46eSDavid Howells unsigned char cpriority; 434607ca46eSDavid Howells unsigned char __reserved; 435607ca46eSDavid Howells __u32 allot; 436607ca46eSDavid Howells __u32 weight; 437607ca46eSDavid Howells }; 438607ca46eSDavid Howells 439607ca46eSDavid Howells struct tc_cbq_ovl { 440607ca46eSDavid Howells unsigned char strategy; 441607ca46eSDavid Howells #define TC_CBQ_OVL_CLASSIC 0 442607ca46eSDavid Howells #define TC_CBQ_OVL_DELAY 1 443607ca46eSDavid Howells #define TC_CBQ_OVL_LOWPRIO 2 444607ca46eSDavid Howells #define TC_CBQ_OVL_DROP 3 445607ca46eSDavid Howells #define TC_CBQ_OVL_RCLASSIC 4 446607ca46eSDavid Howells unsigned char priority2; 447607ca46eSDavid Howells __u16 pad; 448607ca46eSDavid Howells __u32 penalty; 449607ca46eSDavid Howells }; 450607ca46eSDavid Howells 451607ca46eSDavid Howells struct tc_cbq_police { 452607ca46eSDavid Howells unsigned char police; 453607ca46eSDavid Howells unsigned char __res1; 454607ca46eSDavid Howells unsigned short __res2; 455607ca46eSDavid Howells }; 456607ca46eSDavid Howells 457607ca46eSDavid Howells struct tc_cbq_fopt { 458607ca46eSDavid Howells __u32 split; 459607ca46eSDavid Howells __u32 defmap; 460607ca46eSDavid Howells __u32 defchange; 461607ca46eSDavid Howells }; 462607ca46eSDavid Howells 463607ca46eSDavid Howells struct tc_cbq_xstats { 464607ca46eSDavid Howells __u32 borrows; 465607ca46eSDavid Howells __u32 overactions; 466607ca46eSDavid Howells __s32 avgidle; 467607ca46eSDavid Howells __s32 undertime; 468607ca46eSDavid Howells }; 469607ca46eSDavid Howells 470607ca46eSDavid Howells enum { 471607ca46eSDavid Howells TCA_CBQ_UNSPEC, 472607ca46eSDavid Howells TCA_CBQ_LSSOPT, 473607ca46eSDavid Howells TCA_CBQ_WRROPT, 474607ca46eSDavid Howells TCA_CBQ_FOPT, 475607ca46eSDavid Howells TCA_CBQ_OVL_STRATEGY, 476607ca46eSDavid Howells TCA_CBQ_RATE, 477607ca46eSDavid Howells TCA_CBQ_RTAB, 478607ca46eSDavid Howells TCA_CBQ_POLICE, 479607ca46eSDavid Howells __TCA_CBQ_MAX, 480607ca46eSDavid Howells }; 481607ca46eSDavid Howells 482607ca46eSDavid Howells #define TCA_CBQ_MAX (__TCA_CBQ_MAX - 1) 483607ca46eSDavid Howells 484607ca46eSDavid Howells /* dsmark section */ 485607ca46eSDavid Howells 486607ca46eSDavid Howells enum { 487607ca46eSDavid Howells TCA_DSMARK_UNSPEC, 488607ca46eSDavid Howells TCA_DSMARK_INDICES, 489607ca46eSDavid Howells TCA_DSMARK_DEFAULT_INDEX, 490607ca46eSDavid Howells TCA_DSMARK_SET_TC_INDEX, 491607ca46eSDavid Howells TCA_DSMARK_MASK, 492607ca46eSDavid Howells TCA_DSMARK_VALUE, 493607ca46eSDavid Howells __TCA_DSMARK_MAX, 494607ca46eSDavid Howells }; 495607ca46eSDavid Howells 496607ca46eSDavid Howells #define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1) 497607ca46eSDavid Howells 498607ca46eSDavid Howells /* ATM section */ 499607ca46eSDavid Howells 500607ca46eSDavid Howells enum { 501607ca46eSDavid Howells TCA_ATM_UNSPEC, 502607ca46eSDavid Howells TCA_ATM_FD, /* file/socket descriptor */ 503607ca46eSDavid Howells TCA_ATM_PTR, /* pointer to descriptor - later */ 504607ca46eSDavid Howells TCA_ATM_HDR, /* LL header */ 505607ca46eSDavid Howells TCA_ATM_EXCESS, /* excess traffic class (0 for CLP) */ 506607ca46eSDavid Howells TCA_ATM_ADDR, /* PVC address (for output only) */ 507607ca46eSDavid Howells TCA_ATM_STATE, /* VC state (ATM_VS_*; for output only) */ 508607ca46eSDavid Howells __TCA_ATM_MAX, 509607ca46eSDavid Howells }; 510607ca46eSDavid Howells 511607ca46eSDavid Howells #define TCA_ATM_MAX (__TCA_ATM_MAX - 1) 512607ca46eSDavid Howells 513607ca46eSDavid Howells /* Network emulator */ 514607ca46eSDavid Howells 515607ca46eSDavid Howells enum { 516607ca46eSDavid Howells TCA_NETEM_UNSPEC, 517607ca46eSDavid Howells TCA_NETEM_CORR, 518607ca46eSDavid Howells TCA_NETEM_DELAY_DIST, 519607ca46eSDavid Howells TCA_NETEM_REORDER, 520607ca46eSDavid Howells TCA_NETEM_CORRUPT, 521607ca46eSDavid Howells TCA_NETEM_LOSS, 522607ca46eSDavid Howells TCA_NETEM_RATE, 523607ca46eSDavid Howells TCA_NETEM_ECN, 524607ca46eSDavid Howells __TCA_NETEM_MAX, 525607ca46eSDavid Howells }; 526607ca46eSDavid Howells 527607ca46eSDavid Howells #define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1) 528607ca46eSDavid Howells 529607ca46eSDavid Howells struct tc_netem_qopt { 530607ca46eSDavid Howells __u32 latency; /* added delay (us) */ 531607ca46eSDavid Howells __u32 limit; /* fifo limit (packets) */ 532607ca46eSDavid Howells __u32 loss; /* random packet loss (0=none ~0=100%) */ 533607ca46eSDavid Howells __u32 gap; /* re-ordering gap (0 for none) */ 534607ca46eSDavid Howells __u32 duplicate; /* random packet dup (0=none ~0=100%) */ 535607ca46eSDavid Howells __u32 jitter; /* random jitter in latency (us) */ 536607ca46eSDavid Howells }; 537607ca46eSDavid Howells 538607ca46eSDavid Howells struct tc_netem_corr { 539607ca46eSDavid Howells __u32 delay_corr; /* delay correlation */ 540607ca46eSDavid Howells __u32 loss_corr; /* packet loss correlation */ 541607ca46eSDavid Howells __u32 dup_corr; /* duplicate correlation */ 542607ca46eSDavid Howells }; 543607ca46eSDavid Howells 544607ca46eSDavid Howells struct tc_netem_reorder { 545607ca46eSDavid Howells __u32 probability; 546607ca46eSDavid Howells __u32 correlation; 547607ca46eSDavid Howells }; 548607ca46eSDavid Howells 549607ca46eSDavid Howells struct tc_netem_corrupt { 550607ca46eSDavid Howells __u32 probability; 551607ca46eSDavid Howells __u32 correlation; 552607ca46eSDavid Howells }; 553607ca46eSDavid Howells 554607ca46eSDavid Howells struct tc_netem_rate { 555607ca46eSDavid Howells __u32 rate; /* byte/s */ 556607ca46eSDavid Howells __s32 packet_overhead; 557607ca46eSDavid Howells __u32 cell_size; 558607ca46eSDavid Howells __s32 cell_overhead; 559607ca46eSDavid Howells }; 560607ca46eSDavid Howells 561607ca46eSDavid Howells enum { 562607ca46eSDavid Howells NETEM_LOSS_UNSPEC, 563607ca46eSDavid Howells NETEM_LOSS_GI, /* General Intuitive - 4 state model */ 564607ca46eSDavid Howells NETEM_LOSS_GE, /* Gilbert Elliot models */ 565607ca46eSDavid Howells __NETEM_LOSS_MAX 566607ca46eSDavid Howells }; 567607ca46eSDavid Howells #define NETEM_LOSS_MAX (__NETEM_LOSS_MAX - 1) 568607ca46eSDavid Howells 569607ca46eSDavid Howells /* State transition probabilities for 4 state model */ 570607ca46eSDavid Howells struct tc_netem_gimodel { 571607ca46eSDavid Howells __u32 p13; 572607ca46eSDavid Howells __u32 p31; 573607ca46eSDavid Howells __u32 p32; 574607ca46eSDavid Howells __u32 p14; 575607ca46eSDavid Howells __u32 p23; 576607ca46eSDavid Howells }; 577607ca46eSDavid Howells 578607ca46eSDavid Howells /* Gilbert-Elliot models */ 579607ca46eSDavid Howells struct tc_netem_gemodel { 580607ca46eSDavid Howells __u32 p; 581607ca46eSDavid Howells __u32 r; 582607ca46eSDavid Howells __u32 h; 583607ca46eSDavid Howells __u32 k1; 584607ca46eSDavid Howells }; 585607ca46eSDavid Howells 586607ca46eSDavid Howells #define NETEM_DIST_SCALE 8192 587607ca46eSDavid Howells #define NETEM_DIST_MAX 16384 588607ca46eSDavid Howells 589607ca46eSDavid Howells /* DRR */ 590607ca46eSDavid Howells 591607ca46eSDavid Howells enum { 592607ca46eSDavid Howells TCA_DRR_UNSPEC, 593607ca46eSDavid Howells TCA_DRR_QUANTUM, 594607ca46eSDavid Howells __TCA_DRR_MAX 595607ca46eSDavid Howells }; 596607ca46eSDavid Howells 597607ca46eSDavid Howells #define TCA_DRR_MAX (__TCA_DRR_MAX - 1) 598607ca46eSDavid Howells 599607ca46eSDavid Howells struct tc_drr_stats { 600607ca46eSDavid Howells __u32 deficit; 601607ca46eSDavid Howells }; 602607ca46eSDavid Howells 603607ca46eSDavid Howells /* MQPRIO */ 604607ca46eSDavid Howells #define TC_QOPT_BITMASK 15 605607ca46eSDavid Howells #define TC_QOPT_MAX_QUEUE 16 606607ca46eSDavid Howells 607607ca46eSDavid Howells struct tc_mqprio_qopt { 608607ca46eSDavid Howells __u8 num_tc; 609607ca46eSDavid Howells __u8 prio_tc_map[TC_QOPT_BITMASK + 1]; 610607ca46eSDavid Howells __u8 hw; 611607ca46eSDavid Howells __u16 count[TC_QOPT_MAX_QUEUE]; 612607ca46eSDavid Howells __u16 offset[TC_QOPT_MAX_QUEUE]; 613607ca46eSDavid Howells }; 614607ca46eSDavid Howells 615607ca46eSDavid Howells /* SFB */ 616607ca46eSDavid Howells 617607ca46eSDavid Howells enum { 618607ca46eSDavid Howells TCA_SFB_UNSPEC, 619607ca46eSDavid Howells TCA_SFB_PARMS, 620607ca46eSDavid Howells __TCA_SFB_MAX, 621607ca46eSDavid Howells }; 622607ca46eSDavid Howells 623607ca46eSDavid Howells #define TCA_SFB_MAX (__TCA_SFB_MAX - 1) 624607ca46eSDavid Howells 625607ca46eSDavid Howells /* 626607ca46eSDavid Howells * Note: increment, decrement are Q0.16 fixed-point values. 627607ca46eSDavid Howells */ 628607ca46eSDavid Howells struct tc_sfb_qopt { 629607ca46eSDavid Howells __u32 rehash_interval; /* delay between hash move, in ms */ 630607ca46eSDavid Howells __u32 warmup_time; /* double buffering warmup time in ms (warmup_time < rehash_interval) */ 631607ca46eSDavid Howells __u32 max; /* max len of qlen_min */ 632607ca46eSDavid Howells __u32 bin_size; /* maximum queue length per bin */ 633607ca46eSDavid Howells __u32 increment; /* probability increment, (d1 in Blue) */ 634607ca46eSDavid Howells __u32 decrement; /* probability decrement, (d2 in Blue) */ 635607ca46eSDavid Howells __u32 limit; /* max SFB queue length */ 636607ca46eSDavid Howells __u32 penalty_rate; /* inelastic flows are rate limited to 'rate' pps */ 637607ca46eSDavid Howells __u32 penalty_burst; 638607ca46eSDavid Howells }; 639607ca46eSDavid Howells 640607ca46eSDavid Howells struct tc_sfb_xstats { 641607ca46eSDavid Howells __u32 earlydrop; 642607ca46eSDavid Howells __u32 penaltydrop; 643607ca46eSDavid Howells __u32 bucketdrop; 644607ca46eSDavid Howells __u32 queuedrop; 645607ca46eSDavid Howells __u32 childdrop; /* drops in child qdisc */ 646607ca46eSDavid Howells __u32 marked; 647607ca46eSDavid Howells __u32 maxqlen; 648607ca46eSDavid Howells __u32 maxprob; 649607ca46eSDavid Howells __u32 avgprob; 650607ca46eSDavid Howells }; 651607ca46eSDavid Howells 652607ca46eSDavid Howells #define SFB_MAX_PROB 0xFFFF 653607ca46eSDavid Howells 654607ca46eSDavid Howells /* QFQ */ 655607ca46eSDavid Howells enum { 656607ca46eSDavid Howells TCA_QFQ_UNSPEC, 657607ca46eSDavid Howells TCA_QFQ_WEIGHT, 658607ca46eSDavid Howells TCA_QFQ_LMAX, 659607ca46eSDavid Howells __TCA_QFQ_MAX 660607ca46eSDavid Howells }; 661607ca46eSDavid Howells 662607ca46eSDavid Howells #define TCA_QFQ_MAX (__TCA_QFQ_MAX - 1) 663607ca46eSDavid Howells 664607ca46eSDavid Howells struct tc_qfq_stats { 665607ca46eSDavid Howells __u32 weight; 666607ca46eSDavid Howells __u32 lmax; 667607ca46eSDavid Howells }; 668607ca46eSDavid Howells 669607ca46eSDavid Howells /* CODEL */ 670607ca46eSDavid Howells 671607ca46eSDavid Howells enum { 672607ca46eSDavid Howells TCA_CODEL_UNSPEC, 673607ca46eSDavid Howells TCA_CODEL_TARGET, 674607ca46eSDavid Howells TCA_CODEL_LIMIT, 675607ca46eSDavid Howells TCA_CODEL_INTERVAL, 676607ca46eSDavid Howells TCA_CODEL_ECN, 677607ca46eSDavid Howells __TCA_CODEL_MAX 678607ca46eSDavid Howells }; 679607ca46eSDavid Howells 680607ca46eSDavid Howells #define TCA_CODEL_MAX (__TCA_CODEL_MAX - 1) 681607ca46eSDavid Howells 682607ca46eSDavid Howells struct tc_codel_xstats { 683607ca46eSDavid Howells __u32 maxpacket; /* largest packet we've seen so far */ 684607ca46eSDavid Howells __u32 count; /* how many drops we've done since the last time we 685607ca46eSDavid Howells * entered dropping state 686607ca46eSDavid Howells */ 687607ca46eSDavid Howells __u32 lastcount; /* count at entry to dropping state */ 688607ca46eSDavid Howells __u32 ldelay; /* in-queue delay seen by most recently dequeued packet */ 689607ca46eSDavid Howells __s32 drop_next; /* time to drop next packet */ 690607ca46eSDavid Howells __u32 drop_overlimit; /* number of time max qdisc packet limit was hit */ 691607ca46eSDavid Howells __u32 ecn_mark; /* number of packets we ECN marked instead of dropped */ 692607ca46eSDavid Howells __u32 dropping; /* are we in dropping state ? */ 693607ca46eSDavid Howells }; 694607ca46eSDavid Howells 695607ca46eSDavid Howells /* FQ_CODEL */ 696607ca46eSDavid Howells 697607ca46eSDavid Howells enum { 698607ca46eSDavid Howells TCA_FQ_CODEL_UNSPEC, 699607ca46eSDavid Howells TCA_FQ_CODEL_TARGET, 700607ca46eSDavid Howells TCA_FQ_CODEL_LIMIT, 701607ca46eSDavid Howells TCA_FQ_CODEL_INTERVAL, 702607ca46eSDavid Howells TCA_FQ_CODEL_ECN, 703607ca46eSDavid Howells TCA_FQ_CODEL_FLOWS, 704607ca46eSDavid Howells TCA_FQ_CODEL_QUANTUM, 705607ca46eSDavid Howells __TCA_FQ_CODEL_MAX 706607ca46eSDavid Howells }; 707607ca46eSDavid Howells 708607ca46eSDavid Howells #define TCA_FQ_CODEL_MAX (__TCA_FQ_CODEL_MAX - 1) 709607ca46eSDavid Howells 710607ca46eSDavid Howells enum { 711607ca46eSDavid Howells TCA_FQ_CODEL_XSTATS_QDISC, 712607ca46eSDavid Howells TCA_FQ_CODEL_XSTATS_CLASS, 713607ca46eSDavid Howells }; 714607ca46eSDavid Howells 715607ca46eSDavid Howells struct tc_fq_codel_qd_stats { 716607ca46eSDavid Howells __u32 maxpacket; /* largest packet we've seen so far */ 717607ca46eSDavid Howells __u32 drop_overlimit; /* number of time max qdisc 718607ca46eSDavid Howells * packet limit was hit 719607ca46eSDavid Howells */ 720607ca46eSDavid Howells __u32 ecn_mark; /* number of packets we ECN marked 721607ca46eSDavid Howells * instead of being dropped 722607ca46eSDavid Howells */ 723607ca46eSDavid Howells __u32 new_flow_count; /* number of time packets 724607ca46eSDavid Howells * created a 'new flow' 725607ca46eSDavid Howells */ 726607ca46eSDavid Howells __u32 new_flows_len; /* count of flows in new list */ 727607ca46eSDavid Howells __u32 old_flows_len; /* count of flows in old list */ 728607ca46eSDavid Howells }; 729607ca46eSDavid Howells 730607ca46eSDavid Howells struct tc_fq_codel_cl_stats { 731607ca46eSDavid Howells __s32 deficit; 732607ca46eSDavid Howells __u32 ldelay; /* in-queue delay seen by most recently 733607ca46eSDavid Howells * dequeued packet 734607ca46eSDavid Howells */ 735607ca46eSDavid Howells __u32 count; 736607ca46eSDavid Howells __u32 lastcount; 737607ca46eSDavid Howells __u32 dropping; 738607ca46eSDavid Howells __s32 drop_next; 739607ca46eSDavid Howells }; 740607ca46eSDavid Howells 741607ca46eSDavid Howells struct tc_fq_codel_xstats { 742607ca46eSDavid Howells __u32 type; 743607ca46eSDavid Howells union { 744607ca46eSDavid Howells struct tc_fq_codel_qd_stats qdisc_stats; 745607ca46eSDavid Howells struct tc_fq_codel_cl_stats class_stats; 746607ca46eSDavid Howells }; 747607ca46eSDavid Howells }; 748607ca46eSDavid Howells 749afe4fd06SEric Dumazet /* FQ */ 750afe4fd06SEric Dumazet 751afe4fd06SEric Dumazet enum { 752afe4fd06SEric Dumazet TCA_FQ_UNSPEC, 753afe4fd06SEric Dumazet 754afe4fd06SEric Dumazet TCA_FQ_PLIMIT, /* limit of total number of packets in queue */ 755afe4fd06SEric Dumazet 756afe4fd06SEric Dumazet TCA_FQ_FLOW_PLIMIT, /* limit of packets per flow */ 757afe4fd06SEric Dumazet 758afe4fd06SEric Dumazet TCA_FQ_QUANTUM, /* RR quantum */ 759afe4fd06SEric Dumazet 760afe4fd06SEric Dumazet TCA_FQ_INITIAL_QUANTUM, /* RR quantum for new flow */ 761afe4fd06SEric Dumazet 762afe4fd06SEric Dumazet TCA_FQ_RATE_ENABLE, /* enable/disable rate limiting */ 763afe4fd06SEric Dumazet 764afe4fd06SEric Dumazet TCA_FQ_FLOW_DEFAULT_RATE,/* for sockets with unspecified sk_rate, 765afe4fd06SEric Dumazet * use the following rate 766afe4fd06SEric Dumazet */ 767afe4fd06SEric Dumazet 768afe4fd06SEric Dumazet TCA_FQ_FLOW_MAX_RATE, /* per flow max rate */ 769afe4fd06SEric Dumazet 770afe4fd06SEric Dumazet TCA_FQ_BUCKETS_LOG, /* log2(number of buckets) */ 771afe4fd06SEric Dumazet __TCA_FQ_MAX 772afe4fd06SEric Dumazet }; 773afe4fd06SEric Dumazet 774afe4fd06SEric Dumazet #define TCA_FQ_MAX (__TCA_FQ_MAX - 1) 775afe4fd06SEric Dumazet 776afe4fd06SEric Dumazet struct tc_fq_qd_stats { 777afe4fd06SEric Dumazet __u64 gc_flows; 778afe4fd06SEric Dumazet __u64 highprio_packets; 779afe4fd06SEric Dumazet __u64 tcp_retrans; 780afe4fd06SEric Dumazet __u64 throttled; 781afe4fd06SEric Dumazet __u64 flows_plimit; 782afe4fd06SEric Dumazet __u64 pkts_too_long; 783afe4fd06SEric Dumazet __u64 allocation_errors; 784afe4fd06SEric Dumazet __s64 time_next_delayed_flow; 785afe4fd06SEric Dumazet __u32 flows; 786afe4fd06SEric Dumazet __u32 inactive_flows; 787afe4fd06SEric Dumazet __u32 throttled_flows; 788afe4fd06SEric Dumazet __u32 pad; 789afe4fd06SEric Dumazet }; 790607ca46eSDavid Howells #endif 791