]>
git.proxmox.com Git - mirror_iproute2.git/blob - tc/q_sfq.c
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: ... sfq [ limit NUMBER ] [ perturb SECS ] [ quantum BYTES ]\n");
31 #define usage() return(-1)
33 static int sfq_parse_opt(struct qdisc_util
*qu
, int argc
, char **argv
, struct nlmsghdr
*n
)
36 struct tc_sfq_qopt opt
;
38 memset(&opt
, 0, sizeof(opt
));
41 if (strcmp(*argv
, "quantum") == 0) {
43 if (get_size(&opt
.quantum
, *argv
)) {
44 fprintf(stderr
, "Illegal \"limit\"\n");
48 } else if (strcmp(*argv
, "perturb") == 0) {
50 if (get_integer(&opt
.perturb_period
, *argv
, 0)) {
51 fprintf(stderr
, "Illegal \"perturb\"\n");
55 } else if (strcmp(*argv
, "limit") == 0) {
57 if (get_u32(&opt
.limit
, *argv
, 0)) {
58 fprintf(stderr
, "Illegal \"limit\"\n");
62 fprintf(stderr
, "Illegal \"limit\", must be > 1\n");
66 } else if (strcmp(*argv
, "help") == 0) {
70 fprintf(stderr
, "What is \"%s\"?\n", *argv
);
78 addattr_l(n
, 1024, TCA_OPTIONS
, &opt
, sizeof(opt
));
82 static int sfq_print_opt(struct qdisc_util
*qu
, FILE *f
, struct rtattr
*opt
)
84 struct tc_sfq_qopt
*qopt
;
90 if (RTA_PAYLOAD(opt
) < sizeof(*qopt
))
93 fprintf(f
, "limit %up ", qopt
->limit
);
94 fprintf(f
, "quantum %s ", sprint_size(qopt
->quantum
, b1
));
96 fprintf(f
, "flows %u/%u ", qopt
->flows
, qopt
->divisor
);
98 if (qopt
->perturb_period
)
99 fprintf(f
, "perturb %dsec ", qopt
->perturb_period
);
103 static int sfq_print_xstats(struct qdisc_util
*qu
, FILE *f
, struct rtattr
*xstats
)
109 struct qdisc_util sfq_util
= {