예제 #1
0
static int
rr_enqueue(struct dn_sch_inst *_si, struct dn_queue *q, struct mbuf *m)
{
	struct rr_si *si;
	struct rr_queue *rrq;

	if (m != q->mq.head) {
		if (dn_enqueue(q, m, 0)) /* packet was dropped */
			return 1;
		if (m != q->mq.head)
			return 0;
	}

	/* If reach this point, queue q was idle */
	si = (struct rr_si *)(_si + 1);
	rrq = (struct rr_queue *)q;

	if (rrq->status == 1) /* Queue is already in the queue list */
		return 0;

	/* Insert the queue in the queue list */
	rr_append(rrq, si);

	return 0;
}
예제 #2
0
static int
rr_new_queue(struct dn_queue *_q)
{
	struct rr_queue *q = (struct rr_queue *)_q;

	_q->ni.oid.subtype = DN_SCHED_RR;

	q->quantum = _q->fs->fs.par[0] * _q->fs->fs.par[1];
	ND("called, q->quantum %d", q->quantum);
	q->credit = q->quantum;
	q->status = 0;

	if (_q->mq.head != NULL) {
		/* Queue NOT empty, insert in the queue list */
		rr_append(q, (struct rr_si *)(_q->_si + 1));
	}
	return 0;
}
예제 #3
0
static int
rr_new_queue(struct dn_queue *_q)
{
	struct rr_queue *q = (struct rr_queue *)_q;
	uint64_t quantum;

	_q->ni.oid.subtype = DN_SCHED_RR;

	quantum = (uint64_t)_q->fs->fs.par[0] * _q->fs->fs.par[1];
	if (quantum >= (1ULL<< 32)) {
		D("quantum too large, truncating to 4G - 1");
		quantum = (1ULL<< 32) - 1;
	}
	q->quantum = quantum;
	ND("called, q->quantum %d", q->quantum);
	q->credit = q->quantum;
	q->status = 0;

	if (_q->mq.head != NULL) {
		/* Queue NOT empty, insert in the queue list */
		rr_append(q, (struct rr_si *)(_q->_si + 1));
	}
	return 0;
}