Skip to content

Commit 3a2923e

Browse files
Felix Fietkaulinvjw
authored andcommitted
ath9k: get rid of double queueing of rx frames on EDMA
Process rx status directly instead of separating the completion test from the actual rx status processing. Signed-off-by: Felix Fietkau <[email protected]> Signed-off-by: John W. Linville <[email protected]>
1 parent fc16fd8 commit 3a2923e

File tree

3 files changed

+28
-36
lines changed

3 files changed

+28
-36
lines changed

drivers/net/wireless/ath/ath9k/ar9003_mac.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -436,20 +436,14 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
436436
struct ar9003_rxs *rxsp = (struct ar9003_rxs *) buf_addr;
437437
unsigned int phyerr;
438438

439-
/* TODO: byte swap on big endian for ar9300_10 */
440-
441-
if (!rxs) {
442-
if ((rxsp->status11 & AR_RxDone) == 0)
443-
return -EINPROGRESS;
444-
445-
if (MS(rxsp->ds_info, AR_DescId) != 0x168c)
446-
return -EINVAL;
439+
if ((rxsp->status11 & AR_RxDone) == 0)
440+
return -EINPROGRESS;
447441

448-
if ((rxsp->ds_info & (AR_TxRxDesc | AR_CtrlStat)) != 0)
449-
return -EINPROGRESS;
442+
if (MS(rxsp->ds_info, AR_DescId) != 0x168c)
443+
return -EINVAL;
450444

451-
return 0;
452-
}
445+
if ((rxsp->ds_info & (AR_TxRxDesc | AR_CtrlStat)) != 0)
446+
return -EINPROGRESS;
453447

454448
rxs->rs_status = 0;
455449
rxs->rs_flags = 0;

drivers/net/wireless/ath/ath9k/ath9k.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ struct ath_tx {
299299

300300
struct ath_rx_edma {
301301
struct sk_buff_head rx_fifo;
302-
struct sk_buff_head rx_buffers;
303302
u32 rx_fifo_hwsize;
304303
};
305304

drivers/net/wireless/ath/ath9k/recv.c

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ static void ath_rx_edma_cleanup(struct ath_softc *sc)
227227
static void ath_rx_edma_init_queue(struct ath_rx_edma *rx_edma, int size)
228228
{
229229
skb_queue_head_init(&rx_edma->rx_fifo);
230-
skb_queue_head_init(&rx_edma->rx_buffers);
231230
rx_edma->rx_fifo_hwsize = size;
232231
}
233232

@@ -653,7 +652,9 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb, bool mybeacon)
653652
}
654653

655654
static bool ath_edma_get_buffers(struct ath_softc *sc,
656-
enum ath9k_rx_qtype qtype)
655+
enum ath9k_rx_qtype qtype,
656+
struct ath_rx_status *rs,
657+
struct ath_buf **dest)
657658
{
658659
struct ath_rx_edma *rx_edma = &sc->rx.rx_edma[qtype];
659660
struct ath_hw *ah = sc->sc_ah;
@@ -672,7 +673,7 @@ static bool ath_edma_get_buffers(struct ath_softc *sc,
672673
dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr,
673674
common->rx_bufsize, DMA_FROM_DEVICE);
674675

675-
ret = ath9k_hw_process_rxdesc_edma(ah, NULL, skb->data);
676+
ret = ath9k_hw_process_rxdesc_edma(ah, rs, skb->data);
676677
if (ret == -EINPROGRESS) {
677678
/*let device gain the buffer again*/
678679
dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
@@ -685,39 +686,37 @@ static bool ath_edma_get_buffers(struct ath_softc *sc,
685686
/* corrupt descriptor, skip this one and the following one */
686687
list_add_tail(&bf->list, &sc->rx.rxbuf);
687688
ath_rx_edma_buf_link(sc, qtype);
688-
skb = skb_peek(&rx_edma->rx_fifo);
689-
if (!skb)
690-
return true;
691689

692-
bf = SKB_CB_ATHBUF(skb);
693-
BUG_ON(!bf);
690+
skb = skb_peek(&rx_edma->rx_fifo);
691+
if (skb) {
692+
bf = SKB_CB_ATHBUF(skb);
693+
BUG_ON(!bf);
694694

695-
__skb_unlink(skb, &rx_edma->rx_fifo);
696-
list_add_tail(&bf->list, &sc->rx.rxbuf);
697-
ath_rx_edma_buf_link(sc, qtype);
698-
return true;
695+
__skb_unlink(skb, &rx_edma->rx_fifo);
696+
list_add_tail(&bf->list, &sc->rx.rxbuf);
697+
ath_rx_edma_buf_link(sc, qtype);
698+
} else {
699+
bf = NULL;
700+
}
699701
}
700-
skb_queue_tail(&rx_edma->rx_buffers, skb);
701702

703+
*dest = bf;
702704
return true;
703705
}
704706

705707
static struct ath_buf *ath_edma_get_next_rx_buf(struct ath_softc *sc,
706708
struct ath_rx_status *rs,
707709
enum ath9k_rx_qtype qtype)
708710
{
709-
struct ath_rx_edma *rx_edma = &sc->rx.rx_edma[qtype];
710-
struct sk_buff *skb;
711-
struct ath_buf *bf;
711+
struct ath_buf *bf = NULL;
712712

713-
while (ath_edma_get_buffers(sc, qtype));
714-
skb = __skb_dequeue(&rx_edma->rx_buffers);
715-
if (!skb)
716-
return NULL;
713+
while (ath_edma_get_buffers(sc, qtype, rs, &bf)) {
714+
if (!bf)
715+
continue;
717716

718-
bf = SKB_CB_ATHBUF(skb);
719-
ath9k_hw_process_rxdesc_edma(sc->sc_ah, rs, skb->data);
720-
return bf;
717+
return bf;
718+
}
719+
return NULL;
721720
}
722721

723722
static struct ath_buf *ath_get_next_rx_buf(struct ath_softc *sc,

0 commit comments

Comments
 (0)