aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sch_generic.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r--include/net/sch_generic.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index ffc9d883b163..76368c9d4503 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -685,13 +685,19 @@ struct psched_ratecfg {
685 u64 rate_bytes_ps; /* bytes per second */ 685 u64 rate_bytes_ps; /* bytes per second */
686 u32 mult; 686 u32 mult;
687 u16 overhead; 687 u16 overhead;
688 u8 linklayer;
688 u8 shift; 689 u8 shift;
689}; 690};
690 691
691static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, 692static inline u64 psched_l2t_ns(const struct psched_ratecfg *r,
692 unsigned int len) 693 unsigned int len)
693{ 694{
694 return ((u64)(len + r->overhead) * r->mult) >> r->shift; 695 len += r->overhead;
696
697 if (unlikely(r->linklayer == TC_LINKLAYER_ATM))
698 return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift;
699
700 return ((u64)len * r->mult) >> r->shift;
695} 701}
696 702
697void psched_ratecfg_precompute(struct psched_ratecfg *r, 703void psched_ratecfg_precompute(struct psched_ratecfg *r,
@@ -703,6 +709,7 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res,
703 memset(res, 0, sizeof(*res)); 709 memset(res, 0, sizeof(*res));
704 res->rate = r->rate_bytes_ps; 710 res->rate = r->rate_bytes_ps;
705 res->overhead = r->overhead; 711 res->overhead = r->overhead;
712 res->linklayer = (r->linklayer & TC_LINKLAYER_MASK);
706} 713}
707 714
708#endif 715#endif