Subject: Re: bnx2_poll panicking kernel

From: Jarek Poplawski <[email-masked]>
Date: Sat, 12 Jul 2008 15:21:28 +0200

Jarek Poplawski wrote, On 07/12/2008 11:49 AM:

> David Miller wrote, On 07/11/2008 11:56 AM:
> ...
> 
>> diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
>> index 3fb58f4..aa20b47 100644
>> --- a/net/sched/sch_htb.c
>> +++ b/net/sched/sch_htb.c
>> @@ -583,6 +583,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
>>  		if (q->direct_queue.qlen < q->direct_qlen) {
>>  			__skb_queue_tail(&q->direct_queue, skb);
>>  			q->direct_pkts++;
>> +			ret = NET_XMIT_SUCCESS;
>>  		} else {
>>  			kfree_skb(skb);
>>  			sch->qstats.drops++;
>> @@ -595,22 +596,26 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
>>  		kfree_skb(skb);
>>  		return ret;
>>  #endif
>> -	} else if (cl->un.leaf.q->enqueue(skb, cl->un.leaf.q) !=
>> -		   NET_XMIT_SUCCESS) {
>> -		sch->qstats.drops++;
>> -		cl->qstats.drops++;
>> -		return NET_XMIT_DROP;
>>  	} else {
>> -		cl->bstats.packets +=
>> -			skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
>> -		cl->bstats.bytes += skb->len;
>> -		htb_activate(q, cl);
>> +		ret = cl->un.leaf.q->enqueue(skb, cl->un.leaf.q);
>> +		if (ret == NET_XMIT_DROP) {
>> +			sch->qstats.drops++;
>> +			cl->qstats.drops++;
>> +		} else {
>> +			cl->bstats.packets +=
>> +				skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
>> +			cl->bstats.bytes += skb->len;
>> +			htb_activate(q, cl);
> 
> 
> This isn't correct: htb_activate() needs cl->un.leaf.q->q.qlen > 0, and
> only NET_XMIT_SUCCESS can guarantee this.

...Actually, it looks like even NET_XMIT_SUCCESS can't guarantee this
(when returned after TC_ACT_QUEUED or TC_ACT_STOLEN), so additional qlen
test is needed here.

Jarek P.