From owner-svn-src-all@FreeBSD.ORG Wed Mar 25 10:42:20 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DCB51FDF; Wed, 25 Mar 2015 10:42:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 BD97FA62; Wed, 25 Mar 2015 10:42:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2PAgK9r093627; Wed, 25 Mar 2015 10:42:20 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2PAgJjn093624; Wed, 25 Mar 2015 10:42:19 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201503251042.t2PAgJjn093624@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 25 Mar 2015 10:42:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r280538 - stable/10/sys/dev/sfxge X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Mar 2015 10:42:21 -0000 Author: arybchik Date: Wed Mar 25 10:42:19 2015 New Revision: 280538 URL: https://svnweb.freebsd.org/changeset/base/280538 Log: MFC: 278938 sfxge: add driver context member with number of transmit queues Sponsored by: Solarflare Communications, Inc. Approved by: gnn (mentor) Modified: stable/10/sys/dev/sfxge/sfxge.h stable/10/sys/dev/sfxge/sfxge_tx.c stable/10/sys/dev/sfxge/sfxge_tx.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/sfxge/sfxge.h ============================================================================== --- stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:41:09 2015 (r280537) +++ stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:42:19 2015 (r280538) @@ -258,6 +258,8 @@ struct sfxge_softc { struct mtx tx_lock __aligned(CACHE_LINE_SIZE); char tx_lock_name[SFXGE_LOCK_NAME_MAX]; #endif + + unsigned int txq_count; }; #define SFXGE_LINK_UP(sc) ((sc)->port.link_mode != EFX_LINK_DOWN) Modified: stable/10/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.c Wed Mar 25 10:41:09 2015 (r280537) +++ stable/10/sys/dev/sfxge/sfxge_tx.c Wed Mar 25 10:42:19 2015 (r280538) @@ -649,7 +649,7 @@ sfxge_if_qflush(struct ifnet *ifp) sc = ifp->if_softc; - for (i = 0; i < SFXGE_TXQ_IP_TCP_UDP_CKSUM + SFXGE_TX_SCALE(sc); i++) + for (i = 0; i < sc->txq_count; i++) sfxge_tx_qdpl_flush(sc->txq[i]); } @@ -1279,13 +1279,9 @@ sfxge_tx_stop(struct sfxge_softc *sc) { int index; - index = SFXGE_TX_SCALE(sc); + index = sc->txq_count; while (--index >= 0) - sfxge_tx_qstop(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index); - - sfxge_tx_qstop(sc, SFXGE_TXQ_IP_CKSUM); - - sfxge_tx_qstop(sc, SFXGE_TXQ_NON_CKSUM); + sfxge_tx_qstop(sc, index); /* Tear down the transmit module */ efx_tx_fini(sc->enp); @@ -1301,30 +1297,17 @@ sfxge_tx_start(struct sfxge_softc *sc) if ((rc = efx_tx_init(sc->enp)) != 0) return (rc); - if ((rc = sfxge_tx_qstart(sc, SFXGE_TXQ_NON_CKSUM)) != 0) - goto fail; - - if ((rc = sfxge_tx_qstart(sc, SFXGE_TXQ_IP_CKSUM)) != 0) - goto fail2; - - for (index = 0; index < SFXGE_TX_SCALE(sc); index++) { - if ((rc = sfxge_tx_qstart(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + - index)) != 0) - goto fail3; + for (index = 0; index < sc->txq_count; index++) { + if ((rc = sfxge_tx_qstart(sc, index)) != 0) + goto fail; } return (0); -fail3: +fail: while (--index >= 0) - sfxge_tx_qstop(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index); - - sfxge_tx_qstop(sc, SFXGE_TXQ_IP_CKSUM); - -fail2: - sfxge_tx_qstop(sc, SFXGE_TXQ_NON_CKSUM); + sfxge_tx_qstop(sc, index); -fail: efx_tx_fini(sc->enp); return (rc); @@ -1535,9 +1518,7 @@ sfxge_tx_stat_handler(SYSCTL_HANDLER_ARG /* Sum across all TX queues */ sum = 0; - for (index = 0; - index < SFXGE_TXQ_IP_TCP_UDP_CKSUM + SFXGE_TX_SCALE(sc); - index++) + for (index = 0; index < sc->txq_count; index++) sum += *(unsigned long *)((caddr_t)sc->txq[index] + sfxge_tx_stats[id].offset); @@ -1570,12 +1551,11 @@ sfxge_tx_fini(struct sfxge_softc *sc) { int index; - index = SFXGE_TX_SCALE(sc); + index = sc->txq_count; while (--index >= 0) - sfxge_tx_qfini(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index); + sfxge_tx_qfini(sc, index); - sfxge_tx_qfini(sc, SFXGE_TXQ_IP_CKSUM); - sfxge_tx_qfini(sc, SFXGE_TXQ_NON_CKSUM); + sc->txq_count = 0; } @@ -1591,6 +1571,12 @@ sfxge_tx_init(struct sfxge_softc *sc) KASSERT(intr->state == SFXGE_INTR_INITIALIZED, ("intr->state != SFXGE_INTR_INITIALIZED")); +#ifdef SFXGE_HAVE_MQ + sc->txq_count = SFXGE_TXQ_NTYPES - 1 + sc->intr.n_alloc; +#else + sc->txq_count = SFXGE_TXQ_NTYPES; +#endif + sc->txqs_node = SYSCTL_ADD_NODE( device_get_sysctl_ctx(sc->dev), SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)), @@ -1609,8 +1595,10 @@ sfxge_tx_init(struct sfxge_softc *sc) SFXGE_TXQ_IP_CKSUM, 0)) != 0) goto fail2; - for (index = 0; index < SFXGE_TX_SCALE(sc); index++) { - if ((rc = sfxge_tx_qinit(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index, + for (index = 0; + index < sc->txq_count - SFXGE_TXQ_NTYPES + 1; + index++) { + if ((rc = sfxge_tx_qinit(sc, SFXGE_TXQ_NTYPES - 1 + index, SFXGE_TXQ_IP_TCP_UDP_CKSUM, index)) != 0) goto fail3; } @@ -1620,15 +1608,16 @@ sfxge_tx_init(struct sfxge_softc *sc) return (0); fail3: - sfxge_tx_qfini(sc, SFXGE_TXQ_IP_CKSUM); - while (--index >= 0) sfxge_tx_qfini(sc, SFXGE_TXQ_IP_TCP_UDP_CKSUM + index); + sfxge_tx_qfini(sc, SFXGE_TXQ_IP_CKSUM); + fail2: sfxge_tx_qfini(sc, SFXGE_TXQ_NON_CKSUM); fail: fail_txq_node: + sc->txq_count = 0; return (rc); } Modified: stable/10/sys/dev/sfxge/sfxge_tx.h ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_tx.h Wed Mar 25 10:41:09 2015 (r280537) +++ stable/10/sys/dev/sfxge/sfxge_tx.h Wed Mar 25 10:42:19 2015 (r280538) @@ -124,10 +124,8 @@ enum sfxge_txq_type { #ifdef SFXGE_HAVE_MQ #define SFXGE_TX_LOCK(txq) (&(txq)->lock) -#define SFXGE_TX_SCALE(sc) ((sc)->intr.n_alloc) #else #define SFXGE_TX_LOCK(txq) (&(txq)->sc->tx_lock) -#define SFXGE_TX_SCALE(sc) 1 #endif #define SFXGE_TXQ_LOCK_INIT(_txq, _ifname, _txq_index) \