wcn36xx: Improve feature caps exchange
authorPontus Fuchs <pontus.fuchs@gmail.com>
Wed, 12 Feb 2014 19:04:41 +0000 (19:04 +0000)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 13 Feb 2014 20:20:17 +0000 (15:20 -0500)
* Response format is not in the canonical format.
  wcn36xx_smd_rsp_status_check cannot be used.

* Save the FW caps in wcn36xx struct for later use.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/wcn36xx/hal.h
drivers/net/wireless/ath/wcn36xx/smd.c
drivers/net/wireless/ath/wcn36xx/wcn36xx.h

index 3c2ef0c32f72c7ef37b9b032e3b66ec3ab9619d6..a1f1127d7808d739e4f6571fa0f071491ca289bc 100644 (file)
@@ -4384,11 +4384,13 @@ enum place_holder_in_cap_bitmap {
        MAX_FEATURE_SUPPORTED = 128,
 };
 
+#define WCN36XX_HAL_CAPS_SIZE 4
+
 struct wcn36xx_hal_feat_caps_msg {
 
        struct wcn36xx_hal_msg_header header;
 
-       u32 feat_caps[4];
+       u32 feat_caps[WCN36XX_HAL_CAPS_SIZE];
 } __packed;
 
 /* status codes to help debug rekey failures */
index 8a57dfe6c6e8c7a61acd7861bc71d9395ea17bfb..425365ce6139d788aa65823f9c9e08a10855ce29 100644 (file)
@@ -1731,8 +1731,8 @@ static inline void clear_feat_caps(u32 *bitmap,
 
 int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn)
 {
-       struct wcn36xx_hal_feat_caps_msg msg_body;
-       int ret = 0;
+       struct wcn36xx_hal_feat_caps_msg msg_body, *rsp;
+       int ret = 0, i;
 
        mutex_lock(&wcn->hal_mutex);
        INIT_HAL_MSG(msg_body, WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_REQ);
@@ -1746,12 +1746,15 @@ int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn)
                wcn36xx_err("Sending hal_feature_caps_exchange failed\n");
                goto out;
        }
-       ret = wcn36xx_smd_rsp_status_check(wcn->hal_buf, wcn->hal_rsp_len);
-       if (ret) {
-               wcn36xx_err("hal_feature_caps_exchange response failed err=%d\n",
-                           ret);
+       if (wcn->hal_rsp_len != sizeof(*rsp)) {
+               wcn36xx_err("Invalid hal_feature_caps_exchange response");
                goto out;
        }
+
+       rsp = (struct wcn36xx_hal_feat_caps_msg *) wcn->hal_buf;
+
+       for (i = 0; i < WCN36XX_HAL_CAPS_SIZE; i++)
+               wcn->fw_feat_caps[i] = rsp->feat_caps[i];
 out:
        mutex_unlock(&wcn->hal_mutex);
        return ret;
index 8fa5cbace5abba1e027954a64b312bdc37f7b13c..c5bd61cffc9e0dc041bd1bbd64ee3d1a0d085bfd 100644 (file)
@@ -175,6 +175,7 @@ struct wcn36xx {
        u8                      fw_version;
        u8                      fw_minor;
        u8                      fw_major;
+       u32                     fw_feat_caps[WCN36XX_HAL_CAPS_SIZE];
 
        /* extra byte for the NULL termination */
        u8                      crm_version[WCN36XX_HAL_VERSION_LENGTH + 1];