aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_cbq.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_cbq.c')
-rw-r--r--net/sched/sch_cbq.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index b184c3545145..77381f1c6541 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -82,7 +82,7 @@ struct cbq_class
82 unsigned char priority2; /* priority to be used after overlimit */ 82 unsigned char priority2; /* priority to be used after overlimit */
83 unsigned char ewma_log; /* time constant for idle time calculation */ 83 unsigned char ewma_log; /* time constant for idle time calculation */
84 unsigned char ovl_strategy; 84 unsigned char ovl_strategy;
85#ifdef CONFIG_NET_CLS_POLICE 85#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
86 unsigned char police; 86 unsigned char police;
87#endif 87#endif
88 88
@@ -154,7 +154,7 @@ struct cbq_sched_data
154 struct cbq_class *active[TC_CBQ_MAXPRIO+1]; /* List of all classes 154 struct cbq_class *active[TC_CBQ_MAXPRIO+1]; /* List of all classes
155 with backlog */ 155 with backlog */
156 156
157#ifdef CONFIG_NET_CLS_POLICE 157#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
158 struct cbq_class *rx_class; 158 struct cbq_class *rx_class;
159#endif 159#endif
160 struct cbq_class *tx_class; 160 struct cbq_class *tx_class;
@@ -196,7 +196,7 @@ cbq_class_lookup(struct cbq_sched_data *q, u32 classid)
196 return NULL; 196 return NULL;
197} 197}
198 198
199#ifdef CONFIG_NET_CLS_POLICE 199#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
200 200
201static struct cbq_class * 201static struct cbq_class *
202cbq_reclassify(struct sk_buff *skb, struct cbq_class *this) 202cbq_reclassify(struct sk_buff *skb, struct cbq_class *this)
@@ -247,7 +247,8 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
247 /* 247 /*
248 * Step 2+n. Apply classifier. 248 * Step 2+n. Apply classifier.
249 */ 249 */
250 if (!head->filter_list || (result = tc_classify(skb, head->filter_list, &res)) < 0) 250 if (!head->filter_list ||
251 (result = tc_classify_compat(skb, head->filter_list, &res)) < 0)
251 goto fallback; 252 goto fallback;
252 253
253 if ((cl = (void*)res.class) == NULL) { 254 if ((cl = (void*)res.class) == NULL) {
@@ -267,6 +268,8 @@ cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
267 *qerr = NET_XMIT_SUCCESS; 268 *qerr = NET_XMIT_SUCCESS;
268 case TC_ACT_SHOT: 269 case TC_ACT_SHOT:
269 return NULL; 270 return NULL;
271 case TC_ACT_RECLASSIFY:
272 return cbq_reclassify(skb, cl);
270 } 273 }
271#elif defined(CONFIG_NET_CLS_POLICE) 274#elif defined(CONFIG_NET_CLS_POLICE)
272 switch (result) { 275 switch (result) {
@@ -389,7 +392,7 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
389 int ret; 392 int ret;
390 struct cbq_class *cl = cbq_classify(skb, sch, &ret); 393 struct cbq_class *cl = cbq_classify(skb, sch, &ret);
391 394
392#ifdef CONFIG_NET_CLS_POLICE 395#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
393 q->rx_class = cl; 396 q->rx_class = cl;
394#endif 397#endif
395 if (cl == NULL) { 398 if (cl == NULL) {
@@ -399,7 +402,7 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
399 return ret; 402 return ret;
400 } 403 }
401 404
402#ifdef CONFIG_NET_CLS_POLICE 405#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
403 cl->q->__parent = sch; 406 cl->q->__parent = sch;
404#endif 407#endif
405 if ((ret = cl->q->enqueue(skb, cl->q)) == NET_XMIT_SUCCESS) { 408 if ((ret = cl->q->enqueue(skb, cl->q)) == NET_XMIT_SUCCESS) {
@@ -434,7 +437,7 @@ cbq_requeue(struct sk_buff *skb, struct Qdisc *sch)
434 437
435 cbq_mark_toplevel(q, cl); 438 cbq_mark_toplevel(q, cl);
436 439
437#ifdef CONFIG_NET_CLS_POLICE 440#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
438 q->rx_class = cl; 441 q->rx_class = cl;
439 cl->q->__parent = sch; 442 cl->q->__parent = sch;
440#endif 443#endif
@@ -670,7 +673,7 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer)
670} 673}
671 674
672 675
673#ifdef CONFIG_NET_CLS_POLICE 676#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
674 677
675static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child) 678static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child)
676{ 679{
@@ -1364,7 +1367,7 @@ static int cbq_set_overlimit(struct cbq_class *cl, struct tc_cbq_ovl *ovl)
1364 return 0; 1367 return 0;
1365} 1368}
1366 1369
1367#ifdef CONFIG_NET_CLS_POLICE 1370#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
1368static int cbq_set_police(struct cbq_class *cl, struct tc_cbq_police *p) 1371static int cbq_set_police(struct cbq_class *cl, struct tc_cbq_police *p)
1369{ 1372{
1370 cl->police = p->police; 1373 cl->police = p->police;
@@ -1532,7 +1535,7 @@ rtattr_failure:
1532 return -1; 1535 return -1;
1533} 1536}
1534 1537
1535#ifdef CONFIG_NET_CLS_POLICE 1538#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
1536static __inline__ int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl) 1539static __inline__ int cbq_dump_police(struct sk_buff *skb, struct cbq_class *cl)
1537{ 1540{
1538 unsigned char *b = skb_tail_pointer(skb); 1541 unsigned char *b = skb_tail_pointer(skb);
@@ -1558,7 +1561,7 @@ static int cbq_dump_attr(struct sk_buff *skb, struct cbq_class *cl)
1558 cbq_dump_rate(skb, cl) < 0 || 1561 cbq_dump_rate(skb, cl) < 0 ||
1559 cbq_dump_wrr(skb, cl) < 0 || 1562 cbq_dump_wrr(skb, cl) < 0 ||
1560 cbq_dump_ovl(skb, cl) < 0 || 1563 cbq_dump_ovl(skb, cl) < 0 ||
1561#ifdef CONFIG_NET_CLS_POLICE 1564#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
1562 cbq_dump_police(skb, cl) < 0 || 1565 cbq_dump_police(skb, cl) < 0 ||
1563#endif 1566#endif
1564 cbq_dump_fopt(skb, cl) < 0) 1567 cbq_dump_fopt(skb, cl) < 0)
@@ -1653,7 +1656,7 @@ static int cbq_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
1653 cl->classid)) == NULL) 1656 cl->classid)) == NULL)
1654 return -ENOBUFS; 1657 return -ENOBUFS;
1655 } else { 1658 } else {
1656#ifdef CONFIG_NET_CLS_POLICE 1659#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
1657 if (cl->police == TC_POLICE_RECLASSIFY) 1660 if (cl->police == TC_POLICE_RECLASSIFY)
1658 new->reshape_fail = cbq_reshape_fail; 1661 new->reshape_fail = cbq_reshape_fail;
1659#endif 1662#endif
@@ -1718,7 +1721,7 @@ cbq_destroy(struct Qdisc* sch)
1718 struct cbq_class *cl; 1721 struct cbq_class *cl;
1719 unsigned h; 1722 unsigned h;
1720 1723
1721#ifdef CONFIG_NET_CLS_POLICE 1724#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
1722 q->rx_class = NULL; 1725 q->rx_class = NULL;
1723#endif 1726#endif
1724 /* 1727 /*
@@ -1747,7 +1750,7 @@ static void cbq_put(struct Qdisc *sch, unsigned long arg)
1747 struct cbq_class *cl = (struct cbq_class*)arg; 1750 struct cbq_class *cl = (struct cbq_class*)arg;
1748 1751
1749 if (--cl->refcnt == 0) { 1752 if (--cl->refcnt == 0) {
1750#ifdef CONFIG_NET_CLS_POLICE 1753#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
1751 struct cbq_sched_data *q = qdisc_priv(sch); 1754 struct cbq_sched_data *q = qdisc_priv(sch);
1752 1755
1753 spin_lock_bh(&sch->dev->queue_lock); 1756 spin_lock_bh(&sch->dev->queue_lock);
@@ -1795,7 +1798,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t
1795 RTA_PAYLOAD(tb[TCA_CBQ_WRROPT-1]) < sizeof(struct tc_cbq_wrropt)) 1798 RTA_PAYLOAD(tb[TCA_CBQ_WRROPT-1]) < sizeof(struct tc_cbq_wrropt))
1796 return -EINVAL; 1799 return -EINVAL;
1797 1800
1798#ifdef CONFIG_NET_CLS_POLICE 1801#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
1799 if (tb[TCA_CBQ_POLICE-1] && 1802 if (tb[TCA_CBQ_POLICE-1] &&
1800 RTA_PAYLOAD(tb[TCA_CBQ_POLICE-1]) < sizeof(struct tc_cbq_police)) 1803 RTA_PAYLOAD(tb[TCA_CBQ_POLICE-1]) < sizeof(struct tc_cbq_police))
1801 return -EINVAL; 1804 return -EINVAL;
@@ -1838,7 +1841,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t
1838 if (tb[TCA_CBQ_OVL_STRATEGY-1]) 1841 if (tb[TCA_CBQ_OVL_STRATEGY-1])
1839 cbq_set_overlimit(cl, RTA_DATA(tb[TCA_CBQ_OVL_STRATEGY-1])); 1842 cbq_set_overlimit(cl, RTA_DATA(tb[TCA_CBQ_OVL_STRATEGY-1]));
1840 1843
1841#ifdef CONFIG_NET_CLS_POLICE 1844#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
1842 if (tb[TCA_CBQ_POLICE-1]) 1845 if (tb[TCA_CBQ_POLICE-1])
1843 cbq_set_police(cl, RTA_DATA(tb[TCA_CBQ_POLICE-1])); 1846 cbq_set_police(cl, RTA_DATA(tb[TCA_CBQ_POLICE-1]));
1844#endif 1847#endif
@@ -1931,7 +1934,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t
1931 cl->overlimit = cbq_ovl_classic; 1934 cl->overlimit = cbq_ovl_classic;
1932 if (tb[TCA_CBQ_OVL_STRATEGY-1]) 1935 if (tb[TCA_CBQ_OVL_STRATEGY-1])
1933 cbq_set_overlimit(cl, RTA_DATA(tb[TCA_CBQ_OVL_STRATEGY-1])); 1936 cbq_set_overlimit(cl, RTA_DATA(tb[TCA_CBQ_OVL_STRATEGY-1]));
1934#ifdef CONFIG_NET_CLS_POLICE 1937#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
1935 if (tb[TCA_CBQ_POLICE-1]) 1938 if (tb[TCA_CBQ_POLICE-1])
1936 cbq_set_police(cl, RTA_DATA(tb[TCA_CBQ_POLICE-1])); 1939 cbq_set_police(cl, RTA_DATA(tb[TCA_CBQ_POLICE-1]));
1937#endif 1940#endif
@@ -1975,7 +1978,7 @@ static int cbq_delete(struct Qdisc *sch, unsigned long arg)
1975 q->tx_class = NULL; 1978 q->tx_class = NULL;
1976 q->tx_borrowed = NULL; 1979 q->tx_borrowed = NULL;
1977 } 1980 }
1978#ifdef CONFIG_NET_CLS_POLICE 1981#if defined(CONFIG_NET_CLS_ACT) || defined(CONFIG_NET_CLS_POLICE)
1979 if (q->rx_class == cl) 1982 if (q->rx_class == cl)
1980 q->rx_class = NULL; 1983 q->rx_class = NULL;
1981#endif 1984#endif