319-ath9k-Use-a-helper-function-to-set-NoA.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. From: Sujith Manoharan <[email protected]>
  2. Date: Fri, 17 Oct 2014 07:40:24 +0530
  3. Subject: [PATCH] ath9k: Use a helper function to set NoA
  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. @@ -392,6 +392,39 @@ static void ath_chanctx_offchannel_noa(s
  9. avp->noa_duration = 0;
  10. }
  11. +static void ath_chanctx_set_periodic_noa(struct ath_softc *sc,
  12. + struct ath_vif *avp,
  13. + struct ath_beacon_config *cur_conf,
  14. + u32 tsf_time,
  15. + u32 beacon_int)
  16. +{
  17. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  18. +
  19. + avp->noa_index++;
  20. + avp->noa_start = tsf_time;
  21. +
  22. + if (sc->sched.extend_absence)
  23. + avp->noa_duration = (3 * beacon_int / 2) +
  24. + sc->sched.channel_switch_time;
  25. + else
  26. + avp->noa_duration =
  27. + TU_TO_USEC(cur_conf->beacon_interval) / 2 +
  28. + sc->sched.channel_switch_time;
  29. +
  30. + if (test_bit(ATH_OP_SCANNING, &common->op_flags) ||
  31. + sc->sched.extend_absence)
  32. + avp->periodic_noa = false;
  33. + else
  34. + avp->periodic_noa = true;
  35. +
  36. + ath_dbg(common, CHAN_CTX,
  37. + "noa_duration: %d, noa_start: %d, noa_index: %d, periodic: %d\n",
  38. + avp->noa_duration,
  39. + avp->noa_start,
  40. + avp->noa_index,
  41. + avp->periodic_noa);
  42. +}
  43. +
  44. void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
  45. enum ath_chanctx_event ev)
  46. {
  47. @@ -521,31 +554,9 @@ void ath_chanctx_event(struct ath_softc
  48. * announcement.
  49. */
  50. if (ctx->active &&
  51. - (!avp->noa_duration || sc->sched.force_noa_update)) {
  52. - avp->noa_index++;
  53. - avp->noa_start = tsf_time;
  54. -
  55. - if (sc->sched.extend_absence)
  56. - avp->noa_duration = (3 * beacon_int / 2) +
  57. - sc->sched.channel_switch_time;
  58. - else
  59. - avp->noa_duration =
  60. - TU_TO_USEC(cur_conf->beacon_interval) / 2 +
  61. - sc->sched.channel_switch_time;
  62. -
  63. - if (test_bit(ATH_OP_SCANNING, &common->op_flags) ||
  64. - sc->sched.extend_absence)
  65. - avp->periodic_noa = false;
  66. - else
  67. - avp->periodic_noa = true;
  68. -
  69. - ath_dbg(common, CHAN_CTX,
  70. - "noa_duration: %d, noa_start: %d, noa_index: %d, periodic: %d\n",
  71. - avp->noa_duration,
  72. - avp->noa_start,
  73. - avp->noa_index,
  74. - avp->periodic_noa);
  75. - }
  76. + (!avp->noa_duration || sc->sched.force_noa_update))
  77. + ath_chanctx_set_periodic_noa(sc, avp, cur_conf,
  78. + tsf_time, beacon_int);
  79. if (ctx->active && sc->sched.force_noa_update)
  80. sc->sched.force_noa_update = false;