aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2005-11-05 21:14:10 +0100
committerThomas Graf <tgr@axs.localdomain>2005-11-05 22:02:25 +0100
commitd6fd4e9667bf5e00b92e62f02d75bd6c97a7007a (patch)
treeecb80a2d441ca589ca9672807d1cd2ad0fb03e8b /net/sched
parentdea3f62852f98670b72ad355c67bd55c9af58530 (diff)
downloadkernel_samsung_crespo-d6fd4e9667bf5e00b92e62f02d75bd6c97a7007a.zip
kernel_samsung_crespo-d6fd4e9667bf5e00b92e62f02d75bd6c97a7007a.tar.gz
kernel_samsung_crespo-d6fd4e9667bf5e00b92e62f02d75bd6c97a7007a.tar.bz2
[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/sched')
-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 4ced47b..db594b4 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -93,6 +93,7 @@ struct gred_sched_data
enum {
GRED_WRED_MODE = 1,
+ GRED_RIO_MODE,
};
struct gred_sched
@@ -102,7 +103,6 @@ struct gred_sched
u32 DPs;
u32 def;
u8 initd;
- u8 grio;
};
static inline int gred_wred_mode(struct gred_sched *table)
@@ -120,6 +120,21 @@ static inline void gred_disable_wred_mode(struct gred_sched *table)
__clear_bit(GRED_WRED_MODE, &table->flags);
}
+static inline int gred_rio_mode(struct gred_sched *table)
+{
+ return test_bit(GRED_RIO_MODE, &table->flags);
+}
+
+static inline void gred_enable_rio_mode(struct gred_sched *table)
+{
+ __set_bit(GRED_RIO_MODE, &table->flags);
+}
+
+static inline void gred_disable_rio_mode(struct gred_sched *table)
+{
+ __clear_bit(GRED_RIO_MODE, &table->flags);
+}
+
static inline int gred_wred_mode_check(struct Qdisc *sch)
{
struct gred_sched *table = qdisc_priv(sch);
@@ -173,7 +188,7 @@ gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
"general backlog %d\n",skb->tc_index&0xf,sch->handle,q->backlog,
sch->qstats.backlog);
/* sum up all the qaves of prios <= to ours to get the new qave*/
- if (!gred_wred_mode(t) && t->grio) {
+ if (!gred_wred_mode(t) && gred_rio_mode(t)) {
for (i=0;i<t->DPs;i++) {
if ((!t->tab[i]) || (i==q->DP))
continue;
@@ -386,12 +401,12 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
table->def=sopt->def_DP;
if (sopt->grio) {
- table->grio = 1;
+ gred_enable_rio_mode(table);
gred_disable_wred_mode(table);
if (gred_wred_mode_check(sch))
gred_enable_wred_mode(table);
} else {
- table->grio = 0;
+ gred_disable_rio_mode(table);
gred_disable_wred_mode(table);
}
@@ -423,7 +438,7 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
}
q= table->tab[ctl->DP];
- if (table->grio) {
+ if (gred_rio_mode(table)) {
if (ctl->prio <=0) {
if (table->def && table->tab[table->def]) {
DPRINTK("\nGRED: DP %u does not have a prio"
@@ -463,7 +478,7 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
PSCHED_SET_PASTPERFECT(q->qidlestart);
memcpy(q->Stab, RTA_DATA(tb[TCA_GRED_STAB-1]), 256);
- if (table->grio) {
+ if (gred_rio_mode(table)) {
gred_disable_wred_mode(table);
if (gred_wred_mode_check(sch))
gred_enable_wred_mode(table);
@@ -496,7 +511,7 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
q->qth_min = ctl->qth_min<<ctl->Wlog;
q->qth_max = ctl->qth_max<<ctl->Wlog;
- if (table->grio)
+ if (gred_rio_mode(table))
q->prio=table->tab[ctl->DP]->prio;
else
q->prio=8;
@@ -528,7 +543,12 @@ static int gred_init(struct Qdisc *sch, struct rtattr *opt)
sopt = RTA_DATA(tb2[TCA_GRED_DPS-1]);
table->DPs=sopt->DPs;
table->def=sopt->def_DP;
- table->grio=sopt->grio;
+
+ if (sopt->grio)
+ gred_enable_rio_mode(table);
+ else
+ gred_disable_rio_mode(table);
+
table->initd=0;
return 0;
}