svn commit: r289126 - head/sys/dev/wpi

Adrian Chadd adrian at FreeBSD.org
Sun Oct 11 01:53:53 UTC 2015


Author: adrian
Date: Sun Oct 11 01:53:51 2015
New Revision: 289126
URL: https://svnweb.freebsd.org/changeset/base/289126

Log:
  wpi(4): do not allocate space for unused rings.
  
  Tested:
  
  * Tested with Intel 3945BG, STA mode
  
  Submitted by:	<s3erios at gmail.com>
  Differential Revision:	https://reviews.freebsd.org/D3765

Modified:
  head/sys/dev/wpi/if_wpi.c
  head/sys/dev/wpi/if_wpivar.h

Modified: head/sys/dev/wpi/if_wpi.c
==============================================================================
--- head/sys/dev/wpi/if_wpi.c	Sun Oct 11 01:50:54 2015	(r289125)
+++ head/sys/dev/wpi/if_wpi.c	Sun Oct 11 01:53:51 2015	(r289126)
@@ -425,7 +425,7 @@ wpi_attach(device_t dev)
 	}
 
 	/* Allocate TX rings - 4 for QoS purposes, 1 for commands. */
-	for (i = 0; i < WPI_NTXQUEUES; i++) {
+	for (i = 0; i < WPI_DRV_NTXQUEUES; i++) {
 		if ((error = wpi_alloc_tx_ring(sc, &sc->txq[i], i)) != 0) {
 			device_printf(dev,
 			    "could not allocate TX ring %d, error %d\n", i,
@@ -713,7 +713,7 @@ wpi_detach(device_t dev)
 
 	if (sc->txq[0].data_dmat) {
 		/* Free DMA resources. */
-		for (qid = 0; qid < WPI_NTXQUEUES; qid++)
+		for (qid = 0; qid < WPI_DRV_NTXQUEUES; qid++)
 			wpi_free_tx_ring(sc, &sc->txq[qid]);
 
 		wpi_free_rx_ring(sc);
@@ -1186,16 +1186,6 @@ wpi_alloc_tx_ring(struct wpi_softc *sc, 
 	bus_dmamap_sync(sc->shared_dma.tag, sc->shared_dma.map,
 	    BUS_DMASYNC_PREWRITE);
 
-	/*
-	 * We only use rings 0 through 4 (4 EDCA + cmd) so there is no need
-	 * to allocate commands space for other rings.
-	 * XXX Do we really need to allocate descriptors for other rings?
-	 */
-	if (qid > WPI_CMD_QUEUE_NUM) {
-		DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__);
-		return 0;
-	}
-
 	size = WPI_TX_RING_COUNT * sizeof (struct wpi_tx_cmd);
 	error = wpi_dma_contig_alloc(sc, &ring->cmd_dma, (void **)&ring->cmd,
 	    size, 4);
@@ -5326,7 +5316,7 @@ wpi_hw_stop(struct wpi_softc *sc)
 	wpi_reset_rx_ring(sc);
 
 	/* Reset all TX rings. */
-	for (qid = 0; qid < WPI_NTXQUEUES; qid++)
+	for (qid = 0; qid < WPI_DRV_NTXQUEUES; qid++)
 		wpi_reset_tx_ring(sc, &sc->txq[qid]);
 
 	if (wpi_nic_lock(sc) == 0) {

Modified: head/sys/dev/wpi/if_wpivar.h
==============================================================================
--- head/sys/dev/wpi/if_wpivar.h	Sun Oct 11 01:50:54 2015	(r289125)
+++ head/sys/dev/wpi/if_wpivar.h	Sun Oct 11 01:53:51 2015	(r289126)
@@ -176,7 +176,7 @@ struct wpi_softc {
 	struct wpi_dma_info	shared_dma;
 	struct wpi_shared	*shared;
 
-	struct wpi_tx_ring	txq[WPI_NTXQUEUES];
+	struct wpi_tx_ring	txq[WPI_DRV_NTXQUEUES];
 	struct mtx		txq_mtx;
 	struct mtx		txq_state_mtx;
 


More information about the svn-src-head mailing list