Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of wl1271 |
| 3 | * |
| 4 | * Copyright (C) 2008-2009 Nokia Corporation |
| 5 | * |
| 6 | * Contact: Luciano Coelho <luciano.coelho@nokia.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License |
| 10 | * version 2 as published by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 20 | * 02110-1301 USA |
| 21 | * |
| 22 | */ |
| 23 | |
Shahar Levi | 00d2010 | 2010-11-08 11:20:10 +0000 | [diff] [blame] | 24 | #include "wl12xx.h" |
Luciano Coelho | 0f4e312 | 2011-10-07 11:02:42 +0300 | [diff] [blame] | 25 | #include "debug.h" |
Shahar Levi | 00d2010 | 2010-11-08 11:20:10 +0000 | [diff] [blame] | 26 | #include "reg.h" |
| 27 | #include "io.h" |
| 28 | #include "event.h" |
| 29 | #include "ps.h" |
| 30 | #include "scan.h" |
Juuso Oikarinen | 66497dc | 2009-10-08 21:56:30 +0300 | [diff] [blame] | 31 | #include "wl12xx_80211.h" |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 32 | |
Juuso Oikarinen | 00236aed | 2010-04-09 11:07:30 +0300 | [diff] [blame] | 33 | static void wl1271_event_rssi_trigger(struct wl1271 *wl, |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 34 | struct wl12xx_vif *wlvif, |
Juuso Oikarinen | 00236aed | 2010-04-09 11:07:30 +0300 | [diff] [blame] | 35 | struct event_mailbox *mbox) |
| 36 | { |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 37 | struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); |
Juuso Oikarinen | 00236aed | 2010-04-09 11:07:30 +0300 | [diff] [blame] | 38 | enum nl80211_cqm_rssi_threshold_event event; |
| 39 | s8 metric = mbox->rssi_snr_trigger_metric[0]; |
| 40 | |
| 41 | wl1271_debug(DEBUG_EVENT, "RSSI trigger metric: %d", metric); |
| 42 | |
Eliad Peller | 04324d9 | 2011-10-05 11:56:03 +0200 | [diff] [blame] | 43 | if (metric <= wlvif->rssi_thold) |
Juuso Oikarinen | 00236aed | 2010-04-09 11:07:30 +0300 | [diff] [blame] | 44 | event = NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW; |
| 45 | else |
| 46 | event = NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH; |
| 47 | |
Eliad Peller | 04324d9 | 2011-10-05 11:56:03 +0200 | [diff] [blame] | 48 | if (event != wlvif->last_rssi_event) |
| 49 | ieee80211_cqm_rssi_notify(vif, event, GFP_KERNEL); |
| 50 | wlvif->last_rssi_event = event; |
Juuso Oikarinen | 00236aed | 2010-04-09 11:07:30 +0300 | [diff] [blame] | 51 | } |
| 52 | |
Eliad Peller | 536129c | 2011-10-05 11:55:45 +0200 | [diff] [blame] | 53 | static void wl1271_stop_ba_event(struct wl1271 *wl, struct wl12xx_vif *wlvif) |
Shahar Levi | 70559a0 | 2011-05-22 16:10:22 +0300 | [diff] [blame] | 54 | { |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 55 | struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); |
| 56 | |
Eliad Peller | 536129c | 2011-10-05 11:55:45 +0200 | [diff] [blame] | 57 | if (wlvif->bss_type != BSS_TYPE_AP_BSS) { |
Eliad Peller | d0802ab | 2011-10-05 11:56:04 +0200 | [diff] [blame] | 58 | if (!wlvif->sta.ba_rx_bitmap) |
Arik Nemtsov | f4d3b6a | 2011-08-25 12:43:16 +0300 | [diff] [blame] | 59 | return; |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 60 | ieee80211_stop_rx_ba_session(vif, wlvif->sta.ba_rx_bitmap, |
| 61 | vif->bss_conf.bssid); |
Arik Nemtsov | f4d3b6a | 2011-08-25 12:43:16 +0300 | [diff] [blame] | 62 | } else { |
Eliad Peller | c7ffb90 | 2011-10-05 11:56:05 +0200 | [diff] [blame] | 63 | u8 hlid; |
Arik Nemtsov | f4d3b6a | 2011-08-25 12:43:16 +0300 | [diff] [blame] | 64 | struct wl1271_link *lnk; |
Eliad Peller | c7ffb90 | 2011-10-05 11:56:05 +0200 | [diff] [blame] | 65 | for_each_set_bit(hlid, wlvif->ap.sta_hlid_map, |
| 66 | WL12XX_MAX_LINKS) { |
| 67 | lnk = &wl->links[hlid]; |
| 68 | if (!lnk->ba_bitmap) |
Arik Nemtsov | f4d3b6a | 2011-08-25 12:43:16 +0300 | [diff] [blame] | 69 | continue; |
Shahar Levi | 70559a0 | 2011-05-22 16:10:22 +0300 | [diff] [blame] | 70 | |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 71 | ieee80211_stop_rx_ba_session(vif, |
Arik Nemtsov | f4d3b6a | 2011-08-25 12:43:16 +0300 | [diff] [blame] | 72 | lnk->ba_bitmap, |
| 73 | lnk->addr); |
| 74 | } |
| 75 | } |
Shahar Levi | 70559a0 | 2011-05-22 16:10:22 +0300 | [diff] [blame] | 76 | } |
| 77 | |
Eliad Peller | 77ddaa1 | 2011-05-15 11:10:29 +0300 | [diff] [blame] | 78 | static void wl12xx_event_soft_gemini_sense(struct wl1271 *wl, |
| 79 | u8 enable) |
| 80 | { |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 81 | struct wl12xx_vif *wlvif; |
| 82 | |
Eliad Peller | 77ddaa1 | 2011-05-15 11:10:29 +0300 | [diff] [blame] | 83 | if (enable) { |
Eliad Peller | 77ddaa1 | 2011-05-15 11:10:29 +0300 | [diff] [blame] | 84 | set_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags); |
| 85 | } else { |
Eliad Peller | 9eb599e | 2011-10-10 10:12:59 +0200 | [diff] [blame] | 86 | clear_bit(WL1271_FLAG_SOFT_GEMINI, &wl->flags); |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 87 | wl12xx_for_each_wlvif_sta(wl, wlvif) { |
Eliad Peller | 9eb599e | 2011-10-10 10:12:59 +0200 | [diff] [blame] | 88 | wl1271_recalc_rx_streaming(wl, wlvif); |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 89 | } |
Eliad Peller | 77ddaa1 | 2011-05-15 11:10:29 +0300 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | } |
| 93 | |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 94 | static void wl1271_event_mbox_dump(struct event_mailbox *mbox) |
| 95 | { |
| 96 | wl1271_debug(DEBUG_EVENT, "MBOX DUMP:"); |
| 97 | wl1271_debug(DEBUG_EVENT, "\tvector: 0x%x", mbox->events_vector); |
| 98 | wl1271_debug(DEBUG_EVENT, "\tmask: 0x%x", mbox->events_mask); |
| 99 | } |
| 100 | |
| 101 | static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox) |
| 102 | { |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 103 | struct ieee80211_vif *vif; |
| 104 | struct wl12xx_vif *wlvif; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 105 | u32 vector; |
Juuso Oikarinen | 19ad071 | 2009-11-02 20:22:11 +0200 | [diff] [blame] | 106 | bool beacon_loss = false; |
Arik Nemtsov | 3618f30 | 2011-06-26 10:36:03 +0300 | [diff] [blame] | 107 | bool disconnect_sta = false; |
| 108 | unsigned long sta_bitmap = 0; |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 109 | |
| 110 | wl1271_event_mbox_dump(mbox); |
| 111 | |
Luciano Coelho | d0f63b2 | 2009-10-15 10:33:29 +0300 | [diff] [blame] | 112 | vector = le32_to_cpu(mbox->events_vector); |
| 113 | vector &= ~(le32_to_cpu(mbox->events_mask)); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 114 | wl1271_debug(DEBUG_EVENT, "vector: 0x%x", vector); |
| 115 | |
| 116 | if (vector & SCAN_COMPLETE_EVENT_ID) { |
Luciano Coelho | 34dd2aa | 2010-07-08 17:50:06 +0300 | [diff] [blame] | 117 | wl1271_debug(DEBUG_EVENT, "status: 0x%x", |
| 118 | mbox->scheduled_scan_status); |
| 119 | |
Eliad Peller | 784f694 | 2011-10-05 11:55:39 +0200 | [diff] [blame] | 120 | wl1271_scan_stm(wl, wl->scan_vif); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 121 | } |
| 122 | |
Luciano Coelho | 6394c01 | 2011-05-10 14:28:27 +0300 | [diff] [blame] | 123 | if (vector & PERIODIC_SCAN_REPORT_EVENT_ID) { |
| 124 | wl1271_debug(DEBUG_EVENT, "PERIODIC_SCAN_REPORT_EVENT " |
| 125 | "(status 0x%0x)", mbox->scheduled_scan_status); |
Luciano Coelho | 33c2c06 | 2011-05-10 14:46:02 +0300 | [diff] [blame] | 126 | |
| 127 | wl1271_scan_sched_scan_results(wl); |
Luciano Coelho | 6394c01 | 2011-05-10 14:28:27 +0300 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | if (vector & PERIODIC_SCAN_COMPLETE_EVENT_ID) { |
| 131 | wl1271_debug(DEBUG_EVENT, "PERIODIC_SCAN_COMPLETE_EVENT " |
| 132 | "(status 0x%0x)", mbox->scheduled_scan_status); |
Luciano Coelho | 33c2c06 | 2011-05-10 14:46:02 +0300 | [diff] [blame] | 133 | if (wl->sched_scanning) { |
Luciano Coelho | 33c2c06 | 2011-05-10 14:46:02 +0300 | [diff] [blame] | 134 | ieee80211_sched_scan_stopped(wl->hw); |
Eyal Shapira | ee91d18 | 2011-12-20 14:55:38 +0200 | [diff] [blame] | 135 | wl->sched_scanning = false; |
Luciano Coelho | 33c2c06 | 2011-05-10 14:46:02 +0300 | [diff] [blame] | 136 | } |
Luciano Coelho | 6394c01 | 2011-05-10 14:28:27 +0300 | [diff] [blame] | 137 | } |
| 138 | |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 139 | if (vector & SOFT_GEMINI_SENSE_EVENT_ID) |
Eliad Peller | 77ddaa1 | 2011-05-15 11:10:29 +0300 | [diff] [blame] | 140 | wl12xx_event_soft_gemini_sense(wl, |
| 141 | mbox->soft_gemini_sense_info); |
Juuso Oikarinen | 8d2ef7b | 2010-07-08 17:50:03 +0300 | [diff] [blame] | 142 | |
Juuso Oikarinen | b771eee | 2009-10-08 21:56:34 +0300 | [diff] [blame] | 143 | /* |
| 144 | * The BSS_LOSE_EVENT_ID is only needed while psm (and hence beacon |
| 145 | * filtering) is enabled. Without PSM, the stack will receive all |
| 146 | * beacons and can detect beacon loss by itself. |
Teemu Paasikivi | 64e29e4 | 2010-03-26 12:53:26 +0200 | [diff] [blame] | 147 | * |
| 148 | * As there's possibility that the driver disables PSM before receiving |
| 149 | * BSS_LOSE_EVENT, beacon loss has to be reported to the stack. |
| 150 | * |
Juuso Oikarinen | b771eee | 2009-10-08 21:56:34 +0300 | [diff] [blame] | 151 | */ |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 152 | if (vector & BSS_LOSE_EVENT_ID) { |
| 153 | /* TODO: check for multi-role */ |
Juuso Oikarinen | 1a186a5 | 2010-04-01 11:38:23 +0300 | [diff] [blame] | 154 | wl1271_info("Beacon loss detected."); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 155 | |
Juuso Oikarinen | b771eee | 2009-10-08 21:56:34 +0300 | [diff] [blame] | 156 | /* indicate to the stack, that beacons have been lost */ |
Juuso Oikarinen | 19ad071 | 2009-11-02 20:22:11 +0200 | [diff] [blame] | 157 | beacon_loss = true; |
| 158 | } |
| 159 | |
Juuso Oikarinen | 00236aed | 2010-04-09 11:07:30 +0300 | [diff] [blame] | 160 | if (vector & RSSI_SNR_TRIGGER_0_EVENT_ID) { |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 161 | /* TODO: check actual multi-role support */ |
Juuso Oikarinen | 00236aed | 2010-04-09 11:07:30 +0300 | [diff] [blame] | 162 | wl1271_debug(DEBUG_EVENT, "RSSI_SNR_TRIGGER_0_EVENT"); |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 163 | wl12xx_for_each_wlvif_sta(wl, wlvif) { |
| 164 | wl1271_event_rssi_trigger(wl, wlvif, mbox); |
| 165 | } |
Juuso Oikarinen | 00236aed | 2010-04-09 11:07:30 +0300 | [diff] [blame] | 166 | } |
| 167 | |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 168 | if (vector & BA_SESSION_RX_CONSTRAINT_EVENT_ID) { |
| 169 | u8 role_id = mbox->role_id; |
Shahar Levi | 70559a0 | 2011-05-22 16:10:22 +0300 | [diff] [blame] | 170 | wl1271_debug(DEBUG_EVENT, "BA_SESSION_RX_CONSTRAINT_EVENT_ID. " |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 171 | "ba_allowed = 0x%x, role_id=%d", |
| 172 | mbox->rx_ba_allowed, role_id); |
Shahar Levi | 70559a0 | 2011-05-22 16:10:22 +0300 | [diff] [blame] | 173 | |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 174 | wl12xx_for_each_wlvif(wl, wlvif) { |
| 175 | if (role_id != 0xff && role_id != wlvif->role_id) |
| 176 | continue; |
Arik Nemtsov | f4d3b6a | 2011-08-25 12:43:16 +0300 | [diff] [blame] | 177 | |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 178 | wlvif->ba_allowed = !!mbox->rx_ba_allowed; |
| 179 | if (!wlvif->ba_allowed) |
| 180 | wl1271_stop_ba_event(wl, wlvif); |
| 181 | } |
Shahar Levi | 70559a0 | 2011-05-22 16:10:22 +0300 | [diff] [blame] | 182 | } |
| 183 | |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 184 | if (vector & CHANNEL_SWITCH_COMPLETE_EVENT_ID) { |
Shahar Levi | 6d158ff | 2011-09-08 13:01:33 +0300 | [diff] [blame] | 185 | wl1271_debug(DEBUG_EVENT, "CHANNEL_SWITCH_COMPLETE_EVENT_ID. " |
| 186 | "status = 0x%x", |
| 187 | mbox->channel_switch_status); |
| 188 | /* |
| 189 | * That event uses for two cases: |
| 190 | * 1) channel switch complete with status=0 |
| 191 | * 2) channel switch failed status=1 |
| 192 | */ |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 193 | |
Eliad Peller | 52630c5 | 2011-10-10 10:13:08 +0200 | [diff] [blame] | 194 | /* TODO: configure only the relevant vif */ |
| 195 | wl12xx_for_each_wlvif_sta(wl, wlvif) { |
Eliad Peller | 52630c5 | 2011-10-10 10:13:08 +0200 | [diff] [blame] | 196 | bool success; |
| 197 | |
| 198 | if (!test_and_clear_bit(WLVIF_FLAG_CS_PROGRESS, |
| 199 | &wl->flags)) |
| 200 | continue; |
| 201 | |
| 202 | success = mbox->channel_switch_status ? false : true; |
Luciano Coelho | 775e1a4 | 2012-01-24 11:46:32 +0200 | [diff] [blame] | 203 | vif = wl12xx_wlvif_to_vif(wlvif); |
| 204 | |
Eliad Peller | 52630c5 | 2011-10-10 10:13:08 +0200 | [diff] [blame] | 205 | ieee80211_chswitch_done(vif, success); |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 206 | } |
Shahar Levi | 6d158ff | 2011-09-08 13:01:33 +0300 | [diff] [blame] | 207 | } |
| 208 | |
Arik Nemtsov | 79ebec7 | 2011-08-14 13:17:18 +0300 | [diff] [blame] | 209 | if ((vector & DUMMY_PACKET_EVENT_ID)) { |
Shahar Levi | ae47c45 | 2011-03-06 16:32:14 +0200 | [diff] [blame] | 210 | wl1271_debug(DEBUG_EVENT, "DUMMY_PACKET_ID_EVENT_ID"); |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 211 | wl1271_tx_dummy_packet(wl); |
Shahar Levi | ae47c45 | 2011-03-06 16:32:14 +0200 | [diff] [blame] | 212 | } |
| 213 | |
Arik Nemtsov | 3618f30 | 2011-06-26 10:36:03 +0300 | [diff] [blame] | 214 | /* |
| 215 | * "TX retries exceeded" has a different meaning according to mode. |
| 216 | * In AP mode the offending station is disconnected. |
| 217 | */ |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 218 | if (vector & MAX_TX_RETRY_EVENT_ID) { |
Arik Nemtsov | 3618f30 | 2011-06-26 10:36:03 +0300 | [diff] [blame] | 219 | wl1271_debug(DEBUG_EVENT, "MAX_TX_RETRY_EVENT_ID"); |
| 220 | sta_bitmap |= le16_to_cpu(mbox->sta_tx_retry_exceeded); |
| 221 | disconnect_sta = true; |
| 222 | } |
| 223 | |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 224 | if (vector & INACTIVE_STA_EVENT_ID) { |
Arik Nemtsov | 3618f30 | 2011-06-26 10:36:03 +0300 | [diff] [blame] | 225 | wl1271_debug(DEBUG_EVENT, "INACTIVE_STA_EVENT_ID"); |
| 226 | sta_bitmap |= le16_to_cpu(mbox->sta_aging_status); |
| 227 | disconnect_sta = true; |
| 228 | } |
| 229 | |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 230 | if (disconnect_sta) { |
Arik Nemtsov | 3618f30 | 2011-06-26 10:36:03 +0300 | [diff] [blame] | 231 | u32 num_packets = wl->conf.tx.max_tx_retries; |
| 232 | struct ieee80211_sta *sta; |
| 233 | const u8 *addr; |
| 234 | int h; |
| 235 | |
Eliad Peller | c7ffb90 | 2011-10-05 11:56:05 +0200 | [diff] [blame] | 236 | for_each_set_bit(h, &sta_bitmap, WL12XX_MAX_LINKS) { |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 237 | bool found = false; |
| 238 | /* find the ap vif connected to this sta */ |
| 239 | wl12xx_for_each_wlvif_ap(wl, wlvif) { |
| 240 | if (!test_bit(h, wlvif->ap.sta_hlid_map)) |
| 241 | continue; |
| 242 | found = true; |
| 243 | break; |
| 244 | } |
| 245 | if (!found) |
Arik Nemtsov | 3618f30 | 2011-06-26 10:36:03 +0300 | [diff] [blame] | 246 | continue; |
| 247 | |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 248 | vif = wl12xx_wlvif_to_vif(wlvif); |
Arik Nemtsov | 3618f30 | 2011-06-26 10:36:03 +0300 | [diff] [blame] | 249 | addr = wl->links[h].addr; |
| 250 | |
| 251 | rcu_read_lock(); |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 252 | sta = ieee80211_find_sta(vif, addr); |
Arik Nemtsov | 3618f30 | 2011-06-26 10:36:03 +0300 | [diff] [blame] | 253 | if (sta) { |
| 254 | wl1271_debug(DEBUG_EVENT, "remove sta %d", h); |
| 255 | ieee80211_report_low_ack(sta, num_packets); |
| 256 | } |
| 257 | rcu_read_unlock(); |
| 258 | } |
| 259 | } |
| 260 | |
Eliad Peller | 4b730b6 | 2011-10-10 10:12:57 +0200 | [diff] [blame] | 261 | if (beacon_loss) |
| 262 | wl12xx_for_each_wlvif_sta(wl, wlvif) { |
| 263 | vif = wl12xx_wlvif_to_vif(wlvif); |
| 264 | ieee80211_connection_loss(vif); |
| 265 | } |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 266 | |
| 267 | return 0; |
| 268 | } |
| 269 | |
| 270 | int wl1271_event_unmask(struct wl1271 *wl) |
| 271 | { |
| 272 | int ret; |
| 273 | |
| 274 | ret = wl1271_acx_event_mbox_mask(wl, ~(wl->event_mask)); |
| 275 | if (ret < 0) |
| 276 | return ret; |
| 277 | |
| 278 | return 0; |
| 279 | } |
| 280 | |
| 281 | void wl1271_event_mbox_config(struct wl1271 *wl) |
| 282 | { |
Teemu Paasikivi | 7b048c5 | 2010-02-18 13:25:55 +0200 | [diff] [blame] | 283 | wl->mbox_ptr[0] = wl1271_read32(wl, REG_EVENT_MAILBOX_PTR); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 284 | wl->mbox_ptr[1] = wl->mbox_ptr[0] + sizeof(struct event_mailbox); |
| 285 | |
| 286 | wl1271_debug(DEBUG_EVENT, "MBOX ptrs: 0x%x 0x%x", |
| 287 | wl->mbox_ptr[0], wl->mbox_ptr[1]); |
| 288 | } |
| 289 | |
Juuso Oikarinen | 13f2dc5 | 2009-12-11 15:40:59 +0200 | [diff] [blame] | 290 | int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num) |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 291 | { |
| 292 | struct event_mailbox mbox; |
| 293 | int ret; |
| 294 | |
| 295 | wl1271_debug(DEBUG_EVENT, "EVENT on mbox %d", mbox_num); |
| 296 | |
| 297 | if (mbox_num > 1) |
| 298 | return -EINVAL; |
| 299 | |
| 300 | /* first we read the mbox descriptor */ |
Teemu Paasikivi | 7b048c5 | 2010-02-18 13:25:55 +0200 | [diff] [blame] | 301 | wl1271_read(wl, wl->mbox_ptr[mbox_num], &mbox, |
| 302 | sizeof(struct event_mailbox), false); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 303 | |
| 304 | /* process the descriptor */ |
| 305 | ret = wl1271_event_process(wl, &mbox); |
| 306 | if (ret < 0) |
| 307 | return ret; |
| 308 | |
| 309 | /* then we let the firmware know it can go on...*/ |
Teemu Paasikivi | 7b048c5 | 2010-02-18 13:25:55 +0200 | [diff] [blame] | 310 | wl1271_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_EVENT_ACK); |
Luciano Coelho | f5fc0f8 | 2009-08-06 16:25:28 +0300 | [diff] [blame] | 311 | |
| 312 | return 0; |
| 313 | } |