From ceb7440c9ffab74167042d5b22d02b83f9e49e38 Mon Sep 17 00:00:00 2001 From: davidcs Date: Tue, 19 Apr 2016 19:08:44 +0000 Subject: [PATCH] MFC r297873 1. Process tx completions in bxe_periodic_callout_func() and restart transmissions if possible. 2. For SIOCSIFFLAGS call bxe_init_locked() only if !BXE_STATE_DISABLED 3. remove code not needed in bxe_init_internal_common() Submitted by:vaishali.kulkarni@qlogic.com;venkata.bhavaraju@qlogic.com git-svn-id: svn://svn.freebsd.org/base/stable/8@298287 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/bxe/bxe.c | 80 +++++++++++++++++++++++++++++------------ sys/dev/bxe/bxe_stats.h | 6 ++++ 2 files changed, 63 insertions(+), 23 deletions(-) diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c index fb425cdae..c31f40638 100644 --- a/sys/dev/bxe/bxe.c +++ b/sys/dev/bxe/bxe.c @@ -498,7 +498,9 @@ static const struct { { STATS_OFFSET32(mbuf_alloc_sge), 4, STATS_FLAGS_FUNC, "mbuf_alloc_sge"}, { STATS_OFFSET32(mbuf_alloc_tpa), - 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"} + 4, STATS_FLAGS_FUNC, "mbuf_alloc_tpa"}, + { STATS_OFFSET32(tx_queue_full_return), + 4, STATS_FLAGS_FUNC, "tx_queue_full_return"} }; static const struct { @@ -609,7 +611,9 @@ static const struct { { Q_STATS_OFFSET32(mbuf_alloc_sge), 4, "mbuf_alloc_sge"}, { Q_STATS_OFFSET32(mbuf_alloc_tpa), - 4, "mbuf_alloc_tpa"} + 4, "mbuf_alloc_tpa"}, + { Q_STATS_OFFSET32(tx_queue_full_return), + 4, "tx_queue_full_return"} }; #define BXE_NUM_ETH_STATS ARRAY_SIZE(bxe_eth_stats_arr) @@ -4626,7 +4630,7 @@ bxe_ioctl(struct ifnet *ifp, if (ifp->if_drv_flags & IFF_DRV_RUNNING) { /* set the receive mode flags */ bxe_set_rx_mode(sc); - } else { + } else if(sc->state != BXE_STATE_DISABLED) { bxe_init_locked(sc); } } else { @@ -5729,11 +5733,6 @@ bxe_tx_start(struct ifnet *ifp) return; } - if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { - BLOGW(sc, "Interface TX queue is full, ignoring transmit request\n"); - return; - } - if (!sc->link_vars.link_up) { BLOGW(sc, "Interface link is down, ignoring transmit request\n"); return; @@ -5741,6 +5740,11 @@ bxe_tx_start(struct ifnet *ifp) fp = &sc->fp[0]; + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { + fp->eth_q_stats.tx_queue_full_return++; + return; + } + BXE_FP_TX_LOCK(fp); bxe_tx_start_locked(sc, ifp, fp); BXE_FP_TX_UNLOCK(fp); @@ -9942,21 +9946,6 @@ bxe_init_internal_common(struct bxe_softc *sc) { int i; - if (IS_MF_SI(sc)) { - /* - * In switch independent mode, the TSTORM needs to accept - * packets that failed classification, since approximate match - * mac addresses aren't written to NIG LLH. - */ - REG_WR8(sc, - (BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET), - 2); - } else if (!CHIP_IS_E1(sc)) { /* 57710 doesn't support MF */ - REG_WR8(sc, - (BAR_TSTRORM_INTMEM + TSTORM_ACCEPT_CLASSIFY_FAILED_OFFSET), - 0); - } - /* * Zero this manually as its initialization is currently missing * in the initTool. @@ -12299,6 +12288,8 @@ static void bxe_periodic_callout_func(void *xsc) { struct bxe_softc *sc = (struct bxe_softc *)xsc; + struct bxe_fastpath *fp; + uint16_t tx_bd_avail; int i; if (!BXE_CORE_TRYLOCK(sc)) { @@ -12321,6 +12312,48 @@ bxe_periodic_callout_func(void *xsc) return; } +#if __FreeBSD_version >= 800000 + + FOR_EACH_QUEUE(sc, i) { + fp = &sc->fp[i]; + + if (BXE_FP_TX_TRYLOCK(fp)) { + struct ifnet *ifp = sc->ifnet; + /* + * If interface was stopped due to unavailable + * bds, try to process some tx completions + */ + (void) bxe_txeof(sc, fp); + + tx_bd_avail = bxe_tx_avail(sc, fp); + if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) { + bxe_tx_mq_start_locked(sc, ifp, fp, NULL); + } + BXE_FP_TX_UNLOCK(fp); + } + } + +#else + + fp = &sc->fp[0]; + if (BXE_FP_TX_TRYLOCK(fp)) { + struct ifnet *ifp = sc->ifnet; + /* + * If interface was stopped due to unavailable + * bds, try to process some tx completions + */ + (void) bxe_txeof(sc, fp); + + tx_bd_avail = bxe_tx_avail(sc, fp); + if (tx_bd_avail >= BXE_TX_CLEANUP_THRESHOLD) { + bxe_tx_start_locked(sc, ifp, fp); + } + + BXE_FP_TX_UNLOCK(fp); + } + +#endif /* #if __FreeBSD_version >= 800000 */ + /* Check for TX timeouts on any fastpath. */ FOR_EACH_QUEUE(sc, i) { if (bxe_watchdog(sc, &sc->fp[i]) != 0) { @@ -16169,6 +16202,7 @@ bxe_detach(device_t dev) if (sc->state != BXE_STATE_CLOSED) { BXE_CORE_LOCK(sc); bxe_nic_unload(sc, UNLOAD_CLOSE, TRUE); + sc->state = BXE_STATE_DISABLED; BXE_CORE_UNLOCK(sc); } diff --git a/sys/dev/bxe/bxe_stats.h b/sys/dev/bxe/bxe_stats.h index a91c0cba0..31f4c8333 100644 --- a/sys/dev/bxe/bxe_stats.h +++ b/sys/dev/bxe/bxe_stats.h @@ -263,6 +263,9 @@ struct bxe_eth_stats { uint32_t mbuf_alloc_rx; uint32_t mbuf_alloc_sge; uint32_t mbuf_alloc_tpa; + + /* num. of times tx queue full occured */ + uint32_t tx_queue_full_return; }; @@ -366,6 +369,9 @@ struct bxe_eth_q_stats { uint32_t mbuf_alloc_rx; uint32_t mbuf_alloc_sge; uint32_t mbuf_alloc_tpa; + + /* num. of times tx queue full occured */ + uint32_t tx_queue_full_return; }; struct bxe_eth_stats_old { -- 2.42.0