Re: [RFC] sched: CHOKe packet scheduler (v0.2)

Stephen Hemminger
2011-01-05T20:15:56Z

On Wed, 05 Jan 2011 21:06:07 +0100
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> Le mercredi 05 janvier 2011 à 11:21 -0800, Stephen Hemminger a écrit :
> > This implements the CHOKe packet scheduler based on the existing
> > Linux RED scheduler based on the algorithm described in the paper.
> >
>
> > +
> > +static int choke_enqueue(struct sk_buff *skb, struct Qdisc *sch)
> > +{
> > + struct choke_sched_data *q = qdisc_priv(sch);
> > + struct red_parms *p = &q->parms;
> > +
> > + p->qavg = red_calc_qavg(p, skb_queue_len(&sch->q));
> > + if (red_is_idling(p))
> > + red_end_of_idle_period(p);
> > +
> > + if (p->qavg <= p->qth_min)
> > + p->qcount = -1;
> > + else {
> > + struct sk_buff *oskb;
> > +
> > + /* Draw a packet at random from queue */
> > + oskb = skb_peek_random(&sch->q);
> > +
> > + /* Both packets from same flow?
> > + * Assumes skb_get_rxhash already set hash on oskb->rxhash
> > + * prior to queuing
>
> but this is not true... if at that time, p->qavg was <= p->qth_min.
> Packet was directly enqueued.
>
> Just use :
>
> if (skb_get_rxhash(oskb) == skb_get_rxhash(skb))
>
> Since skb_get_rxhash(skb) doesnt recompute rxhash if already set.
>
> Hmm... I am now wondering if this actually works on egress at all
> (can we use rxhash here I mean)
>
>
>
> > + */
> > + if (oskb->rxhash == skb_get_rxhash(skb)) {
> > + /* Drop both packets */
> > + __skb_unlink(oskb, &sch->q);
> > + qdisc_drop(oskb, sch);
> > + goto congestion_drop;
> > + }
>

The code computes a value, whether it is correct or not is another question.
Also a little concerned that different NIC's compute different flow hash
values which could cause false positives.

--