Bonding packet scheduler

Hi,

I have been a long term user of bonding and in general works very well. I tend to use RR for upload bonding and works well. However on aggregation it never reaches anywhere close to the limit of bonded links. I have done a lot of packet analysis on this and the reason is simple. The RR algorithm always balances by packet count. It does not weight by packet size or link speed. The result is that it determines maximum packet flow for all links based on packet load on any given line. It also balances only at the speed of the slowest slave link times number of slaves. As packet size is uneven this results in a perfect packet balance but sub-optimale traffic balance.

I had been researching scheduling methods and determined that scheduling based on byte transfer over the links would allow a better balance. A method that implemented weighted round robin with deterministic scheduling based on byte counter rather than packet counter could get close to limit subject to not breaking up packets. My method was to reset the byte counters every time a slave was enslaved or deslaved to avoid unfair scheduling. Then on each packet scheduling decision send it via the slave with lowest byte count. To allow for different slave speeds a weight could be attached as a normalising factor e.g. make fastest link 1 and work out weight based on speed e.g. half speed link would have 0.5. By using such normalising factors (moved to a better metric in base-2 to allow for faster calculation during scheduling) the slower lines would then have byte delivery proportional to line speed.

I cannot see anyway to add this to RB either using tweaks on bonding or manually mangling and scheduling. If mangle had an option to look up byte counters it could be partially possible.

I have been looking at the packet schedulers and teql drivers on Linux source and can see how these could be added.

Any thoughts or comments on how this could be partially achieved in ROS?