wl12xx: change max/default template size
authorEliad Peller <eliad@wizery.com>
Sun, 14 Aug 2011 10:17:12 +0000 (13:17 +0300)
committerLuciano Coelho <coelho@ti.com>
Mon, 22 Aug 2011 09:35:25 +0000 (12:35 +0300)
The max template size was increased in the new fw.
However, we should use the max size only when needed, as it
consumes some of the chip's memory.

Thus, by default initialize the templates to the default size.
Initialize to the maximum size only when required.

Use WL1271_CMD_TEMPL_DFLT_SIZE instead of some of the
predefined structs, as some of them didn't account
for additional IEs that might be added to the template.

Delete structs defintions not used after these changes.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl12xx/cmd.h
drivers/net/wireless/wl12xx/init.c
drivers/net/wireless/wl12xx/main.c
drivers/net/wireless/wl12xx/wl12xx_80211.h

index 16e0a877bf5743fe8f437ed92deac67110cae440..6950759172f0f9e2353656597ec55a0093daf742 100644 (file)
@@ -172,7 +172,8 @@ enum cmd_templ {
 
 /* unit ms */
 #define WL1271_COMMAND_TIMEOUT     2000
-#define WL1271_CMD_TEMPL_MAX_SIZE  252
+#define WL1271_CMD_TEMPL_DFLT_SIZE 252
+#define WL1271_CMD_TEMPL_MAX_SIZE  548
 #define WL1271_EVENT_TIMEOUT       750
 
 struct wl1271_cmd_header {
index 76e6f37b87adec05424bcb45ad04e5933317be05..683c8d1285515a6fb564c6cb788ff8165c574c24 100644 (file)
@@ -39,13 +39,13 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl)
 
        /* send empty templates for fw memory reservation */
        ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, NULL,
-                                     WL1271_CMD_TEMPL_MAX_SIZE,
+                                     WL1271_CMD_TEMPL_DFLT_SIZE,
                                      0, WL1271_RATE_AUTOMATIC);
        if (ret < 0)
                return ret;
 
        ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5,
-                                     NULL, WL1271_CMD_TEMPL_MAX_SIZE, 0,
+                                     NULL, WL1271_CMD_TEMPL_DFLT_SIZE, 0,
                                      WL1271_RATE_AUTOMATIC);
        if (ret < 0)
                return ret;
@@ -70,15 +70,13 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl)
                return ret;
 
        ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PROBE_RESPONSE, NULL,
-                                     sizeof
-                                     (struct wl12xx_probe_resp_template),
+                                     WL1271_CMD_TEMPL_DFLT_SIZE,
                                      0, WL1271_RATE_AUTOMATIC);
        if (ret < 0)
                return ret;
 
        ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, NULL,
-                                     sizeof
-                                     (struct wl12xx_beacon_template),
+                                     WL1271_CMD_TEMPL_DFLT_SIZE,
                                      0, WL1271_RATE_AUTOMATIC);
        if (ret < 0)
                return ret;
@@ -92,7 +90,7 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl)
 
        for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
                ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV, NULL,
-                                             WL1271_CMD_TEMPL_MAX_SIZE, i,
+                                             WL1271_CMD_TEMPL_DFLT_SIZE, i,
                                              WL1271_RATE_AUTOMATIC);
                if (ret < 0)
                        return ret;
@@ -191,15 +189,13 @@ static int wl1271_ap_init_templates_config(struct wl1271 *wl)
         * reserve memory for later.
         */
        ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_PROBE_RESPONSE, NULL,
-                                     sizeof
-                                     (struct wl12xx_probe_resp_template),
+                                     WL1271_CMD_TEMPL_MAX_SIZE,
                                      0, WL1271_RATE_AUTOMATIC);
        if (ret < 0)
                return ret;
 
        ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_BEACON, NULL,
-                                     sizeof
-                                     (struct wl12xx_beacon_template),
+                                     WL1271_CMD_TEMPL_MAX_SIZE,
                                      0, WL1271_RATE_AUTOMATIC);
        if (ret < 0)
                return ret;
index 7b0b7c34ef761555377c0fcdfa18ccd8d260c1ee..1389c5cba343f7c89737e4d426d5c367a3171544 100644 (file)
@@ -4266,7 +4266,7 @@ int wl1271_init_ieee80211(struct wl1271 *wl)
         * should be the maximum length possible for a template, without
         * the IEEE80211 header of the template
         */
-       wl->hw->wiphy->max_scan_ie_len = WL1271_CMD_TEMPL_MAX_SIZE -
+       wl->hw->wiphy->max_scan_ie_len = WL1271_CMD_TEMPL_DFLT_SIZE -
                        sizeof(struct ieee80211_header);
 
        /* make sure all our channels fit in the scanned_ch bitmask */
index f334ea0817229adc07f39a8bdd37990d2e669894..f7971d3b089856bdd31135aa0e90b4e6d915829a 100644 (file)
@@ -105,18 +105,6 @@ struct wl12xx_ie_country {
 
 /* Templates */
 
-struct wl12xx_beacon_template {
-       struct ieee80211_header header;
-       __le32 time_stamp[2];
-       __le16 beacon_interval;
-       __le16 capability;
-       struct wl12xx_ie_ssid ssid;
-       struct wl12xx_ie_rates rates;
-       struct wl12xx_ie_rates ext_rates;
-       struct wl12xx_ie_ds_params ds_params;
-       struct wl12xx_ie_country country;
-} __packed;
-
 struct wl12xx_null_data_template {
        struct ieee80211_header header;
 } __packed;
@@ -146,19 +134,6 @@ struct wl12xx_arp_rsp_template {
        __be32 target_ip;
 } __packed;
 
-
-struct wl12xx_probe_resp_template {
-       struct ieee80211_header header;
-       __le32 time_stamp[2];
-       __le16 beacon_interval;
-       __le16 capability;
-       struct wl12xx_ie_ssid ssid;
-       struct wl12xx_ie_rates rates;
-       struct wl12xx_ie_rates ext_rates;
-       struct wl12xx_ie_ds_params ds_params;
-       struct wl12xx_ie_country country;
-} __packed;
-
 struct wl12xx_disconn_template {
        struct ieee80211_header header;
        __le16 disconn_reason;