From owner-svn-src-head@freebsd.org Tue Apr 12 21:00:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3910B0E57E; Tue, 12 Apr 2016 21:00:39 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B79431062; Tue, 12 Apr 2016 21:00:39 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3CL0cFE041023; Tue, 12 Apr 2016 21:00:38 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3CL0cl1041021; Tue, 12 Apr 2016 21:00:38 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201604122100.u3CL0cl1041021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 12 Apr 2016 21:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297873 - head/sys/dev/bxe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Apr 2016 21:00:40 -0000 Author: davidcs Date: Tue Apr 12 21:00:38 2016 New Revision: 297873 URL: https://svnweb.freebsd.org/changeset/base/297873 Log: 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 Approved by:davidcs@freebsd.org MFC after:5 days Modified: head/sys/dev/bxe/bxe.c head/sys/dev/bxe/bxe_stats.h Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Tue Apr 12 20:59:25 2016 (r297872) +++ head/sys/dev/bxe/bxe.c Tue Apr 12 21:00:38 2016 (r297873) @@ -487,7 +487,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 { @@ -598,7 +600,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) @@ -4619,7 +4623,7 @@ bxe_ioctl(if_t ifp, if (if_getdrvflags(ifp) & 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 { @@ -5723,11 +5727,6 @@ bxe_tx_start(if_t ifp) return; } - if (if_getdrvflags(ifp) & 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; @@ -5735,6 +5734,11 @@ bxe_tx_start(if_t 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); @@ -9936,21 +9940,6 @@ bxe_init_internal_common(struct bxe_soft { 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. @@ -12269,6 +12258,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)) { @@ -12291,6 +12282,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)) { + if_t ifp = sc->ifp; + /* + * 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) { @@ -16137,6 +16170,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); } Modified: head/sys/dev/bxe/bxe_stats.h ============================================================================== --- head/sys/dev/bxe/bxe_stats.h Tue Apr 12 20:59:25 2016 (r297872) +++ head/sys/dev/bxe/bxe_stats.h Tue Apr 12 21:00:38 2016 (r297873) @@ -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 {