blob: a4e147a11d0cd08cf8aa8c8769930513e8ffc88f [file] [log] [blame]
Marcelo Tosatti876c9d32007-02-10 12:25:27 -02001/**
2 * This file contains the handling of command
3 * responses as well as events generated by firmware.
4 */
Tejun Heo5a0e3ad2010-03-24 17:04:11 +09005#include <linux/slab.h>
Marcelo Tosatti876c9d32007-02-10 12:25:27 -02006#include <linux/delay.h>
Alan Cox767e3662009-10-12 05:27:48 +00007#include <linux/sched.h>
Cliff Cai2c5b9e512009-05-27 14:03:09 -04008#include <asm/unaligned.h>
Kiran Divekare86dc1c2010-06-14 22:01:26 +05309#include <net/cfg80211.h>
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020010
Kiran Divekare86dc1c2010-06-14 22:01:26 +053011#include "cfg.h"
Amitkumar Karwar66fceb62010-05-19 03:24:38 -070012#include "cmd.h"
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020013
14/**
15 * @brief This function handles disconnect event. it
16 * reports disconnect to upper layer, clean tx/rx packets,
17 * reset link state etc.
18 *
Holger Schurig69f90322007-11-23 15:43:44 +010019 * @param priv A pointer to struct lbs_private structure
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020020 * @return n/a
21 */
Holger Schurig69f90322007-11-23 15:43:44 +010022void lbs_mac_event_disconnected(struct lbs_private *priv)
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020023{
David Woodhouseaa21c002007-12-08 20:04:36 +000024 if (priv->connect_status != LBS_CONNECTED)
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020025 return;
26
Holger Schurig91843462007-11-28 14:05:02 +010027 lbs_deb_enter(LBS_DEB_ASSOC);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020028
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020029 /*
30 * Cisco AP sends EAP failure and de-auth in less than 0.5 ms.
31 * It causes problem in the Supplicant
32 */
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020033 msleep_interruptible(1000);
Kiran Divekare4fe4ea2010-06-04 23:20:37 -070034
35 if (priv->wdev->iftype == NL80211_IFTYPE_STATION)
36 lbs_send_disconnect_notification(priv);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020037
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020038 /* report disconnect to upper layer */
Holger Schurig634b8f42007-05-25 13:05:16 -040039 netif_stop_queue(priv->dev);
40 netif_carrier_off(priv->dev);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020041
David Woodhousea27b9f92007-12-12 00:41:51 -050042 /* Free Tx and Rx packets */
43 kfree_skb(priv->currenttxskb);
44 priv->currenttxskb = NULL;
45 priv->tx_pending_len = 0;
46
David Woodhouseaa21c002007-12-08 20:04:36 +000047 priv->connect_status = LBS_DISCONNECTED;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020048
David Woodhouseaa21c002007-12-08 20:04:36 +000049 if (priv->psstate != PS_STATE_FULL_POWER) {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020050 /* make firmware to exit PS mode */
Holger Schuriga6c87002007-08-02 11:54:10 -040051 lbs_deb_cmd("disconnected, so exit PS mode\n");
Holger Schurig10078322007-11-15 18:05:47 -050052 lbs_ps_wakeup(priv, 0);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020053 }
Holger Schurig52507c22008-01-28 17:25:53 +010054 lbs_deb_leave(LBS_DEB_ASSOC);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020055}
56
Holger Schurig7919b892008-04-01 14:50:43 +020057int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020058{
David Woodhousee1258172007-12-11 23:42:49 -050059 uint16_t respcmd, curcmd;
Dan Williamsddac4522007-12-11 13:49:39 -050060 struct cmd_header *resp;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020061 int ret = 0;
David Woodhousee1258172007-12-11 23:42:49 -050062 unsigned long flags;
63 uint16_t result;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020064
Holger Schuriga6c87002007-08-02 11:54:10 -040065 lbs_deb_enter(LBS_DEB_HOST);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020066
David Woodhouseaa21c002007-12-08 20:04:36 +000067 mutex_lock(&priv->lock);
68 spin_lock_irqsave(&priv->driver_lock, flags);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020069
David Woodhouseaa21c002007-12-08 20:04:36 +000070 if (!priv->cur_cmd) {
Holger Schuriga6c87002007-08-02 11:54:10 -040071 lbs_deb_host("CMD_RESP: cur_cmd is NULL\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020072 ret = -1;
David Woodhouseaa21c002007-12-08 20:04:36 +000073 spin_unlock_irqrestore(&priv->driver_lock, flags);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020074 goto done;
75 }
David Woodhousee1258172007-12-11 23:42:49 -050076
Holger Schurig7919b892008-04-01 14:50:43 +020077 resp = (void *)data;
Sebastian Siewior8a96df82008-03-04 18:22:27 +010078 curcmd = le16_to_cpu(priv->cur_cmd->cmdbuf->command);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020079 respcmd = le16_to_cpu(resp->command);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020080 result = le16_to_cpu(resp->result);
81
Holger Schurige5225b32008-03-26 10:04:44 +010082 lbs_deb_cmd("CMD_RESP: response 0x%04x, seq %d, size %d\n",
Holger Schurig7919b892008-04-01 14:50:43 +020083 respcmd, le16_to_cpu(resp->seqnum), len);
84 lbs_deb_hex(LBS_DEB_CMD, "CMD_RESP", (void *) resp, len);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020085
David Woodhouse6305f492008-03-03 12:20:12 +010086 if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) {
David Woodhousee1258172007-12-11 23:42:49 -050087 lbs_pr_info("Received CMD_RESP with invalid sequence %d (expected %d)\n",
David Woodhouse6305f492008-03-03 12:20:12 +010088 le16_to_cpu(resp->seqnum), le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum));
David Woodhouseaa21c002007-12-08 20:04:36 +000089 spin_unlock_irqrestore(&priv->driver_lock, flags);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -020090 ret = -1;
91 goto done;
92 }
David Woodhousee1258172007-12-11 23:42:49 -050093 if (respcmd != CMD_RET(curcmd) &&
Sebastian Siewior5f0547c2008-03-06 10:30:21 +010094 respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) {
David Woodhousee1258172007-12-11 23:42:49 -050095 lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd);
96 spin_unlock_irqrestore(&priv->driver_lock, flags);
97 ret = -1;
98 goto done;
99 }
100
David Woodhouse85388232007-12-17 15:41:30 -0500101 if (resp->result == cpu_to_le16(0x0004)) {
102 /* 0x0004 means -EAGAIN. Drop the response, let it time out
103 and be resubmitted */
104 lbs_pr_info("Firmware returns DEFER to command %x. Will let it time out...\n",
105 le16_to_cpu(resp->command));
106 spin_unlock_irqrestore(&priv->driver_lock, flags);
107 ret = -1;
108 goto done;
109 }
110
David Woodhousee1258172007-12-11 23:42:49 -0500111 /* Now we got response from FW, cancel the command timer */
112 del_timer(&priv->command_timer);
David Woodhouse2a345092007-12-15 19:33:43 -0500113 priv->cmd_timed_out = 0;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200114
115 /* Store the response code to cur_cmd_retcode. */
David Woodhouseaa21c002007-12-08 20:04:36 +0000116 priv->cur_cmd_retcode = result;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200117
Holger Schurig6b63cd02007-08-02 11:53:36 -0400118 if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) {
David Woodhouse38bfab12007-12-16 23:26:54 -0500119 struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1];
David Woodhouse981f1872007-05-25 23:36:54 -0400120 u16 action = le16_to_cpu(psmode->action);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200121
Holger Schuriga6c87002007-08-02 11:54:10 -0400122 lbs_deb_host(
123 "CMD_RESP: PS_MODE cmd reply result 0x%x, action 0x%x\n",
David Woodhouse981f1872007-05-25 23:36:54 -0400124 result, action);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200125
126 if (result) {
Holger Schuriga6c87002007-08-02 11:54:10 -0400127 lbs_deb_host("CMD_RESP: PS command failed with 0x%x\n",
David Woodhouse981f1872007-05-25 23:36:54 -0400128 result);
129 /*
130 * We should not re-try enter-ps command in
131 * ad-hoc mode. It takes place in
Holger Schurig10078322007-11-15 18:05:47 -0500132 * lbs_execute_next_command().
David Woodhouse981f1872007-05-25 23:36:54 -0400133 */
Kiran Divekare86dc1c2010-06-14 22:01:26 +0530134 if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR &&
Dan Williams0aef64d2007-08-02 11:31:18 -0400135 action == CMD_SUBCMD_ENTER_PS)
David Woodhouseaa21c002007-12-08 20:04:36 +0000136 priv->psmode = LBS802_11POWERMODECAM;
Dan Williams0aef64d2007-08-02 11:31:18 -0400137 } else if (action == CMD_SUBCMD_ENTER_PS) {
David Woodhouseaa21c002007-12-08 20:04:36 +0000138 priv->needtowakeup = 0;
139 priv->psstate = PS_STATE_AWAKE;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200140
Holger Schuriga6c87002007-08-02 11:54:10 -0400141 lbs_deb_host("CMD_RESP: ENTER_PS command response\n");
David Woodhouseaa21c002007-12-08 20:04:36 +0000142 if (priv->connect_status != LBS_CONNECTED) {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200143 /*
144 * When Deauth Event received before Enter_PS command
145 * response, We need to wake up the firmware.
146 */
Holger Schuriga6c87002007-08-02 11:54:10 -0400147 lbs_deb_host(
Holger Schurig10078322007-11-15 18:05:47 -0500148 "disconnected, invoking lbs_ps_wakeup\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200149
David Woodhouseaa21c002007-12-08 20:04:36 +0000150 spin_unlock_irqrestore(&priv->driver_lock, flags);
151 mutex_unlock(&priv->lock);
Holger Schurig10078322007-11-15 18:05:47 -0500152 lbs_ps_wakeup(priv, 0);
David Woodhouseaa21c002007-12-08 20:04:36 +0000153 mutex_lock(&priv->lock);
154 spin_lock_irqsave(&priv->driver_lock, flags);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200155 }
Dan Williams0aef64d2007-08-02 11:31:18 -0400156 } else if (action == CMD_SUBCMD_EXIT_PS) {
David Woodhouseaa21c002007-12-08 20:04:36 +0000157 priv->needtowakeup = 0;
158 priv->psstate = PS_STATE_FULL_POWER;
Holger Schuriga6c87002007-08-02 11:54:10 -0400159 lbs_deb_host("CMD_RESP: EXIT_PS command response\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200160 } else {
Holger Schuriga6c87002007-08-02 11:54:10 -0400161 lbs_deb_host("CMD_RESP: PS action 0x%X\n", action);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200162 }
163
David Woodhouse183aeac2007-12-15 01:52:54 -0500164 lbs_complete_command(priv, priv->cur_cmd, result);
David Woodhouseaa21c002007-12-08 20:04:36 +0000165 spin_unlock_irqrestore(&priv->driver_lock, flags);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200166
167 ret = 0;
168 goto done;
169 }
170
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200171 /* If the command is not successful, cleanup and return failure */
172 if ((result != 0 || !(respcmd & 0x8000))) {
Holger Schuriga6c87002007-08-02 11:54:10 -0400173 lbs_deb_host("CMD_RESP: error 0x%04x in command reply 0x%04x\n",
174 result, respcmd);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200175 /*
176 * Handling errors here
177 */
178 switch (respcmd) {
Holger Schurig6b63cd02007-08-02 11:53:36 -0400179 case CMD_RET(CMD_GET_HW_SPEC):
180 case CMD_RET(CMD_802_11_RESET):
Holger Schuriga6c87002007-08-02 11:54:10 -0400181 lbs_deb_host("CMD_RESP: reset failed\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200182 break;
183
184 }
David Woodhouse183aeac2007-12-15 01:52:54 -0500185 lbs_complete_command(priv, priv->cur_cmd, result);
David Woodhouseaa21c002007-12-08 20:04:36 +0000186 spin_unlock_irqrestore(&priv->driver_lock, flags);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200187
188 ret = -1;
189 goto done;
190 }
191
David Woodhouseaa21c002007-12-08 20:04:36 +0000192 spin_unlock_irqrestore(&priv->driver_lock, flags);
David Woodhouse17230472007-12-07 15:13:05 +0000193
Dan Williams7ad994d2007-12-11 12:33:30 -0500194 if (priv->cur_cmd && priv->cur_cmd->callback) {
195 ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg,
Dan Williamsddac4522007-12-11 13:49:39 -0500196 resp);
Dan Williams81961122010-07-27 13:05:16 -0700197 }
David Woodhouse17230472007-12-07 15:13:05 +0000198
David Woodhouseaa21c002007-12-08 20:04:36 +0000199 spin_lock_irqsave(&priv->driver_lock, flags);
David Woodhouse17230472007-12-07 15:13:05 +0000200
David Woodhouseaa21c002007-12-08 20:04:36 +0000201 if (priv->cur_cmd) {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200202 /* Clean up and Put current command back to cmdfreeq */
David Woodhouse183aeac2007-12-15 01:52:54 -0500203 lbs_complete_command(priv, priv->cur_cmd, result);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200204 }
David Woodhouseaa21c002007-12-08 20:04:36 +0000205 spin_unlock_irqrestore(&priv->driver_lock, flags);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200206
207done:
David Woodhouseaa21c002007-12-08 20:04:36 +0000208 mutex_unlock(&priv->lock);
Holger Schuriga6c87002007-08-02 11:54:10 -0400209 lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200210 return ret;
211}
212
Holger Schurig7919b892008-04-01 14:50:43 +0200213int lbs_process_event(struct lbs_private *priv, u32 event)
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200214{
215 int ret = 0;
Amitkumar Karwar66fceb62010-05-19 03:24:38 -0700216 struct cmd_header cmd;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200217
Holger Schurig9556d212007-08-02 13:14:07 -0400218 lbs_deb_enter(LBS_DEB_CMD);
219
Holger Schurig7919b892008-04-01 14:50:43 +0200220 switch (event) {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200221 case MACREG_INT_CODE_LINK_SENSED:
Holger Schurigd4ff0ef2008-03-19 14:25:18 +0100222 lbs_deb_cmd("EVENT: link sensed\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200223 break;
224
225 case MACREG_INT_CODE_DEAUTHENTICATED:
Holger Schuriga6c87002007-08-02 11:54:10 -0400226 lbs_deb_cmd("EVENT: deauthenticated\n");
Holger Schurig10078322007-11-15 18:05:47 -0500227 lbs_mac_event_disconnected(priv);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200228 break;
229
230 case MACREG_INT_CODE_DISASSOCIATED:
Holger Schuriga6c87002007-08-02 11:54:10 -0400231 lbs_deb_cmd("EVENT: disassociated\n");
Holger Schurig10078322007-11-15 18:05:47 -0500232 lbs_mac_event_disconnected(priv);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200233 break;
234
Holger Schurig0b3c07f2007-11-28 09:15:11 +0100235 case MACREG_INT_CODE_LINK_LOST_NO_SCAN:
Holger Schuriga6c87002007-08-02 11:54:10 -0400236 lbs_deb_cmd("EVENT: link lost\n");
Holger Schurig10078322007-11-15 18:05:47 -0500237 lbs_mac_event_disconnected(priv);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200238 break;
239
240 case MACREG_INT_CODE_PS_SLEEP:
Holger Schurigd4ff0ef2008-03-19 14:25:18 +0100241 lbs_deb_cmd("EVENT: ps sleep\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200242
243 /* handle unexpected PS SLEEP event */
David Woodhouseaa21c002007-12-08 20:04:36 +0000244 if (priv->psstate == PS_STATE_FULL_POWER) {
Holger Schurig9012b282007-05-25 11:27:16 -0400245 lbs_deb_cmd(
Holger Schuriga6c87002007-08-02 11:54:10 -0400246 "EVENT: in FULL POWER mode, ignoreing PS_SLEEP\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200247 break;
248 }
David Woodhouseaa21c002007-12-08 20:04:36 +0000249 priv->psstate = PS_STATE_PRE_SLEEP;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200250
Holger Schurigd4ff0ef2008-03-19 14:25:18 +0100251 lbs_ps_confirm_sleep(priv);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200252
253 break;
254
David Woodhouseb47ef242007-12-17 13:26:42 -0500255 case MACREG_INT_CODE_HOST_AWAKE:
Holger Schurigd4ff0ef2008-03-19 14:25:18 +0100256 lbs_deb_cmd("EVENT: host awake\n");
Amitkumar Karwar49125452009-09-30 20:04:38 -0700257 if (priv->reset_deep_sleep_wakeup)
258 priv->reset_deep_sleep_wakeup(priv);
259 priv->is_deep_sleep = 0;
Amitkumar Karwar66fceb62010-05-19 03:24:38 -0700260 lbs_cmd_async(priv, CMD_802_11_WAKEUP_CONFIRM, &cmd,
261 sizeof(cmd));
262 priv->is_host_sleep_activated = 0;
263 wake_up_interruptible(&priv->host_sleep_q);
David Woodhouseb47ef242007-12-17 13:26:42 -0500264 break;
265
Amitkumar Karwar49125452009-09-30 20:04:38 -0700266 case MACREG_INT_CODE_DEEP_SLEEP_AWAKE:
267 if (priv->reset_deep_sleep_wakeup)
268 priv->reset_deep_sleep_wakeup(priv);
269 lbs_deb_cmd("EVENT: ds awake\n");
270 priv->is_deep_sleep = 0;
271 priv->wakeup_dev_required = 0;
272 wake_up_interruptible(&priv->ds_awake_q);
273 break;
274
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200275 case MACREG_INT_CODE_PS_AWAKE:
Holger Schurigd4ff0ef2008-03-19 14:25:18 +0100276 lbs_deb_cmd("EVENT: ps awake\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200277 /* handle unexpected PS AWAKE event */
David Woodhouseaa21c002007-12-08 20:04:36 +0000278 if (priv->psstate == PS_STATE_FULL_POWER) {
Holger Schurig9012b282007-05-25 11:27:16 -0400279 lbs_deb_cmd(
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200280 "EVENT: In FULL POWER mode - ignore PS AWAKE\n");
281 break;
282 }
283
David Woodhouseaa21c002007-12-08 20:04:36 +0000284 priv->psstate = PS_STATE_AWAKE;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200285
David Woodhouseaa21c002007-12-08 20:04:36 +0000286 if (priv->needtowakeup) {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200287 /*
288 * wait for the command processing to finish
289 * before resuming sending
David Woodhouseaa21c002007-12-08 20:04:36 +0000290 * priv->needtowakeup will be set to FALSE
Holger Schurig10078322007-11-15 18:05:47 -0500291 * in lbs_ps_wakeup()
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200292 */
Holger Schuriga6c87002007-08-02 11:54:10 -0400293 lbs_deb_cmd("waking up ...\n");
Holger Schurig10078322007-11-15 18:05:47 -0500294 lbs_ps_wakeup(priv, 0);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200295 }
296 break;
297
298 case MACREG_INT_CODE_MIC_ERR_UNICAST:
Holger Schurig9012b282007-05-25 11:27:16 -0400299 lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n");
Holger Schurig560c6332009-10-22 15:30:57 +0200300 lbs_send_mic_failureevent(priv, event);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200301 break;
302
303 case MACREG_INT_CODE_MIC_ERR_MULTICAST:
Holger Schurig9012b282007-05-25 11:27:16 -0400304 lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
Holger Schurig560c6332009-10-22 15:30:57 +0200305 lbs_send_mic_failureevent(priv, event);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200306 break;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200307
Holger Schurigd4ff0ef2008-03-19 14:25:18 +0100308 case MACREG_INT_CODE_MIB_CHANGED:
309 lbs_deb_cmd("EVENT: MIB CHANGED\n");
310 break;
311 case MACREG_INT_CODE_INIT_DONE:
312 lbs_deb_cmd("EVENT: INIT DONE\n");
313 break;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200314 case MACREG_INT_CODE_ADHOC_BCN_LOST:
Holger Schuriga6c87002007-08-02 11:54:10 -0400315 lbs_deb_cmd("EVENT: ADHOC beacon lost\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200316 break;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200317 case MACREG_INT_CODE_RSSI_LOW:
Holger Schuriga6c87002007-08-02 11:54:10 -0400318 lbs_pr_alert("EVENT: rssi low\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200319 break;
320 case MACREG_INT_CODE_SNR_LOW:
Holger Schuriga6c87002007-08-02 11:54:10 -0400321 lbs_pr_alert("EVENT: snr low\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200322 break;
323 case MACREG_INT_CODE_MAX_FAIL:
Holger Schuriga6c87002007-08-02 11:54:10 -0400324 lbs_pr_alert("EVENT: max fail\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200325 break;
326 case MACREG_INT_CODE_RSSI_HIGH:
Holger Schuriga6c87002007-08-02 11:54:10 -0400327 lbs_pr_alert("EVENT: rssi high\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200328 break;
329 case MACREG_INT_CODE_SNR_HIGH:
Holger Schuriga6c87002007-08-02 11:54:10 -0400330 lbs_pr_alert("EVENT: snr high\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200331 break;
332
Luis Carlos Cobo Rus7d8d28b2007-05-25 23:12:19 -0400333 case MACREG_INT_CODE_MESH_AUTO_STARTED:
Holger Schurigd6ede672009-12-02 15:25:57 +0100334 /* Ignore spurious autostart events */
335 lbs_pr_info("EVENT: MESH_AUTO_STARTED (ignoring)\n");
Luis Carlos Cobo Rus7d8d28b2007-05-25 23:12:19 -0400336 break;
337
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200338 default:
Holger Schurig7919b892008-04-01 14:50:43 +0200339 lbs_pr_alert("EVENT: unknown event id %d\n", event);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200340 break;
341 }
342
Holger Schurig9556d212007-08-02 13:14:07 -0400343 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200344 return ret;
345}