sch: make htb_rate_cfg and functions around that generic
[pandora-kernel.git] / include / net / sch_generic.h
index 1540f9c..2761c90 100644 (file)
@@ -195,7 +195,7 @@ struct tcf_proto_ops {
 
        unsigned long           (*get)(struct tcf_proto*, u32 handle);
        void                    (*put)(struct tcf_proto*, unsigned long);
-       int                     (*change)(struct sk_buff *,
+       int                     (*change)(struct net *net, struct sk_buff *,
                                        struct tcf_proto*, unsigned long,
                                        u32 handle, struct nlattr **,
                                        unsigned long *);
@@ -679,4 +679,23 @@ static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask,
 }
 #endif
 
+struct psched_ratecfg {
+       u64 rate_bps;
+       u32 mult;
+       u32 shift;
+};
+
+static inline u64 psched_l2t_ns(const struct psched_ratecfg *r,
+                               unsigned int len)
+{
+       return ((u64)len * r->mult) >> r->shift;
+}
+
+extern void psched_ratecfg_precompute(struct psched_ratecfg *r, u32 rate);
+
+static inline u32 psched_ratecfg_getrate(const struct psched_ratecfg *r)
+{
+       return r->rate_bps >> 3;
+}
+
 #endif