diff options
Diffstat (limited to 'drivers')
21 files changed, 715 insertions, 796 deletions
diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c index 261bbd55e94f..4cf0ff7b833d 100644 --- a/drivers/net/wireless/libertas/11d.c +++ b/drivers/net/wireless/libertas/11d.c | |||
@@ -570,7 +570,7 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv, | |||
570 | cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); | 570 | cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); |
571 | } | 571 | } |
572 | 572 | ||
573 | lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, (int)(cmd->size)); | 573 | lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, le16_to_cpu(cmd->size)); |
574 | 574 | ||
575 | done: | 575 | done: |
576 | lbs_deb_enter(LBS_DEB_11D); | 576 | lbs_deb_enter(LBS_DEB_11D); |
@@ -611,8 +611,7 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq) | |||
611 | int libertas_ret_802_11d_domain_info(wlan_private * priv, | 611 | int libertas_ret_802_11d_domain_info(wlan_private * priv, |
612 | struct cmd_ds_command *resp) | 612 | struct cmd_ds_command *resp) |
613 | { | 613 | { |
614 | struct cmd_ds_802_11d_domain_info | 614 | struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp; |
615 | *domaininfo = &resp->params.domaininforesp; | ||
616 | struct mrvlietypes_domainparamset *domain = &domaininfo->domain; | 615 | struct mrvlietypes_domainparamset *domain = &domaininfo->domain; |
617 | u16 action = le16_to_cpu(domaininfo->action); | 616 | u16 action = le16_to_cpu(domaininfo->action); |
618 | s16 ret = 0; | 617 | s16 ret = 0; |
@@ -623,8 +622,8 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv, | |||
623 | lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp, | 622 | lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp, |
624 | (int)le16_to_cpu(resp->size)); | 623 | (int)le16_to_cpu(resp->size)); |
625 | 624 | ||
626 | nr_subband = (domain->header.len - 3) / sizeof(struct ieeetypes_subbandset); | 625 | nr_subband = (le16_to_cpu(domain->header.len) - COUNTRY_CODE_LEN) / |
627 | /* countrycode 3 bytes */ | 626 | sizeof(struct ieeetypes_subbandset); |
628 | 627 | ||
629 | lbs_deb_11d("11D Domain Info Resp: nr_subband=%d\n", nr_subband); | 628 | lbs_deb_11d("11D Domain Info Resp: nr_subband=%d\n", nr_subband); |
630 | 629 | ||
diff --git a/drivers/net/wireless/libertas/11d.h b/drivers/net/wireless/libertas/11d.h index 982d7929eed7..73e42e712911 100644 --- a/drivers/net/wireless/libertas/11d.h +++ b/drivers/net/wireless/libertas/11d.h | |||
@@ -47,7 +47,7 @@ struct mrvlietypes_domainparamset { | |||
47 | } __attribute__ ((packed)); | 47 | } __attribute__ ((packed)); |
48 | 48 | ||
49 | struct cmd_ds_802_11d_domain_info { | 49 | struct cmd_ds_802_11d_domain_info { |
50 | u16 action; | 50 | __le16 action; |
51 | struct mrvlietypes_domainparamset domain; | 51 | struct mrvlietypes_domainparamset domain; |
52 | } __attribute__ ((packed)); | 52 | } __attribute__ ((packed)); |
53 | 53 | ||
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index 2ee38a25adef..c70c472f4e0e 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -209,7 +209,7 @@ static int assoc_helper_mode(wlan_private *priv, | |||
209 | cmd_802_11_snmp_mib, | 209 | cmd_802_11_snmp_mib, |
210 | 0, cmd_option_waitforrsp, | 210 | 0, cmd_option_waitforrsp, |
211 | OID_802_11_INFRASTRUCTURE_MODE, | 211 | OID_802_11_INFRASTRUCTURE_MODE, |
212 | (void *) (size_t) assoc_req->mode); | 212 | /* Shoot me now */ (void *) (size_t) assoc_req->mode); |
213 | 213 | ||
214 | done: | 214 | done: |
215 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); | 215 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); |
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 8da788e2ecf9..124e029f1bf4 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -25,13 +25,11 @@ static u16 commands_allowed_in_ps[] = { | |||
25 | * @param command the command ID | 25 | * @param command the command ID |
26 | * @return TRUE or FALSE | 26 | * @return TRUE or FALSE |
27 | */ | 27 | */ |
28 | static u8 is_command_allowed_in_ps(u16 command) | 28 | static u8 is_command_allowed_in_ps(__le16 command) |
29 | { | 29 | { |
30 | int count = sizeof(commands_allowed_in_ps) | ||
31 | / sizeof(commands_allowed_in_ps[0]); | ||
32 | int i; | 30 | int i; |
33 | 31 | ||
34 | for (i = 0; i < count; i++) { | 32 | for (i = 0; i < ARRAY_SIZE(commands_allowed_in_ps); i++) { |
35 | if (command == cpu_to_le16(commands_allowed_in_ps[i])) | 33 | if (command == cpu_to_le16(commands_allowed_in_ps[i])) |
36 | return 1; | 34 | return 1; |
37 | } | 35 | } |
@@ -46,8 +44,7 @@ static int wlan_cmd_hw_spec(wlan_private * priv, struct cmd_ds_command *cmd) | |||
46 | lbs_deb_enter(LBS_DEB_CMD); | 44 | lbs_deb_enter(LBS_DEB_CMD); |
47 | 45 | ||
48 | cmd->command = cpu_to_le16(cmd_get_hw_spec); | 46 | cmd->command = cpu_to_le16(cmd_get_hw_spec); |
49 | cmd->size = | 47 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN); |
50 | cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN); | ||
51 | memcpy(hwspec->permanentaddr, priv->adapter->current_addr, ETH_ALEN); | 48 | memcpy(hwspec->permanentaddr, priv->adapter->current_addr, ETH_ALEN); |
52 | 49 | ||
53 | lbs_deb_leave(LBS_DEB_CMD); | 50 | lbs_deb_leave(LBS_DEB_CMD); |
@@ -59,18 +56,16 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv, | |||
59 | u16 cmd_action) | 56 | u16 cmd_action) |
60 | { | 57 | { |
61 | struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode; | 58 | struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode; |
62 | u16 action = cmd_action; | ||
63 | wlan_adapter *adapter = priv->adapter; | 59 | wlan_adapter *adapter = priv->adapter; |
64 | 60 | ||
65 | lbs_deb_enter(LBS_DEB_CMD); | 61 | lbs_deb_enter(LBS_DEB_CMD); |
66 | 62 | ||
67 | cmd->command = cpu_to_le16(cmd_802_11_ps_mode); | 63 | cmd->command = cpu_to_le16(cmd_802_11_ps_mode); |
68 | cmd->size = | 64 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) + |
69 | cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) + | 65 | S_DS_GEN); |
70 | S_DS_GEN); | ||
71 | psm->action = cpu_to_le16(cmd_action); | 66 | psm->action = cpu_to_le16(cmd_action); |
72 | psm->multipledtim = 0; | 67 | psm->multipledtim = 0; |
73 | switch (action) { | 68 | switch (cmd_action) { |
74 | case cmd_subcmd_enter_ps: | 69 | case cmd_subcmd_enter_ps: |
75 | lbs_deb_cmd("PS command:" "SubCode- Enter PS\n"); | 70 | lbs_deb_cmd("PS command:" "SubCode- Enter PS\n"); |
76 | lbs_deb_cmd("locallisteninterval = %d\n", | 71 | lbs_deb_cmd("locallisteninterval = %d\n", |
@@ -114,8 +109,7 @@ static int wlan_cmd_802_11_inactivity_timeout(wlan_private * priv, | |||
114 | cmd->params.inactivity_timeout.action = cpu_to_le16(cmd_action); | 109 | cmd->params.inactivity_timeout.action = cpu_to_le16(cmd_action); |
115 | 110 | ||
116 | if (cmd_action) | 111 | if (cmd_action) |
117 | cmd->params.inactivity_timeout.timeout = | 112 | cmd->params.inactivity_timeout.timeout = cpu_to_le16(*timeout); |
118 | cpu_to_le16(*timeout); | ||
119 | else | 113 | else |
120 | cmd->params.inactivity_timeout.timeout = 0; | 114 | cmd->params.inactivity_timeout.timeout = 0; |
121 | 115 | ||
@@ -131,9 +125,8 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv, | |||
131 | 125 | ||
132 | lbs_deb_enter(LBS_DEB_CMD); | 126 | lbs_deb_enter(LBS_DEB_CMD); |
133 | 127 | ||
134 | cmd->size = | 128 | cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) + |
135 | cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) + | 129 | S_DS_GEN); |
136 | S_DS_GEN); | ||
137 | cmd->command = cpu_to_le16(cmd_802_11_sleep_params); | 130 | cmd->command = cpu_to_le16(cmd_802_11_sleep_params); |
138 | 131 | ||
139 | if (cmd_action == cmd_act_get) { | 132 | if (cmd_action == cmd_act_get) { |
@@ -167,8 +160,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, | |||
167 | lbs_deb_enter(LBS_DEB_CMD); | 160 | lbs_deb_enter(LBS_DEB_CMD); |
168 | 161 | ||
169 | cmd->command = cpu_to_le16(cmd_802_11_set_wep); | 162 | cmd->command = cpu_to_le16(cmd_802_11_set_wep); |
170 | cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_set_wep)) | 163 | cmd->size = cpu_to_le16(sizeof(*wep) + S_DS_GEN); |
171 | + S_DS_GEN); | ||
172 | 164 | ||
173 | if (cmd_act == cmd_act_add) { | 165 | if (cmd_act == cmd_act_add) { |
174 | int i; | 166 | int i; |
@@ -182,11 +174,10 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, | |||
182 | wep->action = cpu_to_le16(cmd_act_add); | 174 | wep->action = cpu_to_le16(cmd_act_add); |
183 | 175 | ||
184 | /* default tx key index */ | 176 | /* default tx key index */ |
185 | wep->keyindex = cpu_to_le16((u16) | 177 | wep->keyindex = cpu_to_le16((u16)(assoc_req->wep_tx_keyidx & |
186 | (assoc_req->wep_tx_keyidx & | 178 | (u32)cmd_WEP_KEY_INDEX_MASK)); |
187 | (u32)cmd_WEP_KEY_INDEX_MASK)); | ||
188 | 179 | ||
189 | lbs_deb_cmd("Tx key Index: %u\n", wep->keyindex); | 180 | lbs_deb_cmd("Tx key Index: %u\n", le16_to_cpu(wep->keyindex)); |
190 | 181 | ||
191 | /* Copy key types and material to host command structure */ | 182 | /* Copy key types and material to host command structure */ |
192 | for (i = 0; i < 4; i++) { | 183 | for (i = 0; i < 4; i++) { |
@@ -194,12 +185,14 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, | |||
194 | 185 | ||
195 | switch (pkey->len) { | 186 | switch (pkey->len) { |
196 | case KEY_LEN_WEP_40: | 187 | case KEY_LEN_WEP_40: |
197 | wep->keytype[i] = cmd_type_wep_40_bit; | 188 | wep->keytype[i] = |
189 | cpu_to_le16(cmd_type_wep_40_bit); | ||
198 | memmove(&wep->keymaterial[i], pkey->key, | 190 | memmove(&wep->keymaterial[i], pkey->key, |
199 | pkey->len); | 191 | pkey->len); |
200 | break; | 192 | break; |
201 | case KEY_LEN_WEP_104: | 193 | case KEY_LEN_WEP_104: |
202 | wep->keytype[i] = cmd_type_wep_104_bit; | 194 | wep->keytype[i] = |
195 | cpu_to_le16(cmd_type_wep_104_bit); | ||
203 | memmove(&wep->keymaterial[i], pkey->key, | 196 | memmove(&wep->keymaterial[i], pkey->key, |
204 | pkey->len); | 197 | pkey->len); |
205 | break; | 198 | break; |
@@ -218,9 +211,8 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, | |||
218 | wep->action = cpu_to_le16(cmd_act_remove); | 211 | wep->action = cpu_to_le16(cmd_act_remove); |
219 | 212 | ||
220 | /* default tx key index */ | 213 | /* default tx key index */ |
221 | wep->keyindex = cpu_to_le16((u16) | 214 | wep->keyindex = cpu_to_le16((u16)(adapter->wep_tx_keyidx & |
222 | (adapter->wep_tx_keyidx & | 215 | (u32)cmd_WEP_KEY_INDEX_MASK)); |
223 | (u32)cmd_WEP_KEY_INDEX_MASK)); | ||
224 | } | 216 | } |
225 | 217 | ||
226 | ret = 0; | 218 | ret = 0; |
@@ -241,8 +233,7 @@ static int wlan_cmd_802_11_enable_rsn(wlan_private * priv, | |||
241 | lbs_deb_enter(LBS_DEB_CMD); | 233 | lbs_deb_enter(LBS_DEB_CMD); |
242 | 234 | ||
243 | cmd->command = cpu_to_le16(cmd_802_11_enable_rsn); | 235 | cmd->command = cpu_to_le16(cmd_802_11_enable_rsn); |
244 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_enable_rsn) + | 236 | cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN); |
245 | S_DS_GEN); | ||
246 | penableRSN->action = cpu_to_le16(cmd_action); | 237 | penableRSN->action = cpu_to_le16(cmd_action); |
247 | if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { | 238 | if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { |
248 | penableRSN->enable = cpu_to_le16(cmd_enable_rsn); | 239 | penableRSN->enable = cpu_to_le16(cmd_enable_rsn); |
@@ -353,8 +344,7 @@ static int wlan_cmd_802_11_get_stat(wlan_private * priv, | |||
353 | { | 344 | { |
354 | cmd->command = cpu_to_le16(cmd_802_11_get_stat); | 345 | cmd->command = cpu_to_le16(cmd_802_11_get_stat); |
355 | cmd->size = | 346 | cmd->size = |
356 | cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + | 347 | cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + S_DS_GEN); |
357 | S_DS_GEN); | ||
358 | 348 | ||
359 | return 0; | 349 | return 0; |
360 | } | 350 | } |
@@ -373,9 +363,7 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, | |||
373 | lbs_deb_cmd("SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); | 363 | lbs_deb_cmd("SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); |
374 | 364 | ||
375 | cmd->command = cpu_to_le16(cmd_802_11_snmp_mib); | 365 | cmd->command = cpu_to_le16(cmd_802_11_snmp_mib); |
376 | cmd->size = | 366 | cmd->size = cpu_to_le16(sizeof(*pSNMPMIB) + S_DS_GEN); |
377 | cpu_to_le16(sizeof(struct cmd_ds_802_11_snmp_mib) + | ||
378 | S_DS_GEN); | ||
379 | 367 | ||
380 | switch (cmd_oid) { | 368 | switch (cmd_oid) { |
381 | case OID_802_11_INFRASTRUCTURE_MODE: | 369 | case OID_802_11_INFRASTRUCTURE_MODE: |
@@ -406,7 +394,7 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, | |||
406 | pSNMPMIB->querytype = cmd_act_set; | 394 | pSNMPMIB->querytype = cmd_act_set; |
407 | pSNMPMIB->bufsize = sizeof(u16); | 395 | pSNMPMIB->bufsize = sizeof(u16); |
408 | ulTemp = *(u32 *)pdata_buf; | 396 | ulTemp = *(u32 *)pdata_buf; |
409 | *((unsigned short *)(pSNMPMIB->value)) = | 397 | *((__le16 *)(pSNMPMIB->value)) = |
410 | cpu_to_le16((u16) ulTemp); | 398 | cpu_to_le16((u16) ulTemp); |
411 | } | 399 | } |
412 | break; | 400 | break; |
@@ -419,15 +407,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, | |||
419 | pSNMPMIB->oid = cpu_to_le16((u16) fragthresh_i); | 407 | pSNMPMIB->oid = cpu_to_le16((u16) fragthresh_i); |
420 | 408 | ||
421 | if (cmd_action == cmd_act_get) { | 409 | if (cmd_action == cmd_act_get) { |
422 | pSNMPMIB->querytype = | 410 | pSNMPMIB->querytype = cpu_to_le16(cmd_act_get); |
423 | cpu_to_le16(cmd_act_get); | ||
424 | } else if (cmd_action == cmd_act_set) { | 411 | } else if (cmd_action == cmd_act_set) { |
425 | pSNMPMIB->querytype = | 412 | pSNMPMIB->querytype = cpu_to_le16(cmd_act_set); |
426 | cpu_to_le16(cmd_act_set); | 413 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); |
427 | pSNMPMIB->bufsize = | ||
428 | cpu_to_le16(sizeof(u16)); | ||
429 | ulTemp = *((u32 *) pdata_buf); | 414 | ulTemp = *((u32 *) pdata_buf); |
430 | *((unsigned short *)(pSNMPMIB->value)) = | 415 | *((__le16 *)(pSNMPMIB->value)) = |
431 | cpu_to_le16((u16) ulTemp); | 416 | cpu_to_le16((u16) ulTemp); |
432 | 417 | ||
433 | } | 418 | } |
@@ -442,16 +427,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, | |||
442 | pSNMPMIB->oid = le16_to_cpu((u16) rtsthresh_i); | 427 | pSNMPMIB->oid = le16_to_cpu((u16) rtsthresh_i); |
443 | 428 | ||
444 | if (cmd_action == cmd_act_get) { | 429 | if (cmd_action == cmd_act_get) { |
445 | pSNMPMIB->querytype = | 430 | pSNMPMIB->querytype = cpu_to_le16(cmd_act_get); |
446 | cpu_to_le16(cmd_act_get); | ||
447 | } else if (cmd_action == cmd_act_set) { | 431 | } else if (cmd_action == cmd_act_set) { |
448 | pSNMPMIB->querytype = | 432 | pSNMPMIB->querytype = cpu_to_le16(cmd_act_set); |
449 | cpu_to_le16(cmd_act_set); | 433 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); |
450 | pSNMPMIB->bufsize = | 434 | ulTemp = *((u32 *)pdata_buf); |
451 | cpu_to_le16(sizeof(u16)); | 435 | *(__le16 *)(pSNMPMIB->value) = |
452 | ulTemp = *((u32 *) | ||
453 | pdata_buf); | ||
454 | *(unsigned short *)(pSNMPMIB->value) = | ||
455 | cpu_to_le16((u16) ulTemp); | 436 | cpu_to_le16((u16) ulTemp); |
456 | 437 | ||
457 | } | 438 | } |
@@ -461,13 +442,11 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, | |||
461 | pSNMPMIB->oid = cpu_to_le16((u16) short_retrylim_i); | 442 | pSNMPMIB->oid = cpu_to_le16((u16) short_retrylim_i); |
462 | 443 | ||
463 | if (cmd_action == cmd_act_get) { | 444 | if (cmd_action == cmd_act_get) { |
464 | pSNMPMIB->querytype = | 445 | pSNMPMIB->querytype = cpu_to_le16(cmd_act_get); |
465 | cpu_to_le16(cmd_act_get); | ||
466 | } else if (cmd_action == cmd_act_set) { | 446 | } else if (cmd_action == cmd_act_set) { |
467 | pSNMPMIB->querytype = | 447 | pSNMPMIB->querytype = cpu_to_le16(cmd_act_set); |
468 | cpu_to_le16(cmd_act_set); | ||
469 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); | 448 | pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); |
470 | *((unsigned short *)(pSNMPMIB->value)) = | 449 | *((__le16 *)(pSNMPMIB->value)) = |
471 | cpu_to_le16((u16) adapter->txretrycount); | 450 | cpu_to_le16((u16) adapter->txretrycount); |
472 | } | 451 | } |
473 | 452 | ||
@@ -478,12 +457,14 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, | |||
478 | 457 | ||
479 | lbs_deb_cmd( | 458 | lbs_deb_cmd( |
480 | "SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n", | 459 | "SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n", |
481 | cmd->command, cmd->size, cmd->seqnum, cmd->result); | 460 | le16_to_cpu(cmd->command), le16_to_cpu(cmd->size), |
461 | le16_to_cpu(cmd->seqnum), le16_to_cpu(cmd->result)); | ||
482 | 462 | ||
483 | lbs_deb_cmd( | 463 | lbs_deb_cmd( |
484 | "SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n", | 464 | "SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n", |
485 | pSNMPMIB->querytype, pSNMPMIB->oid, pSNMPMIB->bufsize, | 465 | le16_to_cpu(pSNMPMIB->querytype), le16_to_cpu(pSNMPMIB->oid), |
486 | *(u16 *) pSNMPMIB->value); | 466 | le16_to_cpu(pSNMPMIB->bufsize), |
467 | le16_to_cpu(*(__le16 *) pSNMPMIB->value)); | ||
487 | 468 | ||
488 | lbs_deb_leave(LBS_DEB_CMD); | 469 | lbs_deb_leave(LBS_DEB_CMD); |
489 | return 0; | 470 | return 0; |
@@ -494,8 +475,7 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv, | |||
494 | int cmd_action) | 475 | int cmd_action) |
495 | { | 476 | { |
496 | wlan_adapter *adapter = priv->adapter; | 477 | wlan_adapter *adapter = priv->adapter; |
497 | struct cmd_ds_802_11_radio_control *pradiocontrol = | 478 | struct cmd_ds_802_11_radio_control *pradiocontrol = &cmd->params.radio; |
498 | &cmd->params.radio; | ||
499 | 479 | ||
500 | lbs_deb_enter(LBS_DEB_CMD); | 480 | lbs_deb_enter(LBS_DEB_CMD); |
501 | 481 | ||
@@ -540,13 +520,13 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv, | |||
540 | lbs_deb_enter(LBS_DEB_CMD); | 520 | lbs_deb_enter(LBS_DEB_CMD); |
541 | 521 | ||
542 | cmd->size = | 522 | cmd->size = |
543 | cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) + | 523 | cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) + S_DS_GEN); |
544 | S_DS_GEN); | ||
545 | cmd->command = cpu_to_le16(cmd_802_11_rf_tx_power); | 524 | cmd->command = cpu_to_le16(cmd_802_11_rf_tx_power); |
546 | prtp->action = cmd_action; | 525 | prtp->action = cpu_to_le16(cmd_action); |
547 | 526 | ||
548 | lbs_deb_cmd("RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n", cmd->size, | 527 | lbs_deb_cmd("RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n", |
549 | cmd->command, prtp->action); | 528 | le16_to_cpu(cmd->size), le16_to_cpu(cmd->command), |
529 | le16_to_cpu(prtp->action)); | ||
550 | 530 | ||
551 | switch (cmd_action) { | 531 | switch (cmd_action) { |
552 | case cmd_act_tx_power_opt_get: | 532 | case cmd_act_tx_power_opt_get: |
@@ -556,14 +536,12 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv, | |||
556 | 536 | ||
557 | case cmd_act_tx_power_opt_set_high: | 537 | case cmd_act_tx_power_opt_set_high: |
558 | prtp->action = cpu_to_le16(cmd_act_set); | 538 | prtp->action = cpu_to_le16(cmd_act_set); |
559 | prtp->currentlevel = | 539 | prtp->currentlevel = cpu_to_le16(cmd_act_tx_power_index_high); |
560 | cpu_to_le16(cmd_act_tx_power_index_high); | ||
561 | break; | 540 | break; |
562 | 541 | ||
563 | case cmd_act_tx_power_opt_set_mid: | 542 | case cmd_act_tx_power_opt_set_mid: |
564 | prtp->action = cpu_to_le16(cmd_act_set); | 543 | prtp->action = cpu_to_le16(cmd_act_set); |
565 | prtp->currentlevel = | 544 | prtp->currentlevel = cpu_to_le16(cmd_act_tx_power_index_mid); |
566 | cpu_to_le16(cmd_act_tx_power_index_mid); | ||
567 | break; | 545 | break; |
568 | 546 | ||
569 | case cmd_act_tx_power_opt_set_low: | 547 | case cmd_act_tx_power_opt_set_low: |
@@ -583,15 +561,12 @@ static int wlan_cmd_802_11_rf_antenna(wlan_private * priv, | |||
583 | struct cmd_ds_802_11_rf_antenna *rant = &cmd->params.rant; | 561 | struct cmd_ds_802_11_rf_antenna *rant = &cmd->params.rant; |
584 | 562 | ||
585 | cmd->command = cpu_to_le16(cmd_802_11_rf_antenna); | 563 | cmd->command = cpu_to_le16(cmd_802_11_rf_antenna); |
586 | cmd->size = | 564 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_antenna) + |
587 | cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_antenna) + | 565 | S_DS_GEN); |
588 | S_DS_GEN); | ||
589 | 566 | ||
590 | rant->action = cpu_to_le16(cmd_action); | 567 | rant->action = cpu_to_le16(cmd_action); |
591 | if ((cmd_action == cmd_act_set_rx) || | 568 | if ((cmd_action == cmd_act_set_rx) || (cmd_action == cmd_act_set_tx)) { |
592 | (cmd_action == cmd_act_set_tx)) { | 569 | rant->antennamode = cpu_to_le16((u16) (*(u32 *) pdata_buf)); |
593 | rant->antennamode = | ||
594 | cpu_to_le16((u16) (*(u32 *) pdata_buf)); | ||
595 | } | 570 | } |
596 | 571 | ||
597 | return 0; | 572 | return 0; |
@@ -612,9 +587,9 @@ static int wlan_cmd_802_11_rate_adapt_rateset(wlan_private * priv, | |||
612 | 587 | ||
613 | lbs_deb_enter(LBS_DEB_CMD); | 588 | lbs_deb_enter(LBS_DEB_CMD); |
614 | 589 | ||
615 | rateadapt->action = cmd_action; | 590 | rateadapt->action = cpu_to_le16(cmd_action); |
616 | rateadapt->enablehwauto = adapter->enablehwauto; | 591 | rateadapt->enablehwauto = cpu_to_le16(adapter->enablehwauto); |
617 | rateadapt->bitmap = adapter->ratebitmap; | 592 | rateadapt->bitmap = cpu_to_le16(adapter->ratebitmap); |
618 | 593 | ||
619 | lbs_deb_leave(LBS_DEB_CMD); | 594 | lbs_deb_leave(LBS_DEB_CMD); |
620 | return 0; | 595 | return 0; |
@@ -626,12 +601,10 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv, | |||
626 | { | 601 | { |
627 | struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate; | 602 | struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate; |
628 | wlan_adapter *adapter = priv->adapter; | 603 | wlan_adapter *adapter = priv->adapter; |
629 | u16 action = cmd_action; | ||
630 | 604 | ||
631 | lbs_deb_enter(LBS_DEB_CMD); | 605 | lbs_deb_enter(LBS_DEB_CMD); |
632 | 606 | ||
633 | cmd->size = | 607 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) + |
634 | cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) + | ||
635 | S_DS_GEN); | 608 | S_DS_GEN); |
636 | 609 | ||
637 | cmd->command = cpu_to_le16(cmd_802_11_data_rate); | 610 | cmd->command = cpu_to_le16(cmd_802_11_data_rate); |
@@ -640,11 +613,11 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv, | |||
640 | 613 | ||
641 | pdatarate->action = cpu_to_le16(cmd_action); | 614 | pdatarate->action = cpu_to_le16(cmd_action); |
642 | 615 | ||
643 | if (action == cmd_act_set_tx_fix_rate) { | 616 | if (cmd_action == cmd_act_set_tx_fix_rate) { |
644 | pdatarate->datarate[0] = libertas_data_rate_to_index(adapter->datarate); | 617 | pdatarate->datarate[0] = libertas_data_rate_to_index(adapter->datarate); |
645 | lbs_deb_cmd("Setting FW for fixed rate 0x%02X\n", | 618 | lbs_deb_cmd("Setting FW for fixed rate 0x%02X\n", |
646 | adapter->datarate); | 619 | adapter->datarate); |
647 | } else if (action == cmd_act_set_tx_auto) { | 620 | } else if (cmd_action == cmd_act_set_tx_auto) { |
648 | lbs_deb_cmd("Setting FW for AUTO rate\n"); | 621 | lbs_deb_cmd("Setting FW for AUTO rate\n"); |
649 | } | 622 | } |
650 | 623 | ||
@@ -659,8 +632,7 @@ static int wlan_cmd_mac_multicast_adr(wlan_private * priv, | |||
659 | struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr; | 632 | struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr; |
660 | wlan_adapter *adapter = priv->adapter; | 633 | wlan_adapter *adapter = priv->adapter; |
661 | 634 | ||
662 | cmd->size = | 635 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) + |
663 | cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) + | ||
664 | S_DS_GEN); | 636 | S_DS_GEN); |
665 | cmd->command = cpu_to_le16(cmd_mac_multicast_adr); | 637 | cmd->command = cpu_to_le16(cmd_mac_multicast_adr); |
666 | 638 | ||
@@ -680,8 +652,8 @@ static int wlan_cmd_802_11_rf_channel(wlan_private * priv, | |||
680 | struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel; | 652 | struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel; |
681 | 653 | ||
682 | cmd->command = cpu_to_le16(cmd_802_11_rf_channel); | 654 | cmd->command = cpu_to_le16(cmd_802_11_rf_channel); |
683 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) | 655 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) + |
684 | + S_DS_GEN); | 656 | S_DS_GEN); |
685 | 657 | ||
686 | if (option == cmd_opt_802_11_rf_channel_set) { | 658 | if (option == cmd_opt_802_11_rf_channel_set) { |
687 | rfchan->currentchannel = cpu_to_le16(*((u16 *) pdata_buf)); | 659 | rfchan->currentchannel = cpu_to_le16(*((u16 *) pdata_buf)); |
@@ -698,9 +670,8 @@ static int wlan_cmd_802_11_rssi(wlan_private * priv, | |||
698 | wlan_adapter *adapter = priv->adapter; | 670 | wlan_adapter *adapter = priv->adapter; |
699 | 671 | ||
700 | cmd->command = cpu_to_le16(cmd_802_11_rssi); | 672 | cmd->command = cpu_to_le16(cmd_802_11_rssi); |
701 | cmd->size = | 673 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN); |
702 | cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN); | 674 | cmd->params.rssi.N = cpu_to_le16(priv->adapter->bcn_avg_factor); |
703 | cmd->params.rssi.N = priv->adapter->bcn_avg_factor; | ||
704 | 675 | ||
705 | /* reset Beacon SNR/NF/RSSI values */ | 676 | /* reset Beacon SNR/NF/RSSI values */ |
706 | adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = 0; | 677 | adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = 0; |
@@ -729,9 +700,8 @@ static int wlan_cmd_reg_access(wlan_private * priv, | |||
729 | struct cmd_ds_mac_reg_access *macreg; | 700 | struct cmd_ds_mac_reg_access *macreg; |
730 | 701 | ||
731 | cmdptr->size = | 702 | cmdptr->size = |
732 | cpu_to_le16(sizeof | 703 | cpu_to_le16(sizeof (struct cmd_ds_mac_reg_access) |
733 | (struct cmd_ds_mac_reg_access) | 704 | + S_DS_GEN); |
734 | + S_DS_GEN); | ||
735 | macreg = | 705 | macreg = |
736 | (struct cmd_ds_mac_reg_access *)&cmdptr->params. | 706 | (struct cmd_ds_mac_reg_access *)&cmdptr->params. |
737 | macreg; | 707 | macreg; |
@@ -796,8 +766,7 @@ static int wlan_cmd_802_11_mac_address(wlan_private * priv, | |||
796 | wlan_adapter *adapter = priv->adapter; | 766 | wlan_adapter *adapter = priv->adapter; |
797 | 767 | ||
798 | cmd->command = cpu_to_le16(cmd_802_11_mac_address); | 768 | cmd->command = cpu_to_le16(cmd_802_11_mac_address); |
799 | cmd->size = | 769 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) + |
800 | cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) + | ||
801 | S_DS_GEN); | 770 | S_DS_GEN); |
802 | cmd->result = 0; | 771 | cmd->result = 0; |
803 | 772 | ||
@@ -821,9 +790,8 @@ static int wlan_cmd_802_11_eeprom_access(wlan_private * priv, | |||
821 | lbs_deb_enter(LBS_DEB_CMD); | 790 | lbs_deb_enter(LBS_DEB_CMD); |
822 | 791 | ||
823 | cmd->command = cpu_to_le16(cmd_802_11_eeprom_access); | 792 | cmd->command = cpu_to_le16(cmd_802_11_eeprom_access); |
824 | cmd->size = | 793 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) + |
825 | cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) + | 794 | S_DS_GEN); |
826 | S_DS_GEN); | ||
827 | cmd->result = 0; | 795 | cmd->result = 0; |
828 | 796 | ||
829 | cmd->params.rdeeprom.action = cpu_to_le16(ea->action); | 797 | cmd->params.rdeeprom.action = cpu_to_le16(ea->action); |
@@ -842,8 +810,7 @@ static int wlan_cmd_bt_access(wlan_private * priv, | |||
842 | lbs_deb_cmd("BT CMD(%d)\n", cmd_action); | 810 | lbs_deb_cmd("BT CMD(%d)\n", cmd_action); |
843 | 811 | ||
844 | cmd->command = cpu_to_le16(cmd_bt_access); | 812 | cmd->command = cpu_to_le16(cmd_bt_access); |
845 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) | 813 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) + S_DS_GEN); |
846 | + S_DS_GEN); | ||
847 | cmd->result = 0; | 814 | cmd->result = 0; |
848 | bt_access->action = cpu_to_le16(cmd_action); | 815 | bt_access->action = cpu_to_le16(cmd_action); |
849 | 816 | ||
@@ -880,8 +847,7 @@ static int wlan_cmd_fwt_access(wlan_private * priv, | |||
880 | lbs_deb_cmd("FWT CMD(%d)\n", cmd_action); | 847 | lbs_deb_cmd("FWT CMD(%d)\n", cmd_action); |
881 | 848 | ||
882 | cmd->command = cpu_to_le16(cmd_fwt_access); | 849 | cmd->command = cpu_to_le16(cmd_fwt_access); |
883 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) | 850 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) + S_DS_GEN); |
884 | + S_DS_GEN); | ||
885 | cmd->result = 0; | 851 | cmd->result = 0; |
886 | 852 | ||
887 | if (pdata_buf) | 853 | if (pdata_buf) |
@@ -902,8 +868,7 @@ static int wlan_cmd_mesh_access(wlan_private * priv, | |||
902 | lbs_deb_cmd("FWT CMD(%d)\n", cmd_action); | 868 | lbs_deb_cmd("FWT CMD(%d)\n", cmd_action); |
903 | 869 | ||
904 | cmd->command = cpu_to_le16(cmd_mesh_access); | 870 | cmd->command = cpu_to_le16(cmd_mesh_access); |
905 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) | 871 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN); |
906 | + S_DS_GEN); | ||
907 | cmd->result = 0; | 872 | cmd->result = 0; |
908 | 873 | ||
909 | if (pdata_buf) | 874 | if (pdata_buf) |
@@ -937,7 +902,7 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u | |||
937 | /* Exit_PS command needs to be queued in the header always. */ | 902 | /* Exit_PS command needs to be queued in the header always. */ |
938 | if (cmdptr->command == cmd_802_11_ps_mode) { | 903 | if (cmdptr->command == cmd_802_11_ps_mode) { |
939 | struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode; | 904 | struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode; |
940 | if (psm->action == cmd_subcmd_exit_ps) { | 905 | if (psm->action == cpu_to_le16(cmd_subcmd_exit_ps)) { |
941 | if (adapter->psstate != PS_STATE_FULL_POWER) | 906 | if (adapter->psstate != PS_STATE_FULL_POWER) |
942 | addtail = 0; | 907 | addtail = 0; |
943 | } | 908 | } |
@@ -955,7 +920,7 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u | |||
955 | 920 | ||
956 | lbs_deb_cmd("QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n", | 921 | lbs_deb_cmd("QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n", |
957 | cmdnode, | 922 | cmdnode, |
958 | ((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command); | 923 | le16_to_cpu(((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command)); |
959 | 924 | ||
960 | done: | 925 | done: |
961 | lbs_deb_leave(LBS_DEB_CMD); | 926 | lbs_deb_leave(LBS_DEB_CMD); |
@@ -1009,7 +974,7 @@ static int DownloadcommandToStation(wlan_private * priv, | |||
1009 | adapter->cur_cmd_retcode = 0; | 974 | adapter->cur_cmd_retcode = 0; |
1010 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 975 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
1011 | lbs_deb_cmd("DNLD_CMD:: Before download, size of cmd = %d\n", | 976 | lbs_deb_cmd("DNLD_CMD:: Before download, size of cmd = %d\n", |
1012 | cmdptr->size); | 977 | le16_to_cpu(cmdptr->size)); |
1013 | 978 | ||
1014 | cmdsize = cmdptr->size; | 979 | cmdsize = cmdptr->size; |
1015 | 980 | ||
@@ -1034,8 +999,7 @@ static int DownloadcommandToStation(wlan_private * priv, | |||
1034 | lbs_dbg_hex("DNLD_CMD: command", cmdnode->bufvirtualaddr, cmdsize); | 999 | lbs_dbg_hex("DNLD_CMD: command", cmdnode->bufvirtualaddr, cmdsize); |
1035 | 1000 | ||
1036 | /* Setup the timer after transmit command */ | 1001 | /* Setup the timer after transmit command */ |
1037 | if (command == cmd_802_11_scan | 1002 | if (command == cmd_802_11_scan || command == cmd_802_11_authenticate |
1038 | || command == cmd_802_11_authenticate | ||
1039 | || command == cmd_802_11_associate) | 1003 | || command == cmd_802_11_associate) |
1040 | mod_timer(&adapter->command_timer, jiffies + (10*HZ)); | 1004 | mod_timer(&adapter->command_timer, jiffies + (10*HZ)); |
1041 | else | 1005 | else |
@@ -1056,12 +1020,11 @@ static int wlan_cmd_mac_control(wlan_private * priv, | |||
1056 | lbs_deb_enter(LBS_DEB_CMD); | 1020 | lbs_deb_enter(LBS_DEB_CMD); |
1057 | 1021 | ||
1058 | cmd->command = cpu_to_le16(cmd_mac_control); | 1022 | cmd->command = cpu_to_le16(cmd_mac_control); |
1059 | cmd->size = | 1023 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN); |
1060 | cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN); | ||
1061 | mac->action = cpu_to_le16(priv->adapter->currentpacketfilter); | 1024 | mac->action = cpu_to_le16(priv->adapter->currentpacketfilter); |
1062 | 1025 | ||
1063 | lbs_deb_cmd("wlan_cmd_mac_control(): action=0x%X size=%d\n", | 1026 | lbs_deb_cmd("wlan_cmd_mac_control(): action=0x%X size=%d\n", |
1064 | mac->action, cmd->size); | 1027 | le16_to_cpu(mac->action), le16_to_cpu(cmd->size)); |
1065 | 1028 | ||
1066 | lbs_deb_leave(LBS_DEB_CMD); | 1029 | lbs_deb_leave(LBS_DEB_CMD); |
1067 | return 0; | 1030 | return 0; |
@@ -1193,7 +1156,7 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1193 | adapter->seqnum++; | 1156 | adapter->seqnum++; |
1194 | cmdptr->seqnum = cpu_to_le16(adapter->seqnum); | 1157 | cmdptr->seqnum = cpu_to_le16(adapter->seqnum); |
1195 | 1158 | ||
1196 | cmdptr->command = cmd_no; | 1159 | cmdptr->command = cpu_to_le16(cmd_no); |
1197 | cmdptr->result = 0; | 1160 | cmdptr->result = 0; |
1198 | 1161 | ||
1199 | switch (cmd_no) { | 1162 | switch (cmd_no) { |
@@ -1329,9 +1292,8 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1329 | case cmd_802_11_get_afc: | 1292 | case cmd_802_11_get_afc: |
1330 | 1293 | ||
1331 | cmdptr->command = cpu_to_le16(cmd_no); | 1294 | cmdptr->command = cpu_to_le16(cmd_no); |
1332 | cmdptr->size = | 1295 | cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) + |
1333 | cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) + | 1296 | S_DS_GEN); |
1334 | S_DS_GEN); | ||
1335 | 1297 | ||
1336 | memmove(&cmdptr->params.afc, | 1298 | memmove(&cmdptr->params.afc, |
1337 | pdata_buf, sizeof(struct cmd_ds_802_11_afc)); | 1299 | pdata_buf, sizeof(struct cmd_ds_802_11_afc)); |
@@ -1410,17 +1372,14 @@ int libertas_prepare_and_send_command(wlan_private * priv, | |||
1410 | 1372 | ||
1411 | case cmd_get_tsf: | 1373 | case cmd_get_tsf: |
1412 | cmdptr->command = cpu_to_le16(cmd_get_tsf); | 1374 | cmdptr->command = cpu_to_le16(cmd_get_tsf); |
1413 | cmdptr->size = | 1375 | cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf) + |
1414 | cpu_to_le16(sizeof(struct cmd_ds_get_tsf) | 1376 | S_DS_GEN); |
1415 | + S_DS_GEN); | ||
1416 | ret = 0; | 1377 | ret = 0; |
1417 | break; | 1378 | break; |
1418 | case cmd_802_11_tx_rate_query: | 1379 | case cmd_802_11_tx_rate_query: |
1419 | cmdptr->command = | 1380 | cmdptr->command = cpu_to_le16(cmd_802_11_tx_rate_query); |
1420 | cpu_to_le16(cmd_802_11_tx_rate_query); | 1381 | cmdptr->size = cpu_to_le16(sizeof(struct cmd_tx_rate_query) + |
1421 | cmdptr->size = | 1382 | S_DS_GEN); |
1422 | cpu_to_le16(sizeof(struct cmd_tx_rate_query) + | ||
1423 | S_DS_GEN); | ||
1424 | adapter->txrate = 0; | 1383 | adapter->txrate = 0; |
1425 | ret = 0; | 1384 | ret = 0; |
1426 | break; | 1385 | break; |
@@ -1529,7 +1488,7 @@ done: | |||
1529 | */ | 1488 | */ |
1530 | int libertas_free_cmd_buffer(wlan_private * priv) | 1489 | int libertas_free_cmd_buffer(wlan_private * priv) |
1531 | { | 1490 | { |
1532 | u32 ulbufsize; | 1491 | u32 ulbufsize; /* Someone needs to die for this. Slowly and painfully */ |
1533 | unsigned int i; | 1492 | unsigned int i; |
1534 | struct cmd_ctrl_node *tempcmd_array; | 1493 | struct cmd_ctrl_node *tempcmd_array; |
1535 | wlan_adapter *adapter = priv->adapter; | 1494 | wlan_adapter *adapter = priv->adapter; |
@@ -1694,18 +1653,19 @@ int libertas_execute_next_command(wlan_private * priv) | |||
1694 | cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; | 1653 | cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; |
1695 | 1654 | ||
1696 | if (is_command_allowed_in_ps(cmdptr->command)) { | 1655 | if (is_command_allowed_in_ps(cmdptr->command)) { |
1697 | if ((adapter->psstate == PS_STATE_SLEEP) | 1656 | if ((adapter->psstate == PS_STATE_SLEEP) || |
1698 | || (adapter->psstate == PS_STATE_PRE_SLEEP) | 1657 | (adapter->psstate == PS_STATE_PRE_SLEEP)) { |
1699 | ) { | ||
1700 | lbs_deb_cmd( | 1658 | lbs_deb_cmd( |
1701 | "EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n", | 1659 | "EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n", |
1702 | cmdptr->command, adapter->psstate); | 1660 | le16_to_cpu(cmdptr->command), |
1661 | adapter->psstate); | ||
1703 | ret = -1; | 1662 | ret = -1; |
1704 | goto done; | 1663 | goto done; |
1705 | } | 1664 | } |
1706 | lbs_deb_cmd("EXEC_NEXT_CMD: OK to send command " | 1665 | lbs_deb_cmd("EXEC_NEXT_CMD: OK to send command " |
1707 | "0x%x in psstate %d\n", | 1666 | "0x%x in psstate %d\n", |
1708 | cmdptr->command, adapter->psstate); | 1667 | le16_to_cpu(cmdptr->command), |
1668 | adapter->psstate); | ||
1709 | } else if (adapter->psstate != PS_STATE_FULL_POWER) { | 1669 | } else if (adapter->psstate != PS_STATE_FULL_POWER) { |
1710 | /* | 1670 | /* |
1711 | * 1. Non-PS command: | 1671 | * 1. Non-PS command: |
@@ -1755,9 +1715,8 @@ int libertas_execute_next_command(wlan_private * priv) | |||
1755 | goto done; | 1715 | goto done; |
1756 | } | 1716 | } |
1757 | 1717 | ||
1758 | if ((adapter->psstate == PS_STATE_SLEEP) | 1718 | if ((adapter->psstate == PS_STATE_SLEEP) || |
1759 | || (adapter->psstate == PS_STATE_PRE_SLEEP) | 1719 | (adapter->psstate == PS_STATE_PRE_SLEEP)) { |
1760 | ) { | ||
1761 | lbs_deb_cmd( | 1720 | lbs_deb_cmd( |
1762 | "EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n"); | 1721 | "EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n"); |
1763 | list_del((struct list_head *)cmdnode); | 1722 | list_del((struct list_head *)cmdnode); |
@@ -1774,7 +1733,7 @@ int libertas_execute_next_command(wlan_private * priv) | |||
1774 | } | 1733 | } |
1775 | list_del((struct list_head *)cmdnode); | 1734 | list_del((struct list_head *)cmdnode); |
1776 | lbs_deb_cmd("EXEC_NEXT_CMD: Sending 0x%04X command\n", | 1735 | lbs_deb_cmd("EXEC_NEXT_CMD: Sending 0x%04X command\n", |
1777 | cmdptr->command); | 1736 | le16_to_cpu(cmdptr->command)); |
1778 | DownloadcommandToStation(priv, cmdnode); | 1737 | DownloadcommandToStation(priv, cmdnode); |
1779 | } else { | 1738 | } else { |
1780 | /* | 1739 | /* |
@@ -1784,11 +1743,11 @@ int libertas_execute_next_command(wlan_private * priv) | |||
1784 | if ((adapter->psmode != wlan802_11powermodecam) && | 1743 | if ((adapter->psmode != wlan802_11powermodecam) && |
1785 | (adapter->psstate == PS_STATE_FULL_POWER) && | 1744 | (adapter->psstate == PS_STATE_FULL_POWER) && |
1786 | (adapter->connect_status == libertas_connected)) { | 1745 | (adapter->connect_status == libertas_connected)) { |
1787 | if (adapter->secinfo.WPAenabled | 1746 | if (adapter->secinfo.WPAenabled || |
1788 | || adapter->secinfo.WPA2enabled) { | 1747 | adapter->secinfo.WPA2enabled) { |
1789 | /* check for valid WPA group keys */ | 1748 | /* check for valid WPA group keys */ |
1790 | if (adapter->wpa_mcast_key.len | 1749 | if (adapter->wpa_mcast_key.len || |
1791 | || adapter->wpa_unicast_key.len) { | 1750 | adapter->wpa_unicast_key.len) { |
1792 | lbs_deb_cmd( | 1751 | lbs_deb_cmd( |
1793 | "EXEC_NEXT_CMD: WPA enabled and GTK_SET" | 1752 | "EXEC_NEXT_CMD: WPA enabled and GTK_SET" |
1794 | " go back to PS_SLEEP"); | 1753 | " go back to PS_SLEEP"); |
@@ -1824,8 +1783,7 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str) | |||
1824 | iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN; | 1783 | iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN; |
1825 | 1784 | ||
1826 | /* Send Event to upper layer */ | 1785 | /* Send Event to upper layer */ |
1827 | lbs_deb_cmd("Event Indication string = %s\n", | 1786 | lbs_deb_cmd("Event Indication string = %s\n", (char *)buf); |
1828 | (char *)buf); | ||
1829 | lbs_deb_cmd("Event Indication String length = %d\n", iwrq.data.length); | 1787 | lbs_deb_cmd("Event Indication String length = %d\n", iwrq.data.length); |
1830 | 1788 | ||
1831 | lbs_deb_cmd("Sending wireless event IWEVCUSTOM for %s\n", str); | 1789 | lbs_deb_cmd("Sending wireless event IWEVCUSTOM for %s\n", str); |
@@ -1901,13 +1859,13 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option) | |||
1901 | */ | 1859 | */ |
1902 | void libertas_ps_wakeup(wlan_private * priv, int wait_option) | 1860 | void libertas_ps_wakeup(wlan_private * priv, int wait_option) |
1903 | { | 1861 | { |
1904 | enum WLAN_802_11_POWER_MODE Localpsmode; | 1862 | __le32 Localpsmode; |
1905 | 1863 | ||
1906 | lbs_deb_enter(LBS_DEB_CMD); | 1864 | lbs_deb_enter(LBS_DEB_CMD); |
1907 | 1865 | ||
1908 | Localpsmode = wlan802_11powermodecam; | 1866 | Localpsmode = cpu_to_le32(wlan802_11powermodecam); |
1909 | 1867 | ||
1910 | lbs_deb_cmd("Exit_PS: Localpsmode = %d\n", Localpsmode); | 1868 | lbs_deb_cmd("Exit_PS: Localpsmode = %d\n", wlan802_11powermodecam); |
1911 | 1869 | ||
1912 | libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode, | 1870 | libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode, |
1913 | cmd_subcmd_exit_ps, | 1871 | cmd_subcmd_exit_ps, |
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 3b069341f35f..e31d595e4753 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -123,37 +123,27 @@ static int wlan_ret_reg_access(wlan_private * priv, | |||
123 | switch (type) { | 123 | switch (type) { |
124 | case cmd_ret_mac_reg_access: | 124 | case cmd_ret_mac_reg_access: |
125 | { | 125 | { |
126 | struct cmd_ds_mac_reg_access *reg; | 126 | struct cmd_ds_mac_reg_access *reg = &resp->params.macreg; |
127 | 127 | ||
128 | reg = | 128 | adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); |
129 | (struct cmd_ds_mac_reg_access *)&resp->params. | 129 | adapter->offsetvalue.value = le32_to_cpu(reg->value); |
130 | macreg; | ||
131 | |||
132 | adapter->offsetvalue.offset = reg->offset; | ||
133 | adapter->offsetvalue.value = reg->value; | ||
134 | break; | 130 | break; |
135 | } | 131 | } |
136 | 132 | ||
137 | case cmd_ret_bbp_reg_access: | 133 | case cmd_ret_bbp_reg_access: |
138 | { | 134 | { |
139 | struct cmd_ds_bbp_reg_access *reg; | 135 | struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg; |
140 | reg = | ||
141 | (struct cmd_ds_bbp_reg_access *)&resp->params. | ||
142 | bbpreg; | ||
143 | 136 | ||
144 | adapter->offsetvalue.offset = reg->offset; | 137 | adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); |
145 | adapter->offsetvalue.value = reg->value; | 138 | adapter->offsetvalue.value = reg->value; |
146 | break; | 139 | break; |
147 | } | 140 | } |
148 | 141 | ||
149 | case cmd_ret_rf_reg_access: | 142 | case cmd_ret_rf_reg_access: |
150 | { | 143 | { |
151 | struct cmd_ds_rf_reg_access *reg; | 144 | struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg; |
152 | reg = | ||
153 | (struct cmd_ds_rf_reg_access *)&resp->params. | ||
154 | rfreg; | ||
155 | 145 | ||
156 | adapter->offsetvalue.offset = reg->offset; | 146 | adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset); |
157 | adapter->offsetvalue.value = reg->value; | 147 | adapter->offsetvalue.value = reg->value; |
158 | break; | 148 | break; |
159 | } | 149 | } |
@@ -178,7 +168,7 @@ static int wlan_ret_get_hw_spec(wlan_private * priv, | |||
178 | 168 | ||
179 | adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); | 169 | adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); |
180 | 170 | ||
181 | adapter->fwreleasenumber = hwspec->fwreleasenumber; | 171 | adapter->fwreleasenumber = le32_to_cpu(hwspec->fwreleasenumber); |
182 | 172 | ||
183 | lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- 0x%X\n", | 173 | lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- 0x%X\n", |
184 | adapter->fwreleasenumber); | 174 | adapter->fwreleasenumber); |
@@ -203,19 +193,15 @@ static int wlan_ret_get_hw_spec(wlan_private * priv, | |||
203 | if (i >= MRVDRV_MAX_REGION_CODE) { | 193 | if (i >= MRVDRV_MAX_REGION_CODE) { |
204 | adapter->regioncode = 0x10; | 194 | adapter->regioncode = 0x10; |
205 | adapter->regiontableindex = 0; | 195 | adapter->regiontableindex = 0; |
206 | lbs_pr_info( | 196 | lbs_pr_info("unidentified region code; using the default (USA)\n"); |
207 | "unidentified region code, use the default (USA)\n"); | ||
208 | } | 197 | } |
209 | 198 | ||
210 | if (adapter->current_addr[0] == 0xff) { | 199 | if (adapter->current_addr[0] == 0xff) |
211 | memmove(adapter->current_addr, hwspec->permanentaddr, | 200 | memmove(adapter->current_addr, hwspec->permanentaddr, ETH_ALEN); |
212 | ETH_ALEN); | ||
213 | } | ||
214 | 201 | ||
215 | memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN); | 202 | memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN); |
216 | if (priv->mesh_dev) | 203 | if (priv->mesh_dev) |
217 | memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, | 204 | memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); |
218 | ETH_ALEN); | ||
219 | 205 | ||
220 | if (libertas_set_regiontable(priv, adapter->regioncode, 0)) { | 206 | if (libertas_set_regiontable(priv, adapter->regioncode, 0)) { |
221 | ret = -1; | 207 | ret = -1; |
@@ -241,13 +227,15 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv, | |||
241 | lbs_deb_enter(LBS_DEB_CMD); | 227 | lbs_deb_enter(LBS_DEB_CMD); |
242 | 228 | ||
243 | lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n" | 229 | lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n" |
244 | " extsleepclk=%x\n", sp->error, sp->offset, | 230 | " extsleepclk=%x\n", le16_to_cpu(sp->error), |
245 | sp->stabletime, sp->calcontrol, sp->externalsleepclk); | 231 | le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime), |
232 | sp->calcontrol, sp->externalsleepclk); | ||
233 | |||
246 | adapter->sp.sp_error = le16_to_cpu(sp->error); | 234 | adapter->sp.sp_error = le16_to_cpu(sp->error); |
247 | adapter->sp.sp_offset = le16_to_cpu(sp->offset); | 235 | adapter->sp.sp_offset = le16_to_cpu(sp->offset); |
248 | adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime); | 236 | adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime); |
249 | adapter->sp.sp_calcontrol = le16_to_cpu(sp->calcontrol); | 237 | adapter->sp.sp_calcontrol = sp->calcontrol; |
250 | adapter->sp.sp_extsleepclk = le16_to_cpu(sp->externalsleepclk); | 238 | adapter->sp.sp_extsleepclk = sp->externalsleepclk; |
251 | adapter->sp.sp_reserved = le16_to_cpu(sp->reserved); | 239 | adapter->sp.sp_reserved = le16_to_cpu(sp->reserved); |
252 | 240 | ||
253 | lbs_deb_enter(LBS_DEB_CMD); | 241 | lbs_deb_enter(LBS_DEB_CMD); |
@@ -280,31 +268,27 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv, | |||
280 | 268 | ||
281 | lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid, | 269 | lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid, |
282 | querytype); | 270 | querytype); |
283 | lbs_deb_cmd("SNMP_RESP: Buf size = %x\n", | 271 | lbs_deb_cmd("SNMP_RESP: Buf size = %x\n", le16_to_cpu(smib->bufsize)); |
284 | le16_to_cpu(smib->bufsize)); | ||
285 | 272 | ||
286 | if (querytype == cmd_act_get) { | 273 | if (querytype == cmd_act_get) { |
287 | switch (oid) { | 274 | switch (oid) { |
288 | case fragthresh_i: | 275 | case fragthresh_i: |
289 | priv->adapter->fragthsd = | 276 | priv->adapter->fragthsd = |
290 | le16_to_cpu(* | 277 | le16_to_cpu(*((__le16 *)(smib->value))); |
291 | ((unsigned short *)(smib->value))); | ||
292 | lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n", | 278 | lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n", |
293 | priv->adapter->fragthsd); | 279 | priv->adapter->fragthsd); |
294 | break; | 280 | break; |
295 | case rtsthresh_i: | 281 | case rtsthresh_i: |
296 | priv->adapter->rtsthsd = | 282 | priv->adapter->rtsthsd = |
297 | le16_to_cpu(* | 283 | le16_to_cpu(*((__le16 *)(smib->value))); |
298 | ((unsigned short *)(smib->value))); | ||
299 | lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n", | 284 | lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n", |
300 | priv->adapter->rtsthsd); | 285 | priv->adapter->rtsthsd); |
301 | break; | 286 | break; |
302 | case short_retrylim_i: | 287 | case short_retrylim_i: |
303 | priv->adapter->txretrycount = | 288 | priv->adapter->txretrycount = |
304 | le16_to_cpu(* | 289 | le16_to_cpu(*((__le16 *)(smib->value))); |
305 | ((unsigned short *)(smib->value))); | ||
306 | lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n", | 290 | lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n", |
307 | priv->adapter->rtsthsd); | 291 | priv->adapter->rtsthsd); |
308 | break; | 292 | break; |
309 | default: | 293 | default: |
310 | break; | 294 | break; |
@@ -408,12 +392,10 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv, | |||
408 | u16 action = le16_to_cpu(pAntenna->action); | 392 | u16 action = le16_to_cpu(pAntenna->action); |
409 | 393 | ||
410 | if (action == cmd_act_get_rx) | 394 | if (action == cmd_act_get_rx) |
411 | adapter->rxantennamode = | 395 | adapter->rxantennamode = le16_to_cpu(pAntenna->antennamode); |
412 | le16_to_cpu(pAntenna->antennamode); | ||
413 | 396 | ||
414 | if (action == cmd_act_get_tx) | 397 | if (action == cmd_act_get_tx) |
415 | adapter->txantennamode = | 398 | adapter->txantennamode = le16_to_cpu(pAntenna->antennamode); |
416 | le16_to_cpu(pAntenna->antennamode); | ||
417 | 399 | ||
418 | lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n", | 400 | lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n", |
419 | action, le16_to_cpu(pAntenna->antennamode)); | 401 | action, le16_to_cpu(pAntenna->antennamode)); |
@@ -424,15 +406,14 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv, | |||
424 | static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv, | 406 | static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv, |
425 | struct cmd_ds_command *resp) | 407 | struct cmd_ds_command *resp) |
426 | { | 408 | { |
427 | struct cmd_ds_802_11_rate_adapt_rateset *rates = | 409 | struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset; |
428 | &resp->params.rateset; | ||
429 | wlan_adapter *adapter = priv->adapter; | 410 | wlan_adapter *adapter = priv->adapter; |
430 | 411 | ||
431 | lbs_deb_enter(LBS_DEB_CMD); | 412 | lbs_deb_enter(LBS_DEB_CMD); |
432 | 413 | ||
433 | if (rates->action == cmd_act_get) { | 414 | if (rates->action == cmd_act_get) { |
434 | adapter->enablehwauto = rates->enablehwauto; | 415 | adapter->enablehwauto = le16_to_cpu(rates->enablehwauto); |
435 | adapter->ratebitmap = rates->bitmap; | 416 | adapter->ratebitmap = le16_to_cpu(rates->bitmap); |
436 | } | 417 | } |
437 | 418 | ||
438 | lbs_deb_enter(LBS_DEB_CMD); | 419 | lbs_deb_enter(LBS_DEB_CMD); |
@@ -452,7 +433,7 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv, | |||
452 | (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate)); | 433 | (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate)); |
453 | 434 | ||
454 | dot11datarate = pdatarate->datarate[0]; | 435 | dot11datarate = pdatarate->datarate[0]; |
455 | if (pdatarate->action == cmd_act_get_tx_rate) { | 436 | if (pdatarate->action == cpu_to_le16(cmd_act_get_tx_rate)) { |
456 | memcpy(adapter->libertas_supported_rates, pdatarate->datarate, | 437 | memcpy(adapter->libertas_supported_rates, pdatarate->datarate, |
457 | sizeof(adapter->libertas_supported_rates)); | 438 | sizeof(adapter->libertas_supported_rates)); |
458 | } | 439 | } |
@@ -465,8 +446,7 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv, | |||
465 | static int wlan_ret_802_11_rf_channel(wlan_private * priv, | 446 | static int wlan_ret_802_11_rf_channel(wlan_private * priv, |
466 | struct cmd_ds_command *resp) | 447 | struct cmd_ds_command *resp) |
467 | { | 448 | { |
468 | struct cmd_ds_802_11_rf_channel *rfchannel = | 449 | struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel; |
469 | &resp->params.rfchannel; | ||
470 | wlan_adapter *adapter = priv->adapter; | 450 | wlan_adapter *adapter = priv->adapter; |
471 | u16 action = le16_to_cpu(rfchannel->action); | 451 | u16 action = le16_to_cpu(rfchannel->action); |
472 | u16 newchannel = le16_to_cpu(rfchannel->currentchannel); | 452 | u16 newchannel = le16_to_cpu(rfchannel->currentchannel); |
@@ -494,12 +474,10 @@ static int wlan_ret_802_11_rssi(wlan_private * priv, | |||
494 | 474 | ||
495 | /* store the non average value */ | 475 | /* store the non average value */ |
496 | adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); | 476 | adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); |
497 | adapter->NF[TYPE_BEACON][TYPE_NOAVG] = | 477 | adapter->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor); |
498 | le16_to_cpu(rssirsp->noisefloor); | ||
499 | 478 | ||
500 | adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); | 479 | adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); |
501 | adapter->NF[TYPE_BEACON][TYPE_AVG] = | 480 | adapter->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor); |
502 | le16_to_cpu(rssirsp->avgnoisefloor); | ||
503 | 481 | ||
504 | adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = | 482 | adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = |
505 | CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], | 483 | CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], |
@@ -543,15 +521,13 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv, | |||
543 | static int wlan_ret_get_log(wlan_private * priv, | 521 | static int wlan_ret_get_log(wlan_private * priv, |
544 | struct cmd_ds_command *resp) | 522 | struct cmd_ds_command *resp) |
545 | { | 523 | { |
546 | struct cmd_ds_802_11_get_log *logmessage = | 524 | struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog; |
547 | (struct cmd_ds_802_11_get_log *)&resp->params.glog; | ||
548 | wlan_adapter *adapter = priv->adapter; | 525 | wlan_adapter *adapter = priv->adapter; |
549 | 526 | ||
550 | lbs_deb_enter(LBS_DEB_CMD); | 527 | lbs_deb_enter(LBS_DEB_CMD); |
551 | 528 | ||
552 | /* TODO Convert it to Big Endian before copy */ | 529 | /* Stored little-endian */ |
553 | memcpy(&adapter->logmsg, logmessage, | 530 | memcpy(&adapter->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log)); |
554 | sizeof(struct cmd_ds_802_11_get_log)); | ||
555 | 531 | ||
556 | lbs_deb_enter(LBS_DEB_CMD); | 532 | lbs_deb_enter(LBS_DEB_CMD); |
557 | return 0; | 533 | return 0; |
@@ -614,8 +590,7 @@ static inline int handle_cmd_response(u16 respcmd, | |||
614 | case cmd_ret_802_11_set_afc: | 590 | case cmd_ret_802_11_set_afc: |
615 | case cmd_ret_802_11_get_afc: | 591 | case cmd_ret_802_11_get_afc: |
616 | spin_lock_irqsave(&adapter->driver_lock, flags); | 592 | spin_lock_irqsave(&adapter->driver_lock, flags); |
617 | memmove(adapter->cur_cmd->pdata_buf, | 593 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.afc, |
618 | &resp->params.afc, | ||
619 | sizeof(struct cmd_ds_802_11_afc)); | 594 | sizeof(struct cmd_ds_802_11_afc)); |
620 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 595 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
621 | 596 | ||
@@ -681,22 +656,19 @@ static inline int handle_cmd_response(u16 respcmd, | |||
681 | 656 | ||
682 | case cmd_ret_802_11_tpc_cfg: | 657 | case cmd_ret_802_11_tpc_cfg: |
683 | spin_lock_irqsave(&adapter->driver_lock, flags); | 658 | spin_lock_irqsave(&adapter->driver_lock, flags); |
684 | memmove(adapter->cur_cmd->pdata_buf, | 659 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.tpccfg, |
685 | &resp->params.tpccfg, | ||
686 | sizeof(struct cmd_ds_802_11_tpc_cfg)); | 660 | sizeof(struct cmd_ds_802_11_tpc_cfg)); |
687 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 661 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
688 | break; | 662 | break; |
689 | case cmd_ret_802_11_led_gpio_ctrl: | 663 | case cmd_ret_802_11_led_gpio_ctrl: |
690 | spin_lock_irqsave(&adapter->driver_lock, flags); | 664 | spin_lock_irqsave(&adapter->driver_lock, flags); |
691 | memmove(adapter->cur_cmd->pdata_buf, | 665 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.ledgpio, |
692 | &resp->params.ledgpio, | ||
693 | sizeof(struct cmd_ds_802_11_led_ctrl)); | 666 | sizeof(struct cmd_ds_802_11_led_ctrl)); |
694 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 667 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
695 | break; | 668 | break; |
696 | case cmd_ret_802_11_pwr_cfg: | 669 | case cmd_ret_802_11_pwr_cfg: |
697 | spin_lock_irqsave(&adapter->driver_lock, flags); | 670 | spin_lock_irqsave(&adapter->driver_lock, flags); |
698 | memmove(adapter->cur_cmd->pdata_buf, | 671 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg, |
699 | &resp->params.pwrcfg, | ||
700 | sizeof(struct cmd_ds_802_11_pwr_cfg)); | 672 | sizeof(struct cmd_ds_802_11_pwr_cfg)); |
701 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 673 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
702 | 674 | ||
@@ -718,15 +690,13 @@ static inline int handle_cmd_response(u16 respcmd, | |||
718 | case cmd_ret_fwt_access: | 690 | case cmd_ret_fwt_access: |
719 | spin_lock_irqsave(&adapter->driver_lock, flags); | 691 | spin_lock_irqsave(&adapter->driver_lock, flags); |
720 | if (adapter->cur_cmd->pdata_buf) | 692 | if (adapter->cur_cmd->pdata_buf) |
721 | memcpy(adapter->cur_cmd->pdata_buf, | 693 | memcpy(adapter->cur_cmd->pdata_buf, &resp->params.fwt, |
722 | &resp->params.fwt, | 694 | sizeof(resp->params.fwt)); |
723 | sizeof(resp->params.fwt)); | ||
724 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 695 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
725 | break; | 696 | break; |
726 | case cmd_ret_mesh_access: | 697 | case cmd_ret_mesh_access: |
727 | if (adapter->cur_cmd->pdata_buf) | 698 | if (adapter->cur_cmd->pdata_buf) |
728 | memcpy(adapter->cur_cmd->pdata_buf, | 699 | memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh, |
729 | &resp->params.mesh, | ||
730 | sizeof(resp->params.mesh)); | 700 | sizeof(resp->params.mesh)); |
731 | break; | 701 | break; |
732 | case cmd_rte_802_11_tx_rate_query: | 702 | case cmd_rte_802_11_tx_rate_query: |
@@ -734,7 +704,7 @@ static inline int handle_cmd_response(u16 respcmd, | |||
734 | break; | 704 | break; |
735 | default: | 705 | default: |
736 | lbs_deb_cmd("CMD_RESP: Unknown command response %#x\n", | 706 | lbs_deb_cmd("CMD_RESP: Unknown command response %#x\n", |
737 | resp->command); | 707 | resp->command); |
738 | break; | 708 | break; |
739 | } | 709 | } |
740 | return ret; | 710 | return ret; |
@@ -768,14 +738,14 @@ int libertas_process_rx_command(wlan_private * priv) | |||
768 | resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr); | 738 | resp = (struct cmd_ds_command *)(adapter->cur_cmd->bufvirtualaddr); |
769 | 739 | ||
770 | lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr, | 740 | lbs_dbg_hex("CMD_RESP:", adapter->cur_cmd->bufvirtualaddr, |
771 | priv->upld_len); | 741 | priv->upld_len); |
772 | 742 | ||
773 | respcmd = le16_to_cpu(resp->command); | 743 | respcmd = le16_to_cpu(resp->command); |
774 | 744 | ||
775 | result = le16_to_cpu(resp->result); | 745 | result = le16_to_cpu(resp->result); |
776 | 746 | ||
777 | lbs_deb_cmd("CMD_RESP: %x result: %d length: %d\n", respcmd, | 747 | lbs_deb_cmd("CMD_RESP: %x result: %d length: %d\n", respcmd, |
778 | result, priv->upld_len); | 748 | result, priv->upld_len); |
779 | 749 | ||
780 | if (!(respcmd & 0x8000)) { | 750 | if (!(respcmd & 0x8000)) { |
781 | lbs_deb_cmd("Invalid response to command!"); | 751 | lbs_deb_cmd("Invalid response to command!"); |
@@ -789,31 +759,28 @@ int libertas_process_rx_command(wlan_private * priv) | |||
789 | } | 759 | } |
790 | 760 | ||
791 | /* Store the response code to cur_cmd_retcode. */ | 761 | /* Store the response code to cur_cmd_retcode. */ |
792 | adapter->cur_cmd_retcode = le16_to_cpu(resp->result); | 762 | adapter->cur_cmd_retcode = result;; |
793 | 763 | ||
794 | if (respcmd == cmd_ret_802_11_ps_mode) { | 764 | if (respcmd == cmd_ret_802_11_ps_mode) { |
795 | struct cmd_ds_802_11_ps_mode *psmode; | 765 | struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode; |
766 | u16 action = le16_to_cpu(psmode->action); | ||
796 | 767 | ||
797 | psmode = &resp->params.psmode; | ||
798 | lbs_deb_cmd( | 768 | lbs_deb_cmd( |
799 | "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n", | 769 | "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n", |
800 | resp->result, psmode->action); | 770 | result, action); |
801 | psmode->action = cpu_to_le16(psmode->action); | ||
802 | 771 | ||
803 | if (result) { | 772 | if (result) { |
804 | lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n", | 773 | lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n", |
805 | resp->result); | 774 | result); |
806 | if (adapter->mode == IW_MODE_ADHOC) { | 775 | /* |
807 | /* | 776 | * We should not re-try enter-ps command in |
808 | * We should not re-try enter-ps command in | 777 | * ad-hoc mode. It takes place in |
809 | * ad-hoc mode. It takes place in | 778 | * libertas_execute_next_command(). |
810 | * libertas_execute_next_command(). | 779 | */ |
811 | */ | 780 | if (adapter->mode == IW_MODE_ADHOC && |
812 | if (psmode->action == cmd_subcmd_enter_ps) | 781 | action == cmd_subcmd_enter_ps) |
813 | adapter->psmode = | 782 | adapter->psmode = wlan802_11powermodecam; |
814 | wlan802_11powermodecam; | 783 | } else if (action == cmd_subcmd_enter_ps) { |
815 | } | ||
816 | } else if (psmode->action == cmd_subcmd_enter_ps) { | ||
817 | adapter->needtowakeup = 0; | 784 | adapter->needtowakeup = 0; |
818 | adapter->psstate = PS_STATE_AWAKE; | 785 | adapter->psstate = PS_STATE_AWAKE; |
819 | 786 | ||
@@ -832,13 +799,12 @@ int libertas_process_rx_command(wlan_private * priv) | |||
832 | mutex_lock(&adapter->lock); | 799 | mutex_lock(&adapter->lock); |
833 | spin_lock_irqsave(&adapter->driver_lock, flags); | 800 | spin_lock_irqsave(&adapter->driver_lock, flags); |
834 | } | 801 | } |
835 | } else if (psmode->action == cmd_subcmd_exit_ps) { | 802 | } else if (action == cmd_subcmd_exit_ps) { |
836 | adapter->needtowakeup = 0; | 803 | adapter->needtowakeup = 0; |
837 | adapter->psstate = PS_STATE_FULL_POWER; | 804 | adapter->psstate = PS_STATE_FULL_POWER; |
838 | lbs_deb_cmd("CMD_RESP: Exit_PS command response\n"); | 805 | lbs_deb_cmd("CMD_RESP: Exit_PS command response\n"); |
839 | } else { | 806 | } else { |
840 | lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n", | 807 | lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n", action); |
841 | psmode->action); | ||
842 | } | 808 | } |
843 | 809 | ||
844 | __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); | 810 | __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); |
@@ -860,7 +826,7 @@ int libertas_process_rx_command(wlan_private * priv) | |||
860 | /* If the command is not successful, cleanup and return failure */ | 826 | /* If the command is not successful, cleanup and return failure */ |
861 | if ((result != 0 || !(respcmd & 0x8000))) { | 827 | if ((result != 0 || !(respcmd & 0x8000))) { |
862 | lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n", | 828 | lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n", |
863 | resp->command, resp->result); | 829 | respcmd, result); |
864 | /* | 830 | /* |
865 | * Handling errors here | 831 | * Handling errors here |
866 | */ | 832 | */ |
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index debefb6eab77..b62ebca9ab6d 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c | |||
@@ -103,7 +103,6 @@ static ssize_t libertas_sleepparams_write(struct file *file, | |||
103 | wlan_private *priv = file->private_data; | 103 | wlan_private *priv = file->private_data; |
104 | ssize_t buf_size, res; | 104 | ssize_t buf_size, res; |
105 | int p1, p2, p3, p4, p5, p6; | 105 | int p1, p2, p3, p4, p5, p6; |
106 | struct sleep_params sp; | ||
107 | unsigned long addr = get_zeroed_page(GFP_KERNEL); | 106 | unsigned long addr = get_zeroed_page(GFP_KERNEL); |
108 | char *buf = (char *)addr; | 107 | char *buf = (char *)addr; |
109 | 108 | ||
@@ -117,14 +116,12 @@ static ssize_t libertas_sleepparams_write(struct file *file, | |||
117 | res = -EFAULT; | 116 | res = -EFAULT; |
118 | goto out_unlock; | 117 | goto out_unlock; |
119 | } | 118 | } |
120 | sp.sp_error = p1; | 119 | priv->adapter->sp.sp_error = p1; |
121 | sp.sp_offset = p2; | 120 | priv->adapter->sp.sp_offset = p2; |
122 | sp.sp_stabletime = p3; | 121 | priv->adapter->sp.sp_stabletime = p3; |
123 | sp.sp_calcontrol = p4; | 122 | priv->adapter->sp.sp_calcontrol = p4; |
124 | sp.sp_extsleepclk = p5; | 123 | priv->adapter->sp.sp_extsleepclk = p5; |
125 | sp.sp_reserved = p6; | 124 | priv->adapter->sp.sp_reserved = p6; |
126 | |||
127 | memcpy(&priv->adapter->sp, &sp, sizeof(struct sleep_params)); | ||
128 | 125 | ||
129 | res = libertas_prepare_and_send_command(priv, | 126 | res = libertas_prepare_and_send_command(priv, |
130 | cmd_802_11_sleep_params, | 127 | cmd_802_11_sleep_params, |
@@ -408,8 +405,8 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf, | |||
408 | (*cmdnode)->cmdflags |= CMD_F_HOSTCMD; | 405 | (*cmdnode)->cmdflags |= CMD_F_HOSTCMD; |
409 | (*cmdnode)->cmdwaitqwoken = 0; | 406 | (*cmdnode)->cmdwaitqwoken = 0; |
410 | *cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr; | 407 | *cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr; |
411 | (*cmd)->command = cmd_802_11_subscribe_event; | 408 | (*cmd)->command = cpu_to_le16(cmd_802_11_subscribe_event); |
412 | (*cmd)->seqnum = ++priv->adapter->seqnum; | 409 | (*cmd)->seqnum = cpu_to_le16(++priv->adapter->seqnum); |
413 | (*cmd)->result = 0; | 410 | (*cmd)->result = 0; |
414 | return 0; | 411 | return 0; |
415 | } | 412 | } |
@@ -435,26 +432,25 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, | |||
435 | } | 432 | } |
436 | 433 | ||
437 | event = &pcmdptr->params.subscribe_event; | 434 | event = &pcmdptr->params.subscribe_event; |
438 | event->action = cmd_act_get; | 435 | event->action = cpu_to_le16(cmd_act_get); |
439 | pcmdptr->size = | 436 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
440 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
441 | libertas_queue_cmd(adapter, pcmdnode, 1); | 437 | libertas_queue_cmd(adapter, pcmdnode, 1); |
442 | wake_up_interruptible(&priv->mainthread.waitq); | 438 | wake_up_interruptible(&priv->mainthread.waitq); |
443 | 439 | ||
444 | /* Sleep until response is generated by FW */ | 440 | /* Sleep until response is generated by FW */ |
445 | wait_event_interruptible(pcmdnode->cmdwait_q, | 441 | wait_event_interruptible(pcmdnode->cmdwait_q, |
446 | pcmdnode->cmdwaitqwoken); | 442 | pcmdnode->cmdwaitqwoken); |
447 | 443 | ||
448 | pcmdptr = response_buf; | 444 | pcmdptr = response_buf; |
449 | if (pcmdptr->result) { | 445 | if (pcmdptr->result) { |
450 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 446 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
451 | pcmdptr->result); | 447 | le16_to_cpu(pcmdptr->result)); |
452 | kfree(response_buf); | 448 | kfree(response_buf); |
453 | free_page(addr); | 449 | free_page(addr); |
454 | return 0; | 450 | return 0; |
455 | } | 451 | } |
456 | 452 | ||
457 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 453 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
458 | lbs_pr_err("command response incorrect!\n"); | 454 | lbs_pr_err("command response incorrect!\n"); |
459 | kfree(response_buf); | 455 | kfree(response_buf); |
460 | free_page(addr); | 456 | free_page(addr); |
@@ -462,17 +458,17 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, | |||
462 | } | 458 | } |
463 | 459 | ||
464 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); | 460 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); |
465 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 461 | event = (void *)(response_buf + S_DS_GEN); |
466 | while (cmd_len < pcmdptr->size) { | 462 | while (cmd_len < le16_to_cpu(pcmdptr->size)) { |
467 | struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); | 463 | struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); |
468 | switch(header->type) { | 464 | switch (header->type) { |
469 | struct mrvlietypes_rssithreshold *Lowrssi; | 465 | struct mrvlietypes_rssithreshold *Lowrssi; |
470 | case TLV_TYPE_RSSI_LOW: | 466 | case __constant_cpu_to_le16(TLV_TYPE_RSSI_LOW): |
471 | Lowrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len); | 467 | Lowrssi = (void *)(response_buf + cmd_len); |
472 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", | 468 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", |
473 | Lowrssi->rssivalue, | 469 | Lowrssi->rssivalue, |
474 | Lowrssi->rssifreq, | 470 | Lowrssi->rssifreq, |
475 | (event->events & 0x0001)?1:0); | 471 | (event->events & cpu_to_le16(0x0001))?1:0); |
476 | default: | 472 | default: |
477 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); | 473 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); |
478 | break; | 474 | break; |
@@ -500,21 +496,20 @@ static u16 libertas_get_events_bitmap(wlan_private *priv) | |||
500 | return res; | 496 | return res; |
501 | 497 | ||
502 | event = &pcmdptr->params.subscribe_event; | 498 | event = &pcmdptr->params.subscribe_event; |
503 | event->action = cmd_act_get; | 499 | event->action = cpu_to_le16(cmd_act_get); |
504 | pcmdptr->size = | 500 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
505 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
506 | libertas_queue_cmd(adapter, pcmdnode, 1); | 501 | libertas_queue_cmd(adapter, pcmdnode, 1); |
507 | wake_up_interruptible(&priv->mainthread.waitq); | 502 | wake_up_interruptible(&priv->mainthread.waitq); |
508 | 503 | ||
509 | /* Sleep until response is generated by FW */ | 504 | /* Sleep until response is generated by FW */ |
510 | wait_event_interruptible(pcmdnode->cmdwait_q, | 505 | wait_event_interruptible(pcmdnode->cmdwait_q, |
511 | pcmdnode->cmdwaitqwoken); | 506 | pcmdnode->cmdwaitqwoken); |
512 | 507 | ||
513 | pcmdptr = response_buf; | 508 | pcmdptr = response_buf; |
514 | 509 | ||
515 | if (pcmdptr->result) { | 510 | if (pcmdptr->result) { |
516 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 511 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
517 | pcmdptr->result); | 512 | le16_to_cpu(pcmdptr->result)); |
518 | kfree(response_buf); | 513 | kfree(response_buf); |
519 | return 0; | 514 | return 0; |
520 | } | 515 | } |
@@ -526,7 +521,7 @@ static u16 libertas_get_events_bitmap(wlan_private *priv) | |||
526 | } | 521 | } |
527 | 522 | ||
528 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 523 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); |
529 | event_bitmap = event->events; | 524 | event_bitmap = le16_to_cpu(event->events); |
530 | kfree(response_buf); | 525 | kfree(response_buf); |
531 | return event_bitmap; | 526 | return event_bitmap; |
532 | } | 527 | } |
@@ -567,7 +562,7 @@ static ssize_t libertas_lowrssi_write(struct file *file, | |||
567 | goto out_unlock; | 562 | goto out_unlock; |
568 | 563 | ||
569 | event = &pcmdptr->params.subscribe_event; | 564 | event = &pcmdptr->params.subscribe_event; |
570 | event->action = cmd_act_set; | 565 | event->action = cpu_to_le16(cmd_act_set); |
571 | pcmdptr->size = cpu_to_le16(S_DS_GEN + | 566 | pcmdptr->size = cpu_to_le16(S_DS_GEN + |
572 | sizeof(struct cmd_ds_802_11_subscribe_event) + | 567 | sizeof(struct cmd_ds_802_11_subscribe_event) + |
573 | sizeof(struct mrvlietypes_rssithreshold)); | 568 | sizeof(struct mrvlietypes_rssithreshold)); |
@@ -576,30 +571,30 @@ static ssize_t libertas_lowrssi_write(struct file *file, | |||
576 | ptr = (u8*) pcmdptr+cmd_len; | 571 | ptr = (u8*) pcmdptr+cmd_len; |
577 | rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); | 572 | rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); |
578 | rssi_threshold->header.type = cpu_to_le16(0x0104); | 573 | rssi_threshold->header.type = cpu_to_le16(0x0104); |
579 | rssi_threshold->header.len = 2; | 574 | rssi_threshold->header.len = cpu_to_le16(2); |
580 | rssi_threshold->rssivalue = cpu_to_le16(value); | 575 | rssi_threshold->rssivalue = value; |
581 | rssi_threshold->rssifreq = cpu_to_le16(freq); | 576 | rssi_threshold->rssifreq = freq; |
582 | event_bitmap |= subscribed ? 0x0001 : 0x0; | 577 | event_bitmap |= subscribed ? 0x0001 : 0x0; |
583 | event->events = event_bitmap; | 578 | event->events = cpu_to_le16(event_bitmap); |
584 | 579 | ||
585 | libertas_queue_cmd(adapter, pcmdnode, 1); | 580 | libertas_queue_cmd(adapter, pcmdnode, 1); |
586 | wake_up_interruptible(&priv->mainthread.waitq); | 581 | wake_up_interruptible(&priv->mainthread.waitq); |
587 | 582 | ||
588 | /* Sleep until response is generated by FW */ | 583 | /* Sleep until response is generated by FW */ |
589 | wait_event_interruptible(pcmdnode->cmdwait_q, | 584 | wait_event_interruptible(pcmdnode->cmdwait_q, |
590 | pcmdnode->cmdwaitqwoken); | 585 | pcmdnode->cmdwaitqwoken); |
591 | 586 | ||
592 | pcmdptr = response_buf; | 587 | pcmdptr = response_buf; |
593 | 588 | ||
594 | if (pcmdptr->result) { | 589 | if (pcmdptr->result) { |
595 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 590 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
596 | pcmdptr->result); | 591 | le16_to_cpu(pcmdptr->result)); |
597 | kfree(response_buf); | 592 | kfree(response_buf); |
598 | free_page(addr); | 593 | free_page(addr); |
599 | return 0; | 594 | return 0; |
600 | } | 595 | } |
601 | 596 | ||
602 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 597 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
603 | lbs_pr_err("command response incorrect!\n"); | 598 | lbs_pr_err("command response incorrect!\n"); |
604 | kfree(response_buf); | 599 | kfree(response_buf); |
605 | free_page(addr); | 600 | free_page(addr); |
@@ -633,27 +628,26 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, | |||
633 | } | 628 | } |
634 | 629 | ||
635 | event = &pcmdptr->params.subscribe_event; | 630 | event = &pcmdptr->params.subscribe_event; |
636 | event->action = cmd_act_get; | 631 | event->action = cpu_to_le16(cmd_act_get); |
637 | pcmdptr->size = | 632 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
638 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
639 | libertas_queue_cmd(adapter, pcmdnode, 1); | 633 | libertas_queue_cmd(adapter, pcmdnode, 1); |
640 | wake_up_interruptible(&priv->mainthread.waitq); | 634 | wake_up_interruptible(&priv->mainthread.waitq); |
641 | 635 | ||
642 | /* Sleep until response is generated by FW */ | 636 | /* Sleep until response is generated by FW */ |
643 | wait_event_interruptible(pcmdnode->cmdwait_q, | 637 | wait_event_interruptible(pcmdnode->cmdwait_q, |
644 | pcmdnode->cmdwaitqwoken); | 638 | pcmdnode->cmdwaitqwoken); |
645 | 639 | ||
646 | pcmdptr = response_buf; | 640 | pcmdptr = response_buf; |
647 | 641 | ||
648 | if (pcmdptr->result) { | 642 | if (pcmdptr->result) { |
649 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 643 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
650 | pcmdptr->result); | 644 | le16_to_cpu(pcmdptr->result)); |
651 | kfree(response_buf); | 645 | kfree(response_buf); |
652 | free_page(addr); | 646 | free_page(addr); |
653 | return 0; | 647 | return 0; |
654 | } | 648 | } |
655 | 649 | ||
656 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 650 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
657 | lbs_pr_err("command response incorrect!\n"); | 651 | lbs_pr_err("command response incorrect!\n"); |
658 | kfree(response_buf); | 652 | kfree(response_buf); |
659 | free_page(addr); | 653 | free_page(addr); |
@@ -661,17 +655,17 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, | |||
661 | } | 655 | } |
662 | 656 | ||
663 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); | 657 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); |
664 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 658 | event = (void *)(response_buf + S_DS_GEN); |
665 | while (cmd_len < pcmdptr->size) { | 659 | while (cmd_len < le16_to_cpu(pcmdptr->size)) { |
666 | struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); | 660 | struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); |
667 | switch(header->type) { | 661 | switch (header->type) { |
668 | struct mrvlietypes_snrthreshold *LowSnr; | 662 | struct mrvlietypes_snrthreshold *LowSnr; |
669 | case TLV_TYPE_SNR_LOW: | 663 | case __constant_cpu_to_le16(TLV_TYPE_SNR_LOW): |
670 | LowSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len); | 664 | LowSnr = (void *)(response_buf + cmd_len); |
671 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", | 665 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", |
672 | LowSnr->snrvalue, | 666 | LowSnr->snrvalue, |
673 | LowSnr->snrfreq, | 667 | LowSnr->snrfreq, |
674 | (event->events & 0x0002)?1:0); | 668 | (event->events & cpu_to_le16(0x0002))?1:0); |
675 | default: | 669 | default: |
676 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); | 670 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); |
677 | break; | 671 | break; |
@@ -721,7 +715,7 @@ static ssize_t libertas_lowsnr_write(struct file *file, | |||
721 | goto out_unlock; | 715 | goto out_unlock; |
722 | 716 | ||
723 | event = &pcmdptr->params.subscribe_event; | 717 | event = &pcmdptr->params.subscribe_event; |
724 | event->action = cmd_act_set; | 718 | event->action = cpu_to_le16(cmd_act_set); |
725 | pcmdptr->size = cpu_to_le16(S_DS_GEN + | 719 | pcmdptr->size = cpu_to_le16(S_DS_GEN + |
726 | sizeof(struct cmd_ds_802_11_subscribe_event) + | 720 | sizeof(struct cmd_ds_802_11_subscribe_event) + |
727 | sizeof(struct mrvlietypes_snrthreshold)); | 721 | sizeof(struct mrvlietypes_snrthreshold)); |
@@ -729,30 +723,30 @@ static ssize_t libertas_lowsnr_write(struct file *file, | |||
729 | ptr = (u8*) pcmdptr+cmd_len; | 723 | ptr = (u8*) pcmdptr+cmd_len; |
730 | snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); | 724 | snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); |
731 | snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW); | 725 | snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW); |
732 | snr_threshold->header.len = 2; | 726 | snr_threshold->header.len = cpu_to_le16(2); |
733 | snr_threshold->snrvalue = cpu_to_le16(value); | 727 | snr_threshold->snrvalue = value; |
734 | snr_threshold->snrfreq = cpu_to_le16(freq); | 728 | snr_threshold->snrfreq = freq; |
735 | event_bitmap |= subscribed ? 0x0002 : 0x0; | 729 | event_bitmap |= subscribed ? 0x0002 : 0x0; |
736 | event->events = event_bitmap; | 730 | event->events = cpu_to_le16(event_bitmap); |
737 | 731 | ||
738 | libertas_queue_cmd(adapter, pcmdnode, 1); | 732 | libertas_queue_cmd(adapter, pcmdnode, 1); |
739 | wake_up_interruptible(&priv->mainthread.waitq); | 733 | wake_up_interruptible(&priv->mainthread.waitq); |
740 | 734 | ||
741 | /* Sleep until response is generated by FW */ | 735 | /* Sleep until response is generated by FW */ |
742 | wait_event_interruptible(pcmdnode->cmdwait_q, | 736 | wait_event_interruptible(pcmdnode->cmdwait_q, |
743 | pcmdnode->cmdwaitqwoken); | 737 | pcmdnode->cmdwaitqwoken); |
744 | 738 | ||
745 | pcmdptr = response_buf; | 739 | pcmdptr = response_buf; |
746 | 740 | ||
747 | if (pcmdptr->result) { | 741 | if (pcmdptr->result) { |
748 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 742 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
749 | pcmdptr->result); | 743 | le16_to_cpu(pcmdptr->result)); |
750 | kfree(response_buf); | 744 | kfree(response_buf); |
751 | free_page(addr); | 745 | free_page(addr); |
752 | return 0; | 746 | return 0; |
753 | } | 747 | } |
754 | 748 | ||
755 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 749 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
756 | lbs_pr_err("command response incorrect!\n"); | 750 | lbs_pr_err("command response incorrect!\n"); |
757 | kfree(response_buf); | 751 | kfree(response_buf); |
758 | free_page(addr); | 752 | free_page(addr); |
@@ -787,27 +781,26 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, | |||
787 | } | 781 | } |
788 | 782 | ||
789 | event = &pcmdptr->params.subscribe_event; | 783 | event = &pcmdptr->params.subscribe_event; |
790 | event->action = cmd_act_get; | 784 | event->action = cpu_to_le16(cmd_act_get); |
791 | pcmdptr->size = | 785 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
792 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
793 | libertas_queue_cmd(adapter, pcmdnode, 1); | 786 | libertas_queue_cmd(adapter, pcmdnode, 1); |
794 | wake_up_interruptible(&priv->mainthread.waitq); | 787 | wake_up_interruptible(&priv->mainthread.waitq); |
795 | 788 | ||
796 | /* Sleep until response is generated by FW */ | 789 | /* Sleep until response is generated by FW */ |
797 | wait_event_interruptible(pcmdnode->cmdwait_q, | 790 | wait_event_interruptible(pcmdnode->cmdwait_q, |
798 | pcmdnode->cmdwaitqwoken); | 791 | pcmdnode->cmdwaitqwoken); |
799 | 792 | ||
800 | pcmdptr = response_buf; | 793 | pcmdptr = response_buf; |
801 | 794 | ||
802 | if (pcmdptr->result) { | 795 | if (pcmdptr->result) { |
803 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 796 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
804 | pcmdptr->result); | 797 | le16_to_cpu(pcmdptr->result)); |
805 | kfree(response_buf); | 798 | kfree(response_buf); |
806 | free_page(addr); | 799 | free_page(addr); |
807 | return 0; | 800 | return 0; |
808 | } | 801 | } |
809 | 802 | ||
810 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 803 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
811 | lbs_pr_err("command response incorrect!\n"); | 804 | lbs_pr_err("command response incorrect!\n"); |
812 | kfree(response_buf); | 805 | kfree(response_buf); |
813 | free_page(addr); | 806 | free_page(addr); |
@@ -815,17 +808,17 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, | |||
815 | } | 808 | } |
816 | 809 | ||
817 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); | 810 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); |
818 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 811 | event = (void *)(response_buf + S_DS_GEN); |
819 | while (cmd_len < pcmdptr->size) { | 812 | while (cmd_len < le16_to_cpu(pcmdptr->size)) { |
820 | struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); | 813 | struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); |
821 | switch(header->type) { | 814 | switch (header->type) { |
822 | struct mrvlietypes_failurecount *failcount; | 815 | struct mrvlietypes_failurecount *failcount; |
823 | case TLV_TYPE_FAILCOUNT: | 816 | case __constant_cpu_to_le16(TLV_TYPE_FAILCOUNT): |
824 | failcount = (struct mrvlietypes_failurecount *)(response_buf + cmd_len); | 817 | failcount = (void *)(response_buf + cmd_len); |
825 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", | 818 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", |
826 | failcount->failvalue, | 819 | failcount->failvalue, |
827 | failcount->Failfreq, | 820 | failcount->Failfreq, |
828 | (event->events & 0x0004)?1:0); | 821 | (event->events & cpu_to_le16(0x0004))?1:0); |
829 | default: | 822 | default: |
830 | cmd_len += sizeof(struct mrvlietypes_failurecount); | 823 | cmd_len += sizeof(struct mrvlietypes_failurecount); |
831 | break; | 824 | break; |
@@ -874,7 +867,7 @@ static ssize_t libertas_failcount_write(struct file *file, | |||
874 | goto out_unlock; | 867 | goto out_unlock; |
875 | 868 | ||
876 | event = &pcmdptr->params.subscribe_event; | 869 | event = &pcmdptr->params.subscribe_event; |
877 | event->action = cmd_act_set; | 870 | event->action = cpu_to_le16(cmd_act_set); |
878 | pcmdptr->size = cpu_to_le16(S_DS_GEN + | 871 | pcmdptr->size = cpu_to_le16(S_DS_GEN + |
879 | sizeof(struct cmd_ds_802_11_subscribe_event) + | 872 | sizeof(struct cmd_ds_802_11_subscribe_event) + |
880 | sizeof(struct mrvlietypes_failurecount)); | 873 | sizeof(struct mrvlietypes_failurecount)); |
@@ -882,30 +875,30 @@ static ssize_t libertas_failcount_write(struct file *file, | |||
882 | ptr = (u8*) pcmdptr+cmd_len; | 875 | ptr = (u8*) pcmdptr+cmd_len; |
883 | failcount = (struct mrvlietypes_failurecount *)(ptr); | 876 | failcount = (struct mrvlietypes_failurecount *)(ptr); |
884 | failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT); | 877 | failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT); |
885 | failcount->header.len = 2; | 878 | failcount->header.len = cpu_to_le16(2); |
886 | failcount->failvalue = cpu_to_le16(value); | 879 | failcount->failvalue = value; |
887 | failcount->Failfreq = cpu_to_le16(freq); | 880 | failcount->Failfreq = freq; |
888 | event_bitmap |= subscribed ? 0x0004 : 0x0; | 881 | event_bitmap |= subscribed ? 0x0004 : 0x0; |
889 | event->events = event_bitmap; | 882 | event->events = cpu_to_le16(event_bitmap); |
890 | 883 | ||
891 | libertas_queue_cmd(adapter, pcmdnode, 1); | 884 | libertas_queue_cmd(adapter, pcmdnode, 1); |
892 | wake_up_interruptible(&priv->mainthread.waitq); | 885 | wake_up_interruptible(&priv->mainthread.waitq); |
893 | 886 | ||
894 | /* Sleep until response is generated by FW */ | 887 | /* Sleep until response is generated by FW */ |
895 | wait_event_interruptible(pcmdnode->cmdwait_q, | 888 | wait_event_interruptible(pcmdnode->cmdwait_q, |
896 | pcmdnode->cmdwaitqwoken); | 889 | pcmdnode->cmdwaitqwoken); |
897 | 890 | ||
898 | pcmdptr = (struct cmd_ds_command *)response_buf; | 891 | pcmdptr = (struct cmd_ds_command *)response_buf; |
899 | 892 | ||
900 | if (pcmdptr->result) { | 893 | if (pcmdptr->result) { |
901 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 894 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
902 | pcmdptr->result); | 895 | le16_to_cpu(pcmdptr->result)); |
903 | kfree(response_buf); | 896 | kfree(response_buf); |
904 | free_page(addr); | 897 | free_page(addr); |
905 | return 0; | 898 | return 0; |
906 | } | 899 | } |
907 | 900 | ||
908 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 901 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
909 | lbs_pr_err("command response incorrect!\n"); | 902 | lbs_pr_err("command response incorrect!\n"); |
910 | kfree(response_buf); | 903 | kfree(response_buf); |
911 | free_page(addr); | 904 | free_page(addr); |
@@ -939,27 +932,26 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, | |||
939 | } | 932 | } |
940 | 933 | ||
941 | event = &pcmdptr->params.subscribe_event; | 934 | event = &pcmdptr->params.subscribe_event; |
942 | event->action = cmd_act_get; | 935 | event->action = cpu_to_le16(cmd_act_get); |
943 | pcmdptr->size = | 936 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
944 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
945 | libertas_queue_cmd(adapter, pcmdnode, 1); | 937 | libertas_queue_cmd(adapter, pcmdnode, 1); |
946 | wake_up_interruptible(&priv->mainthread.waitq); | 938 | wake_up_interruptible(&priv->mainthread.waitq); |
947 | 939 | ||
948 | /* Sleep until response is generated by FW */ | 940 | /* Sleep until response is generated by FW */ |
949 | wait_event_interruptible(pcmdnode->cmdwait_q, | 941 | wait_event_interruptible(pcmdnode->cmdwait_q, |
950 | pcmdnode->cmdwaitqwoken); | 942 | pcmdnode->cmdwaitqwoken); |
951 | 943 | ||
952 | pcmdptr = response_buf; | 944 | pcmdptr = response_buf; |
953 | 945 | ||
954 | if (pcmdptr->result) { | 946 | if (pcmdptr->result) { |
955 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 947 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
956 | pcmdptr->result); | 948 | le16_to_cpu(pcmdptr->result)); |
957 | free_page(addr); | 949 | free_page(addr); |
958 | kfree(response_buf); | 950 | kfree(response_buf); |
959 | return 0; | 951 | return 0; |
960 | } | 952 | } |
961 | 953 | ||
962 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 954 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
963 | lbs_pr_err("command response incorrect!\n"); | 955 | lbs_pr_err("command response incorrect!\n"); |
964 | free_page(addr); | 956 | free_page(addr); |
965 | kfree(response_buf); | 957 | kfree(response_buf); |
@@ -967,16 +959,16 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, | |||
967 | } | 959 | } |
968 | 960 | ||
969 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); | 961 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); |
970 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 962 | event = (void *)(response_buf + S_DS_GEN); |
971 | while (cmd_len < pcmdptr->size) { | 963 | while (cmd_len < le16_to_cpu(pcmdptr->size)) { |
972 | struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); | 964 | struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); |
973 | switch(header->type) { | 965 | switch (header->type) { |
974 | struct mrvlietypes_beaconsmissed *bcnmiss; | 966 | struct mrvlietypes_beaconsmissed *bcnmiss; |
975 | case TLV_TYPE_BCNMISS: | 967 | case __constant_cpu_to_le16(TLV_TYPE_BCNMISS): |
976 | bcnmiss = (struct mrvlietypes_beaconsmissed *)(response_buf + cmd_len); | 968 | bcnmiss = (void *)(response_buf + cmd_len); |
977 | pos += snprintf(buf+pos, len-pos, "%d N/A %d\n", | 969 | pos += snprintf(buf+pos, len-pos, "%d N/A %d\n", |
978 | bcnmiss->beaconmissed, | 970 | bcnmiss->beaconmissed, |
979 | (event->events & 0x0008)?1:0); | 971 | (event->events & cpu_to_le16(0x0008))?1:0); |
980 | default: | 972 | default: |
981 | cmd_len += sizeof(struct mrvlietypes_beaconsmissed); | 973 | cmd_len += sizeof(struct mrvlietypes_beaconsmissed); |
982 | break; | 974 | break; |
@@ -1026,7 +1018,7 @@ static ssize_t libertas_bcnmiss_write(struct file *file, | |||
1026 | goto out_unlock; | 1018 | goto out_unlock; |
1027 | 1019 | ||
1028 | event = &pcmdptr->params.subscribe_event; | 1020 | event = &pcmdptr->params.subscribe_event; |
1029 | event->action = cmd_act_set; | 1021 | event->action = cpu_to_le16(cmd_act_set); |
1030 | pcmdptr->size = cpu_to_le16(S_DS_GEN + | 1022 | pcmdptr->size = cpu_to_le16(S_DS_GEN + |
1031 | sizeof(struct cmd_ds_802_11_subscribe_event) + | 1023 | sizeof(struct cmd_ds_802_11_subscribe_event) + |
1032 | sizeof(struct mrvlietypes_beaconsmissed)); | 1024 | sizeof(struct mrvlietypes_beaconsmissed)); |
@@ -1034,29 +1026,29 @@ static ssize_t libertas_bcnmiss_write(struct file *file, | |||
1034 | ptr = (u8*) pcmdptr+cmd_len; | 1026 | ptr = (u8*) pcmdptr+cmd_len; |
1035 | bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr); | 1027 | bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr); |
1036 | bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS); | 1028 | bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS); |
1037 | bcnmiss->header.len = 2; | 1029 | bcnmiss->header.len = cpu_to_le16(2); |
1038 | bcnmiss->beaconmissed = cpu_to_le16(value); | 1030 | bcnmiss->beaconmissed = value; |
1039 | event_bitmap |= subscribed ? 0x0008 : 0x0; | 1031 | event_bitmap |= subscribed ? 0x0008 : 0x0; |
1040 | event->events = event_bitmap; | 1032 | event->events = cpu_to_le16(event_bitmap); |
1041 | 1033 | ||
1042 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1034 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1043 | wake_up_interruptible(&priv->mainthread.waitq); | 1035 | wake_up_interruptible(&priv->mainthread.waitq); |
1044 | 1036 | ||
1045 | /* Sleep until response is generated by FW */ | 1037 | /* Sleep until response is generated by FW */ |
1046 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1038 | wait_event_interruptible(pcmdnode->cmdwait_q, |
1047 | pcmdnode->cmdwaitqwoken); | 1039 | pcmdnode->cmdwaitqwoken); |
1048 | 1040 | ||
1049 | pcmdptr = response_buf; | 1041 | pcmdptr = response_buf; |
1050 | 1042 | ||
1051 | if (pcmdptr->result) { | 1043 | if (pcmdptr->result) { |
1052 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 1044 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
1053 | pcmdptr->result); | 1045 | le16_to_cpu(pcmdptr->result)); |
1054 | kfree(response_buf); | 1046 | kfree(response_buf); |
1055 | free_page(addr); | 1047 | free_page(addr); |
1056 | return 0; | 1048 | return 0; |
1057 | } | 1049 | } |
1058 | 1050 | ||
1059 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 1051 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
1060 | lbs_pr_err("command response incorrect!\n"); | 1052 | lbs_pr_err("command response incorrect!\n"); |
1061 | free_page(addr); | 1053 | free_page(addr); |
1062 | kfree(response_buf); | 1054 | kfree(response_buf); |
@@ -1090,27 +1082,26 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, | |||
1090 | } | 1082 | } |
1091 | 1083 | ||
1092 | event = &pcmdptr->params.subscribe_event; | 1084 | event = &pcmdptr->params.subscribe_event; |
1093 | event->action = cmd_act_get; | 1085 | event->action = cpu_to_le16(cmd_act_get); |
1094 | pcmdptr->size = | 1086 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
1095 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
1096 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1087 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1097 | wake_up_interruptible(&priv->mainthread.waitq); | 1088 | wake_up_interruptible(&priv->mainthread.waitq); |
1098 | 1089 | ||
1099 | /* Sleep until response is generated by FW */ | 1090 | /* Sleep until response is generated by FW */ |
1100 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1091 | wait_event_interruptible(pcmdnode->cmdwait_q, |
1101 | pcmdnode->cmdwaitqwoken); | 1092 | pcmdnode->cmdwaitqwoken); |
1102 | 1093 | ||
1103 | pcmdptr = response_buf; | 1094 | pcmdptr = response_buf; |
1104 | 1095 | ||
1105 | if (pcmdptr->result) { | 1096 | if (pcmdptr->result) { |
1106 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 1097 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
1107 | pcmdptr->result); | 1098 | le16_to_cpu(pcmdptr->result)); |
1108 | kfree(response_buf); | 1099 | kfree(response_buf); |
1109 | free_page(addr); | 1100 | free_page(addr); |
1110 | return 0; | 1101 | return 0; |
1111 | } | 1102 | } |
1112 | 1103 | ||
1113 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 1104 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
1114 | lbs_pr_err("command response incorrect!\n"); | 1105 | lbs_pr_err("command response incorrect!\n"); |
1115 | kfree(response_buf); | 1106 | kfree(response_buf); |
1116 | free_page(addr); | 1107 | free_page(addr); |
@@ -1118,17 +1109,17 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, | |||
1118 | } | 1109 | } |
1119 | 1110 | ||
1120 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); | 1111 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); |
1121 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 1112 | event = (void *)(response_buf + S_DS_GEN); |
1122 | while (cmd_len < pcmdptr->size) { | 1113 | while (cmd_len < le16_to_cpu(pcmdptr->size)) { |
1123 | struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); | 1114 | struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); |
1124 | switch(header->type) { | 1115 | switch (header->type) { |
1125 | struct mrvlietypes_rssithreshold *Highrssi; | 1116 | struct mrvlietypes_rssithreshold *Highrssi; |
1126 | case TLV_TYPE_RSSI_HIGH: | 1117 | case __constant_cpu_to_le16(TLV_TYPE_RSSI_HIGH): |
1127 | Highrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len); | 1118 | Highrssi = (void *)(response_buf + cmd_len); |
1128 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", | 1119 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", |
1129 | Highrssi->rssivalue, | 1120 | Highrssi->rssivalue, |
1130 | Highrssi->rssifreq, | 1121 | Highrssi->rssifreq, |
1131 | (event->events & 0x0010)?1:0); | 1122 | (event->events & cpu_to_le16(0x0010))?1:0); |
1132 | default: | 1123 | default: |
1133 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); | 1124 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); |
1134 | break; | 1125 | break; |
@@ -1178,7 +1169,7 @@ static ssize_t libertas_highrssi_write(struct file *file, | |||
1178 | goto out_unlock; | 1169 | goto out_unlock; |
1179 | 1170 | ||
1180 | event = &pcmdptr->params.subscribe_event; | 1171 | event = &pcmdptr->params.subscribe_event; |
1181 | event->action = cmd_act_set; | 1172 | event->action = cpu_to_le16(cmd_act_set); |
1182 | pcmdptr->size = cpu_to_le16(S_DS_GEN + | 1173 | pcmdptr->size = cpu_to_le16(S_DS_GEN + |
1183 | sizeof(struct cmd_ds_802_11_subscribe_event) + | 1174 | sizeof(struct cmd_ds_802_11_subscribe_event) + |
1184 | sizeof(struct mrvlietypes_rssithreshold)); | 1175 | sizeof(struct mrvlietypes_rssithreshold)); |
@@ -1186,29 +1177,29 @@ static ssize_t libertas_highrssi_write(struct file *file, | |||
1186 | ptr = (u8*) pcmdptr+cmd_len; | 1177 | ptr = (u8*) pcmdptr+cmd_len; |
1187 | rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); | 1178 | rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); |
1188 | rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH); | 1179 | rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH); |
1189 | rssi_threshold->header.len = 2; | 1180 | rssi_threshold->header.len = cpu_to_le16(2); |
1190 | rssi_threshold->rssivalue = cpu_to_le16(value); | 1181 | rssi_threshold->rssivalue = value; |
1191 | rssi_threshold->rssifreq = cpu_to_le16(freq); | 1182 | rssi_threshold->rssifreq = freq; |
1192 | event_bitmap |= subscribed ? 0x0010 : 0x0; | 1183 | event_bitmap |= subscribed ? 0x0010 : 0x0; |
1193 | event->events = event_bitmap; | 1184 | event->events = cpu_to_le16(event_bitmap); |
1194 | 1185 | ||
1195 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1186 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1196 | wake_up_interruptible(&priv->mainthread.waitq); | 1187 | wake_up_interruptible(&priv->mainthread.waitq); |
1197 | 1188 | ||
1198 | /* Sleep until response is generated by FW */ | 1189 | /* Sleep until response is generated by FW */ |
1199 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1190 | wait_event_interruptible(pcmdnode->cmdwait_q, |
1200 | pcmdnode->cmdwaitqwoken); | 1191 | pcmdnode->cmdwaitqwoken); |
1201 | 1192 | ||
1202 | pcmdptr = response_buf; | 1193 | pcmdptr = response_buf; |
1203 | 1194 | ||
1204 | if (pcmdptr->result) { | 1195 | if (pcmdptr->result) { |
1205 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 1196 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
1206 | pcmdptr->result); | 1197 | le16_to_cpu(pcmdptr->result)); |
1207 | kfree(response_buf); | 1198 | kfree(response_buf); |
1208 | return 0; | 1199 | return 0; |
1209 | } | 1200 | } |
1210 | 1201 | ||
1211 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 1202 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
1212 | lbs_pr_err("command response incorrect!\n"); | 1203 | lbs_pr_err("command response incorrect!\n"); |
1213 | kfree(response_buf); | 1204 | kfree(response_buf); |
1214 | return 0; | 1205 | return 0; |
@@ -1241,27 +1232,26 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, | |||
1241 | } | 1232 | } |
1242 | 1233 | ||
1243 | event = &pcmdptr->params.subscribe_event; | 1234 | event = &pcmdptr->params.subscribe_event; |
1244 | event->action = cmd_act_get; | 1235 | event->action = cpu_to_le16(cmd_act_get); |
1245 | pcmdptr->size = | 1236 | pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); |
1246 | cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); | ||
1247 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1237 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1248 | wake_up_interruptible(&priv->mainthread.waitq); | 1238 | wake_up_interruptible(&priv->mainthread.waitq); |
1249 | 1239 | ||
1250 | /* Sleep until response is generated by FW */ | 1240 | /* Sleep until response is generated by FW */ |
1251 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1241 | wait_event_interruptible(pcmdnode->cmdwait_q, |
1252 | pcmdnode->cmdwaitqwoken); | 1242 | pcmdnode->cmdwaitqwoken); |
1253 | 1243 | ||
1254 | pcmdptr = response_buf; | 1244 | pcmdptr = response_buf; |
1255 | 1245 | ||
1256 | if (pcmdptr->result) { | 1246 | if (pcmdptr->result) { |
1257 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 1247 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
1258 | pcmdptr->result); | 1248 | le16_to_cpu(pcmdptr->result)); |
1259 | kfree(response_buf); | 1249 | kfree(response_buf); |
1260 | free_page(addr); | 1250 | free_page(addr); |
1261 | return 0; | 1251 | return 0; |
1262 | } | 1252 | } |
1263 | 1253 | ||
1264 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 1254 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
1265 | lbs_pr_err("command response incorrect!\n"); | 1255 | lbs_pr_err("command response incorrect!\n"); |
1266 | kfree(response_buf); | 1256 | kfree(response_buf); |
1267 | free_page(addr); | 1257 | free_page(addr); |
@@ -1269,17 +1259,17 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, | |||
1269 | } | 1259 | } |
1270 | 1260 | ||
1271 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); | 1261 | cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); |
1272 | event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); | 1262 | event = (void *)(response_buf + S_DS_GEN); |
1273 | while (cmd_len < pcmdptr->size) { | 1263 | while (cmd_len < le16_to_cpu(pcmdptr->size)) { |
1274 | struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); | 1264 | struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); |
1275 | switch(header->type) { | 1265 | switch (header->type) { |
1276 | struct mrvlietypes_snrthreshold *HighSnr; | 1266 | struct mrvlietypes_snrthreshold *HighSnr; |
1277 | case TLV_TYPE_SNR_HIGH: | 1267 | case __constant_cpu_to_le16(TLV_TYPE_SNR_HIGH): |
1278 | HighSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len); | 1268 | HighSnr = (void *)(response_buf + cmd_len); |
1279 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", | 1269 | pos += snprintf(buf+pos, len-pos, "%d %d %d\n", |
1280 | HighSnr->snrvalue, | 1270 | HighSnr->snrvalue, |
1281 | HighSnr->snrfreq, | 1271 | HighSnr->snrfreq, |
1282 | (event->events & 0x0020)?1:0); | 1272 | (event->events & cpu_to_le16(0x0020))?1:0); |
1283 | default: | 1273 | default: |
1284 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); | 1274 | cmd_len += sizeof(struct mrvlietypes_snrthreshold); |
1285 | break; | 1275 | break; |
@@ -1329,7 +1319,7 @@ static ssize_t libertas_highsnr_write(struct file *file, | |||
1329 | goto out_unlock; | 1319 | goto out_unlock; |
1330 | 1320 | ||
1331 | event = &pcmdptr->params.subscribe_event; | 1321 | event = &pcmdptr->params.subscribe_event; |
1332 | event->action = cmd_act_set; | 1322 | event->action = cpu_to_le16(cmd_act_set); |
1333 | pcmdptr->size = cpu_to_le16(S_DS_GEN + | 1323 | pcmdptr->size = cpu_to_le16(S_DS_GEN + |
1334 | sizeof(struct cmd_ds_802_11_subscribe_event) + | 1324 | sizeof(struct cmd_ds_802_11_subscribe_event) + |
1335 | sizeof(struct mrvlietypes_snrthreshold)); | 1325 | sizeof(struct mrvlietypes_snrthreshold)); |
@@ -1337,30 +1327,30 @@ static ssize_t libertas_highsnr_write(struct file *file, | |||
1337 | ptr = (u8*) pcmdptr+cmd_len; | 1327 | ptr = (u8*) pcmdptr+cmd_len; |
1338 | snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); | 1328 | snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); |
1339 | snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH); | 1329 | snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH); |
1340 | snr_threshold->header.len = 2; | 1330 | snr_threshold->header.len = cpu_to_le16(2); |
1341 | snr_threshold->snrvalue = cpu_to_le16(value); | 1331 | snr_threshold->snrvalue = value; |
1342 | snr_threshold->snrfreq = cpu_to_le16(freq); | 1332 | snr_threshold->snrfreq = freq; |
1343 | event_bitmap |= subscribed ? 0x0020 : 0x0; | 1333 | event_bitmap |= subscribed ? 0x0020 : 0x0; |
1344 | event->events = event_bitmap; | 1334 | event->events = cpu_to_le16(event_bitmap); |
1345 | 1335 | ||
1346 | libertas_queue_cmd(adapter, pcmdnode, 1); | 1336 | libertas_queue_cmd(adapter, pcmdnode, 1); |
1347 | wake_up_interruptible(&priv->mainthread.waitq); | 1337 | wake_up_interruptible(&priv->mainthread.waitq); |
1348 | 1338 | ||
1349 | /* Sleep until response is generated by FW */ | 1339 | /* Sleep until response is generated by FW */ |
1350 | wait_event_interruptible(pcmdnode->cmdwait_q, | 1340 | wait_event_interruptible(pcmdnode->cmdwait_q, |
1351 | pcmdnode->cmdwaitqwoken); | 1341 | pcmdnode->cmdwaitqwoken); |
1352 | 1342 | ||
1353 | pcmdptr = response_buf; | 1343 | pcmdptr = response_buf; |
1354 | 1344 | ||
1355 | if (pcmdptr->result) { | 1345 | if (pcmdptr->result) { |
1356 | lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, | 1346 | lbs_pr_err("%s: fail, result=%d\n", __func__, |
1357 | pcmdptr->result); | 1347 | le16_to_cpu(pcmdptr->result)); |
1358 | kfree(response_buf); | 1348 | kfree(response_buf); |
1359 | free_page(addr); | 1349 | free_page(addr); |
1360 | return 0; | 1350 | return 0; |
1361 | } | 1351 | } |
1362 | 1352 | ||
1363 | if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { | 1353 | if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { |
1364 | lbs_pr_err("command response incorrect!\n"); | 1354 | lbs_pr_err("command response incorrect!\n"); |
1365 | kfree(response_buf); | 1355 | kfree(response_buf); |
1366 | free_page(addr); | 1356 | free_page(addr); |
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c index 2be1815e2878..96f1974685d4 100644 --- a/drivers/net/wireless/libertas/ethtool.c +++ b/drivers/net/wireless/libertas/ethtool.c | |||
@@ -146,14 +146,14 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev) | |||
146 | goto done; | 146 | goto done; |
147 | } | 147 | } |
148 | 148 | ||
149 | priv->mstats.fwd_drop_rbt = mesh_access.data[0]; | 149 | priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]); |
150 | priv->mstats.fwd_drop_ttl = mesh_access.data[1]; | 150 | priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]); |
151 | priv->mstats.fwd_drop_noroute = mesh_access.data[2]; | 151 | priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]); |
152 | priv->mstats.fwd_drop_nobuf = mesh_access.data[3]; | 152 | priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]); |
153 | priv->mstats.fwd_unicast_cnt = mesh_access.data[4]; | 153 | priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]); |
154 | priv->mstats.fwd_bcast_cnt = mesh_access.data[5]; | 154 | priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]); |
155 | priv->mstats.drop_blind = mesh_access.data[6]; | 155 | priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]); |
156 | priv->mstats.tx_failed_cnt = mesh_access.data[7]; | 156 | priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]); |
157 | 157 | ||
158 | ret = MESH_STATS_NUM; | 158 | ret = MESH_STATS_NUM; |
159 | 159 | ||
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c index 5463ee618a19..2dc84ff7a54a 100644 --- a/drivers/net/wireless/libertas/fw.c +++ b/drivers/net/wireless/libertas/fw.c | |||
@@ -19,7 +19,7 @@ | |||
19 | */ | 19 | */ |
20 | static int check_fwfile_format(u8 *data, u32 totlen) | 20 | static int check_fwfile_format(u8 *data, u32 totlen) |
21 | { | 21 | { |
22 | u8 bincmd, exit; | 22 | u32 bincmd, exit; |
23 | u32 blksize, offset, len; | 23 | u32 blksize, offset, len; |
24 | int ret; | 24 | int ret; |
25 | 25 | ||
@@ -27,8 +27,10 @@ static int check_fwfile_format(u8 *data, u32 totlen) | |||
27 | exit = len = 0; | 27 | exit = len = 0; |
28 | 28 | ||
29 | do { | 29 | do { |
30 | bincmd = *data; | 30 | struct fwheader *fwh = (void *)data; |
31 | blksize = *(u32*)(data + offsetof(struct fwheader, datalength)); | 31 | |
32 | bincmd = le32_to_cpu(fwh->dnldcmd); | ||
33 | blksize = le32_to_cpu(fwh->datalength); | ||
32 | switch (bincmd) { | 34 | switch (bincmd) { |
33 | case FW_HAS_DATA_TO_RECV: | 35 | case FW_HAS_DATA_TO_RECV: |
34 | offset = sizeof(struct fwheader) + blksize; | 36 | offset = sizeof(struct fwheader) + blksize; |
@@ -72,13 +74,12 @@ static int wlan_setup_station_hw(wlan_private * priv, char *fw_name) | |||
72 | 74 | ||
73 | if ((ret = request_firmware(&priv->firmware, fw_name, | 75 | if ((ret = request_firmware(&priv->firmware, fw_name, |
74 | priv->hotplug_device)) < 0) { | 76 | priv->hotplug_device)) < 0) { |
75 | lbs_pr_err("request_firmware() failed with %#x\n", | 77 | lbs_pr_err("request_firmware() failed with %#x\n", ret); |
76 | ret); | ||
77 | lbs_pr_err("firmware %s not found\n", fw_name); | 78 | lbs_pr_err("firmware %s not found\n", fw_name); |
78 | goto done; | 79 | goto done; |
79 | } | 80 | } |
80 | 81 | ||
81 | if(check_fwfile_format(priv->firmware->data, priv->firmware->size)) { | 82 | if (check_fwfile_format(priv->firmware->data, priv->firmware->size)) { |
82 | release_firmware(priv->firmware); | 83 | release_firmware(priv->firmware); |
83 | goto done; | 84 | goto done; |
84 | } | 85 | } |
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 581b9a37d7b7..204d9d53aba8 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h | |||
@@ -14,12 +14,12 @@ | |||
14 | /* TxPD descriptor */ | 14 | /* TxPD descriptor */ |
15 | struct txpd { | 15 | struct txpd { |
16 | /* Current Tx packet status */ | 16 | /* Current Tx packet status */ |
17 | u32 tx_status; | 17 | __le32 tx_status; |
18 | /* Tx control */ | 18 | /* Tx control */ |
19 | u32 tx_control; | 19 | __le32 tx_control; |
20 | u32 tx_packet_location; | 20 | __le32 tx_packet_location; |
21 | /* Tx packet length */ | 21 | /* Tx packet length */ |
22 | u16 tx_packet_length; | 22 | __le16 tx_packet_length; |
23 | /* First 2 byte of destination MAC address */ | 23 | /* First 2 byte of destination MAC address */ |
24 | u8 tx_dest_addr_high[2]; | 24 | u8 tx_dest_addr_high[2]; |
25 | /* Last 4 byte of destination MAC address */ | 25 | /* Last 4 byte of destination MAC address */ |
@@ -37,7 +37,7 @@ struct txpd { | |||
37 | /* RxPD Descriptor */ | 37 | /* RxPD Descriptor */ |
38 | struct rxpd { | 38 | struct rxpd { |
39 | /* Current Rx packet status */ | 39 | /* Current Rx packet status */ |
40 | u16 status; | 40 | __le16 status; |
41 | 41 | ||
42 | /* SNR */ | 42 | /* SNR */ |
43 | u8 snr; | 43 | u8 snr; |
@@ -46,7 +46,7 @@ struct rxpd { | |||
46 | u8 rx_control; | 46 | u8 rx_control; |
47 | 47 | ||
48 | /* Pkt length */ | 48 | /* Pkt length */ |
49 | u16 pkt_len; | 49 | __le16 pkt_len; |
50 | 50 | ||
51 | /* Noise Floor */ | 51 | /* Noise Floor */ |
52 | u8 nf; | 52 | u8 nf; |
@@ -55,10 +55,10 @@ struct rxpd { | |||
55 | u8 rx_rate; | 55 | u8 rx_rate; |
56 | 56 | ||
57 | /* Pkt addr */ | 57 | /* Pkt addr */ |
58 | u32 pkt_ptr; | 58 | __le32 pkt_ptr; |
59 | 59 | ||
60 | /* Next Rx RxPD addr */ | 60 | /* Next Rx RxPD addr */ |
61 | u32 next_rxpd_ptr; | 61 | __le32 next_rxpd_ptr; |
62 | 62 | ||
63 | /* Pkt Priority */ | 63 | /* Pkt Priority */ |
64 | u8 priority; | 64 | u8 priority; |
@@ -89,22 +89,22 @@ struct cmd_ctrl_node { | |||
89 | * is determined from the keylength field. | 89 | * is determined from the keylength field. |
90 | */ | 90 | */ |
91 | struct WLAN_802_11_KEY { | 91 | struct WLAN_802_11_KEY { |
92 | u32 len; | 92 | __le32 len; |
93 | u32 flags; /* KEY_INFO_* from wlan_defs.h */ | 93 | __le32 flags; /* KEY_INFO_* from wlan_defs.h */ |
94 | u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH]; | 94 | u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH]; |
95 | u16 type; /* KEY_TYPE_* from wlan_defs.h */ | 95 | __le16 type; /* KEY_TYPE_* from wlan_defs.h */ |
96 | }; | 96 | }; |
97 | 97 | ||
98 | struct IE_WPA { | 98 | struct IE_WPA { |
99 | u8 elementid; | 99 | u8 elementid; |
100 | u8 len; | 100 | u8 len; |
101 | u8 oui[4]; | 101 | u8 oui[4]; |
102 | u16 version; | 102 | __le16 version; |
103 | }; | 103 | }; |
104 | 104 | ||
105 | struct WLAN_802_11_SSID { | 105 | struct WLAN_802_11_SSID { |
106 | /* SSID length */ | 106 | /* SSID length */ |
107 | u32 ssidlength; | 107 | __le32 ssidlength; |
108 | 108 | ||
109 | /* SSID information field */ | 109 | /* SSID information field */ |
110 | u8 ssid[IW_ESSID_MAX_SIZE]; | 110 | u8 ssid[IW_ESSID_MAX_SIZE]; |
@@ -122,9 +122,9 @@ struct wlan_offset_value { | |||
122 | }; | 122 | }; |
123 | 123 | ||
124 | struct WLAN_802_11_FIXED_IEs { | 124 | struct WLAN_802_11_FIXED_IEs { |
125 | u8 timestamp[8]; | 125 | __le64 timestamp; |
126 | u16 beaconinterval; | 126 | __le16 beaconinterval; |
127 | u16 capabilities; | 127 | u16 capabilities; /* Actually struct ieeetypes_capinfo */ |
128 | }; | 128 | }; |
129 | 129 | ||
130 | struct WLAN_802_11_VARIABLE_IEs { | 130 | struct WLAN_802_11_VARIABLE_IEs { |
@@ -136,10 +136,10 @@ struct WLAN_802_11_VARIABLE_IEs { | |||
136 | /* Define general data structure */ | 136 | /* Define general data structure */ |
137 | /* cmd_DS_GEN */ | 137 | /* cmd_DS_GEN */ |
138 | struct cmd_ds_gen { | 138 | struct cmd_ds_gen { |
139 | u16 command; | 139 | __le16 command; |
140 | u16 size; | 140 | __le16 size; |
141 | u16 seqnum; | 141 | __le16 seqnum; |
142 | u16 result; | 142 | __le16 result; |
143 | }; | 143 | }; |
144 | 144 | ||
145 | #define S_DS_GEN sizeof(struct cmd_ds_gen) | 145 | #define S_DS_GEN sizeof(struct cmd_ds_gen) |
@@ -149,44 +149,44 @@ struct cmd_ds_gen { | |||
149 | */ | 149 | */ |
150 | struct cmd_ds_get_hw_spec { | 150 | struct cmd_ds_get_hw_spec { |
151 | /* HW Interface version number */ | 151 | /* HW Interface version number */ |
152 | u16 hwifversion; | 152 | __le16 hwifversion; |
153 | /* HW version number */ | 153 | /* HW version number */ |
154 | u16 version; | 154 | __le16 version; |
155 | /* Max number of TxPD FW can handle */ | 155 | /* Max number of TxPD FW can handle */ |
156 | u16 nr_txpd; | 156 | __le16 nr_txpd; |
157 | /* Max no of Multicast address */ | 157 | /* Max no of Multicast address */ |
158 | u16 nr_mcast_adr; | 158 | __le16 nr_mcast_adr; |
159 | /* MAC address */ | 159 | /* MAC address */ |
160 | u8 permanentaddr[6]; | 160 | u8 permanentaddr[6]; |
161 | 161 | ||
162 | /* region Code */ | 162 | /* region Code */ |
163 | u16 regioncode; | 163 | __le16 regioncode; |
164 | 164 | ||
165 | /* Number of antenna used */ | 165 | /* Number of antenna used */ |
166 | u16 nr_antenna; | 166 | __le16 nr_antenna; |
167 | 167 | ||
168 | /* FW release number, example 0x1234=1.2.3.4 */ | 168 | /* FW release number, example 0x1234=1.2.3.4 */ |
169 | u32 fwreleasenumber; | 169 | __le32 fwreleasenumber; |
170 | 170 | ||
171 | /* Base Address of TxPD queue */ | 171 | /* Base Address of TxPD queue */ |
172 | u32 wcb_base; | 172 | __le32 wcb_base; |
173 | /* Read Pointer of RxPd queue */ | 173 | /* Read Pointer of RxPd queue */ |
174 | u32 rxpd_rdptr; | 174 | __le32 rxpd_rdptr; |
175 | 175 | ||
176 | /* Write Pointer of RxPd queue */ | 176 | /* Write Pointer of RxPd queue */ |
177 | u32 rxpd_wrptr; | 177 | __le32 rxpd_wrptr; |
178 | 178 | ||
179 | /*FW/HW capability */ | 179 | /*FW/HW capability */ |
180 | u32 fwcapinfo; | 180 | __le32 fwcapinfo; |
181 | } __attribute__ ((packed)); | 181 | } __attribute__ ((packed)); |
182 | 182 | ||
183 | struct cmd_ds_802_11_reset { | 183 | struct cmd_ds_802_11_reset { |
184 | u16 action; | 184 | __le16 action; |
185 | }; | 185 | }; |
186 | 186 | ||
187 | struct cmd_ds_802_11_subscribe_event { | 187 | struct cmd_ds_802_11_subscribe_event { |
188 | u16 action; | 188 | __le16 action; |
189 | u16 events; | 189 | __le16 events; |
190 | }; | 190 | }; |
191 | 191 | ||
192 | /* | 192 | /* |
@@ -205,35 +205,35 @@ struct cmd_ds_802_11_scan { | |||
205 | }; | 205 | }; |
206 | 206 | ||
207 | struct cmd_ds_802_11_scan_rsp { | 207 | struct cmd_ds_802_11_scan_rsp { |
208 | u16 bssdescriptsize; | 208 | __le16 bssdescriptsize; |
209 | u8 nr_sets; | 209 | u8 nr_sets; |
210 | u8 bssdesc_and_tlvbuffer[1]; | 210 | u8 bssdesc_and_tlvbuffer[1]; |
211 | }; | 211 | }; |
212 | 212 | ||
213 | struct cmd_ds_802_11_get_log { | 213 | struct cmd_ds_802_11_get_log { |
214 | u32 mcasttxframe; | 214 | __le32 mcasttxframe; |
215 | u32 failed; | 215 | __le32 failed; |
216 | u32 retry; | 216 | __le32 retry; |
217 | u32 multiretry; | 217 | __le32 multiretry; |
218 | u32 framedup; | 218 | __le32 framedup; |
219 | u32 rtssuccess; | 219 | __le32 rtssuccess; |
220 | u32 rtsfailure; | 220 | __le32 rtsfailure; |
221 | u32 ackfailure; | 221 | __le32 ackfailure; |
222 | u32 rxfrag; | 222 | __le32 rxfrag; |
223 | u32 mcastrxframe; | 223 | __le32 mcastrxframe; |
224 | u32 fcserror; | 224 | __le32 fcserror; |
225 | u32 txframe; | 225 | __le32 txframe; |
226 | u32 wepundecryptable; | 226 | __le32 wepundecryptable; |
227 | }; | 227 | }; |
228 | 228 | ||
229 | struct cmd_ds_mac_control { | 229 | struct cmd_ds_mac_control { |
230 | u16 action; | 230 | __le16 action; |
231 | u16 reserved; | 231 | __le16 reserved; |
232 | }; | 232 | }; |
233 | 233 | ||
234 | struct cmd_ds_mac_multicast_adr { | 234 | struct cmd_ds_mac_multicast_adr { |
235 | u16 action; | 235 | __le16 action; |
236 | u16 nr_of_adrs; | 236 | __le16 nr_of_adrs; |
237 | u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE]; | 237 | u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE]; |
238 | }; | 238 | }; |
239 | 239 | ||
@@ -245,14 +245,14 @@ struct cmd_ds_802_11_authenticate { | |||
245 | 245 | ||
246 | struct cmd_ds_802_11_deauthenticate { | 246 | struct cmd_ds_802_11_deauthenticate { |
247 | u8 macaddr[6]; | 247 | u8 macaddr[6]; |
248 | u16 reasoncode; | 248 | __le16 reasoncode; |
249 | }; | 249 | }; |
250 | 250 | ||
251 | struct cmd_ds_802_11_associate { | 251 | struct cmd_ds_802_11_associate { |
252 | u8 peerstaaddr[6]; | 252 | u8 peerstaaddr[6]; |
253 | struct ieeetypes_capinfo capinfo; | 253 | struct ieeetypes_capinfo capinfo; |
254 | u16 listeninterval; | 254 | __le16 listeninterval; |
255 | u16 bcnperiod; | 255 | __le16 bcnperiod; |
256 | u8 dtimperiod; | 256 | u8 dtimperiod; |
257 | 257 | ||
258 | #if 0 | 258 | #if 0 |
@@ -265,7 +265,7 @@ struct cmd_ds_802_11_associate { | |||
265 | 265 | ||
266 | struct cmd_ds_802_11_disassociate { | 266 | struct cmd_ds_802_11_disassociate { |
267 | u8 destmacaddr[6]; | 267 | u8 destmacaddr[6]; |
268 | u16 reasoncode; | 268 | __le16 reasoncode; |
269 | }; | 269 | }; |
270 | 270 | ||
271 | struct cmd_ds_802_11_associate_rsp { | 271 | struct cmd_ds_802_11_associate_rsp { |
@@ -279,10 +279,10 @@ struct cmd_ds_802_11_ad_hoc_result { | |||
279 | 279 | ||
280 | struct cmd_ds_802_11_set_wep { | 280 | struct cmd_ds_802_11_set_wep { |
281 | /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */ | 281 | /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */ |
282 | u16 action; | 282 | __le16 action; |
283 | 283 | ||
284 | /* key Index selected for Tx */ | 284 | /* key Index selected for Tx */ |
285 | u16 keyindex; | 285 | __le16 keyindex; |
286 | 286 | ||
287 | /* 40, 128bit or TXWEP */ | 287 | /* 40, 128bit or TXWEP */ |
288 | u8 keytype[4]; | 288 | u8 keytype[4]; |
@@ -290,96 +290,96 @@ struct cmd_ds_802_11_set_wep { | |||
290 | }; | 290 | }; |
291 | 291 | ||
292 | struct cmd_ds_802_3_get_stat { | 292 | struct cmd_ds_802_3_get_stat { |
293 | u32 xmitok; | 293 | __le32 xmitok; |
294 | u32 rcvok; | 294 | __le32 rcvok; |
295 | u32 xmiterror; | 295 | __le32 xmiterror; |
296 | u32 rcverror; | 296 | __le32 rcverror; |
297 | u32 rcvnobuffer; | 297 | __le32 rcvnobuffer; |
298 | u32 rcvcrcerror; | 298 | __le32 rcvcrcerror; |
299 | }; | 299 | }; |
300 | 300 | ||
301 | struct cmd_ds_802_11_get_stat { | 301 | struct cmd_ds_802_11_get_stat { |
302 | u32 txfragmentcnt; | 302 | __le32 txfragmentcnt; |
303 | u32 mcasttxframecnt; | 303 | __le32 mcasttxframecnt; |
304 | u32 failedcnt; | 304 | __le32 failedcnt; |
305 | u32 retrycnt; | 305 | __le32 retrycnt; |
306 | u32 Multipleretrycnt; | 306 | __le32 Multipleretrycnt; |
307 | u32 rtssuccesscnt; | 307 | __le32 rtssuccesscnt; |
308 | u32 rtsfailurecnt; | 308 | __le32 rtsfailurecnt; |
309 | u32 ackfailurecnt; | 309 | __le32 ackfailurecnt; |
310 | u32 frameduplicatecnt; | 310 | __le32 frameduplicatecnt; |
311 | u32 rxfragmentcnt; | 311 | __le32 rxfragmentcnt; |
312 | u32 mcastrxframecnt; | 312 | __le32 mcastrxframecnt; |
313 | u32 fcserrorcnt; | 313 | __le32 fcserrorcnt; |
314 | u32 bcasttxframecnt; | 314 | __le32 bcasttxframecnt; |
315 | u32 bcastrxframecnt; | 315 | __le32 bcastrxframecnt; |
316 | u32 txbeacon; | 316 | __le32 txbeacon; |
317 | u32 rxbeacon; | 317 | __le32 rxbeacon; |
318 | u32 wepundecryptable; | 318 | __le32 wepundecryptable; |
319 | }; | 319 | }; |
320 | 320 | ||
321 | struct cmd_ds_802_11_snmp_mib { | 321 | struct cmd_ds_802_11_snmp_mib { |
322 | u16 querytype; | 322 | __le16 querytype; |
323 | u16 oid; | 323 | __le16 oid; |
324 | u16 bufsize; | 324 | __le16 bufsize; |
325 | u8 value[128]; | 325 | u8 value[128]; |
326 | }; | 326 | }; |
327 | 327 | ||
328 | struct cmd_ds_mac_reg_map { | 328 | struct cmd_ds_mac_reg_map { |
329 | u16 buffersize; | 329 | __le16 buffersize; |
330 | u8 regmap[128]; | 330 | u8 regmap[128]; |
331 | u16 reserved; | 331 | __le16 reserved; |
332 | }; | 332 | }; |
333 | 333 | ||
334 | struct cmd_ds_bbp_reg_map { | 334 | struct cmd_ds_bbp_reg_map { |
335 | u16 buffersize; | 335 | __le16 buffersize; |
336 | u8 regmap[128]; | 336 | u8 regmap[128]; |
337 | u16 reserved; | 337 | __le16 reserved; |
338 | }; | 338 | }; |
339 | 339 | ||
340 | struct cmd_ds_rf_reg_map { | 340 | struct cmd_ds_rf_reg_map { |
341 | u16 buffersize; | 341 | __le16 buffersize; |
342 | u8 regmap[64]; | 342 | u8 regmap[64]; |
343 | u16 reserved; | 343 | __le16 reserved; |
344 | }; | 344 | }; |
345 | 345 | ||
346 | struct cmd_ds_mac_reg_access { | 346 | struct cmd_ds_mac_reg_access { |
347 | u16 action; | 347 | __le16 action; |
348 | u16 offset; | 348 | __le16 offset; |
349 | u32 value; | 349 | __le32 value; |
350 | }; | 350 | }; |
351 | 351 | ||
352 | struct cmd_ds_bbp_reg_access { | 352 | struct cmd_ds_bbp_reg_access { |
353 | u16 action; | 353 | __le16 action; |
354 | u16 offset; | 354 | __le16 offset; |
355 | u8 value; | 355 | u8 value; |
356 | u8 reserved[3]; | 356 | u8 reserved[3]; |
357 | }; | 357 | }; |
358 | 358 | ||
359 | struct cmd_ds_rf_reg_access { | 359 | struct cmd_ds_rf_reg_access { |
360 | u16 action; | 360 | __le16 action; |
361 | u16 offset; | 361 | __le16 offset; |
362 | u8 value; | 362 | u8 value; |
363 | u8 reserved[3]; | 363 | u8 reserved[3]; |
364 | }; | 364 | }; |
365 | 365 | ||
366 | struct cmd_ds_802_11_radio_control { | 366 | struct cmd_ds_802_11_radio_control { |
367 | u16 action; | 367 | __le16 action; |
368 | u16 control; | 368 | __le16 control; |
369 | }; | 369 | }; |
370 | 370 | ||
371 | struct cmd_ds_802_11_sleep_params { | 371 | struct cmd_ds_802_11_sleep_params { |
372 | /* ACT_GET/ACT_SET */ | 372 | /* ACT_GET/ACT_SET */ |
373 | u16 action; | 373 | __le16 action; |
374 | 374 | ||
375 | /* Sleep clock error in ppm */ | 375 | /* Sleep clock error in ppm */ |
376 | u16 error; | 376 | __le16 error; |
377 | 377 | ||
378 | /* Wakeup offset in usec */ | 378 | /* Wakeup offset in usec */ |
379 | u16 offset; | 379 | __le16 offset; |
380 | 380 | ||
381 | /* Clock stabilization time in usec */ | 381 | /* Clock stabilization time in usec */ |
382 | u16 stabletime; | 382 | __le16 stabletime; |
383 | 383 | ||
384 | /* control periodic calibration */ | 384 | /* control periodic calibration */ |
385 | u8 calcontrol; | 385 | u8 calcontrol; |
@@ -388,100 +388,100 @@ struct cmd_ds_802_11_sleep_params { | |||
388 | u8 externalsleepclk; | 388 | u8 externalsleepclk; |
389 | 389 | ||
390 | /* reserved field, should be set to zero */ | 390 | /* reserved field, should be set to zero */ |
391 | u16 reserved; | 391 | __le16 reserved; |
392 | }; | 392 | }; |
393 | 393 | ||
394 | struct cmd_ds_802_11_inactivity_timeout { | 394 | struct cmd_ds_802_11_inactivity_timeout { |
395 | /* ACT_GET/ACT_SET */ | 395 | /* ACT_GET/ACT_SET */ |
396 | u16 action; | 396 | __le16 action; |
397 | 397 | ||
398 | /* Inactivity timeout in msec */ | 398 | /* Inactivity timeout in msec */ |
399 | u16 timeout; | 399 | __le16 timeout; |
400 | }; | 400 | }; |
401 | 401 | ||
402 | struct cmd_ds_802_11_rf_channel { | 402 | struct cmd_ds_802_11_rf_channel { |
403 | u16 action; | 403 | __le16 action; |
404 | u16 currentchannel; | 404 | __le16 currentchannel; |
405 | u16 rftype; | 405 | __le16 rftype; |
406 | u16 reserved; | 406 | __le16 reserved; |
407 | u8 channellist[32]; | 407 | u8 channellist[32]; |
408 | }; | 408 | }; |
409 | 409 | ||
410 | struct cmd_ds_802_11_rssi { | 410 | struct cmd_ds_802_11_rssi { |
411 | /* weighting factor */ | 411 | /* weighting factor */ |
412 | u16 N; | 412 | __le16 N; |
413 | 413 | ||
414 | u16 reserved_0; | 414 | __le16 reserved_0; |
415 | u16 reserved_1; | 415 | __le16 reserved_1; |
416 | u16 reserved_2; | 416 | __le16 reserved_2; |
417 | }; | 417 | }; |
418 | 418 | ||
419 | struct cmd_ds_802_11_rssi_rsp { | 419 | struct cmd_ds_802_11_rssi_rsp { |
420 | u16 SNR; | 420 | __le16 SNR; |
421 | u16 noisefloor; | 421 | __le16 noisefloor; |
422 | u16 avgSNR; | 422 | __le16 avgSNR; |
423 | u16 avgnoisefloor; | 423 | __le16 avgnoisefloor; |
424 | }; | 424 | }; |
425 | 425 | ||
426 | struct cmd_ds_802_11_mac_address { | 426 | struct cmd_ds_802_11_mac_address { |
427 | u16 action; | 427 | __le16 action; |
428 | u8 macadd[ETH_ALEN]; | 428 | u8 macadd[ETH_ALEN]; |
429 | }; | 429 | }; |
430 | 430 | ||
431 | struct cmd_ds_802_11_rf_tx_power { | 431 | struct cmd_ds_802_11_rf_tx_power { |
432 | u16 action; | 432 | __le16 action; |
433 | u16 currentlevel; | 433 | __le16 currentlevel; |
434 | }; | 434 | }; |
435 | 435 | ||
436 | struct cmd_ds_802_11_rf_antenna { | 436 | struct cmd_ds_802_11_rf_antenna { |
437 | u16 action; | 437 | __le16 action; |
438 | 438 | ||
439 | /* Number of antennas or 0xffff(diversity) */ | 439 | /* Number of antennas or 0xffff(diversity) */ |
440 | u16 antennamode; | 440 | __le16 antennamode; |
441 | 441 | ||
442 | }; | 442 | }; |
443 | 443 | ||
444 | struct cmd_ds_802_11_ps_mode { | 444 | struct cmd_ds_802_11_ps_mode { |
445 | u16 action; | 445 | __le16 action; |
446 | u16 nullpktinterval; | 446 | __le16 nullpktinterval; |
447 | u16 multipledtim; | 447 | __le16 multipledtim; |
448 | u16 reserved; | 448 | __le16 reserved; |
449 | u16 locallisteninterval; | 449 | __le16 locallisteninterval; |
450 | }; | 450 | }; |
451 | 451 | ||
452 | struct PS_CMD_ConfirmSleep { | 452 | struct PS_CMD_ConfirmSleep { |
453 | u16 command; | 453 | __le16 command; |
454 | u16 size; | 454 | __le16 size; |
455 | u16 seqnum; | 455 | __le16 seqnum; |
456 | u16 result; | 456 | __le16 result; |
457 | 457 | ||
458 | u16 action; | 458 | __le16 action; |
459 | u16 reserved1; | 459 | __le16 reserved1; |
460 | u16 multipledtim; | 460 | __le16 multipledtim; |
461 | u16 reserved; | 461 | __le16 reserved; |
462 | u16 locallisteninterval; | 462 | __le16 locallisteninterval; |
463 | }; | 463 | }; |
464 | 464 | ||
465 | struct cmd_ds_802_11_data_rate { | 465 | struct cmd_ds_802_11_data_rate { |
466 | u16 action; | 466 | __le16 action; |
467 | u16 reserverd; | 467 | __le16 reserverd; |
468 | u8 datarate[G_SUPPORTED_RATES]; | 468 | u8 datarate[G_SUPPORTED_RATES]; |
469 | }; | 469 | }; |
470 | 470 | ||
471 | struct cmd_ds_802_11_rate_adapt_rateset { | 471 | struct cmd_ds_802_11_rate_adapt_rateset { |
472 | u16 action; | 472 | __le16 action; |
473 | u16 enablehwauto; | 473 | __le16 enablehwauto; |
474 | u16 bitmap; | 474 | __le16 bitmap; |
475 | }; | 475 | }; |
476 | 476 | ||
477 | struct cmd_ds_802_11_ad_hoc_start { | 477 | struct cmd_ds_802_11_ad_hoc_start { |
478 | u8 SSID[IW_ESSID_MAX_SIZE]; | 478 | u8 SSID[IW_ESSID_MAX_SIZE]; |
479 | u8 bsstype; | 479 | u8 bsstype; |
480 | u16 beaconperiod; | 480 | __le16 beaconperiod; |
481 | u8 dtimperiod; | 481 | u8 dtimperiod; |
482 | union IEEEtypes_ssparamset ssparamset; | 482 | union IEEEtypes_ssparamset ssparamset; |
483 | union ieeetypes_phyparamset phyparamset; | 483 | union ieeetypes_phyparamset phyparamset; |
484 | u16 probedelay; | 484 | __le16 probedelay; |
485 | struct ieeetypes_capinfo cap; | 485 | struct ieeetypes_capinfo cap; |
486 | u8 datarate[G_SUPPORTED_RATES]; | 486 | u8 datarate[G_SUPPORTED_RATES]; |
487 | u8 tlv_memory_size_pad[100]; | 487 | u8 tlv_memory_size_pad[100]; |
@@ -491,10 +491,10 @@ struct adhoc_bssdesc { | |||
491 | u8 BSSID[6]; | 491 | u8 BSSID[6]; |
492 | u8 SSID[32]; | 492 | u8 SSID[32]; |
493 | u8 bsstype; | 493 | u8 bsstype; |
494 | u16 beaconperiod; | 494 | __le16 beaconperiod; |
495 | u8 dtimperiod; | 495 | u8 dtimperiod; |
496 | u8 timestamp[8]; | 496 | __le64 timestamp; |
497 | u8 localtime[8]; | 497 | __le64 localtime; |
498 | union ieeetypes_phyparamset phyparamset; | 498 | union ieeetypes_phyparamset phyparamset; |
499 | union IEEEtypes_ssparamset ssparamset; | 499 | union IEEEtypes_ssparamset ssparamset; |
500 | struct ieeetypes_capinfo cap; | 500 | struct ieeetypes_capinfo cap; |
@@ -508,52 +508,52 @@ struct adhoc_bssdesc { | |||
508 | 508 | ||
509 | struct cmd_ds_802_11_ad_hoc_join { | 509 | struct cmd_ds_802_11_ad_hoc_join { |
510 | struct adhoc_bssdesc bssdescriptor; | 510 | struct adhoc_bssdesc bssdescriptor; |
511 | u16 failtimeout; | 511 | __le16 failtimeout; |
512 | u16 probedelay; | 512 | __le16 probedelay; |
513 | 513 | ||
514 | } __attribute__ ((packed)); | 514 | } __attribute__ ((packed)); |
515 | 515 | ||
516 | struct cmd_ds_802_11_enable_rsn { | 516 | struct cmd_ds_802_11_enable_rsn { |
517 | u16 action; | 517 | __le16 action; |
518 | u16 enable; | 518 | __le16 enable; |
519 | }; | 519 | }; |
520 | 520 | ||
521 | struct MrvlIEtype_keyParamSet { | 521 | struct MrvlIEtype_keyParamSet { |
522 | /* type ID */ | 522 | /* type ID */ |
523 | u16 type; | 523 | __le16 type; |
524 | 524 | ||
525 | /* length of Payload */ | 525 | /* length of Payload */ |
526 | u16 length; | 526 | __le16 length; |
527 | 527 | ||
528 | /* type of key: WEP=0, TKIP=1, AES=2 */ | 528 | /* type of key: WEP=0, TKIP=1, AES=2 */ |
529 | u16 keytypeid; | 529 | __le16 keytypeid; |
530 | 530 | ||
531 | /* key control Info specific to a keytypeid */ | 531 | /* key control Info specific to a keytypeid */ |
532 | u16 keyinfo; | 532 | __le16 keyinfo; |
533 | 533 | ||
534 | /* length of key */ | 534 | /* length of key */ |
535 | u16 keylen; | 535 | __le16 keylen; |
536 | 536 | ||
537 | /* key material of size keylen */ | 537 | /* key material of size keylen */ |
538 | u8 key[32]; | 538 | u8 key[32]; |
539 | }; | 539 | }; |
540 | 540 | ||
541 | struct cmd_ds_802_11_key_material { | 541 | struct cmd_ds_802_11_key_material { |
542 | u16 action; | 542 | __le16 action; |
543 | struct MrvlIEtype_keyParamSet keyParamSet[2]; | 543 | struct MrvlIEtype_keyParamSet keyParamSet[2]; |
544 | } __attribute__ ((packed)); | 544 | } __attribute__ ((packed)); |
545 | 545 | ||
546 | struct cmd_ds_802_11_eeprom_access { | 546 | struct cmd_ds_802_11_eeprom_access { |
547 | u16 action; | 547 | __le16 action; |
548 | 548 | ||
549 | /* multiple 4 */ | 549 | /* multiple 4 */ |
550 | u16 offset; | 550 | __le16 offset; |
551 | u16 bytecount; | 551 | __le16 bytecount; |
552 | u8 value; | 552 | u8 value; |
553 | } __attribute__ ((packed)); | 553 | } __attribute__ ((packed)); |
554 | 554 | ||
555 | struct cmd_ds_802_11_tpc_cfg { | 555 | struct cmd_ds_802_11_tpc_cfg { |
556 | u16 action; | 556 | __le16 action; |
557 | u8 enable; | 557 | u8 enable; |
558 | s8 P0; | 558 | s8 P0; |
559 | s8 P1; | 559 | s8 P1; |
@@ -562,13 +562,13 @@ struct cmd_ds_802_11_tpc_cfg { | |||
562 | } __attribute__ ((packed)); | 562 | } __attribute__ ((packed)); |
563 | 563 | ||
564 | struct cmd_ds_802_11_led_ctrl { | 564 | struct cmd_ds_802_11_led_ctrl { |
565 | u16 action; | 565 | __le16 action; |
566 | u16 numled; | 566 | __le16 numled; |
567 | u8 data[256]; | 567 | u8 data[256]; |
568 | } __attribute__ ((packed)); | 568 | } __attribute__ ((packed)); |
569 | 569 | ||
570 | struct cmd_ds_802_11_pwr_cfg { | 570 | struct cmd_ds_802_11_pwr_cfg { |
571 | u16 action; | 571 | __le16 action; |
572 | u8 enable; | 572 | u8 enable; |
573 | s8 PA_P0; | 573 | s8 PA_P0; |
574 | s8 PA_P1; | 574 | s8 PA_P1; |
@@ -576,21 +576,21 @@ struct cmd_ds_802_11_pwr_cfg { | |||
576 | } __attribute__ ((packed)); | 576 | } __attribute__ ((packed)); |
577 | 577 | ||
578 | struct cmd_ds_802_11_afc { | 578 | struct cmd_ds_802_11_afc { |
579 | u16 afc_auto; | 579 | __le16 afc_auto; |
580 | union { | 580 | union { |
581 | struct { | 581 | struct { |
582 | u16 threshold; | 582 | __le16 threshold; |
583 | u16 period; | 583 | __le16 period; |
584 | }; | 584 | }; |
585 | struct { | 585 | struct { |
586 | s16 timing_offset; | 586 | __le16 timing_offset; /* signed */ |
587 | s16 carrier_offset; | 587 | __le16 carrier_offset; /* signed */ |
588 | }; | 588 | }; |
589 | }; | 589 | }; |
590 | } __attribute__ ((packed)); | 590 | } __attribute__ ((packed)); |
591 | 591 | ||
592 | struct cmd_tx_rate_query { | 592 | struct cmd_tx_rate_query { |
593 | u16 txrate; | 593 | __le16 txrate; |
594 | } __attribute__ ((packed)); | 594 | } __attribute__ ((packed)); |
595 | 595 | ||
596 | struct cmd_ds_get_tsf { | 596 | struct cmd_ds_get_tsf { |
@@ -598,35 +598,35 @@ struct cmd_ds_get_tsf { | |||
598 | } __attribute__ ((packed)); | 598 | } __attribute__ ((packed)); |
599 | 599 | ||
600 | struct cmd_ds_bt_access { | 600 | struct cmd_ds_bt_access { |
601 | u16 action; | 601 | __le16 action; |
602 | u32 id; | 602 | __le32 id; |
603 | u8 addr1[ETH_ALEN]; | 603 | u8 addr1[ETH_ALEN]; |
604 | u8 addr2[ETH_ALEN]; | 604 | u8 addr2[ETH_ALEN]; |
605 | } __attribute__ ((packed)); | 605 | } __attribute__ ((packed)); |
606 | 606 | ||
607 | struct cmd_ds_fwt_access { | 607 | struct cmd_ds_fwt_access { |
608 | u16 action; | 608 | __le16 action; |
609 | u32 id; | 609 | __le32 id; |
610 | u8 valid; | 610 | u8 valid; |
611 | u8 da[ETH_ALEN]; | 611 | u8 da[ETH_ALEN]; |
612 | u8 dir; | 612 | u8 dir; |
613 | u8 ra[ETH_ALEN]; | 613 | u8 ra[ETH_ALEN]; |
614 | u32 ssn; | 614 | __le32 ssn; |
615 | u32 dsn; | 615 | __le32 dsn; |
616 | u32 metric; | 616 | __le32 metric; |
617 | u8 rate; | 617 | u8 rate; |
618 | u8 hopcount; | 618 | u8 hopcount; |
619 | u8 ttl; | 619 | u8 ttl; |
620 | u32 expiration; | 620 | __le32 expiration; |
621 | u8 sleepmode; | 621 | u8 sleepmode; |
622 | u32 snr; | 622 | __le32 snr; |
623 | u32 references; | 623 | __le32 references; |
624 | u8 prec[ETH_ALEN]; | 624 | u8 prec[ETH_ALEN]; |
625 | } __attribute__ ((packed)); | 625 | } __attribute__ ((packed)); |
626 | 626 | ||
627 | struct cmd_ds_mesh_access { | 627 | struct cmd_ds_mesh_access { |
628 | u16 action; | 628 | __le16 action; |
629 | u32 data[32]; /* last position reserved */ | 629 | __le32 data[32]; /* last position reserved */ |
630 | } __attribute__ ((packed)); | 630 | } __attribute__ ((packed)); |
631 | 631 | ||
632 | /* Number of stats counters returned by the firmware */ | 632 | /* Number of stats counters returned by the firmware */ |
@@ -634,10 +634,10 @@ struct cmd_ds_mesh_access { | |||
634 | 634 | ||
635 | struct cmd_ds_command { | 635 | struct cmd_ds_command { |
636 | /* command header */ | 636 | /* command header */ |
637 | u16 command; | 637 | __le16 command; |
638 | u16 size; | 638 | __le16 size; |
639 | u16 seqnum; | 639 | __le16 seqnum; |
640 | u16 result; | 640 | __le16 result; |
641 | 641 | ||
642 | /* command Body */ | 642 | /* command Body */ |
643 | union { | 643 | union { |
diff --git a/drivers/net/wireless/libertas/if_bootcmd.c b/drivers/net/wireless/libertas/if_bootcmd.c index 70397a3eec7f..8bca306ffad9 100644 --- a/drivers/net/wireless/libertas/if_bootcmd.c +++ b/drivers/net/wireless/libertas/if_bootcmd.c | |||
@@ -27,7 +27,7 @@ int if_usb_issue_boot_command(wlan_private *priv, int ivalue) | |||
27 | int i; | 27 | int i; |
28 | 28 | ||
29 | /* Prepare command */ | 29 | /* Prepare command */ |
30 | sbootcmd.u32magicnumber = BOOT_CMD_MAGIC_NUMBER; | 30 | sbootcmd.u32magicnumber = cpu_to_le32(BOOT_CMD_MAGIC_NUMBER); |
31 | sbootcmd.u8cmd_tag = ivalue; | 31 | sbootcmd.u8cmd_tag = ivalue; |
32 | for (i=0; i<11; i++) | 32 | for (i=0; i<11; i++) |
33 | sbootcmd.au8dumy[i]=0x00; | 33 | sbootcmd.au8dumy[i]=0x00; |
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c index de7a2e2babe6..b544fcdcd0e7 100644 --- a/drivers/net/wireless/libertas/if_usb.c +++ b/drivers/net/wireless/libertas/if_usb.c | |||
@@ -141,10 +141,10 @@ static int if_usb_probe(struct usb_interface *intf, | |||
141 | 141 | ||
142 | lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X" | 142 | lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X" |
143 | " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", | 143 | " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", |
144 | udev->descriptor.bcdUSB, | 144 | le16_to_cpu(udev->descriptor.bcdUSB), |
145 | udev->descriptor.bDeviceClass, | 145 | udev->descriptor.bDeviceClass, |
146 | udev->descriptor.bDeviceSubClass, | 146 | udev->descriptor.bDeviceSubClass, |
147 | udev->descriptor.bDeviceProtocol); | 147 | udev->descriptor.bDeviceProtocol); |
148 | 148 | ||
149 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { | 149 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { |
150 | endpoint = &iface_desc->endpoint[i].desc; | 150 | endpoint = &iface_desc->endpoint[i].desc; |
@@ -153,10 +153,8 @@ static int if_usb_probe(struct usb_interface *intf, | |||
153 | USB_ENDPOINT_XFER_BULK)) { | 153 | USB_ENDPOINT_XFER_BULK)) { |
154 | /* we found a bulk in endpoint */ | 154 | /* we found a bulk in endpoint */ |
155 | lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n", | 155 | lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n", |
156 | endpoint->wMaxPacketSize); | 156 | le16_to_cpu(endpoint->wMaxPacketSize)); |
157 | if (! | 157 | if (!(cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL))) { |
158 | (cardp->rx_urb = | ||
159 | usb_alloc_urb(0, GFP_KERNEL))) { | ||
160 | lbs_deb_usbd(&udev->dev, | 158 | lbs_deb_usbd(&udev->dev, |
161 | "Rx URB allocation failed\n"); | 159 | "Rx URB allocation failed\n"); |
162 | goto dealloc; | 160 | goto dealloc; |
@@ -164,7 +162,7 @@ static int if_usb_probe(struct usb_interface *intf, | |||
164 | cardp->rx_urb_recall = 0; | 162 | cardp->rx_urb_recall = 0; |
165 | 163 | ||
166 | cardp->bulk_in_size = | 164 | cardp->bulk_in_size = |
167 | endpoint->wMaxPacketSize; | 165 | le16_to_cpu(endpoint->wMaxPacketSize); |
168 | cardp->bulk_in_endpointAddr = | 166 | cardp->bulk_in_endpointAddr = |
169 | (endpoint-> | 167 | (endpoint-> |
170 | bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); | 168 | bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); |
@@ -178,19 +176,17 @@ static int if_usb_probe(struct usb_interface *intf, | |||
178 | && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | 176 | && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == |
179 | USB_ENDPOINT_XFER_BULK)) { | 177 | USB_ENDPOINT_XFER_BULK)) { |
180 | /* We found bulk out endpoint */ | 178 | /* We found bulk out endpoint */ |
181 | if (! | 179 | if (!(cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL))) { |
182 | (cardp->tx_urb = | ||
183 | usb_alloc_urb(0, GFP_KERNEL))) { | ||
184 | lbs_deb_usbd(&udev->dev, | 180 | lbs_deb_usbd(&udev->dev, |
185 | "Tx URB allocation failed\n"); | 181 | "Tx URB allocation failed\n"); |
186 | goto dealloc; | 182 | goto dealloc; |
187 | } | 183 | } |
188 | 184 | ||
189 | cardp->bulk_out_size = | 185 | cardp->bulk_out_size = |
190 | endpoint->wMaxPacketSize; | 186 | le16_to_cpu(endpoint->wMaxPacketSize); |
191 | lbs_deb_usbd(&udev->dev, | 187 | lbs_deb_usbd(&udev->dev, |
192 | "Bulk out size is %d\n", | 188 | "Bulk out size is %d\n", |
193 | endpoint->wMaxPacketSize); | 189 | le16_to_cpu(endpoint->wMaxPacketSize)); |
194 | cardp->bulk_out_endpointAddr = | 190 | cardp->bulk_out_endpointAddr = |
195 | endpoint->bEndpointAddress; | 191 | endpoint->bEndpointAddress; |
196 | lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n", | 192 | lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n", |
@@ -313,7 +309,7 @@ static int if_prog_firmware(wlan_private * priv) | |||
313 | 309 | ||
314 | /* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */ | 310 | /* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */ |
315 | memcpy(fwdata->data, &firmware[cardp->totalbytes], | 311 | memcpy(fwdata->data, &firmware[cardp->totalbytes], |
316 | fwdata->fwheader.datalength); | 312 | le32_to_cpu(fwdata->fwheader.datalength)); |
317 | 313 | ||
318 | /* | 314 | /* |
319 | lbs_deb_usbd(&cardp->udev->dev, | 315 | lbs_deb_usbd(&cardp->udev->dev, |
@@ -322,13 +318,13 @@ static int if_prog_firmware(wlan_private * priv) | |||
322 | 318 | ||
323 | cardp->fwseqnum = cardp->fwseqnum + 1; | 319 | cardp->fwseqnum = cardp->fwseqnum + 1; |
324 | 320 | ||
325 | fwdata->seqnum = cardp->fwseqnum; | 321 | fwdata->seqnum = cpu_to_le32(cardp->fwseqnum); |
326 | cardp->lastseqnum = fwdata->seqnum; | 322 | cardp->lastseqnum = cardp->fwseqnum; |
327 | cardp->totalbytes += fwdata->fwheader.datalength; | 323 | cardp->totalbytes += le32_to_cpu(fwdata->fwheader.datalength); |
328 | 324 | ||
329 | if (fwheader->dnldcmd == FW_HAS_DATA_TO_RECV) { | 325 | if (fwheader->dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) { |
330 | /* | 326 | /* |
331 | lbs_deb_usbd(&cardp->udev->dev, "There is data to follow\n"); | 327 | lbs_deb_usbd(&cardp->udev->dev, "There are data to follow\n"); |
332 | lbs_deb_usbd(&cardp->udev->dev, | 328 | lbs_deb_usbd(&cardp->udev->dev, |
333 | "seqnum = %d totalbytes = %d\n", cardp->fwseqnum, | 329 | "seqnum = %d totalbytes = %d\n", cardp->fwseqnum, |
334 | cardp->totalbytes); | 330 | cardp->totalbytes); |
@@ -486,7 +482,7 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
486 | if (cardp->bootcmdresp == 0) { | 482 | if (cardp->bootcmdresp == 0) { |
487 | memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET, | 483 | memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET, |
488 | sizeof(bootcmdresp)); | 484 | sizeof(bootcmdresp)); |
489 | if (cardp->udev->descriptor.bcdDevice < 0x3106) { | 485 | if (le16_to_cpu(cardp->udev->descriptor.bcdDevice) < 0x3106) { |
490 | kfree_skb(skb); | 486 | kfree_skb(skb); |
491 | if_usb_submit_rx_urb_fwload(priv); | 487 | if_usb_submit_rx_urb_fwload(priv); |
492 | cardp->bootcmdresp = 1; | 488 | cardp->bootcmdresp = 1; |
@@ -494,10 +490,10 @@ static void if_usb_receive_fwload(struct urb *urb) | |||
494 | "Received valid boot command response\n"); | 490 | "Received valid boot command response\n"); |
495 | return; | 491 | return; |
496 | } | 492 | } |
497 | if (bootcmdresp.u32magicnumber != BOOT_CMD_MAGIC_NUMBER) { | 493 | if (bootcmdresp.u32magicnumber != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) { |
498 | lbs_pr_info( | 494 | lbs_pr_info( |
499 | "boot cmd response wrong magic number (0x%x)\n", | 495 | "boot cmd response wrong magic number (0x%x)\n", |
500 | bootcmdresp.u32magicnumber); | 496 | le32_to_cpu(bootcmdresp.u32magicnumber)); |
501 | } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) { | 497 | } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) { |
502 | lbs_pr_info( | 498 | lbs_pr_info( |
503 | "boot cmd response cmd_tag error (%d)\n", | 499 | "boot cmd response cmd_tag error (%d)\n", |
@@ -672,7 +668,7 @@ static void if_usb_receive(struct urb *urb) | |||
672 | case CMD_TYPE_INDICATION: | 668 | case CMD_TYPE_INDICATION: |
673 | /* Event cause handling */ | 669 | /* Event cause handling */ |
674 | spin_lock(&priv->adapter->driver_lock); | 670 | spin_lock(&priv->adapter->driver_lock); |
675 | cardp->usb_event_cause = *(u32 *) (recvbuff + MESSAGE_HEADER_LEN); | 671 | cardp->usb_event_cause = le32_to_cpu(*(__le32 *) (recvbuff + MESSAGE_HEADER_LEN)); |
676 | lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n", | 672 | lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n", |
677 | cardp->usb_event_cause); | 673 | cardp->usb_event_cause); |
678 | if (cardp->usb_event_cause & 0xffff0000) { | 674 | if (cardp->usb_event_cause & 0xffff0000) { |
@@ -680,7 +676,7 @@ static void if_usb_receive(struct urb *urb) | |||
680 | spin_unlock(&priv->adapter->driver_lock); | 676 | spin_unlock(&priv->adapter->driver_lock); |
681 | break; | 677 | break; |
682 | } | 678 | } |
683 | cardp->usb_event_cause = le32_to_cpu(cardp->usb_event_cause) << 3; | 679 | cardp->usb_event_cause <<= 3; |
684 | cardp->usb_int_cause |= his_cardevent; | 680 | cardp->usb_int_cause |= his_cardevent; |
685 | kfree_skb(skb); | 681 | kfree_skb(skb); |
686 | libertas_interrupt(priv->dev); | 682 | libertas_interrupt(priv->dev); |
diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h index bfad79eb43cf..3ed46a33fd21 100644 --- a/drivers/net/wireless/libertas/if_usb.h +++ b/drivers/net/wireless/libertas/if_usb.h | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | struct bootcmdstr | 21 | struct bootcmdstr |
22 | { | 22 | { |
23 | u32 u32magicnumber; | 23 | __le32 u32magicnumber; |
24 | u8 u8cmd_tag; | 24 | u8 u8cmd_tag; |
25 | u8 au8dumy[11]; | 25 | u8 au8dumy[11]; |
26 | }; | 26 | }; |
@@ -30,7 +30,7 @@ struct bootcmdstr | |||
30 | 30 | ||
31 | struct bootcmdrespStr | 31 | struct bootcmdrespStr |
32 | { | 32 | { |
33 | u32 u32magicnumber; | 33 | __le32 u32magicnumber; |
34 | u8 u8cmd_tag; | 34 | u8 u8cmd_tag; |
35 | u8 u8result; | 35 | u8 u8result; |
36 | u8 au8dumy[2]; | 36 | u8 au8dumy[2]; |
@@ -76,24 +76,24 @@ struct usb_card_rec { | |||
76 | 76 | ||
77 | /** fwheader */ | 77 | /** fwheader */ |
78 | struct fwheader { | 78 | struct fwheader { |
79 | u32 dnldcmd; | 79 | __le32 dnldcmd; |
80 | u32 baseaddr; | 80 | __le32 baseaddr; |
81 | u32 datalength; | 81 | __le32 datalength; |
82 | u32 CRC; | 82 | __le32 CRC; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #define FW_MAX_DATA_BLK_SIZE 600 | 85 | #define FW_MAX_DATA_BLK_SIZE 600 |
86 | /** FWData */ | 86 | /** FWData */ |
87 | struct FWData { | 87 | struct FWData { |
88 | struct fwheader fwheader; | 88 | struct fwheader fwheader; |
89 | u32 seqnum; | 89 | __le32 seqnum; |
90 | u8 data[FW_MAX_DATA_BLK_SIZE]; | 90 | u8 data[FW_MAX_DATA_BLK_SIZE]; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | /** fwsyncheader */ | 93 | /** fwsyncheader */ |
94 | struct fwsyncheader { | 94 | struct fwsyncheader { |
95 | u32 cmd; | 95 | __le32 cmd; |
96 | u32 seqnum; | 96 | __le32 seqnum; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | #define FW_HAS_DATA_TO_RECV 0x00000001 | 99 | #define FW_HAS_DATA_TO_RECV 0x00000001 |
diff --git a/drivers/net/wireless/libertas/ioctl.c b/drivers/net/wireless/libertas/ioctl.c index 4b145e3e7db1..f41081585564 100644 --- a/drivers/net/wireless/libertas/ioctl.c +++ b/drivers/net/wireless/libertas/ioctl.c | |||
@@ -216,7 +216,7 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req) | |||
216 | struct iwreq *wrq = (struct iwreq *)req; | 216 | struct iwreq *wrq = (struct iwreq *)req; |
217 | /* used to pass id and store the bt entry returned by the FW */ | 217 | /* used to pass id and store the bt entry returned by the FW */ |
218 | union { | 218 | union { |
219 | int id; | 219 | u32 id; |
220 | char addr1addr2[2 * ETH_ALEN]; | 220 | char addr1addr2[2 * ETH_ALEN]; |
221 | } param; | 221 | } param; |
222 | static char outstr[64]; | 222 | static char outstr[64]; |
@@ -272,7 +272,7 @@ static int wlan_bt_set_invert_ioctl(wlan_private * priv, struct ifreq *req) | |||
272 | int ret; | 272 | int ret; |
273 | struct iwreq *wrq = (struct iwreq *)req; | 273 | struct iwreq *wrq = (struct iwreq *)req; |
274 | union { | 274 | union { |
275 | int id; | 275 | u32 id; |
276 | char addr1addr2[2 * ETH_ALEN]; | 276 | char addr1addr2[2 * ETH_ALEN]; |
277 | } param; | 277 | } param; |
278 | 278 | ||
@@ -300,7 +300,7 @@ static int wlan_bt_get_invert_ioctl(wlan_private * priv, struct ifreq *req) | |||
300 | struct iwreq *wrq = (struct iwreq *)req; | 300 | struct iwreq *wrq = (struct iwreq *)req; |
301 | int ret; | 301 | int ret; |
302 | union { | 302 | union { |
303 | int id; | 303 | u32 id; |
304 | char addr1addr2[2 * ETH_ALEN]; | 304 | char addr1addr2[2 * ETH_ALEN]; |
305 | } param; | 305 | } param; |
306 | 306 | ||
@@ -365,7 +365,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
365 | fwt_access.metric = | 365 | fwt_access.metric = |
366 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 366 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
367 | else | 367 | else |
368 | fwt_access.metric = FWT_DEFAULT_METRIC; | 368 | fwt_access.metric = cpu_to_le32(FWT_DEFAULT_METRIC); |
369 | 369 | ||
370 | if ((ptr = next_param(ptr))) | 370 | if ((ptr = next_param(ptr))) |
371 | fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10); | 371 | fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10); |
@@ -381,13 +381,13 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
381 | fwt_access.ssn = | 381 | fwt_access.ssn = |
382 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 382 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
383 | else | 383 | else |
384 | fwt_access.ssn = FWT_DEFAULT_SSN; | 384 | fwt_access.ssn = cpu_to_le32(FWT_DEFAULT_SSN); |
385 | 385 | ||
386 | if ((ptr = next_param(ptr))) | 386 | if ((ptr = next_param(ptr))) |
387 | fwt_access.dsn = | 387 | fwt_access.dsn = |
388 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 388 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
389 | else | 389 | else |
390 | fwt_access.dsn = FWT_DEFAULT_DSN; | 390 | fwt_access.dsn = cpu_to_le32(FWT_DEFAULT_DSN); |
391 | 391 | ||
392 | if ((ptr = next_param(ptr))) | 392 | if ((ptr = next_param(ptr))) |
393 | fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10); | 393 | fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10); |
@@ -403,7 +403,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
403 | fwt_access.expiration = | 403 | fwt_access.expiration = |
404 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 404 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
405 | else | 405 | else |
406 | fwt_access.expiration = FWT_DEFAULT_EXPIRATION; | 406 | fwt_access.expiration = cpu_to_le32(FWT_DEFAULT_EXPIRATION); |
407 | 407 | ||
408 | if ((ptr = next_param(ptr))) | 408 | if ((ptr = next_param(ptr))) |
409 | fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10); | 409 | fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10); |
@@ -414,7 +414,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) | |||
414 | fwt_access.snr = | 414 | fwt_access.snr = |
415 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); | 415 | cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); |
416 | else | 416 | else |
417 | fwt_access.snr = FWT_DEFAULT_SNR; | 417 | fwt_access.snr = cpu_to_le32(FWT_DEFAULT_SNR); |
418 | 418 | ||
419 | #ifdef DEBUG | 419 | #ifdef DEBUG |
420 | { | 420 | { |
@@ -864,7 +864,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl) | |||
864 | return -EINVAL; | 864 | return -EINVAL; |
865 | 865 | ||
866 | memset(&mesh_access, 0, sizeof(mesh_access)); | 866 | memset(&mesh_access, 0, sizeof(mesh_access)); |
867 | mesh_access.data[0] = ttl; | 867 | mesh_access.data[0] = cpu_to_le32(ttl); |
868 | 868 | ||
869 | ret = libertas_prepare_and_send_command(priv, cmd_mesh_access, | 869 | ret = libertas_prepare_and_send_command(priv, cmd_mesh_access, |
870 | cmd_act_mesh_set_ttl, | 870 | cmd_act_mesh_set_ttl, |
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c index f222e78a922c..781b563a2f4f 100644 --- a/drivers/net/wireless/libertas/join.c +++ b/drivers/net/wireless/libertas/join.c | |||
@@ -306,13 +306,11 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv, | |||
306 | lbs_deb_enter(LBS_DEB_JOIN); | 306 | lbs_deb_enter(LBS_DEB_JOIN); |
307 | 307 | ||
308 | cmd->command = cpu_to_le16(cmd_802_11_deauthenticate); | 308 | cmd->command = cpu_to_le16(cmd_802_11_deauthenticate); |
309 | cmd->size = | 309 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) + |
310 | cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) + | ||
311 | S_DS_GEN); | 310 | S_DS_GEN); |
312 | 311 | ||
313 | /* set AP MAC address */ | 312 | /* set AP MAC address */ |
314 | memmove(dauth->macaddr, adapter->curbssparams.bssid, | 313 | memmove(dauth->macaddr, adapter->curbssparams.bssid, ETH_ALEN); |
315 | ETH_ALEN); | ||
316 | 314 | ||
317 | /* Reason code 3 = Station is leaving */ | 315 | /* Reason code 3 = Station is leaving */ |
318 | #define REASON_CODE_STA_LEAVING 3 | 316 | #define REASON_CODE_STA_LEAVING 3 |
@@ -333,7 +331,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
333 | u8 *card_rates; | 331 | u8 *card_rates; |
334 | u8 *pos; | 332 | u8 *pos; |
335 | int card_rates_size; | 333 | int card_rates_size; |
336 | u16 tmpcap; | 334 | u16 tmpcap, tmplen; |
337 | struct mrvlietypes_ssidparamset *ssid; | 335 | struct mrvlietypes_ssidparamset *ssid; |
338 | struct mrvlietypes_phyparamset *phy; | 336 | struct mrvlietypes_phyparamset *phy; |
339 | struct mrvlietypes_ssparamset *ss; | 337 | struct mrvlietypes_ssparamset *ss; |
@@ -355,7 +353,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
355 | pos += sizeof(passo->peerstaaddr); | 353 | pos += sizeof(passo->peerstaaddr); |
356 | 354 | ||
357 | /* set the listen interval */ | 355 | /* set the listen interval */ |
358 | passo->listeninterval = adapter->listeninterval; | 356 | passo->listeninterval = cpu_to_le16(adapter->listeninterval); |
359 | 357 | ||
360 | pos += sizeof(passo->capinfo); | 358 | pos += sizeof(passo->capinfo); |
361 | pos += sizeof(passo->listeninterval); | 359 | pos += sizeof(passo->listeninterval); |
@@ -364,14 +362,14 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
364 | 362 | ||
365 | ssid = (struct mrvlietypes_ssidparamset *) pos; | 363 | ssid = (struct mrvlietypes_ssidparamset *) pos; |
366 | ssid->header.type = cpu_to_le16(TLV_TYPE_SSID); | 364 | ssid->header.type = cpu_to_le16(TLV_TYPE_SSID); |
367 | ssid->header.len = bss->ssid.ssidlength; | 365 | ssid->header.len = cpu_to_le16(bss->ssid.ssidlength); |
368 | memcpy(ssid->ssid, bss->ssid.ssid, ssid->header.len); | 366 | memcpy(ssid->ssid, bss->ssid.ssid, ssid->header.len); |
369 | pos += sizeof(ssid->header) + ssid->header.len; | 367 | pos += sizeof(ssid->header) + ssid->header.len; |
370 | ssid->header.len = cpu_to_le16(ssid->header.len); | 368 | ssid->header.len = cpu_to_le16(ssid->header.len); |
371 | 369 | ||
372 | phy = (struct mrvlietypes_phyparamset *) pos; | 370 | phy = (struct mrvlietypes_phyparamset *) pos; |
373 | phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); | 371 | phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); |
374 | phy->header.len = sizeof(phy->fh_ds.dsparamset); | 372 | phy->header.len = cpu_to_le16(sizeof(phy->fh_ds.dsparamset)); |
375 | memcpy(&phy->fh_ds.dsparamset, | 373 | memcpy(&phy->fh_ds.dsparamset, |
376 | &bss->phyparamset.dsparamset.currentchan, | 374 | &bss->phyparamset.dsparamset.currentchan, |
377 | sizeof(phy->fh_ds.dsparamset)); | 375 | sizeof(phy->fh_ds.dsparamset)); |
@@ -380,7 +378,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
380 | 378 | ||
381 | ss = (struct mrvlietypes_ssparamset *) pos; | 379 | ss = (struct mrvlietypes_ssparamset *) pos; |
382 | ss->header.type = cpu_to_le16(TLV_TYPE_CF); | 380 | ss->header.type = cpu_to_le16(TLV_TYPE_CF); |
383 | ss->header.len = sizeof(ss->cf_ibss.cfparamset); | 381 | ss->header.len = cpu_to_le16(sizeof(ss->cf_ibss.cfparamset)); |
384 | pos += sizeof(ss->header) + ss->header.len; | 382 | pos += sizeof(ss->header) + ss->header.len; |
385 | ss->header.len = cpu_to_le16(ss->header.len); | 383 | ss->header.len = cpu_to_le16(ss->header.len); |
386 | 384 | ||
@@ -398,33 +396,34 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
398 | goto done; | 396 | goto done; |
399 | } | 397 | } |
400 | 398 | ||
401 | rates->header.len = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES); | 399 | tmplen = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES); |
402 | adapter->curbssparams.numofrates = rates->header.len; | 400 | adapter->curbssparams.numofrates = tmplen; |
403 | 401 | ||
404 | pos += sizeof(rates->header) + rates->header.len; | 402 | pos += sizeof(rates->header) + tmplen; |
405 | rates->header.len = cpu_to_le16(rates->header.len); | 403 | rates->header.len = cpu_to_le16(tmplen); |
406 | 404 | ||
407 | if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { | 405 | if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { |
408 | rsn = (struct mrvlietypes_rsnparamset *) pos; | 406 | rsn = (struct mrvlietypes_rsnparamset *) pos; |
409 | rsn->header.type = (u16) assoc_req->wpa_ie[0]; /* WPA_IE or WPA2_IE */ | 407 | /* WPA_IE or WPA2_IE */ |
410 | rsn->header.type = cpu_to_le16(rsn->header.type); | 408 | rsn->header.type = cpu_to_le16((u16) assoc_req->wpa_ie[0]); |
411 | rsn->header.len = (u16) assoc_req->wpa_ie[1]; | 409 | tmplen = (u16) assoc_req->wpa_ie[1]; |
412 | memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], rsn->header.len); | 410 | rsn->header.len = cpu_to_le16(tmplen); |
411 | memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], tmplen); | ||
413 | lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn, | 412 | lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn, |
414 | sizeof(rsn->header) + rsn->header.len); | 413 | sizeof(rsn->header) + tmplen); |
415 | pos += sizeof(rsn->header) + rsn->header.len; | 414 | pos += sizeof(rsn->header) + tmplen; |
416 | rsn->header.len = cpu_to_le16(rsn->header.len); | ||
417 | } | 415 | } |
418 | 416 | ||
419 | /* update curbssparams */ | 417 | /* update curbssparams */ |
420 | adapter->curbssparams.channel = | 418 | adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan; |
421 | (bss->phyparamset.dsparamset.currentchan); | ||
422 | 419 | ||
423 | /* Copy the infra. association rates into Current BSS state structure */ | 420 | /* Copy the infra. association rates into Current BSS state structure */ |
424 | memcpy(&adapter->curbssparams.datarates, &rates->rates, | 421 | memcpy(&adapter->curbssparams.datarates, &rates->rates, |
425 | min_t(size_t, sizeof(adapter->curbssparams.datarates), rates->header.len)); | 422 | min_t(size_t, sizeof(adapter->curbssparams.datarates), |
423 | cpu_to_le16(rates->header.len))); | ||
426 | 424 | ||
427 | lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", rates->header.len); | 425 | lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", |
426 | cpu_to_le16(rates->header.len)); | ||
428 | 427 | ||
429 | /* set IBSS field */ | 428 | /* set IBSS field */ |
430 | if (bss->mode == IW_MODE_INFRA) { | 429 | if (bss->mode == IW_MODE_INFRA) { |
@@ -443,8 +442,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, | |||
443 | memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo)); | 442 | memcpy(&tmpcap, &bss->cap, sizeof(passo->capinfo)); |
444 | tmpcap &= CAPINFO_MASK; | 443 | tmpcap &= CAPINFO_MASK; |
445 | lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", | 444 | lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", |
446 | tmpcap, CAPINFO_MASK); | 445 | tmpcap, CAPINFO_MASK); |
447 | tmpcap = cpu_to_le16(tmpcap); | ||
448 | memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo)); | 446 | memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo)); |
449 | 447 | ||
450 | done: | 448 | done: |
@@ -460,7 +458,6 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
460 | int ret = 0; | 458 | int ret = 0; |
461 | int cmdappendsize = 0; | 459 | int cmdappendsize = 0; |
462 | int i; | 460 | int i; |
463 | u16 tmpcap; | ||
464 | struct assoc_request * assoc_req = pdata_buf; | 461 | struct assoc_request * assoc_req = pdata_buf; |
465 | 462 | ||
466 | lbs_deb_enter(LBS_DEB_JOIN); | 463 | lbs_deb_enter(LBS_DEB_JOIN); |
@@ -492,7 +489,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
492 | /* set the BSS type */ | 489 | /* set the BSS type */ |
493 | adhs->bsstype = cmd_bss_type_ibss; | 490 | adhs->bsstype = cmd_bss_type_ibss; |
494 | adapter->mode = IW_MODE_ADHOC; | 491 | adapter->mode = IW_MODE_ADHOC; |
495 | adhs->beaconperiod = adapter->beaconperiod; | 492 | adhs->beaconperiod = cpu_to_le16(adapter->beaconperiod); |
496 | 493 | ||
497 | /* set Physical param set */ | 494 | /* set Physical param set */ |
498 | #define DS_PARA_IE_ID 3 | 495 | #define DS_PARA_IE_ID 3 |
@@ -504,7 +501,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
504 | WARN_ON(!assoc_req->channel); | 501 | WARN_ON(!assoc_req->channel); |
505 | 502 | ||
506 | lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n", | 503 | lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n", |
507 | assoc_req->channel); | 504 | assoc_req->channel); |
508 | 505 | ||
509 | adhs->phyparamset.dsparamset.currentchan = assoc_req->channel; | 506 | adhs->phyparamset.dsparamset.currentchan = assoc_req->channel; |
510 | 507 | ||
@@ -514,7 +511,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
514 | 511 | ||
515 | adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID; | 512 | adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID; |
516 | adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN; | 513 | adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN; |
517 | adhs->ssparamset.ibssparamset.atimwindow = adapter->atimwindow; | 514 | adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow); |
518 | 515 | ||
519 | /* set capability info */ | 516 | /* set capability info */ |
520 | adhs->cap.ess = 0; | 517 | adhs->cap.ess = 0; |
@@ -562,13 +559,8 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, | |||
562 | goto done; | 559 | goto done; |
563 | } | 560 | } |
564 | 561 | ||
565 | cmd->size = | 562 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) + |
566 | cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) | 563 | S_DS_GEN + cmdappendsize); |
567 | + S_DS_GEN + cmdappendsize); | ||
568 | |||
569 | memcpy(&tmpcap, &adhs->cap, sizeof(u16)); | ||
570 | tmpcap = cpu_to_le16(tmpcap); | ||
571 | memcpy(&adhs->cap, &tmpcap, sizeof(u16)); | ||
572 | 564 | ||
573 | ret = 0; | 565 | ret = 0; |
574 | done: | 566 | done: |
@@ -605,7 +597,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
605 | 597 | ||
606 | padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss; | 598 | padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss; |
607 | 599 | ||
608 | padhocjoin->bssdescriptor.beaconperiod = bss->beaconperiod; | 600 | padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod); |
609 | 601 | ||
610 | memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN); | 602 | memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN); |
611 | memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid.ssid, bss->ssid.ssidlength); | 603 | memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid.ssid, bss->ssid.ssidlength); |
@@ -634,8 +626,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
634 | padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); | 626 | padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); |
635 | 627 | ||
636 | /* probedelay */ | 628 | /* probedelay */ |
637 | padhocjoin->probedelay = | 629 | padhocjoin->probedelay = cpu_to_le16(cmd_scan_probe_delay_time); |
638 | cpu_to_le16(cmd_scan_probe_delay_time); | ||
639 | 630 | ||
640 | /* Copy Data rates from the rates recorded in scan response */ | 631 | /* Copy Data rates from the rates recorded in scan response */ |
641 | memset(padhocjoin->bssdescriptor.datarates, 0, | 632 | memset(padhocjoin->bssdescriptor.datarates, 0, |
@@ -679,9 +670,9 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
679 | 670 | ||
680 | if (adapter->psmode == wlan802_11powermodemax_psp) { | 671 | if (adapter->psmode == wlan802_11powermodemax_psp) { |
681 | /* wake up first */ | 672 | /* wake up first */ |
682 | enum WLAN_802_11_POWER_MODE Localpsmode; | 673 | __le32 Localpsmode; |
683 | 674 | ||
684 | Localpsmode = wlan802_11powermodecam; | 675 | Localpsmode = cpu_to_le32(wlan802_11powermodecam); |
685 | ret = libertas_prepare_and_send_command(priv, | 676 | ret = libertas_prepare_and_send_command(priv, |
686 | cmd_802_11_ps_mode, | 677 | cmd_802_11_ps_mode, |
687 | cmd_act_set, | 678 | cmd_act_set, |
@@ -698,16 +689,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, | |||
698 | goto done; | 689 | goto done; |
699 | } | 690 | } |
700 | 691 | ||
701 | cmd->size = | 692 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) + |
702 | cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) | 693 | S_DS_GEN + cmdappendsize); |
703 | + S_DS_GEN + cmdappendsize); | ||
704 | |||
705 | memcpy(&tmpcap, &padhocjoin->bssdescriptor.cap, | ||
706 | sizeof(struct ieeetypes_capinfo)); | ||
707 | tmpcap = cpu_to_le16(tmpcap); | ||
708 | |||
709 | memcpy(&padhocjoin->bssdescriptor.cap, | ||
710 | &tmpcap, sizeof(struct ieeetypes_capinfo)); | ||
711 | 694 | ||
712 | done: | 695 | done: |
713 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); | 696 | lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); |
@@ -734,11 +717,11 @@ int libertas_ret_80211_associate(wlan_private * priv, | |||
734 | 717 | ||
735 | passocrsp = (struct ieeetypes_assocrsp *) & resp->params; | 718 | passocrsp = (struct ieeetypes_assocrsp *) & resp->params; |
736 | 719 | ||
737 | if (passocrsp->statuscode) { | 720 | if (le16_to_cpu(passocrsp->statuscode)) { |
738 | libertas_mac_event_disconnected(priv); | 721 | libertas_mac_event_disconnected(priv); |
739 | 722 | ||
740 | lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n", | 723 | lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n", |
741 | passocrsp->statuscode); | 724 | le16_to_cpu(passocrsp->statuscode)); |
742 | 725 | ||
743 | ret = -1; | 726 | ret = -1; |
744 | goto done; | 727 | goto done; |
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 072eeebfdcd1..ec9be0c51c69 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c | |||
@@ -190,7 +190,7 @@ static ssize_t libertas_mpp_get(struct device * dev, | |||
190 | cmd_act_mesh_get_mpp, | 190 | cmd_act_mesh_get_mpp, |
191 | cmd_option_waitforrsp, 0, (void *)&mesh_access); | 191 | cmd_option_waitforrsp, 0, (void *)&mesh_access); |
192 | 192 | ||
193 | return snprintf(buf, 3, "%d\n", mesh_access.data[0]); | 193 | return snprintf(buf, 3, "%d\n", le32_to_cpu(mesh_access.data[0])); |
194 | } | 194 | } |
195 | 195 | ||
196 | /** | 196 | /** |
@@ -199,9 +199,12 @@ static ssize_t libertas_mpp_get(struct device * dev, | |||
199 | static ssize_t libertas_mpp_set(struct device * dev, | 199 | static ssize_t libertas_mpp_set(struct device * dev, |
200 | struct device_attribute *attr, const char * buf, size_t count) { | 200 | struct device_attribute *attr, const char * buf, size_t count) { |
201 | struct cmd_ds_mesh_access mesh_access; | 201 | struct cmd_ds_mesh_access mesh_access; |
202 | uint32_t datum; | ||
202 | 203 | ||
203 | memset(&mesh_access, 0, sizeof(mesh_access)); | 204 | memset(&mesh_access, 0, sizeof(mesh_access)); |
204 | sscanf(buf, "%d", &(mesh_access.data[0])); | 205 | sscanf(buf, "%d", &datum); |
206 | mesh_access.data[0] = cpu_to_le32(datum); | ||
207 | |||
205 | libertas_prepare_and_send_command((to_net_dev(dev))->priv, | 208 | libertas_prepare_and_send_command((to_net_dev(dev))->priv, |
206 | cmd_mesh_access, | 209 | cmd_mesh_access, |
207 | cmd_act_mesh_set_mpp, | 210 | cmd_act_mesh_set_mpp, |
@@ -213,8 +216,7 @@ static ssize_t libertas_mpp_set(struct device * dev, | |||
213 | * libertas_mpp attribute to be exported per mshX interface | 216 | * libertas_mpp attribute to be exported per mshX interface |
214 | * through sysfs (/sys/class/net/mshX/libertas-mpp) | 217 | * through sysfs (/sys/class/net/mshX/libertas-mpp) |
215 | */ | 218 | */ |
216 | static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, | 219 | static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, libertas_mpp_set ); |
217 | libertas_mpp_set ); | ||
218 | 220 | ||
219 | /** | 221 | /** |
220 | * @brief Check if the device can be open and wait if necessary. | 222 | * @brief Check if the device can be open and wait if necessary. |
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c index ec64f6c174bb..5d70a7625150 100644 --- a/drivers/net/wireless/libertas/rx.c +++ b/drivers/net/wireless/libertas/rx.c | |||
@@ -200,7 +200,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) | |||
200 | /* | 200 | /* |
201 | * Check rxpd status and update 802.3 stat, | 201 | * Check rxpd status and update 802.3 stat, |
202 | */ | 202 | */ |
203 | if (!(p_rx_pd->status & MRVDRV_RXPD_STATUS_OK)) { | 203 | if (!(p_rx_pd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) { |
204 | lbs_deb_rx("rx err: frame received with bad status\n"); | 204 | lbs_deb_rx("rx err: frame received with bad status\n"); |
205 | lbs_pr_alert("rxpd not ok\n"); | 205 | lbs_pr_alert("rxpd not ok\n"); |
206 | priv->stats.rx_errors++; | 206 | priv->stats.rx_errors++; |
@@ -353,7 +353,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) | |||
353 | /* | 353 | /* |
354 | * Check rxpd status and update 802.3 stat, | 354 | * Check rxpd status and update 802.3 stat, |
355 | */ | 355 | */ |
356 | if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) { | 356 | if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) { |
357 | //lbs_deb_rx("rx err: frame received with bad status\n"); | 357 | //lbs_deb_rx("rx err: frame received with bad status\n"); |
358 | priv->stats.rx_errors++; | 358 | priv->stats.rx_errors++; |
359 | } | 359 | } |
@@ -386,7 +386,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) | |||
386 | /* XXX must check no carryout */ | 386 | /* XXX must check no carryout */ |
387 | radiotap_hdr.antsignal = prxpd->snr + prxpd->nf; | 387 | radiotap_hdr.antsignal = prxpd->snr + prxpd->nf; |
388 | radiotap_hdr.rx_flags = 0; | 388 | radiotap_hdr.rx_flags = 0; |
389 | if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) | 389 | if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) |
390 | radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS; | 390 | radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS; |
391 | //memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18); | 391 | //memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18); |
392 | 392 | ||
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c index a1ab698088db..9799d87aaa3b 100644 --- a/drivers/net/wireless/libertas/scan.c +++ b/drivers/net/wireless/libertas/scan.c | |||
@@ -323,14 +323,12 @@ static void wlan_scan_create_channel_list(wlan_private * priv, | |||
323 | 323 | ||
324 | if (scantype == cmd_scan_type_passive) { | 324 | if (scantype == cmd_scan_type_passive) { |
325 | scanchanlist[chanidx].maxscantime = | 325 | scanchanlist[chanidx].maxscantime = |
326 | cpu_to_le16 | 326 | cpu_to_le16(MRVDRV_PASSIVE_SCAN_CHAN_TIME); |
327 | (MRVDRV_PASSIVE_SCAN_CHAN_TIME); | ||
328 | scanchanlist[chanidx].chanscanmode.passivescan = | 327 | scanchanlist[chanidx].chanscanmode.passivescan = |
329 | 1; | 328 | 1; |
330 | } else { | 329 | } else { |
331 | scanchanlist[chanidx].maxscantime = | 330 | scanchanlist[chanidx].maxscantime = |
332 | cpu_to_le16 | 331 | cpu_to_le16(MRVDRV_ACTIVE_SCAN_CHAN_TIME); |
333 | (MRVDRV_ACTIVE_SCAN_CHAN_TIME); | ||
334 | scanchanlist[chanidx].chanscanmode.passivescan = | 332 | scanchanlist[chanidx].chanscanmode.passivescan = |
335 | 0; | 333 | 0; |
336 | } | 334 | } |
@@ -487,16 +485,11 @@ wlan_scan_setup_scan_config(wlan_private * priv, | |||
487 | /* If the input config or adapter has the number of Probes set, add tlv */ | 485 | /* If the input config or adapter has the number of Probes set, add tlv */ |
488 | if (numprobes) { | 486 | if (numprobes) { |
489 | pnumprobestlv = (struct mrvlietypes_numprobes *) ptlvpos; | 487 | pnumprobestlv = (struct mrvlietypes_numprobes *) ptlvpos; |
490 | pnumprobestlv->header.type = | 488 | pnumprobestlv->header.type = cpu_to_le16(TLV_TYPE_NUMPROBES); |
491 | cpu_to_le16(TLV_TYPE_NUMPROBES); | 489 | pnumprobestlv->header.len = cpu_to_le16(2); |
492 | pnumprobestlv->header.len = sizeof(pnumprobestlv->numprobes); | ||
493 | pnumprobestlv->numprobes = cpu_to_le16(numprobes); | 490 | pnumprobestlv->numprobes = cpu_to_le16(numprobes); |
494 | 491 | ||
495 | ptlvpos += | 492 | ptlvpos += sizeof(*pnumprobestlv); |
496 | sizeof(pnumprobestlv->header) + pnumprobestlv->header.len; | ||
497 | |||
498 | pnumprobestlv->header.len = | ||
499 | cpu_to_le16(pnumprobestlv->header.len); | ||
500 | } | 493 | } |
501 | 494 | ||
502 | /* | 495 | /* |
@@ -655,8 +648,11 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
655 | ptmpchan, sizeof(pchantlvout->chanscanparam)); | 648 | ptmpchan, sizeof(pchantlvout->chanscanparam)); |
656 | 649 | ||
657 | /* Increment the TLV header length by the size appended */ | 650 | /* Increment the TLV header length by the size appended */ |
658 | pchantlvout->header.len += | 651 | /* Ew, it would be _so_ nice if we could just declare the |
659 | sizeof(pchantlvout->chanscanparam); | 652 | variable little-endian and let GCC handle it for us */ |
653 | pchantlvout->header.len = | ||
654 | cpu_to_le16(le16_to_cpu(pchantlvout->header.len) + | ||
655 | sizeof(pchantlvout->chanscanparam)); | ||
660 | 656 | ||
661 | /* | 657 | /* |
662 | * The tlv buffer length is set to the number of bytes of the | 658 | * The tlv buffer length is set to the number of bytes of the |
@@ -670,7 +666,7 @@ static int wlan_scan_channel_list(wlan_private * priv, | |||
670 | /* Add the size of the channel tlv header and the data length */ | 666 | /* Add the size of the channel tlv header and the data length */ |
671 | pscancfgout->tlvbufferlen += | 667 | pscancfgout->tlvbufferlen += |
672 | (sizeof(pchantlvout->header) | 668 | (sizeof(pchantlvout->header) |
673 | + pchantlvout->header.len); | 669 | + le16_to_cpu(pchantlvout->header.len)); |
674 | 670 | ||
675 | /* Increment the index to the channel tlv we are constructing */ | 671 | /* Increment the index to the channel tlv we are constructing */ |
676 | tlvidx++; | 672 | tlvidx++; |
@@ -955,8 +951,7 @@ static int libertas_process_bss(struct bss_descriptor * bss, | |||
955 | 951 | ||
956 | if (*bytesleft >= sizeof(beaconsize)) { | 952 | if (*bytesleft >= sizeof(beaconsize)) { |
957 | /* Extract & convert beacon size from the command buffer */ | 953 | /* Extract & convert beacon size from the command buffer */ |
958 | memcpy(&beaconsize, *pbeaconinfo, sizeof(beaconsize)); | 954 | beaconsize = le16_to_cpup((void *)*pbeaconinfo); |
959 | beaconsize = le16_to_cpu(beaconsize); | ||
960 | *bytesleft -= sizeof(beaconsize); | 955 | *bytesleft -= sizeof(beaconsize); |
961 | *pbeaconinfo += sizeof(beaconsize); | 956 | *pbeaconinfo += sizeof(beaconsize); |
962 | } | 957 | } |
@@ -995,28 +990,25 @@ static int libertas_process_bss(struct bss_descriptor * bss, | |||
995 | */ | 990 | */ |
996 | 991 | ||
997 | /* RSSI is 1 byte long */ | 992 | /* RSSI is 1 byte long */ |
998 | bss->rssi = le32_to_cpu((long)(*pcurrentptr)); | 993 | bss->rssi = *pcurrentptr; |
999 | lbs_deb_scan("process_bss: RSSI=%02X\n", *pcurrentptr); | 994 | lbs_deb_scan("process_bss: RSSI=%02X\n", *pcurrentptr); |
1000 | pcurrentptr += 1; | 995 | pcurrentptr += 1; |
1001 | bytesleftforcurrentbeacon -= 1; | 996 | bytesleftforcurrentbeacon -= 1; |
1002 | 997 | ||
1003 | /* time stamp is 8 bytes long */ | 998 | /* time stamp is 8 bytes long */ |
1004 | memcpy(fixedie.timestamp, pcurrentptr, 8); | 999 | fixedie.timestamp = bss->timestamp = le64_to_cpup((void *)pcurrentptr); |
1005 | memcpy(bss->timestamp, pcurrentptr, 8); | ||
1006 | pcurrentptr += 8; | 1000 | pcurrentptr += 8; |
1007 | bytesleftforcurrentbeacon -= 8; | 1001 | bytesleftforcurrentbeacon -= 8; |
1008 | 1002 | ||
1009 | /* beacon interval is 2 bytes long */ | 1003 | /* beacon interval is 2 bytes long */ |
1010 | memcpy(&fixedie.beaconinterval, pcurrentptr, 2); | 1004 | fixedie.beaconinterval = bss->beaconperiod = le16_to_cpup((void *)pcurrentptr); |
1011 | bss->beaconperiod = le16_to_cpu(fixedie.beaconinterval); | ||
1012 | pcurrentptr += 2; | 1005 | pcurrentptr += 2; |
1013 | bytesleftforcurrentbeacon -= 2; | 1006 | bytesleftforcurrentbeacon -= 2; |
1014 | 1007 | ||
1015 | /* capability information is 2 bytes long */ | 1008 | /* capability information is 2 bytes long */ |
1016 | memcpy(&fixedie.capabilities, pcurrentptr, 2); | 1009 | memcpy(&fixedie.capabilities, pcurrentptr, 2); |
1017 | lbs_deb_scan("process_bss: fixedie.capabilities=0x%X\n", | 1010 | lbs_deb_scan("process_bss: fixedie.capabilities=0x%X\n", |
1018 | fixedie.capabilities); | 1011 | fixedie.capabilities); |
1019 | fixedie.capabilities = le16_to_cpu(fixedie.capabilities); | ||
1020 | pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities; | 1012 | pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities; |
1021 | memcpy(&bss->cap, pcap, sizeof(struct ieeetypes_capinfo)); | 1013 | memcpy(&bss->cap, pcap, sizeof(struct ieeetypes_capinfo)); |
1022 | pcurrentptr += 2; | 1014 | pcurrentptr += 2; |
@@ -1077,8 +1069,10 @@ static int libertas_process_bss(struct bss_descriptor * bss, | |||
1077 | pFH = (struct ieeetypes_fhparamset *) pcurrentptr; | 1069 | pFH = (struct ieeetypes_fhparamset *) pcurrentptr; |
1078 | memmove(&bss->phyparamset.fhparamset, pFH, | 1070 | memmove(&bss->phyparamset.fhparamset, pFH, |
1079 | sizeof(struct ieeetypes_fhparamset)); | 1071 | sizeof(struct ieeetypes_fhparamset)); |
1072 | #if 0 /* I think we can store these LE */ | ||
1080 | bss->phyparamset.fhparamset.dwelltime | 1073 | bss->phyparamset.fhparamset.dwelltime |
1081 | = le16_to_cpu(bss->phyparamset.fhparamset.dwelltime); | 1074 | = le16_to_cpu(bss->phyparamset.fhparamset.dwelltime); |
1075 | #endif | ||
1082 | break; | 1076 | break; |
1083 | 1077 | ||
1084 | case DS_PARAM_SET: | 1078 | case DS_PARAM_SET: |
@@ -1099,8 +1093,10 @@ static int libertas_process_bss(struct bss_descriptor * bss, | |||
1099 | bss->atimwindow = le32_to_cpu(pibss->atimwindow); | 1093 | bss->atimwindow = le32_to_cpu(pibss->atimwindow); |
1100 | memmove(&bss->ssparamset.ibssparamset, pibss, | 1094 | memmove(&bss->ssparamset.ibssparamset, pibss, |
1101 | sizeof(struct ieeetypes_ibssparamset)); | 1095 | sizeof(struct ieeetypes_ibssparamset)); |
1096 | #if 0 | ||
1102 | bss->ssparamset.ibssparamset.atimwindow | 1097 | bss->ssparamset.ibssparamset.atimwindow |
1103 | = le16_to_cpu(bss->ssparamset.ibssparamset.atimwindow); | 1098 | = le16_to_cpu(bss->ssparamset.ibssparamset.atimwindow); |
1099 | #endif | ||
1104 | break; | 1100 | break; |
1105 | 1101 | ||
1106 | /* Handle Country Info IE */ | 1102 | /* Handle Country Info IE */ |
@@ -1744,7 +1740,8 @@ int libertas_cmd_80211_scan(wlan_private * priv, | |||
1744 | + pscancfg->tlvbufferlen + S_DS_GEN); | 1740 | + pscancfg->tlvbufferlen + S_DS_GEN); |
1745 | 1741 | ||
1746 | lbs_deb_scan("SCAN_CMD: command=%x, size=%x, seqnum=%x\n", | 1742 | lbs_deb_scan("SCAN_CMD: command=%x, size=%x, seqnum=%x\n", |
1747 | cmd->command, cmd->size, cmd->seqnum); | 1743 | le16_to_cpu(cmd->command), le16_to_cpu(cmd->size), |
1744 | le16_to_cpu(cmd->seqnum)); | ||
1748 | 1745 | ||
1749 | lbs_deb_leave(LBS_DEB_ASSOC); | 1746 | lbs_deb_leave(LBS_DEB_ASSOC); |
1750 | return 0; | 1747 | return 0; |
@@ -1799,7 +1796,6 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp) | |||
1799 | int bytesleft; | 1796 | int bytesleft; |
1800 | int idx; | 1797 | int idx; |
1801 | int tlvbufsize; | 1798 | int tlvbufsize; |
1802 | u64 tsfval; | ||
1803 | int ret; | 1799 | int ret; |
1804 | 1800 | ||
1805 | lbs_deb_enter(LBS_DEB_ASSOC); | 1801 | lbs_deb_enter(LBS_DEB_ASSOC); |
@@ -1905,9 +1901,7 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp) | |||
1905 | * beacon or probe response was received. | 1901 | * beacon or probe response was received. |
1906 | */ | 1902 | */ |
1907 | if (ptsftlv) { | 1903 | if (ptsftlv) { |
1908 | memcpy(&tsfval, &ptsftlv->tsftable[idx], sizeof(tsfval)); | 1904 | new.networktsf = le64_to_cpup(&ptsftlv->tsftable[idx]); |
1909 | tsfval = le64_to_cpu(tsfval); | ||
1910 | memcpy(&new.networktsf, &tsfval, sizeof(new.networktsf)); | ||
1911 | } | 1905 | } |
1912 | 1906 | ||
1913 | /* Copy the locally created newbssentry to the scan table */ | 1907 | /* Copy the locally created newbssentry to the scan table */ |
diff --git a/drivers/net/wireless/libertas/scan.h b/drivers/net/wireless/libertas/scan.h index df7481c11f68..60a09e347f45 100644 --- a/drivers/net/wireless/libertas/scan.h +++ b/drivers/net/wireless/libertas/scan.h | |||
@@ -154,7 +154,7 @@ struct bss_descriptor { | |||
154 | u8 mode; | 154 | u8 mode; |
155 | u8 libertas_supported_rates[WLAN_SUPPORTED_RATES]; | 155 | u8 libertas_supported_rates[WLAN_SUPPORTED_RATES]; |
156 | 156 | ||
157 | u8 timestamp[8]; //!< TSF value included in the beacon/probe response | 157 | __le64 timestamp; //!< TSF value included in the beacon/probe response |
158 | unsigned long last_scanned; | 158 | unsigned long last_scanned; |
159 | 159 | ||
160 | union ieeetypes_phyparamset phyparamset; | 160 | union ieeetypes_phyparamset phyparamset; |
@@ -162,7 +162,7 @@ struct bss_descriptor { | |||
162 | struct ieeetypes_capinfo cap; | 162 | struct ieeetypes_capinfo cap; |
163 | u8 datarates[WLAN_SUPPORTED_RATES]; | 163 | u8 datarates[WLAN_SUPPORTED_RATES]; |
164 | 164 | ||
165 | __le64 networktsf; //!< TSF timestamp from the current firmware TSF | 165 | u64 networktsf; //!< TSF timestamp from the current firmware TSF |
166 | 166 | ||
167 | struct ieeetypes_countryinfofullset countryinfo; | 167 | struct ieeetypes_countryinfofullset countryinfo; |
168 | 168 | ||
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c index b6cb675f730d..10d1db0ab3a6 100644 --- a/drivers/net/wireless/libertas/tx.c +++ b/drivers/net/wireless/libertas/tx.c | |||
@@ -85,13 +85,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) | |||
85 | 85 | ||
86 | memset(plocaltxpd, 0, sizeof(struct txpd)); | 86 | memset(plocaltxpd, 0, sizeof(struct txpd)); |
87 | 87 | ||
88 | plocaltxpd->tx_packet_length = skb->len; | 88 | plocaltxpd->tx_packet_length = cpu_to_le16(skb->len); |
89 | 89 | ||
90 | /* offset of actual data */ | 90 | /* offset of actual data */ |
91 | plocaltxpd->tx_packet_location = sizeof(struct txpd); | 91 | plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd)); |
92 | 92 | ||
93 | /* TxCtrl set by user or default */ | 93 | /* TxCtrl set by user or default */ |
94 | plocaltxpd->tx_control = adapter->pkttxctrl; | 94 | plocaltxpd->tx_control = cpu_to_le32(adapter->pkttxctrl); |
95 | 95 | ||
96 | p802x_hdr = skb->data; | 96 | p802x_hdr = skb->data; |
97 | if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) { | 97 | if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) { |
@@ -102,15 +102,16 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) | |||
102 | /* set txpd fields from the radiotap header */ | 102 | /* set txpd fields from the radiotap header */ |
103 | new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate); | 103 | new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate); |
104 | if (new_rate != 0) { | 104 | if (new_rate != 0) { |
105 | /* erase tx_control[4:0] */ | 105 | /* use new tx_control[4:0] */ |
106 | plocaltxpd->tx_control &= ~0x1f; | 106 | new_rate |= (adapter->pkttxctrl & ~0x1f); |
107 | /* write new tx_control[4:0] */ | 107 | plocaltxpd->tx_control = cpu_to_le32(new_rate); |
108 | plocaltxpd->tx_control |= new_rate; | ||
109 | } | 108 | } |
110 | 109 | ||
111 | /* skip the radiotap header */ | 110 | /* skip the radiotap header */ |
112 | p802x_hdr += sizeof(struct tx_radiotap_hdr); | 111 | p802x_hdr += sizeof(struct tx_radiotap_hdr); |
113 | plocaltxpd->tx_packet_length -= sizeof(struct tx_radiotap_hdr); | 112 | plocaltxpd->tx_packet_length = |
113 | cpu_to_le32(le32_to_cpu(plocaltxpd->tx_packet_length) | ||
114 | - sizeof(struct tx_radiotap_hdr)); | ||
114 | 115 | ||
115 | } | 116 | } |
116 | /* copy destination address from 802.3 or 802.11 header */ | 117 | /* copy destination address from 802.3 or 802.11 header */ |
@@ -122,19 +123,19 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) | |||
122 | lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd)); | 123 | lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd)); |
123 | 124 | ||
124 | if (IS_MESH_FRAME(skb)) { | 125 | if (IS_MESH_FRAME(skb)) { |
125 | plocaltxpd->tx_control |= TxPD_MESH_FRAME; | 126 | plocaltxpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME); |
126 | } | 127 | } |
127 | 128 | ||
128 | memcpy(ptr, plocaltxpd, sizeof(struct txpd)); | 129 | memcpy(ptr, plocaltxpd, sizeof(struct txpd)); |
129 | 130 | ||
130 | ptr += sizeof(struct txpd); | 131 | ptr += sizeof(struct txpd); |
131 | 132 | ||
132 | lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, plocaltxpd->tx_packet_length); | 133 | lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, le32_to_cpu(plocaltxpd->tx_packet_length)); |
133 | memcpy(ptr, p802x_hdr, plocaltxpd->tx_packet_length); | 134 | memcpy(ptr, p802x_hdr, le32_to_cpu(plocaltxpd->tx_packet_length)); |
134 | ret = priv->hw_host_to_card(priv, MVMS_DAT, | 135 | ret = priv->hw_host_to_card(priv, MVMS_DAT, |
135 | priv->adapter->tmptxbuf, | 136 | priv->adapter->tmptxbuf, |
136 | plocaltxpd->tx_packet_length + | 137 | le32_to_cpu(plocaltxpd->tx_packet_length) + |
137 | sizeof(struct txpd)); | 138 | sizeof(struct txpd)); |
138 | 139 | ||
139 | if (ret) { | 140 | if (ret) { |
140 | lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret); | 141 | lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret); |
diff --git a/drivers/net/wireless/libertas/types.h b/drivers/net/wireless/libertas/types.h index 09d62f8b1a16..028e2f3b53d6 100644 --- a/drivers/net/wireless/libertas/types.h +++ b/drivers/net/wireless/libertas/types.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #define _WLAN_TYPES_ | 5 | #define _WLAN_TYPES_ |
6 | 6 | ||
7 | #include <linux/if_ether.h> | 7 | #include <linux/if_ether.h> |
8 | #include <asm/byteorder.h> | ||
8 | 9 | ||
9 | /** IEEE type definitions */ | 10 | /** IEEE type definitions */ |
10 | enum ieeetypes_elementid { | 11 | enum ieeetypes_elementid { |
@@ -29,9 +30,30 @@ enum ieeetypes_elementid { | |||
29 | EXTRA_IE = 133, | 30 | EXTRA_IE = 133, |
30 | } __attribute__ ((packed)); | 31 | } __attribute__ ((packed)); |
31 | 32 | ||
33 | #ifdef __BIG_ENDIAN | ||
32 | #define CAPINFO_MASK (~(0xda00)) | 34 | #define CAPINFO_MASK (~(0xda00)) |
35 | #else | ||
36 | #define CAPINFO_MASK (~(0x00da)) | ||
37 | #endif | ||
33 | 38 | ||
34 | struct ieeetypes_capinfo { | 39 | struct ieeetypes_capinfo { |
40 | #ifdef __BIG_ENDIAN_BITFIELD | ||
41 | u8 chanagility:1; | ||
42 | u8 pbcc:1; | ||
43 | u8 shortpreamble:1; | ||
44 | u8 privacy:1; | ||
45 | u8 cfpollrqst:1; | ||
46 | u8 cfpollable:1; | ||
47 | u8 ibss:1; | ||
48 | u8 ess:1; | ||
49 | u8 rsrvd1:2; | ||
50 | u8 dsssofdm:1; | ||
51 | u8 rsvrd2:1; | ||
52 | u8 apsd:1; | ||
53 | u8 shortslottime:1; | ||
54 | u8 rsrvd3:1; | ||
55 | u8 spectrummgmt:1; | ||
56 | #else | ||
35 | u8 ess:1; | 57 | u8 ess:1; |
36 | u8 ibss:1; | 58 | u8 ibss:1; |
37 | u8 cfpollable:1; | 59 | u8 cfpollable:1; |
@@ -47,6 +69,7 @@ struct ieeetypes_capinfo { | |||
47 | u8 rsvrd2:1; | 69 | u8 rsvrd2:1; |
48 | u8 dsssofdm:1; | 70 | u8 dsssofdm:1; |
49 | u8 rsrvd1:2; | 71 | u8 rsrvd1:2; |
72 | #endif | ||
50 | } __attribute__ ((packed)); | 73 | } __attribute__ ((packed)); |
51 | 74 | ||
52 | struct ieeetypes_cfparamset { | 75 | struct ieeetypes_cfparamset { |
@@ -54,15 +77,15 @@ struct ieeetypes_cfparamset { | |||
54 | u8 len; | 77 | u8 len; |
55 | u8 cfpcnt; | 78 | u8 cfpcnt; |
56 | u8 cfpperiod; | 79 | u8 cfpperiod; |
57 | u16 cfpmaxduration; | 80 | __le16 cfpmaxduration; |
58 | u16 cfpdurationremaining; | 81 | __le16 cfpdurationremaining; |
59 | } __attribute__ ((packed)); | 82 | } __attribute__ ((packed)); |
60 | 83 | ||
61 | 84 | ||
62 | struct ieeetypes_ibssparamset { | 85 | struct ieeetypes_ibssparamset { |
63 | u8 elementid; | 86 | u8 elementid; |
64 | u8 len; | 87 | u8 len; |
65 | u16 atimwindow; | 88 | __le16 atimwindow; |
66 | } __attribute__ ((packed)); | 89 | } __attribute__ ((packed)); |
67 | 90 | ||
68 | union IEEEtypes_ssparamset { | 91 | union IEEEtypes_ssparamset { |
@@ -73,7 +96,7 @@ union IEEEtypes_ssparamset { | |||
73 | struct ieeetypes_fhparamset { | 96 | struct ieeetypes_fhparamset { |
74 | u8 elementid; | 97 | u8 elementid; |
75 | u8 len; | 98 | u8 len; |
76 | u16 dwelltime; | 99 | __le16 dwelltime; |
77 | u8 hopset; | 100 | u8 hopset; |
78 | u8 hoppattern; | 101 | u8 hoppattern; |
79 | u8 hopindex; | 102 | u8 hopindex; |
@@ -92,8 +115,8 @@ union ieeetypes_phyparamset { | |||
92 | 115 | ||
93 | struct ieeetypes_assocrsp { | 116 | struct ieeetypes_assocrsp { |
94 | struct ieeetypes_capinfo capability; | 117 | struct ieeetypes_capinfo capability; |
95 | u16 statuscode; | 118 | __le16 statuscode; |
96 | u16 aid; | 119 | __le16 aid; |
97 | u8 iebuffer[1]; | 120 | u8 iebuffer[1]; |
98 | } __attribute__ ((packed)); | 121 | } __attribute__ ((packed)); |
99 | 122 | ||
@@ -138,8 +161,8 @@ struct ieeetypes_assocrsp { | |||
138 | 161 | ||
139 | /** TLV related data structures*/ | 162 | /** TLV related data structures*/ |
140 | struct mrvlietypesheader { | 163 | struct mrvlietypesheader { |
141 | u16 type; | 164 | __le16 type; |
142 | u16 len; | 165 | __le16 len; |
143 | } __attribute__ ((packed)); | 166 | } __attribute__ ((packed)); |
144 | 167 | ||
145 | struct mrvlietypes_data { | 168 | struct mrvlietypes_data { |
@@ -164,17 +187,23 @@ struct mrvlietypes_wildcardssidparamset { | |||
164 | } __attribute__ ((packed)); | 187 | } __attribute__ ((packed)); |
165 | 188 | ||
166 | struct chanscanmode { | 189 | struct chanscanmode { |
190 | #ifdef __BIG_ENDIAN_BITFIELD | ||
191 | u8 reserved_2_7:6; | ||
192 | u8 disablechanfilt:1; | ||
193 | u8 passivescan:1; | ||
194 | #else | ||
167 | u8 passivescan:1; | 195 | u8 passivescan:1; |
168 | u8 disablechanfilt:1; | 196 | u8 disablechanfilt:1; |
169 | u8 reserved_2_7:6; | 197 | u8 reserved_2_7:6; |
198 | #endif | ||
170 | } __attribute__ ((packed)); | 199 | } __attribute__ ((packed)); |
171 | 200 | ||
172 | struct chanscanparamset { | 201 | struct chanscanparamset { |
173 | u8 radiotype; | 202 | u8 radiotype; |
174 | u8 channumber; | 203 | u8 channumber; |
175 | struct chanscanmode chanscanmode; | 204 | struct chanscanmode chanscanmode; |
176 | u16 minscantime; | 205 | __le16 minscantime; |
177 | u16 maxscantime; | 206 | __le16 maxscantime; |
178 | } __attribute__ ((packed)); | 207 | } __attribute__ ((packed)); |
179 | 208 | ||
180 | struct mrvlietypes_chanlistparamset { | 209 | struct mrvlietypes_chanlistparamset { |
@@ -185,12 +214,12 @@ struct mrvlietypes_chanlistparamset { | |||
185 | struct cfparamset { | 214 | struct cfparamset { |
186 | u8 cfpcnt; | 215 | u8 cfpcnt; |
187 | u8 cfpperiod; | 216 | u8 cfpperiod; |
188 | u16 cfpmaxduration; | 217 | __le16 cfpmaxduration; |
189 | u16 cfpdurationremaining; | 218 | __le16 cfpdurationremaining; |
190 | } __attribute__ ((packed)); | 219 | } __attribute__ ((packed)); |
191 | 220 | ||
192 | struct ibssparamset { | 221 | struct ibssparamset { |
193 | u16 atimwindow; | 222 | __le16 atimwindow; |
194 | } __attribute__ ((packed)); | 223 | } __attribute__ ((packed)); |
195 | 224 | ||
196 | struct mrvlietypes_ssparamset { | 225 | struct mrvlietypes_ssparamset { |
@@ -202,7 +231,7 @@ struct mrvlietypes_ssparamset { | |||
202 | } __attribute__ ((packed)); | 231 | } __attribute__ ((packed)); |
203 | 232 | ||
204 | struct fhparamset { | 233 | struct fhparamset { |
205 | u16 dwelltime; | 234 | __le16 dwelltime; |
206 | u8 hopset; | 235 | u8 hopset; |
207 | u8 hoppattern; | 236 | u8 hoppattern; |
208 | u8 hopindex; | 237 | u8 hopindex; |
@@ -263,17 +292,17 @@ struct mrvlietypes_beaconsmissed { | |||
263 | 292 | ||
264 | struct mrvlietypes_numprobes { | 293 | struct mrvlietypes_numprobes { |
265 | struct mrvlietypesheader header; | 294 | struct mrvlietypesheader header; |
266 | u16 numprobes; | 295 | __le16 numprobes; |
267 | } __attribute__ ((packed)); | 296 | } __attribute__ ((packed)); |
268 | 297 | ||
269 | struct mrvlietypes_bcastprobe { | 298 | struct mrvlietypes_bcastprobe { |
270 | struct mrvlietypesheader header; | 299 | struct mrvlietypesheader header; |
271 | u16 bcastprobe; | 300 | __le16 bcastprobe; |
272 | } __attribute__ ((packed)); | 301 | } __attribute__ ((packed)); |
273 | 302 | ||
274 | struct mrvlietypes_numssidprobe { | 303 | struct mrvlietypes_numssidprobe { |
275 | struct mrvlietypesheader header; | 304 | struct mrvlietypesheader header; |
276 | u16 numssidprobe; | 305 | __le16 numssidprobe; |
277 | } __attribute__ ((packed)); | 306 | } __attribute__ ((packed)); |
278 | 307 | ||
279 | struct led_pin { | 308 | struct led_pin { |
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c index e91de104ad67..1abb4bcecc66 100644 --- a/drivers/net/wireless/libertas/wext.c +++ b/drivers/net/wireless/libertas/wext.c | |||
@@ -402,7 +402,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info, | |||
402 | int ret = 0; | 402 | int ret = 0; |
403 | wlan_private *priv = dev->priv; | 403 | wlan_private *priv = dev->priv; |
404 | wlan_adapter *adapter = priv->adapter; | 404 | wlan_adapter *adapter = priv->adapter; |
405 | int rthr = vwrq->value; | 405 | u32 rthr = vwrq->value; |
406 | 406 | ||
407 | lbs_deb_enter(LBS_DEB_WEXT); | 407 | lbs_deb_enter(LBS_DEB_WEXT); |
408 | 408 | ||
@@ -452,7 +452,7 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, | |||
452 | struct iw_param *vwrq, char *extra) | 452 | struct iw_param *vwrq, char *extra) |
453 | { | 453 | { |
454 | int ret = 0; | 454 | int ret = 0; |
455 | int fthr = vwrq->value; | 455 | u32 fthr = vwrq->value; |
456 | wlan_private *priv = dev->priv; | 456 | wlan_private *priv = dev->priv; |
457 | wlan_adapter *adapter = priv->adapter; | 457 | wlan_adapter *adapter = priv->adapter; |
458 | 458 | ||
@@ -1115,7 +1115,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) | |||
1115 | /* Quality by TX errors */ | 1115 | /* Quality by TX errors */ |
1116 | priv->wstats.discard.retries = priv->stats.tx_errors; | 1116 | priv->wstats.discard.retries = priv->stats.tx_errors; |
1117 | 1117 | ||
1118 | tx_retries = adapter->logmsg.retry; | 1118 | tx_retries = le16_to_cpu(adapter->logmsg.retry); |
1119 | 1119 | ||
1120 | if (tx_retries > 75) | 1120 | if (tx_retries > 75) |
1121 | tx_qual = (90 - tx_retries) * POOR / 15; | 1121 | tx_qual = (90 - tx_retries) * POOR / 15; |
@@ -1131,10 +1131,10 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) | |||
1131 | (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; | 1131 | (PERFECT - VERY_GOOD) / 50 + VERY_GOOD; |
1132 | quality = min(quality, tx_qual); | 1132 | quality = min(quality, tx_qual); |
1133 | 1133 | ||
1134 | priv->wstats.discard.code = adapter->logmsg.wepundecryptable; | 1134 | priv->wstats.discard.code = le16_to_cpu(adapter->logmsg.wepundecryptable); |
1135 | priv->wstats.discard.fragment = adapter->logmsg.rxfrag; | 1135 | priv->wstats.discard.fragment = le16_to_cpu(adapter->logmsg.rxfrag); |
1136 | priv->wstats.discard.retries = tx_retries; | 1136 | priv->wstats.discard.retries = tx_retries; |
1137 | priv->wstats.discard.misc = adapter->logmsg.ackfailure; | 1137 | priv->wstats.discard.misc = le16_to_cpu(adapter->logmsg.ackfailure); |
1138 | 1138 | ||
1139 | /* Calculate quality */ | 1139 | /* Calculate quality */ |
1140 | priv->wstats.qual.qual = max(quality, (u32)100); | 1140 | priv->wstats.qual.qual = max(quality, (u32)100); |