From owner-svn-src-all@FreeBSD.ORG Wed Mar 25 10:43:08 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 E12351A8; Wed, 25 Mar 2015 10:43:07 +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 CB060A6D; Wed, 25 Mar 2015 10:43:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2PAh7dD093790; Wed, 25 Mar 2015 10:43:07 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2PAh7HT093788; Wed, 25 Mar 2015 10:43:07 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201503251043.t2PAh7HT093788@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:43:07 +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: r280539 - 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:43:08 -0000 Author: arybchik Date: Wed Mar 25 10:43:06 2015 New Revision: 280539 URL: https://svnweb.freebsd.org/changeset/base/280539 Log: MFC: 278939 sfxge: add driver context member with number of receive queues Mainly to unify with similar member for 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_rx.c 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:42:19 2015 (r280538) +++ stable/10/sys/dev/sfxge/sfxge.h Wed Mar 25 10:43:06 2015 (r280539) @@ -259,6 +259,7 @@ struct sfxge_softc { char tx_lock_name[SFXGE_LOCK_NAME_MAX]; #endif + unsigned int rxq_count; unsigned int txq_count; }; Modified: stable/10/sys/dev/sfxge/sfxge_rx.c ============================================================================== --- stable/10/sys/dev/sfxge/sfxge_rx.c Wed Mar 25 10:42:19 2015 (r280538) +++ stable/10/sys/dev/sfxge/sfxge_rx.c Wed Mar 25 10:43:06 2015 (r280539) @@ -939,13 +939,10 @@ fail: void sfxge_rx_stop(struct sfxge_softc *sc) { - struct sfxge_intr *intr; int index; - intr = &sc->intr; - /* Stop the receive queue(s) */ - index = intr->n_alloc; + index = sc->rxq_count; while (--index >= 0) sfxge_rx_qstop(sc, index); @@ -987,7 +984,7 @@ sfxge_rx_start(struct sfxge_softc *sc) * Set up the scale table. Enable all hash types and hash insertion. */ for (index = 0; index < SFXGE_RX_SCALE_MAX; index++) - sc->rx_indir_table[index] = index % sc->intr.n_alloc; + sc->rx_indir_table[index] = index % sc->rxq_count; if ((rc = efx_rx_scale_tbl_set(sc->enp, sc->rx_indir_table, SFXGE_RX_SCALE_MAX)) != 0) goto fail; @@ -1000,7 +997,7 @@ sfxge_rx_start(struct sfxge_softc *sc) goto fail; /* Start the receive queue(s). */ - for (index = 0; index < intr->n_alloc; index++) { + for (index = 0; index < sc->rxq_count; index++) { if ((rc = sfxge_rx_qstart(sc, index)) != 0) goto fail2; } @@ -1099,7 +1096,7 @@ sfxge_rx_qinit(struct sfxge_softc *sc, u efsys_mem_t *esmp; int rc; - KASSERT(index < sc->intr.n_alloc, ("index >= %d", sc->intr.n_alloc)); + KASSERT(index < sc->rxq_count, ("index >= %d", sc->rxq_count)); rxq = malloc(sizeof(struct sfxge_rxq), M_SFXGE, M_ZERO | M_WAITOK); rxq->sc = sc; @@ -1159,7 +1156,7 @@ sfxge_rx_stat_handler(SYSCTL_HANDLER_ARG /* Sum across all RX queues */ sum = 0; - for (index = 0; index < sc->intr.n_alloc; index++) + for (index = 0; index < sc->rxq_count; index++) sum += *(unsigned int *)((caddr_t)sc->rxq[index] + sfxge_rx_stats[id].offset); @@ -1190,14 +1187,13 @@ sfxge_rx_stat_init(struct sfxge_softc *s void sfxge_rx_fini(struct sfxge_softc *sc) { - struct sfxge_intr *intr; int index; - intr = &sc->intr; - - index = intr->n_alloc; + index = sc->rxq_count; while (--index >= 0) sfxge_rx_qfini(sc, index); + + sc->rxq_count = 0; } int @@ -1212,11 +1208,13 @@ sfxge_rx_init(struct sfxge_softc *sc) intr = &sc->intr; + sc->rxq_count = intr->n_alloc; + KASSERT(intr->state == SFXGE_INTR_INITIALIZED, ("intr->state != SFXGE_INTR_INITIALIZED")); /* Initialize the receive queue(s) - one per interrupt. */ - for (index = 0; index < intr->n_alloc; index++) { + for (index = 0; index < sc->rxq_count; index++) { if ((rc = sfxge_rx_qinit(sc, index)) != 0) goto fail; } @@ -1230,5 +1228,6 @@ fail: while (--index >= 0) sfxge_rx_qfini(sc, index); + sc->rxq_count = 0; return (rc); }