svn commit: r280541 - stable/10/sys/dev/sfxge

Andrew Rybchenko arybchik at FreeBSD.org
Wed Mar 25 10:44:31 UTC 2015


Author: arybchik
Date: Wed Mar 25 10:44:30 2015
New Revision: 280541
URL: https://svnweb.freebsd.org/changeset/base/280541

Log:
  MFC: 278940
  
  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:
  stable/10/sys/dev/sfxge/sfxge.h
  stable/10/sys/dev/sfxge/sfxge_ev.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:44:09 2015	(r280540)
+++ stable/10/sys/dev/sfxge/sfxge.h	Wed Mar 25 10:44:30 2015	(r280541)
@@ -259,6 +259,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: stable/10/sys/dev/sfxge/sfxge_ev.c
==============================================================================
--- stable/10/sys/dev/sfxge/sfxge_ev.c	Wed Mar 25 10:44:09 2015	(r280540)
+++ stable/10/sys/dev/sfxge/sfxge_ev.c	Wed Mar 25 10:44:30 2015	(r280541)
@@ -422,7 +422,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);
@@ -488,7 +488,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);
 
@@ -508,7 +508,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 {
@@ -722,7 +722,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);
 
@@ -747,7 +747,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;
 	}
@@ -848,9 +848,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
@@ -864,6 +866,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"));
 
@@ -879,7 +883,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;
 	}
@@ -894,5 +898,6 @@ fail:
 	while (--index >= 0)
 		sfxge_ev_qfini(sc, index);
 
+	sc->evq_count = 0;
 	return (rc);
 }


More information about the svn-src-all mailing list