Skip to content

Commit c3498d3

Browse files
Florian Westphaldavem330
authored andcommitted
cbq: remove TCA_CBQ_OVL_STRATEGY support
since initial revision of cbq in 2004 iproute 2 has never implemented support for TCA_CBQ_OVL_STRATEGY, which is what needs to be set to activate the class->drop() call (TC_CBQ_OVL_DROP strategy must be set by userspace value must be set by userspace). David Miller says: It seems really safe to kill this thing off, flag an error if someone tries to set the attribute, and therefore kill off all of the non-default cbq_ovl_*() functions. A followup commit can then remove all .drop qdisc methods since this removed the only caller. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 76e48f9 commit c3498d3

File tree

1 file changed

+6
-160
lines changed

1 file changed

+6
-160
lines changed

net/sched/sch_cbq.c

Lines changed: 6 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ struct cbq_class {
8080
unsigned char priority; /* class priority */
8181
unsigned char priority2; /* priority to be used after overlimit */
8282
unsigned char ewma_log; /* time constant for idle time calculation */
83-
unsigned char ovl_strategy;
8483
#ifdef CONFIG_NET_CLS_ACT
8584
unsigned char police;
8685
#endif
@@ -94,10 +93,6 @@ struct cbq_class {
9493
u32 avpkt;
9594
struct qdisc_rate_table *R_tab;
9695

97-
/* Overlimit strategy parameters */
98-
void (*overlimit)(struct cbq_class *cl);
99-
psched_tdiff_t penalty;
100-
10196
/* General scheduler (WRR) parameters */
10297
long allot;
10398
long quantum; /* Allotment per WRR round */
@@ -402,11 +397,8 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
402397
return ret;
403398
}
404399

405-
/* Overlimit actions */
406-
407-
/* TC_CBQ_OVL_CLASSIC: (default) penalize leaf class by adding offtime */
408-
409-
static void cbq_ovl_classic(struct cbq_class *cl)
400+
/* Overlimit action: penalize leaf class by adding offtime */
401+
static void cbq_overlimit(struct cbq_class *cl)
410402
{
411403
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
412404
psched_tdiff_t delay = cl->undertime - q->now;
@@ -456,99 +448,6 @@ static void cbq_ovl_classic(struct cbq_class *cl)
456448
}
457449
}
458450

