From owner-svn-src-all@FreeBSD.ORG Sat Jul 28 04:42:06 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A2C661065674; Sat, 28 Jul 2012 04:42:06 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 745AC8FC19; Sat, 28 Jul 2012 04:42:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6S4g6EL084377; Sat, 28 Jul 2012 04:42:06 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6S4g66H084373; Sat, 28 Jul 2012 04:42:06 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201207280442.q6S4g66H084373@svn.freebsd.org> From: Adrian Chadd Date: Sat, 28 Jul 2012 04:42:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238855 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 28 Jul 2012 04:42:06 -0000 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;