Cake - FQ_codel the next generation
 help / color / mirror / Atom feed
From: Dave Taht <dave.taht@gmail.com>
To: Cake List <cake@lists.bufferbloat.net>
Subject: [Cake] dealing with multibit DUAL whatevers
Date: Sun, 26 Nov 2017 11:42:19 -0800	[thread overview]
Message-ID: <CAA93jw5AP0UfZvDzpoN+6RLSNX-1AVgQOMivYSG-HP8nEmVfgw@mail.gmail.com> (raw)

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

             reply	other threads:[~2017-11-26 19:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-26 19:42 Dave Taht [this message]
2017-11-27 11:16 ` Pete Heist

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.bufferbloat.net/postorius/lists/cake.lists.bufferbloat.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA93jw5AP0UfZvDzpoN+6RLSNX-1AVgQOMivYSG-HP8nEmVfgw@mail.gmail.com \
    --to=dave.taht@gmail.com \
    --cc=cake@lists.bufferbloat.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox