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

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