310-ath9k-fix-moredata-bit-in-PS-buffered-frame-release.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Date: Sun, 28 Aug 2016 13:13:01 +0200
  3. Subject: [PATCH] ath9k: fix moredata bit in PS buffered frame release
  4. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  5. ---
  6. --- a/drivers/net/wireless/ath/ath9k/xmit.c
  7. +++ b/drivers/net/wireless/ath/ath9k/xmit.c
  8. @@ -1694,6 +1694,22 @@ void ath_tx_aggr_wakeup(struct ath_softc
  9. }
  10. }
  11. +
  12. +static void
  13. +ath9k_set_moredata(struct ath_softc *sc, struct ath_buf *bf, bool val)
  14. +{
  15. + struct ieee80211_hdr *hdr;
  16. + u16 mask = cpu_to_le16(IEEE80211_FCTL_MOREDATA);
  17. + u16 mask_val = mask * val;
  18. +
  19. + hdr = (struct ieee80211_hdr *) bf->bf_mpdu->data;
  20. + if ((hdr->frame_control & mask) != mask_val) {
  21. + hdr->frame_control = (hdr->frame_control & ~mask) | mask_val;
  22. + dma_sync_single_for_device(sc->dev, bf->bf_buf_addr,
  23. + sizeof(*hdr), DMA_TO_DEVICE);
  24. + }
  25. +}
  26. +
  27. void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
  28. struct ieee80211_sta *sta,
  29. u16 tids, int nframes,
  30. @@ -1724,6 +1740,7 @@ void ath9k_release_buffered_frames(struc
  31. if (!bf)
  32. break;
  33. + ath9k_set_moredata(sc, bf, true);
  34. list_add_tail(&bf->list, &bf_q);
  35. ath_set_rates(tid->an->vif, tid->an->sta, bf, true);
  36. if (bf_isampdu(bf)) {
  37. @@ -1747,6 +1764,9 @@ void ath9k_release_buffered_frames(struc
  38. if (list_empty(&bf_q))
  39. return;
  40. + if (!more_data)
  41. + ath9k_set_moredata(sc, bf_tail, false);
  42. +
  43. info = IEEE80211_SKB_CB(bf_tail->bf_mpdu);
  44. info->flags |= IEEE80211_TX_STATUS_EOSP;