313-ath9k-fix-block-ack-window-tracking-issues.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Date: Tue, 30 Aug 2016 12:44:08 +0200
  3. Subject: [PATCH] ath9k: fix block-ack window tracking issues
  4. Ensure that a buffer gets tracked as part of the block-ack window as
  5. soon as it's dequeued from the tid for the first time. Ensure that
  6. double calls to ath_tx_addto_baw (e.g. on retransmission) don't cause
  7. any issues.
  8. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  9. ---
  10. --- a/drivers/net/wireless/ath/ath9k/xmit.c
  11. +++ b/drivers/net/wireless/ath/ath9k/xmit.c
  12. @@ -62,7 +62,7 @@ static void ath_tx_rc_status(struct ath_
  13. struct ath_tx_status *ts, int nframes, int nbad,
  14. int txok);
  15. static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
  16. - int seqno);
  17. + struct ath_buf *bf);
  18. static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
  19. struct ath_txq *txq,
  20. struct ath_atx_tid *tid,
  21. @@ -311,7 +311,7 @@ static void ath_tx_flush_tid(struct ath_
  22. }
  23. if (fi->baw_tracked) {
  24. - ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
  25. + ath_tx_update_baw(sc, tid, bf);
  26. sendbar = true;
  27. }
  28. @@ -327,10 +327,15 @@ static void ath_tx_flush_tid(struct ath_
  29. }
  30. static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
  31. - int seqno)
  32. + struct ath_buf *bf)
  33. {
  34. + struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu);
  35. + u16 seqno = bf->bf_state.seqno;
  36. int index, cindex;
  37. + if (!fi->baw_tracked)
  38. + return;
  39. +
  40. index = ATH_BA_INDEX(tid->seq_start, seqno);
  41. cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
  42. @@ -351,6 +356,9 @@ static void ath_tx_addto_baw(struct ath_
  43. u16 seqno = bf->bf_state.seqno;
  44. int index, cindex;
  45. + if (fi->baw_tracked)
  46. + return;
  47. +
  48. index = ATH_BA_INDEX(tid->seq_start, seqno);
  49. cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
  50. __set_bit(cindex, tid->tx_buf);
  51. @@ -627,7 +635,7 @@ static void ath_tx_complete_aggr(struct
  52. * complete the acked-ones/xretried ones; update
  53. * block-ack window
  54. */
  55. - ath_tx_update_baw(sc, tid, seqno);
  56. + ath_tx_update_baw(sc, tid, bf);
  57. if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) {
  58. memcpy(tx_info->control.rates, rates, sizeof(rates));
  59. @@ -657,7 +665,7 @@ static void ath_tx_complete_aggr(struct
  60. * run out of tx buf.
  61. */
  62. if (!tbf) {
  63. - ath_tx_update_baw(sc, tid, seqno);
  64. + ath_tx_update_baw(sc, tid, bf);
  65. ath_tx_complete_buf(sc, bf, txq,
  66. &bf_head, NULL, ts,
  67. @@ -1046,11 +1054,14 @@ ath_tx_get_tid_subframe(struct ath_softc
  68. INIT_LIST_HEAD(&bf_head);
  69. list_add(&bf->list, &bf_head);
  70. - ath_tx_update_baw(sc, tid, seqno);
  71. + ath_tx_update_baw(sc, tid, bf);
  72. ath_tx_complete_buf(sc, bf, txq, &bf_head, NULL, &ts, 0);
  73. continue;
  74. }
  75. + if (bf_isampdu(bf))
  76. + ath_tx_addto_baw(sc, tid, bf);
  77. +
  78. return bf;
  79. }
  80. @@ -1108,8 +1119,6 @@ ath_tx_form_aggr(struct ath_softc *sc, s
  81. bf->bf_next = NULL;
  82. /* link buffers of this frame to the aggregate */
  83. - if (!fi->baw_tracked)
  84. - ath_tx_addto_baw(sc, tid, bf);
  85. bf->bf_state.ndelim = ndelim;
  86. list_add_tail(&bf->list, bf_q);
  87. @@ -1745,10 +1754,8 @@ void ath9k_release_buffered_frames(struc
  88. ath9k_set_moredata(sc, bf, true);
  89. list_add_tail(&bf->list, &bf_q);
  90. ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  91. - if (bf_isampdu(bf)) {
  92. - ath_tx_addto_baw(sc, tid, bf);
  93. + if (bf_isampdu(bf))
  94. bf->bf_state.bf_type &= ~BUF_AGGR;
  95. - }
  96. if (bf_tail)
  97. bf_tail->bf_next = bf;