Skip to content
Permalink
Browse files

Ingress mode, first stage. Can't yet be configured active.

  • Loading branch information
chromi committed Apr 1, 2017
1 parent 08da7dd commit 17ee7e76cd4b7f7e78adc5ad6546293936c2d83c
Showing with 20 additions and 6 deletions.
  1. +20 −6 sch_cake.c
@@ -271,6 +271,7 @@ enum {
CAKE_FLAG_ATM = 0x0001,
CAKE_FLAG_PTM = 0x0002,
CAKE_FLAG_AUTORATE_INGRESS = 0x0010,
CAKE_FLAG_INGRESS = 0x0040,
CAKE_FLAG_WASH = 0x0100
};

@@ -768,6 +769,8 @@ static void cake_heapify_up(struct cake_sched_data *q, u16 i)
}
}

static void cake_advance_shaper(struct cake_sched_data *q, struct cake_tin_data *b, u32 len, u64 now);

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
static unsigned int cake_drop(struct Qdisc *sch)
#else
@@ -780,6 +783,7 @@ static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)
struct cake_tin_data *b;
struct cake_flow *flow;
struct cake_heap_entry qq;
u64 now = cobalt_get_time();

if(!q->overflow_timeout) {
int i;
@@ -803,7 +807,7 @@ static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)
return idx + (tin << 16);
}

if(cobalt_queue_full(&flow->cvars, &b->cparams, cobalt_get_time()))
if(cobalt_queue_full(&flow->cvars, &b->cparams, now))
b->unresponsive_flow_count++;

len = qdisc_pkt_len(skb);
@@ -816,6 +820,9 @@ static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)
b->tin_dropped++;
sch->qstats.drops++;

if(q->rate_flags & CAKE_FLAG_INGRESS)
cake_advance_shaper(q, b, cake_overhead(q, len), now);

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
kfree_skb(skb);
#else
@@ -1257,6 +1264,8 @@ static struct sk_buff *cake_dequeue(struct Qdisc *sch)
break;

/* drop this packet, get another one */
if(q->rate_flags & CAKE_FLAG_INGRESS)
cake_advance_shaper(q, b, cake_overhead(q, qdisc_pkt_len(skb)), now);
b->tin_dropped++;
qdisc_tree_reduce_backlog(sch, 1, qdisc_pkt_len(skb));
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
@@ -1284,6 +1293,16 @@ static struct sk_buff *cake_dequeue(struct Qdisc *sch)
b->base_delay = cake_ewma(b->base_delay, delay,
delay < b->base_delay ? 2 : 8);

cake_advance_shaper(q, b, len, now);

if(q->overflow_timeout)
q->overflow_timeout--;

return skb;
}

static void cake_advance_shaper(struct cake_sched_data *q, struct cake_tin_data *b, u32 len, u64 now)
{
/* charge packet bandwidth to this tin, lower tins,
* and to the global shaper.
*/
@@ -1299,11 +1318,6 @@ static struct sk_buff *cake_dequeue(struct Qdisc *sch)

q->time_next_packet += tdiff3;
}

if(q->overflow_timeout)
q->overflow_timeout--;

return skb;
}

static void cake_reset(struct Qdisc *sch)

0 comments on commit 17ee7e7

Please sign in to comment.
You can’t perform that action at this time.