diff options
| author | David C Somayajulu <davidcs@FreeBSD.org> | 2015-08-05 02:16:11 +0000 |
|---|---|---|
| committer | David C Somayajulu <davidcs@FreeBSD.org> | 2015-08-05 02:16:11 +0000 |
| commit | 648dcf329cb996c1b5431f38812bc8e0ea749ba8 (patch) | |
| tree | 4c386e55974a884b2b15545b899d660fbc04360f | |
| parent | cb1fe3ec8f517ff0cc16b3671b4e316dcc3fc054 (diff) | |
Notes
| -rw-r--r-- | sys/dev/bxe/bxe.c | 36 | ||||
| -rw-r--r-- | sys/dev/bxe/bxe.h | 1 |
2 files changed, 15 insertions, 22 deletions
diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c index 704b84628de0..1d432e133d6c 100644 --- a/sys/dev/bxe/bxe.c +++ b/sys/dev/bxe/bxe.c @@ -6015,19 +6015,26 @@ bxe_tx_mq_start_locked(struct bxe_softc *sc, rc = tx_count = 0; + BXE_FP_TX_LOCK_ASSERT(fp); + if (!tx_br) { BLOGE(sc, "Multiqueue TX and no buf_ring!\n"); return (EINVAL); } + if (!sc->link_vars.link_up || + (ifp->if_drv_flags & + (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) { + rc = drbr_enqueue_drv(ifp, tx_br, m); + goto bxe_tx_mq_start_locked_exit; + } + /* fetch the depth of the driver queue */ depth = drbr_inuse(ifp, tx_br); if (depth > fp->eth_q_stats.tx_max_drbr_queue_depth) { fp->eth_q_stats.tx_max_drbr_queue_depth = depth; } - BXE_FP_TX_LOCK_ASSERT(fp); - if (m == NULL) { /* no new work, check for pending frames */ next = drbr_dequeue(ifp, tx_br); @@ -6120,26 +6127,11 @@ bxe_tx_mq_start(struct ifnet *ifp, fp = &sc->fp[fp_index]; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - BLOGW(sc, "Interface not running, ignoring transmit request\n"); - return (ENETDOWN); - } - - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { - BLOGW(sc, "Interface TX queue is full, ignoring transmit request\n"); - return (EBUSY); - } - - if (!sc->link_vars.link_up) { - BLOGW(sc, "Interface link is down, ignoring transmit request\n"); - return (ENETDOWN); - } - - /* XXX change to TRYLOCK here and if failed then schedule taskqueue */ - - BXE_FP_TX_LOCK(fp); - rc = bxe_tx_mq_start_locked(sc, ifp, fp, m); - BXE_FP_TX_UNLOCK(fp); + if (BXE_FP_TX_TRYLOCK(fp)) { + rc = bxe_tx_mq_start_locked(sc, ifp, fp, m); + BXE_FP_TX_UNLOCK(fp); + } else + rc = drbr_enqueue_drv(ifp, fp->tx_br, m); return (rc); } diff --git a/sys/dev/bxe/bxe.h b/sys/dev/bxe/bxe.h index 173a164a7f44..32b63f5228b1 100644 --- a/sys/dev/bxe/bxe.h +++ b/sys/dev/bxe/bxe.h @@ -582,6 +582,7 @@ struct bxe_fastpath { #define BXE_FP_TX_LOCK(fp) mtx_lock(&fp->tx_mtx) #define BXE_FP_TX_UNLOCK(fp) mtx_unlock(&fp->tx_mtx) #define BXE_FP_TX_LOCK_ASSERT(fp) mtx_assert(&fp->tx_mtx, MA_OWNED) +#define BXE_FP_TX_TRYLOCK(fp) mtx_trylock(&fp->tx_mtx) #define BXE_FP_RX_LOCK(fp) mtx_lock(&fp->rx_mtx) #define BXE_FP_RX_UNLOCK(fp) mtx_unlock(&fp->rx_mtx) |
