Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jul 2012 04:42:06 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238855 - head/sys/dev/ath
Message-ID:  <201207280442.q6S4g66H084373@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sat Jul 28 04:42:05 2012
New Revision: 238855
URL: http://svn.freebsd.org/changeset/base/238855

Log:
  Flesh out the initial TX FIFO storage for each hardware TX queue.

Modified:
  head/sys/dev/ath/if_ath_tx_edma.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath_tx_edma.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx_edma.c	Sat Jul 28 04:40:52 2012	(r238854)
+++ head/sys/dev/ath/if_ath_tx_edma.c	Sat Jul 28 04:42:05 2012	(r238855)
@@ -131,9 +131,42 @@ __FBSDID("$FreeBSD$");
 MALLOC_DECLARE(M_ATHDEV);
 
 static int
+ath_edma_setup_txfifo(struct ath_softc *sc, int qnum)
+{
+	struct ath_tx_edma_fifo *te = &sc->sc_txedma[qnum];
+
+	te->m_fifo = malloc(sizeof(struct ath_buf *) * HAL_TXFIFO_DEPTH,
+	    M_ATHDEV,
+	    M_NOWAIT | M_ZERO);
+	if (te->m_fifo == NULL) {
+		device_printf(sc->sc_dev, "%s: malloc failed\n",
+		    __func__);
+		return (-ENOMEM);
+	}
+
+	/*
+	 * Set initial "empty" state.
+	 */
+	te->m_fifo_head = te->m_fifo_tail = te->m_fifo_depth = 0;
+	
+	return (0);
+}
+
+static int
+ath_edma_free_txfifo(struct ath_softc *sc, int qnum)
+{
+	struct ath_tx_edma_fifo *te = &sc->sc_txedma[qnum];
+
+	/* XXX TODO: actually deref the ath_buf entries? */
+	free(te->m_fifo, M_ATHDEV);
+	return (0);
+}
+
+static int
 ath_edma_dma_txsetup(struct ath_softc *sc)
 {
 	int error;
+	int i;
 
 	error = ath_descdma_alloc_desc(sc, &sc->sc_txsdma,
 	    NULL, "txcomp", sc->sc_tx_statuslen, ATH_TXSTATUS_RING_SIZE);
@@ -145,6 +178,10 @@ ath_edma_dma_txsetup(struct ath_softc *s
 	    sc->sc_txsdma.dd_desc_paddr,
 	    ATH_TXSTATUS_RING_SIZE);
 
+	for (i = 0; i < HAL_NUM_TX_QUEUES; i++) {
+		ath_edma_setup_txfifo(sc, i);
+	}
+
 
 	return (0);
 }
@@ -152,6 +189,11 @@ ath_edma_dma_txsetup(struct ath_softc *s
 static int
 ath_edma_dma_txteardown(struct ath_softc *sc)
 {
+	int i;
+
+	for (i = 0; i < HAL_NUM_TX_QUEUES; i++) {
+		ath_edma_free_txfifo(sc, i);
+	}
 
 	ath_descdma_cleanup(sc, &sc->sc_txsdma, NULL);
 	return (0);

Modified: head/sys/dev/ath/if_athvar.h
==============================================================================
--- head/sys/dev/ath/if_athvar.h	Sat Jul 28 04:40:52 2012	(r238854)
+++ head/sys/dev/ath/if_athvar.h	Sat Jul 28 04:42:05 2012	(r238855)
@@ -397,6 +397,14 @@ struct ath_rx_edma {
 	struct mbuf	*m_rxpending;
 };
 
+struct ath_tx_edma_fifo {
+	struct ath_buf	**m_fifo;
+	int		m_fifolen;
+	int		m_fifo_head;
+	int		m_fifo_tail;
+	int		m_fifo_depth;
+};
+
 struct ath_tx_methods {
 	int		(*xmit_setup)(struct ath_softc *sc);
 	int		(*xmit_teardown)(struct ath_softc *sc);
@@ -418,6 +426,7 @@ struct ath_softc {
 	struct ath_rx_methods	sc_rx;
 	struct ath_rx_edma	sc_rxedma[HAL_NUM_RX_QUEUES];	/* HP/LP queues */
 	struct ath_tx_methods	sc_tx;
+	struct ath_tx_edma_fifo	sc_txedma[HAL_NUM_TX_QUEUES];
 
 	int			sc_rx_statuslen;
 	int			sc_tx_desclen;



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