FreeBSD/sys/net/altq/altq_fairq.c
/*
 * fairq_enqueue is an enqueue function to be registered to
 * (*altq_enqueue) in struct ifaltq.
 */
fairq_enqueue is an enqueue function to be registered to
(*altq_enqueue) in struct ifaltq.
fairq_enqueue is an enqueue function to be registered to ( * altq_enqueue ) in struct ifaltq .
static int
fairq_enqueue(struct ifaltq *ifq, struct mbuf *m, struct altq_pktattr *pktattr)
{
	struct fairq_if *pif = (struct fairq_if *)ifq->altq_disc;
	struct fairq_class *cl = NULL; 
	struct pf_mtag *t;
	u_int32_t qid_hash = 0;
	int len;
	IFQ_LOCK_ASSERT(ifq);
	if ((m->m_flags & M_PKTHDR) == 0) {
		printf("altq: packet for %s does not have pkthdr\n",
			ifq->altq_ifp->if_xname);
		m_freem(m);
		return (ENOBUFS);
	}
	if ((t = pf_find_mtag(m)) != NULL) {
		cl = clh_to_clp(pif, t->qid);
		qid_hash = t->qid_hash;
	}
	if (cl == NULL) {
		cl = pif->pif_default;
		if (cl == NULL) {
			m_freem(m);
			return (ENOBUFS);
		}
	}
	cl->cl_flags |= FARF_HAS_PACKETS;
	cl->cl_pktattr = NULL;
	len = m_pktlen(m);
	if (fairq_addq(cl, m, qid_hash) != 0) {
		PKTCNTR_ADD(&cl->cl_dropcnt, len);
		return (ENOBUFS);
	}
	IFQ_INC_LEN(ifq);
	return (0);
}
static int fairq_enqueue ( struct ifaltq * ifq , struct mbuf * m , struct altq_pktattr * pktattr ) { struct fairq_if * pif = ( struct fairq_if * ) ifq -> altq_disc ; struct fairq_class * cl = NULL ; struct pf_mtag * t ; u_int32_t qid_hash = 0 ; int len ; IFQ_LOCK_ASSERT ( ifq ) ; if ( ( m -> m_flags & M_PKTHDR ) == 0 ) { printf ( " \n " , ifq -> altq_ifp -> if_xname ) ; m_freem ( m ) ; return ( ENOBUFS ) ; } if ( ( t = pf_find_mtag ( m ) ) != NULL ) { cl = clh_to_clp ( pif , t -> qid ) ; qid_hash = t -> qid_hash ; } if ( cl == NULL ) { cl = pif -> pif_default ; if ( cl == NULL ) { m_freem ( m ) ; return ( ENOBUFS ) ; } } cl -> cl_flags |= FARF_HAS_PACKETS ; cl -> cl_pktattr = NULL ; len = m_pktlen ( m ) ; if ( fairq_addq ( cl , m , qid_hash ) != 0 ) { PKTCNTR_ADD ( & cl -> cl_dropcnt , len ) ; return ( ENOBUFS ) ; } IFQ_INC_LEN ( ifq ) ; return ( 0 ) ; }
fairq_enqueue is an enqueue function to be registered to
 (*altq_enqueue) in struct ifaltq.
fairq_enqueue is an enqueue function to be registered to ( * altq_enqueue ) in struct ifaltq .
/* Make compiler happy */ /* grab class set by classifier */ /* should not happen */ /* drop occurred.  mbuf was freed in fairq_addq. */