On Fri, May 6, 2016 at 8:55 AM, Eric Dumazet <eric.duma...@gmail.com> wrote: > @@ -193,6 +199,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct > Qdisc *sch) > unsigned int idx, prev_backlog, prev_qlen; > struct fq_codel_flow *flow; > int uninitialized_var(ret); > + bool memory_limited; > > idx = fq_codel_classify(skb, sch, &ret); > if (idx == 0) { > @@ -215,7 +222,9 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct > Qdisc *sch) > flow->deficit = q->quantum; > flow->dropped = 0; > } > - if (++sch->q.qlen <= sch->limit) > + q->memory_usage += skb->truesize; > + memory_limited = q->memory_usage > q->memory_limit; > + if (++sch->q.qlen <= sch->limit && !memory_limited) > return NET_XMIT_SUCCESS; > > prev_backlog = sch->qstats.backlog; > @@ -229,7 +238,8 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct > Qdisc *sch) > ret = fq_codel_drop(sch, q->drop_batch_size); > > q->drop_overlimit += prev_qlen - sch->q.qlen; > - > + if (memory_limited) > + q->drop_overmemory += prev_qlen - sch->q.qlen;
So when the packet is dropped due to memory over limit, should we return failure for this case? Or I miss anything?