diff options
-rw-r--r-- | net/sched/sch_netem.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 1aa43453705c..f69698ff88d9 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -352,7 +352,7 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr) | |||
352 | return 0; | 352 | return 0; |
353 | } | 353 | } |
354 | 354 | ||
355 | static int get_correlation(struct Qdisc *sch, const struct nlattr *attr) | 355 | static void get_correlation(struct Qdisc *sch, const struct nlattr *attr) |
356 | { | 356 | { |
357 | struct netem_sched_data *q = qdisc_priv(sch); | 357 | struct netem_sched_data *q = qdisc_priv(sch); |
358 | const struct tc_netem_corr *c = nla_data(attr); | 358 | const struct tc_netem_corr *c = nla_data(attr); |
@@ -360,27 +360,24 @@ static int get_correlation(struct Qdisc *sch, const struct nlattr *attr) | |||
360 | init_crandom(&q->delay_cor, c->delay_corr); | 360 | init_crandom(&q->delay_cor, c->delay_corr); |
361 | init_crandom(&q->loss_cor, c->loss_corr); | 361 | init_crandom(&q->loss_cor, c->loss_corr); |
362 | init_crandom(&q->dup_cor, c->dup_corr); | 362 | init_crandom(&q->dup_cor, c->dup_corr); |
363 | return 0; | ||
364 | } | 363 | } |
365 | 364 | ||
366 | static int get_reorder(struct Qdisc *sch, const struct nlattr *attr) | 365 | static void get_reorder(struct Qdisc *sch, const struct nlattr *attr) |
367 | { | 366 | { |
368 | struct netem_sched_data *q = qdisc_priv(sch); | 367 | struct netem_sched_data *q = qdisc_priv(sch); |
369 | const struct tc_netem_reorder *r = nla_data(attr); | 368 | const struct tc_netem_reorder *r = nla_data(attr); |
370 | 369 | ||
371 | q->reorder = r->probability; | 370 | q->reorder = r->probability; |
372 | init_crandom(&q->reorder_cor, r->correlation); | 371 | init_crandom(&q->reorder_cor, r->correlation); |
373 | return 0; | ||
374 | } | 372 | } |
375 | 373 | ||
376 | static int get_corrupt(struct Qdisc *sch, const struct nlattr *attr) | 374 | static void get_corrupt(struct Qdisc *sch, const struct nlattr *attr) |
377 | { | 375 | { |
378 | struct netem_sched_data *q = qdisc_priv(sch); | 376 | struct netem_sched_data *q = qdisc_priv(sch); |
379 | const struct tc_netem_corrupt *r = nla_data(attr); | 377 | const struct tc_netem_corrupt *r = nla_data(attr); |
380 | 378 | ||
381 | q->corrupt = r->probability; | 379 | q->corrupt = r->probability; |
382 | init_crandom(&q->corrupt_cor, r->correlation); | 380 | init_crandom(&q->corrupt_cor, r->correlation); |
383 | return 0; | ||
384 | } | 381 | } |
385 | 382 | ||
386 | static const struct nla_policy netem_policy[TCA_NETEM_MAX + 1] = { | 383 | static const struct nla_policy netem_policy[TCA_NETEM_MAX + 1] = { |
@@ -439,11 +436,8 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt) | |||
439 | if (q->gap) | 436 | if (q->gap) |
440 | q->reorder = ~0; | 437 | q->reorder = ~0; |
441 | 438 | ||
442 | if (tb[TCA_NETEM_CORR]) { | 439 | if (tb[TCA_NETEM_CORR]) |
443 | ret = get_correlation(sch, tb[TCA_NETEM_CORR]); | 440 | get_correlation(sch, tb[TCA_NETEM_CORR]); |
444 | if (ret) | ||
445 | return ret; | ||
446 | } | ||
447 | 441 | ||
448 | if (tb[TCA_NETEM_DELAY_DIST]) { | 442 | if (tb[TCA_NETEM_DELAY_DIST]) { |
449 | ret = get_dist_table(sch, tb[TCA_NETEM_DELAY_DIST]); | 443 | ret = get_dist_table(sch, tb[TCA_NETEM_DELAY_DIST]); |
@@ -451,17 +445,11 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt) | |||
451 | return ret; | 445 | return ret; |
452 | } | 446 | } |
453 | 447 | ||
454 | if (tb[TCA_NETEM_REORDER]) { | 448 | if (tb[TCA_NETEM_REORDER]) |
455 | ret = get_reorder(sch, tb[TCA_NETEM_REORDER]); | 449 | get_reorder(sch, tb[TCA_NETEM_REORDER]); |
456 | if (ret) | ||
457 | return ret; | ||
458 | } | ||
459 | 450 | ||
460 | if (tb[TCA_NETEM_CORRUPT]) { | 451 | if (tb[TCA_NETEM_CORRUPT]) |
461 | ret = get_corrupt(sch, tb[TCA_NETEM_CORRUPT]); | 452 | get_corrupt(sch, tb[TCA_NETEM_CORRUPT]); |
462 | if (ret) | ||
463 | return ret; | ||
464 | } | ||
465 | 453 | ||
466 | return 0; | 454 | return 0; |
467 | } | 455 | } |