aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2014-09-04 04:18:32 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2014-09-10 07:17:09 -0400
commitc4f8c83665cf47b658ec2e4cc83cd873f8c943c7 (patch)
treea509450f84236b8a284510301170f9cb15503bf3
parente13cf7a313a44c7279b4b646b5b7056d702ad0b7 (diff)
ath10k: use proper service bitmap size
On 32bit systems the bitmap was too small and it was overwritten partially by the stat completion structure. This was visible with 10.2 firmware only due to it using a few of the last service ids. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath10k/core.h2
-rw-r--r--drivers/net/wireless/ath/ath10k/debug.c2
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.c4
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.h12
4 files changed, 9 insertions, 11 deletions
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 797741d762be..a2695e33f29a 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -293,7 +293,7 @@ struct ath10k_debug {
293 struct dentry *debugfs_phy; 293 struct dentry *debugfs_phy;
294 294
295 struct ath10k_target_stats target_stats; 295 struct ath10k_target_stats target_stats;
296 DECLARE_BITMAP(wmi_service_bitmap, WMI_SERVICE_BM_SIZE); 296 DECLARE_BITMAP(wmi_service_bitmap, WMI_SERVICE_MAX);
297 297
298 struct completion event_stats_compl; 298 struct completion event_stats_compl;
299 299
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 966784ad7ce4..97109221ffb3 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -208,7 +208,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file,
208 if (len > buf_len) 208 if (len > buf_len)
209 len = buf_len; 209 len = buf_len;
210 210
211 for (i = 0; i < WMI_MAX_SERVICE; i++) { 211 for (i = 0; i < WMI_SERVICE_MAX; i++) {
212 enabled = test_bit(i, ar->debug.wmi_service_bitmap); 212 enabled = test_bit(i, ar->debug.wmi_service_bitmap);
213 name = wmi_service_name(i); 213 name = wmi_service_name(i);
214 214
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index b13ccf6778c3..e7edc89cfcd0 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2164,7 +2164,7 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar,
2164 struct sk_buff *skb) 2164 struct sk_buff *skb)
2165{ 2165{
2166 struct wmi_service_ready_event *ev = (void *)skb->data; 2166 struct wmi_service_ready_event *ev = (void *)skb->data;
2167 DECLARE_BITMAP(svc_bmap, WMI_SERVICE_BM_SIZE) = {}; 2167 DECLARE_BITMAP(svc_bmap, WMI_SERVICE_MAX) = {};
2168 2168
2169 if (skb->len < sizeof(*ev)) { 2169 if (skb->len < sizeof(*ev)) {
2170 ath10k_warn(ar, "Service ready event was %d B but expected %zu B. Wrong firmware version?\n", 2170 ath10k_warn(ar, "Service ready event was %d B but expected %zu B. Wrong firmware version?\n",
@@ -2241,7 +2241,7 @@ static void ath10k_wmi_10x_service_ready_event_rx(struct ath10k *ar,
2241 u32 num_units, req_id, unit_size, num_mem_reqs, num_unit_info, i; 2241 u32 num_units, req_id, unit_size, num_mem_reqs, num_unit_info, i;
2242 int ret; 2242 int ret;
2243 struct wmi_service_ready_event_10x *ev = (void *)skb->data; 2243 struct wmi_service_ready_event_10x *ev = (void *)skb->data;
2244 DECLARE_BITMAP(svc_bmap, WMI_SERVICE_BM_SIZE) = {}; 2244 DECLARE_BITMAP(svc_bmap, WMI_SERVICE_MAX) = {};
2245 2245
2246 if (skb->len < sizeof(*ev)) { 2246 if (skb->len < sizeof(*ev)) {
2247 ath10k_warn(ar, "Service ready event was %d B but expected %zu B. Wrong firmware version?\n", 2247 ath10k_warn(ar, "Service ready event was %d B but expected %zu B. Wrong firmware version?\n",
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index e70836586756..bdb2e6cc0f4c 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -109,6 +109,9 @@ enum wmi_service {
109 WMI_SERVICE_BURST, 109 WMI_SERVICE_BURST,
110 WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT, 110 WMI_SERVICE_SMART_ANTENNA_SW_SUPPORT,
111 WMI_SERVICE_SMART_ANTENNA_HW_SUPPORT, 111 WMI_SERVICE_SMART_ANTENNA_HW_SUPPORT,
112
113 /* keep last */
114 WMI_SERVICE_MAX,
112}; 115};
113 116
114enum wmi_10x_service { 117enum wmi_10x_service {
@@ -219,8 +222,6 @@ static inline char *wmi_service_name(int service_id)
219#undef SVCSTR 222#undef SVCSTR
220} 223}
221 224
222#define WMI_MAX_SERVICE 64
223
224#define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id) \ 225#define WMI_SERVICE_IS_ENABLED(wmi_svc_bmap, svc_id) \
225 (__le32_to_cpu((wmi_svc_bmap)[(svc_id)/(sizeof(u32))]) & \ 226 (__le32_to_cpu((wmi_svc_bmap)[(svc_id)/(sizeof(u32))]) & \
226 BIT((svc_id)%(sizeof(u32)))) 227 BIT((svc_id)%(sizeof(u32))))
@@ -347,9 +348,6 @@ static inline void wmi_main_svc_map(const __le32 *in, unsigned long *out)
347 348
348#undef SVCMAP 349#undef SVCMAP
349 350
350#define WMI_SERVICE_BM_SIZE \
351 ((WMI_MAX_SERVICE + sizeof(u32) - 1)/sizeof(u32))
352
353/* 2 word representation of MAC addr */ 351/* 2 word representation of MAC addr */
354struct wmi_mac_addr { 352struct wmi_mac_addr {
355 union { 353 union {
@@ -1405,7 +1403,7 @@ struct wmi_service_ready_event {
1405 __le32 phy_capability; 1403 __le32 phy_capability;
1406 /* Maximum number of frag table entries that SW will populate less 1 */ 1404 /* Maximum number of frag table entries that SW will populate less 1 */
1407 __le32 max_frag_entry; 1405 __le32 max_frag_entry;
1408 __le32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE]; 1406 __le32 wmi_service_bitmap[16];
1409 __le32 num_rf_chains; 1407 __le32 num_rf_chains;
1410 /* 1408 /*
1411 * The following field is only valid for service type 1409 * The following field is only valid for service type
@@ -1444,7 +1442,7 @@ struct wmi_service_ready_event_10x {
1444 1442
1445 /* Maximum number of frag table entries that SW will populate less 1 */ 1443 /* Maximum number of frag table entries that SW will populate less 1 */
1446 __le32 max_frag_entry; 1444 __le32 max_frag_entry;
1447 __le32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE]; 1445 __le32 wmi_service_bitmap[16];
1448 __le32 num_rf_chains; 1446 __le32 num_rf_chains;
1449 1447
1450 /* 1448 /*