ATH10K Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath10k: fix survey reporting
@ 2015-03-24 12:38 Michal Kazior
  2015-04-01 17:20 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Kazior @ 2015-03-24 12:38 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Michal Kazior

Number of channels is stored in a separate macro
in a header file and channel list is constructed
independently. The macro is used to define survey
array.

This fixes a recent regression introduced after
adding support for 144 channel. The regression
would lead to a warning and incomplete survey data
on channel 165:

  chan info: invalid frequency 5825 (idx 38 out of bounds)

Also make sure to enforce the sizes and avoid this
kind of problem in the future.

Fixes: 4a7898fed5f3 ("ath10k: enable channel 144 on 5GHz band")
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---

Notes:
    (based on pending branch)

 drivers/net/wireless/ath/ath10k/core.h | 2 +-
 drivers/net/wireless/ath/ath10k/mac.c  | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index d50408822f39..7fa171fa55e3 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -45,7 +45,7 @@
 #define WMI_READY_TIMEOUT (5 * HZ)
 #define ATH10K_FLUSH_TIMEOUT_HZ (5*HZ)
 #define ATH10K_CONNECTION_LOSS_HZ (3*HZ)
-#define ATH10K_NUM_CHANS 38
+#define ATH10K_NUM_CHANS 39
 
 /* Antenna noise floor */
 #define ATH10K_DEFAULT_NOISE_FLOOR -95
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 5f9705deb430..75cc304d32d4 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -6014,6 +6014,10 @@ int ath10k_mac_register(struct ath10k *ar)
 	ht_cap = ath10k_get_ht_cap(ar);
 	vht_cap = ath10k_create_vht_cap(ar);
 
+	BUILD_BUG_ON((ARRAY_SIZE(ath10k_2ghz_channels) +
+		      ARRAY_SIZE(ath10k_5ghz_channels)) !=
+		     ATH10K_NUM_CHANS);
+
 	if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
 		channels = kmemdup(ath10k_2ghz_channels,
 				   sizeof(ath10k_2ghz_channels),
-- 
2.1.4


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ath10k: fix survey reporting
  2015-03-24 12:38 [PATCH] ath10k: fix survey reporting Michal Kazior
@ 2015-04-01 17:20 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2015-04-01 17:20 UTC (permalink / raw)
  To: Michal Kazior; +Cc: linux-wireless, ath10k

Michal Kazior <michal.kazior@tieto.com> writes:

> Number of channels is stored in a separate macro
> in a header file and channel list is constructed
> independently. The macro is used to define survey
> array.
>
> This fixes a recent regression introduced after
> adding support for 144 channel. The regression
> would lead to a warning and incomplete survey data
> on channel 165:
>
>   chan info: invalid frequency 5825 (idx 38 out of bounds)
>
> Also make sure to enforce the sizes and avoid this
> kind of problem in the future.
>
> Fixes: 4a7898fed5f3 ("ath10k: enable channel 144 on 5GHz band")
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>

Thanks, applied.

-- 
Kalle Valo

_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-01 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-24 12:38 [PATCH] ath10k: fix survey reporting Michal Kazior
2015-04-01 17:20 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox