libertas: change IW_ESSID_MAX_SIZE -> IEEE80211_MAX_SSID_LEN
[linux-3.10.git] / drivers / net / wireless / libertas / cmdresp.c
1 /**
2   * This file contains the handling of command
3   * responses as well as events generated by firmware.
4   */
5 #include <linux/delay.h>
6 #include <linux/sched.h>
7 #include <linux/if_arp.h>
8 #include <linux/netdevice.h>
9 #include <asm/unaligned.h>
10 #include <net/iw_handler.h>
11
12 #include "host.h"
13 #include "decl.h"
14 #include "cmd.h"
15 #include "defs.h"
16 #include "dev.h"
17 #include "assoc.h"
18 #include "wext.h"
19
20 /**
21  *  @brief This function handles disconnect event. it
22  *  reports disconnect to upper layer, clean tx/rx packets,
23  *  reset link state etc.
24  *
25  *  @param priv    A pointer to struct lbs_private structure
26  *  @return        n/a
27  */
28 void lbs_mac_event_disconnected(struct lbs_private *priv)
29 {
30         union iwreq_data wrqu;
31
32         if (priv->connect_status != LBS_CONNECTED)
33                 return;
34
35         lbs_deb_enter(LBS_DEB_ASSOC);
36
37         memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
38         wrqu.ap_addr.sa_family = ARPHRD_ETHER;
39
40         /*
41          * Cisco AP sends EAP failure and de-auth in less than 0.5 ms.
42          * It causes problem in the Supplicant
43          */
44
45         msleep_interruptible(1000);
46         wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
47
48         /* report disconnect to upper layer */
49         netif_stop_queue(priv->dev);
50         netif_carrier_off(priv->dev);
51
52         /* Free Tx and Rx packets */
53         kfree_skb(priv->currenttxskb);
54         priv->currenttxskb = NULL;
55         priv->tx_pending_len = 0;
56
57         /* reset SNR/NF/RSSI values */
58         memset(priv->SNR, 0x00, sizeof(priv->SNR));
59         memset(priv->NF, 0x00, sizeof(priv->NF));
60         memset(priv->RSSI, 0x00, sizeof(priv->RSSI));
61         memset(priv->rawSNR, 0x00, sizeof(priv->rawSNR));
62         memset(priv->rawNF, 0x00, sizeof(priv->rawNF));
63         priv->nextSNRNF = 0;
64         priv->numSNRNF = 0;
65         priv->connect_status = LBS_DISCONNECTED;
66
67         /* Clear out associated SSID and BSSID since connection is
68          * no longer valid.
69          */
70         memset(&priv->curbssparams.bssid, 0, ETH_ALEN);
71         memset(&priv->curbssparams.ssid, 0, IEEE80211_MAX_SSID_LEN);
72         priv->curbssparams.ssid_len = 0;
73
74         if (priv->psstate != PS_STATE_FULL_POWER) {
75                 /* make firmware to exit PS mode */
76                 lbs_deb_cmd("disconnected, so exit PS mode\n");
77                 lbs_ps_wakeup(priv, 0);
78         }
79         lbs_deb_leave(LBS_DEB_ASSOC);
80 }
81
82 /**
83  *  @brief This function handles MIC failure event.
84  *
85  *  @param priv    A pointer to struct lbs_private structure
86  *  @para  event   the event id
87  *  @return        n/a
88  */
89 static void handle_mic_failureevent(struct lbs_private *priv, u32 event)
90 {
91         char buf[50];
92
93         lbs_deb_enter(LBS_DEB_CMD);
94         memset(buf, 0, sizeof(buf));
95
96         sprintf(buf, "%s", "MLME-MICHAELMICFAILURE.indication ");
97
98         if (event == MACREG_INT_CODE_MIC_ERR_UNICAST) {
99                 strcat(buf, "unicast ");
100         } else {
101                 strcat(buf, "multicast ");
102         }
103
104         lbs_send_iwevcustom_event(priv, buf);
105         lbs_deb_leave(LBS_DEB_CMD);
106 }
107
108 static int lbs_ret_reg_access(struct lbs_private *priv,
109                                u16 type, struct cmd_ds_command *resp)
110 {
111         int ret = 0;
112
113         lbs_deb_enter(LBS_DEB_CMD);
114
115         switch (type) {
116         case CMD_RET(CMD_MAC_REG_ACCESS):
117                 {
118                         struct cmd_ds_mac_reg_access *reg = &resp->params.macreg;
119
120                         priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
121                         priv->offsetvalue.value = le32_to_cpu(reg->value);
122                         break;
123                 }
124
125         case CMD_RET(CMD_BBP_REG_ACCESS):
126                 {
127                         struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg;
128
129                         priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
130                         priv->offsetvalue.value = reg->value;
131                         break;
132                 }
133
134         case CMD_RET(CMD_RF_REG_ACCESS):
135                 {
136                         struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg;
137
138                         priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
139                         priv->offsetvalue.value = reg->value;
140                         break;
141                 }
142
143         default:
144                 ret = -1;
145         }
146
147         lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
148         return ret;
149 }
150
151 static int lbs_ret_802_11_rssi(struct lbs_private *priv,
152                                 struct cmd_ds_command *resp)
153 {
154         struct cmd_ds_802_11_rssi_rsp *rssirsp = &resp->params.rssirsp;
155
156         lbs_deb_enter(LBS_DEB_CMD);
157
158         /* store the non average value */
159         priv->SNR[TYPE_BEACON][TYPE_NOAVG] = get_unaligned_le16(&rssirsp->SNR);
160         priv->NF[TYPE_BEACON][TYPE_NOAVG] = get_unaligned_le16(&rssirsp->noisefloor);
161
162         priv->SNR[TYPE_BEACON][TYPE_AVG] = get_unaligned_le16(&rssirsp->avgSNR);
163         priv->NF[TYPE_BEACON][TYPE_AVG] = get_unaligned_le16(&rssirsp->avgnoisefloor);
164
165         priv->RSSI[TYPE_BEACON][TYPE_NOAVG] =
166             CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG],
167                      priv->NF[TYPE_BEACON][TYPE_NOAVG]);
168
169         priv->RSSI[TYPE_BEACON][TYPE_AVG] =
170             CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE,
171                      priv->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE);
172
173         lbs_deb_cmd("RSSI: beacon %d, avg %d\n",
174                priv->RSSI[TYPE_BEACON][TYPE_NOAVG],
175                priv->RSSI[TYPE_BEACON][TYPE_AVG]);
176
177         lbs_deb_leave(LBS_DEB_CMD);
178         return 0;
179 }
180
181 static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
182                                         struct cmd_ds_command *resp)
183 {
184         struct cmd_ds_802_11_beacon_control *bcn_ctrl =
185             &resp->params.bcn_ctrl;
186
187         lbs_deb_enter(LBS_DEB_CMD);
188
189         if (bcn_ctrl->action == CMD_ACT_GET) {
190                 priv->beacon_enable = (u8) le16_to_cpu(bcn_ctrl->beacon_enable);
191                 priv->beacon_period = le16_to_cpu(bcn_ctrl->beacon_period);
192         }
193
194         lbs_deb_enter(LBS_DEB_CMD);
195         return 0;
196 }
197
198 static inline int handle_cmd_response(struct lbs_private *priv,
199                                       struct cmd_header *cmd_response)
200 {
201         struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response;
202         int ret = 0;
203         unsigned long flags;
204         uint16_t respcmd = le16_to_cpu(resp->command);
205
206         lbs_deb_enter(LBS_DEB_HOST);
207
208         switch (respcmd) {
209         case CMD_RET(CMD_MAC_REG_ACCESS):
210         case CMD_RET(CMD_BBP_REG_ACCESS):
211         case CMD_RET(CMD_RF_REG_ACCESS):
212                 ret = lbs_ret_reg_access(priv, respcmd, resp);
213                 break;
214
215         case CMD_RET(CMD_802_11_SET_AFC):
216         case CMD_RET(CMD_802_11_GET_AFC):
217                 spin_lock_irqsave(&priv->driver_lock, flags);
218                 memmove((void *)priv->cur_cmd->callback_arg, &resp->params.afc,
219                         sizeof(struct cmd_ds_802_11_afc));
220                 spin_unlock_irqrestore(&priv->driver_lock, flags);
221
222                 break;
223
224         case CMD_RET(CMD_802_11_BEACON_STOP):
225                 break;
226
227         case CMD_RET(CMD_802_11_RSSI):
228                 ret = lbs_ret_802_11_rssi(priv, resp);
229                 break;
230
231         case CMD_RET(CMD_802_11_TPC_CFG):
232                 spin_lock_irqsave(&priv->driver_lock, flags);
233                 memmove((void *)priv->cur_cmd->callback_arg, &resp->params.tpccfg,
234                         sizeof(struct cmd_ds_802_11_tpc_cfg));
235                 spin_unlock_irqrestore(&priv->driver_lock, flags);
236                 break;
237         case CMD_RET(CMD_802_11_LED_GPIO_CTRL):
238                 spin_lock_irqsave(&priv->driver_lock, flags);
239                 memmove((void *)priv->cur_cmd->callback_arg, &resp->params.ledgpio,
240                         sizeof(struct cmd_ds_802_11_led_ctrl));
241                 spin_unlock_irqrestore(&priv->driver_lock, flags);
242                 break;
243
244         case CMD_RET(CMD_GET_TSF):
245                 spin_lock_irqsave(&priv->driver_lock, flags);
246                 memcpy((void *)priv->cur_cmd->callback_arg,
247                        &resp->params.gettsf.tsfvalue, sizeof(u64));
248                 spin_unlock_irqrestore(&priv->driver_lock, flags);
249                 break;
250         case CMD_RET(CMD_BT_ACCESS):
251                 spin_lock_irqsave(&priv->driver_lock, flags);
252                 if (priv->cur_cmd->callback_arg)
253                         memcpy((void *)priv->cur_cmd->callback_arg,
254                                &resp->params.bt.addr1, 2 * ETH_ALEN);
255                 spin_unlock_irqrestore(&priv->driver_lock, flags);
256                 break;
257         case CMD_RET(CMD_FWT_ACCESS):
258                 spin_lock_irqsave(&priv->driver_lock, flags);
259                 if (priv->cur_cmd->callback_arg)
260                         memcpy((void *)priv->cur_cmd->callback_arg, &resp->params.fwt,
261                                sizeof(resp->params.fwt));
262                 spin_unlock_irqrestore(&priv->driver_lock, flags);
263                 break;
264         case CMD_RET(CMD_802_11_BEACON_CTRL):
265                 ret = lbs_ret_802_11_bcn_ctrl(priv, resp);
266                 break;
267
268         default:
269                 lbs_pr_err("CMD_RESP: unknown cmd response 0x%04x\n",
270                            le16_to_cpu(resp->command));
271                 break;
272         }
273         lbs_deb_leave(LBS_DEB_HOST);
274         return ret;
275 }
276
277 int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)
278 {
279         uint16_t respcmd, curcmd;
280         struct cmd_header *resp;
281         int ret = 0;
282         unsigned long flags;
283         uint16_t result;
284
285         lbs_deb_enter(LBS_DEB_HOST);
286
287         mutex_lock(&priv->lock);
288         spin_lock_irqsave(&priv->driver_lock, flags);
289
290         if (!priv->cur_cmd) {
291                 lbs_deb_host("CMD_RESP: cur_cmd is NULL\n");
292                 ret = -1;
293                 spin_unlock_irqrestore(&priv->driver_lock, flags);
294                 goto done;
295         }
296
297         resp = (void *)data;
298         curcmd = le16_to_cpu(priv->cur_cmd->cmdbuf->command);
299         respcmd = le16_to_cpu(resp->command);
300         result = le16_to_cpu(resp->result);
301
302         lbs_deb_cmd("CMD_RESP: response 0x%04x, seq %d, size %d\n",
303                      respcmd, le16_to_cpu(resp->seqnum), len);
304         lbs_deb_hex(LBS_DEB_CMD, "CMD_RESP", (void *) resp, len);
305
306         if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) {
307                 lbs_pr_info("Received CMD_RESP with invalid sequence %d (expected %d)\n",
308                             le16_to_cpu(resp->seqnum), le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum));
309                 spin_unlock_irqrestore(&priv->driver_lock, flags);
310                 ret = -1;
311                 goto done;
312         }
313         if (respcmd != CMD_RET(curcmd) &&
314             respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) {
315                 lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd);
316                 spin_unlock_irqrestore(&priv->driver_lock, flags);
317                 ret = -1;
318                 goto done;
319         }
320
321         if (resp->result == cpu_to_le16(0x0004)) {
322                 /* 0x0004 means -EAGAIN. Drop the response, let it time out
323                    and be resubmitted */
324                 lbs_pr_info("Firmware returns DEFER to command %x. Will let it time out...\n",
325                             le16_to_cpu(resp->command));
326                 spin_unlock_irqrestore(&priv->driver_lock, flags);
327                 ret = -1;
328                 goto done;
329         }
330
331         /* Now we got response from FW, cancel the command timer */
332         del_timer(&priv->command_timer);
333         priv->cmd_timed_out = 0;
334         if (priv->nr_retries) {
335                 lbs_pr_info("Received result %x to command %x after %d retries\n",
336                             result, curcmd, priv->nr_retries);
337                 priv->nr_retries = 0;
338         }
339
340         /* Store the response code to cur_cmd_retcode. */
341         priv->cur_cmd_retcode = result;
342
343         if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) {
344                 struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1];
345                 u16 action = le16_to_cpu(psmode->action);
346
347                 lbs_deb_host(
348                        "CMD_RESP: PS_MODE cmd reply result 0x%x, action 0x%x\n",
349                        result, action);
350
351                 if (result) {
352                         lbs_deb_host("CMD_RESP: PS command failed with 0x%x\n",
353                                     result);
354                         /*
355                          * We should not re-try enter-ps command in
356                          * ad-hoc mode. It takes place in
357                          * lbs_execute_next_command().
358                          */
359                         if (priv->mode == IW_MODE_ADHOC &&
360                             action == CMD_SUBCMD_ENTER_PS)
361                                 priv->psmode = LBS802_11POWERMODECAM;
362                 } else if (action == CMD_SUBCMD_ENTER_PS) {
363                         priv->needtowakeup = 0;
364                         priv->psstate = PS_STATE_AWAKE;
365
366                         lbs_deb_host("CMD_RESP: ENTER_PS command response\n");
367                         if (priv->connect_status != LBS_CONNECTED) {
368                                 /*
369                                  * When Deauth Event received before Enter_PS command
370                                  * response, We need to wake up the firmware.
371                                  */
372                                 lbs_deb_host(
373                                        "disconnected, invoking lbs_ps_wakeup\n");
374
375                                 spin_unlock_irqrestore(&priv->driver_lock, flags);
376                                 mutex_unlock(&priv->lock);
377                                 lbs_ps_wakeup(priv, 0);
378                                 mutex_lock(&priv->lock);
379                                 spin_lock_irqsave(&priv->driver_lock, flags);
380                         }
381                 } else if (action == CMD_SUBCMD_EXIT_PS) {
382                         priv->needtowakeup = 0;
383                         priv->psstate = PS_STATE_FULL_POWER;
384                         lbs_deb_host("CMD_RESP: EXIT_PS command response\n");
385                 } else {
386                         lbs_deb_host("CMD_RESP: PS action 0x%X\n", action);
387                 }
388
389                 lbs_complete_command(priv, priv->cur_cmd, result);
390                 spin_unlock_irqrestore(&priv->driver_lock, flags);
391
392                 ret = 0;
393                 goto done;
394         }
395
396         /* If the command is not successful, cleanup and return failure */
397         if ((result != 0 || !(respcmd & 0x8000))) {
398                 lbs_deb_host("CMD_RESP: error 0x%04x in command reply 0x%04x\n",
399                        result, respcmd);
400                 /*
401                  * Handling errors here
402                  */
403                 switch (respcmd) {
404                 case CMD_RET(CMD_GET_HW_SPEC):
405                 case CMD_RET(CMD_802_11_RESET):
406                         lbs_deb_host("CMD_RESP: reset failed\n");
407                         break;
408
409                 }
410                 lbs_complete_command(priv, priv->cur_cmd, result);
411                 spin_unlock_irqrestore(&priv->driver_lock, flags);
412
413                 ret = -1;
414                 goto done;
415         }
416
417         spin_unlock_irqrestore(&priv->driver_lock, flags);
418
419         if (priv->cur_cmd && priv->cur_cmd->callback) {
420                 ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg,
421                                 resp);
422         } else
423                 ret = handle_cmd_response(priv, resp);
424
425         spin_lock_irqsave(&priv->driver_lock, flags);
426
427         if (priv->cur_cmd) {
428                 /* Clean up and Put current command back to cmdfreeq */
429                 lbs_complete_command(priv, priv->cur_cmd, result);
430         }
431         spin_unlock_irqrestore(&priv->driver_lock, flags);
432
433 done:
434         mutex_unlock(&priv->lock);
435         lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
436         return ret;
437 }
438
439 static int lbs_send_confirmwake(struct lbs_private *priv)
440 {
441         struct cmd_header cmd;
442         int ret = 0;
443
444         lbs_deb_enter(LBS_DEB_HOST);
445
446         cmd.command = cpu_to_le16(CMD_802_11_WAKEUP_CONFIRM);
447         cmd.size = cpu_to_le16(sizeof(cmd));
448         cmd.seqnum = cpu_to_le16(++priv->seqnum);
449         cmd.result = 0;
450
451         lbs_deb_hex(LBS_DEB_HOST, "wake confirm", (u8 *) &cmd,
452                 sizeof(cmd));
453
454         ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) &cmd, sizeof(cmd));
455         if (ret)
456                 lbs_pr_alert("SEND_WAKEC_CMD: Host to Card failed for Confirm Wake\n");
457
458         lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
459         return ret;
460 }
461
462 int lbs_process_event(struct lbs_private *priv, u32 event)
463 {
464         int ret = 0;
465
466         lbs_deb_enter(LBS_DEB_CMD);
467
468         switch (event) {
469         case MACREG_INT_CODE_LINK_SENSED:
470                 lbs_deb_cmd("EVENT: link sensed\n");
471                 break;
472
473         case MACREG_INT_CODE_DEAUTHENTICATED:
474                 lbs_deb_cmd("EVENT: deauthenticated\n");
475                 lbs_mac_event_disconnected(priv);
476                 break;
477
478         case MACREG_INT_CODE_DISASSOCIATED:
479                 lbs_deb_cmd("EVENT: disassociated\n");
480                 lbs_mac_event_disconnected(priv);
481                 break;
482
483         case MACREG_INT_CODE_LINK_LOST_NO_SCAN:
484                 lbs_deb_cmd("EVENT: link lost\n");
485                 lbs_mac_event_disconnected(priv);
486                 break;
487
488         case MACREG_INT_CODE_PS_SLEEP:
489                 lbs_deb_cmd("EVENT: ps sleep\n");
490
491                 /* handle unexpected PS SLEEP event */
492                 if (priv->psstate == PS_STATE_FULL_POWER) {
493                         lbs_deb_cmd(
494                                "EVENT: in FULL POWER mode, ignoreing PS_SLEEP\n");
495                         break;
496                 }
497                 priv->psstate = PS_STATE_PRE_SLEEP;
498
499                 lbs_ps_confirm_sleep(priv);
500
501                 break;
502
503         case MACREG_INT_CODE_HOST_AWAKE:
504                 lbs_deb_cmd("EVENT: host awake\n");
505                 if (priv->reset_deep_sleep_wakeup)
506                         priv->reset_deep_sleep_wakeup(priv);
507                 priv->is_deep_sleep = 0;
508                 lbs_send_confirmwake(priv);
509                 break;
510
511         case MACREG_INT_CODE_DEEP_SLEEP_AWAKE:
512                 if (priv->reset_deep_sleep_wakeup)
513                         priv->reset_deep_sleep_wakeup(priv);
514                 lbs_deb_cmd("EVENT: ds awake\n");
515                 priv->is_deep_sleep = 0;
516                 priv->wakeup_dev_required = 0;
517                 wake_up_interruptible(&priv->ds_awake_q);
518                 break;
519
520         case MACREG_INT_CODE_PS_AWAKE:
521                 lbs_deb_cmd("EVENT: ps awake\n");
522                 /* handle unexpected PS AWAKE event */
523                 if (priv->psstate == PS_STATE_FULL_POWER) {
524                         lbs_deb_cmd(
525                                "EVENT: In FULL POWER mode - ignore PS AWAKE\n");
526                         break;
527                 }
528
529                 priv->psstate = PS_STATE_AWAKE;
530
531                 if (priv->needtowakeup) {
532                         /*
533                          * wait for the command processing to finish
534                          * before resuming sending
535                          * priv->needtowakeup will be set to FALSE
536                          * in lbs_ps_wakeup()
537                          */
538                         lbs_deb_cmd("waking up ...\n");
539                         lbs_ps_wakeup(priv, 0);
540                 }
541                 break;
542
543         case MACREG_INT_CODE_MIC_ERR_UNICAST:
544                 lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n");
545                 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST);
546                 break;
547
548         case MACREG_INT_CODE_MIC_ERR_MULTICAST:
549                 lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
550                 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
551                 break;
552
553         case MACREG_INT_CODE_MIB_CHANGED:
554                 lbs_deb_cmd("EVENT: MIB CHANGED\n");
555                 break;
556         case MACREG_INT_CODE_INIT_DONE:
557                 lbs_deb_cmd("EVENT: INIT DONE\n");
558                 break;
559         case MACREG_INT_CODE_ADHOC_BCN_LOST:
560                 lbs_deb_cmd("EVENT: ADHOC beacon lost\n");
561                 break;
562         case MACREG_INT_CODE_RSSI_LOW:
563                 lbs_pr_alert("EVENT: rssi low\n");
564                 break;
565         case MACREG_INT_CODE_SNR_LOW:
566                 lbs_pr_alert("EVENT: snr low\n");
567                 break;
568         case MACREG_INT_CODE_MAX_FAIL:
569                 lbs_pr_alert("EVENT: max fail\n");
570                 break;
571         case MACREG_INT_CODE_RSSI_HIGH:
572                 lbs_pr_alert("EVENT: rssi high\n");
573                 break;
574         case MACREG_INT_CODE_SNR_HIGH:
575                 lbs_pr_alert("EVENT: snr high\n");
576                 break;
577
578         case MACREG_INT_CODE_MESH_AUTO_STARTED:
579                 /* Ignore spurious autostart events if autostart is disabled */
580                 if (!priv->mesh_autostart_enabled) {
581                         lbs_pr_info("EVENT: MESH_AUTO_STARTED (ignoring)\n");
582                         break;
583                 }
584                 lbs_pr_info("EVENT: MESH_AUTO_STARTED\n");
585                 priv->mesh_connect_status = LBS_CONNECTED;
586                 if (priv->mesh_open) {
587                         netif_carrier_on(priv->mesh_dev);
588                         if (!priv->tx_pending_len)
589                                 netif_wake_queue(priv->mesh_dev);
590                 }
591                 priv->mode = IW_MODE_ADHOC;
592                 schedule_work(&priv->sync_channel);
593                 break;
594
595         default:
596                 lbs_pr_alert("EVENT: unknown event id %d\n", event);
597                 break;
598         }
599
600         lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
601         return ret;
602 }