/* The class is connected to ancestors and/or appropriate rows for priorities it is participating on. cl->cmode must be new (activated) mode. It does nothing if cl->prio_activity == 0.  */
static void htb_activate_prios(struct htb_sched *q, struct htb_class *cl)
/* The class is connected to ancestors and/or appropriate rows for priorities it is participating on. cl->cmode must be new (activated) mode. It does nothing if cl->prio_activity == 0.  */
static void htb_activate_prios(struct htb_sched *q, struct htb_class *cl)
{
	struct htb_class *p = cl->parent;
	long m, mask = cl->prio_activity;
	while (cl->cmode == HTB_MAY_BORROW && p && mask) {
		m = mask;
		while (m) {
			int prio = ffz(~m);
			m &= ~(1 << prio);
			if (p->un.inner.feed[prio].rb_node)
				mask &= ~(1 << prio);
			htb_add_to_id_tree(p->un.inner.feed + prio, cl, prio);
		}
		p->prio_activity |= mask;
		cl = p;
		p = cl->parent;
	}
	if (cl->cmode == HTB_CAN_SEND && mask)
		htb_add_class_to_row(q, cl, mask);
}