FreeBSD/sys/dev/e1000/if_igb.c
/*
** Multiqueue Transmit Entry:
**  quick turnaround to the stack
**
*/
Multiqueue Transmit Entry:
quick turnaround to the stack
Multiqueue Transmit Entry : quick turnaround to the stack
static int
igb_mq_start(struct ifnet *ifp, struct mbuf *m)
{
	struct adapter		*adapter = ifp->if_softc;
	struct igb_queue	*que;
	struct tx_ring		*txr;
	int 			i, err = 0;
#ifdef	RSS
	uint32_t		bucket_id;
#endif
	if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
#ifdef	RSS
		if (rss_hash2bucket(m->m_pkthdr.flowid,
		    M_HASHTYPE_GET(m), &bucket_id) == 0) {
			i = bucket_id % adapter->num_queues;
		} else {
#endif
			i = m->m_pkthdr.flowid % adapter->num_queues;
#ifdef	RSS
		}
#endif
	} else {
		i = curcpu % adapter->num_queues;
	}
	txr = &adapter->tx_rings[i];
	que = &adapter->queues[i];
	err = drbr_enqueue(ifp, txr->br, m);
	if (err)
		return (err);
	if (IGB_TX_TRYLOCK(txr)) {
		igb_mq_start_locked(ifp, txr);
		IGB_TX_UNLOCK(txr);
	} else
		taskqueue_enqueue(que->tq, &txr->txq_task);
	return (0);
}
static int igb_mq_start ( struct ifnet * ifp , struct mbuf * m ) { struct adapter * adapter = ifp -> if_softc ; struct igb_queue * que ; struct tx_ring * txr ; int i , err = 0 ; #ifdef RSS uint32_t bucket_id ; #endif if ( M_HASHTYPE_GET ( m ) != M_HASHTYPE_NONE ) { #ifdef RSS if ( rss_hash2bucket ( m -> m_pkthdr . flowid , M_HASHTYPE_GET ( m ) , & bucket_id ) == 0 ) { i = bucket_id % adapter -> num_queues ; } else { #endif 
			i = m->m_pkthdr.flowid % adapter->num_queues; #ifdef RSS } #endif } else { i = curcpu % adapter -> num_queues ; } txr = & adapter -> tx_rings [ i ] ; que = & adapter -> queues [ i ] ; err = drbr_enqueue ( ifp , txr -> br , m ) ; if ( err ) return ( err ) ; if ( IGB_TX_TRYLOCK ( txr ) ) { igb_mq_start_locked ( ifp , txr ) ; IGB_TX_UNLOCK ( txr ) ; } else taskqueue_enqueue ( que -> tq , & txr -> txq_task ) ; return ( 0 ) ; }
Multiqueue Transmit Entry:
quick turnaround to the stack
Multiqueue Transmit Entry : quick turnaround to the stack
/* Which queue to use */ /*
	 * When doing RSS, map it to the same outbound queue
	 * as the incoming flow would be mapped to.
	 *
	 * If everything is setup correctly, it should be the
	 * same bucket that the current CPU we're on is.
	 */ /* XXX TODO: spit out something if bucket_id > num_queues? */