322-ath9k-Send-oneshot-NoA.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. From: Sujith Manoharan <[email protected]>
  2. Date: Fri, 17 Oct 2014 07:40:27 +0530
  3. Subject: [PATCH] ath9k: Send oneshot NoA
  4. This patch makes sure that a GO interface
  5. sends out a new NoA schedule with 200ms duration
  6. when mgd_prepare_tx() is called.
  7. Signed-off-by: Sujith Manoharan <[email protected]>
  8. ---
  9. --- a/drivers/net/wireless/ath/ath9k/ath9k.h
  10. +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
  11. @@ -620,6 +620,7 @@ struct ath_vif {
  12. u32 noa_start;
  13. u32 noa_duration;
  14. bool periodic_noa;
  15. + bool oneshot_noa;
  16. };
  17. struct ath9k_vif_iter_data {
  18. --- a/drivers/net/wireless/ath/ath9k/channel.c
  19. +++ b/drivers/net/wireless/ath/ath9k/channel.c
  20. @@ -450,6 +450,27 @@ static void ath_chanctx_set_periodic_noa
  21. avp->periodic_noa);
  22. }
  23. +static void ath_chanctx_set_oneshot_noa(struct ath_softc *sc,
  24. + struct ath_vif *avp,
  25. + u32 tsf_time,
  26. + u32 duration)
  27. +{
  28. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  29. +
  30. + avp->noa_index++;
  31. + avp->noa_start = tsf_time;
  32. + avp->periodic_noa = false;
  33. + avp->oneshot_noa = true;
  34. + avp->noa_duration = duration + sc->sched.channel_switch_time;
  35. +
  36. + ath_dbg(common, CHAN_CTX,
  37. + "oneshot 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. @@ -476,6 +497,14 @@ void ath_chanctx_event(struct ath_softc
  48. if (avp->offchannel_duration)
  49. avp->offchannel_duration = 0;
  50. + if (avp->oneshot_noa) {
  51. + avp->noa_duration = 0;
  52. + avp->oneshot_noa = false;
  53. +
  54. + ath_dbg(common, CHAN_CTX,
  55. + "Clearing oneshot NoA\n");
  56. + }
  57. +
  58. if (avp->chanctx != sc->cur_chan) {
  59. ath_dbg(common, CHAN_CTX,
  60. "Contexts differ, not preparing beacon\n");
  61. @@ -551,6 +580,18 @@ void ath_chanctx_event(struct ath_softc
  62. ath_chanctx_handle_bmiss(sc, ctx, avp);
  63. + /*
  64. + * If a mgd_prepare_tx() has been called by mac80211,
  65. + * a one-shot NoA needs to be sent. This can happen
  66. + * with one or more active channel contexts - in both
  67. + * cases, a new NoA schedule has to be advertised.
  68. + */
  69. + if (sc->sched.mgd_prepare_tx) {
  70. + ath_chanctx_set_oneshot_noa(sc, avp, tsf_time,
  71. + jiffies_to_usecs(HZ / 5));
  72. + break;
  73. + }
  74. +
  75. /* Prevent wrap-around issues */
  76. if (avp->noa_duration && tsf_time - avp->noa_start > BIT(30))
  77. avp->noa_duration = 0;