Lines Matching refs:grp
150 struct qfq_group *grp; member
301 if (agg->grp == NULL) { in qfq_update_agg()
304 agg->grp = &q->groups[i]; in qfq_update_agg()
749 static int qfq_calc_state(struct qfq_sched *q, const struct qfq_group *grp) in qfq_calc_state() argument
752 unsigned int state = qfq_gt(grp->S, q->V); in qfq_calc_state()
753 unsigned long mask = mask_from(q->bitmaps[ER], grp->index); in qfq_calc_state()
758 if (qfq_gt(grp->F, next->F)) in qfq_calc_state()
879 static void qfq_slot_insert(struct qfq_group *grp, struct qfq_aggregate *agg, in qfq_slot_insert() argument
882 u64 slot = (roundedS - grp->S) >> grp->slot_shift; in qfq_slot_insert()
886 u64 deltaS = roundedS - grp->S - in qfq_slot_insert()
887 ((u64)(QFQ_MAX_SLOTS - 2)<<grp->slot_shift); in qfq_slot_insert()
893 i = (grp->front + slot) % QFQ_MAX_SLOTS; in qfq_slot_insert()
895 hlist_add_head(&agg->next, &grp->slots[i]); in qfq_slot_insert()
896 __set_bit(slot, &grp->full_slots); in qfq_slot_insert()
900 static struct qfq_aggregate *qfq_slot_head(struct qfq_group *grp) in qfq_slot_head() argument
902 return hlist_entry(grp->slots[grp->front].first, in qfq_slot_head()
909 static void qfq_front_slot_remove(struct qfq_group *grp) in qfq_front_slot_remove() argument
911 struct qfq_aggregate *agg = qfq_slot_head(grp); in qfq_front_slot_remove()
915 if (hlist_empty(&grp->slots[grp->front])) in qfq_front_slot_remove()
916 __clear_bit(0, &grp->full_slots); in qfq_front_slot_remove()
924 static struct qfq_aggregate *qfq_slot_scan(struct qfq_group *grp) in qfq_slot_scan() argument
929 grp->index, grp->full_slots); in qfq_slot_scan()
931 if (grp->full_slots == 0) in qfq_slot_scan()
934 i = __ffs(grp->full_slots); /* zero based */ in qfq_slot_scan()
936 grp->front = (grp->front + i) % QFQ_MAX_SLOTS; in qfq_slot_scan()
937 grp->full_slots >>= i; in qfq_slot_scan()
940 return qfq_slot_head(grp); in qfq_slot_scan()
952 static void qfq_slot_rotate(struct qfq_group *grp, u64 roundedS) in qfq_slot_rotate() argument
954 unsigned int i = (grp->S - roundedS) >> grp->slot_shift; in qfq_slot_rotate()
956 grp->full_slots <<= i; in qfq_slot_rotate()
957 grp->front = (grp->front - i) % QFQ_MAX_SLOTS; in qfq_slot_rotate()
962 struct qfq_group *grp; in qfq_update_eligible() local
968 grp = qfq_ffs(q, ineligible); in qfq_update_eligible()
969 if (qfq_gt(grp->S, q->V)) in qfq_update_eligible()
970 q->V = grp->S; in qfq_update_eligible()
1043 int slot_shift = agg->grp->slot_shift; in qfq_update_start()
1050 mask = mask_from(q->bitmaps[ER], agg->grp->index); in qfq_update_start()
1171 struct qfq_group *grp; in qfq_choose_next_agg() local
1181 grp = qfq_ffs(q, q->bitmaps[ER]); in qfq_choose_next_agg()
1182 old_F = grp->F; in qfq_choose_next_agg()
1184 agg = qfq_slot_head(grp); in qfq_choose_next_agg()
1187 qfq_front_slot_remove(grp); in qfq_choose_next_agg()
1189 new_front_agg = qfq_slot_scan(grp); in qfq_choose_next_agg()
1192 __clear_bit(grp->index, &q->bitmaps[ER]); in qfq_choose_next_agg()
1195 grp->slot_shift); in qfq_choose_next_agg()
1198 if (grp->S == roundedS) in qfq_choose_next_agg()
1200 grp->S = roundedS; in qfq_choose_next_agg()
1201 grp->F = roundedS + (2ULL << grp->slot_shift); in qfq_choose_next_agg()
1202 __clear_bit(grp->index, &q->bitmaps[ER]); in qfq_choose_next_agg()
1203 s = qfq_calc_state(q, grp); in qfq_choose_next_agg()
1204 __set_bit(grp->index, &q->bitmaps[s]); in qfq_choose_next_agg()
1207 qfq_unblock_groups(q, grp->index, old_F); in qfq_choose_next_agg()
1286 struct qfq_group *grp = agg->grp; in qfq_schedule_agg() local
1290 roundedS = qfq_round_down(agg->S, grp->slot_shift); in qfq_schedule_agg()
1301 if (grp->full_slots) { in qfq_schedule_agg()
1302 if (!qfq_gt(grp->S, agg->S)) in qfq_schedule_agg()
1306 qfq_slot_rotate(grp, roundedS); in qfq_schedule_agg()
1308 __clear_bit(grp->index, &q->bitmaps[IR]); in qfq_schedule_agg()
1309 __clear_bit(grp->index, &q->bitmaps[IB]); in qfq_schedule_agg()
1314 grp->S = roundedS; in qfq_schedule_agg()
1315 grp->F = roundedS + (2ULL << grp->slot_shift); in qfq_schedule_agg()
1316 s = qfq_calc_state(q, grp); in qfq_schedule_agg()
1317 __set_bit(grp->index, &q->bitmaps[s]); in qfq_schedule_agg()
1326 qfq_slot_insert(grp, agg, roundedS); in qfq_schedule_agg()
1345 static void qfq_slot_remove(struct qfq_sched *q, struct qfq_group *grp, in qfq_slot_remove() argument
1351 roundedS = qfq_round_down(agg->S, grp->slot_shift); in qfq_slot_remove()
1352 offset = (roundedS - grp->S) >> grp->slot_shift; in qfq_slot_remove()
1354 i = (grp->front + offset) % QFQ_MAX_SLOTS; in qfq_slot_remove()
1357 if (hlist_empty(&grp->slots[i])) in qfq_slot_remove()
1358 __clear_bit(offset, &grp->full_slots); in qfq_slot_remove()
1370 struct qfq_group *grp = agg->grp; in qfq_deactivate_agg() local
1382 qfq_slot_remove(q, grp, agg); in qfq_deactivate_agg()
1384 if (!grp->full_slots) { in qfq_deactivate_agg()
1385 __clear_bit(grp->index, &q->bitmaps[IR]); in qfq_deactivate_agg()
1386 __clear_bit(grp->index, &q->bitmaps[EB]); in qfq_deactivate_agg()
1387 __clear_bit(grp->index, &q->bitmaps[IB]); in qfq_deactivate_agg()
1389 if (test_bit(grp->index, &q->bitmaps[ER]) && in qfq_deactivate_agg()
1390 !(q->bitmaps[ER] & ~((1UL << grp->index) - 1))) { in qfq_deactivate_agg()
1391 mask = q->bitmaps[ER] & ((1UL << grp->index) - 1); in qfq_deactivate_agg()
1399 __clear_bit(grp->index, &q->bitmaps[ER]); in qfq_deactivate_agg()
1400 } else if (hlist_empty(&grp->slots[grp->front])) { in qfq_deactivate_agg()
1401 agg = qfq_slot_scan(grp); in qfq_deactivate_agg()
1402 roundedS = qfq_round_down(agg->S, grp->slot_shift); in qfq_deactivate_agg()
1403 if (grp->S != roundedS) { in qfq_deactivate_agg()
1404 __clear_bit(grp->index, &q->bitmaps[ER]); in qfq_deactivate_agg()
1405 __clear_bit(grp->index, &q->bitmaps[IR]); in qfq_deactivate_agg()
1406 __clear_bit(grp->index, &q->bitmaps[EB]); in qfq_deactivate_agg()
1407 __clear_bit(grp->index, &q->bitmaps[IB]); in qfq_deactivate_agg()
1408 grp->S = roundedS; in qfq_deactivate_agg()
1409 grp->F = roundedS + (2ULL << grp->slot_shift); in qfq_deactivate_agg()
1410 s = qfq_calc_state(q, grp); in qfq_deactivate_agg()
1411 __set_bit(grp->index, &q->bitmaps[s]); in qfq_deactivate_agg()
1428 struct qfq_group *grp; in qfq_init_qdisc() local
1451 grp = &q->groups[i]; in qfq_init_qdisc()
1452 grp->index = i; in qfq_init_qdisc()
1453 grp->slot_shift = q->min_slot_shift + i; in qfq_init_qdisc()
1455 INIT_HLIST_HEAD(&grp->slots[j]); in qfq_init_qdisc()