From owner-svn-src-all@FreeBSD.ORG Wed Feb 18 06:22:01 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 25CBED60; Wed, 18 Feb 2015 06:22:01 +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 104B0332; Wed, 18 Feb 2015 06:22:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t1I6M0st077515; Wed, 18 Feb 2015 06:22:00 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t1I6M0wU077512; Wed, 18 Feb 2015 06:22:00 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201502180622.t1I6M0wU077512@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Wed, 18 Feb 2015 06:22:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r278940 - head/sys/dev/sfxge X-SVN-Group: head 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, 18 Feb 2015 06:22:01 -0000 Author: arybchik Date: Wed Feb 18 06:21:59 2015 New Revision: 278940 URL: https://svnweb.freebsd.org/changeset/base/278940 Log: sfxge: add driver context member with number of event queues Mainly to unify with similar member for transmit and receive queues. It will be used in the future for resources allocation processing. Sponsored by: Solarflare Communications, Inc. Approved by: gnn (mentor) Modified: head/sys/dev/sfxge/sfxge.h head/sys/dev/sfxge/sfxge_ev.c Modified: head/sys/dev/sfxge/sfxge.h ============================================================================== --- head/sys/dev/sfxge/sfxge.h Wed Feb 18 06:20:59 2015 (r278939) +++ head/sys/dev/sfxge/sfxge.h Wed Feb 18 06:21:59 2015 (r278940) @@ -260,6 +260,7 @@ struct sfxge_softc { char tx_lock_name[SFXGE_LOCK_NAME_MAX]; #endif + unsigned int evq_count; unsigned int rxq_count; unsigned int txq_count; }; Modified: head/sys/dev/sfxge/sfxge_ev.c ============================================================================== --- head/sys/dev/sfxge/sfxge_ev.c Wed Feb 18 06:20:59 2015 (r278939) +++ head/sys/dev/sfxge/sfxge_ev.c Wed Feb 18 06:21:59 2015 (r278940) @@ -427,7 +427,7 @@ sfxge_ev_stat_update(struct sfxge_softc sc->ev_stats_update_time = now; /* Add event counts from each event queue in turn */ - for (index = 0; index < sc->intr.n_alloc; index++) { + for (index = 0; index < sc->evq_count; index++) { evq = sc->evq[index]; SFXGE_EVQ_LOCK(evq); efx_ev_qstats_update(evq->common, sc->ev_stats); @@ -493,7 +493,7 @@ sfxge_int_mod_handler(SYSCTL_HANDLER_ARG struct sfxge_intr *intr = &sc->intr; unsigned int moderation; int error; - int index; + unsigned int index; SFXGE_ADAPTER_LOCK(sc); @@ -513,7 +513,7 @@ sfxge_int_mod_handler(SYSCTL_HANDLER_ARG sc->ev_moderation = moderation; if (intr->state == SFXGE_INTR_STARTED) { - for (index = 0; index < intr->n_alloc; index++) + for (index = 0; index < sc->evq_count; index++) sfxge_ev_qmoderate(sc, index, moderation); } } else { @@ -727,7 +727,7 @@ sfxge_ev_stop(struct sfxge_softc *sc) ("Interrupts not started")); /* Stop the event queue(s) */ - index = intr->n_alloc; + index = sc->evq_count; while (--index >= 0) sfxge_ev_qstop(sc, index); @@ -752,7 +752,7 @@ sfxge_ev_start(struct sfxge_softc *sc) return (rc); /* Start the event queues */ - for (index = 0; index < intr->n_alloc; index++) { + for (index = 0; index < sc->evq_count; index++) { if ((rc = sfxge_ev_qstart(sc, index)) != 0) goto fail; } @@ -853,9 +853,11 @@ sfxge_ev_fini(struct sfxge_softc *sc) sc->ev_moderation = 0; /* Tear down the event queue(s). */ - index = intr->n_alloc; + index = sc->evq_count; while (--index >= 0) sfxge_ev_qfini(sc, index); + + sc->evq_count = 0; } int @@ -869,6 +871,8 @@ sfxge_ev_init(struct sfxge_softc *sc) intr = &sc->intr; + sc->evq_count = intr->n_alloc; + KASSERT(intr->state == SFXGE_INTR_INITIALIZED, ("intr->state != SFXGE_INTR_INITIALIZED")); @@ -884,7 +888,7 @@ sfxge_ev_init(struct sfxge_softc *sc) /* * Initialize the event queue(s) - one per interrupt. */ - for (index = 0; index < intr->n_alloc; index++) { + for (index = 0; index < sc->evq_count; index++) { if ((rc = sfxge_ev_qinit(sc, index)) != 0) goto fail; } @@ -899,5 +903,6 @@ fail: while (--index >= 0) sfxge_ev_qfini(sc, index); + sc->evq_count = 0; return (rc); }