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>
17 #include <sys/socket.h>
18 #include <netinet/in.h>
19 #include <arpa/inet.h>
25 static void explain(void)
27 fprintf(stderr
, "Usage: ... <[p|b]fifo | pfifo_head_drop> [ limit NUMBER ]\n");
30 static int fifo_parse_opt(struct qdisc_util
*qu
, int argc
, char **argv
, struct nlmsghdr
*n
, const char *dev
)
33 struct tc_fifo_qopt opt
= {};
36 if (strcmp(*argv
, "limit") == 0) {
38 if (get_size(&opt
.limit
, *argv
)) {
39 fprintf(stderr
, "%s: Illegal value for \"limit\": \"%s\"\n", qu
->id
, *argv
);
43 } else if (strcmp(*argv
, "help") == 0) {
47 fprintf(stderr
, "%s: unknown parameter \"%s\"\n", qu
->id
, *argv
);
55 addattr_l(n
, 1024, TCA_OPTIONS
, &opt
, sizeof(opt
));
59 static int fifo_print_opt(struct qdisc_util
*qu
, FILE *f
, struct rtattr
*opt
)
61 struct tc_fifo_qopt
*qopt
;
66 if (RTA_PAYLOAD(opt
) < sizeof(*qopt
))
69 if (strcmp(qu
->id
, "bfifo") == 0) {
71 fprintf(f
, "limit %s", sprint_size(qopt
->limit
, b1
));
73 fprintf(f
, "limit %up", qopt
->limit
);
78 struct qdisc_util bfifo_qdisc_util
= {
80 .parse_qopt
= fifo_parse_opt
,
81 .print_qopt
= fifo_print_opt
,
84 struct qdisc_util pfifo_qdisc_util
= {
86 .parse_qopt
= fifo_parse_opt
,
87 .print_qopt
= fifo_print_opt
,
90 struct qdisc_util pfifo_head_drop_qdisc_util
= {
91 .id
= "pfifo_head_drop",
92 .parse_qopt
= fifo_parse_opt
,
93 .print_qopt
= fifo_print_opt
,
96 extern int prio_print_opt(struct qdisc_util
*qu
, FILE *f
, struct rtattr
*opt
);
97 struct qdisc_util pfifo_fast_qdisc_util
= {
99 .print_qopt
= prio_print_opt
,