diff options
Diffstat (limited to 'drivers/net/wireless/ti/wlcore/cmd.c')
-rw-r--r-- | drivers/net/wireless/ti/wlcore/cmd.c | 70 |
1 files changed, 29 insertions, 41 deletions
diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c index 34d9dff..c9e0607 100644 --- a/drivers/net/wireless/ti/wlcore/cmd.c +++ b/drivers/net/wireless/ti/wlcore/cmd.c @@ -60,8 +60,7 @@ static int __wlcore_cmd_send(struct wl1271 *wl, u16 id, void *buf, u16 status; u16 poll_count = 0; - if (WARN_ON(wl->state == WLCORE_STATE_RESTARTING && - id != CMD_STOP_FWLOGGER)) + if (WARN_ON(unlikely(wl->state == WLCORE_STATE_RESTARTING))) return -EIO; cmd = buf; @@ -846,8 +845,7 @@ EXPORT_SYMBOL_GPL(wl1271_cmd_test); * @buf: buffer for the response, including all headers, must work with dma * @len: length of buf */ -int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, - size_t cmd_len, size_t res_len) +int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len) { struct acx_header *acx = buf; int ret; @@ -856,10 +854,10 @@ int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, acx->id = cpu_to_le16(id); - /* response payload length, does not include any headers */ - acx->len = cpu_to_le16(res_len - sizeof(*acx)); + /* payload length, does not include any headers */ + acx->len = cpu_to_le16(len - sizeof(*acx)); - ret = wl1271_cmd_send(wl, CMD_INTERROGATE, acx, cmd_len, res_len); + ret = wl1271_cmd_send(wl, CMD_INTERROGATE, acx, sizeof(*acx), len); if (ret < 0) wl1271_error("INTERROGATE command failed"); @@ -1128,8 +1126,6 @@ int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif, u16 template_id_2_4 = wl->scan_templ_id_2_4; u16 template_id_5 = wl->scan_templ_id_5; - wl1271_debug(DEBUG_SCAN, "build probe request band %d", band); - skb = ieee80211_probereq_get(wl->hw, vif, ssid, ssid_len, ie_len); if (!skb) { @@ -1139,6 +1135,8 @@ int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif, if (ie_len) memcpy(skb_put(skb, ie_len), ie, ie_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 = wl->sched_scan_templ_id_2_4; @@ -1174,7 +1172,7 @@ struct sk_buff *wl1271_cmd_build_ap_probe_req(struct wl1271 *wl, if (!skb) goto out; - wl1271_debug(DEBUG_SCAN, "set ap probe request template"); + wl1271_dump(DEBUG_SCAN, "AP PROBE REQ: ", skb->data, skb->len); rate = wl1271_tx_min_rate_get(wl, wlvif->bitrate_masks[wlvif->band]); if (wlvif->band == IEEE80211_BAND_2GHZ) @@ -1609,43 +1607,33 @@ out: static int wlcore_get_reg_conf_ch_idx(enum ieee80211_band band, u16 ch) { - /* - * map the given band/channel to the respective predefined - * bit expected by the fw - */ + int idx = -1; + switch (band) { + case IEEE80211_BAND_5GHZ: + if (ch >= 8 && ch <= 16) + idx = ((ch-8)/4 + 18); + else if (ch >= 34 && ch <= 64) + idx = ((ch-34)/2 + 3 + 18); + else if (ch >= 100 && ch <= 140) + idx = ((ch-100)/4 + 15 + 18); + else if (ch >= 149 && ch <= 165) + idx = ((ch-149)/4 + 26 + 18); + else + idx = -1; + break; case IEEE80211_BAND_2GHZ: - /* channels 1..14 are mapped to 0..13 */ if (ch >= 1 && ch <= 14) - return ch - 1; - break; - case IEEE80211_BAND_5GHZ: - switch (ch) { - case 8 ... 16: - /* channels 8,12,16 are mapped to 18,19,20 */ - return 18 + (ch-8)/4; - case 34 ... 48: - /* channels 34,36..48 are mapped to 21..28 */ - return 21 + (ch-34)/2; - case 52 ... 64: - /* channels 52,56..64 are mapped to 29..32 */ - return 29 + (ch-52)/4; - case 100 ... 140: - /* channels 100,104..140 are mapped to 33..43 */ - return 33 + (ch-100)/4; - case 149 ... 165: - /* channels 149,153..165 are mapped to 44..48 */ - return 44 + (ch-149)/4; - default: - break; - } + idx = ch - 1; + else + idx = -1; break; default: - break; + wl1271_error("get reg conf ch idx - unknown band: %d", + (int)band); } - wl1271_error("%s: unknown band/channel: %d/%d", __func__, band, ch); - return -1; + return idx; } void wlcore_set_pending_regdomain_ch(struct wl1271 *wl, u16 channel, @@ -1658,7 +1646,7 @@ void wlcore_set_pending_regdomain_ch(struct wl1271 *wl, u16 channel, ch_bit_idx = wlcore_get_reg_conf_ch_idx(band, channel); - if (ch_bit_idx >= 0 && ch_bit_idx <= WL1271_MAX_CHANNELS) + if (ch_bit_idx > 0 && ch_bit_idx <= WL1271_MAX_CHANNELS) set_bit(ch_bit_idx, (long *)wl->reg_ch_conf_pending); } |