Processing a packet typically includes enqueuing the packet on to a queue
when it arrives at a device, and then at some later time under control of
the scheduler, dequeuing the packet for transmission. The scheduler needs
some representation of the packet length for its uses when dequeuing. By
storing the packet length as an adjusted packet length containing fewer
bits, the scheduler and any storage of the packets lengths in the queues
are reduced in complexity/size. One implementation maintains a residue
amount corresponding to one or more packet queues or streams of packets.
The residue amount is updated to maintain a forward looking or lagging
behind indication of the error induced by this approximation. An adjusted
packet length for the packet is determined based on its actual packet
length and the residue amount. The residue amount is accordingly updated
to reduce any long term error induced by using the adjusted packet
lengths.