Qdisc requeue should be void?

Stephen Hemminger
Fri, 13 May 2005 17:57:54 -0000

There is an design problem with the qdisc interface that causes qlen related
bugs
in netem, tbf, and other qdisc''s that peek at the top of the queue. The
problem is
that requeue needs to be called from the dequeue function but requeue can fail.
If requeue fails, then the calling qdisc can not properly handle the error.  If
it
returns NULL, then the parent''s expectation about qlen gets messed up.

Example:

	prio (qlen = 1)
		skb = netem dequeue
			skb = htb dequeue
			... decides not to send this skb now
			htp requeue(skb) fails
				?? what now
				--netem.qlen // := 0
				return NULL
		 skb is NULL

at this point prio qlen is 1 but underlying queue''s are empty.

My proposal is to require requeue to always succeed and change it to be
void instead of returning int.