1
0

020-12-rt2x00-add-txdone-nomatch-function.patch 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. From a09305d052166cb489402a63a5d275e954e0b923 Mon Sep 17 00:00:00 2001
  2. From: Stanislaw Gruszka <sgruszka@redhat.com>
  3. Date: Wed, 15 Feb 2017 10:25:08 +0100
  4. Subject: [PATCH 12/19] rt2x00: add txdone nomatch function
  5. This txdone nomatch function will be used when we get status from the HW,
  6. but we could not match it with any sent skb.
  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/rt2x00.h | 2 ++
  11. drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 50 ++++++++++++++++++++++++++
  12. 2 files changed, 52 insertions(+)
  13. diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00.h b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  14. index 340787894c69..91ba10fdf732 100644
  15. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  16. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  17. @@ -1425,6 +1425,8 @@ void rt2x00lib_dmastart(struct queue_entry *entry);
  18. void rt2x00lib_dmadone(struct queue_entry *entry);
  19. void rt2x00lib_txdone(struct queue_entry *entry,
  20. struct txdone_entry_desc *txdesc);
  21. +void rt2x00lib_txdone_nomatch(struct queue_entry *entry,
  22. + struct txdone_entry_desc *txdesc);
  23. void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status);
  24. void rt2x00lib_rxdone(struct queue_entry *entry, gfp_t gfp);
  25. diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  26. index 03b368ac9cb6..90fc259fb5bc 100644
  27. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  28. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  29. @@ -417,6 +417,56 @@ static void rt2x00lib_clear_entry(struct rt2x00_dev *rt2x00dev,
  30. spin_unlock_bh(&entry->queue->tx_lock);
  31. }
  32. +void rt2x00lib_txdone_nomatch(struct queue_entry *entry,
  33. + struct txdone_entry_desc *txdesc)
  34. +{
  35. + struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
  36. + struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
  37. + struct ieee80211_tx_info txinfo = {};
  38. + bool success;
  39. +
  40. + /*
  41. + * Unmap the skb.
  42. + */
  43. + rt2x00queue_unmap_skb(entry);
  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. + * Send frame to debugfs immediately, after this call is completed
  52. + * we are going to overwrite the skb->cb array.
  53. + */
  54. + rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TXDONE, entry);
  55. +
  56. + /*
  57. + * Determine if the frame has been successfully transmitted and
  58. + * remove BARs from our check list while checking for their
  59. + * TX status.
  60. + */
  61. + success =
  62. + rt2x00lib_txdone_bar_status(entry) ||
  63. + test_bit(TXDONE_SUCCESS, &txdesc->flags);
  64. +
  65. + if (!test_bit(TXDONE_UNKNOWN, &txdesc->flags)) {
  66. + /*
  67. + * Update TX statistics.
  68. + */
  69. + rt2x00dev->link.qual.tx_success += success;
  70. + rt2x00dev->link.qual.tx_failed += !success;
  71. +
  72. + rt2x00lib_fill_tx_status(rt2x00dev, &txinfo, skbdesc, txdesc,
  73. + success);
  74. + ieee80211_tx_status_noskb(rt2x00dev->hw, skbdesc->sta, &txinfo);
  75. + }
  76. +
  77. + dev_kfree_skb_any(entry->skb);
  78. + rt2x00lib_clear_entry(rt2x00dev, entry);
  79. +}
  80. +EXPORT_SYMBOL_GPL(rt2x00lib_txdone_nomatch);
  81. +
  82. void rt2x00lib_txdone(struct queue_entry *entry,
  83. struct txdone_entry_desc *txdesc)
  84. {
  85. --
  86. 2.12.1