diff options
| author | Eric Dumazet <edumazet@google.com> | 2013-09-19 12:10:03 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2013-09-20 14:41:02 -0400 |
| commit | 3e1e3aae1f5d4e8e5edb7e332f6e265597cc5b0a (patch) | |
| tree | 26737c73709aa3a29ad1c435e6bb7cd83126f4c6 | |
| parent | 118a7b0ede580f3c5553028301001d46f8eede99 (diff) | |
net_sched: add u64 rate to psched_ratecfg_precompute()
Add an extra u64 rate parameter to psched_ratecfg_precompute()
so that some qdisc can opt-in for 64bit rates in the future,
to overcome the ~34 Gbits limit.
psched_ratecfg_getrate() reports a legacy structure to
tc utility, so if actual rate is above the 32bit rate field,
cap it to the 34Gbit limit.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | include/net/sch_generic.h | 11 | ||||
| -rw-r--r-- | net/sched/act_police.c | 4 | ||||
| -rw-r--r-- | net/sched/sch_generic.c | 5 | ||||
| -rw-r--r-- | net/sched/sch_htb.c | 4 | ||||
| -rw-r--r-- | net/sched/sch_tbf.c | 4 |
5 files changed, 18 insertions, 10 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index f4eb365f7dcd..d0a6321c302e 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
| @@ -702,13 +702,20 @@ static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, | |||
| 702 | } | 702 | } |
| 703 | 703 | ||
| 704 | void psched_ratecfg_precompute(struct psched_ratecfg *r, | 704 | void psched_ratecfg_precompute(struct psched_ratecfg *r, |
| 705 | const struct tc_ratespec *conf); | 705 | const struct tc_ratespec *conf, |
| 706 | u64 rate64); | ||
| 706 | 707 | ||
| 707 | static inline void psched_ratecfg_getrate(struct tc_ratespec *res, | 708 | static inline void psched_ratecfg_getrate(struct tc_ratespec *res, |
| 708 | const struct psched_ratecfg *r) | 709 | const struct psched_ratecfg *r) |
| 709 | { | 710 | { |
| 710 | memset(res, 0, sizeof(*res)); | 711 | memset(res, 0, sizeof(*res)); |
| 711 | res->rate = r->rate_bytes_ps; | 712 | |
| 713 | /* legacy struct tc_ratespec has a 32bit @rate field | ||
| 714 | * Qdisc using 64bit rate should add new attributes | ||
| 715 | * in order to maintain compatibility. | ||
| 716 | */ | ||
| 717 | res->rate = min_t(u64, r->rate_bytes_ps, ~0U); | ||
| 718 | |||
| 712 | res->overhead = r->overhead; | 719 | res->overhead = r->overhead; |
| 713 | res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); | 720 | res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); |
| 714 | } | 721 | } |
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 189e3c5b3d09..272d8e924cf6 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
| @@ -231,14 +231,14 @@ override: | |||
| 231 | } | 231 | } |
| 232 | if (R_tab) { | 232 | if (R_tab) { |
| 233 | police->rate_present = true; | 233 | police->rate_present = true; |
| 234 | psched_ratecfg_precompute(&police->rate, &R_tab->rate); | 234 | psched_ratecfg_precompute(&police->rate, &R_tab->rate, 0); |
| 235 | qdisc_put_rtab(R_tab); | 235 | qdisc_put_rtab(R_tab); |
| 236 | } else { | 236 | } else { |
| 237 | police->rate_present = false; | 237 | police->rate_present = false; |
| 238 | } | 238 | } |
| 239 | if (P_tab) { | 239 | if (P_tab) { |
| 240 | police->peak_present = true; | 240 | police->peak_present = true; |
| 241 | psched_ratecfg_precompute(&police->peak, &P_tab->rate); | 241 | psched_ratecfg_precompute(&police->peak, &P_tab->rate, 0); |
| 242 | qdisc_put_rtab(P_tab); | 242 | qdisc_put_rtab(P_tab); |
| 243 | } else { | 243 | } else { |
| 244 | police->peak_present = false; | 244 | police->peak_present = false; |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index a74e278654aa..e7121d29c4bd 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
| @@ -910,11 +910,12 @@ void dev_shutdown(struct net_device *dev) | |||
| 910 | } | 910 | } |
| 911 | 911 | ||
| 912 | void psched_ratecfg_precompute(struct psched_ratecfg *r, | 912 | void psched_ratecfg_precompute(struct psched_ratecfg *r, |
| 913 | const struct tc_ratespec *conf) | 913 | const struct tc_ratespec *conf, |
| 914 | u64 rate64) | ||
| 914 | { | 915 | { |
| 915 | memset(r, 0, sizeof(*r)); | 916 | memset(r, 0, sizeof(*r)); |
| 916 | r->overhead = conf->overhead; | 917 | r->overhead = conf->overhead; |
| 917 | r->rate_bytes_ps = conf->rate; | 918 | r->rate_bytes_ps = max_t(u64, conf->rate, rate64); |
| 918 | r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK); | 919 | r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK); |
| 919 | r->mult = 1; | 920 | r->mult = 1; |
| 920 | /* | 921 | /* |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 863846cc5513..6b126f6c9957 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
| @@ -1491,8 +1491,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
| 1491 | cl->prio = TC_HTB_NUMPRIO - 1; | 1491 | cl->prio = TC_HTB_NUMPRIO - 1; |
| 1492 | } | 1492 | } |
| 1493 | 1493 | ||
| 1494 | psched_ratecfg_precompute(&cl->rate, &hopt->rate); | 1494 | psched_ratecfg_precompute(&cl->rate, &hopt->rate, 0); |
| 1495 | psched_ratecfg_precompute(&cl->ceil, &hopt->ceil); | 1495 | psched_ratecfg_precompute(&cl->ceil, &hopt->ceil, 0); |
| 1496 | 1496 | ||
| 1497 | cl->buffer = PSCHED_TICKS2NS(hopt->buffer); | 1497 | cl->buffer = PSCHED_TICKS2NS(hopt->buffer); |
| 1498 | cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer); | 1498 | cl->cbuffer = PSCHED_TICKS2NS(hopt->cbuffer); |
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c index 1aaf1b6e51a2..b0571224f3c9 100644 --- a/net/sched/sch_tbf.c +++ b/net/sched/sch_tbf.c | |||
| @@ -341,9 +341,9 @@ static int tbf_change(struct Qdisc *sch, struct nlattr *opt) | |||
| 341 | q->tokens = q->buffer; | 341 | q->tokens = q->buffer; |
| 342 | q->ptokens = q->mtu; | 342 | q->ptokens = q->mtu; |
| 343 | 343 | ||
| 344 | psched_ratecfg_precompute(&q->rate, &rtab->rate); | 344 | psched_ratecfg_precompute(&q->rate, &rtab->rate, 0); |
| 345 | if (ptab) { | 345 | if (ptab) { |
| 346 | psched_ratecfg_precompute(&q->peak, &ptab->rate); | 346 | psched_ratecfg_precompute(&q->peak, &ptab->rate, 0); |
| 347 | q->peak_present = true; | 347 | q->peak_present = true; |
| 348 | } else { | 348 | } else { |
| 349 | q->peak_present = false; | 349 | q->peak_present = false; |
