2 * This file contains the handling of command
3 * responses as well as events generated by firmware.
5 #include <linux/delay.h>
6 #include <linux/if_arp.h>
7 #include <linux/netdevice.h>
9 #include <net/iw_handler.h>
19 * @brief This function handles disconnect event. it
20 * reports disconnect to upper layer, clean tx/rx packets,
21 * reset link state etc.
23 * @param priv A pointer to struct lbs_private structure
26 void lbs_mac_event_disconnected(struct lbs_private
*priv
)
28 union iwreq_data wrqu
;
30 if (priv
->connect_status
!= LBS_CONNECTED
)
33 lbs_deb_enter(LBS_DEB_ASSOC
);
35 memset(wrqu
.ap_addr
.sa_data
, 0x00, ETH_ALEN
);
36 wrqu
.ap_addr
.sa_family
= ARPHRD_ETHER
;
39 * Cisco AP sends EAP failure and de-auth in less than 0.5 ms.
40 * It causes problem in the Supplicant
43 msleep_interruptible(1000);
44 wireless_send_event(priv
->dev
, SIOCGIWAP
, &wrqu
, NULL
);
46 /* report disconnect to upper layer */
47 netif_stop_queue(priv
->dev
);
48 netif_carrier_off(priv
->dev
);
50 /* Free Tx and Rx packets */
51 kfree_skb(priv
->currenttxskb
);
52 priv
->currenttxskb
= NULL
;
53 priv
->tx_pending_len
= 0;
55 /* reset SNR/NF/RSSI values */
56 memset(priv
->SNR
, 0x00, sizeof(priv
->SNR
));
57 memset(priv
->NF
, 0x00, sizeof(priv
->NF
));
58 memset(priv
->RSSI
, 0x00, sizeof(priv
->RSSI
));
59 memset(priv
->rawSNR
, 0x00, sizeof(priv
->rawSNR
));
60 memset(priv
->rawNF
, 0x00, sizeof(priv
->rawNF
));
63 priv
->connect_status
= LBS_DISCONNECTED
;
65 /* Clear out associated SSID and BSSID since connection is
68 memset(&priv
->curbssparams
.bssid
, 0, ETH_ALEN
);
69 memset(&priv
->curbssparams
.ssid
, 0, IW_ESSID_MAX_SIZE
);
70 priv
->curbssparams
.ssid_len
= 0;
72 if (priv
->psstate
!= PS_STATE_FULL_POWER
) {
73 /* make firmware to exit PS mode */
74 lbs_deb_cmd("disconnected, so exit PS mode\n");
75 lbs_ps_wakeup(priv
, 0);
77 lbs_deb_leave(LBS_DEB_ASSOC
);
81 * @brief This function handles MIC failure event.
83 * @param priv A pointer to struct lbs_private structure
84 * @para event the event id
87 static void handle_mic_failureevent(struct lbs_private
*priv
, u32 event
)
91 lbs_deb_enter(LBS_DEB_CMD
);
92 memset(buf
, 0, sizeof(buf
));
94 sprintf(buf
, "%s", "MLME-MICHAELMICFAILURE.indication ");
96 if (event
== MACREG_INT_CODE_MIC_ERR_UNICAST
) {
97 strcat(buf
, "unicast ");
99 strcat(buf
, "multicast ");
102 lbs_send_iwevcustom_event(priv
, buf
);
103 lbs_deb_leave(LBS_DEB_CMD
);
106 static int lbs_ret_reg_access(struct lbs_private
*priv
,
107 u16 type
, struct cmd_ds_command
*resp
)
111 lbs_deb_enter(LBS_DEB_CMD
);
114 case CMD_RET(CMD_MAC_REG_ACCESS
):
116 struct cmd_ds_mac_reg_access
*reg
= &resp
->params
.macreg
;
118 priv
->offsetvalue
.offset
= (u32
)le16_to_cpu(reg
->offset
);
119 priv
->offsetvalue
.value
= le32_to_cpu(reg
->value
);
123 case CMD_RET(CMD_BBP_REG_ACCESS
):
125 struct cmd_ds_bbp_reg_access
*reg
= &resp
->params
.bbpreg
;
127 priv
->offsetvalue
.offset
= (u32
)le16_to_cpu(reg
->offset
);
128 priv
->offsetvalue
.value
= reg
->value
;
132 case CMD_RET(CMD_RF_REG_ACCESS
):
134 struct cmd_ds_rf_reg_access
*reg
= &resp
->params
.rfreg
;
136 priv
->offsetvalue
.offset
= (u32
)le16_to_cpu(reg
->offset
);
137 priv
->offsetvalue
.value
= reg
->value
;
145 lbs_deb_leave_args(LBS_DEB_CMD
, "ret %d", ret
);
149 static int lbs_ret_802_11_snmp_mib(struct lbs_private
*priv
,
150 struct cmd_ds_command
*resp
)
152 struct cmd_ds_802_11_snmp_mib
*smib
= &resp
->params
.smib
;
153 u16 oid
= le16_to_cpu(smib
->oid
);
154 u16 querytype
= le16_to_cpu(smib
->querytype
);
156 lbs_deb_enter(LBS_DEB_CMD
);
158 lbs_deb_cmd("SNMP_RESP: oid 0x%x, querytype 0x%x\n", oid
,
160 lbs_deb_cmd("SNMP_RESP: Buf size %d\n", le16_to_cpu(smib
->bufsize
));
162 if (querytype
== CMD_ACT_GET
) {
166 le16_to_cpu(*((__le16
*)(smib
->value
)));
167 lbs_deb_cmd("SNMP_RESP: frag threshold %u\n",
172 le16_to_cpu(*((__le16
*)(smib
->value
)));
173 lbs_deb_cmd("SNMP_RESP: rts threshold %u\n",
176 case SHORT_RETRYLIM_I
:
178 le16_to_cpu(*((__le16
*)(smib
->value
)));
179 lbs_deb_cmd("SNMP_RESP: tx retry count %u\n",
187 lbs_deb_enter(LBS_DEB_CMD
);
191 static int lbs_ret_802_11_rf_tx_power(struct lbs_private
*priv
,
192 struct cmd_ds_command
*resp
)
194 struct cmd_ds_802_11_rf_tx_power
*rtp
= &resp
->params
.txp
;
196 lbs_deb_enter(LBS_DEB_CMD
);
198 priv
->txpowerlevel
= le16_to_cpu(rtp
->currentlevel
);
200 lbs_deb_cmd("TX power currently %d\n", priv
->txpowerlevel
);
202 lbs_deb_leave(LBS_DEB_CMD
);
206 static int lbs_ret_802_11_rate_adapt_rateset(struct lbs_private
*priv
,
207 struct cmd_ds_command
*resp
)
209 struct cmd_ds_802_11_rate_adapt_rateset
*rates
= &resp
->params
.rateset
;
211 lbs_deb_enter(LBS_DEB_CMD
);
213 if (rates
->action
== CMD_ACT_GET
) {
214 priv
->enablehwauto
= le16_to_cpu(rates
->enablehwauto
);
215 priv
->ratebitmap
= le16_to_cpu(rates
->bitmap
);
218 lbs_deb_leave(LBS_DEB_CMD
);
222 static int lbs_ret_802_11_rssi(struct lbs_private
*priv
,
223 struct cmd_ds_command
*resp
)
225 struct cmd_ds_802_11_rssi_rsp
*rssirsp
= &resp
->params
.rssirsp
;
227 lbs_deb_enter(LBS_DEB_CMD
);
229 /* store the non average value */
230 priv
->SNR
[TYPE_BEACON
][TYPE_NOAVG
] = le16_to_cpu(rssirsp
->SNR
);
231 priv
->NF
[TYPE_BEACON
][TYPE_NOAVG
] = le16_to_cpu(rssirsp
->noisefloor
);
233 priv
->SNR
[TYPE_BEACON
][TYPE_AVG
] = le16_to_cpu(rssirsp
->avgSNR
);
234 priv
->NF
[TYPE_BEACON
][TYPE_AVG
] = le16_to_cpu(rssirsp
->avgnoisefloor
);
236 priv
->RSSI
[TYPE_BEACON
][TYPE_NOAVG
] =
237 CAL_RSSI(priv
->SNR
[TYPE_BEACON
][TYPE_NOAVG
],
238 priv
->NF
[TYPE_BEACON
][TYPE_NOAVG
]);
240 priv
->RSSI
[TYPE_BEACON
][TYPE_AVG
] =
241 CAL_RSSI(priv
->SNR
[TYPE_BEACON
][TYPE_AVG
] / AVG_SCALE
,
242 priv
->NF
[TYPE_BEACON
][TYPE_AVG
] / AVG_SCALE
);
244 lbs_deb_cmd("RSSI: beacon %d, avg %d\n",
245 priv
->RSSI
[TYPE_BEACON
][TYPE_NOAVG
],
246 priv
->RSSI
[TYPE_BEACON
][TYPE_AVG
]);
248 lbs_deb_leave(LBS_DEB_CMD
);
252 static int lbs_ret_802_11_bcn_ctrl(struct lbs_private
* priv
,
253 struct cmd_ds_command
*resp
)
255 struct cmd_ds_802_11_beacon_control
*bcn_ctrl
=
256 &resp
->params
.bcn_ctrl
;
258 lbs_deb_enter(LBS_DEB_CMD
);
260 if (bcn_ctrl
->action
== CMD_ACT_GET
) {
261 priv
->beacon_enable
= (u8
) le16_to_cpu(bcn_ctrl
->beacon_enable
);
262 priv
->beacon_period
= le16_to_cpu(bcn_ctrl
->beacon_period
);
265 lbs_deb_enter(LBS_DEB_CMD
);
269 static inline int handle_cmd_response(struct lbs_private
*priv
,
270 struct cmd_header
*cmd_response
)
272 struct cmd_ds_command
*resp
= (struct cmd_ds_command
*) cmd_response
;
275 uint16_t respcmd
= le16_to_cpu(resp
->command
);
277 lbs_deb_enter(LBS_DEB_HOST
);
280 case CMD_RET(CMD_MAC_REG_ACCESS
):
281 case CMD_RET(CMD_BBP_REG_ACCESS
):
282 case CMD_RET(CMD_RF_REG_ACCESS
):
283 ret
= lbs_ret_reg_access(priv
, respcmd
, resp
);
286 case CMD_RET_802_11_ASSOCIATE
:
287 case CMD_RET(CMD_802_11_ASSOCIATE
):
288 case CMD_RET(CMD_802_11_REASSOCIATE
):
289 ret
= lbs_ret_80211_associate(priv
, resp
);
292 case CMD_RET(CMD_802_11_DISASSOCIATE
):
293 case CMD_RET(CMD_802_11_DEAUTHENTICATE
):
294 ret
= lbs_ret_80211_disassociate(priv
);
297 case CMD_RET(CMD_802_11_AD_HOC_START
):
298 case CMD_RET(CMD_802_11_AD_HOC_JOIN
):
299 ret
= lbs_ret_80211_ad_hoc_start(priv
, resp
);
302 case CMD_RET(CMD_802_11_SNMP_MIB
):
303 ret
= lbs_ret_802_11_snmp_mib(priv
, resp
);
306 case CMD_RET(CMD_802_11_RF_TX_POWER
):
307 ret
= lbs_ret_802_11_rf_tx_power(priv
, resp
);
310 case CMD_RET(CMD_802_11_SET_AFC
):
311 case CMD_RET(CMD_802_11_GET_AFC
):
312 spin_lock_irqsave(&priv
->driver_lock
, flags
);
313 memmove((void *)priv
->cur_cmd
->callback_arg
, &resp
->params
.afc
,
314 sizeof(struct cmd_ds_802_11_afc
));
315 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
319 case CMD_RET(CMD_MAC_MULTICAST_ADR
):
320 case CMD_RET(CMD_802_11_RESET
):
321 case CMD_RET(CMD_802_11_AUTHENTICATE
):
322 case CMD_RET(CMD_802_11_BEACON_STOP
):
325 case CMD_RET(CMD_802_11_RATE_ADAPT_RATESET
):
326 ret
= lbs_ret_802_11_rate_adapt_rateset(priv
, resp
);
329 case CMD_RET(CMD_802_11_RSSI
):
330 ret
= lbs_ret_802_11_rssi(priv
, resp
);
333 case CMD_RET(CMD_802_11_AD_HOC_STOP
):
334 ret
= lbs_ret_80211_ad_hoc_stop(priv
);
337 case CMD_RET(CMD_802_11D_DOMAIN_INFO
):
338 ret
= lbs_ret_802_11d_domain_info(resp
);
341 case CMD_RET(CMD_802_11_TPC_CFG
):
342 spin_lock_irqsave(&priv
->driver_lock
, flags
);
343 memmove((void *)priv
->cur_cmd
->callback_arg
, &resp
->params
.tpccfg
,
344 sizeof(struct cmd_ds_802_11_tpc_cfg
));
345 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
347 case CMD_RET(CMD_802_11_LED_GPIO_CTRL
):
348 spin_lock_irqsave(&priv
->driver_lock
, flags
);
349 memmove((void *)priv
->cur_cmd
->callback_arg
, &resp
->params
.ledgpio
,
350 sizeof(struct cmd_ds_802_11_led_ctrl
));
351 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
354 case CMD_RET(CMD_GET_TSF
):
355 spin_lock_irqsave(&priv
->driver_lock
, flags
);
356 memcpy((void *)priv
->cur_cmd
->callback_arg
,
357 &resp
->params
.gettsf
.tsfvalue
, sizeof(u64
));
358 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
360 case CMD_RET(CMD_BT_ACCESS
):
361 spin_lock_irqsave(&priv
->driver_lock
, flags
);
362 if (priv
->cur_cmd
->callback_arg
)
363 memcpy((void *)priv
->cur_cmd
->callback_arg
,
364 &resp
->params
.bt
.addr1
, 2 * ETH_ALEN
);
365 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
367 case CMD_RET(CMD_FWT_ACCESS
):
368 spin_lock_irqsave(&priv
->driver_lock
, flags
);
369 if (priv
->cur_cmd
->callback_arg
)
370 memcpy((void *)priv
->cur_cmd
->callback_arg
, &resp
->params
.fwt
,
371 sizeof(resp
->params
.fwt
));
372 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
374 case CMD_RET(CMD_802_11_BEACON_CTRL
):
375 ret
= lbs_ret_802_11_bcn_ctrl(priv
, resp
);
379 lbs_deb_host("CMD_RESP: unknown cmd response 0x%04x\n",
380 le16_to_cpu(resp
->command
));
383 lbs_deb_leave(LBS_DEB_HOST
);
387 int lbs_process_command_response(struct lbs_private
*priv
, u8
*data
, u32 len
)
389 uint16_t respcmd
, curcmd
;
390 struct cmd_header
*resp
;
395 lbs_deb_enter(LBS_DEB_HOST
);
397 mutex_lock(&priv
->lock
);
398 spin_lock_irqsave(&priv
->driver_lock
, flags
);
400 if (!priv
->cur_cmd
) {
401 lbs_deb_host("CMD_RESP: cur_cmd is NULL\n");
403 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
408 curcmd
= le16_to_cpu(priv
->cur_cmd
->cmdbuf
->command
);
409 respcmd
= le16_to_cpu(resp
->command
);
410 result
= le16_to_cpu(resp
->result
);
412 lbs_deb_cmd("CMD_RESP: response 0x%04x, seq %d, size %d\n",
413 respcmd
, le16_to_cpu(resp
->seqnum
), len
);
414 lbs_deb_hex(LBS_DEB_CMD
, "CMD_RESP", (void *) resp
, len
);
416 if (resp
->seqnum
!= priv
->cur_cmd
->cmdbuf
->seqnum
) {
417 lbs_pr_info("Received CMD_RESP with invalid sequence %d (expected %d)\n",
418 le16_to_cpu(resp
->seqnum
), le16_to_cpu(priv
->cur_cmd
->cmdbuf
->seqnum
));
419 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
423 if (respcmd
!= CMD_RET(curcmd
) &&
424 respcmd
!= CMD_RET_802_11_ASSOCIATE
&& curcmd
!= CMD_802_11_ASSOCIATE
) {
425 lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd
, curcmd
);
426 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
431 if (resp
->result
== cpu_to_le16(0x0004)) {
432 /* 0x0004 means -EAGAIN. Drop the response, let it time out
433 and be resubmitted */
434 lbs_pr_info("Firmware returns DEFER to command %x. Will let it time out...\n",
435 le16_to_cpu(resp
->command
));
436 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
441 /* Now we got response from FW, cancel the command timer */
442 del_timer(&priv
->command_timer
);
443 priv
->cmd_timed_out
= 0;
444 if (priv
->nr_retries
) {
445 lbs_pr_info("Received result %x to command %x after %d retries\n",
446 result
, curcmd
, priv
->nr_retries
);
447 priv
->nr_retries
= 0;
450 /* Store the response code to cur_cmd_retcode. */
451 priv
->cur_cmd_retcode
= result
;
453 if (respcmd
== CMD_RET(CMD_802_11_PS_MODE
)) {
454 struct cmd_ds_802_11_ps_mode
*psmode
= (void *) &resp
[1];
455 u16 action
= le16_to_cpu(psmode
->action
);
458 "CMD_RESP: PS_MODE cmd reply result 0x%x, action 0x%x\n",
462 lbs_deb_host("CMD_RESP: PS command failed with 0x%x\n",
465 * We should not re-try enter-ps command in
466 * ad-hoc mode. It takes place in
467 * lbs_execute_next_command().
469 if (priv
->mode
== IW_MODE_ADHOC
&&
470 action
== CMD_SUBCMD_ENTER_PS
)
471 priv
->psmode
= LBS802_11POWERMODECAM
;
472 } else if (action
== CMD_SUBCMD_ENTER_PS
) {
473 priv
->needtowakeup
= 0;
474 priv
->psstate
= PS_STATE_AWAKE
;
476 lbs_deb_host("CMD_RESP: ENTER_PS command response\n");
477 if (priv
->connect_status
!= LBS_CONNECTED
) {
479 * When Deauth Event received before Enter_PS command
480 * response, We need to wake up the firmware.
483 "disconnected, invoking lbs_ps_wakeup\n");
485 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
486 mutex_unlock(&priv
->lock
);
487 lbs_ps_wakeup(priv
, 0);
488 mutex_lock(&priv
->lock
);
489 spin_lock_irqsave(&priv
->driver_lock
, flags
);
491 } else if (action
== CMD_SUBCMD_EXIT_PS
) {
492 priv
->needtowakeup
= 0;
493 priv
->psstate
= PS_STATE_FULL_POWER
;
494 lbs_deb_host("CMD_RESP: EXIT_PS command response\n");
496 lbs_deb_host("CMD_RESP: PS action 0x%X\n", action
);
499 lbs_complete_command(priv
, priv
->cur_cmd
, result
);
500 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
506 /* If the command is not successful, cleanup and return failure */
507 if ((result
!= 0 || !(respcmd
& 0x8000))) {
508 lbs_deb_host("CMD_RESP: error 0x%04x in command reply 0x%04x\n",
511 * Handling errors here
514 case CMD_RET(CMD_GET_HW_SPEC
):
515 case CMD_RET(CMD_802_11_RESET
):
516 lbs_deb_host("CMD_RESP: reset failed\n");
520 lbs_complete_command(priv
, priv
->cur_cmd
, result
);
521 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
527 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
529 if (priv
->cur_cmd
&& priv
->cur_cmd
->callback
) {
530 ret
= priv
->cur_cmd
->callback(priv
, priv
->cur_cmd
->callback_arg
,
533 ret
= handle_cmd_response(priv
, resp
);
535 spin_lock_irqsave(&priv
->driver_lock
, flags
);
538 /* Clean up and Put current command back to cmdfreeq */
539 lbs_complete_command(priv
, priv
->cur_cmd
, result
);
541 spin_unlock_irqrestore(&priv
->driver_lock
, flags
);
544 mutex_unlock(&priv
->lock
);
545 lbs_deb_leave_args(LBS_DEB_HOST
, "ret %d", ret
);
549 static int lbs_send_confirmwake(struct lbs_private
*priv
)
551 struct cmd_header cmd
;
554 lbs_deb_enter(LBS_DEB_HOST
);
556 cmd
.command
= cpu_to_le16(CMD_802_11_WAKEUP_CONFIRM
);
557 cmd
.size
= cpu_to_le16(sizeof(cmd
));
558 cmd
.seqnum
= cpu_to_le16(++priv
->seqnum
);
561 lbs_deb_hex(LBS_DEB_HOST
, "wake confirm", (u8
*) &cmd
,
564 ret
= priv
->hw_host_to_card(priv
, MVMS_CMD
, (u8
*) &cmd
, sizeof(cmd
));
566 lbs_pr_alert("SEND_WAKEC_CMD: Host to Card failed for Confirm Wake\n");
568 lbs_deb_leave_args(LBS_DEB_HOST
, "ret %d", ret
);
572 int lbs_process_event(struct lbs_private
*priv
, u32 event
)
576 lbs_deb_enter(LBS_DEB_CMD
);
579 case MACREG_INT_CODE_LINK_SENSED
:
580 lbs_deb_cmd("EVENT: link sensed\n");
583 case MACREG_INT_CODE_DEAUTHENTICATED
:
584 lbs_deb_cmd("EVENT: deauthenticated\n");
585 lbs_mac_event_disconnected(priv
);
588 case MACREG_INT_CODE_DISASSOCIATED
:
589 lbs_deb_cmd("EVENT: disassociated\n");
590 lbs_mac_event_disconnected(priv
);
593 case MACREG_INT_CODE_LINK_LOST_NO_SCAN
:
594 lbs_deb_cmd("EVENT: link lost\n");
595 lbs_mac_event_disconnected(priv
);
598 case MACREG_INT_CODE_PS_SLEEP
:
599 lbs_deb_cmd("EVENT: ps sleep\n");
601 /* handle unexpected PS SLEEP event */
602 if (priv
->psstate
== PS_STATE_FULL_POWER
) {
604 "EVENT: in FULL POWER mode, ignoreing PS_SLEEP\n");
607 priv
->psstate
= PS_STATE_PRE_SLEEP
;
609 lbs_ps_confirm_sleep(priv
);
613 case MACREG_INT_CODE_HOST_AWAKE
:
614 lbs_deb_cmd("EVENT: host awake\n");
615 lbs_send_confirmwake(priv
);
618 case MACREG_INT_CODE_PS_AWAKE
:
619 lbs_deb_cmd("EVENT: ps awake\n");
620 /* handle unexpected PS AWAKE event */
621 if (priv
->psstate
== PS_STATE_FULL_POWER
) {
623 "EVENT: In FULL POWER mode - ignore PS AWAKE\n");
627 priv
->psstate
= PS_STATE_AWAKE
;
629 if (priv
->needtowakeup
) {
631 * wait for the command processing to finish
632 * before resuming sending
633 * priv->needtowakeup will be set to FALSE
636 lbs_deb_cmd("waking up ...\n");
637 lbs_ps_wakeup(priv
, 0);
641 case MACREG_INT_CODE_MIC_ERR_UNICAST
:
642 lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n");
643 handle_mic_failureevent(priv
, MACREG_INT_CODE_MIC_ERR_UNICAST
);
646 case MACREG_INT_CODE_MIC_ERR_MULTICAST
:
647 lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
648 handle_mic_failureevent(priv
, MACREG_INT_CODE_MIC_ERR_MULTICAST
);
651 case MACREG_INT_CODE_MIB_CHANGED
:
652 lbs_deb_cmd("EVENT: MIB CHANGED\n");
654 case MACREG_INT_CODE_INIT_DONE
:
655 lbs_deb_cmd("EVENT: INIT DONE\n");
657 case MACREG_INT_CODE_ADHOC_BCN_LOST
:
658 lbs_deb_cmd("EVENT: ADHOC beacon lost\n");
660 case MACREG_INT_CODE_RSSI_LOW
:
661 lbs_pr_alert("EVENT: rssi low\n");
663 case MACREG_INT_CODE_SNR_LOW
:
664 lbs_pr_alert("EVENT: snr low\n");
666 case MACREG_INT_CODE_MAX_FAIL
:
667 lbs_pr_alert("EVENT: max fail\n");
669 case MACREG_INT_CODE_RSSI_HIGH
:
670 lbs_pr_alert("EVENT: rssi high\n");
672 case MACREG_INT_CODE_SNR_HIGH
:
673 lbs_pr_alert("EVENT: snr high\n");
676 case MACREG_INT_CODE_MESH_AUTO_STARTED
:
677 /* Ignore spurious autostart events if autostart is disabled */
678 if (!priv
->mesh_autostart_enabled
) {
679 lbs_pr_info("EVENT: MESH_AUTO_STARTED (ignoring)\n");
682 lbs_pr_info("EVENT: MESH_AUTO_STARTED\n");
683 priv
->mesh_connect_status
= LBS_CONNECTED
;
684 if (priv
->mesh_open
) {
685 netif_carrier_on(priv
->mesh_dev
);
686 if (!priv
->tx_pending_len
)
687 netif_wake_queue(priv
->mesh_dev
);
689 priv
->mode
= IW_MODE_ADHOC
;
690 schedule_work(&priv
->sync_channel
);
694 lbs_pr_alert("EVENT: unknown event id %d\n", event
);
698 lbs_deb_leave_args(LBS_DEB_CMD
, "ret %d", ret
);