/* This should be the only way how to change classe's mode under normal cirsumstances. Routine will update feed lists linkage, change mode and add class to the wait event queue if appropriate. New mode should be different from old one and cl->pq_key has to be valid if changing to mode other than HTB_CAN_SEND (see htb_add_to_wait_tree).  */
static void htb_change_class_mode(struct htb_sched *q, struct htb_class *cl, long *diff)
/* This should be the only way how to change classe's mode under normal cirsumstances. Routine will update feed lists linkage, change mode and add class to the wait event queue if appropriate. New mode should be different from old one and cl->pq_key has to be valid if changing to mode other than HTB_CAN_SEND (see htb_add_to_wait_tree).  */
static void htb_change_class_mode(struct htb_sched *q, struct htb_class *cl, long *diff)
{
	enum htb_cmode new_mode = htb_class_mode(cl, diff);
	if (new_mode == cl->cmode)
		return;
	if (cl->prio_activity) {
		if (cl->cmode != HTB_CANT_SEND)
			htb_deactivate_prios(q, cl);
		cl->cmode = new_mode;
		if (new_mode != HTB_CANT_SEND)
			htb_activate_prios(q, cl);
	} else
		cl->cmode = new_mode;
}