459-
/* TC_CBQ_OVL_RCLASSIC: penalize by offtime classes in hierarchy, when
460-
* they go overlimit
461-
*/
462-
463-
static void cbq_ovl_rclassic(struct cbq_class *cl)
464-
{
465-
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
466-
struct cbq_class *this = cl;
467-
468-
do {
469-
if (cl->level > q->toplevel) {
470-
cl = NULL;
471-
break;
472-
}
473-
} while ((cl = cl->borrow) != NULL);
474-
475-
if (cl == NULL)
476-
cl = this;
477-
cbq_ovl_classic(cl);
478-
}
479-
480-
/* TC_CBQ_OVL_DELAY: delay until it will go to underlimit */
481-
482-
static void cbq_ovl_delay(struct cbq_class *cl)
483-
{
484-
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
485-
psched_tdiff_t delay = cl->undertime - q->now;
486-
487-
if (test_bit(__QDISC_STATE_DEACTIVATED,
488-
&qdisc_root_sleeping(cl->qdisc)->state))
489-
return;
490-
491-
if (!cl->delayed) {
492-
psched_time_t sched = q->now;
493-
ktime_t expires;
494-
495-
delay += cl->offtime;
496-
if (cl->avgidle < 0)
497-
delay -= (-cl->avgidle) - ((-cl->avgidle) >> cl->ewma_log);
498-
if (cl->avgidle < cl->minidle)
499-
cl->avgidle = cl->minidle;
500-
cl->undertime = q->now + delay;
501-
502-
if (delay > 0) {
503-
sched += delay + cl->penalty;
504-
cl->penalized = sched;
505-
cl->cpriority = TC_CBQ_MAXPRIO;
506-
q->pmask |= (1<<TC_CBQ_MAXPRIO);
507-
508-
expires = ns_to_ktime(PSCHED_TICKS2NS(sched));
509-
if (hrtimer_try_to_cancel(&q->delay_timer) &&
510-
ktime_to_ns(ktime_sub(
511-
hrtimer_get_expires(&q->delay_timer),
512-
expires)) > 0)
513-
hrtimer_set_expires(&q->delay_timer, expires);
514-
hrtimer_restart(&q->delay_timer);
515-
cl->delayed = 1;
516-
cl->xstats.overactions++;
517-
return;
518-
}
519-
delay = 1;
520-
}
521-
if (q->wd_expires == 0 || q->wd_expires > delay)
522-
q->wd_expires = delay;
523-
}
524-
525-
/* TC_CBQ_OVL_LOWPRIO: penalize class by lowering its priority band */
526-
527-
static void cbq_ovl_lowprio(struct cbq_class *cl)
528-
{
529-
struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
530-
531-
cl->penalized = q->now + cl->penalty;
532-
533-
if (cl->cpriority != cl->priority2) {
534-
cl->cpriority = cl->priority2;
535-
q->pmask |= (1<<cl->cpriority);
536-
cl->xstats.overactions++;
537-
}
538-
cbq_ovl_classic(cl);
539-
}
540-
541-
/* TC_CBQ_OVL_DROP: penalize class by dropping */
542-
543-
static void cbq_ovl_drop(struct cbq_class *cl)
544-
{
545-
if (cl->q->ops->drop)
546-
if (cl->q->ops->drop(cl->q))
547-
cl->qdisc->q.qlen--;
548-
cl->xstats.overactions++;
549-
cbq_ovl_classic(cl);
550-
}
551-
552451
static psched_tdiff_t cbq_undelay_prio(struct cbq_sched_data *q, int prio,
553452
psched_time_t now)
554453
{
@@ -807,7 +706,7 @@ cbq_under_limit(struct cbq_class *cl)
807706
cl = cl->borrow;
808707
if (!cl) {
809708
this_cl->qstats.overlimits++;
810-
this_cl->overlimit(this_cl);
709+
cbq_overlimit(this_cl);
811710
return NULL;
812711
}
813712
if (cl->level > q->toplevel)
@@ -1280,35 +1179,6 @@ static int cbq_set_wrr(struct cbq_class *cl, struct tc_cbq_wrropt *wrr)
12801179
return 0;
12811180
}
12821181

1283-
static int cbq_set_overlimit(struct cbq_class *cl, struct tc_cbq_ovl *ovl)
1284-
{
1285-
switch (ovl->strategy) {
1286-
case TC_CBQ_OVL_CLASSIC:
1287-
cl->overlimit = cbq_ovl_classic;
1288-
break;
1289-
case TC_CBQ_OVL_DELAY:
1290-
cl->overlimit = cbq_ovl_delay;
1291-
break;
1292-
case TC_CBQ_OVL_LOWPRIO:
1293-
if (ovl->priority2 - 1 >= TC_CBQ_MAXPRIO ||
1294-
ovl->priority2 - 1 <= cl->priority)
1295-
return -EINVAL;
1296-
cl->priority2 = ovl->priority2 - 1;
1297-
cl->overlimit = cbq_ovl_lowprio;
1298-
break;
1299-
case TC_CBQ_OVL_DROP:
1300-
cl->overlimit = cbq_ovl_drop;
1301-
break;
1302-
case TC_CBQ_OVL_RCLASSIC:
1303-
cl->overlimit = cbq_ovl_rclassic;
1304-
break;
1305-
default:
1306-
return -EINVAL;
1307-
}
1308-
cl->penalty = ovl->penalty;
1309-
return 0;
1310-
}
1311-
13121182
#ifdef CONFIG_NET_CLS_ACT
13131183
static int cbq_set_police(struct cbq_class *cl, struct tc_cbq_police *p)
13141184
{
@@ -1375,8 +1245,6 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
13751245
q->link.priority = TC_CBQ_MAXPRIO - 1;
13761246
q->link.priority2 = TC_CBQ_MAXPRIO - 1;
13771247
q->link.cpriority = TC_CBQ_MAXPRIO - 1;
1378-
q->link.ovl_strategy = TC_CBQ_OVL_CLASSIC;
1379-
q->link.overlimit = cbq_ovl_classic;
13801248
q->link.allot = psched_mtu(qdisc_dev(sch));
13811249
q->link.quantum = q->link.allot;
13821250
q->link.weight = q->link.R_tab->rate.rate;
@@ -1463,24 +1331,6 @@ static int cbq_dump_wrr(struct sk_buff *skb, struct cbq_class *cl)
14631331
return -1;
14641332
}
14651333

