320-ath9k-Use-a-helper-function-for-bmiss.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From: Sujith Manoharan <[email protected]>
  2. Date: Fri, 17 Oct 2014 07:40:25 +0530
  3. Subject: [PATCH] ath9k: Use a helper function for bmiss
  4. Signed-off-by: Sujith Manoharan <[email protected]>
  5. ---
  6. --- a/drivers/net/wireless/ath/ath9k/channel.c
  7. +++ b/drivers/net/wireless/ath/ath9k/channel.c
  8. @@ -366,6 +366,31 @@ static void ath_chanctx_setup_timer(stru
  9. "Setup chanctx timer with timeout: %d ms\n", jiffies_to_msecs(tsf_time));
  10. }
  11. +static void ath_chanctx_handle_bmiss(struct ath_softc *sc,
  12. + struct ath_chanctx *ctx,
  13. + struct ath_vif *avp)
  14. +{
  15. + /*
  16. + * Clear the extend_absence flag if it had been
  17. + * set during the previous beacon transmission,
  18. + * since we need to revert to the normal NoA
  19. + * schedule.
  20. + */
  21. + if (ctx->active && sc->sched.extend_absence) {
  22. + avp->noa_duration = 0;
  23. + sc->sched.extend_absence = false;
  24. + }
  25. +
  26. + /* If at least two consecutive beacons were missed on the STA
  27. + * chanctx, stay on the STA channel for one extra beacon period,
  28. + * to resync the timer properly.
  29. + */
  30. + if (ctx->active && sc->sched.beacon_miss >= 2) {
  31. + avp->noa_duration = 0;
  32. + sc->sched.extend_absence = true;
  33. + }
  34. +}
  35. +
  36. static void ath_chanctx_offchannel_noa(struct ath_softc *sc,
  37. struct ath_chanctx *ctx,
  38. struct ath_vif *avp,
  39. @@ -524,25 +549,7 @@ void ath_chanctx_event(struct ath_softc
  40. break;
  41. }
  42. - /*
  43. - * Clear the extend_absence flag if it had been
  44. - * set during the previous beacon transmission,
  45. - * since we need to revert to the normal NoA
  46. - * schedule.
  47. - */
  48. - if (ctx->active && sc->sched.extend_absence) {
  49. - avp->noa_duration = 0;
  50. - sc->sched.extend_absence = false;
  51. - }
  52. -
  53. - /* If at least two consecutive beacons were missed on the STA
  54. - * chanctx, stay on the STA channel for one extra beacon period,
  55. - * to resync the timer properly.
  56. - */
  57. - if (ctx->active && sc->sched.beacon_miss >= 2) {
  58. - avp->noa_duration = 0;
  59. - sc->sched.extend_absence = true;
  60. - }
  61. + ath_chanctx_handle_bmiss(sc, ctx, avp);
  62. /* Prevent wrap-around issues */
  63. if (avp->noa_duration && tsf_time - avp->noa_start > BIT(30))