1
0

981-ath10k-adjust-tx-power-reduction-for-US-regulatory-d.patch 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. From: Sven Eckelmann <seckelmann@datto.com>
  2. Date: Wed, 28 Nov 2018 16:16:27 +0100
  3. Subject: ath10k: adjust tx power reduction for US regulatory domain
  4. FCC allows maximum antenna gain of 6 dBi. 15.247(b)(4):
  5. > (4) The conducted output power limit
  6. > specified in paragraph (b) of this section
  7. > is based on the use of antennas
  8. > with directional gains that do not exceed
  9. > 6 dBi. Except as shown in paragraph
  10. > (c) of this section, if transmitting
  11. > antennas of directional gain greater
  12. > than 6 dBi are used, the conducted
  13. > output power from the intentional radiator
  14. > shall be reduced below the stated
  15. > values in paragraphs (b)(1), (b)(2),
  16. > and (b)(3) of this section, as appropriate,
  17. > by the amount in dB that the
  18. > directional gain of the antenna exceeds
  19. > 6 dBi.
  20. https://www.gpo.gov/fdsys/pkg/CFR-2013-title47-vol1/pdf/CFR-2013-title47-vol1-sec15-247.pdf
  21. Signed-off-by: Sven Eckelmann <seckelmann@datto.com>
  22. Forwarded: no
  23. --- a/drivers/net/wireless/ath/ath10k/mac.c
  24. +++ b/drivers/net/wireless/ath/ath10k/mac.c
  25. @@ -1028,6 +1028,40 @@ static inline int ath10k_vdev_setup_sync
  26. return ar->last_wmi_vdev_start_status;
  27. }
  28. +static u32 ath10k_get_max_antenna_gain(struct ath10k *ar,
  29. + u32 ch_max_antenna_gain)
  30. +{
  31. + u32 max_antenna_gain;
  32. +
  33. + if (ar->dfs_detector && ar->dfs_detector->region == NL80211_DFS_FCC) {
  34. + /* FCC allows maximum antenna gain of 6 dBi. 15.247(b)(4):
  35. + *
  36. + * > (4) The conducted output power limit
  37. + * > specified in paragraph (b) of this section
  38. + * > is based on the use of antennas
  39. + * > with directional gains that do not exceed
  40. + * > 6 dBi. Except as shown in paragraph
  41. + * > (c) of this section, if transmitting
  42. + * > antennas of directional gain greater
  43. + * > than 6 dBi are used, the conducted
  44. + * > output power from the intentional radiator
  45. + * > shall be reduced below the stated
  46. + * > values in paragraphs (b)(1), (b)(2),
  47. + * > and (b)(3) of this section, as appropriate,
  48. + * > by the amount in dB that the
  49. + * > directional gain of the antenna exceeds
  50. + * > 6 dBi.
  51. + *
  52. + * https://www.gpo.gov/fdsys/pkg/CFR-2013-title47-vol1/pdf/CFR-2013-title47-vol1-sec15-247.pdf
  53. + */
  54. + max_antenna_gain = 6;
  55. + } else {
  56. + max_antenna_gain = 0;
  57. + }
  58. +
  59. + return max(ch_max_antenna_gain, max_antenna_gain);
  60. +}
  61. +
  62. static int ath10k_monitor_vdev_start(struct ath10k *ar, int vdev_id)
  63. {
  64. struct cfg80211_chan_def *chandef = NULL;
  65. @@ -1060,7 +1094,8 @@ static int ath10k_monitor_vdev_start(str
  66. arg.channel.min_power = 0;
  67. arg.channel.max_power = channel->max_power * 2;
  68. arg.channel.max_reg_power = channel->max_reg_power * 2;
  69. - arg.channel.max_antenna_gain = channel->max_antenna_gain;
  70. + arg.channel.max_antenna_gain = ath10k_get_max_antenna_gain(ar,
  71. + channel->max_antenna_gain);
  72. reinit_completion(&ar->vdev_setup_done);
  73. reinit_completion(&ar->vdev_delete_done);
  74. @@ -1506,7 +1541,8 @@ static int ath10k_vdev_start_restart(str
  75. arg.channel.min_power = 0;
  76. arg.channel.max_power = chandef->chan->max_power * 2;
  77. arg.channel.max_reg_power = chandef->chan->max_reg_power * 2;
  78. - arg.channel.max_antenna_gain = chandef->chan->max_antenna_gain;
  79. + arg.channel.max_antenna_gain = ath10k_get_max_antenna_gain(ar,
  80. + chandef->chan->max_antenna_gain);
  81. if (arvif->vdev_type == WMI_VDEV_TYPE_AP) {
  82. arg.ssid = arvif->u.ap.ssid;
  83. @@ -3437,7 +3473,8 @@ static int ath10k_update_channel_list(st
  84. ch->min_power = 0;
  85. ch->max_power = channel->max_power * 2;
  86. ch->max_reg_power = channel->max_reg_power * 2;
  87. - ch->max_antenna_gain = channel->max_antenna_gain;
  88. + ch->max_antenna_gain = ath10k_get_max_antenna_gain(ar,
  89. + channel->max_antenna_gain);
  90. ch->reg_class_id = 0; /* FIXME */
  91. /* FIXME: why use only legacy modes, why not any