Lines Matching defs:agg

27     http://algo.ing.unimo.it/people/paolo/agg-sched/agg-sched.pdf
140 struct qfq_aggregate *agg; /* Parent aggregate. */
259 static void qfq_init_agg(struct qfq_sched *q, struct qfq_aggregate *agg,
262 INIT_LIST_HEAD(&agg->active);
263 hlist_add_head(&agg->nonfull_next, &q->nonfull_aggs);
265 agg->lmax = lmax;
266 agg->class_weight = weight;
272 struct qfq_aggregate *agg;
274 hlist_for_each_entry(agg, &q->nonfull_aggs, nonfull_next)
275 if (agg->lmax == lmax && agg->class_weight == weight)
276 return agg;
283 static void qfq_update_agg(struct qfq_sched *q, struct qfq_aggregate *agg,
289 hlist_del_init(&agg->nonfull_next);
291 if (agg->num_classes > new_num_classes &&
292 new_num_classes == q->max_agg_classes - 1) /* agg no more full */
293 hlist_add_head(&agg->nonfull_next, &q->nonfull_aggs);
296 * agg->initial_budget > agg->budgetmax
299 agg->budgetmax = new_num_classes * agg->lmax;
300 new_agg_weight = agg->class_weight * new_num_classes;
301 agg->inv_w = ONE_FP/new_agg_weight;
303 if (agg->grp == NULL) {
304 int i = qfq_calc_index(agg->inv_w, agg->budgetmax,
306 agg->grp = &q->groups[i];
310 (int) agg->class_weight * (new_num_classes - agg->num_classes);
313 agg->num_classes = new_num_classes;
318 struct qfq_aggregate *agg,
321 cl->agg = agg;
323 qfq_update_agg(q, agg, agg->num_classes+1);
325 list_add_tail(&cl->alist, &agg->active);
326 if (list_first_entry(&agg->active, struct qfq_class, alist) ==
327 cl && q->in_serv_agg != agg) /* agg was inactive */
328 qfq_activate_agg(q, agg, enqueue); /* schedule agg */
334 static void qfq_destroy_agg(struct qfq_sched *q, struct qfq_aggregate *agg)
336 hlist_del_init(&agg->nonfull_next);
337 q->wsum -= agg->class_weight;
341 if (q->in_serv_agg == agg)
343 kfree(agg);
349 struct qfq_aggregate *agg = cl->agg;
353 if (list_empty(&agg->active)) /* agg is now inactive */
354 qfq_deactivate_agg(q, agg);
360 struct qfq_aggregate *agg = cl->agg;
362 cl->agg = NULL;
363 if (agg->num_classes == 1) { /* agg being emptied, destroy it */
364 qfq_destroy_agg(q, agg);
367 qfq_update_agg(q, agg, agg->num_classes-1);
447 lmax == cl->agg->lmax &&
448 weight == cl->agg->class_weight)
451 delta_w = weight - (cl ? cl->agg->class_weight : 0);
630 if (nla_put_u32(skb, TCA_QFQ_WEIGHT, cl->agg->class_weight) ||
631 nla_put_u32(skb, TCA_QFQ_LMAX, cl->agg->lmax))
648 xstats.weight = cl->agg->class_weight;
649 xstats.lmax = cl->agg->lmax;
830 * The index of the slot in which the input aggregate agg is to be
839 * happens to postpone the service of agg unjustly, i.e., it never
843 * the timestamps of agg are low enough that the slot index is never
845 * guarantee if it happens to unjustly postpone the service of agg, or
855 * the timestamps of agg, if needed, so as to guarantee that the slot
859 * fact, in case of no out-of-order service, the timestamps of agg
864 * however waited for the service of agg before being served.
867 * for agg is a recent change of the parameters of some class. If the
884 static void qfq_slot_insert(struct qfq_group *grp, struct qfq_aggregate *agg,
893 agg->S -= deltaS;
894 agg->F -= deltaS;
900 hlist_add_head(&agg->next, &grp->slots[i]);
916 struct qfq_aggregate *agg = qfq_slot_head(grp);
918 BUG_ON(!agg);
919 hlist_del(&agg->next);
982 static struct sk_buff *agg_dequeue(struct qfq_aggregate *agg,
995 cl->deficit += agg->lmax;
996 list_move_tail(&cl->alist, &agg->active);
1002 static inline struct sk_buff *qfq_peek_skb(struct qfq_aggregate *agg,
1008 *cl = list_first_entry(&agg->active, struct qfq_class, alist);
1019 static inline void charge_actual_service(struct qfq_aggregate *agg)
1023 * agg, it may happen that
1024 * agg->initial_budget - agg->budget > agg->bugdetmax
1026 u32 service_received = min(agg->budgetmax,
1027 agg->initial_budget - agg->budget);
1029 agg->F = agg->S + (u64)service_received * agg->inv_w;
1044 static void qfq_update_start(struct qfq_sched *q, struct qfq_aggregate *agg)
1048 int slot_shift = agg->grp->slot_shift;
1050 roundedF = qfq_round_down(agg->F, slot_shift);
1053 if (!qfq_gt(agg->F, q->V) || qfq_gt(roundedF, limit)) {
1055 mask = mask_from(q->bitmaps[ER], agg->grp->index);
1060 agg->S = next->F;
1062 agg->S = limit;
1066 agg->S = q->V;
1068 agg->S = agg->F;
1071 /* Update the timestamps of agg before scheduling/rescheduling it for
1072 * service. In particular, assign to agg->F its maximum possible
1078 struct qfq_aggregate *agg, enum update_reason reason)
1081 qfq_update_start(q, agg);
1082 else /* just charge agg for the service received */
1083 agg->S = agg->F;
1085 agg->F = agg->S + (u64)agg->budgetmax * agg->inv_w;
1088 static void qfq_schedule_agg(struct qfq_sched *q, struct qfq_aggregate *agg);
1096 /* next-packet len, 0 means no more active classes in in-service agg */
1177 struct qfq_aggregate *agg, *new_front_agg;
1189 agg = qfq_slot_head(grp);
1191 /* agg starts to be served, remove it from schedule */
1204 return agg;
1214 return agg;
1223 struct qfq_aggregate *agg;
1236 if (unlikely(cl->agg->lmax < len)) {
1238 cl->agg->lmax, len, cl->common.classid);
1239 err = qfq_change_agg(sch, cl, cl->agg->class_weight, len);
1263 agg = cl->agg;
1267 list_first_entry(&agg->active, struct qfq_class, alist)
1269 list_move_tail(&cl->alist, &agg->active);
1275 cl->deficit = agg->lmax;
1276 list_add_tail(&cl->alist, &agg->active);
1278 if (list_first_entry(&agg->active, struct qfq_class, alist) != cl ||
1279 q->in_serv_agg == agg)
1282 qfq_activate_agg(q, agg, enqueue);
1290 static void qfq_schedule_agg(struct qfq_sched *q, struct qfq_aggregate *agg)
1292 struct qfq_group *grp = agg->grp;
1296 roundedS = qfq_round_down(agg->S, grp->slot_shift);
1299 * Insert agg in the correct bucket.
1300 * If agg->S >= grp->S we don't need to adjust the
1308 if (!qfq_gt(grp->S, agg->S))
1311 /* create a slot for this agg->S */
1327 (unsigned long long) agg->S,
1328 (unsigned long long) agg->F,
1332 qfq_slot_insert(grp, agg, roundedS);
1336 /* Update agg ts and schedule agg for service */
1337 static void qfq_activate_agg(struct qfq_sched *q, struct qfq_aggregate *agg,
1340 agg->initial_budget = agg->budget = agg->budgetmax; /* recharge budg. */
1342 qfq_update_agg_ts(q, agg, reason);
1344 q->in_serv_agg = agg; /* start serving this aggregate */
1345 /* update V: to be in service, agg must be eligible */
1346 q->oldV = q->V = agg->S;
1347 } else if (agg != q->in_serv_agg)
1348 qfq_schedule_agg(q, agg);
1352 struct qfq_aggregate *agg)
1357 roundedS = qfq_round_down(agg->S, grp->slot_shift);
1362 hlist_del(&agg->next);
1374 static void qfq_deactivate_agg(struct qfq_sched *q, struct qfq_aggregate *agg)
1376 struct qfq_group *grp = agg->grp;
1381 if (agg == q->in_serv_agg) {
1382 charge_actual_service(agg);
1387 agg->F = agg->S;
1388 qfq_slot_remove(q, grp, agg);
1407 agg = qfq_slot_scan(grp);
1408 roundedS = qfq_round_down(agg->S, grp->slot_shift);