]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
sfxge: prefetch txq->common if TxQ is started only
authorarybchik <arybchik@FreeBSD.org>
Tue, 17 Mar 2015 08:23:15 +0000 (08:23 +0000)
committerarybchik <arybchik@FreeBSD.org>
Tue, 17 Mar 2015 08:23:15 +0000 (08:23 +0000)
Transmit may be called when TxQ is not started yet (i.e. txq->common is
invalid). TxQ state is checked below when mbuf is processed and dropped
if TxQ is not started.

Sponsored by:   Solarflare Communications, Inc.
Approved by:    gnn (mentor)

sys/dev/sfxge/sfxge_tx.c

index 1169ecb0984e8fa2ac93e0c7dda31e553e15cb72..00ffda321a91f48965dbcea1c25c6d5b42fb3afb 100644 (file)
@@ -423,8 +423,10 @@ sfxge_tx_qdpl_drain(struct sfxge_txq *txq)
        stdp = &txq->dpl;
        pushed = txq->added;
 
-       prefetch_read_many(sc->enp);
-       prefetch_read_many(txq->common);
+       if (__predict_true(txq->init_state == SFXGE_TXQ_STARTED)) {
+               prefetch_read_many(sc->enp);
+               prefetch_read_many(txq->common);
+       }
 
        mbuf = stdp->std_get;
        count = stdp->std_get_count;