diff options
author | Jiri Pirko <jiri@resnulli.us> | 2013-02-11 19:12:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-02-12 18:59:45 -0500 |
commit | 292f1c7ff6cc10516076ceeea45ed11833bb71c7 (patch) | |
tree | 14e97f023e75d908cbebc183ce3b07fcb0233d05 /include/net/sch_generic.h | |
parent | b9a7afdefdf90dc9e64902b2565170b8b017aa75 (diff) |
sch: make htb_rate_cfg and functions around that generic
As it is going to be used in tbf as well, push these to generic code.
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r-- | include/net/sch_generic.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 2d06c2a53de1..2761c905504e 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -679,4 +679,23 @@ static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask, | |||
679 | } | 679 | } |
680 | #endif | 680 | #endif |
681 | 681 | ||
682 | struct psched_ratecfg { | ||
683 | u64 rate_bps; | ||
684 | u32 mult; | ||
685 | u32 shift; | ||
686 | }; | ||
687 | |||
688 | static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, | ||
689 | unsigned int len) | ||
690 | { | ||
691 | return ((u64)len * r->mult) >> r->shift; | ||
692 | } | ||
693 | |||
694 | extern void psched_ratecfg_precompute(struct psched_ratecfg *r, u32 rate); | ||
695 | |||
696 | static inline u32 psched_ratecfg_getrate(const struct psched_ratecfg *r) | ||
697 | { | ||
698 | return r->rate_bps >> 3; | ||
699 | } | ||
700 | |||
682 | #endif | 701 | #endif |