332-mac80211-fix-regression-in-sta-connection-monitor.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From: Felix Fietkau <[email protected]>
  2. Date: Mon, 21 Sep 2020 17:43:06 +0200
  3. Subject: [PATCH] mac80211: fix regression in sta connection monitor
  4. When a frame was acked and probe frames were sent, the connection monitoring
  5. needs to be reset, otherwise it will keep probing until the connection is
  6. considered dead, even though frames have been acked in the mean time.
  7. Fixes: 9abf4e49830d ("mac80211: optimize station connection monitor")
  8. Reported-by: Georgi Valkov <[email protected]>
  9. Signed-off-by: Felix Fietkau <[email protected]>
  10. ---
  11. --- a/net/mac80211/status.c
  12. +++ b/net/mac80211/status.c
  13. @@ -989,10 +989,6 @@ static void __ieee80211_tx_status(struct
  14. if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked)
  15. ieee80211_frame_acked(sta, skb);
  16. - if ((sta->sdata->vif.type == NL80211_IFTYPE_STATION) &&
  17. - ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS))
  18. - ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data,
  19. - acked, info->status.tx_time);
  20. }
  21. /* SNMP counters
  22. @@ -1127,11 +1123,18 @@ void ieee80211_tx_status_ext(struct ieee
  23. noack_success = !!(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED);
  24. if (pubsta) {
  25. + struct ieee80211_sub_if_data *sdata = sta->sdata;
  26. +
  27. if (!acked && !noack_success)
  28. sta->status_stats.retry_failed++;
  29. sta->status_stats.retry_count += retry_count;
  30. if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
  31. + if (sdata->vif.type == NL80211_IFTYPE_STATION &&
  32. + skb && !(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP))
  33. + ieee80211_sta_tx_notify(sdata, (void *) skb->data,
  34. + acked, info->status.tx_time);
  35. +
  36. if (acked) {
  37. sta->status_stats.last_ack = jiffies;
  38. @@ -1141,6 +1144,11 @@ void ieee80211_tx_status_ext(struct ieee
  39. /* Track when last packet was ACKed */
  40. sta->status_stats.last_pkt_time = jiffies;
  41. + /* Reset connection monitor */
  42. + if (sdata->vif.type == NL80211_IFTYPE_STATION &&
  43. + unlikely(sdata->u.mgd.probe_send_count > 0))
  44. + sdata->u.mgd.probe_send_count = 0;
  45. +
  46. if (info->status.is_valid_ack_signal) {
  47. sta->status_stats.last_ack_signal =
  48. (s8)info->status.ack_signal;
  49. --- a/net/mac80211/mlme.c
  50. +++ b/net/mac80211/mlme.c
  51. @@ -2508,7 +2508,9 @@ void ieee80211_sta_tx_notify(struct ieee
  52. !sdata->u.mgd.probe_send_count)
  53. return;
  54. - if (!ack)
  55. + if (ack)
  56. + sdata->u.mgd.probe_send_count = 0;
  57. + else
  58. sdata->u.mgd.nullfunc_failed = true;
  59. ieee80211_queue_work(&sdata->local->hw, &sdata->work);
  60. }