On Mon, May 15, 2017 at 20:13 +0200, Mike Belopuhov wrote:
> Here are some bits to display flow queues alongside H-FSC ones.
> It's a bit hackish in a way I switch the "bandwidth" field to
> the "bandwidth or flows" and then use node->qstats.data.period
> because I'm too lazy to change the pfctl_queue_node to include
> a union... This will require changes in the whole file instead
> of just an XXX comment. Does it bother anybody?
>
> I also make use of a presently empty field "SCH" to display the
> queue management policy (flow or fifo) which is not strictly a
> scheduler, but it will become descriptive when I'll [hopefully]
> hook up FQ-CoDel to HFSC so that it would be an HFSC class with
> its queue managed by the FQ-CoDel. This will distinguish such
> queues from the regular HFSC ones that use a FIFO queue.
>
> OK?
>
No objections?
> diff --git usr.bin/systat/pftop.c usr.bin/systat/pftop.c
> index 673a69df6a6..d19affeae90 100644
> --- usr.bin/systat/pftop.c
> +++ usr.bin/systat/pftop.c
> @@ -146,11 +146,11 @@ field_def fields[] = {
> {"RATE", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0},
> {"AVG", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0},
> {"PEAK", 5, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0},
> {"ANCHOR", 6, 16, 1, FLD_ALIGN_LEFT, -1, 0, 0},
> {"QUEUE", 15, 30, 1, FLD_ALIGN_LEFT, -1, 0, 0, 0},
> - {"BW", 4, 5, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0},
> + {"BW/FL", 4, 5, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0},
> {"SCH", 3, 4, 1, FLD_ALIGN_LEFT, -1, 0, 0, 0},
> {"DROP_P", 6, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0},
> {"DROP_B", 6, 8, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0},
> {"QLEN", 4, 4, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0},
> {"BORROW", 4, 6, 1, FLD_ALIGN_RIGHT, -1, 0, 0, 0},
> @@ -1621,16 +1621,28 @@ print_queue_node(struct pfctl_queue_node *node)
> tbprintf(" on %s ", node->qs.ifname);
> print_fld_tb(FLD_QUEUE);
>
> // XXX: missing min, max, burst
> tb_start();
> - rate = node->qs.linkshare.m2.absolute;
> - for (i = 0; rate >= 1000 && i <= 3; i++)
> - rate /= 1000;
> - tbprintf("%u%c", rate, unit[i]);
> + if (node->qs.flags & PFQS_FLOWQUEUE)
> + /*
> + * XXX We're abusing the fact that 'flows' in
> + * the fqcodel_stats structure is at the same
> + * spot as the 'period' in hfsc_class_stats.
> + */
> + tbprintf("%u", node->qstats.data.period);
> + else {
> + rate = node->qs.linkshare.m2.absolute;
> + for (i = 0; rate >= 1000 && i <= 3; i++)
> + rate /= 1000;
> + tbprintf("%u%c", rate, unit[i]);
> + }
> print_fld_tb(FLD_BANDW);
>
> + print_fld_str(FLD_SCHED, node->qs.flags & PFQS_FLOWQUEUE ?
> + "flow" : "fifo");
> +
> if (node->qstats.valid && node->qstats_last.valid)
> interval = calc_interval(&node->qstats.timestamp,
> &node->qstats_last.timestamp);
> else
> interval = 0;