Lines Matching refs:grp
151 struct qfq_group *grp; member
297 if (agg->grp == NULL) { in qfq_update_agg()
300 agg->grp = &q->groups[i]; in qfq_update_agg()
738 static int qfq_calc_state(struct qfq_sched *q, const struct qfq_group *grp) in qfq_calc_state() argument
741 unsigned int state = qfq_gt(grp->S, q->V); in qfq_calc_state()
742 unsigned long mask = mask_from(q->bitmaps[ER], grp->index); in qfq_calc_state()
747 if (qfq_gt(grp->F, next->F)) in qfq_calc_state()
868 static void qfq_slot_insert(struct qfq_group *grp, struct qfq_aggregate *agg, in qfq_slot_insert() argument
871 u64 slot = (roundedS - grp->S) >> grp->slot_shift; in qfq_slot_insert()
875 u64 deltaS = roundedS - grp->S - in qfq_slot_insert()
876 ((u64)(QFQ_MAX_SLOTS - 2)<<grp->slot_shift); in qfq_slot_insert()
882 i = (grp->front + slot) % QFQ_MAX_SLOTS; in qfq_slot_insert()
884 hlist_add_head(&agg->next, &grp->slots[i]); in qfq_slot_insert()
885 __set_bit(slot, &grp->full_slots); in qfq_slot_insert()
889 static struct qfq_aggregate *qfq_slot_head(struct qfq_group *grp) in qfq_slot_head() argument
891 return hlist_entry(grp->slots[grp->front].first, in qfq_slot_head()
898 static void qfq_front_slot_remove(struct qfq_group *grp) in qfq_front_slot_remove() argument
900 struct qfq_aggregate *agg = qfq_slot_head(grp); in qfq_front_slot_remove()
904 if (hlist_empty(&grp->slots[grp->front])) in qfq_front_slot_remove()
905 __clear_bit(0, &grp->full_slots); in qfq_front_slot_remove()
913 static struct qfq_aggregate *qfq_slot_scan(struct qfq_group *grp) in qfq_slot_scan() argument
918 grp->index, grp->full_slots); in qfq_slot_scan()
920 if (grp->full_slots == 0) in qfq_slot_scan()
923 i = __ffs(grp->full_slots); /* zero based */ in qfq_slot_scan()
925 grp->front = (grp->front + i) % QFQ_MAX_SLOTS; in qfq_slot_scan()
926 grp->full_slots >>= i; in qfq_slot_scan()
929 return qfq_slot_head(grp); in qfq_slot_scan()
941 static void qfq_slot_rotate(struct qfq_group *grp, u64 roundedS) in qfq_slot_rotate() argument
943 unsigned int i = (grp->S - roundedS) >> grp->slot_shift; in qfq_slot_rotate()
945 grp->full_slots <<= i; in qfq_slot_rotate()
946 grp->front = (grp->front - i) % QFQ_MAX_SLOTS; in qfq_slot_rotate()
951 struct qfq_group *grp; in qfq_update_eligible() local
957 grp = qfq_ffs(q, ineligible); in qfq_update_eligible()
958 if (qfq_gt(grp->S, q->V)) in qfq_update_eligible()
959 q->V = grp->S; in qfq_update_eligible()
1027 int slot_shift = agg->grp->slot_shift; in qfq_update_start()
1034 mask = mask_from(q->bitmaps[ER], agg->grp->index); in qfq_update_start()
1148 struct qfq_group *grp; in qfq_choose_next_agg() local
1158 grp = qfq_ffs(q, q->bitmaps[ER]); in qfq_choose_next_agg()
1159 old_F = grp->F; in qfq_choose_next_agg()
1161 agg = qfq_slot_head(grp); in qfq_choose_next_agg()
1164 qfq_front_slot_remove(grp); in qfq_choose_next_agg()
1166 new_front_agg = qfq_slot_scan(grp); in qfq_choose_next_agg()
1169 __clear_bit(grp->index, &q->bitmaps[ER]); in qfq_choose_next_agg()
1172 grp->slot_shift); in qfq_choose_next_agg()
1175 if (grp->S == roundedS) in qfq_choose_next_agg()
1177 grp->S = roundedS; in qfq_choose_next_agg()
1178 grp->F = roundedS + (2ULL << grp->slot_shift); in qfq_choose_next_agg()
1179 __clear_bit(grp->index, &q->bitmaps[ER]); in qfq_choose_next_agg()
1180 s = qfq_calc_state(q, grp); in qfq_choose_next_agg()
1181 __set_bit(grp->index, &q->bitmaps[s]); in qfq_choose_next_agg()
1184 qfq_unblock_groups(q, grp->index, old_F); in qfq_choose_next_agg()
1263 struct qfq_group *grp = agg->grp; in qfq_schedule_agg() local
1267 roundedS = qfq_round_down(agg->S, grp->slot_shift); in qfq_schedule_agg()
1278 if (grp->full_slots) { in qfq_schedule_agg()
1279 if (!qfq_gt(grp->S, agg->S)) in qfq_schedule_agg()
1283 qfq_slot_rotate(grp, roundedS); in qfq_schedule_agg()
1285 __clear_bit(grp->index, &q->bitmaps[IR]); in qfq_schedule_agg()
1286 __clear_bit(grp->index, &q->bitmaps[IB]); in qfq_schedule_agg()
1291 grp->S = roundedS; in qfq_schedule_agg()
1292 grp->F = roundedS + (2ULL << grp->slot_shift); in qfq_schedule_agg()
1293 s = qfq_calc_state(q, grp); in qfq_schedule_agg()
1294 __set_bit(grp->index, &q->bitmaps[s]); in qfq_schedule_agg()
1303 qfq_slot_insert(grp, agg, roundedS); in qfq_schedule_agg()
1322 static void qfq_slot_remove(struct qfq_sched *q, struct qfq_group *grp, in qfq_slot_remove() argument
1328 roundedS = qfq_round_down(agg->S, grp->slot_shift); in qfq_slot_remove()
1329 offset = (roundedS - grp->S) >> grp->slot_shift; in qfq_slot_remove()
1331 i = (grp->front + offset) % QFQ_MAX_SLOTS; in qfq_slot_remove()
1334 if (hlist_empty(&grp->slots[i])) in qfq_slot_remove()
1335 __clear_bit(offset, &grp->full_slots); in qfq_slot_remove()
1347 struct qfq_group *grp = agg->grp; in qfq_deactivate_agg() local
1359 qfq_slot_remove(q, grp, agg); in qfq_deactivate_agg()
1361 if (!grp->full_slots) { in qfq_deactivate_agg()
1362 __clear_bit(grp->index, &q->bitmaps[IR]); in qfq_deactivate_agg()
1363 __clear_bit(grp->index, &q->bitmaps[EB]); in qfq_deactivate_agg()
1364 __clear_bit(grp->index, &q->bitmaps[IB]); in qfq_deactivate_agg()
1366 if (test_bit(grp->index, &q->bitmaps[ER]) && in qfq_deactivate_agg()
1367 !(q->bitmaps[ER] & ~((1UL << grp->index) - 1))) { in qfq_deactivate_agg()
1368 mask = q->bitmaps[ER] & ((1UL << grp->index) - 1); in qfq_deactivate_agg()
1376 __clear_bit(grp->index, &q->bitmaps[ER]); in qfq_deactivate_agg()
1377 } else if (hlist_empty(&grp->slots[grp->front])) { in qfq_deactivate_agg()
1378 agg = qfq_slot_scan(grp); in qfq_deactivate_agg()
1379 roundedS = qfq_round_down(agg->S, grp->slot_shift); in qfq_deactivate_agg()
1380 if (grp->S != roundedS) { in qfq_deactivate_agg()
1381 __clear_bit(grp->index, &q->bitmaps[ER]); in qfq_deactivate_agg()
1382 __clear_bit(grp->index, &q->bitmaps[IR]); in qfq_deactivate_agg()
1383 __clear_bit(grp->index, &q->bitmaps[EB]); in qfq_deactivate_agg()
1384 __clear_bit(grp->index, &q->bitmaps[IB]); in qfq_deactivate_agg()
1385 grp->S = roundedS; in qfq_deactivate_agg()
1386 grp->F = roundedS + (2ULL << grp->slot_shift); in qfq_deactivate_agg()
1387 s = qfq_calc_state(q, grp); in qfq_deactivate_agg()
1388 __set_bit(grp->index, &q->bitmaps[s]); in qfq_deactivate_agg()
1405 struct qfq_group *grp; in qfq_init_qdisc() local
1428 grp = &q->groups[i]; in qfq_init_qdisc()
1429 grp->index = i; in qfq_init_qdisc()
1430 grp->slot_shift = q->min_slot_shift + i; in qfq_init_qdisc()
1432 INIT_HLIST_HEAD(&grp->slots[j]); in qfq_init_qdisc()