FreeBSD/sys/netpfil/ipfw/test/test_dn_sched.c
/*
 * This is a simplified function for testing purposes, which does
 * not implement statistics or random loss.
 * Enqueue a packet in q, subject to space and queue management policy
 * (whose parameters are in q->fs).
 * Update stats for the queue and the scheduler.
 * Return 0 on success, 1 on drop. The packet is consumed anyways.
 */
This is a simplified function for testing purposes, which does
not implement statistics or random loss.
Enqueue a packet in q, subject to space and queue management policy
(whose parameters are in q->fs).
Update stats for the queue and the scheduler.
Return 0 on success, 1 on drop. The packet is consumed anyways.
This is a simplified function for testing purposes which does not implement statistics or random loss . Enqueue a packet in q subject to space and queue management policy ( whose parameters are in q - > fs ) . Update stats for the queue and the scheduler . Return 0 on success 1 on drop . The packet is consumed anyways .
int
dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop)
{
        if (drop)
                goto drop;
        if (q->ni.length >= 200)
                goto drop;
        mq_append(&q->mq, m);
        q->ni.length++;
        q->ni.tot_bytes += m->m_pkthdr.len;
        q->ni.tot_pkts++;
        return 0;
drop:
        q->ni.drops++;
        return 1;
}
int dn_enqueue ( struct dn_queue * q , struct mbuf * m , int drop ) { if ( drop ) goto drop ; if ( q -> ni . length >= 200 ) goto drop ; mq_append ( & q -> mq , m ) ; q -> ni . length ++ ; q -> ni . tot_bytes += m -> m_pkthdr . len ; q -> ni . tot_pkts ++ ; return 0 ; drop : q -> ni . drops ++ ; return 1 ; }
This is a simplified function for testing purposes, which does
 not implement statistics or random loss.
This is a simplified function for testing purposes which does not implement statistics or random loss .