24 #include <linux/module.h>
29 #include <linux/slab.h>
41 #define WL1271_CMD_FAST_POLL_COUNT 50
42 #define WL1271_WAIT_EVENT_FAST_POLL_COUNT 20
72 ret = wlcore_write(wl, wl->
cmd_box_addr, buf, len,
false);
112 ret = wlcore_read(wl, wl->
cmd_box_addr, cmd, res_len,
false);
124 WL1271_ACX_INTR_CMD_COMPLETE);
139 static int wl1271_cmd_wait_for_event_or_timeout(
struct wl1271 *wl,
144 unsigned long timeout_time;
171 ret = wlcore_read(wl, wl->
mbox_ptr[0], events_vector,
172 sizeof(*events_vector),
false);
176 event = *events_vector &
mask;
178 ret = wlcore_read(wl, wl->
mbox_ptr[1], events_vector,
179 sizeof(*events_vector),
false);
183 event |= *events_vector &
mask;
187 kfree(events_vector);
191 static int wl1271_cmd_wait_for_event(
struct wl1271 *wl,
u32 mask)
194 bool timeout =
false;
196 ret = wl1271_cmd_wait_for_event_or_timeout(wl, mask, &timeout);
197 if (ret != 0 || timeout) {
292 spin_unlock_irqrestore(&wl->
wl_lock, flags);
308 spin_unlock_irqrestore(&wl->
wl_lock, flags);
319 static int wl12xx_get_new_session_id(
struct wl1271 *wl,
330 static u8 wlcore_get_native_channel_type(
u8 nl_channel_type)
332 switch (nl_channel_type) {
347 static int wl12xx_cmd_role_start_dev(
struct wl1271 *wl,
372 cmd->
device.session = wl12xx_get_new_session_id(wl, wlvif);
396 static int wl12xx_cmd_role_stop_dev(
struct wl1271 *wl,
425 wl1271_error(
"cmd role stop dev event completion error");
470 cmd->
sta.hlid = wlvif->
sta.hlid;
471 cmd->
sta.session = wl12xx_get_new_session_id(wl, wlvif);
475 "basic_rate_set: 0x%x, remote_rates: 0x%x",
503 bool timeout =
false;
531 ret = wl1271_cmd_wait_for_event_or_timeout(wl,
575 goto out_free_global;
580 cmd->
ap.global_hlid = wlvif->
ap.global_hlid;
581 cmd->
ap.broadcast_hlid = wlvif->
ap.bcast_hlid;
587 cmd->
ap.reset_tsf = 1;
603 wlcore_hw_ap_get_mimo_wide_rate_mask(wl, wlvif);
610 switch (wlvif->
band) {
708 cmd->
ibss.hlid = wlvif->
sta.hlid;
712 "basic_rate_set: 0x%x, remote_rates: 0x%x",
853 enable ?
"start" :
"stop", cmd->
channel);
858 enable ?
"start" :
"stop", cmd->
channel);
863 enable ?
"start" :
"stop", cmd->
channel);
868 enable ?
"start" :
"stop", cmd->
channel);
877 u8 ps_mode,
u16 auto_ps_timeout)
884 ps_params = kzalloc(
sizeof(*ps_params),
GFP_KERNEL);
895 sizeof(*ps_params), 0);
907 u16 template_id,
void *
buf,
size_t buf_len,
914 template_id, role_id);
963 wl12xx_wlvif_to_vif(wlvif));
996 wlvif->
sta.klv_template_id,
1029 u8 role_id,
u8 band,
1030 const u8 *
ssid,
size_t ssid_len,
1031 const u8 *ie,
size_t ie_len,
bool sched_scan)
1059 skb->
data, skb->
len, 0, rate);
1063 skb->
data, skb->
len, 0, rate);
1089 skb->
data, skb->
len, 0, rate);
1093 skb->
data, skb->
len, 0, rate);
1096 wl1271_error(
"Unable to set ap probe request template.");
1112 skb = dev_alloc_skb(
sizeof(*hdr) +
sizeof(
__le16) +
sizeof(*tmpl) +
1115 wl1271_error(
"failed to allocate buffer for arp rsp template");
1122 memset(tmpl, 0,
sizeof(*tmpl));
1172 memset(hdr, 0,
sizeof(*hdr));
1196 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
1199 memset(&
template, 0,
sizeof(
template));
1214 sizeof(
template), 0,
1252 u32 tx_seq_32,
u16 tx_seq_16)
1271 else if (is_broadcast_ether_addr(addr))
1331 if (hlid == wlvif->
ap.bcast_hlid) {
1341 " hlid: %d", (
int)action, (
int)
id, (
int)lid_type,
1342 (
int)key_type, (
int)hlid);
1429 cmd->
wmm = sta->
wme ? 1 : 0;
1433 cmd->
psd_type[NUM_ACCESS_CATEGORIES_COPY-1-
i] =
1436 cmd->
psd_type[NUM_ACCESS_CATEGORIES_COPY-1-
i] =
1441 if (sta->
ht_cap.ht_supported)
1470 bool timeout =
false;
1491 ret = wl1271_cmd_wait_for_event_or_timeout(wl,
1530 wl1271_error(
"failed to send config firmware logger command");
1556 wl1271_error(
"failed to send start firmware logger command");
1582 wl1271_error(
"failed to send stop firmware logger command");
1612 switch (wlvif->
band) {
1683 ret = wl1271_cmd_wait_for_event(wl,
1792 wl12xx_wlvif_to_vif(wlvif)->
addr,
1798 ret = wl12xx_cmd_role_start_dev(wl, wlvif);
1809 wl12xx_cmd_role_stop_dev(wl, wlvif);
1836 ret = wl12xx_cmd_role_stop_dev(wl, wlvif);