[Cake] dealing with multibit DUAL whatevers

Pete Heist peteheist at gmail.com
Mon Nov 27 06:16:13 EST 2017


This looks like a cosmetic change only (much easier to read now), but I was grokking this in case there would be something to explain the fairness differences in my dual-whatever tests, where srchost/dsthost is much fairer at a host level than dual-srchost/dual-dsthost (explained in round 1 results). Want to at least make sure there’s not a bug here and it’s explained by some other technicality...

http://www.drhleny.cz/bufferbloat/cake/round1/hostiso_eg_cake_src_cake_dst_900mbit/index.html <http://www.drhleny.cz/bufferbloat/cake/round1/hostiso_eg_cake_src_cake_dst_900mbit/index.html>
http://www.drhleny.cz/bufferbloat/cake/round1/hostiso_eg_cake_dsrc_cake_ddst_900mbit/index.html <http://www.drhleny.cz/bufferbloat/cake/round1/hostiso_eg_cake_dsrc_cake_ddst_900mbit/index.html>

> On Nov 26, 2017, at 8:42 PM, Dave Taht <dave.taht at gmail.com> wrote:
> 
> I just committed this
> 
> diff --git a/sch_cake.c b/sch_cake.c
> index 14b32e0..606ec29 100644
> --- a/sch_cake.c
> +++ b/sch_cake.c
> @@ -654,6 +654,20 @@ static inline void cake_update_flowkeys(struct
> flow_keys *keys,
> }
> #endif
> 
> +/* Cake has several subtle multiple bit settings. In these cases you
> + *  would be matching triple isolate mode as well.
> + */
> +
> +static inline bool cake_dsrc(int flow_mode)
> +{
> +    return (flow_mode & CAKE_FLOW_DUAL_SRC) == CAKE_FLOW_DUAL_SRC;
> +}
> +
> +static inline bool cake_ddst(int flow_mode)
> +{
> +    return (flow_mode & CAKE_FLOW_DUAL_DST) == CAKE_FLOW_DUAL_DST;
> +}
> +
> static inline u32
> cake_hash(struct cake_tin_data *q, const struct sk_buff *skb, int flow_mode)
> {
> @@ -772,8 +786,8 @@ cake_hash(struct cake_tin_data *q, const struct
> sk_buff *skb, int flow_mode)
> 
>                 if (!q->flows[outer_hash + k].set) {
>                     /* need to increment host refcnts */
> -                    allocate_src = ((flow_mode & CAKE_FLOW_DUAL_SRC)
> == CAKE_FLOW_DUAL_SRC);
> -                    allocate_dst = ((flow_mode & CAKE_FLOW_DUAL_DST)
> == CAKE_FLOW_DUAL_DST);
> +                    allocate_src = cake_dsrc(flow_mode);
> +                    allocate_dst = cake_ddst(flow_mode);
>                 }
> 
>                 goto found;
> @@ -787,8 +801,8 @@ cake_hash(struct cake_tin_data *q, const struct
> sk_buff *skb, int flow_mode)
>              i++, k = (k + 1) % CAKE_SET_WAYS) {
>             if (!q->flows[outer_hash + k].set) {
>                 q->way_misses++;
> -                allocate_src = ((flow_mode & CAKE_FLOW_DUAL_SRC) ==
> CAKE_FLOW_DUAL_SRC);
> -                allocate_dst = ((flow_mode & CAKE_FLOW_DUAL_DST) ==
> CAKE_FLOW_DUAL_DST);
> +                allocate_src = cake_dsrc(flow_mode);
> +                allocate_dst = cake_ddst(flow_mode);
>                 goto found;
>             }
>         }
> @@ -799,9 +813,8 @@ cake_hash(struct cake_tin_data *q, const struct
> sk_buff *skb, int flow_mode)
>         q->way_collisions++;
>         q->hosts[q->flows[reduced_hash].srchost].srchost_refcnt--;
>         q->hosts[q->flows[reduced_hash].dsthost].dsthost_refcnt--;
> -        allocate_src = ((flow_mode & CAKE_FLOW_DUAL_SRC) ==
> CAKE_FLOW_DUAL_SRC);
> -        allocate_dst = ((flow_mode & CAKE_FLOW_DUAL_DST) ==
> CAKE_FLOW_DUAL_DST);
> -
> +        allocate_src = cake_dsrc(flow_mode);
> +        allocate_dst = cake_ddst(flow_mode);
> found:
>         /* reserve queue for future packets in same flow */
>         reduced_hash = outer_hash + k;
> @@ -1595,10 +1608,10 @@ static s32 cake_enqueue(struct sk_buff *skb,
> struct Qdisc *sch,
>         flow->set = CAKE_SET_SPARSE;
>         b->sparse_flow_count++;
> 
> -        if ((q->flow_mode & CAKE_FLOW_DUAL_SRC) == CAKE_FLOW_DUAL_SRC)
> +        if (cake_dsrc(q->flow_mode))
>             host_load = max(host_load, srchost->srchost_refcnt);
> 
> -        if ((q->flow_mode & CAKE_FLOW_DUAL_DST) == CAKE_FLOW_DUAL_DST)
> +        if (cake_ddst(q->flow_mode))
>             host_load = max(host_load, dsthost->dsthost_refcnt);
> 
>         flow->deficit = (b->flow_quantum * quantum_div[host_load]) >> 16;
> @@ -1762,10 +1775,10 @@ retry:
>     dsthost = &b->hosts[flow->dsthost];
>     host_load = 1;
> 
> -    if ((q->flow_mode & CAKE_FLOW_DUAL_SRC) == CAKE_FLOW_DUAL_SRC)
> +    if (cake_dsrc(q->flow_mode))
>         host_load = max(host_load, srchost->srchost_refcnt);
> 
> -    if ((q->flow_mode & CAKE_FLOW_DUAL_DST) == CAKE_FLOW_DUAL_DST)
> +    if (cake_ddst(q->flow_mode))
>         host_load = max(host_load, dsthost->dsthost_refcnt);
> 
>     WARN_ON(host_load > CAKE_QUEUES);
> 
> 
> -- 
> 
> Dave Täht
> CEO, TekLibre, LLC
> http://www.teklibre.com
> Tel: 1-669-226-2619
> _______________________________________________
> Cake mailing list
> Cake at lists.bufferbloat.net
> https://lists.bufferbloat.net/listinfo/cake

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.bufferbloat.net/pipermail/cake/attachments/20171127/6da2822e/attachment.html>


More information about the Cake mailing list