osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 1 | /* |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 2 | * q_hfsc.c HFSC. |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 3 | * |
| 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. |
| 8 | * |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 9 | * Authors: Patrick McHardy, <kaber@trash.net> |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 10 | * |
| 11 | */ |
| 12 | |
| 13 | #include <stdio.h> |
| 14 | #include <stdlib.h> |
| 15 | #include <unistd.h> |
| 16 | #include <syslog.h> |
| 17 | #include <fcntl.h> |
| 18 | #include <sys/socket.h> |
| 19 | #include <netinet/in.h> |
| 20 | #include <arpa/inet.h> |
| 21 | #include <string.h> |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 22 | #include <math.h> |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 23 | |
| 24 | #include "utils.h" |
| 25 | #include "tc_util.h" |
| 26 | |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 27 | static int hfsc_get_sc(int *, char ***, struct tc_service_curve *); |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 28 | |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 29 | |
| 30 | static void |
| 31 | explain_qdisc(void) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 32 | { |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 33 | fprintf(stderr, |
| 34 | "Usage: ... hfsc [ default CLASSID ]\n" |
| 35 | "\n" |
| 36 | " default: default class for unclassified packets\n" |
| 37 | ); |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 38 | } |
| 39 | |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 40 | static void |
| 41 | explain_class(void) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 42 | { |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 43 | fprintf(stderr, |
net[shemminger]!shemminger | b7de67d | 2004-08-23 20:17:40 +0000 | [diff] [blame] | 44 | "Usage: ... hfsc [ [ rt SC ] [ ls SC ] | [ sc SC ] ] [ ul SC ]\n" |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 45 | "\n" |
Michal Soltys | 41f6004 | 2011-10-26 04:15:21 -0400 | [diff] [blame] | 46 | "SC := [ [ m1 BPS ] d SEC ] m2 BPS\n" |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 47 | "\n" |
| 48 | " m1 : slope of first segment\n" |
| 49 | " d : x-coordinate of intersection\n" |
| 50 | " m2 : slope of second segment\n" |
| 51 | "\n" |
| 52 | "Alternative format:\n" |
| 53 | "\n" |
| 54 | "SC := [ [ umax BYTE ] dmax SEC ] rate BPS\n" |
| 55 | "\n" |
| 56 | " umax : maximum unit of work\n" |
| 57 | " dmax : maximum delay\n" |
| 58 | " rate : rate\n" |
| 59 | "\n" |
Michal Soltys | 41f6004 | 2011-10-26 04:15:21 -0400 | [diff] [blame] | 60 | "Remarks:\n" |
| 61 | " - at least one of 'rt', 'ls' or 'sc' must be specified\n" |
| 62 | " - 'ul' can only be specified with 'ls' or 'sc'\n" |
| 63 | "\n" |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 64 | ); |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 65 | } |
| 66 | |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 67 | static void |
| 68 | explain1(char *arg) |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 69 | { |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 70 | fprintf(stderr, "HFSC: Illegal \"%s\"\n", arg); |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 71 | } |
| 72 | |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 73 | static int |
| 74 | hfsc_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nlmsghdr *n) |
| 75 | { |
| 76 | struct tc_hfsc_qopt qopt; |
| 77 | |
| 78 | memset(&qopt, 0, sizeof(qopt)); |
| 79 | |
| 80 | while (argc > 0) { |
| 81 | if (matches(*argv, "default") == 0) { |
| 82 | NEXT_ARG(); |
| 83 | if (qopt.defcls != 0) { |
| 84 | fprintf(stderr, "HFSC: Double \"default\"\n"); |
| 85 | return -1; |
| 86 | } |
| 87 | if (get_u16(&qopt.defcls, *argv, 16) < 0) { |
| 88 | explain1("default"); |
| 89 | return -1; |
| 90 | } |
| 91 | } else if (matches(*argv, "help") == 0) { |
| 92 | explain_qdisc(); |
| 93 | return -1; |
| 94 | } else { |
| 95 | fprintf(stderr, "HFSC: What is \"%s\" ?\n", *argv); |
| 96 | explain_qdisc(); |
| 97 | return -1; |
| 98 | } |
| 99 | argc--, argv++; |
| 100 | } |
| 101 | |
| 102 | addattr_l(n, 1024, TCA_OPTIONS, &qopt, sizeof(qopt)); |
| 103 | return 0; |
| 104 | } |
| 105 | |
| 106 | static int |
| 107 | hfsc_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) |
| 108 | { |
| 109 | struct tc_hfsc_qopt *qopt; |
| 110 | |
| 111 | if (opt == NULL) |
| 112 | return 0; |
| 113 | if (RTA_PAYLOAD(opt) < sizeof(*qopt)) |
| 114 | return -1; |
| 115 | qopt = RTA_DATA(opt); |
| 116 | |
| 117 | if (qopt->defcls != 0) |
| 118 | fprintf(f, "default %x ", qopt->defcls); |
| 119 | |
| 120 | return 0; |
| 121 | } |
| 122 | |
| 123 | static int |
| 124 | hfsc_print_xstats(struct qdisc_util *qu, FILE *f, struct rtattr *xstats) |
| 125 | { |
| 126 | struct tc_hfsc_stats *st; |
| 127 | |
| 128 | if (xstats == NULL) |
| 129 | return 0; |
| 130 | if (RTA_PAYLOAD(xstats) < sizeof(*st)) |
| 131 | return -1; |
| 132 | st = RTA_DATA(xstats); |
| 133 | |
| 134 | fprintf(f, " period %u ", st->period); |
| 135 | if (st->work != 0) |
net[shemminger]!shemminger | b906243 | 2005-01-17 23:28:16 +0000 | [diff] [blame] | 136 | fprintf(f, "work %llu bytes ", (unsigned long long) st->work); |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 137 | if (st->rtwork != 0) |
net[shemminger]!shemminger | b906243 | 2005-01-17 23:28:16 +0000 | [diff] [blame] | 138 | fprintf(f, "rtwork %llu bytes ", (unsigned long long) st->rtwork); |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 139 | fprintf(f, "level %u ", st->level); |
| 140 | fprintf(f, "\n"); |
| 141 | |
| 142 | return 0; |
| 143 | } |
| 144 | |
| 145 | static int |
| 146 | hfsc_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, |
Stephen Hemminger | 32a121c | 2016-03-21 11:48:36 -0700 | [diff] [blame] | 147 | struct nlmsghdr *n) |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 148 | { |
| 149 | struct tc_service_curve rsc, fsc, usc; |
| 150 | int rsc_ok, fsc_ok, usc_ok; |
| 151 | struct rtattr *tail; |
| 152 | |
| 153 | memset(&rsc, 0, sizeof(rsc)); |
| 154 | memset(&fsc, 0, sizeof(fsc)); |
| 155 | memset(&usc, 0, sizeof(usc)); |
| 156 | rsc_ok = fsc_ok = usc_ok = 0; |
| 157 | |
| 158 | while (argc > 0) { |
| 159 | if (matches(*argv, "rt") == 0) { |
| 160 | NEXT_ARG(); |
| 161 | if (hfsc_get_sc(&argc, &argv, &rsc) < 0) { |
| 162 | explain1("rt"); |
| 163 | return -1; |
| 164 | } |
| 165 | rsc_ok = 1; |
| 166 | } else if (matches(*argv, "ls") == 0) { |
| 167 | NEXT_ARG(); |
| 168 | if (hfsc_get_sc(&argc, &argv, &fsc) < 0) { |
| 169 | explain1("ls"); |
| 170 | return -1; |
| 171 | } |
| 172 | fsc_ok = 1; |
net[shemminger]!shemminger | b7de67d | 2004-08-23 20:17:40 +0000 | [diff] [blame] | 173 | } else if (matches(*argv, "sc") == 0) { |
| 174 | NEXT_ARG(); |
| 175 | if (hfsc_get_sc(&argc, &argv, &rsc) < 0) { |
| 176 | explain1("sc"); |
| 177 | return -1; |
| 178 | } |
| 179 | memcpy(&fsc, &rsc, sizeof(fsc)); |
| 180 | rsc_ok = 1; |
| 181 | fsc_ok = 1; |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 182 | } else if (matches(*argv, "ul") == 0) { |
| 183 | NEXT_ARG(); |
| 184 | if (hfsc_get_sc(&argc, &argv, &usc) < 0) { |
| 185 | explain1("ul"); |
| 186 | return -1; |
| 187 | } |
| 188 | usc_ok = 1; |
| 189 | } else if (matches(*argv, "help") == 0) { |
| 190 | explain_class(); |
| 191 | return -1; |
| 192 | } else { |
| 193 | fprintf(stderr, "HFSC: What is \"%s\" ?\n", *argv); |
| 194 | explain_class(); |
| 195 | return -1; |
| 196 | } |
| 197 | argc--, argv++; |
| 198 | } |
| 199 | |
| 200 | if (!(rsc_ok || fsc_ok || usc_ok)) { |
| 201 | fprintf(stderr, "HFSC: no parameters given\n"); |
| 202 | explain_class(); |
| 203 | return -1; |
| 204 | } |
| 205 | if (usc_ok && !fsc_ok) { |
Stephen Hemminger | 32a121c | 2016-03-21 11:48:36 -0700 | [diff] [blame] | 206 | fprintf(stderr, "HFSC: Upper-limit Service Curve without Link-Share Service Curve\n"); |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 207 | explain_class(); |
| 208 | return -1; |
| 209 | } |
| 210 | |
8!tgraf | 4a86fe1 | 2005-01-18 01:24:18 +0000 | [diff] [blame] | 211 | tail = NLMSG_TAIL(n); |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 212 | |
| 213 | addattr_l(n, 1024, TCA_OPTIONS, NULL, 0); |
| 214 | if (rsc_ok) |
| 215 | addattr_l(n, 1024, TCA_HFSC_RSC, &rsc, sizeof(rsc)); |
| 216 | if (fsc_ok) |
| 217 | addattr_l(n, 1024, TCA_HFSC_FSC, &fsc, sizeof(fsc)); |
| 218 | if (usc_ok) |
| 219 | addattr_l(n, 1024, TCA_HFSC_USC, &usc, sizeof(usc)); |
| 220 | |
8!tgraf | 4a86fe1 | 2005-01-18 01:24:18 +0000 | [diff] [blame] | 221 | tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail; |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 222 | return 0; |
| 223 | } |
| 224 | |
| 225 | static void |
| 226 | hfsc_print_sc(FILE *f, char *name, struct tc_service_curve *sc) |
| 227 | { |
| 228 | SPRINT_BUF(b1); |
| 229 | |
| 230 | fprintf(f, "%s ", name); |
| 231 | fprintf(f, "m1 %s ", sprint_rate(sc->m1, b1)); |
Patrick McHardy | 8f34caa | 2007-03-04 20:15:00 +0100 | [diff] [blame] | 232 | fprintf(f, "d %s ", sprint_time(tc_core_ktime2time(sc->d), b1)); |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 233 | fprintf(f, "m2 %s ", sprint_rate(sc->m2, b1)); |
| 234 | } |
| 235 | |
| 236 | static int |
| 237 | hfsc_print_class_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) |
| 238 | { |
| 239 | struct rtattr *tb[TCA_HFSC_MAX+1]; |
| 240 | struct tc_service_curve *rsc = NULL, *fsc = NULL, *usc = NULL; |
| 241 | |
| 242 | if (opt == NULL) |
| 243 | return 0; |
| 244 | |
8!tgraf | ac2fc2d | 2005-01-18 22:11:58 +0000 | [diff] [blame] | 245 | parse_rtattr_nested(tb, TCA_HFSC_MAX, opt); |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 246 | |
| 247 | if (tb[TCA_HFSC_RSC]) { |
| 248 | if (RTA_PAYLOAD(tb[TCA_HFSC_RSC]) < sizeof(*rsc)) |
| 249 | fprintf(stderr, "HFSC: truncated realtime option\n"); |
| 250 | else |
| 251 | rsc = RTA_DATA(tb[TCA_HFSC_RSC]); |
| 252 | } |
| 253 | if (tb[TCA_HFSC_FSC]) { |
| 254 | if (RTA_PAYLOAD(tb[TCA_HFSC_FSC]) < sizeof(*fsc)) |
| 255 | fprintf(stderr, "HFSC: truncated linkshare option\n"); |
| 256 | else |
| 257 | fsc = RTA_DATA(tb[TCA_HFSC_FSC]); |
| 258 | } |
| 259 | if (tb[TCA_HFSC_USC]) { |
| 260 | if (RTA_PAYLOAD(tb[TCA_HFSC_USC]) < sizeof(*usc)) |
| 261 | fprintf(stderr, "HFSC: truncated upperlimit option\n"); |
| 262 | else |
| 263 | usc = RTA_DATA(tb[TCA_HFSC_USC]); |
| 264 | } |
| 265 | |
Stephen Hemminger | ae665a5 | 2006-12-05 10:10:22 -0800 | [diff] [blame] | 266 | |
net[shemminger]!shemminger | b7de67d | 2004-08-23 20:17:40 +0000 | [diff] [blame] | 267 | if (rsc != NULL && fsc != NULL && |
| 268 | memcmp(rsc, fsc, sizeof(*rsc)) == 0) |
| 269 | hfsc_print_sc(f, "sc", rsc); |
| 270 | else { |
| 271 | if (rsc != NULL) |
| 272 | hfsc_print_sc(f, "rt", rsc); |
| 273 | if (fsc != NULL) |
| 274 | hfsc_print_sc(f, "ls", fsc); |
| 275 | } |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 276 | if (usc != NULL) |
| 277 | hfsc_print_sc(f, "ul", usc); |
| 278 | |
| 279 | return 0; |
| 280 | } |
Stephen Hemminger | ae665a5 | 2006-12-05 10:10:22 -0800 | [diff] [blame] | 281 | |
net[shemminger]!kaber | 95812b5 | 2004-09-28 18:35:49 +0000 | [diff] [blame] | 282 | struct qdisc_util hfsc_qdisc_util = { |
osdl.net!shemminger | f2f99e2 | 2004-08-31 17:45:21 +0000 | [diff] [blame] | 283 | .id = "hfsc", |
| 284 | .parse_qopt = hfsc_parse_opt, |
| 285 | .print_qopt = hfsc_print_opt, |
| 286 | .print_xstats = hfsc_print_xstats, |
| 287 | .parse_copt = hfsc_parse_class_opt, |
| 288 | .print_copt = hfsc_print_class_opt, |
osdl.org!shemminger | aba5acd | 2004-04-15 20:56:59 +0000 | [diff] [blame] | 289 | }; |
| 290 | |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 291 | static int |
| 292 | hfsc_get_sc1(int *argcp, char ***argvp, struct tc_service_curve *sc) |
| 293 | { |
| 294 | char **argv = *argvp; |
| 295 | int argc = *argcp; |
| 296 | unsigned int m1 = 0, d = 0, m2 = 0; |
| 297 | |
| 298 | if (matches(*argv, "m1") == 0) { |
| 299 | NEXT_ARG(); |
| 300 | if (get_rate(&m1, *argv) < 0) { |
| 301 | explain1("m1"); |
| 302 | return -1; |
| 303 | } |
| 304 | NEXT_ARG(); |
| 305 | } |
| 306 | |
| 307 | if (matches(*argv, "d") == 0) { |
| 308 | NEXT_ARG(); |
Patrick McHardy | 8f34caa | 2007-03-04 20:15:00 +0100 | [diff] [blame] | 309 | if (get_time(&d, *argv) < 0) { |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 310 | explain1("d"); |
| 311 | return -1; |
| 312 | } |
| 313 | NEXT_ARG(); |
| 314 | } |
| 315 | |
| 316 | if (matches(*argv, "m2") == 0) { |
| 317 | NEXT_ARG(); |
| 318 | if (get_rate(&m2, *argv) < 0) { |
| 319 | explain1("m2"); |
| 320 | return -1; |
| 321 | } |
| 322 | } else |
| 323 | return -1; |
| 324 | |
| 325 | sc->m1 = m1; |
Patrick McHardy | f0bda7e | 2007-03-04 20:14:59 +0100 | [diff] [blame] | 326 | sc->d = tc_core_time2ktime(d); |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 327 | sc->m2 = m2; |
| 328 | |
| 329 | *argvp = argv; |
| 330 | *argcp = argc; |
| 331 | return 0; |
| 332 | } |
| 333 | |
| 334 | static int |
| 335 | hfsc_get_sc2(int *argcp, char ***argvp, struct tc_service_curve *sc) |
| 336 | { |
| 337 | char **argv = *argvp; |
| 338 | int argc = *argcp; |
| 339 | unsigned int umax = 0, dmax = 0, rate = 0; |
| 340 | |
| 341 | if (matches(*argv, "umax") == 0) { |
| 342 | NEXT_ARG(); |
| 343 | if (get_size(&umax, *argv) < 0) { |
| 344 | explain1("umax"); |
| 345 | return -1; |
| 346 | } |
| 347 | NEXT_ARG(); |
| 348 | } |
| 349 | |
| 350 | if (matches(*argv, "dmax") == 0) { |
| 351 | NEXT_ARG(); |
Patrick McHardy | 8f34caa | 2007-03-04 20:15:00 +0100 | [diff] [blame] | 352 | if (get_time(&dmax, *argv) < 0) { |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 353 | explain1("dmax"); |
| 354 | return -1; |
| 355 | } |
| 356 | NEXT_ARG(); |
| 357 | } |
| 358 | |
| 359 | if (matches(*argv, "rate") == 0) { |
| 360 | NEXT_ARG(); |
| 361 | if (get_rate(&rate, *argv) < 0) { |
| 362 | explain1("rate"); |
| 363 | return -1; |
| 364 | } |
| 365 | } else |
| 366 | return -1; |
| 367 | |
| 368 | if (umax != 0 && dmax == 0) { |
| 369 | fprintf(stderr, "HFSC: umax given but dmax is zero.\n"); |
| 370 | return -1; |
| 371 | } |
| 372 | |
Patrick McHardy | f0bda7e | 2007-03-04 20:14:59 +0100 | [diff] [blame] | 373 | if (dmax != 0 && ceil(1.0 * umax * TIME_UNITS_PER_SEC / dmax) > rate) { |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 374 | /* |
| 375 | * concave curve, slope of first segment is umax/dmax, |
| 376 | * intersection is at dmax |
| 377 | */ |
Patrick McHardy | f0bda7e | 2007-03-04 20:14:59 +0100 | [diff] [blame] | 378 | sc->m1 = ceil(1.0 * umax * TIME_UNITS_PER_SEC / dmax); /* in bps */ |
| 379 | sc->d = tc_core_time2ktime(dmax); |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 380 | sc->m2 = rate; |
| 381 | } else { |
| 382 | /* |
| 383 | * convex curve, slope of first segment is 0, intersection |
| 384 | * is at dmax - umax / rate |
| 385 | */ |
| 386 | sc->m1 = 0; |
Patrick McHardy | f0bda7e | 2007-03-04 20:14:59 +0100 | [diff] [blame] | 387 | sc->d = tc_core_time2ktime(ceil(dmax - umax * TIME_UNITS_PER_SEC / rate)); |
net[shemminger]!shemminger | 7518df0 | 2004-07-02 18:54:03 +0000 | [diff] [blame] | 388 | sc->m2 = rate; |
| 389 | } |
| 390 | |
| 391 | *argvp = argv; |
| 392 | *argcp = argc; |
| 393 | return 0; |
| 394 | } |
| 395 | |
| 396 | static int |
| 397 | hfsc_get_sc(int *argcp, char ***argvp, struct tc_service_curve *sc) |
| 398 | { |
| 399 | if (hfsc_get_sc1(argcp, argvp, sc) < 0 && |
| 400 | hfsc_get_sc2(argcp, argvp, sc) < 0) |
| 401 | return -1; |
| 402 | |
| 403 | if (sc->m1 == 0 && sc->m2 == 0) { |
| 404 | fprintf(stderr, "HFSC: Service Curve has two zero slopes\n"); |
| 405 | return -1; |
| 406 | } |
| 407 | |
| 408 | return 0; |
| 409 | } |