1466-
static int cbq_dump_ovl(struct sk_buff *skb, struct cbq_class *cl)
1467-
{
1468-
unsigned char *b = skb_tail_pointer(skb);
1469-
struct tc_cbq_ovl opt;
1470-
1471-
opt.strategy = cl->ovl_strategy;
1472-
opt.priority2 = cl->priority2 + 1;
1473-
opt.pad = 0;
1474-
opt.penalty = cl->penalty;
1475-
if (nla_put(skb, TCA_CBQ_OVL_STRATEGY, sizeof(opt), &opt))
1476-
goto nla_put_failure;
1477-
return skb->len;
1478-
1479-
nla_put_failure:
1480-
nlmsg_trim(skb, b);
1481-
return -1;
1482-
}
1483-
14841334
static int cbq_dump_fopt(struct sk_buff *skb, struct cbq_class *cl)
14851335
{
14861336
unsigned char *b = skb_tail_pointer(skb);
@@ -1526,7 +1376,6 @@ static int cbq_dump_attr(struct sk_buff *skb, struct cbq_class *cl)
15261376
if (cbq_dump_lss(skb, cl) < 0 ||
15271377
cbq_dump_rate(skb, cl) < 0 ||
15281378
cbq_dump_wrr(skb, cl) < 0 ||
1529-
cbq_dump_ovl(skb, cl) < 0 ||
15301379
#ifdef CONFIG_NET_CLS_ACT
15311380
cbq_dump_police(skb, cl) < 0 ||
15321381
#endif
@@ -1736,6 +1585,9 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
17361585
if (err < 0)
17371586
return err;
17381587

1588+
if (tb[TCA_CBQ_OVL_STRATEGY])
1589+
return -EOPNOTSUPP;
1590+
17391591
if (cl) {
17401592
/* Check parent */
17411593
if (parentid) {
@@ -1784,9 +1636,6 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
17841636
cbq_set_wrr(cl, nla_data(tb[TCA_CBQ_WRROPT]));
17851637
}
17861638

1787-
if (tb[TCA_CBQ_OVL_STRATEGY])
1788-
cbq_set_overlimit(cl, nla_data(tb[TCA_CBQ_OVL_STRATEGY]));
1789-
17901639
#ifdef CONFIG_NET_CLS_ACT
17911640
if (tb[TCA_CBQ_POLICE])
17921641
cbq_set_police(cl, nla_data(tb[TCA_CBQ_POLICE]));
@@ -1887,9 +1736,6 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
18871736
cl->maxidle = q->link.maxidle;
18881737
if (cl->avpkt == 0)
18891738
cl->avpkt = q->link.avpkt;
1890-
cl->overlimit = cbq_ovl_classic;
1891-
if (tb[TCA_CBQ_OVL_STRATEGY])
1892-
cbq_set_overlimit(cl, nla_data(tb[TCA_CBQ_OVL_STRATEGY]));
18931739
#ifdef CONFIG_NET_CLS_ACT
18941740
if (tb[TCA_CBQ_POLICE])
18951741
cbq_set_police(cl, nla_data(tb[TCA_CBQ_POLICE]));

0 commit comments

Comments
 (0)