[Cake] dealing with multibit DUAL whatevers
Dave Taht
dave.taht at gmail.com
Sun Nov 26 14:42:19 EST 2017
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
More information about the Cake
mailing list