diff options
author | adrian <adrian@FreeBSD.org> | 2012-07-23 23:40:13 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2012-07-23 23:40:13 +0000 |
commit | 142df5fc8eb25ab65ff82ee819ffb79841bcba18 (patch) | |
tree | ee595f54ee113486a7fca35a2bbc3fe116ece1b0 /sys/dev/ath | |
parent | 615f9f5c414aac0d6075e7b8e042f07122fe6c05 (diff) | |
download | FreeBSD-src-142df5fc8eb25ab65ff82ee819ffb79841bcba18.zip FreeBSD-src-142df5fc8eb25ab65ff82ee819ffb79841bcba18.tar.gz |
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.
Diffstat (limited to 'sys/dev/ath')
-rw-r--r-- | sys/dev/ath/if_ath.c | 11 | ||||
-rw-r--r-- | sys/dev/ath/if_ath_misc.h | 3 | ||||
-rw-r--r-- | sys/dev/ath/if_ath_rx.c | 5 | ||||
-rw-r--r-- | sys/dev/ath/if_ath_tx.c | 7 |
4 files changed, 19 insertions, 7 deletions
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 4b0bae8..3f831d8 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -2767,7 +2767,7 @@ ath_load_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) 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, diff --git a/sys/dev/ath/if_ath_misc.h b/sys/dev/ath/if_ath_misc.h index 23c9f68..a1d2e83 100644 --- a/sys/dev/ath/if_ath_misc.h +++ b/sys/dev/ath/if_ath_misc.h @@ -85,7 +85,8 @@ extern void ath_setdefantenna(struct ath_softc *sc, u_int antenna); 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); diff --git a/sys/dev/ath/if_ath_rx.c b/sys/dev/ath/if_ath_rx.c index 9e90977..4027bfe 100644 --- a/sys/dev/ath/if_ath_rx.c +++ b/sys/dev/ath/if_ath_rx.c @@ -1075,7 +1075,7 @@ ath_legacy_dma_rxsetup(struct ath_softc *sc) 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 *sc) 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; diff --git a/sys/dev/ath/if_ath_tx.c b/sys/dev/ath/if_ath_tx.c index 848ed14..c0dfa2b 100644 --- a/sys/dev/ath/if_ath_tx.c +++ b/sys/dev/ath/if_ath_tx.c @@ -4483,6 +4483,13 @@ ath_legacy_dma_txteardown(struct ath_softc *sc) 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; |