source: svn/trunk/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/pkt_sched.h

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 9.7 KB
Line 
1#ifndef __LINUX_PKT_SCHED_H
2#define __LINUX_PKT_SCHED_H
3
4#include <asm/types.h>
5
6
7/* Logical priority bands not depending on specific packet scheduler.
8   Every scheduler will map them to real traffic classes, if it has
9   no more precise mechanism to classify packets.
10
11   These numbers have no special meaning, though their coincidence
12   with obsolete IPv6 values is not occasional :-). New IPv6 drafts
13   preferred full anarchy inspired by diffserv group.
14
15   Note: TC_PRIO_BESTEFFORT does not mean that it is the most unhappy
16   class, actually, as rule it will be handled with more care than
17   filler or even bulk.
18 */
19
20#define TC_PRIO_BESTEFFORT              0
21#define TC_PRIO_FILLER                  1
22#define TC_PRIO_BULK                    2
23#define TC_PRIO_INTERACTIVE_BULK        4
24#define TC_PRIO_INTERACTIVE             6
25#define TC_PRIO_CONTROL                 7
26
27#define TC_PRIO_MAX                     15
28
29/* Generic queue statistics, available for all the elements.
30   Particular schedulers may have also their private records.
31 */
32
33struct tc_stats
34{
35        __u64   bytes;                  /* NUmber of enqueues bytes */
36        __u32   packets;                /* Number of enqueued packets   */
37        __u32   drops;                  /* Packets dropped because of lack of resources */
38        __u32   overlimits;             /* Number of throttle events when this
39                                         * flow goes out of allocated bandwidth */
40        __u32   bps;                    /* Current flow byte rate */
41        __u32   pps;                    /* Current flow packet rate */
42        __u32   qlen;
43        __u32   backlog;
44};
45
46struct tc_estimator
47{
48        signed char     interval;
49        unsigned char   ewma_log;
50};
51
52/* "Handles"
53   ---------
54
55    All the traffic control objects have 32bit identifiers, or "handles".
56
57    They can be considered as opaque numbers from user API viewpoint,
58    but actually they always consist of two fields: major and
59    minor numbers, which are interpreted by kernel specially,
60    that may be used by applications, though not recommended.
61
62    F.e. qdisc handles always have minor number equal to zero,
63    classes (or flows) have major equal to parent qdisc major, and
64    minor uniquely identifying class inside qdisc.
65
66    Macros to manipulate handles:
67 */
68
69#define TC_H_MAJ_MASK (0xFFFF0000U)
70#define TC_H_MIN_MASK (0x0000FFFFU)
71#define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK)
72#define TC_H_MIN(h) ((h)&TC_H_MIN_MASK)
73#define TC_H_MAKE(maj,min) (((maj)&TC_H_MAJ_MASK)|((min)&TC_H_MIN_MASK))
74
75#define TC_H_UNSPEC     (0U)
76#define TC_H_ROOT       (0xFFFFFFFFU)
77#define TC_H_INGRESS    (0xFFFFFFF1U)
78
79struct tc_ratespec
80{
81        unsigned char   cell_log;
82        unsigned char   __reserved;
83        unsigned short  feature;
84        short           addend;
85        unsigned short  mpu;
86        __u32           rate;
87};
88
89/* FIFO section */
90
91struct tc_fifo_qopt
92{
93        __u32   limit;  /* Queue length: bytes for bfifo, packets for pfifo */
94};
95
96/* PRIO section */
97
98#define TCQ_PRIO_BANDS  16
99
100struct tc_prio_qopt
101{
102        int     bands;                  /* Number of bands */
103        __u8    priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */
104};
105
106/* TBF section */
107
108struct tc_tbf_qopt
109{
110        struct tc_ratespec rate;
111        struct tc_ratespec peakrate;
112        __u32           limit;
113        __u32           buffer;
114        __u32           mtu;
115};
116
117enum
118{
119        TCA_TBF_UNSPEC,
120        TCA_TBF_PARMS,
121        TCA_TBF_RTAB,
122        TCA_TBF_PTAB,
123        __TCA_TBF_MAX,
124};
125
126#define TCA_TBF_MAX (__TCA_TBF_MAX - 1)
127
128
129/* TEQL section */
130
131/* TEQL does not require any parameters */
132
133/* SFQ section */
134
135struct tc_sfq_qopt
136{
137        unsigned        quantum;        /* Bytes per round allocated to flow */
138        int             perturb_period; /* Period of hash perturbation */
139        __u32           limit;          /* Maximal packets in queue */
140        unsigned        divisor;        /* Hash divisor  */
141        unsigned        flows;          /* Maximal number of flows  */
142};
143
144/*
145 *  NOTE: limit, divisor and flows are hardwired to code at the moment.
146 *
147 *      limit=flows=128, divisor=1024;
148 *
149 *      The only reason for this is efficiency, it is possible
150 *      to change these parameters in compile time.
151 */
152
153/* RED section */
154
155enum
156{
157        TCA_RED_UNSPEC,
158        TCA_RED_PARMS,
159        TCA_RED_STAB,
160        __TCA_RED_MAX,
161};
162
163#define TCA_RED_MAX (__TCA_RED_MAX - 1)
164
165struct tc_red_qopt
166{
167        __u32           limit;          /* HARD maximal queue length (bytes)    */
168        __u32           qth_min;        /* Min average length threshold (bytes) */
169        __u32           qth_max;        /* Max average length threshold (bytes) */
170        unsigned char   Wlog;           /* log(W)               */
171        unsigned char   Plog;           /* log(P_max/(qth_max-qth_min)) */
172        unsigned char   Scell_log;      /* cell size for idle damping */
173        unsigned char   flags;
174#define TC_RED_ECN      1
175};
176
177struct tc_red_xstats
178{
179        __u32           early;          /* Early drops */
180        __u32           pdrop;          /* Drops due to queue limits */
181        __u32           other;          /* Drops due to drop() calls */
182        __u32           marked;         /* Marked packets */
183};
184
185/* GRED section */
186
187#define MAX_DPs 16
188
189enum
190{
191       TCA_GRED_UNSPEC,
192       TCA_GRED_PARMS,
193       TCA_GRED_STAB,
194       TCA_GRED_DPS,
195           __TCA_GRED_MAX,
196};
197
198#define TCA_GRED_MAX (__TCA_GRED_MAX - 1)
199
200#define TCA_SET_OFF TCA_GRED_PARMS
201struct tc_gred_qopt
202{
203       __u32           limit;          /* HARD maximal queue length (bytes)   
204*/
205       __u32           qth_min;        /* Min average length threshold (bytes)
206*/
207       __u32           qth_max;        /* Max average length threshold (bytes)
208*/
209       __u32           DP;             /* upto 2^32 DPs */
210       __u32           backlog;       
211       __u32           qave;   
212       __u32           forced; 
213       __u32           early; 
214       __u32           other; 
215       __u32           pdrop; 
216
217       unsigned char   Wlog;           /* log(W)               */
218       unsigned char   Plog;           /* log(P_max/(qth_max-qth_min)) */
219       unsigned char   Scell_log;      /* cell size for idle damping */
220       __u8            prio;            /* prio of this VQ */
221       __u32    packets;
222       __u32    bytesin;
223};
224/* gred setup */
225struct tc_gred_sopt
226{
227       __u32           DPs;
228       __u32           def_DP;
229       __u8            grio;
230};
231
232/* HTB section */
233#define TC_HTB_NUMPRIO          8
234#define TC_HTB_MAXDEPTH         8
235#define TC_HTB_PROTOVER         3 /* the same as HTB and TC's major */
236
237struct tc_htb_opt
238{
239        struct tc_ratespec      rate;
240        struct tc_ratespec      ceil;
241        __u32   buffer;
242        __u32   cbuffer;
243        __u32   quantum;
244        __u32   level;          /* out only */
245        __u32   prio;
246};
247struct tc_htb_glob
248{
249        __u32 version;          /* to match HTB/TC */
250        __u32 rate2quantum;     /* bps->quantum divisor */
251        __u32 defcls;           /* default class number */
252        __u32 debug;            /* debug flags */
253
254        /* stats */
255        __u32 direct_pkts; /* count of non shapped packets */
256};
257enum
258{
259        TCA_HTB_UNSPEC,
260        TCA_HTB_PARMS,
261        TCA_HTB_INIT,
262        TCA_HTB_CTAB,
263        TCA_HTB_RTAB,
264        __TCA_HTB_MAX,
265};
266
267#define TCA_HTB_MAX (__TCA_HTB_MAX - 1)
268
269struct tc_htb_xstats
270{
271        __u32 lends;
272        __u32 borrows;
273        __u32 giants;   /* too big packets (rate will not be accurate) */
274        __u32 tokens;
275        __u32 ctokens;
276};
277
278/* HFSC section */
279
280struct tc_hfsc_qopt
281{
282        __u16   defcls;         /* default class */
283};
284
285struct tc_service_curve
286{
287        __u32   m1;             /* slope of the first segment in bps */
288        __u32   d;              /* x-projection of the first segment in us */
289        __u32   m2;             /* slope of the second segment in bps */
290};
291
292struct tc_hfsc_stats
293{
294        __u64   work;           /* total work done */
295        __u64   rtwork;         /* work done by real-time criteria */
296        __u32   period;         /* current period */
297        __u32   level;          /* class level in hierarchy */
298};
299
300enum
301{
302        TCA_HFSC_UNSPEC,
303        TCA_HFSC_RSC,
304        TCA_HFSC_FSC,
305        TCA_HFSC_USC,
306        __TCA_HFSC_MAX,
307};
308
309#define TCA_HFSC_MAX (__TCA_HFSC_MAX - 1)
310
311
312/* CBQ section */
313
314#define TC_CBQ_MAXPRIO          8
315#define TC_CBQ_MAXLEVEL         8
316#define TC_CBQ_DEF_EWMA         5
317
318struct tc_cbq_lssopt
319{
320        unsigned char   change;
321        unsigned char   flags;
322#define TCF_CBQ_LSS_BOUNDED     1
323#define TCF_CBQ_LSS_ISOLATED    2
324        unsigned char   ewma_log;
325        unsigned char   level;
326#define TCF_CBQ_LSS_FLAGS       1
327#define TCF_CBQ_LSS_EWMA        2
328#define TCF_CBQ_LSS_MAXIDLE     4
329#define TCF_CBQ_LSS_MINIDLE     8
330#define TCF_CBQ_LSS_OFFTIME     0x10
331#define TCF_CBQ_LSS_AVPKT       0x20
332        __u32           maxidle;
333        __u32           minidle;
334        __u32           offtime;
335        __u32           avpkt;
336};
337
338struct tc_cbq_wrropt
339{
340        unsigned char   flags;
341        unsigned char   priority;
342        unsigned char   cpriority;
343        unsigned char   __reserved;
344        __u32           allot;
345        __u32           weight;
346};
347
348struct tc_cbq_ovl
349{
350        unsigned char   strategy;
351#define TC_CBQ_OVL_CLASSIC      0
352#define TC_CBQ_OVL_DELAY        1
353#define TC_CBQ_OVL_LOWPRIO      2
354#define TC_CBQ_OVL_DROP         3
355#define TC_CBQ_OVL_RCLASSIC     4
356        unsigned char   priority2;
357        __u32           penalty;
358};
359
360struct tc_cbq_police
361{
362        unsigned char   police;
363        unsigned char   __res1;
364        unsigned short  __res2;
365};
366
367struct tc_cbq_fopt
368{
369        __u32           split;
370        __u32           defmap;
371        __u32           defchange;
372};
373
374struct tc_cbq_xstats
375{
376        __u32           borrows;
377        __u32           overactions;
378        __s32           avgidle;
379        __s32           undertime;
380};
381
382enum
383{
384        TCA_CBQ_UNSPEC,
385        TCA_CBQ_LSSOPT,
386        TCA_CBQ_WRROPT,
387        TCA_CBQ_FOPT,
388        TCA_CBQ_OVL_STRATEGY,
389        TCA_CBQ_RATE,
390        TCA_CBQ_RTAB,
391        TCA_CBQ_POLICE,
392        __TCA_CBQ_MAX,
393};
394
395#define TCA_CBQ_MAX     (__TCA_CBQ_MAX - 1)
396
397/* dsmark section */
398
399enum {
400        TCA_DSMARK_UNSPEC,
401        TCA_DSMARK_INDICES,
402        TCA_DSMARK_DEFAULT_INDEX,
403        TCA_DSMARK_SET_TC_INDEX,
404        TCA_DSMARK_MASK,
405        TCA_DSMARK_VALUE,
406        __TCA_DSMARK_MAX,
407};
408
409#define TCA_DSMARK_MAX (__TCA_DSMARK_MAX - 1)
410
411/* ATM  section */
412
413enum {
414        TCA_ATM_UNSPEC,
415        TCA_ATM_FD,             /* file/socket descriptor */
416        TCA_ATM_PTR,            /* pointer to descriptor - later */
417        TCA_ATM_HDR,            /* LL header */
418        TCA_ATM_EXCESS,         /* excess traffic class (0 for CLP)  */
419        TCA_ATM_ADDR,           /* PVC address (for output only) */
420        TCA_ATM_STATE,          /* VC state (ATM_VS_*; for output only) */
421        __TCA_ATM_MAX,
422};
423
424#define TCA_ATM_MAX     (__TCA_ATM_MAX - 1)
425
426/* Network emulator */
427
428enum
429{
430        TCA_NETEM_UNSPEC,
431        TCA_NETEM_CORR,
432        TCA_NETEM_DELAY_DIST,
433        TCA_NETEM_REORDER,
434        __TCA_NETEM_MAX,
435};
436
437#define TCA_NETEM_MAX (__TCA_NETEM_MAX - 1)
438
439struct tc_netem_qopt
440{
441        __u32   latency;        /* added delay (us) */
442        __u32   limit;          /* fifo limit (packets) */
443        __u32   loss;           /* random packet loss (0=none ~0=100%) */
444        __u32   gap;            /* re-ordering gap (0 for none) */
445        __u32   duplicate;      /* random packet dup  (0=none ~0=100%) */
446        __u32   jitter;         /* random jitter in latency (us) */
447};
448
449struct tc_netem_corr
450{
451        __u32   delay_corr;     /* delay correlation */
452        __u32   loss_corr;      /* packet loss correlation */
453        __u32   dup_corr;       /* duplicate correlation  */
454};
455
456struct tc_netem_reorder
457{
458        __u32   probability;
459        __u32   correlation;
460};
461
462#define NETEM_DIST_SCALE        8192
463
464#endif
Note: See TracBrowser for help on using the repository browser.