aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2005-11-05 15:14:10 -0500
committerThomas Graf <tgr@axs.localdomain>2005-11-05 16:02:25 -0500
commitd6fd4e9667bf5e00b92e62f02d75bd6c97a7007a (patch)
treeecb80a2d441ca589ca9672807d1cd2ad0fb03e8b /net
parentdea3f62852f98670b72ad355c67bd55c9af58530 (diff)
[PKT_SCHED]: GRED: Transform grio to GRED_RIO_MODE
Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net')
-rw-r--r--net/sched/sch_gred.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index 4ced47bf6089..db594b46a52f 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -93,6 +93,7 @@ struct gred_sched_data
93 93
94enum { 94enum {
95 GRED_WRED_MODE = 1, 95 GRED_WRED_MODE = 1,
96 GRED_RIO_MODE,
96}; 97};
97 98
98struct gred_sched 99struct gred_sched
@@ -102,7 +103,6 @@ struct gred_sched
102 u32 DPs; 103 u32 DPs;
103 u32 def; 104 u32 def;
104 u8 initd; 105 u8 initd;
105 u8 grio;
106}; 106};
107 107
108static inline int gred_wred_mode(struct gred_sched *table) 108static inline int gred_wred_mode(struct gred_sched *table)
@@ -120,6 +120,21 @@ static inline void gred_disable_wred_mode(struct gred_sched *table)
120 __clear_bit(GRED_WRED_MODE, &table->flags); 120 __clear_bit(GRED_WRED_MODE, &table->flags);
121} 121}
122 122
123static inline int gred_rio_mode(struct gred_sched *table)
124{
125 return test_bit(GRED_RIO_MODE, &table->flags);
126}
127
128static inline void gred_enable_rio_mode(struct gred_sched *table)
129{
130 __set_bit(GRED_RIO_MODE, &table->flags);
131}
132
133static inline void gred_disable_rio_mode(struct gred_sched *table)
134{
135 __clear_bit(GRED_RIO_MODE, &table->flags);
136}
137
123static inline int gred_wred_mode_check(struct Qdisc *sch) 138static inline int gred_wred_mode_check(struct Qdisc *sch)
124{ 139{
125 struct gred_sched *table = qdisc_priv(sch); 140 struct gred_sched *table = qdisc_priv(sch);
@@ -173,7 +188,7 @@ gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
173 "general backlog %d\n",skb->tc_index&0xf,sch->handle,q->backlog, 188 "general backlog %d\n",skb->tc_index&0xf,sch->handle,q->backlog,
174 sch->qstats.backlog); 189 sch->qstats.backlog);
175 /* sum up all the qaves of prios <= to ours to get the new qave*/ 190 /* sum up all the qaves of prios <= to ours to get the new qave*/
176 if (!gred_wred_mode(t) && t->grio) { 191 if (!gred_wred_mode(t) && gred_rio_mode(t)) {
177 for (i=0;i<t->DPs;i++) { 192 for (i=0;i<t->DPs;i++) {
178 if ((!t->tab[i]) || (i==q->DP)) 193 if ((!t->tab[i]) || (i==q->DP))
179 continue; 194 continue;
@@ -386,12 +401,12 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
386 table->def=sopt->def_DP; 401 table->def=sopt->def_DP;
387 402
388 if (sopt->grio) { 403 if (sopt->grio) {
389 table->grio = 1; 404 gred_enable_rio_mode(table);
390 gred_disable_wred_mode(table); 405 gred_disable_wred_mode(table);
391 if (gred_wred_mode_check(sch)) 406 if (gred_wred_mode_check(sch))
392 gred_enable_wred_mode(table); 407 gred_enable_wred_mode(table);
393 } else { 408 } else {
394 table->grio = 0; 409 gred_disable_rio_mode(table);
395 gred_disable_wred_mode(table); 410 gred_disable_wred_mode(table);
396 } 411 }
397 412
@@ -423,7 +438,7 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
423 } 438 }
424 q= table->tab[ctl->DP]; 439 q= table->tab[ctl->DP];
425 440
426 if (table->grio) { 441 if (gred_rio_mode(table)) {
427 if (ctl->prio <=0) { 442 if (ctl->prio <=0) {
428 if (table->def && table->tab[table->def]) { 443 if (table->def && table->tab[table->def]) {
429 DPRINTK("\nGRED: DP %u does not have a prio" 444 DPRINTK("\nGRED: DP %u does not have a prio"
@@ -463,7 +478,7 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
463 PSCHED_SET_PASTPERFECT(q->qidlestart); 478 PSCHED_SET_PASTPERFECT(q->qidlestart);
464 memcpy(q->Stab, RTA_DATA(tb[TCA_GRED_STAB-1]), 256); 479 memcpy(q->Stab, RTA_DATA(tb[TCA_GRED_STAB-1]), 256);
465 480
466 if (table->grio) { 481 if (gred_rio_mode(table)) {
467 gred_disable_wred_mode(table); 482 gred_disable_wred_mode(table);
468 if (gred_wred_mode_check(sch)) 483 if (gred_wred_mode_check(sch))
469 gred_enable_wred_mode(table); 484 gred_enable_wred_mode(table);
@@ -496,7 +511,7 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
496 q->qth_min = ctl->qth_min<<ctl->Wlog; 511 q->qth_min = ctl->qth_min<<ctl->Wlog;
497 q->qth_max = ctl->qth_max<<ctl->Wlog; 512 q->qth_max = ctl->qth_max<<ctl->Wlog;
498 513
499 if (table->grio) 514 if (gred_rio_mode(table))
500 q->prio=table->tab[ctl->DP]->prio; 515 q->prio=table->tab[ctl->DP]->prio;
501 else 516 else
502 q->prio=8; 517 q->prio=8;
@@ -528,7 +543,12 @@ static int gred_init(struct Qdisc *sch, struct rtattr *opt)
528 sopt = RTA_DATA(tb2[TCA_GRED_DPS-1]); 543 sopt = RTA_DATA(tb2[TCA_GRED_DPS-1]);
529 table->DPs=sopt->DPs; 544 table->DPs=sopt->DPs;
530 table->def=sopt->def_DP; 545 table->def=sopt->def_DP;
531 table->grio=sopt->grio; 546
547 if (sopt->grio)
548 gred_enable_rio_mode(table);
549 else
550 gred_disable_rio_mode(table);
551
532 table->initd=0; 552 table->initd=0;
533 return 0; 553 return 0;
534 } 554 }