]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
wcn36xx: Restore BEACON_TEMPLATE_SIZE
authorBjorn Andersson <bjorn.andersson@linaro.org>
Thu, 14 Apr 2016 01:13:28 +0000 (18:13 -0700)
committerNicolas Dechesne <nicolas.dechesne@linaro.org>
Fri, 22 Apr 2016 09:32:10 +0000 (11:32 +0200)
The BEACON_TEMPLATE_SIZE is used to describe the size of the beacon
template in SEND_BEACON_REQ as well as UPDATE_PROBE_RSP_TEMPLATE_REQ, in
the first case the beacon length is doubly encoded inside this buffer
while in the second its not.

Restore the BEACON_TEMPLATE_SIZE, to make UPDATE_PROBE_RSP_TEMPLATE_REQ
correct again and properly encode the double encoded length in the
SEND_BEACON_REQ case.

Also update the SEND_BEACON_REQ code path to mark the template size as
being the sum of the beacon size and the internal length marker.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
drivers/net/wireless/ath/wcn36xx/hal.h
drivers/net/wireless/ath/wcn36xx/smd.c

index c5c347a2748f9c0f50c5bbb71ffab9673552d5d1..4a78583697d75ce797c155186b2227f83adef50f 100644 (file)
@@ -52,7 +52,7 @@
 #define WCN36XX_HAL_BSS_INVALID_IDX 0xFF
 
 /* Default Beacon template size. */
-#define BEACON_TEMPLATE_SIZE 0x17C
+#define BEACON_TEMPLATE_SIZE 0x180
 
 /* Minimum PVM size that the FW expects. See comment in smd.c for details. */
 #define TIM_MIN_PVM_SIZE 6
@@ -2889,14 +2889,12 @@ struct update_beacon_rsp_msg {
 struct wcn36xx_hal_send_beacon_req_msg {
        struct wcn36xx_hal_msg_header header;
 
-       /* length of the template + 6. Only qcom knows why */
-       u32 beacon_length6;
-
-       /* length of the template. */
-       u32 beacon_length;
+       /* length of the template + sizeof(beacon_length) */
+       u32 template_length;
 
        /* Beacon data. */
-       u8 beacon[BEACON_TEMPLATE_SIZE];
+       u32 beacon_length;
+       u8 beacon[BEACON_TEMPLATE_SIZE - sizeof(u32)];
 
        u8 bssid[ETH_ALEN];
 
index abeeb36667857c9df779f5834207d94dc6a9aa08..ae015a961110b813f585e39880306fc97d6c2617 100644 (file)
@@ -1405,6 +1405,7 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif,
 {
        struct wcn36xx_hal_send_beacon_req_msg msg_body;
        int ret = 0, pad, pvm_len;
+       u32 beacon_length;
 
        mutex_lock(&wcn->hal_mutex);
        INIT_HAL_MSG(msg_body, WCN36XX_HAL_SEND_BEACON_REQ);
@@ -1416,16 +1417,16 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif,
        if (vif->type == NL80211_IFTYPE_MESH_POINT)
                pad = 0;
 
-       msg_body.beacon_length = skb_beacon->len + pad;
-       /* TODO need to find out why + 6 is needed */
-       msg_body.beacon_length6 = msg_body.beacon_length + 6;
+       beacon_length = skb_beacon->len + pad;
+       msg_body.template_length = beacon_length + sizeof(beacon_length);
 
-       if (msg_body.beacon_length > BEACON_TEMPLATE_SIZE) {
+       if (msg_body.template_length > BEACON_TEMPLATE_SIZE) {
                wcn36xx_err("Beacon is to big: beacon size=%d\n",
-                             msg_body.beacon_length);
+                             msg_body.template_length);
                ret = -ENOMEM;
                goto out;
        }
+       msg_body.beacon_length = beacon_length;
        memcpy(msg_body.beacon, skb_beacon->data, skb_beacon->len);
        memcpy(msg_body.bssid, vif->addr, ETH_ALEN);