svn commit: r238729 - head/sys/dev/ath
Adrian Chadd
adrian at FreeBSD.org
Mon Jul 23 23:40:14 UTC 2012
Author: adrian
Date: Mon Jul 23 23:40:13 2012
New Revision: 238729
URL: http://svn.freebsd.org/changeset/base/238729
Log:
Modify ath_descdma_setup() to take a descriptor size parameter.
The AR9300 and later descriptors are 128 bytes, however I'd like to make
sure that isn't used for earlier chips.
* Populate the TX descriptor length field in the softc with
sizeof(ath_desc)
* Use this field when allocating the TX descriptors
* Pre-AR93xx TX/RX descriptors will use the ath_desc size; newer ones will
query the HAL for these sizes.
Modified:
head/sys/dev/ath/if_ath.c
head/sys/dev/ath/if_ath_misc.h
head/sys/dev/ath/if_ath_rx.c
head/sys/dev/ath/if_ath_tx.c
Modified: head/sys/dev/ath/if_ath.c
==============================================================================
--- head/sys/dev/ath/if_ath.c Mon Jul 23 21:32:37 2012 (r238728)
+++ head/sys/dev/ath/if_ath.c Mon Jul 23 23:40:13 2012 (r238729)
@@ -2767,7 +2767,7 @@ ath_load_cb(void *arg, bus_dma_segment_t
int
ath_descdma_setup(struct ath_softc *sc,
struct ath_descdma *dd, ath_bufhead *head,
- const char *name, int nbuf, int ndesc)
+ const char *name, int ds_size, int nbuf, int ndesc)
{
#define DS2PHYS(_dd, _ds) \
((_dd)->dd_desc_paddr + ((caddr_t)(_ds) - (caddr_t)(_dd)->dd_desc))
@@ -2778,7 +2778,7 @@ ath_descdma_setup(struct ath_softc *sc,
struct ath_buf *bf;
int i, bsize, error;
- dd->dd_descsize = sizeof(struct ath_desc);
+ dd->dd_descsize = ds_size;
DPRINTF(sc, ATH_DEBUG_RESET,
"%s: %s DMA: %u buffers %u desc/buf, %d bytes per descriptor\n",
@@ -3010,14 +3010,15 @@ ath_desc_alloc(struct ath_softc *sc)
int error;
error = ath_descdma_setup(sc, &sc->sc_txdma, &sc->sc_txbuf,
- "tx", ath_txbuf, ATH_TXDESC);
+ "tx", sc->sc_tx_desclen, ath_txbuf, ATH_TXDESC);
if (error != 0) {
return error;
}
sc->sc_txbuf_cnt = ath_txbuf;
error = ath_descdma_setup(sc, &sc->sc_txdma_mgmt, &sc->sc_txbuf_mgmt,
- "tx_mgmt", ath_txbuf_mgmt, ATH_TXDESC);
+ "tx_mgmt", sc->sc_tx_desclen, ath_txbuf_mgmt,
+ ATH_TXDESC);
if (error != 0) {
ath_descdma_cleanup(sc, &sc->sc_txdma, &sc->sc_txbuf);
return error;
@@ -3029,7 +3030,7 @@ ath_desc_alloc(struct ath_softc *sc)
*/
error = ath_descdma_setup(sc, &sc->sc_bdma, &sc->sc_bbuf,
- "beacon", ATH_BCBUF, 1);
+ "beacon", sc->sc_tx_desclen, ATH_BCBUF, 1);
if (error != 0) {
ath_descdma_cleanup(sc, &sc->sc_txdma, &sc->sc_txbuf);
ath_descdma_cleanup(sc, &sc->sc_txdma_mgmt,
Modified: head/sys/dev/ath/if_ath_misc.h
==============================================================================
--- head/sys/dev/ath/if_ath_misc.h Mon Jul 23 21:32:37 2012 (r238728)
+++ head/sys/dev/ath/if_ath_misc.h Mon Jul 23 23:40:13 2012 (r238729)
@@ -85,7 +85,8 @@ extern void ath_setdefantenna(struct ath
extern void ath_setslottime(struct ath_softc *sc);
extern int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
- ath_bufhead *head, const char *name, int nbuf, int ndesc);
+ ath_bufhead *head, const char *name, int ds_size, int nbuf,
+ int ndesc);
extern int ath_descdma_setup_rx_edma(struct ath_softc *sc,
struct ath_descdma *dd, ath_bufhead *head, const char *name,
int nbuf, int desclen);
Modified: head/sys/dev/ath/if_ath_rx.c
==============================================================================
--- head/sys/dev/ath/if_ath_rx.c Mon Jul 23 21:32:37 2012 (r238728)
+++ head/sys/dev/ath/if_ath_rx.c Mon Jul 23 23:40:13 2012 (r238729)
@@ -1075,7 +1075,7 @@ ath_legacy_dma_rxsetup(struct ath_softc
device_printf(sc->sc_dev, "%s: called\n", __func__);
error = ath_descdma_setup(sc, &sc->sc_rxdma, &sc->sc_rxbuf,
- "rx", ath_rxbuf, 1);
+ "rx", sizeof(struct ath_desc), ath_rxbuf, 1);
if (error != 0)
return (error);
@@ -1099,6 +1099,9 @@ ath_recv_setup_legacy(struct ath_softc *
device_printf(sc->sc_dev, "DMA setup: legacy\n");
+ /* Sensible legacy defaults */
+ sc->sc_rx_statuslen = 0;
+
sc->sc_rx.recv_start = ath_legacy_startrecv;
sc->sc_rx.recv_stop = ath_legacy_stoprecv;
sc->sc_rx.recv_flush = ath_legacy_flushrecv;
Modified: head/sys/dev/ath/if_ath_tx.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx.c Mon Jul 23 21:32:37 2012 (r238728)
+++ head/sys/dev/ath/if_ath_tx.c Mon Jul 23 23:40:13 2012 (r238729)
@@ -4483,6 +4483,13 @@ ath_legacy_dma_txteardown(struct ath_sof
void
ath_xmit_setup_legacy(struct ath_softc *sc)
{
+ /*
+ * For now, just set the descriptor length to sizeof(ath_desc);
+ * worry about extracting the real length out of the HAL later.
+ */
+ sc->sc_tx_desclen = sizeof(struct ath_desc);
+ sc->sc_tx_statuslen = 0;
+ sc->sc_tx_nmaps = 1; /* only one buffer per TX desc */
sc->sc_tx.xmit_setup = ath_legacy_dma_txsetup;
sc->sc_tx.xmit_teardown = ath_legacy_dma_txteardown;
More information about the svn-src-all
mailing list