]>
Commit | Line | Data |
---|---|---|
fe1a34fa AD |
1 | /* |
2 | * q_multiq.c Multiqueue aware qdisc | |
3 | * | |
4 | * Copyright (c) 2008, Intel Corporation. | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms and conditions of the GNU General Public License, | |
8 | * version 2, as published by the Free Software Foundation. | |
9 | * | |
10 | * This program is distributed in the hope it will be useful, but WITHOUT | |
11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
13 | * more details. | |
14 | * | |
4d98ab00 SH |
15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, see <http://www.gnu.org/licenses>. | |
fe1a34fa AD |
17 | * |
18 | * Author: Alexander Duyck <alexander.h.duyck@intel.com> | |
19 | * | |
20 | * Original Authors: PJ Waskiewicz, <peter.p.waskiewicz.jr@intel.com> (RR) | |
3d0b7439 | 21 | * Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> (from PRIO) |
fe1a34fa AD |
22 | * |
23 | */ | |
24 | ||
25 | #include <stdio.h> | |
26 | #include <stdlib.h> | |
27 | #include <unistd.h> | |
fe1a34fa AD |
28 | #include <fcntl.h> |
29 | #include <sys/socket.h> | |
30 | #include <netinet/in.h> | |
31 | #include <arpa/inet.h> | |
32 | #include <string.h> | |
33 | ||
34 | #include "utils.h" | |
35 | #include "tc_util.h" | |
36 | ||
37 | static void explain(void) | |
38 | { | |
39 | fprintf(stderr, "Usage: ... multiq [help]\n"); | |
40 | } | |
41 | ||
fe1a34fa | 42 | static int multiq_parse_opt(struct qdisc_util *qu, int argc, char **argv, |
927e3cfb | 43 | struct nlmsghdr *n, const char *dev) |
fe1a34fa | 44 | { |
82ed9ffa | 45 | struct tc_multiq_qopt opt = {}; |
fe1a34fa | 46 | |
5582c0cf | 47 | if (argc) { |
fe1a34fa AD |
48 | if (strcmp(*argv, "help") == 0) { |
49 | explain(); | |
50 | return -1; | |
51 | } else { | |
52 | fprintf(stderr, "What is \"%s\"?\n", *argv); | |
53 | explain(); | |
54 | return -1; | |
55 | } | |
fe1a34fa AD |
56 | } |
57 | ||
58 | addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)); | |
59 | return 0; | |
60 | } | |
61 | ||
d1f28cf1 | 62 | static int multiq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) |
fe1a34fa AD |
63 | { |
64 | struct tc_multiq_qopt *qopt; | |
65 | ||
66 | if (opt == NULL) | |
67 | return 0; | |
68 | if (RTA_PAYLOAD(opt) < sizeof(*qopt)) | |
69 | return 0; | |
70 | ||
71 | qopt = RTA_DATA(opt); | |
72 | ||
73 | fprintf(f, "bands %u/%u ", qopt->bands, qopt->max_bands); | |
74 | ||
75 | return 0; | |
76 | } | |
77 | ||
78 | struct qdisc_util multiq_qdisc_util = { | |
32a121cb | 79 | .id = "multiq", |
fe1a34fa AD |
80 | .parse_qopt = multiq_parse_opt, |
81 | .print_qopt = multiq_print_opt, | |
82 | }; |