Skip to content

Commit d0bfd83

Browse files
committed
[ath9k] Remove broken ath_rxbuf_alloc()
ath_rx_init() demonstrates some serious confusion over how to use pointers, resulting in (uint32_t*)NULL being used as a temporary variable. This does not end well. The broken code in question is performing manual alignment of I/O buffers, which can now be achieved more simply using alloc_iob_raw(). Fix by removing ath_rxbuf_alloc() entirely. Signed-off-by: Michael Brown <mcb30@ipxe.org>
1 parent 4ddd3d9 commit d0bfd83

File tree

3 files changed

+5
-70
lines changed

3 files changed

+5
-70
lines changed

src/drivers/net/ath/ath.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,6 @@ struct ath_common {
229229
int btcoex_enabled;
230230
};
231231

232-
struct io_buffer *ath_rxbuf_alloc(struct ath_common *common,
233-
u32 len,
234-
u32 *iob_addr);
235-
236232
void ath_hw_setbssidmask(struct ath_common *common);
237233
int ath_hw_keyreset(struct ath_common *common, u16 entry);
238234
void ath_hw_cycle_counters_update(struct ath_common *common);

src/drivers/net/ath/ath9k/ath9k_recv.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
9898
{
9999
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
100100
struct io_buffer *iob;
101-
u32 *iob_addr = NULL;
102101
struct ath_buf *bf;
103102
int error = 0;
104103

@@ -122,15 +121,14 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
122121
}
123122

124123
list_for_each_entry(bf, &sc->rx.rxbuf, list) {
125-
iob = ath_rxbuf_alloc(common, common->rx_bufsize,
126-
iob_addr);
124+
iob = alloc_iob_raw ( common->rx_bufsize, common->cachelsz, 0 );
127125
if (iob == NULL) {
128126
error = -ENOMEM;
129127
goto err;
130128
}
131129

132130
bf->bf_mpdu = iob;
133-
bf->bf_buf_addr = *iob_addr;
131+
bf->bf_buf_addr = virt_to_bus ( iob->data );
134132
}
135133
sc->rx.rxlink = NULL;
136134

@@ -433,7 +431,6 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, int hp __unused)
433431
{
434432
struct ath_buf *bf;
435433
struct io_buffer *iob = NULL, *requeue_iob;
436-
u32 *requeue_iob_addr = NULL;
437434
struct ath_hw *ah = sc->sc_ah;
438435
struct ath_common *common = ath9k_hw_common(ah);
439436
/*
@@ -476,7 +473,8 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, int hp __unused)
476473

477474
/* Ensure we always have an iob to requeue once we are done
478475
* processing the current buffer's iob */
479-
requeue_iob = ath_rxbuf_alloc(common, common->rx_bufsize, requeue_iob_addr);
476+
requeue_iob = alloc_iob_raw ( common->rx_bufsize,
477+
common->cachelsz, 0 );
480478

481479
/* If there is no memory we ignore the current RX'd frame,
482480
* tell hardware it can give us a new frame using the old
@@ -491,7 +489,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, int hp __unused)
491489

492490
/* We will now give hardware our shiny new allocated iob */
493491
bf->bf_mpdu = requeue_iob;
494-
bf->bf_buf_addr = *requeue_iob_addr;
492+
bf->bf_buf_addr = virt_to_bus ( requeue_iob->data );
495493

496494
/*
497495
* change the default rx antenna if rx diversity chooses the

src/drivers/net/ath/ath_main.c

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)