public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net_sched: increase drops and decrease backlog when packets are dropped
@ 2014-05-06  9:37 Yang Yingliang
  2014-05-06 13:58 ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Yang Yingliang @ 2014-05-06  9:37 UTC (permalink / raw)
  To: netdev; +Cc: eric.dumazet, vtlam, nanditad, davem

When packets are dropped, backlog and drops statistic of qdisc
need be changed. Replace kfree_skb() with qdisc_drop() for
increasing drops.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 net/sched/sch_fq.c       | 2 +-
 net/sched/sch_fq_codel.c | 3 ++-
 net/sched/sch_hhf.c      | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
index 23c682b42f99..958ef7d4b825 100644
--- a/net/sched/sch_fq.c
+++ b/net/sched/sch_fq.c
@@ -714,7 +714,7 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt)
 
 		if (!skb)
 			break;
-		kfree_skb(skb);
+		qdisc_drop(skb, sch);
 		drop_count++;
 	}
 	qdisc_tree_decrease_qlen(sch, drop_count);
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index 0bf432c782c1..83abd4cd10cd 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -344,7 +344,8 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt)
 	while (sch->q.qlen > sch->limit) {
 		struct sk_buff *skb = fq_codel_dequeue(sch);
 
-		kfree_skb(skb);
+		sch->qstats.backlog -= qdisc_pkt_len(skb);
+		qdisc_drop(skb, sch);
 		q->cstats.drop_count++;
 	}
 	qdisc_tree_decrease_qlen(sch, q->cstats.drop_count);
diff --git a/net/sched/sch_hhf.c b/net/sched/sch_hhf.c
index edee03d922e2..a9051d0fff52 100644
--- a/net/sched/sch_hhf.c
+++ b/net/sched/sch_hhf.c
@@ -592,7 +592,7 @@ static int hhf_change(struct Qdisc *sch, struct nlattr *opt)
 	while (sch->q.qlen > sch->limit) {
 		struct sk_buff *skb = hhf_dequeue(sch);
 
-		kfree_skb(skb);
+		qdisc_drop(skb, sch);
 	}
 	qdisc_tree_decrease_qlen(sch, qlen - sch->q.qlen);
 
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net_sched: increase drops and decrease backlog when packets are dropped
  2014-05-06  9:37 [PATCH net-next] net_sched: increase drops and decrease backlog when packets are dropped Yang Yingliang
@ 2014-05-06 13:58 ` Eric Dumazet
  2014-05-08  2:08   ` Yang Yingliang
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2014-05-06 13:58 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: netdev, vtlam, nanditad, davem

On Tue, 2014-05-06 at 17:37 +0800, Yang Yingliang wrote:
> When packets are dropped, backlog and drops statistic of qdisc
> need be changed. Replace kfree_skb() with qdisc_drop() for
> increasing drops.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---


> diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
> index 0bf432c782c1..83abd4cd10cd 100644
> --- a/net/sched/sch_fq_codel.c
> +++ b/net/sched/sch_fq_codel.c
> @@ -344,7 +344,8 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt)
>  	while (sch->q.qlen > sch->limit) {
>  		struct sk_buff *skb = fq_codel_dequeue(sch);
>  
> -		kfree_skb(skb);
> +		sch->qstats.backlog -= qdisc_pkt_len(skb);

Hmmm... please describe how you tested this change ?

> +		qdisc_drop(skb, sch);
>  		q->cstats.drop_count++;
>  	}
>  	qdisc_tree_decrease_qlen(sch, q->cstats.drop_count);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net_sched: increase drops and decrease backlog when packets are dropped
  2014-05-06 13:58 ` Eric Dumazet
@ 2014-05-08  2:08   ` Yang Yingliang
  2014-05-08  2:55     ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Yang Yingliang @ 2014-05-08  2:08 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev, vtlam, nanditad, davem

On 2014/5/6 21:58, Eric Dumazet wrote:
> On Tue, 2014-05-06 at 17:37 +0800, Yang Yingliang wrote:
>> When packets are dropped, backlog and drops statistic of qdisc
>> need be changed. Replace kfree_skb() with qdisc_drop() for
>> increasing drops.
>>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
> 
> 
>> diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
>> index 0bf432c782c1..83abd4cd10cd 100644
>> --- a/net/sched/sch_fq_codel.c
>> +++ b/net/sched/sch_fq_codel.c
>> @@ -344,7 +344,8 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt)
>>  	while (sch->q.qlen > sch->limit) {
>>  		struct sk_buff *skb = fq_codel_dequeue(sch);
>>  
>> -		kfree_skb(skb);
>> +		sch->qstats.backlog -= qdisc_pkt_len(skb);
> 
> Hmmm... please describe how you tested this change ?

Compiled only. The packet is dropped, so I think the backlog should be decreased.

Regards,
Yang

> 
>> +		qdisc_drop(skb, sch);
>>  		q->cstats.drop_count++;
>>  	}
>>  	qdisc_tree_decrease_qlen(sch, q->cstats.drop_count);
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net_sched: increase drops and decrease backlog when packets are dropped
  2014-05-08  2:08   ` Yang Yingliang
@ 2014-05-08  2:55     ` Eric Dumazet
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2014-05-08  2:55 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: netdev, vtlam, nanditad, davem

On Thu, 2014-05-08 at 10:08 +0800, Yang Yingliang wrote:
> On 2014/5/6 21:58, Eric Dumazet wrote:
> > On Tue, 2014-05-06 at 17:37 +0800, Yang Yingliang wrote:
> >> When packets are dropped, backlog and drops statistic of qdisc
> >> need be changed. Replace kfree_skb() with qdisc_drop() for
> >> increasing drops.
> >>
> >> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> >> ---
> > 
> > 
> >> diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
> >> index 0bf432c782c1..83abd4cd10cd 100644
> >> --- a/net/sched/sch_fq_codel.c
> >> +++ b/net/sched/sch_fq_codel.c
> >> @@ -344,7 +344,8 @@ static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt)
> >>  	while (sch->q.qlen > sch->limit) {
> >>  		struct sk_buff *skb = fq_codel_dequeue(sch);
> >>  
> >> -		kfree_skb(skb);
> >> +		sch->qstats.backlog -= qdisc_pkt_len(skb);
> > 
> > Hmmm... please describe how you tested this change ?
> 
> Compiled only. The packet is dropped, so I think the backlog should be decreased.

Well, please test your patches then, and read again the code,
because you add a bug here.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-08  2:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-06  9:37 [PATCH net-next] net_sched: increase drops and decrease backlog when packets are dropped Yang Yingliang
2014-05-06 13:58 ` Eric Dumazet
2014-05-08  2:08   ` Yang Yingliang
2014-05-08  2:55     ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox