Subject: Re: [NET_SCHED 03/06]: Fix endless loops caused by inaccurate qlen counters (part 1)

From: Mika Penttilä <[email-masked]>
Date: Mon, 20 Nov 2006 16:23:55 +0200

> @@ -348,6 +354,26 @@ dev_graft_qdisc(struct net_device *dev, 
>  	return oqdisc;
>  }
>  
> +void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
> +{
> +	struct Qdisc_class_ops *cops;
> +	unsigned long cl;
> +	u32 parentid;
> +
> +	if (n == 0)
> +		return;
> +	while ((parentid = sch->parent)) {
> +		sch = __qdisc_lookup(sch->dev, TC_H_MAJ(parentid));
> +		cops = sch->ops->cl_ops;
> +		if (cops->qlen_notify) {
> +			cl = cops->get(sch, parentid);
> +			cops->qlen_notify(sch, cl);
> +			cops->put(sch, cl);
> +		}
> +		sch->q.qlen -= n;
> +	}
> +}
> +EXPORT_SYMBOL(qdisc_tree_decrease_qlen);
>  
>   
Are you sure you didn't mean to :

+	while ((parentid = sch->parent)) {
+		sch = __qdisc_lookup(sch->dev, TC_H_MAJ(parentid));
+		cops = sch->ops->cl_ops;
+		if (!(sch->q.qlen -= n) && cops->qlen_notify) {    <----
+			cl = cops->get(sch, parentid);
+			cops->qlen_notify(sch, cl);
+			cops->put(sch, cl);
+		}
+	}

--Mika