Lines Matching +full:pa +full:- +full:stats

100 		return (-1);  in pfctl_show_altq()
104 return (-1); in pfctl_show_altq()
108 for (node = root; node != NULL; node = node->next) { in pfctl_show_altq()
109 if (iface != NULL && strcmp(node->altq.ifname, iface)) in pfctl_show_altq()
122 if ((nodes = pfctl_update_qstats(dev, &root)) == -1) in pfctl_show_altq()
123 return (-1); in pfctl_show_altq()
124 for (node = root; node != NULL; node = node->next) { in pfctl_show_altq()
125 if (iface != NULL && strcmp(node->altq.ifname, iface)) in pfctl_show_altq()
128 if (node->altq.local_flags & PFALTQ_FLAG_IF_REMOVED) in pfctl_show_altq()
142 struct pfioc_altq pa; local
148 memset(&pa, 0, sizeof(pa));
151 pa.version = PFIOC_ALTQ_VERSION;
152 if (ioctl(dev, DIOCGETALTQS, &pa)) {
154 return (-1);
158 if (pa.ticket != last_ticket && *root != NULL) {
162 last_ticket = pa.ticket;
164 mnr = pa.nr;
166 pa.nr = nr;
167 if (ioctl(dev, DIOCGETALTQ, &pa)) {
169 return (-1);
172 if ((pa.altq.qid > 0 || pa.altq.scheduler == ALTQT_CODEL) &&
173 !(pa.altq.local_flags & PFALTQ_FLAG_IF_REMOVED)) {
175 if (pa.altq.qid > 0) {
178 pq.ticket = pa.ticket;
181 pq.version = altq_stats_version(pa.altq.scheduler);
184 return (-1);
186 if ((node = pfctl_find_altq_node(*root, pa.altq.qname,
187 pa.altq.ifname)) != NULL) {
188 memcpy(&node->qstats.data, &qstats.data,
192 pfctl_insert_altq_node(root, pa.altq, qstats);
196 else if (pa.altq.local_flags & PFALTQ_FLAG_IF_REMOVED) {
198 if ((node = pfctl_find_altq_node(*root, pa.altq.qname,
199 pa.altq.ifname)) != NULL) {
200 memcpy(&node->qstats.data, &qstats.data,
204 pfctl_insert_altq_node(root, pa.altq, qstats);
221 memcpy(&node->altq, &altq, sizeof(struct pf_altq));
222 memcpy(&node->qstats, &qstats, sizeof(qstats));
223 node->next = node->children = NULL;
230 while (prev->next != NULL)
231 prev = prev->next;
232 prev->next = node;
239 if (parent->children == NULL)
240 parent->children = node;
242 struct pf_altq_node *prev = parent->children;
244 while (prev->next != NULL)
245 prev = prev->next;
246 prev->next = node;
258 for (node = root; node != NULL; node = node->next) {
259 if (!strcmp(node->altq.qname, qname)
260 && !(strcmp(node->altq.ifname, ifname)))
262 if (node->children != NULL) {
263 child = pfctl_find_altq_node(node->children, qname,
281 print_altq(&node->altq, level, NULL, NULL);
283 if (node->children != NULL) {
285 for (child = node->children; child != NULL;
286 child = child->next) {
287 printf("%s", child->altq.qname);
288 if (child->next != NULL)
300 node->altq.qid, node->altq.ifname,
301 rate2str((double)(node->altq.ifbandwidth)));
303 for (child = node->children; child != NULL;
304 child = child->next)
311 if (a->altq.qid == 0 && a->altq.scheduler != ALTQT_CODEL)
315 if (a->altq.local_flags & PFALTQ_FLAG_IF_REMOVED)
318 switch (a->altq.scheduler) {
320 print_cbqstats(a->qstats);
323 print_priqstats(a->qstats);
326 print_hfscstats(a->qstats);
329 print_fairqstats(a->qstats);
332 print_codelstats(a->qstats);
366 cur.data.codel_stats.stats.drop_cnt.packets,
368 cur.data.codel_stats.stats.drop_cnt.bytes);
446 if (node->children != NULL)
447 pfctl_free_altq_node(node->children);
449 node = node->next;
461 if (a->altq.qid == 0 && a->altq.scheduler != ALTQT_CODEL)
464 qs = &a->qstats;
465 n = qs->avgn;
467 switch (a->altq.scheduler) {
469 b = qs->data.cbq_stats.xmit_cnt.bytes;
470 p = qs->data.cbq_stats.xmit_cnt.packets;
473 b = qs->data.priq_stats.xmitcnt.bytes;
474 p = qs->data.priq_stats.xmitcnt.packets;
477 b = qs->data.hfsc_stats.xmit_cnt.bytes;
478 p = qs->data.hfsc_stats.xmit_cnt.packets;
481 b = qs->data.fairq_stats.xmit_cnt.bytes;
482 p = qs->data.fairq_stats.xmit_cnt.packets;
485 b = qs->data.codel_stats.cl_xmitcnt.bytes;
486 p = qs->data.codel_stats.cl_xmitcnt.packets;
495 qs->prev_bytes = b;
496 qs->prev_packets = p;
497 qs->avgn++;
501 if (b >= qs->prev_bytes)
502 qs->avg_bytes = ((qs->avg_bytes * (n - 1)) +
503 (b - qs->prev_bytes)) / n;
505 if (p >= qs->prev_packets)
506 qs->avg_packets = ((qs->avg_packets * (n - 1)) +
507 (p - qs->prev_packets)) / n;
509 qs->prev_bytes = b;
510 qs->prev_packets = p;
512 qs->avgn++;