/* HTB traffic control class. */
#define HTB_N_QUEUES 0xf000
+#define HTB_RATE2QUANTUM 10
struct htb {
struct tc tc;
nl_msg_put_string(&request, TCA_KIND, "htb");
memset(&opt, 0, sizeof opt);
- opt.rate2quantum = 10;
+ opt.rate2quantum = HTB_RATE2QUANTUM;
opt.version = 3;
opt.defcls = 1;
memset(&opt, 0, sizeof opt);
tc_fill_rate(&opt.rate, class->min_rate, mtu);
tc_fill_rate(&opt.ceil, class->max_rate, mtu);
+ /* Makes sure the quantum is at least MTU. Setting quantum will
+ * make htb ignore the r2q for this class. */
+ if ((class->min_rate / HTB_RATE2QUANTUM) < mtu) {
+ opt.quantum = mtu;
+ }
opt.buffer = tc_calc_buffer(opt.rate.rate, mtu, class->burst);
opt.cbuffer = tc_calc_buffer(opt.ceil.rate, mtu, class->burst);
opt.prio = class->priority;