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 [ limit NUMBER ]\n");
31 #define usage() return(-1)
33 static int fifo_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n)
36 struct tc_fifo_qopt opt;
37 memset(&opt, 0, sizeof(opt));
40 if (strcmp(*argv, "limit") == 0) {
42 if (get_size(&opt.limit, *argv)) {
43 fprintf(stderr, "Illegal \"limit\"\n");
47 } else if (strcmp(*argv, "help") == 0) {
51 fprintf(stderr, "What is \"%s\"?\n", *argv);
59 addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
63 static int fifo_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
65 struct tc_fifo_qopt *qopt;
70 if (RTA_PAYLOAD(opt) < sizeof(*qopt))
73 if (strcmp(qu->id, "bfifo") == 0) {
75 fprintf(f, "limit %s", sprint_size(qopt->limit, b1));
77 fprintf(f, "limit %up", qopt->limit);
82 struct qdisc_util bfifo_qdisc_util = {
84 .parse_qopt = fifo_parse_opt,
85 .print_qopt = fifo_print_opt,
88 struct qdisc_util pfifo_qdisc_util = {
90 .parse_qopt = fifo_parse_opt,
91 .print_qopt = fifo_print_opt,
94 extern int prio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt);
95 struct qdisc_util pfifo_fast_qdisc_util = {
97 .print_qopt = prio_print_opt,