* [PATCH 1/2 (resend)] Fix TBF class reporting (tc class show)
@ 2004-03-23 6:08 Dmitry Torokhov
2004-03-23 6:08 ` [PATCH 2/2 (resend)] TBF trailing whitespace fixes Dmitry Torokhov
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2004-03-23 6:08 UTC (permalink / raw)
To: linux-net; +Cc: netdev
Hi,
The patch below fixes issue with "tc class show dev <dev>" not showing any
classes when TBF qdisc is present in the chain. PLease copnsider for
inclusion.
--
Dmitry
===================================================================
ChangeSet@1.1648, 2004-03-05 01:02:36-05:00, dtor_core@ameritech.net
NET: Fix class reporting in TBF qdisc
sch_tbf.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
===================================================================
diff -Nru a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
--- a/net/sched/sch_tbf.c Fri Mar 5 01:26:33 2004
+++ b/net/sched/sch_tbf.c Fri Mar 5 01:26:33 2004
@@ -434,8 +434,7 @@
if (cl != 1) /* only one class */
return -ENOENT;
- tcm->tcm_parent = TC_H_ROOT;
- tcm->tcm_handle = 1;
+ tcm->tcm_handle |= TC_H_MIN(1);
tcm->tcm_info = q->qdisc->handle;
return 0;
@@ -486,11 +485,9 @@
static void tbf_walk(struct Qdisc *sch, struct qdisc_walker *walker)
{
- struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
-
if (!walker->stop) {
- if (walker->count >= walker->skip)
- if (walker->fn(sch, (unsigned long)q, walker) < 0) {
+ if (walker->count >= walker->skip)
+ if (walker->fn(sch, 1, walker) < 0) {
walker->stop = 1;
return;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2 (resend)] TBF trailing whitespace fixes
2004-03-23 6:08 [PATCH 1/2 (resend)] Fix TBF class reporting (tc class show) Dmitry Torokhov
@ 2004-03-23 6:08 ` Dmitry Torokhov
2004-03-24 21:59 ` David S. Miller
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2004-03-23 6:08 UTC (permalink / raw)
To: linux-net; +Cc: netdev
===================================================================
ChangeSet@1.1649, 2004-03-05 01:18:18-05:00, dtor_core@ameritech.net
NET: TBF trailing whitespace cleanup
sch_tbf.c | 68 +++++++++++++++++++++++++++++++-------------------------------
1 files changed, 34 insertions(+), 34 deletions(-)
===================================================================
diff -Nru a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
--- a/net/sched/sch_tbf.c Fri Mar 5 01:26:58 2004
+++ b/net/sched/sch_tbf.c Fri Mar 5 01:26:58 2004
@@ -62,7 +62,7 @@
Algorithm.
----------
-
+
Let N(t_i) be B/R initially and N(t) grow continuously with time as:
N(t+delta) = min{B/R, N(t) + delta}
@@ -146,15 +146,15 @@
if (sch->reshape_fail == NULL || sch->reshape_fail(skb, sch))
#endif
kfree_skb(skb);
-
+
return NET_XMIT_DROP;
}
-
+
if ((ret = q->qdisc->enqueue(skb, q->qdisc)) != 0) {
sch->stats.drops++;
return ret;
- }
-
+ }
+
sch->q.qlen++;
sch->stats.bytes += skb->len;
sch->stats.packets++;
@@ -165,10 +165,10 @@
{
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
int ret;
-
+
if ((ret = q->qdisc->ops->requeue(skb, q->qdisc)) == 0)
- sch->q.qlen++;
-
+ sch->q.qlen++;
+
return ret;
}
@@ -176,7 +176,7 @@
{
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
unsigned int len;
-
+
if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) {
sch->q.qlen--;
sch->stats.drops++;
@@ -196,7 +196,7 @@
{
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
struct sk_buff *skb;
-
+
skb = q->qdisc->dequeue(q->qdisc);
if (skb) {
@@ -204,7 +204,7 @@
long toks;
long ptoks = 0;
unsigned int len = skb->len;
-
+
PSCHED_GET_TIME(now);
toks = PSCHED_TDIFF_SAFE(now, q->t_c, q->buffer, 0);
@@ -248,13 +248,13 @@
This is the main idea of all FQ algorithms
(cf. CSZ, HPFQ, HFSC)
*/
-
+
if (q->qdisc->ops->requeue(skb, q->qdisc) != NET_XMIT_SUCCESS) {
- /* When requeue fails skb is dropped */
+ /* When requeue fails skb is dropped */
sch->q.qlen--;
sch->stats.drops++;
- }
-
+ }
+
sch->flags |= TCQ_F_THROTTLED;
sch->stats.overlimits++;
}
@@ -279,24 +279,24 @@
struct Qdisc *q = qdisc_create_dflt(dev, &bfifo_qdisc_ops);
struct rtattr *rta;
int ret;
-
+
if (q) {
rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
if (rta) {
rta->rta_type = RTM_NEWQDISC;
rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit;
-
+
ret = q->ops->change(q, rta);
kfree(rta);
-
+
if (ret == 0)
return q;
}
qdisc_destroy(q);
}
- return NULL;
+ return NULL;
}
static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
@@ -340,7 +340,7 @@
}
if (max_size < 0)
goto done;
-
+
if (q->qdisc == &noop_qdisc) {
if ((child = tbf_create_dflt_qdisc(sch->dev, qopt->limit)) == NULL)
goto done;
@@ -369,17 +369,17 @@
static int tbf_init(struct Qdisc* sch, struct rtattr *opt)
{
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
-
+
if (opt == NULL)
return -EINVAL;
-
+
PSCHED_GET_TIME(q->t_c);
init_timer(&q->wd_timer);
q->wd_timer.function = tbf_watchdog;
q->wd_timer.data = (unsigned long)sch;
q->qdisc = &noop_qdisc;
-
+
return tbf_change(sch, opt);
}
@@ -393,7 +393,7 @@
qdisc_put_rtab(q->P_tab);
if (q->R_tab)
qdisc_put_rtab(q->R_tab);
-
+
qdisc_destroy(q->qdisc);
q->qdisc = &noop_qdisc;
}
@@ -404,10 +404,10 @@
unsigned char *b = skb->tail;
struct rtattr *rta;
struct tc_tbf_qopt opt;
-
+
rta = (struct rtattr*)b;
RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
-
+
opt.limit = q->limit;
opt.rate = q->R_tab->rate;
if (q->P_tab)
@@ -427,13 +427,13 @@
}
static int tbf_dump_class(struct Qdisc *sch, unsigned long cl,
- struct sk_buff *skb, struct tcmsg *tcm)
+ struct sk_buff *skb, struct tcmsg *tcm)
{
struct tbf_sched_data *q = (struct tbf_sched_data*)sch->data;
- if (cl != 1) /* only one class */
+ if (cl != 1) /* only one class */
return -ENOENT;
-
+
tcm->tcm_handle |= TC_H_MIN(1);
tcm->tcm_info = q->qdisc->handle;
@@ -448,12 +448,12 @@
if (new == NULL)
new = &noop_qdisc;
- sch_tree_lock(sch);
+ sch_tree_lock(sch);
*old = xchg(&q->qdisc, new);
qdisc_reset(*old);
sch->q.qlen = 0;
sch_tree_unlock(sch);
-
+
return 0;
}
@@ -473,7 +473,7 @@
}
static int tbf_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
- struct rtattr **tca, unsigned long *arg)
+ struct rtattr **tca, unsigned long *arg)
{
return -ENOSYS;
}
@@ -497,7 +497,7 @@
static struct Qdisc_class_ops tbf_class_ops =
{
- .graft = tbf_graft,
+ .graft = tbf_graft,
.leaf = tbf_leaf,
.get = tbf_get,
.put = tbf_put,
@@ -529,7 +529,7 @@
return register_qdisc(&tbf_qdisc_ops);
}
-static void __exit tbf_module_exit(void)
+static void __exit tbf_module_exit(void)
{
unregister_qdisc(&tbf_qdisc_ops);
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2 (resend)] TBF trailing whitespace fixes
2004-03-23 6:08 ` [PATCH 2/2 (resend)] TBF trailing whitespace fixes Dmitry Torokhov
@ 2004-03-24 21:59 ` David S. Miller
2004-03-25 4:54 ` Dmitry Torokhov
0 siblings, 1 reply; 5+ messages in thread
From: David S. Miller @ 2004-03-24 21:59 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-net, netdev
Dmitry, I applied the first patch to both 2.4.x and 2.6.x
The whitespace patch (the second one) only applies to 2.6.x,
so a 2.4.x version would be appreciated.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2 (resend)] TBF trailing whitespace fixes
2004-03-24 21:59 ` David S. Miller
@ 2004-03-25 4:54 ` Dmitry Torokhov
2004-03-25 20:59 ` David S. Miller
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2004-03-25 4:54 UTC (permalink / raw)
To: David S. Miller; +Cc: linux-net, netdev
On Wednesday 24 March 2004 04:59 pm, David S. Miller wrote:
>
> Dmitry, I applied the first patch to both 2.4.x and 2.6.x
> The whitespace patch (the second one) only applies to 2.6.x,
> so a 2.4.x version would be appreciated.
>
> Thanks.
>
Here it is, against the today's Marcelo's BK plus the first patch.
It compiles.
--
Dmitry
===================================================================
ChangeSet@1.1321, 2004-03-24 23:50:16-05:00, dtor_core@ameritech.net
NET: TBF trailing whitespace cleanup
sch_tbf.c | 68 +++++++++++++++++++++++++++++++-------------------------------
1 files changed, 34 insertions(+), 34 deletions(-)
===================================================================
diff -Nru a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
--- a/net/sched/sch_tbf.c Wed Mar 24 23:50:55 2004
+++ b/net/sched/sch_tbf.c Wed Mar 24 23:50:55 2004
@@ -62,7 +62,7 @@
Algorithm.
----------
-
+
Let N(t_i) be B/R initially and N(t) grow continuously with time as:
N(t+delta) = min{B/R, N(t) + delta}
@@ -146,15 +146,15 @@
if (sch->reshape_fail == NULL || sch->reshape_fail(skb, sch))
#endif
kfree_skb(skb);
-
+
return NET_XMIT_DROP;
}
-
+
if ((ret = q->qdisc->enqueue(skb, q->qdisc)) != 0) {
sch->stats.drops++;
return ret;
- }
-
+ }
+
sch->q.qlen++;
sch->stats.bytes += skb->len;
sch->stats.packets++;
@@ -165,10 +165,10 @@
{
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
int ret;
-
+
if ((ret = q->qdisc->ops->requeue(skb, q->qdisc)) == 0)
- sch->q.qlen++;
-
+ sch->q.qlen++;
+
return ret;
}
@@ -176,7 +176,7 @@
{
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
unsigned int len;
-
+
if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) {
sch->q.qlen--;
sch->stats.drops++;
@@ -196,7 +196,7 @@
{
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
struct sk_buff *skb;
-
+
skb = q->qdisc->dequeue(q->qdisc);
if (skb) {
@@ -204,7 +204,7 @@
long toks;
long ptoks = 0;
unsigned int len = skb->len;
-
+
PSCHED_GET_TIME(now);
toks = PSCHED_TDIFF_SAFE(now, q->t_c, q->buffer, 0);
@@ -248,13 +248,13 @@
This is the main idea of all FQ algorithms
(cf. CSZ, HPFQ, HFSC)
*/
-
+
if (q->qdisc->ops->requeue(skb, q->qdisc) != NET_XMIT_SUCCESS) {
- /* When requeue fails skb is dropped */
+ /* When requeue fails skb is dropped */
sch->q.qlen--;
sch->stats.drops++;
- }
-
+ }
+
sch->flags |= TCQ_F_THROTTLED;
sch->stats.overlimits++;
}
@@ -279,24 +279,24 @@
struct Qdisc *q = qdisc_create_dflt(dev, &bfifo_qdisc_ops);
struct rtattr *rta;
int ret;
-
+
if (q) {
rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
if (rta) {
rta->rta_type = RTM_NEWQDISC;
- rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
+ rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit;
-
+
ret = q->ops->change(q, rta);
kfree(rta);
-
+
if (ret == 0)
return q;
}
qdisc_destroy(q);
}
- return NULL;
+ return NULL;
}
static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
@@ -340,7 +340,7 @@
}
if (max_size < 0)
goto done;
-
+
if (q->qdisc == &noop_qdisc) {
if ((child = tbf_create_dflt_qdisc(sch->dev, qopt->limit)) == NULL)
goto done;
@@ -370,19 +370,19 @@
{
int err;
struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
-
+
if (opt == NULL)
return -EINVAL;
-
+
MOD_INC_USE_COUNT;
-
+
PSCHED_GET_TIME(q->t_c);
init_timer(&q->wd_timer);
q->wd_timer.function = tbf_watchdog;
q->wd_timer.data = (unsigned long)sch;
q->qdisc = &noop_qdisc;
-
+
if ((err = tbf_change(sch, opt)) != 0) {
MOD_DEC_USE_COUNT;
}
@@ -399,7 +399,7 @@
qdisc_put_rtab(q->P_tab);
if (q->R_tab)
qdisc_put_rtab(q->R_tab);
-
+
qdisc_destroy(q->qdisc);
q->qdisc = &noop_qdisc;
@@ -412,10 +412,10 @@
unsigned char *b = skb->tail;
struct rtattr *rta;
struct tc_tbf_qopt opt;
-
+
rta = (struct rtattr*)b;
RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
-
+
opt.limit = q->limit;
opt.rate = q->R_tab->rate;
if (q->P_tab)
@@ -439,9 +439,9 @@
{
struct tbf_sched_data *q = (struct tbf_sched_data*)sch->data;
- if (cl != 1) /* only one class */
+ if (cl != 1) /* only one class */
return -ENOENT;
-
+
tcm->tcm_handle |= TC_H_MIN(1);
tcm->tcm_info = q->qdisc->handle;
@@ -456,12 +456,12 @@
if (new == NULL)
new = &noop_qdisc;
- sch_tree_lock(sch);
+ sch_tree_lock(sch);
*old = xchg(&q->qdisc, new);
qdisc_reset(*old);
sch->q.qlen = 0;
sch_tree_unlock(sch);
-
+
return 0;
}
@@ -480,7 +480,7 @@
{
}
-static int tbf_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
+static int tbf_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
struct rtattr **tca, unsigned long *arg)
{
return -ENOSYS;
@@ -542,7 +542,7 @@
return register_qdisc(&tbf_qdisc_ops);
}
-void cleanup_module(void)
+void cleanup_module(void)
{
unregister_qdisc(&tbf_qdisc_ops);
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2 (resend)] TBF trailing whitespace fixes
2004-03-25 4:54 ` Dmitry Torokhov
@ 2004-03-25 20:59 ` David S. Miller
0 siblings, 0 replies; 5+ messages in thread
From: David S. Miller @ 2004-03-25 20:59 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-net, netdev
On Wed, 24 Mar 2004 23:54:22 -0500
Dmitry Torokhov <dtor_core@ameritech.net> wrote:
> Here it is, against the today's Marcelo's BK plus the first patch.
> It compiles.
Thanks, applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-03-25 20:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-23 6:08 [PATCH 1/2 (resend)] Fix TBF class reporting (tc class show) Dmitry Torokhov
2004-03-23 6:08 ` [PATCH 2/2 (resend)] TBF trailing whitespace fixes Dmitry Torokhov
2004-03-24 21:59 ` David S. Miller
2004-03-25 4:54 ` Dmitry Torokhov
2004-03-25 20:59 ` David S. Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).