020-10-rt2x00-separte-filling-tx-status-from-rt2x00lib_txdo.patch 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. From 5edb05afebba8f488a30db29550e55c42eea6d6a Mon Sep 17 00:00:00 2001
  2. From: Stanislaw Gruszka <[email protected]>
  3. Date: Wed, 15 Feb 2017 10:25:06 +0100
  4. Subject: [PATCH 10/19] rt2x00: separte filling tx status from rt2x00lib_txdone
  5. This makes rt2x00lib_txdone a bit simpler and will allow to reuse code
  6. in different variant of txdone which I'm preparing.
  7. Signed-off-by: Stanislaw Gruszka <[email protected]>
  8. Signed-off-by: Kalle Valo <[email protected]>
  9. ---
  10. drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 141 +++++++++++++------------
  11. 1 file changed, 76 insertions(+), 65 deletions(-)
  12. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  13. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  14. @@ -313,73 +313,14 @@ static inline int rt2x00lib_txdone_bar_s
  15. return ret;
  16. }
  17. -void rt2x00lib_txdone(struct queue_entry *entry,
  18. - struct txdone_entry_desc *txdesc)
  19. +static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev,
  20. + struct ieee80211_tx_info *tx_info,
  21. + struct skb_frame_desc *skbdesc,
  22. + struct txdone_entry_desc *txdesc,
  23. + bool success)
  24. {
  25. - struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
  26. - struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
  27. - struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
  28. - unsigned int header_length, i;
  29. u8 rate_idx, rate_flags, retry_rates;
  30. - u8 skbdesc_flags = skbdesc->flags;
  31. - bool success;
  32. -
  33. - /*
  34. - * Unmap the skb.
  35. - */
  36. - rt2x00queue_unmap_skb(entry);
  37. -
  38. - /*
  39. - * Remove the extra tx headroom from the skb.
  40. - */
  41. - skb_pull(entry->skb, rt2x00dev->extra_tx_headroom);
  42. -
  43. - /*
  44. - * Signal that the TX descriptor is no longer in the skb.
  45. - */
  46. - skbdesc->flags &= ~SKBDESC_DESC_IN_SKB;
  47. -
  48. - /*
  49. - * Determine the length of 802.11 header.
  50. - */
  51. - header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
  52. -
  53. - /*
  54. - * Remove L2 padding which was added during
  55. - */
  56. - if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD))
  57. - rt2x00queue_remove_l2pad(entry->skb, header_length);
  58. -
  59. - /*
  60. - * If the IV/EIV data was stripped from the frame before it was
  61. - * passed to the hardware, we should now reinsert it again because
  62. - * mac80211 will expect the same data to be present it the
  63. - * frame as it was passed to us.
  64. - */
  65. - if (rt2x00_has_cap_hw_crypto(rt2x00dev))
  66. - rt2x00crypto_tx_insert_iv(entry->skb, header_length);
  67. -
  68. - /*
  69. - * Send frame to debugfs immediately, after this call is completed
  70. - * we are going to overwrite the skb->cb array.
  71. - */
  72. - rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
  73. -
  74. - /*
  75. - * Determine if the frame has been successfully transmitted and
  76. - * remove BARs from our check list while checking for their
  77. - * TX status.
  78. - */
  79. - success =
  80. - rt2x00lib_txdone_bar_status(entry) ||
  81. - test_bit(TXDONE_SUCCESS, &txdesc->flags) ||
  82. - test_bit(TXDONE_UNKNOWN, &txdesc->flags);
  83. -
  84. - /*
  85. - * Update TX statistics.
  86. - */
  87. - rt2x00dev->link.qual.tx_success += success;
  88. - rt2x00dev->link.qual.tx_failed += !success;
  89. + int i;
  90. rate_idx = skbdesc->tx_rate_idx;
  91. rate_flags = skbdesc->tx_rate_flags;
  92. @@ -448,6 +389,76 @@ void rt2x00lib_txdone(struct queue_entry
  93. else
  94. rt2x00dev->low_level_stats.dot11RTSFailureCount++;
  95. }
  96. +}
  97. +
  98. +void rt2x00lib_txdone(struct queue_entry *entry,
  99. + struct txdone_entry_desc *txdesc)
  100. +{
  101. + struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
  102. + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
  103. + struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
  104. + u8 skbdesc_flags = skbdesc->flags;
  105. + unsigned int header_length;
  106. + bool success;
  107. +
  108. + /*
  109. + * Unmap the skb.
  110. + */
  111. + rt2x00queue_unmap_skb(entry);
  112. +
  113. + /*
  114. + * Remove the extra tx headroom from the skb.
  115. + */
  116. + skb_pull(entry->skb, rt2x00dev->extra_tx_headroom);
  117. +
  118. + /*
  119. + * Signal that the TX descriptor is no longer in the skb.
  120. + */
  121. + skbdesc->flags &= ~SKBDESC_DESC_IN_SKB;
  122. +
  123. + /*
  124. + * Determine the length of 802.11 header.
  125. + */
  126. + header_length = ieee80211_get_hdrlen_from_skb(entry->skb);
  127. +
  128. + /*
  129. + * Remove L2 padding which was added during
  130. + */
  131. + if (rt2x00_has_cap_flag(rt2x00dev, REQUIRE_L2PAD))
  132. + rt2x00queue_remove_l2pad(entry->skb, header_length);
  133. +
  134. + /*
  135. + * If the IV/EIV data was stripped from the frame before it was
  136. + * passed to the hardware, we should now reinsert it again because
  137. + * mac80211 will expect the same data to be present it the
  138. + * frame as it was passed to us.
  139. + */
  140. + if (rt2x00_has_cap_hw_crypto(rt2x00dev))
  141. + rt2x00crypto_tx_insert_iv(entry->skb, header_length);
  142. +
  143. + /*
  144. + * Send frame to debugfs immediately, after this call is completed
  145. + * we are going to overwrite the skb->cb array.
  146. + */
  147. + rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
  148. +
  149. + /*
  150. + * Determine if the frame has been successfully transmitted and
  151. + * remove BARs from our check list while checking for their
  152. + * TX status.
  153. + */
  154. + success =
  155. + rt2x00lib_txdone_bar_status(entry) ||
  156. + test_bit(TXDONE_SUCCESS, &txdesc->flags) ||
  157. + test_bit(TXDONE_UNKNOWN, &txdesc->flags);
  158. +
  159. + /*
  160. + * Update TX statistics.
  161. + */
  162. + rt2x00dev->link.qual.tx_success += success;
  163. + rt2x00dev->link.qual.tx_failed += !success;
  164. +
  165. + rt2x00lib_fill_tx_status(rt2x00dev, tx_info, skbdesc, txdesc, success);
  166. /*
  167. * Only send the status report to mac80211 when it's a frame