aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/cmdresp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/cmdresp.c')
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c376
1 files changed, 176 insertions, 200 deletions
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index c86454034b58..0c3b9a583d83 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -9,7 +9,6 @@
9#include <net/iw_handler.h> 9#include <net/iw_handler.h>
10 10
11#include "host.h" 11#include "host.h"
12#include "sbi.h"
13#include "decl.h" 12#include "decl.h"
14#include "defs.h" 13#include "defs.h"
15#include "dev.h" 14#include "dev.h"
@@ -32,7 +31,7 @@ void libertas_mac_event_disconnected(wlan_private * priv)
32 if (adapter->connect_status != libertas_connected) 31 if (adapter->connect_status != libertas_connected)
33 return; 32 return;
34 33
35 lbs_pr_debug(1, "Handles disconnect event.\n"); 34 lbs_deb_cmd("Handles disconnect event.\n");
36 35
37 memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN); 36 memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
38 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 37 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -43,15 +42,15 @@ void libertas_mac_event_disconnected(wlan_private * priv)
43 */ 42 */
44 43
45 msleep_interruptible(1000); 44 msleep_interruptible(1000);
46 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL); 45 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
47 46
48 /* Free Tx and Rx packets */ 47 /* Free Tx and Rx packets */
49 kfree_skb(priv->adapter->currenttxskb); 48 kfree_skb(priv->adapter->currenttxskb);
50 priv->adapter->currenttxskb = NULL; 49 priv->adapter->currenttxskb = NULL;
51 50
52 /* report disconnect to upper layer */ 51 /* report disconnect to upper layer */
53 netif_stop_queue(priv->wlan_dev.netdev); 52 netif_stop_queue(priv->dev);
54 netif_carrier_off(priv->wlan_dev.netdev); 53 netif_carrier_off(priv->dev);
55 54
56 /* reset SNR/NF/RSSI values */ 55 /* reset SNR/NF/RSSI values */
57 memset(adapter->SNR, 0x00, sizeof(adapter->SNR)); 56 memset(adapter->SNR, 0x00, sizeof(adapter->SNR));
@@ -62,35 +61,32 @@ void libertas_mac_event_disconnected(wlan_private * priv)
62 adapter->nextSNRNF = 0; 61 adapter->nextSNRNF = 0;
63 adapter->numSNRNF = 0; 62 adapter->numSNRNF = 0;
64 adapter->rxpd_rate = 0; 63 adapter->rxpd_rate = 0;
65 lbs_pr_debug(1, "Current SSID=%s, ssid length=%u\n", 64 lbs_deb_cmd("Current SSID='%s', ssid length=%u\n",
66 adapter->curbssparams.ssid.ssid, 65 escape_essid(adapter->curbssparams.ssid,
67 adapter->curbssparams.ssid.ssidlength); 66 adapter->curbssparams.ssid_len),
68 lbs_pr_debug(1, "Previous SSID=%s, ssid length=%u\n", 67 adapter->curbssparams.ssid_len);
69 adapter->previousssid.ssid, adapter->previousssid.ssidlength); 68 lbs_deb_cmd("Previous SSID='%s', ssid length=%u\n",
70 69 escape_essid(adapter->prev_ssid, adapter->prev_ssid_len),
71 /* reset internal flags */ 70 adapter->prev_ssid_len);
72 adapter->secinfo.WPAenabled = 0;
73 adapter->secinfo.WPA2enabled = 0;
74 adapter->wpa_ie_len = 0;
75 71
76 adapter->connect_status = libertas_disconnected; 72 adapter->connect_status = libertas_disconnected;
77 73
78 /* 74 /* Save previous SSID and BSSID for possible reassociation */
79 * memorize the previous SSID and BSSID 75 memcpy(&adapter->prev_ssid, &adapter->curbssparams.ssid,
80 * it could be used for re-assoc 76 IW_ESSID_MAX_SIZE);
81 */ 77 adapter->prev_ssid_len = adapter->curbssparams.ssid_len;
82 memcpy(&adapter->previousssid, 78 memcpy(adapter->prev_bssid, adapter->curbssparams.bssid, ETH_ALEN);
83 &adapter->curbssparams.ssid, sizeof(struct WLAN_802_11_SSID));
84 memcpy(adapter->previousbssid,
85 adapter->curbssparams.bssid, ETH_ALEN);
86 79
87 /* need to erase the current SSID and BSSID info */ 80 /* Clear out associated SSID and BSSID since connection is
88 adapter->pattemptedbssdesc = NULL; 81 * no longer valid.
89 memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams)); 82 */
83 memset(&adapter->curbssparams.bssid, 0, ETH_ALEN);
84 memset(&adapter->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE);
85 adapter->curbssparams.ssid_len = 0;
90 86
91 if (adapter->psstate != PS_STATE_FULL_POWER) { 87 if (adapter->psstate != PS_STATE_FULL_POWER) {
92 /* make firmware to exit PS mode */ 88 /* make firmware to exit PS mode */
93 lbs_pr_debug(1, "Disconnected, so exit PS mode.\n"); 89 lbs_deb_cmd("Disconnected, so exit PS mode.\n");
94 libertas_ps_wakeup(priv, 0); 90 libertas_ps_wakeup(priv, 0);
95 } 91 }
96} 92}
@@ -122,55 +118,45 @@ static void handle_mic_failureevent(wlan_private * priv, u32 event)
122static int wlan_ret_reg_access(wlan_private * priv, 118static int wlan_ret_reg_access(wlan_private * priv,
123 u16 type, struct cmd_ds_command *resp) 119 u16 type, struct cmd_ds_command *resp)
124{ 120{
121 int ret = 0;
125 wlan_adapter *adapter = priv->adapter; 122 wlan_adapter *adapter = priv->adapter;
126 123
127 ENTER(); 124 lbs_deb_enter(LBS_DEB_CMD);
128 125
129 switch (type) { 126 switch (type) {
130 case cmd_ret_mac_reg_access: 127 case cmd_ret_mac_reg_access:
131 { 128 {
132 struct cmd_ds_mac_reg_access *reg; 129 struct cmd_ds_mac_reg_access *reg = &resp->params.macreg;
133
134 reg =
135 (struct cmd_ds_mac_reg_access *)&resp->params.
136 macreg;
137 130
138 adapter->offsetvalue.offset = reg->offset; 131 adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
139 adapter->offsetvalue.value = reg->value; 132 adapter->offsetvalue.value = le32_to_cpu(reg->value);
140 break; 133 break;
141 } 134 }
142 135
143 case cmd_ret_bbp_reg_access: 136 case cmd_ret_bbp_reg_access:
144 { 137 {
145 struct cmd_ds_bbp_reg_access *reg; 138 struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg;
146 reg =
147 (struct cmd_ds_bbp_reg_access *)&resp->params.
148 bbpreg;
149 139
150 adapter->offsetvalue.offset = reg->offset; 140 adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
151 adapter->offsetvalue.value = reg->value; 141 adapter->offsetvalue.value = reg->value;
152 break; 142 break;
153 } 143 }
154 144
155 case cmd_ret_rf_reg_access: 145 case cmd_ret_rf_reg_access:
156 { 146 {
157 struct cmd_ds_rf_reg_access *reg; 147 struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg;
158 reg =
159 (struct cmd_ds_rf_reg_access *)&resp->params.
160 rfreg;
161 148
162 adapter->offsetvalue.offset = reg->offset; 149 adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
163 adapter->offsetvalue.value = reg->value; 150 adapter->offsetvalue.value = reg->value;
164 break; 151 break;
165 } 152 }
166 153
167 default: 154 default:
168 LEAVE(); 155 ret = -1;
169 return -1;
170 } 156 }
171 157
172 LEAVE(); 158 lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
173 return 0; 159 return ret;
174} 160}
175 161
176static int wlan_ret_get_hw_spec(wlan_private * priv, 162static int wlan_ret_get_hw_spec(wlan_private * priv,
@@ -181,19 +167,20 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
181 wlan_adapter *adapter = priv->adapter; 167 wlan_adapter *adapter = priv->adapter;
182 int ret = 0; 168 int ret = 0;
183 169
184 ENTER(); 170 lbs_deb_enter(LBS_DEB_CMD);
185 171
186 adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); 172 adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo);
187 173
188 adapter->fwreleasenumber = hwspec->fwreleasenumber; 174 memcpy(adapter->fwreleasenumber, hwspec->fwreleasenumber, 4);
189 175
190 lbs_pr_debug(1, "GET_HW_SPEC: FWReleaseVersion- 0x%X\n", 176 lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- %u.%u.%u.p%u\n",
191 adapter->fwreleasenumber); 177 adapter->fwreleasenumber[2], adapter->fwreleasenumber[1],
192 lbs_pr_debug(1, "GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n", 178 adapter->fwreleasenumber[0], adapter->fwreleasenumber[3]);
179 lbs_deb_cmd("GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n",
193 hwspec->permanentaddr[0], hwspec->permanentaddr[1], 180 hwspec->permanentaddr[0], hwspec->permanentaddr[1],
194 hwspec->permanentaddr[2], hwspec->permanentaddr[3], 181 hwspec->permanentaddr[2], hwspec->permanentaddr[3],
195 hwspec->permanentaddr[4], hwspec->permanentaddr[5]); 182 hwspec->permanentaddr[4], hwspec->permanentaddr[5]);
196 lbs_pr_debug(1, "GET_HW_SPEC: hwifversion=0x%X version=0x%X\n", 183 lbs_deb_cmd("GET_HW_SPEC: hwifversion=0x%X version=0x%X\n",
197 hwspec->hwifversion, hwspec->version); 184 hwspec->hwifversion, hwspec->version);
198 185
199 adapter->regioncode = le16_to_cpu(hwspec->regioncode); 186 adapter->regioncode = le16_to_cpu(hwspec->regioncode);
@@ -210,17 +197,15 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
210 if (i >= MRVDRV_MAX_REGION_CODE) { 197 if (i >= MRVDRV_MAX_REGION_CODE) {
211 adapter->regioncode = 0x10; 198 adapter->regioncode = 0x10;
212 adapter->regiontableindex = 0; 199 adapter->regiontableindex = 0;
213 lbs_pr_info( 200 lbs_pr_info("unidentified region code; using the default (USA)\n");
214 "unidentified region code, use the default (USA)\n");
215 } 201 }
216 202
217 if (adapter->current_addr[0] == 0xff) { 203 if (adapter->current_addr[0] == 0xff)
218 memmove(adapter->current_addr, hwspec->permanentaddr, 204 memmove(adapter->current_addr, hwspec->permanentaddr, ETH_ALEN);
219 ETH_ALEN);
220 }
221 205
222 memcpy(priv->wlan_dev.netdev->dev_addr, adapter->current_addr, ETH_ALEN); 206 memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN);
223 memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); 207 if (priv->mesh_dev)
208 memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
224 209
225 if (libertas_set_regiontable(priv, adapter->regioncode, 0)) { 210 if (libertas_set_regiontable(priv, adapter->regioncode, 0)) {
226 ret = -1; 211 ret = -1;
@@ -232,8 +217,8 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
232 goto done; 217 goto done;
233 } 218 }
234 219
235 done: 220done:
236 LEAVE(); 221 lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
237 return ret; 222 return ret;
238} 223}
239 224
@@ -243,19 +228,21 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv,
243 struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params; 228 struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params;
244 wlan_adapter *adapter = priv->adapter; 229 wlan_adapter *adapter = priv->adapter;
245 230
246 ENTER(); 231 lbs_deb_enter(LBS_DEB_CMD);
232
233 lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n"
234 " extsleepclk=%x\n", le16_to_cpu(sp->error),
235 le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime),
236 sp->calcontrol, sp->externalsleepclk);
247 237
248 lbs_pr_debug(1, "error=%x offset=%x stabletime=%x calcontrol=%x\n"
249 " extsleepclk=%x\n", sp->error, sp->offset,
250 sp->stabletime, sp->calcontrol, sp->externalsleepclk);
251 adapter->sp.sp_error = le16_to_cpu(sp->error); 238 adapter->sp.sp_error = le16_to_cpu(sp->error);
252 adapter->sp.sp_offset = le16_to_cpu(sp->offset); 239 adapter->sp.sp_offset = le16_to_cpu(sp->offset);
253 adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime); 240 adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime);
254 adapter->sp.sp_calcontrol = le16_to_cpu(sp->calcontrol); 241 adapter->sp.sp_calcontrol = sp->calcontrol;
255 adapter->sp.sp_extsleepclk = le16_to_cpu(sp->externalsleepclk); 242 adapter->sp.sp_extsleepclk = sp->externalsleepclk;
256 adapter->sp.sp_reserved = le16_to_cpu(sp->reserved); 243 adapter->sp.sp_reserved = le16_to_cpu(sp->reserved);
257 244
258 LEAVE(); 245 lbs_deb_enter(LBS_DEB_CMD);
259 return 0; 246 return 0;
260} 247}
261 248
@@ -281,42 +268,38 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv,
281 u16 oid = le16_to_cpu(smib->oid); 268 u16 oid = le16_to_cpu(smib->oid);
282 u16 querytype = le16_to_cpu(smib->querytype); 269 u16 querytype = le16_to_cpu(smib->querytype);
283 270
284 ENTER(); 271 lbs_deb_enter(LBS_DEB_CMD);
285 272
286 lbs_pr_debug(1, "SNMP_RESP: value of the oid = %x, querytype=%x\n", oid, 273 lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid,
287 querytype); 274 querytype);
288 lbs_pr_debug(1, "SNMP_RESP: Buf size = %x\n", 275 lbs_deb_cmd("SNMP_RESP: Buf size = %x\n", le16_to_cpu(smib->bufsize));
289 le16_to_cpu(smib->bufsize));
290 276
291 if (querytype == cmd_act_get) { 277 if (querytype == cmd_act_get) {
292 switch (oid) { 278 switch (oid) {
293 case fragthresh_i: 279 case fragthresh_i:
294 priv->adapter->fragthsd = 280 priv->adapter->fragthsd =
295 le16_to_cpu(* 281 le16_to_cpu(*((__le16 *)(smib->value)));
296 ((unsigned short *)(smib->value))); 282 lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n",
297 lbs_pr_debug(1, "SNMP_RESP: fragthsd =%u\n", 283 priv->adapter->fragthsd);
298 priv->adapter->fragthsd);
299 break; 284 break;
300 case rtsthresh_i: 285 case rtsthresh_i:
301 priv->adapter->rtsthsd = 286 priv->adapter->rtsthsd =
302 le16_to_cpu(* 287 le16_to_cpu(*((__le16 *)(smib->value)));
303 ((unsigned short *)(smib->value))); 288 lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n",
304 lbs_pr_debug(1, "SNMP_RESP: rtsthsd =%u\n", 289 priv->adapter->rtsthsd);
305 priv->adapter->rtsthsd);
306 break; 290 break;
307 case short_retrylim_i: 291 case short_retrylim_i:
308 priv->adapter->txretrycount = 292 priv->adapter->txretrycount =
309 le16_to_cpu(* 293 le16_to_cpu(*((__le16 *)(smib->value)));
310 ((unsigned short *)(smib->value))); 294 lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n",
311 lbs_pr_debug(1, "SNMP_RESP: txretrycount =%u\n", 295 priv->adapter->rtsthsd);
312 priv->adapter->rtsthsd);
313 break; 296 break;
314 default: 297 default:
315 break; 298 break;
316 } 299 }
317 } 300 }
318 301
319 LEAVE(); 302 lbs_deb_enter(LBS_DEB_CMD);
320 return 0; 303 return 0;
321} 304}
322 305
@@ -328,7 +311,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv,
328 wlan_adapter *adapter = priv->adapter; 311 wlan_adapter *adapter = priv->adapter;
329 u16 action = le16_to_cpu(pkeymaterial->action); 312 u16 action = le16_to_cpu(pkeymaterial->action);
330 313
331 ENTER(); 314 lbs_deb_enter(LBS_DEB_CMD);
332 315
333 /* Copy the returned key to driver private data */ 316 /* Copy the returned key to driver private data */
334 if (action == cmd_act_get) { 317 if (action == cmd_act_get) {
@@ -371,7 +354,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv,
371 } 354 }
372 } 355 }
373 356
374 LEAVE(); 357 lbs_deb_enter(LBS_DEB_CMD);
375 return 0; 358 return 0;
376} 359}
377 360
@@ -381,11 +364,11 @@ static int wlan_ret_802_11_mac_address(wlan_private * priv,
381 struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd; 364 struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd;
382 wlan_adapter *adapter = priv->adapter; 365 wlan_adapter *adapter = priv->adapter;
383 366
384 ENTER(); 367 lbs_deb_enter(LBS_DEB_CMD);
385 368
386 memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN); 369 memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN);
387 370
388 LEAVE(); 371 lbs_deb_enter(LBS_DEB_CMD);
389 return 0; 372 return 0;
390} 373}
391 374
@@ -395,13 +378,13 @@ static int wlan_ret_802_11_rf_tx_power(wlan_private * priv,
395 struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp; 378 struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp;
396 wlan_adapter *adapter = priv->adapter; 379 wlan_adapter *adapter = priv->adapter;
397 380
398 ENTER(); 381 lbs_deb_enter(LBS_DEB_CMD);
399 382
400 adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel); 383 adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel);
401 384
402 lbs_pr_debug(1, "Current TxPower Level = %d\n", adapter->txpowerlevel); 385 lbs_deb_cmd("Current TxPower Level = %d\n", adapter->txpowerlevel);
403 386
404 LEAVE(); 387 lbs_deb_enter(LBS_DEB_CMD);
405 return 0; 388 return 0;
406} 389}
407 390
@@ -413,14 +396,12 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv,
413 u16 action = le16_to_cpu(pAntenna->action); 396 u16 action = le16_to_cpu(pAntenna->action);
414 397
415 if (action == cmd_act_get_rx) 398 if (action == cmd_act_get_rx)
416 adapter->rxantennamode = 399 adapter->rxantennamode = le16_to_cpu(pAntenna->antennamode);
417 le16_to_cpu(pAntenna->antennamode);
418 400
419 if (action == cmd_act_get_tx) 401 if (action == cmd_act_get_tx)
420 adapter->txantennamode = 402 adapter->txantennamode = le16_to_cpu(pAntenna->antennamode);
421 le16_to_cpu(pAntenna->antennamode);
422 403
423 lbs_pr_debug(1, "RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n", 404 lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n",
424 action, le16_to_cpu(pAntenna->antennamode)); 405 action, le16_to_cpu(pAntenna->antennamode));
425 406
426 return 0; 407 return 0;
@@ -429,19 +410,17 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv,
429static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv, 410static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv,
430 struct cmd_ds_command *resp) 411 struct cmd_ds_command *resp)
431{ 412{
432 struct cmd_ds_802_11_rate_adapt_rateset *rates = 413 struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset;
433 &resp->params.rateset;
434 wlan_adapter *adapter = priv->adapter; 414 wlan_adapter *adapter = priv->adapter;
435 415
436 ENTER(); 416 lbs_deb_enter(LBS_DEB_CMD);
437 417
438 if (rates->action == cmd_act_get) { 418 if (rates->action == cmd_act_get) {
439 adapter->enablehwauto = rates->enablehwauto; 419 adapter->enablehwauto = le16_to_cpu(rates->enablehwauto);
440 adapter->ratebitmap = rates->bitmap; 420 adapter->ratebitmap = le16_to_cpu(rates->bitmap);
441 } 421 }
442 422
443 LEAVE(); 423 lbs_deb_enter(LBS_DEB_CMD);
444
445 return 0; 424 return 0;
446} 425}
447 426
@@ -452,43 +431,42 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv,
452 wlan_adapter *adapter = priv->adapter; 431 wlan_adapter *adapter = priv->adapter;
453 u8 dot11datarate; 432 u8 dot11datarate;
454 433
455 ENTER(); 434 lbs_deb_enter(LBS_DEB_CMD);
456 435
457 lbs_dbg_hex("DATA_RATE_RESP: data_rate- ", 436 lbs_dbg_hex("DATA_RATE_RESP: data_rate- ",
458 (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate)); 437 (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate));
459 438
460 dot11datarate = pdatarate->datarate[0]; 439 dot11datarate = pdatarate->datarate[0];
461 if (pdatarate->action == cmd_act_get_tx_rate) { 440 if (pdatarate->action == cpu_to_le16(cmd_act_get_tx_rate)) {
462 memcpy(adapter->libertas_supported_rates, pdatarate->datarate, 441 memcpy(adapter->libertas_supported_rates, pdatarate->datarate,
463 sizeof(adapter->libertas_supported_rates)); 442 sizeof(adapter->libertas_supported_rates));
464 } 443 }
465 adapter->datarate = libertas_index_to_data_rate(dot11datarate); 444 adapter->datarate = libertas_index_to_data_rate(dot11datarate);
466 445
467 LEAVE(); 446 lbs_deb_enter(LBS_DEB_CMD);
468 return 0; 447 return 0;
469} 448}
470 449
471static int wlan_ret_802_11_rf_channel(wlan_private * priv, 450static int wlan_ret_802_11_rf_channel(wlan_private * priv,
472 struct cmd_ds_command *resp) 451 struct cmd_ds_command *resp)
473{ 452{
474 struct cmd_ds_802_11_rf_channel *rfchannel = 453 struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel;
475 &resp->params.rfchannel;
476 wlan_adapter *adapter = priv->adapter; 454 wlan_adapter *adapter = priv->adapter;
477 u16 action = le16_to_cpu(rfchannel->action); 455 u16 action = le16_to_cpu(rfchannel->action);
478 u16 newchannel = le16_to_cpu(rfchannel->currentchannel); 456 u16 newchannel = le16_to_cpu(rfchannel->currentchannel);
479 457
480 ENTER(); 458 lbs_deb_enter(LBS_DEB_CMD);
481 459
482 if (action == cmd_opt_802_11_rf_channel_get 460 if (action == cmd_opt_802_11_rf_channel_get
483 && adapter->curbssparams.channel != newchannel) { 461 && adapter->curbssparams.channel != newchannel) {
484 lbs_pr_debug(1, "channel Switch: %d to %d\n", 462 lbs_deb_cmd("channel Switch: %d to %d\n",
485 adapter->curbssparams.channel, newchannel); 463 adapter->curbssparams.channel, newchannel);
486 464
487 /* Update the channel again */ 465 /* Update the channel again */
488 adapter->curbssparams.channel = newchannel; 466 adapter->curbssparams.channel = newchannel;
489 } 467 }
490 468
491 LEAVE(); 469 lbs_deb_enter(LBS_DEB_CMD);
492 return 0; 470 return 0;
493} 471}
494 472
@@ -500,12 +478,10 @@ static int wlan_ret_802_11_rssi(wlan_private * priv,
500 478
501 /* store the non average value */ 479 /* store the non average value */
502 adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); 480 adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR);
503 adapter->NF[TYPE_BEACON][TYPE_NOAVG] = 481 adapter->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor);
504 le16_to_cpu(rssirsp->noisefloor);
505 482
506 adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); 483 adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR);
507 adapter->NF[TYPE_BEACON][TYPE_AVG] = 484 adapter->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor);
508 le16_to_cpu(rssirsp->avgnoisefloor);
509 485
510 adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = 486 adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] =
511 CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], 487 CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG],
@@ -515,7 +491,7 @@ static int wlan_ret_802_11_rssi(wlan_private * priv,
515 CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE, 491 CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE,
516 adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE); 492 adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE);
517 493
518 lbs_pr_debug(1, "Beacon RSSI value = 0x%x\n", 494 lbs_deb_cmd("Beacon RSSI value = 0x%x\n",
519 adapter->RSSI[TYPE_BEACON][TYPE_AVG]); 495 adapter->RSSI[TYPE_BEACON][TYPE_AVG]);
520 496
521 return 0; 497 return 0;
@@ -528,11 +504,11 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv,
528 struct wlan_ioctl_regrdwr *pbuf; 504 struct wlan_ioctl_regrdwr *pbuf;
529 pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom; 505 pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom;
530 506
531 lbs_pr_debug(1, "eeprom read len=%x\n", 507 lbs_deb_cmd("eeprom read len=%x\n",
532 le16_to_cpu(resp->params.rdeeprom.bytecount)); 508 le16_to_cpu(resp->params.rdeeprom.bytecount));
533 if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) { 509 if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) {
534 pbuf->NOB = 0; 510 pbuf->NOB = 0;
535 lbs_pr_debug(1, "eeprom read return length is too big\n"); 511 lbs_deb_cmd("eeprom read return length is too big\n");
536 return -1; 512 return -1;
537 } 513 }
538 pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount); 514 pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount);
@@ -549,17 +525,15 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv,
549static int wlan_ret_get_log(wlan_private * priv, 525static int wlan_ret_get_log(wlan_private * priv,
550 struct cmd_ds_command *resp) 526 struct cmd_ds_command *resp)
551{ 527{
552 struct cmd_ds_802_11_get_log *logmessage = 528 struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog;
553 (struct cmd_ds_802_11_get_log *)&resp->params.glog;
554 wlan_adapter *adapter = priv->adapter; 529 wlan_adapter *adapter = priv->adapter;
555 530
556 ENTER(); 531 lbs_deb_enter(LBS_DEB_CMD);
557 532
558 /* TODO Convert it to Big Endian before copy */ 533 /* Stored little-endian */
559 memcpy(&adapter->logmsg, logmessage, 534 memcpy(&adapter->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log));
560 sizeof(struct cmd_ds_802_11_get_log));
561 535
562 LEAVE(); 536 lbs_deb_enter(LBS_DEB_CMD);
563 return 0; 537 return 0;
564} 538}
565 539
@@ -620,8 +594,7 @@ static inline int handle_cmd_response(u16 respcmd,
620 case cmd_ret_802_11_set_afc: 594 case cmd_ret_802_11_set_afc:
621 case cmd_ret_802_11_get_afc: 595 case cmd_ret_802_11_get_afc:
622 spin_lock_irqsave(&adapter->driver_lock, flags); 596 spin_lock_irqsave(&adapter->driver_lock, flags);
623 memmove(adapter->cur_cmd->pdata_buf, 597 memmove(adapter->cur_cmd->pdata_buf, &resp->params.afc,
624 &resp->params.afc,
625 sizeof(struct cmd_ds_802_11_afc)); 598 sizeof(struct cmd_ds_802_11_afc));
626 spin_unlock_irqrestore(&adapter->driver_lock, flags); 599 spin_unlock_irqrestore(&adapter->driver_lock, flags);
627 600
@@ -663,7 +636,7 @@ static inline int handle_cmd_response(u16 respcmd,
663 break; 636 break;
664 637
665 case cmd_ret_802_11_key_material: 638 case cmd_ret_802_11_key_material:
666 lbs_pr_debug(1, "CMD_RESP: KEY_MATERIAL command response\n"); 639 lbs_deb_cmd("CMD_RESP: KEY_MATERIAL command response\n");
667 ret = wlan_ret_802_11_key_material(priv, resp); 640 ret = wlan_ret_802_11_key_material(priv, resp);
668 break; 641 break;
669 642
@@ -687,22 +660,19 @@ static inline int handle_cmd_response(u16 respcmd,
687 660
688 case cmd_ret_802_11_tpc_cfg: 661 case cmd_ret_802_11_tpc_cfg:
689 spin_lock_irqsave(&adapter->driver_lock, flags); 662 spin_lock_irqsave(&adapter->driver_lock, flags);
690 memmove(adapter->cur_cmd->pdata_buf, 663 memmove(adapter->cur_cmd->pdata_buf, &resp->params.tpccfg,
691 &resp->params.tpccfg,
692 sizeof(struct cmd_ds_802_11_tpc_cfg)); 664 sizeof(struct cmd_ds_802_11_tpc_cfg));
693 spin_unlock_irqrestore(&adapter->driver_lock, flags); 665 spin_unlock_irqrestore(&adapter->driver_lock, flags);
694 break; 666 break;
695 case cmd_ret_802_11_led_gpio_ctrl: 667 case cmd_ret_802_11_led_gpio_ctrl:
696 spin_lock_irqsave(&adapter->driver_lock, flags); 668 spin_lock_irqsave(&adapter->driver_lock, flags);
697 memmove(adapter->cur_cmd->pdata_buf, 669 memmove(adapter->cur_cmd->pdata_buf, &resp->params.ledgpio,
698 &resp->params.ledgpio,
699 sizeof(struct cmd_ds_802_11_led_ctrl)); 670 sizeof(struct cmd_ds_802_11_led_ctrl));
700 spin_unlock_irqrestore(&adapter->driver_lock, flags); 671 spin_unlock_irqrestore(&adapter->driver_lock, flags);
701 break; 672 break;
702 case cmd_ret_802_11_pwr_cfg: 673 case cmd_ret_802_11_pwr_cfg:
703 spin_lock_irqsave(&adapter->driver_lock, flags); 674 spin_lock_irqsave(&adapter->driver_lock, flags);
704 memmove(adapter->cur_cmd->pdata_buf, 675 memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg,
705 &resp->params.pwrcfg,
706 sizeof(struct cmd_ds_802_11_pwr_cfg)); 676 sizeof(struct cmd_ds_802_11_pwr_cfg));
707 spin_unlock_irqrestore(&adapter->driver_lock, flags); 677 spin_unlock_irqrestore(&adapter->driver_lock, flags);
708 678
@@ -724,23 +694,21 @@ static inline int handle_cmd_response(u16 respcmd,
724 case cmd_ret_fwt_access: 694 case cmd_ret_fwt_access:
725 spin_lock_irqsave(&adapter->driver_lock, flags); 695 spin_lock_irqsave(&adapter->driver_lock, flags);
726 if (adapter->cur_cmd->pdata_buf) 696 if (adapter->cur_cmd->pdata_buf)
727 memcpy(adapter->cur_cmd->pdata_buf, 697 memcpy(adapter->cur_cmd->pdata_buf, &resp->params.fwt,
728 &resp->params.fwt, 698 sizeof(resp->params.fwt));
729 sizeof(resp->params.fwt));
730 spin_unlock_irqrestore(&adapter->driver_lock, flags); 699 spin_unlock_irqrestore(&adapter->driver_lock, flags);
731 break; 700 break;
732 case cmd_ret_mesh_access: 701 case cmd_ret_mesh_access:
733 if (adapter->cur_cmd->pdata_buf) 702 if (adapter->cur_cmd->pdata_buf)
734 memcpy(adapter->cur_cmd->pdata_buf, 703 memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh,
735 &resp->params.mesh,
736 sizeof(resp->params.mesh)); 704 sizeof(resp->params.mesh));
737 break; 705 break;
738 case cmd_rte_802_11_tx_rate_query: 706 case cmd_rte_802_11_tx_rate_query:
739 priv->adapter->txrate = resp->params.txrate.txrate; 707 priv->adapter->txrate = resp->params.txrate.txrate;
740 break; 708 break;
741 default: 709 default:
742 lbs_pr_debug(1, "CMD_RESP: Unknown command response %#x\n", 710 lbs_deb_cmd("CMD_RESP: Unknown command response %#x\n",
743 resp->command); 711 resp->command);
744 break; 712 break;
745 } 713 }
746 return ret; 714 return ret;
@@ -755,9 +723,9 @@ int libertas_process_rx_command(wlan_private * priv)
755 ulong flags; 723 ulong flags;
756 u16 result; 724 u16 result;
757 725
758 ENTER(); 726 lbs_deb_enter(LBS_DEB_CMD);
759 727
760 lbs_pr_debug(1, "CMD_RESP: @ %lu\n", jiffies); 728 lbs_deb_cmd("CMD_RESP: @ %lu\n", jiffies);
761 729
762 /* Now we got response from FW, cancel the command timer */ 730 /* Now we got response from FW, cancel the command timer */
763 del_timer(&adapter->command_timer); 731 del_timer(&adapter->command_timer);
@@ -766,7 +734,7 @@ int libertas_process_rx_command(wlan_private * priv)
766 spin_lock_irqsave(&adapter->driver_lock, flags); 734 spin_lock_irqsave(&adapter->driver_lock, flags);
767 735
768 if (!adapter->cur_cmd) { 736 if (!adapter->cur_cmd) {
769 lbs_pr_debug(1, "CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd); 737 lbs_deb_cmd("CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd);
770 ret = -1; 738 ret = -1;
771 spin_unlock_irqrestore(&adapter->driver_lock, flags); 739 spin_unlock_irqrestore(&adapter->driver_lock, flags);
772 goto done; 740 goto done;
@@ -774,17 +742,17 @@ int libertas_process_rx_command(wlan_private * priv)
774 resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr); 742 resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr);
775 743
776 lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr, 744 lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr,
777 priv->wlan_dev.upld_len); 745 priv->upld_len);
778 746
779 respcmd = le16_to_cpu(resp->command); 747 respcmd = le16_to_cpu(resp->command);
780 748
781 result = le16_to_cpu(resp->result); 749 result = le16_to_cpu(resp->result);
782 750
783 lbs_pr_debug(1, "CMD_RESP: %x result: %d length: %d\n", respcmd, 751 lbs_deb_cmd("CMD_RESP: %x result: %d length: %d\n", respcmd,
784 result, priv->wlan_dev.upld_len); 752 result, priv->upld_len);
785 753
786 if (!(respcmd & 0x8000)) { 754 if (!(respcmd & 0x8000)) {
787 lbs_pr_debug(1, "Invalid response to command!"); 755 lbs_deb_cmd("Invalid response to command!");
788 adapter->cur_cmd_retcode = -1; 756 adapter->cur_cmd_retcode = -1;
789 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); 757 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
790 adapter->nr_cmd_pending--; 758 adapter->nr_cmd_pending--;
@@ -795,56 +763,52 @@ int libertas_process_rx_command(wlan_private * priv)
795 } 763 }
796 764
797 /* Store the response code to cur_cmd_retcode. */ 765 /* Store the response code to cur_cmd_retcode. */
798 adapter->cur_cmd_retcode = le16_to_cpu(resp->result); 766 adapter->cur_cmd_retcode = result;;
799 767
800 if (respcmd == cmd_ret_802_11_ps_mode) { 768 if (respcmd == cmd_ret_802_11_ps_mode) {
801 struct cmd_ds_802_11_ps_mode *psmode; 769 struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode;
770 u16 action = le16_to_cpu(psmode->action);
802 771
803 psmode = &resp->params.psmode; 772 lbs_deb_cmd(
804 lbs_pr_debug(1,
805 "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n", 773 "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n",
806 resp->result, psmode->action); 774 result, action);
807 psmode->action = cpu_to_le16(psmode->action);
808 775
809 if (result) { 776 if (result) {
810 lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n", 777 lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n",
811 resp->result); 778 result);
812 if (adapter->mode == IW_MODE_ADHOC) { 779 /*
813 /* 780 * We should not re-try enter-ps command in
814 * We should not re-try enter-ps command in 781 * ad-hoc mode. It takes place in
815 * ad-hoc mode. It takes place in 782 * libertas_execute_next_command().
816 * libertas_execute_next_command(). 783 */
817 */ 784 if (adapter->mode == IW_MODE_ADHOC &&
818 if (psmode->action == cmd_subcmd_enter_ps) 785 action == cmd_subcmd_enter_ps)
819 adapter->psmode = 786 adapter->psmode = wlan802_11powermodecam;
820 wlan802_11powermodecam; 787 } else if (action == cmd_subcmd_enter_ps) {
821 }
822 } else if (psmode->action == cmd_subcmd_enter_ps) {
823 adapter->needtowakeup = 0; 788 adapter->needtowakeup = 0;
824 adapter->psstate = PS_STATE_AWAKE; 789 adapter->psstate = PS_STATE_AWAKE;
825 790
826 lbs_pr_debug(1, "CMD_RESP: Enter_PS command response\n"); 791 lbs_deb_cmd("CMD_RESP: Enter_PS command response\n");
827 if (adapter->connect_status != libertas_connected) { 792 if (adapter->connect_status != libertas_connected) {
828 /* 793 /*
829 * When Deauth Event received before Enter_PS command 794 * When Deauth Event received before Enter_PS command
830 * response, We need to wake up the firmware. 795 * response, We need to wake up the firmware.
831 */ 796 */
832 lbs_pr_debug(1, 797 lbs_deb_cmd(
833 "Disconnected, Going to invoke libertas_ps_wakeup\n"); 798 "Disconnected, Going to invoke libertas_ps_wakeup\n");
834 799
835 mutex_unlock(&adapter->lock);
836 spin_unlock_irqrestore(&adapter->driver_lock, flags); 800 spin_unlock_irqrestore(&adapter->driver_lock, flags);
801 mutex_unlock(&adapter->lock);
837 libertas_ps_wakeup(priv, 0); 802 libertas_ps_wakeup(priv, 0);
838 mutex_lock(&adapter->lock); 803 mutex_lock(&adapter->lock);
839 spin_lock_irqsave(&adapter->driver_lock, flags); 804 spin_lock_irqsave(&adapter->driver_lock, flags);
840 } 805 }
841 } else if (psmode->action == cmd_subcmd_exit_ps) { 806 } else if (action == cmd_subcmd_exit_ps) {
842 adapter->needtowakeup = 0; 807 adapter->needtowakeup = 0;
843 adapter->psstate = PS_STATE_FULL_POWER; 808 adapter->psstate = PS_STATE_FULL_POWER;
844 lbs_pr_debug(1, "CMD_RESP: Exit_PS command response\n"); 809 lbs_deb_cmd("CMD_RESP: Exit_PS command response\n");
845 } else { 810 } else {
846 lbs_pr_debug(1, "CMD_RESP: PS- action=0x%X\n", 811 lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n", action);
847 psmode->action);
848 } 812 }
849 813
850 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); 814 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
@@ -865,15 +829,15 @@ int libertas_process_rx_command(wlan_private * priv)
865 829
866 /* If the command is not successful, cleanup and return failure */ 830 /* If the command is not successful, cleanup and return failure */
867 if ((result != 0 || !(respcmd & 0x8000))) { 831 if ((result != 0 || !(respcmd & 0x8000))) {
868 lbs_pr_debug(1, "CMD_RESP: command reply %#x result=%#x\n", 832 lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n",
869 resp->command, resp->result); 833 respcmd, result);
870 /* 834 /*
871 * Handling errors here 835 * Handling errors here
872 */ 836 */
873 switch (respcmd) { 837 switch (respcmd) {
874 case cmd_ret_hw_spec_info: 838 case cmd_ret_hw_spec_info:
875 case cmd_ret_802_11_reset: 839 case cmd_ret_802_11_reset:
876 lbs_pr_debug(1, "CMD_RESP: Reset command failed\n"); 840 lbs_deb_cmd("CMD_RESP: Reset command failed\n");
877 break; 841 break;
878 842
879 } 843 }
@@ -903,7 +867,7 @@ int libertas_process_rx_command(wlan_private * priv)
903 867
904done: 868done:
905 mutex_unlock(&adapter->lock); 869 mutex_unlock(&adapter->lock);
906 LEAVE(); 870 lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
907 return ret; 871 return ret;
908} 872}
909 873
@@ -917,37 +881,37 @@ int libertas_process_event(wlan_private * priv)
917 eventcause = adapter->eventcause; 881 eventcause = adapter->eventcause;
918 spin_unlock_irq(&adapter->driver_lock); 882 spin_unlock_irq(&adapter->driver_lock);
919 883
920 ENTER(); 884 lbs_deb_enter(LBS_DEB_CMD);
921 885
922 lbs_pr_debug(1, "EVENT Cause %x\n", eventcause); 886 lbs_deb_cmd("EVENT Cause %x\n", eventcause);
923 887
924 switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) { 888 switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) {
925 case MACREG_INT_CODE_LINK_SENSED: 889 case MACREG_INT_CODE_LINK_SENSED:
926 lbs_pr_debug(1, "EVENT: MACREG_INT_CODE_LINK_SENSED\n"); 890 lbs_deb_cmd("EVENT: MACREG_INT_CODE_LINK_SENSED\n");
927 break; 891 break;
928 892
929 case MACREG_INT_CODE_DEAUTHENTICATED: 893 case MACREG_INT_CODE_DEAUTHENTICATED:
930 lbs_pr_debug(1, "EVENT: Deauthenticated\n"); 894 lbs_deb_cmd("EVENT: Deauthenticated\n");
931 libertas_mac_event_disconnected(priv); 895 libertas_mac_event_disconnected(priv);
932 break; 896 break;
933 897
934 case MACREG_INT_CODE_DISASSOCIATED: 898 case MACREG_INT_CODE_DISASSOCIATED:
935 lbs_pr_debug(1, "EVENT: Disassociated\n"); 899 lbs_deb_cmd("EVENT: Disassociated\n");
936 libertas_mac_event_disconnected(priv); 900 libertas_mac_event_disconnected(priv);
937 break; 901 break;
938 902
939 case MACREG_INT_CODE_LINK_LOSE_NO_SCAN: 903 case MACREG_INT_CODE_LINK_LOSE_NO_SCAN:
940 lbs_pr_debug(1, "EVENT: Link lost\n"); 904 lbs_deb_cmd("EVENT: Link lost\n");
941 libertas_mac_event_disconnected(priv); 905 libertas_mac_event_disconnected(priv);
942 break; 906 break;
943 907
944 case MACREG_INT_CODE_PS_SLEEP: 908 case MACREG_INT_CODE_PS_SLEEP:
945 lbs_pr_debug(1, "EVENT: SLEEP\n"); 909 lbs_deb_cmd("EVENT: SLEEP\n");
946 lbs_pr_debug(1, "_"); 910 lbs_deb_cmd("_");
947 911
948 /* handle unexpected PS SLEEP event */ 912 /* handle unexpected PS SLEEP event */
949 if (adapter->psstate == PS_STATE_FULL_POWER) { 913 if (adapter->psstate == PS_STATE_FULL_POWER) {
950 lbs_pr_debug(1, 914 lbs_deb_cmd(
951 "EVENT: In FULL POWER mode - ignore PS SLEEP\n"); 915 "EVENT: In FULL POWER mode - ignore PS SLEEP\n");
952 break; 916 break;
953 } 917 }
@@ -958,12 +922,12 @@ int libertas_process_event(wlan_private * priv)
958 break; 922 break;
959 923
960 case MACREG_INT_CODE_PS_AWAKE: 924 case MACREG_INT_CODE_PS_AWAKE:
961 lbs_pr_debug(1, "EVENT: AWAKE \n"); 925 lbs_deb_cmd("EVENT: AWAKE \n");
962 lbs_pr_debug(1, "|"); 926 lbs_deb_cmd("|");
963 927
964 /* handle unexpected PS AWAKE event */ 928 /* handle unexpected PS AWAKE event */
965 if (adapter->psstate == PS_STATE_FULL_POWER) { 929 if (adapter->psstate == PS_STATE_FULL_POWER) {
966 lbs_pr_debug(1, 930 lbs_deb_cmd(
967 "EVENT: In FULL POWER mode - ignore PS AWAKE\n"); 931 "EVENT: In FULL POWER mode - ignore PS AWAKE\n");
968 break; 932 break;
969 } 933 }
@@ -977,18 +941,18 @@ int libertas_process_event(wlan_private * priv)
977 * adapter->needtowakeup will be set to FALSE 941 * adapter->needtowakeup will be set to FALSE
978 * in libertas_ps_wakeup() 942 * in libertas_ps_wakeup()
979 */ 943 */
980 lbs_pr_debug(1, "Waking up...\n"); 944 lbs_deb_cmd("Waking up...\n");
981 libertas_ps_wakeup(priv, 0); 945 libertas_ps_wakeup(priv, 0);
982 } 946 }
983 break; 947 break;
984 948
985 case MACREG_INT_CODE_MIC_ERR_UNICAST: 949 case MACREG_INT_CODE_MIC_ERR_UNICAST:
986 lbs_pr_debug(1, "EVENT: UNICAST MIC ERROR\n"); 950 lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n");
987 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST); 951 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST);
988 break; 952 break;
989 953
990 case MACREG_INT_CODE_MIC_ERR_MULTICAST: 954 case MACREG_INT_CODE_MIC_ERR_MULTICAST:
991 lbs_pr_debug(1, "EVENT: MULTICAST MIC ERROR\n"); 955 lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
992 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST); 956 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
993 break; 957 break;
994 case MACREG_INT_CODE_MIB_CHANGED: 958 case MACREG_INT_CODE_MIB_CHANGED:
@@ -996,7 +960,7 @@ int libertas_process_event(wlan_private * priv)
996 break; 960 break;
997 961
998 case MACREG_INT_CODE_ADHOC_BCN_LOST: 962 case MACREG_INT_CODE_ADHOC_BCN_LOST:
999 lbs_pr_debug(1, "EVENT: HWAC - ADHOC BCN LOST\n"); 963 lbs_deb_cmd("EVENT: HWAC - ADHOC BCN LOST\n");
1000 break; 964 break;
1001 965
1002 case MACREG_INT_CODE_RSSI_LOW: 966 case MACREG_INT_CODE_RSSI_LOW:
@@ -1015,6 +979,17 @@ int libertas_process_event(wlan_private * priv)
1015 lbs_pr_alert( "EVENT: SNR_HIGH\n"); 979 lbs_pr_alert( "EVENT: SNR_HIGH\n");
1016 break; 980 break;
1017 981
982 case MACREG_INT_CODE_MESH_AUTO_STARTED:
983 lbs_pr_alert( "EVENT: MESH_AUTO_STARTED\n");
984 adapter->connect_status = libertas_connected ;
985 if (priv->mesh_open == 1) {
986 netif_wake_queue(priv->mesh_dev) ;
987 netif_carrier_on(priv->mesh_dev) ;
988 }
989 adapter->mode = IW_MODE_ADHOC ;
990 schedule_work(&priv->sync_channel);
991 break;
992
1018 default: 993 default:
1019 lbs_pr_alert( "EVENT: unknown event id: %#x\n", 994 lbs_pr_alert( "EVENT: unknown event id: %#x\n",
1020 eventcause >> SBI_EVENT_CAUSE_SHIFT); 995 eventcause >> SBI_EVENT_CAUSE_SHIFT);
@@ -1024,6 +999,7 @@ int libertas_process_event(wlan_private * priv)
1024 spin_lock_irq(&adapter->driver_lock); 999 spin_lock_irq(&adapter->driver_lock);
1025 adapter->eventcause = 0; 1000 adapter->eventcause = 0;
1026 spin_unlock_irq(&adapter->driver_lock); 1001 spin_unlock_irq(&adapter->driver_lock);
1027 LEAVE(); 1002
1003 lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
1028 return ret; 1004 return ret;
1029} 1005}