Commit 3df74f46 authored by Yoni Divinsky's avatar Yoni Divinsky Committed by John W. Linville

wlcore: add probe request templates for sched and one-shot scans

The driver configures the firmware template for probe requests during
the scan process.  If the same template is used for one-shot and sched
scans they will override each other when running scans simultaneously.

This fix works only on firmwares later than X.3.9.2.112 for single
role and X.3.9.2.23 for multi-role.

[Some cleaning-up and renaming of the quirk to something smaller --
Luca.]
Signed-off-by: default avatarYoni Divinsky <yoni.divinsky@ti.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent b034fd6f
...@@ -637,6 +637,7 @@ static int wl12xx_identify_chip(struct wl1271 *wl) ...@@ -637,6 +637,7 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
wl->chip.id); wl->chip.id);
wl->quirks |= WLCORE_QUIRK_LEGACY_NVS | wl->quirks |= WLCORE_QUIRK_LEGACY_NVS |
WLCORE_QUIRK_DUAL_PROBE_TMPL |
WLCORE_QUIRK_TKIP_HEADER_SPACE; WLCORE_QUIRK_TKIP_HEADER_SPACE;
wl->sr_fw_name = WL127X_FW_NAME_SINGLE; wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
wl->mr_fw_name = WL127X_FW_NAME_MULTI; wl->mr_fw_name = WL127X_FW_NAME_MULTI;
...@@ -656,6 +657,7 @@ static int wl12xx_identify_chip(struct wl1271 *wl) ...@@ -656,6 +657,7 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
wl->chip.id); wl->chip.id);
wl->quirks |= WLCORE_QUIRK_LEGACY_NVS | wl->quirks |= WLCORE_QUIRK_LEGACY_NVS |
WLCORE_QUIRK_DUAL_PROBE_TMPL |
WLCORE_QUIRK_TKIP_HEADER_SPACE; WLCORE_QUIRK_TKIP_HEADER_SPACE;
wl->plt_fw_name = WL127X_PLT_FW_NAME; wl->plt_fw_name = WL127X_PLT_FW_NAME;
wl->sr_fw_name = WL127X_FW_NAME_SINGLE; wl->sr_fw_name = WL127X_FW_NAME_SINGLE;
...@@ -680,6 +682,7 @@ static int wl12xx_identify_chip(struct wl1271 *wl) ...@@ -680,6 +682,7 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
/* wl128x requires TX blocksize alignment */ /* wl128x requires TX blocksize alignment */
wl->quirks |= WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN | wl->quirks |= WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN |
WLCORE_QUIRK_DUAL_PROBE_TMPL |
WLCORE_QUIRK_TKIP_HEADER_SPACE; WLCORE_QUIRK_TKIP_HEADER_SPACE;
wlcore_set_min_fw_ver(wl, WL128X_CHIP_VER, WL128X_IFTYPE_VER, wlcore_set_min_fw_ver(wl, WL128X_CHIP_VER, WL128X_IFTYPE_VER,
......
...@@ -1007,12 +1007,14 @@ int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -1007,12 +1007,14 @@ int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif,
int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif, int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif,
u8 role_id, u8 band, u8 role_id, u8 band,
const u8 *ssid, size_t ssid_len, const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len) const u8 *ie, size_t ie_len, bool sched_scan)
{ {
struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
struct sk_buff *skb; struct sk_buff *skb;
int ret; int ret;
u32 rate; u32 rate;
u16 template_id_2_4 = CMD_TEMPL_CFG_PROBE_REQ_2_4;
u16 template_id_5 = CMD_TEMPL_CFG_PROBE_REQ_5;
skb = ieee80211_probereq_get(wl->hw, vif, ssid, ssid_len, skb = ieee80211_probereq_get(wl->hw, vif, ssid, ssid_len,
ie, ie_len); ie, ie_len);
...@@ -1023,14 +1025,20 @@ int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -1023,14 +1025,20 @@ int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif,
wl1271_dump(DEBUG_SCAN, "PROBE REQ: ", skb->data, skb->len); wl1271_dump(DEBUG_SCAN, "PROBE REQ: ", skb->data, skb->len);
if (!sched_scan &&
(wl->quirks & WLCORE_QUIRK_DUAL_PROBE_TMPL)) {
template_id_2_4 = CMD_TEMPL_APP_PROBE_REQ_2_4;
template_id_5 = CMD_TEMPL_APP_PROBE_REQ_5;
}
rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[band]); rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[band]);
if (band == IEEE80211_BAND_2GHZ) if (band == IEEE80211_BAND_2GHZ)
ret = wl1271_cmd_template_set(wl, role_id, ret = wl1271_cmd_template_set(wl, role_id,
CMD_TEMPL_CFG_PROBE_REQ_2_4, template_id_2_4,
skb->data, skb->len, 0, rate); skb->data, skb->len, 0, rate);
else else
ret = wl1271_cmd_template_set(wl, role_id, ret = wl1271_cmd_template_set(wl, role_id,
CMD_TEMPL_CFG_PROBE_REQ_5, template_id_5,
skb->data, skb->len, 0, rate); skb->data, skb->len, 0, rate);
out: out:
......
...@@ -58,7 +58,7 @@ int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -58,7 +58,7 @@ int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif,
int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif, int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif,
u8 role_id, u8 band, u8 role_id, u8 band,
const u8 *ssid, size_t ssid_len, const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len); const u8 *ie, size_t ie_len, bool sched_scan);
struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl, struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl,
struct wl12xx_vif *wlvif, struct wl12xx_vif *wlvif,
struct sk_buff *skb); struct sk_buff *skb);
...@@ -172,8 +172,8 @@ enum cmd_templ { ...@@ -172,8 +172,8 @@ enum cmd_templ {
CMD_TEMPL_PS_POLL, CMD_TEMPL_PS_POLL,
CMD_TEMPL_KLV, CMD_TEMPL_KLV,
CMD_TEMPL_DISCONNECT, CMD_TEMPL_DISCONNECT,
CMD_TEMPL_PROBE_REQ_2_4, /* for firmware internal use only */ CMD_TEMPL_APP_PROBE_REQ_2_4,
CMD_TEMPL_PROBE_REQ_5, /* for firmware internal use only */ CMD_TEMPL_APP_PROBE_REQ_5,
CMD_TEMPL_BAR, /* for firmware internal use only */ CMD_TEMPL_BAR, /* for firmware internal use only */
CMD_TEMPL_CTS, /* CMD_TEMPL_CTS, /*
* For CTS-to-self (FastCTS) mechanism * For CTS-to-self (FastCTS) mechanism
......
...@@ -54,6 +54,22 @@ int wl1271_init_templates_config(struct wl1271 *wl) ...@@ -54,6 +54,22 @@ int wl1271_init_templates_config(struct wl1271 *wl)
if (ret < 0) if (ret < 0)
return ret; return ret;
if (wl->quirks & WLCORE_QUIRK_DUAL_PROBE_TMPL) {
ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
CMD_TEMPL_APP_PROBE_REQ_2_4, NULL,
WL1271_CMD_TEMPL_MAX_SIZE,
0, WL1271_RATE_AUTOMATIC);
if (ret < 0)
return ret;
ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
CMD_TEMPL_APP_PROBE_REQ_5, NULL,
WL1271_CMD_TEMPL_MAX_SIZE,
0, WL1271_RATE_AUTOMATIC);
if (ret < 0)
return ret;
}
ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID, ret = wl1271_cmd_template_set(wl, WL12XX_INVALID_ROLE_ID,
CMD_TEMPL_NULL_DATA, NULL, CMD_TEMPL_NULL_DATA, NULL,
sizeof(struct wl12xx_null_data_template), sizeof(struct wl12xx_null_data_template),
......
...@@ -226,7 +226,7 @@ static int wl1271_scan_send(struct wl1271 *wl, struct ieee80211_vif *vif, ...@@ -226,7 +226,7 @@ static int wl1271_scan_send(struct wl1271 *wl, struct ieee80211_vif *vif,
cmd->params.role_id, band, cmd->params.role_id, band,
wl->scan.ssid, wl->scan.ssid_len, wl->scan.ssid, wl->scan.ssid_len,
wl->scan.req->ie, wl->scan.req->ie,
wl->scan.req->ie_len); wl->scan.req->ie_len, false);
if (ret < 0) { if (ret < 0) {
wl1271_error("PROBE request template failed"); wl1271_error("PROBE request template failed");
goto out; goto out;
...@@ -722,7 +722,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, ...@@ -722,7 +722,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
req->ssids[0].ssid, req->ssids[0].ssid,
req->ssids[0].ssid_len, req->ssids[0].ssid_len,
ies->ie[band], ies->ie[band],
ies->len[band]); ies->len[band], true);
if (ret < 0) { if (ret < 0) {
wl1271_error("2.4GHz PROBE request template failed"); wl1271_error("2.4GHz PROBE request template failed");
goto out; goto out;
...@@ -736,7 +736,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl, ...@@ -736,7 +736,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
req->ssids[0].ssid, req->ssids[0].ssid,
req->ssids[0].ssid_len, req->ssids[0].ssid_len,
ies->ie[band], ies->ie[band],
ies->len[band]); ies->len[band], true);
if (ret < 0) { if (ret < 0) {
wl1271_error("5GHz PROBE request template failed"); wl1271_error("5GHz PROBE request template failed");
goto out; goto out;
......
...@@ -455,6 +455,9 @@ wlcore_set_min_fw_ver(struct wl1271 *wl, unsigned int chip, ...@@ -455,6 +455,9 @@ wlcore_set_min_fw_ver(struct wl1271 *wl, unsigned int chip,
/* Some firmwares not support sched scans while connected */ /* Some firmwares not support sched scans while connected */
#define WLCORE_QUIRK_NO_SCHED_SCAN_WHILE_CONN BIT(9) #define WLCORE_QUIRK_NO_SCHED_SCAN_WHILE_CONN BIT(9)
/* separate probe response templates for one-shot and sched scans */
#define WLCORE_QUIRK_DUAL_PROBE_TMPL BIT(10)
/* TODO: move to the lower drivers when all usages are abstracted */ /* TODO: move to the lower drivers when all usages are abstracted */
#define CHIP_ID_1271_PG10 (0x4030101) #define CHIP_ID_1271_PG10 (0x4030101)
#define CHIP_ID_1271_PG20 (0x4030111) #define CHIP_ID_1271_PG20 (0x4030111)
......
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