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.
This commit is contained in:
parent
8a489dc248
commit
1006fc0c3b
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user