FreeBSD/sys/netpfil/ipfw/dn_sched_fq_codel.c
/* Enqueue a packet 'm' to a queue 'q' and add timestamp to that packet.
 * Return 1 when unable to add timestamp, otherwise return 0 
 */
Enqueue a packet 'm' to a queue 'q' and add timestamp to that packet.
Return 1 when unable to add timestamp, otherwise return 0
Enqueue a packet ' m ' to a queue ' q ' and add timestamp to that packet . Return 1 when unable to add timestamp otherwise return 0
static int
codel_enqueue(struct fq_codel_flow *q, struct mbuf *m, struct fq_codel_si *si)
{
	uint64_t len;
	len = m->m_pkthdr.len;
	if (len > q->cst.maxpkt_size)
		q->cst.maxpkt_size = len;
	struct m_tag *mtag;
	mtag = m_tag_locate(m, MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, NULL);
	if (mtag == NULL)
		mtag = m_tag_alloc(MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, sizeof(aqm_time_t),
			M_NOWAIT);
	if (mtag == NULL) {
		m_freem(m); 
		goto drop;
	}
	*(aqm_time_t *)(mtag + 1) = AQM_UNOW;
	m_tag_prepend(m, mtag);
	mq_append(&q->mq, m);
	fq_update_stats(q, si, len, 0);
	return 0;
drop:
	fq_update_stats(q, si, len, 1);
	m_freem(m);
	return 1;
}
static int codel_enqueue ( struct fq_codel_flow * q , struct mbuf * m , struct fq_codel_si * si ) { uint64_t len ; len = m -> m_pkthdr . len ; if ( len > q -> cst . maxpkt_size ) q -> cst . maxpkt_size = len ; struct m_tag * mtag ; mtag = m_tag_locate ( m , MTAG_ABI_COMPAT , DN_AQM_MTAG_TS , NULL ) ; if ( mtag == NULL ) mtag = m_tag_alloc ( MTAG_ABI_COMPAT , DN_AQM_MTAG_TS , sizeof ( aqm_time_t ) , M_NOWAIT ) ; if ( mtag == NULL ) { m_freem ( m ) ; goto drop ; } * ( aqm_time_t * ) ( mtag + 1 ) = AQM_UNOW ; m_tag_prepend ( m , mtag ) ; mq_append ( & q -> mq , m ) ; fq_update_stats ( q , si , len , 0 ) ; return 0 ; drop : fq_update_stats ( q , si , len , 1 ) ; m_freem ( m ) ; return 1 ; }
Enqueue a packet 'm' to a queue 'q' and add timestamp to that packet.
Enqueue a packet ' m ' to a queue ' q ' and add timestamp to that packet .
/* finding maximum packet size */ /* Add timestamp to mbuf as MTAG */