On Tue, Jul 3, 2018 at 4:14 PM Taran Lynn <tfl...@ucdavis.edu> wrote: > > Hello, > I'm new to linux development and am working on creating a qdisc module, > similar to those under net/sched/sch_*.c. Currently I'm stuck on two > things. > > 1. What's the best way to set the maximum bit rate? > 2. How do I determine the RTT for packets? > > For (1) I'm currently tracking the number of bits sent, and only sending > packets if they stay within the appropriate rate bound. Is there a better > way to do this? I've looked at net/sched/sch_netem.c, and as far as I can > tell it determines the delay between packets for a given rate and sends > them after that delay has passed. However, when I tried to do this I got > inconsistent rates, so I think I may be missing something.
It depends on what you want to do for bandwidth control. If you simply want traffic policing, take a look at gen estimator in net/core/gen_estimator.c. net/sched/act_police.c is an example of how it is used. If you want traffic shaping, it is harder, the simplest one in kernel is probably net/sched/sch_tbf.c. > > As for (2) I'm not sure where to start. Why do you care about RTT in Qdisc layer? RTT is kinda TCP thing, while Qdisc is at L2...