Commit 154037d1 authored by Eliad Peller's avatar Eliad Peller Committed by Luciano Coelho

wl12xx: change max/default template size

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: default avatarEliad Peller <eliad@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 79b122dc
...@@ -172,7 +172,8 @@ enum cmd_templ { ...@@ -172,7 +172,8 @@ enum cmd_templ {
/* unit ms */ /* unit ms */
#define WL1271_COMMAND_TIMEOUT 2000 #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 #define WL1271_EVENT_TIMEOUT 750
struct wl1271_cmd_header { struct wl1271_cmd_header {
......
...@@ -39,13 +39,13 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl) ...@@ -39,13 +39,13 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl)
/* send empty templates for fw memory reservation */ /* send empty templates for fw memory reservation */
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_2_4, NULL, 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); 0, WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_CFG_PROBE_REQ_5, 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); WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -70,15 +70,13 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl) ...@@ -70,15 +70,13 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl)
return ret; return ret;
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PROBE_RESPONSE, NULL, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_PROBE_RESPONSE, NULL,
sizeof WL1271_CMD_TEMPL_DFLT_SIZE,
(struct wl12xx_probe_resp_template),
0, WL1271_RATE_AUTOMATIC); 0, WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, NULL, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_BEACON, NULL,
sizeof WL1271_CMD_TEMPL_DFLT_SIZE,
(struct wl12xx_beacon_template),
0, WL1271_RATE_AUTOMATIC); 0, WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -92,7 +90,7 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl) ...@@ -92,7 +90,7 @@ int wl1271_sta_init_templates_config(struct wl1271 *wl)
for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) { for (i = 0; i < CMD_TEMPL_KLV_IDX_MAX; i++) {
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_KLV, NULL, 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); WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -191,15 +189,13 @@ static int wl1271_ap_init_templates_config(struct wl1271 *wl) ...@@ -191,15 +189,13 @@ static int wl1271_ap_init_templates_config(struct wl1271 *wl)
* reserve memory for later. * reserve memory for later.
*/ */
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_PROBE_RESPONSE, NULL, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_PROBE_RESPONSE, NULL,
sizeof WL1271_CMD_TEMPL_MAX_SIZE,
(struct wl12xx_probe_resp_template),
0, WL1271_RATE_AUTOMATIC); 0, WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_BEACON, NULL, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_AP_BEACON, NULL,
sizeof WL1271_CMD_TEMPL_MAX_SIZE,
(struct wl12xx_beacon_template),
0, WL1271_RATE_AUTOMATIC); 0, WL1271_RATE_AUTOMATIC);
if (ret < 0) if (ret < 0)
return ret; return ret;
......
...@@ -4266,7 +4266,7 @@ int wl1271_init_ieee80211(struct wl1271 *wl) ...@@ -4266,7 +4266,7 @@ int wl1271_init_ieee80211(struct wl1271 *wl)
* should be the maximum length possible for a template, without * should be the maximum length possible for a template, without
* the IEEE80211 header of the template * 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); sizeof(struct ieee80211_header);
/* make sure all our channels fit in the scanned_ch bitmask */ /* make sure all our channels fit in the scanned_ch bitmask */
......
...@@ -105,18 +105,6 @@ struct wl12xx_ie_country { ...@@ -105,18 +105,6 @@ struct wl12xx_ie_country {
/* Templates */ /* 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 wl12xx_null_data_template {
struct ieee80211_header header; struct ieee80211_header header;
} __packed; } __packed;
...@@ -146,19 +134,6 @@ struct wl12xx_arp_rsp_template { ...@@ -146,19 +134,6 @@ struct wl12xx_arp_rsp_template {
__be32 target_ip; __be32 target_ip;
} __packed; } __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 wl12xx_disconn_template {
struct ieee80211_header header; struct ieee80211_header header;
__le16 disconn_reason; __le16 disconn_reason;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment