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()
745 static int qfq_calc_state(struct qfq_sched *q, const struct qfq_group *grp) in qfq_calc_state() argument
748 unsigned int state = qfq_gt(grp->S, q->V); in qfq_calc_state()
749 unsigned long mask = mask_from(q->bitmaps[ER], grp->index); in qfq_calc_state()
754 if (qfq_gt(grp->F, next->F)) in qfq_calc_state()
875 static void qfq_slot_insert(struct qfq_group *grp, struct qfq_aggregate *agg, in qfq_slot_insert() argument
878 u64 slot = (roundedS - grp->S) >> grp->slot_shift; in qfq_slot_insert()
882 u64 deltaS = roundedS - grp->S - in qfq_slot_insert()
883 ((u64)(QFQ_MAX_SLOTS - 2)<<grp->slot_shift); in qfq_slot_insert()
889 i = (grp->front + slot) % QFQ_MAX_SLOTS; in qfq_slot_insert()
891 hlist_add_head(&agg->next, &grp->slots[i]); in qfq_slot_insert()
892 __set_bit(slot, &grp->full_slots); in qfq_slot_insert()
896 static struct qfq_aggregate *qfq_slot_head(struct qfq_group *grp) in qfq_slot_head() argument
898 return hlist_entry(grp->slots[grp->front].first, in qfq_slot_head()
905 static void qfq_front_slot_remove(struct qfq_group *grp) in qfq_front_slot_remove() argument
907 struct qfq_aggregate *agg = qfq_slot_head(grp); in qfq_front_slot_remove()
911 if (hlist_empty(&grp->slots[grp->front])) in qfq_front_slot_remove()
912 __clear_bit(0, &grp->full_slots); in qfq_front_slot_remove()
920 static struct qfq_aggregate *qfq_slot_scan(struct qfq_group *grp) in qfq_slot_scan() argument
925 grp->index, grp->full_slots); in qfq_slot_scan()
927 if (grp->full_slots == 0) in qfq_slot_scan()
930 i = __ffs(grp->full_slots); /* zero based */ in qfq_slot_scan()
932 grp->front = (grp->front + i) % QFQ_MAX_SLOTS; in qfq_slot_scan()
933 grp->full_slots >>= i; in qfq_slot_scan()
936 return qfq_slot_head(grp); in qfq_slot_scan()
948 static void qfq_slot_rotate(struct qfq_group *grp, u64 roundedS) in qfq_slot_rotate() argument
950 unsigned int i = (grp->S - roundedS) >> grp->slot_shift; in qfq_slot_rotate()
952 grp->full_slots <<= i; in qfq_slot_rotate()
953 grp->front = (grp->front - i) % QFQ_MAX_SLOTS; in qfq_slot_rotate()
958 struct qfq_group *grp; in qfq_update_eligible() local
964 grp = qfq_ffs(q, ineligible); in qfq_update_eligible()
965 if (qfq_gt(grp->S, q->V)) in qfq_update_eligible()
966 q->V = grp->S; in qfq_update_eligible()
1034 int slot_shift = agg->grp->slot_shift; in qfq_update_start()
1041 mask = mask_from(q->bitmaps[ER], agg->grp->index); in qfq_update_start()
1155 struct qfq_group *grp; in qfq_choose_next_agg() local
1165 grp = qfq_ffs(q, q->bitmaps[ER]); in qfq_choose_next_agg()
1166 old_F = grp->F; in qfq_choose_next_agg()
1168 agg = qfq_slot_head(grp); in qfq_choose_next_agg()
1171 qfq_front_slot_remove(grp); in qfq_choose_next_agg()
1173 new_front_agg = qfq_slot_scan(grp); in qfq_choose_next_agg()
1176 __clear_bit(grp->index, &q->bitmaps[ER]); in qfq_choose_next_agg()
1179 grp->slot_shift); in qfq_choose_next_agg()
1182 if (grp->S == roundedS) in qfq_choose_next_agg()
1184 grp->S = roundedS; in qfq_choose_next_agg()
1185 grp->F = roundedS + (2ULL << grp->slot_shift); in qfq_choose_next_agg()
1186 __clear_bit(grp->index, &q->bitmaps[ER]); in qfq_choose_next_agg()
1187 s = qfq_calc_state(q, grp); in qfq_choose_next_agg()
1188 __set_bit(grp->index, &q->bitmaps[s]); in qfq_choose_next_agg()
1191 qfq_unblock_groups(q, grp->index, old_F); in qfq_choose_next_agg()
1271 struct qfq_group *grp = agg->grp; in qfq_schedule_agg() local
1275 roundedS = qfq_round_down(agg->S, grp->slot_shift); in qfq_schedule_agg()
1286 if (grp->full_slots) { in qfq_schedule_agg()
1287 if (!qfq_gt(grp->S, agg->S)) in qfq_schedule_agg()
1291 qfq_slot_rotate(grp, roundedS); in qfq_schedule_agg()
1293 __clear_bit(grp->index, &q->bitmaps[IR]); in qfq_schedule_agg()
1294 __clear_bit(grp->index, &q->bitmaps[IB]); in qfq_schedule_agg()
1299 grp->S = roundedS; in qfq_schedule_agg()
1300 grp->F = roundedS + (2ULL << grp->slot_shift); in qfq_schedule_agg()
1301 s = qfq_calc_state(q, grp); in qfq_schedule_agg()
1302 __set_bit(grp->index, &q->bitmaps[s]); in qfq_schedule_agg()
1311 qfq_slot_insert(grp, agg, roundedS); in qfq_schedule_agg()
1330 static void qfq_slot_remove(struct qfq_sched *q, struct qfq_group *grp, in qfq_slot_remove() argument
1336 roundedS = qfq_round_down(agg->S, grp->slot_shift); in qfq_slot_remove()
1337 offset = (roundedS - grp->S) >> grp->slot_shift; in qfq_slot_remove()
1339 i = (grp->front + offset) % QFQ_MAX_SLOTS; in qfq_slot_remove()
1342 if (hlist_empty(&grp->slots[i])) in qfq_slot_remove()
1343 __clear_bit(offset, &grp->full_slots); in qfq_slot_remove()
1355 struct qfq_group *grp = agg->grp; in qfq_deactivate_agg() local
1367 qfq_slot_remove(q, grp, agg); in qfq_deactivate_agg()
1369 if (!grp->full_slots) { in qfq_deactivate_agg()
1370 __clear_bit(grp->index, &q->bitmaps[IR]); in qfq_deactivate_agg()
1371 __clear_bit(grp->index, &q->bitmaps[EB]); in qfq_deactivate_agg()
1372 __clear_bit(grp->index, &q->bitmaps[IB]); in qfq_deactivate_agg()
1374 if (test_bit(grp->index, &q->bitmaps[ER]) && in qfq_deactivate_agg()
1375 !(q->bitmaps[ER] & ~((1UL << grp->index) - 1))) { in qfq_deactivate_agg()
1376 mask = q->bitmaps[ER] & ((1UL << grp->index) - 1); in qfq_deactivate_agg()
1384 __clear_bit(grp->index, &q->bitmaps[ER]); in qfq_deactivate_agg()
1385 } else if (hlist_empty(&grp->slots[grp->front])) { in qfq_deactivate_agg()
1386 agg = qfq_slot_scan(grp); in qfq_deactivate_agg()
1387 roundedS = qfq_round_down(agg->S, grp->slot_shift); in qfq_deactivate_agg()
1388 if (grp->S != roundedS) { in qfq_deactivate_agg()
1389 __clear_bit(grp->index, &q->bitmaps[ER]); in qfq_deactivate_agg()
1390 __clear_bit(grp->index, &q->bitmaps[IR]); in qfq_deactivate_agg()
1391 __clear_bit(grp->index, &q->bitmaps[EB]); in qfq_deactivate_agg()
1392 __clear_bit(grp->index, &q->bitmaps[IB]); in qfq_deactivate_agg()
1393 grp->S = roundedS; in qfq_deactivate_agg()
1394 grp->F = roundedS + (2ULL << grp->slot_shift); in qfq_deactivate_agg()
1395 s = qfq_calc_state(q, grp); in qfq_deactivate_agg()
1396 __set_bit(grp->index, &q->bitmaps[s]); in qfq_deactivate_agg()
1413 struct qfq_group *grp; in qfq_init_qdisc() local
1436 grp = &q->groups[i]; in qfq_init_qdisc()
1437 grp->index = i; in qfq_init_qdisc()
1438 grp->slot_shift = q->min_slot_shift + i; in qfq_init_qdisc()
1440 INIT_HLIST_HEAD(&grp->slots[j]); in qfq_init_qdisc()