enum htb_cmode htb_class_mode (struct htb_class * cl, long * diff);
It computes cl's mode at time cl->t_c+diff and returns it. If mode is not HTB_CAN_SEND then cl->pq_key is updated to time difference from now to time when cl will change its state. Also it is worth to note that class mode doesn't change simply at cl->{c,}tokens == 0 but there can rather be hysteresis of 0 .. -cl->{c,}buffer range. It is meant to limit number of mode transitions per time unit. The speed gain is about 1/6.