From ac49485b29519fb1a4a88bc07e715ea232058397 Mon Sep 17 00:00:00 2001 From: Dave Taht Date: Thu, 4 Jun 2015 10:04:46 -0700 Subject: [PATCH] Make compile on linux 4.0 and later --- sch_cake.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sch_cake.c b/sch_cake.c index 242333c..538d090 100644 --- a/sch_cake.c +++ b/sch_cake.c @@ -49,10 +49,12 @@ #include #include #include +#include #include "pkt_sched.h" +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) #include +#endif #include "codel5.h" - /* The CAKE Principle: * (or, how to have your cake and eat it too) * @@ -205,12 +207,15 @@ enum { static inline unsigned int cake_fqcd_hash(struct cake_fqcd_sched_data *q, const struct sk_buff *skb, int flow_mode) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) struct flow_keys keys; +#endif u32 hash, reduced_hash; if(unlikely(flow_mode == CAKE_FLOW_NONE || q->flows_cnt < CAKE_SET_WAYS)) return 0; +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0) skb_flow_dissect(skb, &keys); if(flow_mode != CAKE_FLOW_ALL) { @@ -227,6 +232,9 @@ cake_fqcd_hash(struct cake_fqcd_sched_data *q, const struct sk_buff *skb, int fl hash = jhash_3words((__force u32)keys.dst, (__force u32)keys.src ^ keys.ip_proto, (__force u32)keys.ports, q->perturbation); +#else + hash = skb_get_hash_perturb(skb, q->perturbation); +#endif reduced_hash = reciprocal_scale(hash, q->flows_cnt); @@ -416,7 +424,7 @@ static int cake_enqueue(struct sk_buff *skb, struct Qdisc *sch) * Split GSO aggregates if they're likely to impair flow isolation * or if we need to know individual packet sizes for framing overhead. */ - if(unlikely((len * max(fqcd->flow_count, 1)) > q->peel_threshold && skb_is_gso(skb))) + if(((len * max((fqcd->flow_count), 1)) > q->peel_threshold && skb_is_gso(skb))) { struct sk_buff *segs, *nskb; netdev_features_t features = netif_skb_features(skb); -- 2.1.0