2 * $Id: test_dn_sched.c 5626 2010-03-04 21:55:22Z luigi $
4 * library functions for userland testing of dummynet schedulers
10 m_freem(struct mbuf *m)
12 printf("free %p\n", m);
16 dn_sched_modevent(module_t mod, int cmd, void *arg)
22 dn_free_pkts(struct mbuf *m)
32 dn_delete_queue(void *_q, void *do_free)
34 struct dn_queue *q = _q;
36 dn_free_pkts(q->mq.head);
42 * This is a simplified function for testing purposes, which does
43 * not implement statistics or random loss.
44 * Enqueue a packet in q, subject to space and queue management policy
45 * (whose parameters are in q->fs).
46 * Update stats for the queue and the scheduler.
47 * Return 0 on success, 1 on drop. The packet is consumed anyways.
50 dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop)
54 if (q->ni.length >= 200)
58 q->ni.tot_bytes += m->m_pkthdr.len;
67 ipdn_bound_var(int *v, int dflt, int lo, int hi, const char *msg)
85 for (bit = 1; mask != 1; bit++)
86 mask = (unsigned int)mask >> 1;