Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
  2. index aa5ffcc..b7f19c3 100644
  3. --- a/drivers/net/wireless/ath/ath9k/main.c
  4. +++ b/drivers/net/wireless/ath/ath9k/main.c
  5. @@ -19,6 +19,17 @@
  6. #include "ath9k.h"
  7. #include "btcoex.h"
  8.  
  9. +/* Edit by Seokseong Jeon */
  10. +s32 caesar_mac_idle, caesar_mac_tof;
  11. +bool caesar_worked;
  12. +int caesar_stdev, caesar_gamma;
  13. +s32 caesar_sum = 0, caesar_mean = 0, caesar_sumsq = 0;
  14. +s32 caesar_ewma;
  15. +int caesar_cnt = 0;
  16. +#define CAESAR_EWMA_LEV 32
  17. +#define CAESAR_EWMA_DIV 128
  18. +extern int ath9k_CAESAR_K;
  19. +
  20. u8 ath9k_parse_mpdudensity(u8 mpdudensity)
  21. {
  22. /*
  23. @@ -364,6 +375,9 @@ void ath9k_tasklet(unsigned long data)
  24. unsigned long flags;
  25. u32 status = sc->intrstatus;
  26. u32 rxmask;
  27. + /* Edit by Seokseong Jeon */
  28. + u32 tmp_sum, tmp_mean, tmp_sumsq;
  29. +
  30.  
  31. ath9k_ps_wakeup(sc);
  32. spin_lock(&sc->sc_pcu_lock);
  33. @@ -467,6 +481,63 @@ void ath9k_tasklet(unsigned long data)
  34.  
  35. /* re-enable hardware interrupt */
  36. ath9k_hw_enable_interrupts(ah);
  37. +
  38. + /* Edit by Seokseong Jeon */
  39. + /* check overflow */
  40. + if (caesar_worked) {
  41. + if (!(caesar_mac_idle & 0x80000000)) {
  42. +#define MULTIPLIER 1000
  43. + /* cycles to milli-cycles */
  44. + //caesar_mac_idle *= 1000;
  45. +#define T_SIFS 440
  46. +#define T_FD 84
  47. +#define CLOCKRATE 44
  48. + /* need to put multipath correction factor */
  49. + caesar_gamma = 0;
  50. + if (caesar_cnt != 0) {
  51. + tmp_sum = caesar_sum + caesar_mac_idle;
  52. + tmp_mean = tmp_sum / (caesar_cnt + 1);
  53. + tmp_sumsq = caesar_sumsq + caesar_mac_idle * caesar_mac_idle;
  54. + caesar_stdev = int_sqrt( tmp_sumsq / (caesar_cnt + 1) - tmp_mean * tmp_mean );
  55. + if (caesar_mac_idle > caesar_mean) {
  56. + if (caesar_stdev > 2 * CLOCKRATE) {
  57. + goto caesar_out;
  58. + } else if (caesar_stdev > CLOCKRATE) {
  59. + caesar_gamma = caesar_stdev / 2;
  60. + }
  61. + caesar_mac_idle -= caesar_gamma;
  62. + }
  63. + }
  64. +
  65. + /*if (caesar_mac_idle < ath9k_CAESAR_K) {
  66. + goto caesar_out;
  67. + }*/
  68. +
  69. + caesar_sum += caesar_mac_idle;
  70. + caesar_mean = caesar_sum / (caesar_cnt + 1);
  71. + caesar_sumsq += caesar_mac_idle * caesar_mac_idle;
  72. +
  73. + //caesar_mac_tof = (caesar_mac_idle - caesar_gamma - T_SIFS - T_FD) / 2;
  74. + caesar_mac_tof = (caesar_mac_idle - ath9k_CAESAR_K) / 2 * MULTIPLIER;
  75. + printk(KERN_DEBUG "ath9k ToF: (%4d) idle: %4d, stdev: %4d, gamma: -%4d, K: %4d, tof:%7d\n",
  76. + caesar_cnt + 1, caesar_mac_idle, caesar_stdev, caesar_gamma, ath9k_CAESAR_K, caesar_mac_tof);
  77. + if (caesar_cnt == 0)
  78. + caesar_ewma = caesar_mac_tof;
  79. + else
  80. + caesar_ewma = ( (CAESAR_EWMA_DIV - CAESAR_EWMA_LEV) * caesar_ewma
  81. + + CAESAR_EWMA_LEV * caesar_mac_tof )
  82. + / CAESAR_EWMA_DIV;
  83. + caesar_cnt++;
  84. + if (caesar_cnt == 1000) {
  85. + printk(KERN_DEBUG "ath9k ToF: ewma: %7d\n", caesar_ewma);
  86. + caesar_cnt = 0;
  87. + caesar_sum = 0;
  88. + caesar_sumsq = 0;
  89. + }
  90. + }
  91. + }
  92. +caesar_out:
  93. + caesar_mac_idle = 0xffffffff;
  94. out:
  95. spin_unlock(&sc->sc_pcu_lock);
  96. ath9k_ps_restore(sc);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement