318-ath9k-Use-a-helper-function-for-offchannel-NoA.patch 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From: Sujith Manoharan <[email protected]>
  2. Date: Fri, 17 Oct 2014 07:40:23 +0530
  3. Subject: [PATCH] ath9k: Use a helper function for offchannel 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. @@ -366,6 +366,32 @@ 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_offchannel_noa(struct ath_softc *sc,
  12. + struct ath_chanctx *ctx,
  13. + struct ath_vif *avp,
  14. + u32 tsf_time)
  15. +{
  16. + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
  17. +
  18. + avp->noa_index++;
  19. + avp->offchannel_start = tsf_time;
  20. + avp->offchannel_duration = sc->sched.offchannel_duration;
  21. +
  22. + ath_dbg(common, CHAN_CTX,
  23. + "offchannel noa_duration: %d, noa_start: %d, noa_index: %d\n",
  24. + avp->offchannel_duration,
  25. + avp->offchannel_start,
  26. + avp->noa_index);
  27. +
  28. + /*
  29. + * When multiple contexts are active, the NoA
  30. + * has to be recalculated and advertised after
  31. + * an offchannel operation.
  32. + */
  33. + if (ctx->active && avp->noa_duration)
  34. + avp->noa_duration = 0;
  35. +}
  36. +
  37. void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
  38. enum ath_chanctx_event ev)
  39. {
  40. @@ -461,24 +487,7 @@ void ath_chanctx_event(struct ath_softc
  41. * values and increment the index.
  42. */
  43. if (sc->next_chan == &sc->offchannel.chan) {
  44. - avp->noa_index++;
  45. - avp->offchannel_start = tsf_time;
  46. - avp->offchannel_duration = sc->sched.offchannel_duration;
  47. -
  48. - ath_dbg(common, CHAN_CTX,
  49. - "offchannel noa_duration: %d, noa_start: %d, noa_index: %d\n",
  50. - avp->offchannel_duration,
  51. - avp->offchannel_start,
  52. - avp->noa_index);
  53. -
  54. - /*
  55. - * When multiple contexts are active, the NoA
  56. - * has to be recalculated and advertised after
  57. - * an offchannel operation.
  58. - */
  59. - if (ctx->active && avp->noa_duration)
  60. - avp->noa_duration = 0;
  61. -
  62. + ath_chanctx_offchannel_noa(sc, ctx, avp, tsf_time);
  63. break;
  64. }