Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Feb 2015 06:22:00 +0000 (UTC)
From:      Andrew Rybchenko <arybchik@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r278940 - head/sys/dev/sfxge
Message-ID:  <201502180622.t1I6M0wU077512@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502180622.t1I6M0wU077512>