next up previous
Next: Init Up: Queuing Disciplines Previous: Requeue

Drop

The drop function is used to drop a packet from the queue. This is a very simple function which may be needed in the case of certain queuing disciplines like the RED and the GRED. These queuing disciplines will need to drop some packets under certain conditions. A portion of the GRED code (in net/sched/sch_gred.c) is shown below:
static int
gred_drop(struct Qdisc* sch)
{
.
.
.
    skb = __skb_dequeue_tail(&sch->q);
    if (skb) {
	q= t->tab[(skb->tc_index&0xf)];
	sch->stats.backlog -= skb->len;
	sch->stats.drops++;
	q->backlog
	    -=
	    skb->len;
	q->other++;
	kfree_skb(skb);
	return
	    1;
    }
.
.
}

As can be seen from above, the drop function simply involves dequeuing the packet from the queue and freeing the memory occupied by it.

Next, let us discuss the init function of a queuing disciplines.



Saravanan Radhakrishnan
1999-09-30