4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
18 #include <sys/socket.h>
19 #include <netinet/in.h>
20 #include <arpa/inet.h>
26 static void explain(void)
28 fprintf(stderr, "Usage: ... <[p|b]fifo | pfifo_head_drop> [ limit NUMBER ]\n");
31 static int fifo_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
34 struct tc_fifo_qopt opt;
35 memset(&opt, 0, sizeof(opt));
38 if (strcmp(*argv, "limit") == 0) {
40 if (get_size(&opt.limit, *argv)) {
41 fprintf(stderr, "Illegal \"limit\"\n");
45 } else if (strcmp(*argv, "help") == 0) {
49 fprintf(stderr, "What is \"%s\"?\n", *argv);
57 addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
61 static int fifo_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
63 struct tc_fifo_qopt *qopt;
68 if (RTA_PAYLOAD(opt) < sizeof(*qopt))
71 if (strcmp(qu->id, "bfifo") == 0) {
73 fprintf(f, "limit %s", sprint_size(qopt->limit, b1));
75 fprintf(f, "limit %up", qopt->limit);
80 struct qdisc_util bfifo_qdisc_util = {
82 .parse_qopt = fifo_parse_opt,
83 .print_qopt = fifo_print_opt,
86 struct qdisc_util pfifo_qdisc_util = {
88 .parse_qopt = fifo_parse_opt,
89 .print_qopt = fifo_print_opt,
92 struct qdisc_util pfifo_head_drop_qdisc_util = {
93 .id = "pfifo_head_drop",
94 .parse_qopt = fifo_parse_opt,
95 .print_qopt = fifo_print_opt,
98 extern int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
99 struct qdisc_util pfifo_fast_qdisc_util = {
101 .print_qopt = prio_print_opt,