Commit 025dc69a authored by osdl.net!shemminger's avatar osdl.net!shemminger

Fix errors in netem scheduler when using PSCHED_CLOCK_CPU,

correct value before passing to kernel.

(Logical change 1.63)
parent cbe1a23d
2004-08-09 Stephen Hemminger <shemminger@osdl.org> 2004-08-09 Stephen Hemminger <shemminger@osdl.org>
* Fix netem scheduler to handle case where psched us != real us
* Remove configuration for everything that can depend on * Remove configuration for everything that can depend on
extracted kernel headers extracted kernel headers
* Add kernel headers required to include/linux * Add kernel headers required to include/linux
......
...@@ -42,6 +42,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv, ...@@ -42,6 +42,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
struct nlmsghdr *n) struct nlmsghdr *n)
{ {
struct tc_netem_qopt opt; struct tc_netem_qopt opt;
unsigned latency = 0;
int ok = 0; int ok = 0;
memset(&opt, 0, sizeof(opt)); memset(&opt, 0, sizeof(opt));
...@@ -57,7 +58,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv, ...@@ -57,7 +58,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
ok++; ok++;
} else if (matches(*argv, "latency") == 0) { } else if (matches(*argv, "latency") == 0) {
NEXT_ARG(); NEXT_ARG();
if (get_usecs(&opt.latency, *argv)) { if (get_usecs(&latency, *argv)) {
explain1("latency"); explain1("latency");
return -1; return -1;
} }
...@@ -101,6 +102,8 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv, ...@@ -101,6 +102,8 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
argc--; argv++; argc--; argv++;
} }
opt.latency = tc_core_usec2tick(latency);
return ok ? addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)) : 0; return ok ? addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt)) : 0;
} }
...@@ -120,7 +123,7 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) ...@@ -120,7 +123,7 @@ static int netem_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
fprintf(f, "limit %d", qopt->limit); fprintf(f, "limit %d", qopt->limit);
if (qopt->latency) if (qopt->latency)
fprintf(f, " latency %s", fprintf(f, " latency %s",
sprint_usecs(qopt->latency, b1)); sprint_usecs(tc_core_tick2usec(qopt->latency), b1));
if (qopt->jitter) if (qopt->jitter)
fprintf(f, " jitter %s", sprint_usecs(qopt->jitter, b1)); fprintf(f, " jitter %s", sprint_usecs(qopt->jitter, b1));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment