A scheduler for a network processor includes a scheduling queue in which
weighted fair queuing is applied. The scheduling queue has a range R.
Flows are attached to the scheduling queue at a distance D from a current
pointer for the scheduling queue. The distance D is calculated for each
flow according to the formula D=((WF.times.FS)/SF), where WF is a
weighting factor applicable to a respective flow; FS is a frame size
attributable to the respective flow; and SF is a scaling factor. The
scaling factor SF is adjusted depending on a comparison of the distance D
to the range R.