blob: 5e95da9dcc2e2c99064d26d07264e06c1a272cfd [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 Schurig634b8f492007-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");
Dan Williams0bb64082010-07-27 13:08:08 -070052 lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, false);
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 Siewior5f0547c22008-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
Holger Schurig6b63cd02007-08-02 11:53:36 -0400115 if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) {
David Woodhouse38bfab12007-12-16 23:26:54 -0500116 struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1];
David Woodhouse981f1872007-05-25 23:36:54 -0400117 u16 action = le16_to_cpu(psmode->action);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200118
Holger Schuriga6c87002007-08-02 11:54:10 -0400119 lbs_deb_host(
120 "CMD_RESP: PS_MODE cmd reply result 0x%x, action 0x%x\n",
David Woodhouse981f1872007-05-25 23:36:54 -0400121 result, action);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200122
123 if (result) {
Holger Schuriga6c87002007-08-02 11:54:10 -0400124 lbs_deb_host("CMD_RESP: PS command failed with 0x%x\n",
David Woodhouse981f1872007-05-25 23:36:54 -0400125 result);
126 /*
127 * We should not re-try enter-ps command in
128 * ad-hoc mode. It takes place in
Holger Schurig10078322007-11-15 18:05:47 -0500129 * lbs_execute_next_command().
David Woodhouse981f1872007-05-25 23:36:54 -0400130 */
Kiran Divekare86dc1c2010-06-14 22:01:26 +0530131 if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR &&
Dan Williams0bb64082010-07-27 13:08:08 -0700132 action == PS_MODE_ACTION_ENTER_PS)
David Woodhouseaa21c002007-12-08 20:04:36 +0000133 priv->psmode = LBS802_11POWERMODECAM;
Dan Williams0bb64082010-07-27 13:08:08 -0700134 } else if (action == PS_MODE_ACTION_ENTER_PS) {
David Woodhouseaa21c002007-12-08 20:04:36 +0000135 priv->needtowakeup = 0;
136 priv->psstate = PS_STATE_AWAKE;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200137
Holger Schuriga6c87002007-08-02 11:54:10 -0400138 lbs_deb_host("CMD_RESP: ENTER_PS command response\n");
David Woodhouseaa21c002007-12-08 20:04:36 +0000139 if (priv->connect_status != LBS_CONNECTED) {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200140 /*
141 * When Deauth Event received before Enter_PS command
142 * response, We need to wake up the firmware.
143 */
Holger Schuriga6c87002007-08-02 11:54:10 -0400144 lbs_deb_host(
Holger Schurig10078322007-11-15 18:05:47 -0500145 "disconnected, invoking lbs_ps_wakeup\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200146
David Woodhouseaa21c002007-12-08 20:04:36 +0000147 spin_unlock_irqrestore(&priv->driver_lock, flags);
148 mutex_unlock(&priv->lock);
Dan Williams0bb64082010-07-27 13:08:08 -0700149 lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS,
150 false);
David Woodhouseaa21c002007-12-08 20:04:36 +0000151 mutex_lock(&priv->lock);
152 spin_lock_irqsave(&priv->driver_lock, flags);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200153 }
Dan Williams0bb64082010-07-27 13:08:08 -0700154 } else if (action == PS_MODE_ACTION_EXIT_PS) {
David Woodhouseaa21c002007-12-08 20:04:36 +0000155 priv->needtowakeup = 0;
156 priv->psstate = PS_STATE_FULL_POWER;
Holger Schuriga6c87002007-08-02 11:54:10 -0400157 lbs_deb_host("CMD_RESP: EXIT_PS command response\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200158 } else {
Holger Schuriga6c87002007-08-02 11:54:10 -0400159 lbs_deb_host("CMD_RESP: PS action 0x%X\n", action);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200160 }
161
David Woodhouse183aeac2007-12-15 01:52:54 -0500162 lbs_complete_command(priv, priv->cur_cmd, result);
David Woodhouseaa21c002007-12-08 20:04:36 +0000163 spin_unlock_irqrestore(&priv->driver_lock, flags);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200164
165 ret = 0;
166 goto done;
167 }
168
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200169 /* If the command is not successful, cleanup and return failure */
170 if ((result != 0 || !(respcmd & 0x8000))) {
Holger Schuriga6c87002007-08-02 11:54:10 -0400171 lbs_deb_host("CMD_RESP: error 0x%04x in command reply 0x%04x\n",
172 result, respcmd);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200173 /*
174 * Handling errors here
175 */
176 switch (respcmd) {
Holger Schurig6b63cd02007-08-02 11:53:36 -0400177 case CMD_RET(CMD_GET_HW_SPEC):
178 case CMD_RET(CMD_802_11_RESET):
Holger Schuriga6c87002007-08-02 11:54:10 -0400179 lbs_deb_host("CMD_RESP: reset failed\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200180 break;
181
182 }
David Woodhouse183aeac2007-12-15 01:52:54 -0500183 lbs_complete_command(priv, priv->cur_cmd, result);
David Woodhouseaa21c002007-12-08 20:04:36 +0000184 spin_unlock_irqrestore(&priv->driver_lock, flags);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200185
186 ret = -1;
187 goto done;
188 }
189
David Woodhouseaa21c002007-12-08 20:04:36 +0000190 spin_unlock_irqrestore(&priv->driver_lock, flags);
David Woodhouse17230472007-12-07 15:13:05 +0000191
Dan Williams7ad994d2007-12-11 12:33:30 -0500192 if (priv->cur_cmd && priv->cur_cmd->callback) {
193 ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg,
Dan Williamsddac4522007-12-11 13:49:39 -0500194 resp);
Dan Williams81961122010-07-27 13:05:16 -0700195 }
David Woodhouse17230472007-12-07 15:13:05 +0000196
David Woodhouseaa21c002007-12-08 20:04:36 +0000197 spin_lock_irqsave(&priv->driver_lock, flags);
David Woodhouse17230472007-12-07 15:13:05 +0000198
David Woodhouseaa21c002007-12-08 20:04:36 +0000199 if (priv->cur_cmd) {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200200 /* Clean up and Put current command back to cmdfreeq */
David Woodhouse183aeac2007-12-15 01:52:54 -0500201 lbs_complete_command(priv, priv->cur_cmd, result);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200202 }
David Woodhouseaa21c002007-12-08 20:04:36 +0000203 spin_unlock_irqrestore(&priv->driver_lock, flags);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200204
205done:
David Woodhouseaa21c002007-12-08 20:04:36 +0000206 mutex_unlock(&priv->lock);
Holger Schuriga6c87002007-08-02 11:54:10 -0400207 lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200208 return ret;
209}
210
Holger Schurig7919b892008-04-01 14:50:43 +0200211int lbs_process_event(struct lbs_private *priv, u32 event)
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200212{
213 int ret = 0;
Amitkumar Karwar66fceb62010-05-19 03:24:38 -0700214 struct cmd_header cmd;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200215
Holger Schurig9556d212007-08-02 13:14:07 -0400216 lbs_deb_enter(LBS_DEB_CMD);
217
Holger Schurig7919b892008-04-01 14:50:43 +0200218 switch (event) {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200219 case MACREG_INT_CODE_LINK_SENSED:
Holger Schurigd4ff0ef2008-03-19 14:25:18 +0100220 lbs_deb_cmd("EVENT: link sensed\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200221 break;
222
223 case MACREG_INT_CODE_DEAUTHENTICATED:
Holger Schuriga6c87002007-08-02 11:54:10 -0400224 lbs_deb_cmd("EVENT: deauthenticated\n");
Holger Schurig10078322007-11-15 18:05:47 -0500225 lbs_mac_event_disconnected(priv);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200226 break;
227
228 case MACREG_INT_CODE_DISASSOCIATED:
Holger Schuriga6c87002007-08-02 11:54:10 -0400229 lbs_deb_cmd("EVENT: disassociated\n");
Holger Schurig10078322007-11-15 18:05:47 -0500230 lbs_mac_event_disconnected(priv);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200231 break;
232
Holger Schurig0b3c07f2007-11-28 09:15:11 +0100233 case MACREG_INT_CODE_LINK_LOST_NO_SCAN:
Holger Schuriga6c87002007-08-02 11:54:10 -0400234 lbs_deb_cmd("EVENT: link lost\n");
Holger Schurig10078322007-11-15 18:05:47 -0500235 lbs_mac_event_disconnected(priv);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200236 break;
237
238 case MACREG_INT_CODE_PS_SLEEP:
Holger Schurigd4ff0ef2008-03-19 14:25:18 +0100239 lbs_deb_cmd("EVENT: ps sleep\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200240
241 /* handle unexpected PS SLEEP event */
David Woodhouseaa21c002007-12-08 20:04:36 +0000242 if (priv->psstate == PS_STATE_FULL_POWER) {
Holger Schurig9012b282007-05-25 11:27:16 -0400243 lbs_deb_cmd(
Holger Schuriga6c87002007-08-02 11:54:10 -0400244 "EVENT: in FULL POWER mode, ignoreing PS_SLEEP\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200245 break;
246 }
David Woodhouseaa21c002007-12-08 20:04:36 +0000247 priv->psstate = PS_STATE_PRE_SLEEP;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200248
Holger Schurigd4ff0ef2008-03-19 14:25:18 +0100249 lbs_ps_confirm_sleep(priv);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200250
251 break;
252
David Woodhouseb47ef242007-12-17 13:26:42 -0500253 case MACREG_INT_CODE_HOST_AWAKE:
Holger Schurigd4ff0ef2008-03-19 14:25:18 +0100254 lbs_deb_cmd("EVENT: host awake\n");
Amitkumar Karwar49125452009-09-30 20:04:38 -0700255 if (priv->reset_deep_sleep_wakeup)
256 priv->reset_deep_sleep_wakeup(priv);
257 priv->is_deep_sleep = 0;
Amitkumar Karwar66fceb62010-05-19 03:24:38 -0700258 lbs_cmd_async(priv, CMD_802_11_WAKEUP_CONFIRM, &cmd,
259 sizeof(cmd));
260 priv->is_host_sleep_activated = 0;
261 wake_up_interruptible(&priv->host_sleep_q);
David Woodhouseb47ef242007-12-17 13:26:42 -0500262 break;
263
Amitkumar Karwar49125452009-09-30 20:04:38 -0700264 case MACREG_INT_CODE_DEEP_SLEEP_AWAKE:
265 if (priv->reset_deep_sleep_wakeup)
266 priv->reset_deep_sleep_wakeup(priv);
267 lbs_deb_cmd("EVENT: ds awake\n");
268 priv->is_deep_sleep = 0;
269 priv->wakeup_dev_required = 0;
270 wake_up_interruptible(&priv->ds_awake_q);
271 break;
272
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200273 case MACREG_INT_CODE_PS_AWAKE:
Holger Schurigd4ff0ef2008-03-19 14:25:18 +0100274 lbs_deb_cmd("EVENT: ps awake\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200275 /* handle unexpected PS AWAKE event */
David Woodhouseaa21c002007-12-08 20:04:36 +0000276 if (priv->psstate == PS_STATE_FULL_POWER) {
Holger Schurig9012b282007-05-25 11:27:16 -0400277 lbs_deb_cmd(
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200278 "EVENT: In FULL POWER mode - ignore PS AWAKE\n");
279 break;
280 }
281
David Woodhouseaa21c002007-12-08 20:04:36 +0000282 priv->psstate = PS_STATE_AWAKE;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200283
David Woodhouseaa21c002007-12-08 20:04:36 +0000284 if (priv->needtowakeup) {
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200285 /*
286 * wait for the command processing to finish
287 * before resuming sending
David Woodhouseaa21c002007-12-08 20:04:36 +0000288 * priv->needtowakeup will be set to FALSE
Holger Schurig10078322007-11-15 18:05:47 -0500289 * in lbs_ps_wakeup()
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200290 */
Holger Schuriga6c87002007-08-02 11:54:10 -0400291 lbs_deb_cmd("waking up ...\n");
Dan Williams0bb64082010-07-27 13:08:08 -0700292 lbs_set_ps_mode(priv, PS_MODE_ACTION_EXIT_PS, false);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200293 }
294 break;
295
296 case MACREG_INT_CODE_MIC_ERR_UNICAST:
Holger Schurig9012b282007-05-25 11:27:16 -0400297 lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n");
Holger Schurig560c6332009-10-22 15:30:57 +0200298 lbs_send_mic_failureevent(priv, event);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200299 break;
300
301 case MACREG_INT_CODE_MIC_ERR_MULTICAST:
Holger Schurig9012b282007-05-25 11:27:16 -0400302 lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
Holger Schurig560c6332009-10-22 15:30:57 +0200303 lbs_send_mic_failureevent(priv, event);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200304 break;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200305
Holger Schurigd4ff0ef2008-03-19 14:25:18 +0100306 case MACREG_INT_CODE_MIB_CHANGED:
307 lbs_deb_cmd("EVENT: MIB CHANGED\n");
308 break;
309 case MACREG_INT_CODE_INIT_DONE:
310 lbs_deb_cmd("EVENT: INIT DONE\n");
311 break;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200312 case MACREG_INT_CODE_ADHOC_BCN_LOST:
Holger Schuriga6c87002007-08-02 11:54:10 -0400313 lbs_deb_cmd("EVENT: ADHOC beacon lost\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200314 break;
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200315 case MACREG_INT_CODE_RSSI_LOW:
Holger Schuriga6c87002007-08-02 11:54:10 -0400316 lbs_pr_alert("EVENT: rssi low\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200317 break;
318 case MACREG_INT_CODE_SNR_LOW:
Holger Schuriga6c87002007-08-02 11:54:10 -0400319 lbs_pr_alert("EVENT: snr low\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200320 break;
321 case MACREG_INT_CODE_MAX_FAIL:
Holger Schuriga6c87002007-08-02 11:54:10 -0400322 lbs_pr_alert("EVENT: max fail\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200323 break;
324 case MACREG_INT_CODE_RSSI_HIGH:
Holger Schuriga6c87002007-08-02 11:54:10 -0400325 lbs_pr_alert("EVENT: rssi high\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200326 break;
327 case MACREG_INT_CODE_SNR_HIGH:
Holger Schuriga6c87002007-08-02 11:54:10 -0400328 lbs_pr_alert("EVENT: snr high\n");
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200329 break;
330
Luis Carlos Cobo Rus7d8d28b2007-05-25 23:12:19 -0400331 case MACREG_INT_CODE_MESH_AUTO_STARTED:
Holger Schurigd6ede672009-12-02 15:25:57 +0100332 /* Ignore spurious autostart events */
333 lbs_pr_info("EVENT: MESH_AUTO_STARTED (ignoring)\n");
Luis Carlos Cobo Rus7d8d28b2007-05-25 23:12:19 -0400334 break;
335
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200336 default:
Holger Schurig7919b892008-04-01 14:50:43 +0200337 lbs_pr_alert("EVENT: unknown event id %d\n", event);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200338 break;
339 }
340
Holger Schurig9556d212007-08-02 13:14:07 -0400341 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
Marcelo Tosatti876c9d32007-02-10 12:25:27 -0200342 return ret;
343}