Commit 981f187b authored by David Woodhouse's avatar David Woodhouse Committed by John W. Linville

[PATCH] libertas: first pass at fixing up endianness issues

Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 123e0e04
...@@ -570,7 +570,7 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv, ...@@ -570,7 +570,7 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
} }
lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, (int)(cmd->size)); lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, le16_to_cpu(cmd->size));
done: done:
lbs_deb_enter(LBS_DEB_11D); lbs_deb_enter(LBS_DEB_11D);
...@@ -611,8 +611,7 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq) ...@@ -611,8 +611,7 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq)
int libertas_ret_802_11d_domain_info(wlan_private * priv, int libertas_ret_802_11d_domain_info(wlan_private * priv,
struct cmd_ds_command *resp) struct cmd_ds_command *resp)
{ {
struct cmd_ds_802_11d_domain_info struct cmd_ds_802_11d_domain_info *domaininfo = &resp->params.domaininforesp;
*domaininfo = &resp->params.domaininforesp;
struct mrvlietypes_domainparamset *domain = &domaininfo->domain; struct mrvlietypes_domainparamset *domain = &domaininfo->domain;
u16 action = le16_to_cpu(domaininfo->action); u16 action = le16_to_cpu(domaininfo->action);
s16 ret = 0; s16 ret = 0;
...@@ -623,8 +622,8 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv, ...@@ -623,8 +622,8 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp, lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp,
(int)le16_to_cpu(resp->size)); (int)le16_to_cpu(resp->size));
nr_subband = (domain->header.len - 3) / sizeof(struct ieeetypes_subbandset); nr_subband = (le16_to_cpu(domain->header.len) - COUNTRY_CODE_LEN) /
/* countrycode 3 bytes */ sizeof(struct ieeetypes_subbandset);
lbs_deb_11d("11D Domain Info Resp: nr_subband=%d\n", nr_subband); lbs_deb_11d("11D Domain Info Resp: nr_subband=%d\n", nr_subband);
......
...@@ -47,7 +47,7 @@ struct mrvlietypes_domainparamset { ...@@ -47,7 +47,7 @@ struct mrvlietypes_domainparamset {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_802_11d_domain_info { struct cmd_ds_802_11d_domain_info {
u16 action; __le16 action;
struct mrvlietypes_domainparamset domain; struct mrvlietypes_domainparamset domain;
} __attribute__ ((packed)); } __attribute__ ((packed));
......
...@@ -209,7 +209,7 @@ static int assoc_helper_mode(wlan_private *priv, ...@@ -209,7 +209,7 @@ static int assoc_helper_mode(wlan_private *priv,
cmd_802_11_snmp_mib, cmd_802_11_snmp_mib,
0, cmd_option_waitforrsp, 0, cmd_option_waitforrsp,
OID_802_11_INFRASTRUCTURE_MODE, OID_802_11_INFRASTRUCTURE_MODE,
(void *) (size_t) assoc_req->mode); /* Shoot me now */ (void *) (size_t) assoc_req->mode);
done: done:
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
......
...@@ -25,13 +25,11 @@ static u16 commands_allowed_in_ps[] = { ...@@ -25,13 +25,11 @@ static u16 commands_allowed_in_ps[] = {
* @param command the command ID * @param command the command ID
* @return TRUE or FALSE * @return TRUE or FALSE
*/ */
static u8 is_command_allowed_in_ps(u16 command) static u8 is_command_allowed_in_ps(__le16 command)
{ {
int count = sizeof(commands_allowed_in_ps)
/ sizeof(commands_allowed_in_ps[0]);
int i; int i;
for (i = 0; i < count; i++) { for (i = 0; i < ARRAY_SIZE(commands_allowed_in_ps); i++) {
if (command == cpu_to_le16(commands_allowed_in_ps[i])) if (command == cpu_to_le16(commands_allowed_in_ps[i]))
return 1; return 1;
} }
...@@ -46,8 +44,7 @@ static int wlan_cmd_hw_spec(wlan_private * priv, struct cmd_ds_command *cmd) ...@@ -46,8 +44,7 @@ static int wlan_cmd_hw_spec(wlan_private * priv, struct cmd_ds_command *cmd)
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(cmd_get_hw_spec); cmd->command = cpu_to_le16(cmd_get_hw_spec);
cmd->size = cmd->size = cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN);
cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN);
memcpy(hwspec->permanentaddr, priv->adapter->current_addr, ETH_ALEN); memcpy(hwspec->permanentaddr, priv->adapter->current_addr, ETH_ALEN);
lbs_deb_leave(LBS_DEB_CMD); lbs_deb_leave(LBS_DEB_CMD);
...@@ -59,18 +56,16 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv, ...@@ -59,18 +56,16 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv,
u16 cmd_action) u16 cmd_action)
{ {
struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode; struct cmd_ds_802_11_ps_mode *psm = &cmd->params.psmode;
u16 action = cmd_action;
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(cmd_802_11_ps_mode); cmd->command = cpu_to_le16(cmd_802_11_ps_mode);
cmd->size = cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) +
cpu_to_le16(sizeof(struct cmd_ds_802_11_ps_mode) +
S_DS_GEN); S_DS_GEN);
psm->action = cpu_to_le16(cmd_action); psm->action = cpu_to_le16(cmd_action);
psm->multipledtim = 0; psm->multipledtim = 0;
switch (action) { switch (cmd_action) {
case cmd_subcmd_enter_ps: case cmd_subcmd_enter_ps:
lbs_deb_cmd("PS command:" "SubCode- Enter PS\n"); lbs_deb_cmd("PS command:" "SubCode- Enter PS\n");
lbs_deb_cmd("locallisteninterval = %d\n", lbs_deb_cmd("locallisteninterval = %d\n",
...@@ -114,8 +109,7 @@ static int wlan_cmd_802_11_inactivity_timeout(wlan_private * priv, ...@@ -114,8 +109,7 @@ static int wlan_cmd_802_11_inactivity_timeout(wlan_private * priv,
cmd->params.inactivity_timeout.action = cpu_to_le16(cmd_action); cmd->params.inactivity_timeout.action = cpu_to_le16(cmd_action);
if (cmd_action) if (cmd_action)
cmd->params.inactivity_timeout.timeout = cmd->params.inactivity_timeout.timeout = cpu_to_le16(*timeout);
cpu_to_le16(*timeout);
else else
cmd->params.inactivity_timeout.timeout = 0; cmd->params.inactivity_timeout.timeout = 0;
...@@ -131,8 +125,7 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv, ...@@ -131,8 +125,7 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv,
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
cmd->size = cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) +
cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) +
S_DS_GEN); S_DS_GEN);
cmd->command = cpu_to_le16(cmd_802_11_sleep_params); cmd->command = cpu_to_le16(cmd_802_11_sleep_params);
...@@ -167,8 +160,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, ...@@ -167,8 +160,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(cmd_802_11_set_wep); cmd->command = cpu_to_le16(cmd_802_11_set_wep);
cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_set_wep)) cmd->size = cpu_to_le16(sizeof(*wep) + S_DS_GEN);
+ S_DS_GEN);
if (cmd_act == cmd_act_add) { if (cmd_act == cmd_act_add) {
int i; int i;
...@@ -182,11 +174,10 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, ...@@ -182,11 +174,10 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
wep->action = cpu_to_le16(cmd_act_add); wep->action = cpu_to_le16(cmd_act_add);
/* default tx key index */ /* default tx key index */
wep->keyindex = cpu_to_le16((u16) wep->keyindex = cpu_to_le16((u16)(assoc_req->wep_tx_keyidx &
(assoc_req->wep_tx_keyidx &
(u32)cmd_WEP_KEY_INDEX_MASK)); (u32)cmd_WEP_KEY_INDEX_MASK));
lbs_deb_cmd("Tx key Index: %u\n", wep->keyindex); lbs_deb_cmd("Tx key Index: %u\n", le16_to_cpu(wep->keyindex));
/* Copy key types and material to host command structure */ /* Copy key types and material to host command structure */
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
...@@ -194,12 +185,14 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, ...@@ -194,12 +185,14 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
switch (pkey->len) { switch (pkey->len) {
case KEY_LEN_WEP_40: case KEY_LEN_WEP_40:
wep->keytype[i] = cmd_type_wep_40_bit; wep->keytype[i] =
cpu_to_le16(cmd_type_wep_40_bit);
memmove(&wep->keymaterial[i], pkey->key, memmove(&wep->keymaterial[i], pkey->key,
pkey->len); pkey->len);
break; break;
case KEY_LEN_WEP_104: case KEY_LEN_WEP_104:
wep->keytype[i] = cmd_type_wep_104_bit; wep->keytype[i] =
cpu_to_le16(cmd_type_wep_104_bit);
memmove(&wep->keymaterial[i], pkey->key, memmove(&wep->keymaterial[i], pkey->key,
pkey->len); pkey->len);
break; break;
...@@ -218,8 +211,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv, ...@@ -218,8 +211,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
wep->action = cpu_to_le16(cmd_act_remove); wep->action = cpu_to_le16(cmd_act_remove);
/* default tx key index */ /* default tx key index */
wep->keyindex = cpu_to_le16((u16) wep->keyindex = cpu_to_le16((u16)(adapter->wep_tx_keyidx &
(adapter->wep_tx_keyidx &
(u32)cmd_WEP_KEY_INDEX_MASK)); (u32)cmd_WEP_KEY_INDEX_MASK));
} }
...@@ -241,8 +233,7 @@ static int wlan_cmd_802_11_enable_rsn(wlan_private * priv, ...@@ -241,8 +233,7 @@ static int wlan_cmd_802_11_enable_rsn(wlan_private * priv,
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(cmd_802_11_enable_rsn); cmd->command = cpu_to_le16(cmd_802_11_enable_rsn);
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_enable_rsn) + cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN);
S_DS_GEN);
penableRSN->action = cpu_to_le16(cmd_action); penableRSN->action = cpu_to_le16(cmd_action);
if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
penableRSN->enable = cpu_to_le16(cmd_enable_rsn); penableRSN->enable = cpu_to_le16(cmd_enable_rsn);
...@@ -353,8 +344,7 @@ static int wlan_cmd_802_11_get_stat(wlan_private * priv, ...@@ -353,8 +344,7 @@ static int wlan_cmd_802_11_get_stat(wlan_private * priv,
{ {
cmd->command = cpu_to_le16(cmd_802_11_get_stat); cmd->command = cpu_to_le16(cmd_802_11_get_stat);
cmd->size = cmd->size =
cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + cpu_to_le16(sizeof(struct cmd_ds_802_11_get_stat) + S_DS_GEN);
S_DS_GEN);
return 0; return 0;
} }
...@@ -373,9 +363,7 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, ...@@ -373,9 +363,7 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
lbs_deb_cmd("SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); lbs_deb_cmd("SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid);
cmd->command = cpu_to_le16(cmd_802_11_snmp_mib); cmd->command = cpu_to_le16(cmd_802_11_snmp_mib);
cmd->size = cmd->size = cpu_to_le16(sizeof(*pSNMPMIB) + S_DS_GEN);
cpu_to_le16(sizeof(struct cmd_ds_802_11_snmp_mib) +
S_DS_GEN);
switch (cmd_oid) { switch (cmd_oid) {
case OID_802_11_INFRASTRUCTURE_MODE: case OID_802_11_INFRASTRUCTURE_MODE:
...@@ -406,7 +394,7 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, ...@@ -406,7 +394,7 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
pSNMPMIB->querytype = cmd_act_set; pSNMPMIB->querytype = cmd_act_set;
pSNMPMIB->bufsize = sizeof(u16); pSNMPMIB->bufsize = sizeof(u16);
ulTemp = *(u32 *)pdata_buf; ulTemp = *(u32 *)pdata_buf;
*((unsigned short *)(pSNMPMIB->value)) = *((__le16 *)(pSNMPMIB->value)) =
cpu_to_le16((u16) ulTemp); cpu_to_le16((u16) ulTemp);
} }
break; break;
...@@ -419,15 +407,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, ...@@ -419,15 +407,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
pSNMPMIB->oid = cpu_to_le16((u16) fragthresh_i); pSNMPMIB->oid = cpu_to_le16((u16) fragthresh_i);
if (cmd_action == cmd_act_get) { if (cmd_action == cmd_act_get) {
pSNMPMIB->querytype = pSNMPMIB->querytype = cpu_to_le16(cmd_act_get);
cpu_to_le16(cmd_act_get);
} else if (cmd_action == cmd_act_set) { } else if (cmd_action == cmd_act_set) {
pSNMPMIB->querytype = pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
cpu_to_le16(cmd_act_set); pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
pSNMPMIB->bufsize =
cpu_to_le16(sizeof(u16));
ulTemp = *((u32 *) pdata_buf); ulTemp = *((u32 *) pdata_buf);
*((unsigned short *)(pSNMPMIB->value)) = *((__le16 *)(pSNMPMIB->value)) =
cpu_to_le16((u16) ulTemp); cpu_to_le16((u16) ulTemp);
} }
...@@ -442,16 +427,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, ...@@ -442,16 +427,12 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
pSNMPMIB->oid = le16_to_cpu((u16) rtsthresh_i); pSNMPMIB->oid = le16_to_cpu((u16) rtsthresh_i);
if (cmd_action == cmd_act_get) { if (cmd_action == cmd_act_get) {
pSNMPMIB->querytype = pSNMPMIB->querytype = cpu_to_le16(cmd_act_get);
cpu_to_le16(cmd_act_get);
} else if (cmd_action == cmd_act_set) { } else if (cmd_action == cmd_act_set) {
pSNMPMIB->querytype = pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
cpu_to_le16(cmd_act_set); pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
pSNMPMIB->bufsize = ulTemp = *((u32 *)pdata_buf);
cpu_to_le16(sizeof(u16)); *(__le16 *)(pSNMPMIB->value) =
ulTemp = *((u32 *)
pdata_buf);
*(unsigned short *)(pSNMPMIB->value) =
cpu_to_le16((u16) ulTemp); cpu_to_le16((u16) ulTemp);
} }
...@@ -461,13 +442,11 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, ...@@ -461,13 +442,11 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
pSNMPMIB->oid = cpu_to_le16((u16) short_retrylim_i); pSNMPMIB->oid = cpu_to_le16((u16) short_retrylim_i);
if (cmd_action == cmd_act_get) { if (cmd_action == cmd_act_get) {
pSNMPMIB->querytype = pSNMPMIB->querytype = cpu_to_le16(cmd_act_get);
cpu_to_le16(cmd_act_get);
} else if (cmd_action == cmd_act_set) { } else if (cmd_action == cmd_act_set) {
pSNMPMIB->querytype = pSNMPMIB->querytype = cpu_to_le16(cmd_act_set);
cpu_to_le16(cmd_act_set);
pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16)); pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
*((unsigned short *)(pSNMPMIB->value)) = *((__le16 *)(pSNMPMIB->value)) =
cpu_to_le16((u16) adapter->txretrycount); cpu_to_le16((u16) adapter->txretrycount);
} }
...@@ -478,12 +457,14 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv, ...@@ -478,12 +457,14 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
lbs_deb_cmd( lbs_deb_cmd(
"SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n", "SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n",
cmd->command, cmd->size, cmd->seqnum, cmd->result); le16_to_cpu(cmd->command), le16_to_cpu(cmd->size),
le16_to_cpu(cmd->seqnum), le16_to_cpu(cmd->result));
lbs_deb_cmd( lbs_deb_cmd(
"SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n", "SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n",
pSNMPMIB->querytype, pSNMPMIB->oid, pSNMPMIB->bufsize, le16_to_cpu(pSNMPMIB->querytype), le16_to_cpu(pSNMPMIB->oid),
*(u16 *) pSNMPMIB->value); le16_to_cpu(pSNMPMIB->bufsize),
le16_to_cpu(*(__le16 *) pSNMPMIB->value));
lbs_deb_leave(LBS_DEB_CMD); lbs_deb_leave(LBS_DEB_CMD);
return 0; return 0;
...@@ -494,8 +475,7 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv, ...@@ -494,8 +475,7 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv,
int cmd_action) int cmd_action)
{ {
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
struct cmd_ds_802_11_radio_control *pradiocontrol = struct cmd_ds_802_11_radio_control *pradiocontrol = &cmd->params.radio;
&cmd->params.radio;
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
...@@ -540,13 +520,13 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv, ...@@ -540,13 +520,13 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
cmd->size = cmd->size =
cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) + cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) + S_DS_GEN);
S_DS_GEN);
cmd->command = cpu_to_le16(cmd_802_11_rf_tx_power); cmd->command = cpu_to_le16(cmd_802_11_rf_tx_power);
prtp->action = cmd_action; prtp->action = cpu_to_le16(cmd_action);
lbs_deb_cmd("RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n", cmd->size, lbs_deb_cmd("RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n",
cmd->command, prtp->action); le16_to_cpu(cmd->size), le16_to_cpu(cmd->command),
le16_to_cpu(prtp->action));
switch (cmd_action) { switch (cmd_action) {
case cmd_act_tx_power_opt_get: case cmd_act_tx_power_opt_get:
...@@ -556,14 +536,12 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv, ...@@ -556,14 +536,12 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
case cmd_act_tx_power_opt_set_high: case cmd_act_tx_power_opt_set_high:
prtp->action = cpu_to_le16(cmd_act_set); prtp->action = cpu_to_le16(cmd_act_set);
prtp->currentlevel = prtp->currentlevel = cpu_to_le16(cmd_act_tx_power_index_high);
cpu_to_le16(cmd_act_tx_power_index_high);
break; break;
case cmd_act_tx_power_opt_set_mid: case cmd_act_tx_power_opt_set_mid:
prtp->action = cpu_to_le16(cmd_act_set); prtp->action = cpu_to_le16(cmd_act_set);
prtp->currentlevel = prtp->currentlevel = cpu_to_le16(cmd_act_tx_power_index_mid);
cpu_to_le16(cmd_act_tx_power_index_mid);
break; break;
case cmd_act_tx_power_opt_set_low: case cmd_act_tx_power_opt_set_low:
...@@ -583,15 +561,12 @@ static int wlan_cmd_802_11_rf_antenna(wlan_private * priv, ...@@ -583,15 +561,12 @@ static int wlan_cmd_802_11_rf_antenna(wlan_private * priv,
struct cmd_ds_802_11_rf_antenna *rant = &cmd->params.rant; struct cmd_ds_802_11_rf_antenna *rant = &cmd->params.rant;
cmd->command = cpu_to_le16(cmd_802_11_rf_antenna); cmd->command = cpu_to_le16(cmd_802_11_rf_antenna);
cmd->size = cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_antenna) +
cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_antenna) +
S_DS_GEN); S_DS_GEN);
rant->action = cpu_to_le16(cmd_action); rant->action = cpu_to_le16(cmd_action);
if ((cmd_action == cmd_act_set_rx) || if ((cmd_action == cmd_act_set_rx) || (cmd_action == cmd_act_set_tx)) {
(cmd_action == cmd_act_set_tx)) { rant->antennamode = cpu_to_le16((u16) (*(u32 *) pdata_buf));
rant->antennamode =
cpu_to_le16((u16) (*(u32 *) pdata_buf));
} }
return 0; return 0;
...@@ -612,9 +587,9 @@ static int wlan_cmd_802_11_rate_adapt_rateset(wlan_private * priv, ...@@ -612,9 +587,9 @@ static int wlan_cmd_802_11_rate_adapt_rateset(wlan_private * priv,
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
rateadapt->action = cmd_action; rateadapt->action = cpu_to_le16(cmd_action);
rateadapt->enablehwauto = adapter->enablehwauto; rateadapt->enablehwauto = cpu_to_le16(adapter->enablehwauto);
rateadapt->bitmap = adapter->ratebitmap; rateadapt->bitmap = cpu_to_le16(adapter->ratebitmap);
lbs_deb_leave(LBS_DEB_CMD); lbs_deb_leave(LBS_DEB_CMD);
return 0; return 0;
...@@ -626,12 +601,10 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv, ...@@ -626,12 +601,10 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv,
{ {
struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate; struct cmd_ds_802_11_data_rate *pdatarate = &cmd->params.drate;
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
u16 action = cmd_action;
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
cmd->size = cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) +
cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) +
S_DS_GEN); S_DS_GEN);
cmd->command = cpu_to_le16(cmd_802_11_data_rate); 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,11 +613,11 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv,
pdatarate->action = cpu_to_le16(cmd_action); pdatarate->action = cpu_to_le16(cmd_action);
if (action == cmd_act_set_tx_fix_rate) { if (cmd_action == cmd_act_set_tx_fix_rate) {
pdatarate->datarate[0] = libertas_data_rate_to_index(adapter->datarate); pdatarate->datarate[0] = libertas_data_rate_to_index(adapter->datarate);
lbs_deb_cmd("Setting FW for fixed rate 0x%02X\n", lbs_deb_cmd("Setting FW for fixed rate 0x%02X\n",
adapter->datarate); adapter->datarate);
} else if (action == cmd_act_set_tx_auto) { } else if (cmd_action == cmd_act_set_tx_auto) {
lbs_deb_cmd("Setting FW for AUTO rate\n"); lbs_deb_cmd("Setting FW for AUTO rate\n");
} }
...@@ -659,8 +632,7 @@ static int wlan_cmd_mac_multicast_adr(wlan_private * priv, ...@@ -659,8 +632,7 @@ static int wlan_cmd_mac_multicast_adr(wlan_private * priv,
struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr; struct cmd_ds_mac_multicast_adr *pMCastAdr = &cmd->params.madr;
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
cmd->size = cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) +
cpu_to_le16(sizeof(struct cmd_ds_mac_multicast_adr) +
S_DS_GEN); S_DS_GEN);
cmd->command = cpu_to_le16(cmd_mac_multicast_adr); cmd->command = cpu_to_le16(cmd_mac_multicast_adr);
...@@ -680,8 +652,8 @@ static int wlan_cmd_802_11_rf_channel(wlan_private * priv, ...@@ -680,8 +652,8 @@ static int wlan_cmd_802_11_rf_channel(wlan_private * priv,
struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel; struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel;
cmd->command = cpu_to_le16(cmd_802_11_rf_channel); cmd->command = cpu_to_le16(cmd_802_11_rf_channel);
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) +
+ S_DS_GEN); S_DS_GEN);
if (option == cmd_opt_802_11_rf_channel_set) { if (option == cmd_opt_802_11_rf_channel_set) {
rfchan->currentchannel = cpu_to_le16(*((u16 *) pdata_buf)); rfchan->currentchannel = cpu_to_le16(*((u16 *) pdata_buf));
...@@ -698,9 +670,8 @@ static int wlan_cmd_802_11_rssi(wlan_private * priv, ...@@ -698,9 +670,8 @@ static int wlan_cmd_802_11_rssi(wlan_private * priv,
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
cmd->command = cpu_to_le16(cmd_802_11_rssi); cmd->command = cpu_to_le16(cmd_802_11_rssi);
cmd->size = cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN);
cpu_to_le16(sizeof(struct cmd_ds_802_11_rssi) + S_DS_GEN); cmd->params.rssi.N = cpu_to_le16(priv->adapter->bcn_avg_factor);
cmd->params.rssi.N = priv->adapter->bcn_avg_factor;
/* reset Beacon SNR/NF/RSSI values */ /* reset Beacon SNR/NF/RSSI values */
adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = 0; adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = 0;
...@@ -729,8 +700,7 @@ static int wlan_cmd_reg_access(wlan_private * priv, ...@@ -729,8 +700,7 @@ static int wlan_cmd_reg_access(wlan_private * priv,
struct cmd_ds_mac_reg_access *macreg; struct cmd_ds_mac_reg_access *macreg;
cmdptr->size = cmdptr->size =
cpu_to_le16(sizeof cpu_to_le16(sizeof (struct cmd_ds_mac_reg_access)
(struct cmd_ds_mac_reg_access)
+ S_DS_GEN); + S_DS_GEN);
macreg = macreg =
(struct cmd_ds_mac_reg_access *)&cmdptr->params. (struct cmd_ds_mac_reg_access *)&cmdptr->params.
...@@ -796,8 +766,7 @@ static int wlan_cmd_802_11_mac_address(wlan_private * priv, ...@@ -796,8 +766,7 @@ static int wlan_cmd_802_11_mac_address(wlan_private * priv,
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
cmd->command = cpu_to_le16(cmd_802_11_mac_address); cmd->command = cpu_to_le16(cmd_802_11_mac_address);
cmd->size = cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) +
cpu_to_le16(sizeof(struct cmd_ds_802_11_mac_address) +
S_DS_GEN); S_DS_GEN);
cmd->result = 0; cmd->result = 0;
...@@ -821,8 +790,7 @@ static int wlan_cmd_802_11_eeprom_access(wlan_private * priv, ...@@ -821,8 +790,7 @@ static int wlan_cmd_802_11_eeprom_access(wlan_private * priv,
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(cmd_802_11_eeprom_access); cmd->command = cpu_to_le16(cmd_802_11_eeprom_access);
cmd->size = cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) +
cpu_to_le16(sizeof(struct cmd_ds_802_11_eeprom_access) +
S_DS_GEN); S_DS_GEN);
cmd->result = 0; cmd->result = 0;
...@@ -842,8 +810,7 @@ static int wlan_cmd_bt_access(wlan_private * priv, ...@@ -842,8 +810,7 @@ static int wlan_cmd_bt_access(wlan_private * priv,
lbs_deb_cmd("BT CMD(%d)\n", cmd_action); lbs_deb_cmd("BT CMD(%d)\n", cmd_action);
cmd->command = cpu_to_le16(cmd_bt_access); cmd->command = cpu_to_le16(cmd_bt_access);
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) + S_DS_GEN);
+ S_DS_GEN);
cmd->result = 0; cmd->result = 0;
bt_access->action = cpu_to_le16(cmd_action); bt_access->action = cpu_to_le16(cmd_action);
...@@ -880,8 +847,7 @@ static int wlan_cmd_fwt_access(wlan_private * priv, ...@@ -880,8 +847,7 @@ static int wlan_cmd_fwt_access(wlan_private * priv,
lbs_deb_cmd("FWT CMD(%d)\n", cmd_action); lbs_deb_cmd("FWT CMD(%d)\n", cmd_action);
cmd->command = cpu_to_le16(cmd_fwt_access); cmd->command = cpu_to_le16(cmd_fwt_access);
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) + S_DS_GEN);
+ S_DS_GEN);
cmd->result = 0; cmd->result = 0;
if (pdata_buf) if (pdata_buf)
...@@ -902,8 +868,7 @@ static int wlan_cmd_mesh_access(wlan_private * priv, ...@@ -902,8 +868,7 @@ static int wlan_cmd_mesh_access(wlan_private * priv,
lbs_deb_cmd("FWT CMD(%d)\n", cmd_action); lbs_deb_cmd("FWT CMD(%d)\n", cmd_action);
cmd->command = cpu_to_le16(cmd_mesh_access); cmd->command = cpu_to_le16(cmd_mesh_access);
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN);
+ S_DS_GEN);
cmd->result = 0; cmd->result = 0;
if (pdata_buf) if (pdata_buf)
...@@ -937,7 +902,7 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u ...@@ -937,7 +902,7 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
/* Exit_PS command needs to be queued in the header always. */ /* Exit_PS command needs to be queued in the header always. */
if (cmdptr->command == cmd_802_11_ps_mode) { if (cmdptr->command == cmd_802_11_ps_mode) {
struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode; struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode;
if (psm->action == cmd_subcmd_exit_ps) { if (psm->action == cpu_to_le16(cmd_subcmd_exit_ps)) {
if (adapter->psstate != PS_STATE_FULL_POWER) if (adapter->psstate != PS_STATE_FULL_POWER)
addtail = 0; addtail = 0;
} }
...@@ -955,7 +920,7 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u ...@@ -955,7 +920,7 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
lbs_deb_cmd("QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n", lbs_deb_cmd("QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n",
cmdnode, cmdnode,
((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command); le16_to_cpu(((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command));
done: done:
lbs_deb_leave(LBS_DEB_CMD); lbs_deb_leave(LBS_DEB_CMD);
...@@ -1009,7 +974,7 @@ static int DownloadcommandToStation(wlan_private * priv, ...@@ -1009,7 +974,7 @@ static int DownloadcommandToStation(wlan_private * priv,
adapter->cur_cmd_retcode = 0; adapter->cur_cmd_retcode = 0;
spin_unlock_irqrestore(&adapter->driver_lock, flags); spin_unlock_irqrestore(&adapter->driver_lock, flags);
lbs_deb_cmd("DNLD_CMD:: Before download, size of cmd = %d\n", lbs_deb_cmd("DNLD_CMD:: Before download, size of cmd = %d\n",
cmdptr->size); le16_to_cpu(cmdptr->size));
cmdsize = cmdptr->size; cmdsize = cmdptr->size;
...@@ -1034,8 +999,7 @@ static int DownloadcommandToStation(wlan_private * priv, ...@@ -1034,8 +999,7 @@ static int DownloadcommandToStation(wlan_private * priv,
lbs_dbg_hex("DNLD_CMD: command", cmdnode->bufvirtualaddr, cmdsize); lbs_dbg_hex("DNLD_CMD: command", cmdnode->bufvirtualaddr, cmdsize);
/* Setup the timer after transmit command */ /* Setup the timer after transmit command */
if (command == cmd_802_11_scan if (command == cmd_802_11_scan || command == cmd_802_11_authenticate
|| command == cmd_802_11_authenticate
|| command == cmd_802_11_associate) || command == cmd_802_11_associate)
mod_timer(&adapter->command_timer, jiffies + (10*HZ)); mod_timer(&adapter->command_timer, jiffies + (10*HZ));
else else
...@@ -1056,12 +1020,11 @@ static int wlan_cmd_mac_control(wlan_private * priv, ...@@ -1056,12 +1020,11 @@ static int wlan_cmd_mac_control(wlan_private * priv,
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(cmd_mac_control); cmd->command = cpu_to_le16(cmd_mac_control);
cmd->size = cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN);
cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN);
mac->action = cpu_to_le16(priv->adapter->currentpacketfilter); mac->action = cpu_to_le16(priv->adapter->currentpacketfilter);
lbs_deb_cmd("wlan_cmd_mac_control(): action=0x%X size=%d\n", lbs_deb_cmd("wlan_cmd_mac_control(): action=0x%X size=%d\n",
mac->action, cmd->size); le16_to_cpu(mac->action), le16_to_cpu(cmd->size));
lbs_deb_leave(LBS_DEB_CMD); lbs_deb_leave(LBS_DEB_CMD);
return 0; return 0;
...@@ -1193,7 +1156,7 @@ int libertas_prepare_and_send_command(wlan_private * priv, ...@@ -1193,7 +1156,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
adapter->seqnum++; adapter->seqnum++;
cmdptr->seqnum = cpu_to_le16(adapter->seqnum); cmdptr->seqnum = cpu_to_le16(adapter->seqnum);
cmdptr->command = cmd_no; cmdptr->command = cpu_to_le16(cmd_no);
cmdptr->result = 0; cmdptr->result = 0;
switch (cmd_no) { switch (cmd_no) {
...@@ -1329,8 +1292,7 @@ int libertas_prepare_and_send_command(wlan_private * priv, ...@@ -1329,8 +1292,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
case cmd_802_11_get_afc: case cmd_802_11_get_afc:
cmdptr->command = cpu_to_le16(cmd_no); cmdptr->command = cpu_to_le16(cmd_no);
cmdptr->size = cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) +
cpu_to_le16(sizeof(struct cmd_ds_802_11_afc) +
S_DS_GEN); S_DS_GEN);
memmove(&cmdptr->params.afc, memmove(&cmdptr->params.afc,
...@@ -1410,16 +1372,13 @@ int libertas_prepare_and_send_command(wlan_private * priv, ...@@ -1410,16 +1372,13 @@ int libertas_prepare_and_send_command(wlan_private * priv,
case cmd_get_tsf: case cmd_get_tsf:
cmdptr->command = cpu_to_le16(cmd_get_tsf); cmdptr->command = cpu_to_le16(cmd_get_tsf);
cmdptr->size = cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf) +
cpu_to_le16(sizeof(struct cmd_ds_get_tsf) S_DS_GEN);
+ S_DS_GEN);
ret = 0; ret = 0;
break; break;
case cmd_802_11_tx_rate_query: case cmd_802_11_tx_rate_query:
cmdptr->command = cmdptr->command = cpu_to_le16(cmd_802_11_tx_rate_query);
cpu_to_le16(cmd_802_11_tx_rate_query); cmdptr->size = cpu_to_le16(sizeof(struct cmd_tx_rate_query) +
cmdptr->size =
cpu_to_le16(sizeof(struct cmd_tx_rate_query) +
S_DS_GEN); S_DS_GEN);
adapter->txrate = 0; adapter->txrate = 0;
ret = 0; ret = 0;
...@@ -1529,7 +1488,7 @@ done: ...@@ -1529,7 +1488,7 @@ done:
*/ */
int libertas_free_cmd_buffer(wlan_private * priv) int libertas_free_cmd_buffer(wlan_private * priv)
{ {
u32 ulbufsize; u32 ulbufsize; /* Someone needs to die for this. Slowly and painfully */
unsigned int i; unsigned int i;
struct cmd_ctrl_node *tempcmd_array; struct cmd_ctrl_node *tempcmd_array;
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
...@@ -1694,18 +1653,19 @@ int libertas_execute_next_command(wlan_private * priv) ...@@ -1694,18 +1653,19 @@ int libertas_execute_next_command(wlan_private * priv)
cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
if (is_command_allowed_in_ps(cmdptr->command)) { if (is_command_allowed_in_ps(cmdptr->command)) {
if ((adapter->psstate == PS_STATE_SLEEP) if ((adapter->psstate == PS_STATE_SLEEP) ||
|| (adapter->psstate == PS_STATE_PRE_SLEEP) (adapter->psstate == PS_STATE_PRE_SLEEP)) {
) {
lbs_deb_cmd( lbs_deb_cmd(
"EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n", "EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n",
cmdptr->command, adapter->psstate); le16_to_cpu(cmdptr->command),
adapter->psstate);
ret = -1; ret = -1;
goto done; goto done;
} }
lbs_deb_cmd("EXEC_NEXT_CMD: OK to send command " lbs_deb_cmd("EXEC_NEXT_CMD: OK to send command "
"0x%x in psstate %d\n", "0x%x in psstate %d\n",
cmdptr->command, adapter->psstate); le16_to_cpu(cmdptr->command),
adapter->psstate);
} else if (adapter->psstate != PS_STATE_FULL_POWER) { } else if (adapter->psstate != PS_STATE_FULL_POWER) {
/* /*
* 1. Non-PS command: * 1. Non-PS command:
...@@ -1755,9 +1715,8 @@ int libertas_execute_next_command(wlan_private * priv) ...@@ -1755,9 +1715,8 @@ int libertas_execute_next_command(wlan_private * priv)
goto done; goto done;
} }
if ((adapter->psstate == PS_STATE_SLEEP) if ((adapter->psstate == PS_STATE_SLEEP) ||
|| (adapter->psstate == PS_STATE_PRE_SLEEP) (adapter->psstate == PS_STATE_PRE_SLEEP)) {
) {
lbs_deb_cmd( lbs_deb_cmd(
"EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n"); "EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n");
list_del((struct list_head *)cmdnode); list_del((struct list_head *)cmdnode);
...@@ -1774,7 +1733,7 @@ int libertas_execute_next_command(wlan_private * priv) ...@@ -1774,7 +1733,7 @@ int libertas_execute_next_command(wlan_private * priv)
} }
list_del((struct list_head *)cmdnode); list_del((struct list_head *)cmdnode);
lbs_deb_cmd("EXEC_NEXT_CMD: Sending 0x%04X command\n", lbs_deb_cmd("EXEC_NEXT_CMD: Sending 0x%04X command\n",
cmdptr->command); le16_to_cpu(cmdptr->command));
DownloadcommandToStation(priv, cmdnode); DownloadcommandToStation(priv, cmdnode);
} else { } else {
/* /*
...@@ -1784,11 +1743,11 @@ int libertas_execute_next_command(wlan_private * priv) ...@@ -1784,11 +1743,11 @@ int libertas_execute_next_command(wlan_private * priv)
if ((adapter->psmode != wlan802_11powermodecam) && if ((adapter->psmode != wlan802_11powermodecam) &&
(adapter->psstate == PS_STATE_FULL_POWER) && (adapter->psstate == PS_STATE_FULL_POWER) &&
(adapter->connect_status == libertas_connected)) { (adapter->connect_status == libertas_connected)) {
if (adapter->secinfo.WPAenabled if (adapter->secinfo.WPAenabled ||
|| adapter->secinfo.WPA2enabled) { adapter->secinfo.WPA2enabled) {
/* check for valid WPA group keys */ /* check for valid WPA group keys */
if (adapter->wpa_mcast_key.len if (adapter->wpa_mcast_key.len ||
|| adapter->wpa_unicast_key.len) { adapter->wpa_unicast_key.len) {
lbs_deb_cmd( lbs_deb_cmd(
"EXEC_NEXT_CMD: WPA enabled and GTK_SET" "EXEC_NEXT_CMD: WPA enabled and GTK_SET"
" go back to PS_SLEEP"); " go back to PS_SLEEP");
...@@ -1824,8 +1783,7 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str) ...@@ -1824,8 +1783,7 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str)
iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN; iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN;
/* Send Event to upper layer */ /* Send Event to upper layer */
lbs_deb_cmd("Event Indication string = %s\n", lbs_deb_cmd("Event Indication string = %s\n", (char *)buf);
(char *)buf);
lbs_deb_cmd("Event Indication String length = %d\n", iwrq.data.length); lbs_deb_cmd("Event Indication String length = %d\n", iwrq.data.length);
lbs_deb_cmd("Sending wireless event IWEVCUSTOM for %s\n", str); 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,13 +1859,13 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option)
*/ */
void libertas_ps_wakeup(wlan_private * priv, int wait_option) void libertas_ps_wakeup(wlan_private * priv, int wait_option)
{ {
enum WLAN_802_11_POWER_MODE Localpsmode; __le32 Localpsmode;
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
Localpsmode = wlan802_11powermodecam; Localpsmode = cpu_to_le32(wlan802_11powermodecam);
lbs_deb_cmd("Exit_PS: Localpsmode = %d\n", Localpsmode); lbs_deb_cmd("Exit_PS: Localpsmode = %d\n", wlan802_11powermodecam);
libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode, libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode,
cmd_subcmd_exit_ps, cmd_subcmd_exit_ps,
......
...@@ -123,37 +123,27 @@ static int wlan_ret_reg_access(wlan_private * priv, ...@@ -123,37 +123,27 @@ static int wlan_ret_reg_access(wlan_private * priv,
switch (type) { switch (type) {
case cmd_ret_mac_reg_access: case cmd_ret_mac_reg_access:
{ {
struct cmd_ds_mac_reg_access *reg; struct cmd_ds_mac_reg_access *reg = &resp->params.macreg;
reg = adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
(struct cmd_ds_mac_reg_access *)&resp->params. adapter->offsetvalue.value = le32_to_cpu(reg->value);
macreg;
adapter->offsetvalue.offset = reg->offset;
adapter->offsetvalue.value = reg->value;
break; break;
} }
case cmd_ret_bbp_reg_access: case cmd_ret_bbp_reg_access:
{ {
struct cmd_ds_bbp_reg_access *reg; struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg;
reg =
(struct cmd_ds_bbp_reg_access *)&resp->params.
bbpreg;
adapter->offsetvalue.offset = reg->offset; adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
adapter->offsetvalue.value = reg->value; adapter->offsetvalue.value = reg->value;
break; break;
} }
case cmd_ret_rf_reg_access: case cmd_ret_rf_reg_access:
{ {
struct cmd_ds_rf_reg_access *reg; struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg;
reg =
(struct cmd_ds_rf_reg_access *)&resp->params.
rfreg;
adapter->offsetvalue.offset = reg->offset; adapter->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
adapter->offsetvalue.value = reg->value; adapter->offsetvalue.value = reg->value;
break; break;
} }
...@@ -178,7 +168,7 @@ static int wlan_ret_get_hw_spec(wlan_private * priv, ...@@ -178,7 +168,7 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo);
adapter->fwreleasenumber = hwspec->fwreleasenumber; adapter->fwreleasenumber = le32_to_cpu(hwspec->fwreleasenumber);
lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- 0x%X\n", lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- 0x%X\n",
adapter->fwreleasenumber); adapter->fwreleasenumber);
...@@ -203,19 +193,15 @@ static int wlan_ret_get_hw_spec(wlan_private * priv, ...@@ -203,19 +193,15 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
if (i >= MRVDRV_MAX_REGION_CODE) { if (i >= MRVDRV_MAX_REGION_CODE) {
adapter->regioncode = 0x10; adapter->regioncode = 0x10;
adapter->regiontableindex = 0; adapter->regiontableindex = 0;
lbs_pr_info( lbs_pr_info("unidentified region code; using the default (USA)\n");
"unidentified region code, use the default (USA)\n");
} }
if (adapter->current_addr[0] == 0xff) { if (adapter->current_addr[0] == 0xff)
memmove(adapter->current_addr, hwspec->permanentaddr, memmove(adapter->current_addr, hwspec->permanentaddr, ETH_ALEN);
ETH_ALEN);
}
memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN); memcpy(priv->dev->dev_addr, adapter->current_addr, ETH_ALEN);
if (priv->mesh_dev) if (priv->mesh_dev)
memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, memcpy(priv->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
ETH_ALEN);
if (libertas_set_regiontable(priv, adapter->regioncode, 0)) { if (libertas_set_regiontable(priv, adapter->regioncode, 0)) {
ret = -1; ret = -1;
...@@ -241,13 +227,15 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv, ...@@ -241,13 +227,15 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv,
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n" lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n"
" extsleepclk=%x\n", sp->error, sp->offset, " extsleepclk=%x\n", le16_to_cpu(sp->error),
sp->stabletime, sp->calcontrol, sp->externalsleepclk); le16_to_cpu(sp->offset), le16_to_cpu(sp->stabletime),
sp->calcontrol, sp->externalsleepclk);
adapter->sp.sp_error = le16_to_cpu(sp->error); adapter->sp.sp_error = le16_to_cpu(sp->error);
adapter->sp.sp_offset = le16_to_cpu(sp->offset); adapter->sp.sp_offset = le16_to_cpu(sp->offset);
adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime); adapter->sp.sp_stabletime = le16_to_cpu(sp->stabletime);
adapter->sp.sp_calcontrol = le16_to_cpu(sp->calcontrol); adapter->sp.sp_calcontrol = sp->calcontrol;
adapter->sp.sp_extsleepclk = le16_to_cpu(sp->externalsleepclk); adapter->sp.sp_extsleepclk = sp->externalsleepclk;
adapter->sp.sp_reserved = le16_to_cpu(sp->reserved); adapter->sp.sp_reserved = le16_to_cpu(sp->reserved);
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
...@@ -280,29 +268,25 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv, ...@@ -280,29 +268,25 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv,
lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid, lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid,
querytype); querytype);
lbs_deb_cmd("SNMP_RESP: Buf size = %x\n", lbs_deb_cmd("SNMP_RESP: Buf size = %x\n", le16_to_cpu(smib->bufsize));
le16_to_cpu(smib->bufsize));
if (querytype == cmd_act_get) { if (querytype == cmd_act_get) {
switch (oid) { switch (oid) {
case fragthresh_i: case fragthresh_i:
priv->adapter->fragthsd = priv->adapter->fragthsd =
le16_to_cpu(* le16_to_cpu(*((__le16 *)(smib->value)));
((unsigned short *)(smib->value)));
lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n", lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n",
priv->adapter->fragthsd); priv->adapter->fragthsd);
break; break;
case rtsthresh_i: case rtsthresh_i:
priv->adapter->rtsthsd = priv->adapter->rtsthsd =
le16_to_cpu(* le16_to_cpu(*((__le16 *)(smib->value)));
((unsigned short *)(smib->value)));
lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n", lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n",
priv->adapter->rtsthsd); priv->adapter->rtsthsd);
break; break;
case short_retrylim_i: case short_retrylim_i:
priv->adapter->txretrycount = priv->adapter->txretrycount =
le16_to_cpu(* le16_to_cpu(*((__le16 *)(smib->value)));
((unsigned short *)(smib->value)));
lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n", lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n",
priv->adapter->rtsthsd); priv->adapter->rtsthsd);
break; break;
...@@ -408,12 +392,10 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv, ...@@ -408,12 +392,10 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv,
u16 action = le16_to_cpu(pAntenna->action); u16 action = le16_to_cpu(pAntenna->action);
if (action == cmd_act_get_rx) if (action == cmd_act_get_rx)
adapter->rxantennamode = adapter->rxantennamode = le16_to_cpu(pAntenna->antennamode);
le16_to_cpu(pAntenna->antennamode);
if (action == cmd_act_get_tx) if (action == cmd_act_get_tx)
adapter->txantennamode = adapter->txantennamode = le16_to_cpu(pAntenna->antennamode);
le16_to_cpu(pAntenna->antennamode);
lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n", lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n",
action, le16_to_cpu(pAntenna->antennamode)); action, le16_to_cpu(pAntenna->antennamode));
...@@ -424,15 +406,14 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv, ...@@ -424,15 +406,14 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv,
static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv, static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv,
struct cmd_ds_command *resp) struct cmd_ds_command *resp)
{ {
struct cmd_ds_802_11_rate_adapt_rateset *rates = struct cmd_ds_802_11_rate_adapt_rateset *rates = &resp->params.rateset;
&resp->params.rateset;
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
if (rates->action == cmd_act_get) { if (rates->action == cmd_act_get) {
adapter->enablehwauto = rates->enablehwauto; adapter->enablehwauto = le16_to_cpu(rates->enablehwauto);
adapter->ratebitmap = rates->bitmap; adapter->ratebitmap = le16_to_cpu(rates->bitmap);
} }
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
...@@ -452,7 +433,7 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv, ...@@ -452,7 +433,7 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv,
(u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate)); (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate));
dot11datarate = pdatarate->datarate[0]; dot11datarate = pdatarate->datarate[0];
if (pdatarate->action == cmd_act_get_tx_rate) { if (pdatarate->action == cpu_to_le16(cmd_act_get_tx_rate)) {
memcpy(adapter->libertas_supported_rates, pdatarate->datarate, memcpy(adapter->libertas_supported_rates, pdatarate->datarate,
sizeof(adapter->libertas_supported_rates)); sizeof(adapter->libertas_supported_rates));
} }
...@@ -465,8 +446,7 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv, ...@@ -465,8 +446,7 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv,
static int wlan_ret_802_11_rf_channel(wlan_private * priv, static int wlan_ret_802_11_rf_channel(wlan_private * priv,
struct cmd_ds_command *resp) struct cmd_ds_command *resp)
{ {
struct cmd_ds_802_11_rf_channel *rfchannel = struct cmd_ds_802_11_rf_channel *rfchannel = &resp->params.rfchannel;
&resp->params.rfchannel;
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
u16 action = le16_to_cpu(rfchannel->action); u16 action = le16_to_cpu(rfchannel->action);
u16 newchannel = le16_to_cpu(rfchannel->currentchannel); u16 newchannel = le16_to_cpu(rfchannel->currentchannel);
...@@ -494,12 +474,10 @@ static int wlan_ret_802_11_rssi(wlan_private * priv, ...@@ -494,12 +474,10 @@ static int wlan_ret_802_11_rssi(wlan_private * priv,
/* store the non average value */ /* store the non average value */
adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR); adapter->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR);
adapter->NF[TYPE_BEACON][TYPE_NOAVG] = adapter->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor);
le16_to_cpu(rssirsp->noisefloor);
adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR); adapter->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR);
adapter->NF[TYPE_BEACON][TYPE_AVG] = adapter->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor);
le16_to_cpu(rssirsp->avgnoisefloor);
adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] = adapter->RSSI[TYPE_BEACON][TYPE_NOAVG] =
CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG], CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_NOAVG],
...@@ -543,15 +521,13 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv, ...@@ -543,15 +521,13 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv,
static int wlan_ret_get_log(wlan_private * priv, static int wlan_ret_get_log(wlan_private * priv,
struct cmd_ds_command *resp) struct cmd_ds_command *resp)
{ {
struct cmd_ds_802_11_get_log *logmessage = struct cmd_ds_802_11_get_log *logmessage = &resp->params.glog;
(struct cmd_ds_802_11_get_log *)&resp->params.glog;
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
/* TODO Convert it to Big Endian before copy */ /* Stored little-endian */
memcpy(&adapter->logmsg, logmessage, memcpy(&adapter->logmsg, logmessage, sizeof(struct cmd_ds_802_11_get_log));
sizeof(struct cmd_ds_802_11_get_log));
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
return 0; return 0;
...@@ -614,8 +590,7 @@ static inline int handle_cmd_response(u16 respcmd, ...@@ -614,8 +590,7 @@ static inline int handle_cmd_response(u16 respcmd,
case cmd_ret_802_11_set_afc: case cmd_ret_802_11_set_afc:
case cmd_ret_802_11_get_afc: case cmd_ret_802_11_get_afc:
spin_lock_irqsave(&adapter->driver_lock, flags); spin_lock_irqsave(&adapter->driver_lock, flags);
memmove(adapter->cur_cmd->pdata_buf, memmove(adapter->cur_cmd->pdata_buf, &resp->params.afc,
&resp->params.afc,
sizeof(struct cmd_ds_802_11_afc)); sizeof(struct cmd_ds_802_11_afc));
spin_unlock_irqrestore(&adapter->driver_lock, flags); spin_unlock_irqrestore(&adapter->driver_lock, flags);
...@@ -681,22 +656,19 @@ static inline int handle_cmd_response(u16 respcmd, ...@@ -681,22 +656,19 @@ static inline int handle_cmd_response(u16 respcmd,
case cmd_ret_802_11_tpc_cfg: case cmd_ret_802_11_tpc_cfg:
spin_lock_irqsave(&adapter->driver_lock, flags); spin_lock_irqsave(&adapter->driver_lock, flags);
memmove(adapter->cur_cmd->pdata_buf, memmove(adapter->cur_cmd->pdata_buf, &resp->params.tpccfg,
&resp->params.tpccfg,
sizeof(struct cmd_ds_802_11_tpc_cfg)); sizeof(struct cmd_ds_802_11_tpc_cfg));
spin_unlock_irqrestore(&adapter->driver_lock, flags); spin_unlock_irqrestore(&adapter->driver_lock, flags);
break; break;
case cmd_ret_802_11_led_gpio_ctrl: case cmd_ret_802_11_led_gpio_ctrl:
spin_lock_irqsave(&adapter->driver_lock, flags); spin_lock_irqsave(&adapter->driver_lock, flags);
memmove(adapter->cur_cmd->pdata_buf, memmove(adapter->cur_cmd->pdata_buf, &resp->params.ledgpio,
&resp->params.ledgpio,
sizeof(struct cmd_ds_802_11_led_ctrl)); sizeof(struct cmd_ds_802_11_led_ctrl));
spin_unlock_irqrestore(&adapter->driver_lock, flags); spin_unlock_irqrestore(&adapter->driver_lock, flags);
break; break;
case cmd_ret_802_11_pwr_cfg: case cmd_ret_802_11_pwr_cfg:
spin_lock_irqsave(&adapter->driver_lock, flags); spin_lock_irqsave(&adapter->driver_lock, flags);
memmove(adapter->cur_cmd->pdata_buf, memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg,
&resp->params.pwrcfg,
sizeof(struct cmd_ds_802_11_pwr_cfg)); sizeof(struct cmd_ds_802_11_pwr_cfg));
spin_unlock_irqrestore(&adapter->driver_lock, flags); spin_unlock_irqrestore(&adapter->driver_lock, flags);
...@@ -718,15 +690,13 @@ static inline int handle_cmd_response(u16 respcmd, ...@@ -718,15 +690,13 @@ static inline int handle_cmd_response(u16 respcmd,
case cmd_ret_fwt_access: case cmd_ret_fwt_access:
spin_lock_irqsave(&adapter->driver_lock, flags); spin_lock_irqsave(&adapter->driver_lock, flags);
if (adapter->cur_cmd->pdata_buf) if (adapter->cur_cmd->pdata_buf)
memcpy(adapter->cur_cmd->pdata_buf, memcpy(adapter->cur_cmd->pdata_buf, &resp->params.fwt,
&resp->params.fwt,
sizeof(resp->params.fwt)); sizeof(resp->params.fwt));
spin_unlock_irqrestore(&adapter->driver_lock, flags); spin_unlock_irqrestore(&adapter->driver_lock, flags);
break; break;
case cmd_ret_mesh_access: case cmd_ret_mesh_access:
if (adapter->cur_cmd->pdata_buf) if (adapter->cur_cmd->pdata_buf)
memcpy(adapter->cur_cmd->pdata_buf, memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh,
&resp->params.mesh,
sizeof(resp->params.mesh)); sizeof(resp->params.mesh));
break; break;
case cmd_rte_802_11_tx_rate_query: case cmd_rte_802_11_tx_rate_query:
...@@ -789,31 +759,28 @@ int libertas_process_rx_command(wlan_private * priv) ...@@ -789,31 +759,28 @@ int libertas_process_rx_command(wlan_private * priv)
} }
/* Store the response code to cur_cmd_retcode. */ /* Store the response code to cur_cmd_retcode. */
adapter->cur_cmd_retcode = le16_to_cpu(resp->result); adapter->cur_cmd_retcode = result;;
if (respcmd == cmd_ret_802_11_ps_mode) { if (respcmd == cmd_ret_802_11_ps_mode) {
struct cmd_ds_802_11_ps_mode *psmode; struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode;
u16 action = le16_to_cpu(psmode->action);
psmode = &resp->params.psmode;
lbs_deb_cmd( lbs_deb_cmd(
"CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n", "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n",
resp->result, psmode->action); result, action);
psmode->action = cpu_to_le16(psmode->action);
if (result) { if (result) {
lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n", lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n",
resp->result); result);
if (adapter->mode == IW_MODE_ADHOC) {
/* /*
* We should not re-try enter-ps command in * We should not re-try enter-ps command in
* ad-hoc mode. It takes place in * ad-hoc mode. It takes place in
* libertas_execute_next_command(). * libertas_execute_next_command().
*/ */
if (psmode->action == cmd_subcmd_enter_ps) if (adapter->mode == IW_MODE_ADHOC &&
adapter->psmode = action == cmd_subcmd_enter_ps)
wlan802_11powermodecam; adapter->psmode = wlan802_11powermodecam;
} } else if (action == cmd_subcmd_enter_ps) {
} else if (psmode->action == cmd_subcmd_enter_ps) {
adapter->needtowakeup = 0; adapter->needtowakeup = 0;
adapter->psstate = PS_STATE_AWAKE; adapter->psstate = PS_STATE_AWAKE;
...@@ -832,13 +799,12 @@ int libertas_process_rx_command(wlan_private * priv) ...@@ -832,13 +799,12 @@ int libertas_process_rx_command(wlan_private * priv)
mutex_lock(&adapter->lock); mutex_lock(&adapter->lock);
spin_lock_irqsave(&adapter->driver_lock, flags); spin_lock_irqsave(&adapter->driver_lock, flags);
} }
} else if (psmode->action == cmd_subcmd_exit_ps) { } else if (action == cmd_subcmd_exit_ps) {
adapter->needtowakeup = 0; adapter->needtowakeup = 0;
adapter->psstate = PS_STATE_FULL_POWER; adapter->psstate = PS_STATE_FULL_POWER;
lbs_deb_cmd("CMD_RESP: Exit_PS command response\n"); lbs_deb_cmd("CMD_RESP: Exit_PS command response\n");
} else { } else {
lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n", lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n", action);
psmode->action);
} }
__libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
...@@ -860,7 +826,7 @@ int libertas_process_rx_command(wlan_private * priv) ...@@ -860,7 +826,7 @@ int libertas_process_rx_command(wlan_private * priv)
/* If the command is not successful, cleanup and return failure */ /* If the command is not successful, cleanup and return failure */
if ((result != 0 || !(respcmd & 0x8000))) { if ((result != 0 || !(respcmd & 0x8000))) {
lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n", lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n",
resp->command, resp->result); respcmd, result);
/* /*
* Handling errors here * Handling errors here
*/ */
......
...@@ -103,7 +103,6 @@ static ssize_t libertas_sleepparams_write(struct file *file, ...@@ -103,7 +103,6 @@ static ssize_t libertas_sleepparams_write(struct file *file,
wlan_private *priv = file->private_data; wlan_private *priv = file->private_data;
ssize_t buf_size, res; ssize_t buf_size, res;
int p1, p2, p3, p4, p5, p6; int p1, p2, p3, p4, p5, p6;
struct sleep_params sp;
unsigned long addr = get_zeroed_page(GFP_KERNEL); unsigned long addr = get_zeroed_page(GFP_KERNEL);
char *buf = (char *)addr; char *buf = (char *)addr;
...@@ -117,14 +116,12 @@ static ssize_t libertas_sleepparams_write(struct file *file, ...@@ -117,14 +116,12 @@ static ssize_t libertas_sleepparams_write(struct file *file,
res = -EFAULT; res = -EFAULT;
goto out_unlock; goto out_unlock;
} }
sp.sp_error = p1; priv->adapter->sp.sp_error = p1;
sp.sp_offset = p2; priv->adapter->sp.sp_offset = p2;
sp.sp_stabletime = p3; priv->adapter->sp.sp_stabletime = p3;
sp.sp_calcontrol = p4; priv->adapter->sp.sp_calcontrol = p4;
sp.sp_extsleepclk = p5; priv->adapter->sp.sp_extsleepclk = p5;
sp.sp_reserved = p6; priv->adapter->sp.sp_reserved = p6;
memcpy(&priv->adapter->sp, &sp, sizeof(struct sleep_params));
res = libertas_prepare_and_send_command(priv, res = libertas_prepare_and_send_command(priv,
cmd_802_11_sleep_params, cmd_802_11_sleep_params,
...@@ -408,8 +405,8 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf, ...@@ -408,8 +405,8 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf,
(*cmdnode)->cmdflags |= CMD_F_HOSTCMD; (*cmdnode)->cmdflags |= CMD_F_HOSTCMD;
(*cmdnode)->cmdwaitqwoken = 0; (*cmdnode)->cmdwaitqwoken = 0;
*cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr; *cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr;
(*cmd)->command = cmd_802_11_subscribe_event; (*cmd)->command = cpu_to_le16(cmd_802_11_subscribe_event);
(*cmd)->seqnum = ++priv->adapter->seqnum; (*cmd)->seqnum = cpu_to_le16(++priv->adapter->seqnum);
(*cmd)->result = 0; (*cmd)->result = 0;
return 0; return 0;
} }
...@@ -435,9 +432,8 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, ...@@ -435,9 +432,8 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf,
} }
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_get; event->action = cpu_to_le16(cmd_act_get);
pcmdptr->size = pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -447,14 +443,14 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, ...@@ -447,14 +443,14 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf,
pcmdptr = response_buf; pcmdptr = response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
return 0; return 0;
} }
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
lbs_pr_err("command response incorrect!\n"); lbs_pr_err("command response incorrect!\n");
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
...@@ -462,17 +458,17 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, ...@@ -462,17 +458,17 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf,
} }
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); event = (void *)(response_buf + S_DS_GEN);
while (cmd_len < pcmdptr->size) { while (cmd_len < le16_to_cpu(pcmdptr->size)) {
struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
switch(header->type) { switch (header->type) {
struct mrvlietypes_rssithreshold *Lowrssi; struct mrvlietypes_rssithreshold *Lowrssi;
case TLV_TYPE_RSSI_LOW: case __constant_cpu_to_le16(TLV_TYPE_RSSI_LOW):
Lowrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len); Lowrssi = (void *)(response_buf + cmd_len);
pos += snprintf(buf+pos, len-pos, "%d %d %d\n", pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
Lowrssi->rssivalue, Lowrssi->rssivalue,
Lowrssi->rssifreq, Lowrssi->rssifreq,
(event->events & 0x0001)?1:0); (event->events & cpu_to_le16(0x0001))?1:0);
default: default:
cmd_len += sizeof(struct mrvlietypes_snrthreshold); cmd_len += sizeof(struct mrvlietypes_snrthreshold);
break; break;
...@@ -500,9 +496,8 @@ static u16 libertas_get_events_bitmap(wlan_private *priv) ...@@ -500,9 +496,8 @@ static u16 libertas_get_events_bitmap(wlan_private *priv)
return res; return res;
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_get; event->action = cpu_to_le16(cmd_act_get);
pcmdptr->size = pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -513,8 +508,8 @@ static u16 libertas_get_events_bitmap(wlan_private *priv) ...@@ -513,8 +508,8 @@ static u16 libertas_get_events_bitmap(wlan_private *priv)
pcmdptr = response_buf; pcmdptr = response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
kfree(response_buf); kfree(response_buf);
return 0; return 0;
} }
...@@ -526,7 +521,7 @@ static u16 libertas_get_events_bitmap(wlan_private *priv) ...@@ -526,7 +521,7 @@ static u16 libertas_get_events_bitmap(wlan_private *priv)
} }
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
event_bitmap = event->events; event_bitmap = le16_to_cpu(event->events);
kfree(response_buf); kfree(response_buf);
return event_bitmap; return event_bitmap;
} }
...@@ -567,7 +562,7 @@ static ssize_t libertas_lowrssi_write(struct file *file, ...@@ -567,7 +562,7 @@ static ssize_t libertas_lowrssi_write(struct file *file,
goto out_unlock; goto out_unlock;
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_set; event->action = cpu_to_le16(cmd_act_set);
pcmdptr->size = cpu_to_le16(S_DS_GEN + pcmdptr->size = cpu_to_le16(S_DS_GEN +
sizeof(struct cmd_ds_802_11_subscribe_event) + sizeof(struct cmd_ds_802_11_subscribe_event) +
sizeof(struct mrvlietypes_rssithreshold)); sizeof(struct mrvlietypes_rssithreshold));
...@@ -576,11 +571,11 @@ static ssize_t libertas_lowrssi_write(struct file *file, ...@@ -576,11 +571,11 @@ static ssize_t libertas_lowrssi_write(struct file *file,
ptr = (u8*) pcmdptr+cmd_len; ptr = (u8*) pcmdptr+cmd_len;
rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr);
rssi_threshold->header.type = cpu_to_le16(0x0104); rssi_threshold->header.type = cpu_to_le16(0x0104);
rssi_threshold->header.len = 2; rssi_threshold->header.len = cpu_to_le16(2);
rssi_threshold->rssivalue = cpu_to_le16(value); rssi_threshold->rssivalue = value;
rssi_threshold->rssifreq = cpu_to_le16(freq); rssi_threshold->rssifreq = freq;
event_bitmap |= subscribed ? 0x0001 : 0x0; event_bitmap |= subscribed ? 0x0001 : 0x0;
event->events = event_bitmap; event->events = cpu_to_le16(event_bitmap);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -592,14 +587,14 @@ static ssize_t libertas_lowrssi_write(struct file *file, ...@@ -592,14 +587,14 @@ static ssize_t libertas_lowrssi_write(struct file *file,
pcmdptr = response_buf; pcmdptr = response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
return 0; return 0;
} }
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
lbs_pr_err("command response incorrect!\n"); lbs_pr_err("command response incorrect!\n");
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
...@@ -633,9 +628,8 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, ...@@ -633,9 +628,8 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf,
} }
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_get; event->action = cpu_to_le16(cmd_act_get);
pcmdptr->size = pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -646,14 +640,14 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, ...@@ -646,14 +640,14 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf,
pcmdptr = response_buf; pcmdptr = response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
return 0; return 0;
} }
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
lbs_pr_err("command response incorrect!\n"); lbs_pr_err("command response incorrect!\n");
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
...@@ -661,17 +655,17 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, ...@@ -661,17 +655,17 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf,
} }
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); event = (void *)(response_buf + S_DS_GEN);
while (cmd_len < pcmdptr->size) { while (cmd_len < le16_to_cpu(pcmdptr->size)) {
struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
switch(header->type) { switch (header->type) {
struct mrvlietypes_snrthreshold *LowSnr; struct mrvlietypes_snrthreshold *LowSnr;
case TLV_TYPE_SNR_LOW: case __constant_cpu_to_le16(TLV_TYPE_SNR_LOW):
LowSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len); LowSnr = (void *)(response_buf + cmd_len);
pos += snprintf(buf+pos, len-pos, "%d %d %d\n", pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
LowSnr->snrvalue, LowSnr->snrvalue,
LowSnr->snrfreq, LowSnr->snrfreq,
(event->events & 0x0002)?1:0); (event->events & cpu_to_le16(0x0002))?1:0);
default: default:
cmd_len += sizeof(struct mrvlietypes_snrthreshold); cmd_len += sizeof(struct mrvlietypes_snrthreshold);
break; break;
...@@ -721,7 +715,7 @@ static ssize_t libertas_lowsnr_write(struct file *file, ...@@ -721,7 +715,7 @@ static ssize_t libertas_lowsnr_write(struct file *file,
goto out_unlock; goto out_unlock;
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_set; event->action = cpu_to_le16(cmd_act_set);
pcmdptr->size = cpu_to_le16(S_DS_GEN + pcmdptr->size = cpu_to_le16(S_DS_GEN +
sizeof(struct cmd_ds_802_11_subscribe_event) + sizeof(struct cmd_ds_802_11_subscribe_event) +
sizeof(struct mrvlietypes_snrthreshold)); sizeof(struct mrvlietypes_snrthreshold));
...@@ -729,11 +723,11 @@ static ssize_t libertas_lowsnr_write(struct file *file, ...@@ -729,11 +723,11 @@ static ssize_t libertas_lowsnr_write(struct file *file,
ptr = (u8*) pcmdptr+cmd_len; ptr = (u8*) pcmdptr+cmd_len;
snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr);
snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW); snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW);
snr_threshold->header.len = 2; snr_threshold->header.len = cpu_to_le16(2);
snr_threshold->snrvalue = cpu_to_le16(value); snr_threshold->snrvalue = value;
snr_threshold->snrfreq = cpu_to_le16(freq); snr_threshold->snrfreq = freq;
event_bitmap |= subscribed ? 0x0002 : 0x0; event_bitmap |= subscribed ? 0x0002 : 0x0;
event->events = event_bitmap; event->events = cpu_to_le16(event_bitmap);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -745,14 +739,14 @@ static ssize_t libertas_lowsnr_write(struct file *file, ...@@ -745,14 +739,14 @@ static ssize_t libertas_lowsnr_write(struct file *file,
pcmdptr = response_buf; pcmdptr = response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
return 0; return 0;
} }
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
lbs_pr_err("command response incorrect!\n"); lbs_pr_err("command response incorrect!\n");
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
...@@ -787,9 +781,8 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, ...@@ -787,9 +781,8 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf,
} }
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_get; event->action = cpu_to_le16(cmd_act_get);
pcmdptr->size = pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -800,14 +793,14 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, ...@@ -800,14 +793,14 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf,
pcmdptr = response_buf; pcmdptr = response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
return 0; return 0;
} }
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
lbs_pr_err("command response incorrect!\n"); lbs_pr_err("command response incorrect!\n");
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
...@@ -815,17 +808,17 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, ...@@ -815,17 +808,17 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf,
} }
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); event = (void *)(response_buf + S_DS_GEN);
while (cmd_len < pcmdptr->size) { while (cmd_len < le16_to_cpu(pcmdptr->size)) {
struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
switch(header->type) { switch (header->type) {
struct mrvlietypes_failurecount *failcount; struct mrvlietypes_failurecount *failcount;
case TLV_TYPE_FAILCOUNT: case __constant_cpu_to_le16(TLV_TYPE_FAILCOUNT):
failcount = (struct mrvlietypes_failurecount *)(response_buf + cmd_len); failcount = (void *)(response_buf + cmd_len);
pos += snprintf(buf+pos, len-pos, "%d %d %d\n", pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
failcount->failvalue, failcount->failvalue,
failcount->Failfreq, failcount->Failfreq,
(event->events & 0x0004)?1:0); (event->events & cpu_to_le16(0x0004))?1:0);
default: default:
cmd_len += sizeof(struct mrvlietypes_failurecount); cmd_len += sizeof(struct mrvlietypes_failurecount);
break; break;
...@@ -874,7 +867,7 @@ static ssize_t libertas_failcount_write(struct file *file, ...@@ -874,7 +867,7 @@ static ssize_t libertas_failcount_write(struct file *file,
goto out_unlock; goto out_unlock;
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_set; event->action = cpu_to_le16(cmd_act_set);
pcmdptr->size = cpu_to_le16(S_DS_GEN + pcmdptr->size = cpu_to_le16(S_DS_GEN +
sizeof(struct cmd_ds_802_11_subscribe_event) + sizeof(struct cmd_ds_802_11_subscribe_event) +
sizeof(struct mrvlietypes_failurecount)); sizeof(struct mrvlietypes_failurecount));
...@@ -882,11 +875,11 @@ static ssize_t libertas_failcount_write(struct file *file, ...@@ -882,11 +875,11 @@ static ssize_t libertas_failcount_write(struct file *file,
ptr = (u8*) pcmdptr+cmd_len; ptr = (u8*) pcmdptr+cmd_len;
failcount = (struct mrvlietypes_failurecount *)(ptr); failcount = (struct mrvlietypes_failurecount *)(ptr);
failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT); failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT);
failcount->header.len = 2; failcount->header.len = cpu_to_le16(2);
failcount->failvalue = cpu_to_le16(value); failcount->failvalue = value;
failcount->Failfreq = cpu_to_le16(freq); failcount->Failfreq = freq;
event_bitmap |= subscribed ? 0x0004 : 0x0; event_bitmap |= subscribed ? 0x0004 : 0x0;
event->events = event_bitmap; event->events = cpu_to_le16(event_bitmap);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -898,14 +891,14 @@ static ssize_t libertas_failcount_write(struct file *file, ...@@ -898,14 +891,14 @@ static ssize_t libertas_failcount_write(struct file *file,
pcmdptr = (struct cmd_ds_command *)response_buf; pcmdptr = (struct cmd_ds_command *)response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
return 0; return 0;
} }
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
lbs_pr_err("command response incorrect!\n"); lbs_pr_err("command response incorrect!\n");
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
...@@ -939,9 +932,8 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, ...@@ -939,9 +932,8 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf,
} }
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_get; event->action = cpu_to_le16(cmd_act_get);
pcmdptr->size = pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -952,14 +944,14 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, ...@@ -952,14 +944,14 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf,
pcmdptr = response_buf; pcmdptr = response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
free_page(addr); free_page(addr);
kfree(response_buf); kfree(response_buf);
return 0; return 0;
} }
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
lbs_pr_err("command response incorrect!\n"); lbs_pr_err("command response incorrect!\n");
free_page(addr); free_page(addr);
kfree(response_buf); kfree(response_buf);
...@@ -967,16 +959,16 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, ...@@ -967,16 +959,16 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf,
} }
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); event = (void *)(response_buf + S_DS_GEN);
while (cmd_len < pcmdptr->size) { while (cmd_len < le16_to_cpu(pcmdptr->size)) {
struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
switch(header->type) { switch (header->type) {
struct mrvlietypes_beaconsmissed *bcnmiss; struct mrvlietypes_beaconsmissed *bcnmiss;
case TLV_TYPE_BCNMISS: case __constant_cpu_to_le16(TLV_TYPE_BCNMISS):
bcnmiss = (struct mrvlietypes_beaconsmissed *)(response_buf + cmd_len); bcnmiss = (void *)(response_buf + cmd_len);
pos += snprintf(buf+pos, len-pos, "%d N/A %d\n", pos += snprintf(buf+pos, len-pos, "%d N/A %d\n",
bcnmiss->beaconmissed, bcnmiss->beaconmissed,
(event->events & 0x0008)?1:0); (event->events & cpu_to_le16(0x0008))?1:0);
default: default:
cmd_len += sizeof(struct mrvlietypes_beaconsmissed); cmd_len += sizeof(struct mrvlietypes_beaconsmissed);
break; break;
...@@ -1026,7 +1018,7 @@ static ssize_t libertas_bcnmiss_write(struct file *file, ...@@ -1026,7 +1018,7 @@ static ssize_t libertas_bcnmiss_write(struct file *file,
goto out_unlock; goto out_unlock;
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_set; event->action = cpu_to_le16(cmd_act_set);
pcmdptr->size = cpu_to_le16(S_DS_GEN + pcmdptr->size = cpu_to_le16(S_DS_GEN +
sizeof(struct cmd_ds_802_11_subscribe_event) + sizeof(struct cmd_ds_802_11_subscribe_event) +
sizeof(struct mrvlietypes_beaconsmissed)); sizeof(struct mrvlietypes_beaconsmissed));
...@@ -1034,10 +1026,10 @@ static ssize_t libertas_bcnmiss_write(struct file *file, ...@@ -1034,10 +1026,10 @@ static ssize_t libertas_bcnmiss_write(struct file *file,
ptr = (u8*) pcmdptr+cmd_len; ptr = (u8*) pcmdptr+cmd_len;
bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr); bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr);
bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS); bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS);
bcnmiss->header.len = 2; bcnmiss->header.len = cpu_to_le16(2);
bcnmiss->beaconmissed = cpu_to_le16(value); bcnmiss->beaconmissed = value;
event_bitmap |= subscribed ? 0x0008 : 0x0; event_bitmap |= subscribed ? 0x0008 : 0x0;
event->events = event_bitmap; event->events = cpu_to_le16(event_bitmap);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -1049,14 +1041,14 @@ static ssize_t libertas_bcnmiss_write(struct file *file, ...@@ -1049,14 +1041,14 @@ static ssize_t libertas_bcnmiss_write(struct file *file,
pcmdptr = response_buf; pcmdptr = response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
return 0; return 0;
} }
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
lbs_pr_err("command response incorrect!\n"); lbs_pr_err("command response incorrect!\n");
free_page(addr); free_page(addr);
kfree(response_buf); kfree(response_buf);
...@@ -1090,9 +1082,8 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, ...@@ -1090,9 +1082,8 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf,
} }
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_get; event->action = cpu_to_le16(cmd_act_get);
pcmdptr->size = pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -1103,14 +1094,14 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, ...@@ -1103,14 +1094,14 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf,
pcmdptr = response_buf; pcmdptr = response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
return 0; return 0;
} }
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
lbs_pr_err("command response incorrect!\n"); lbs_pr_err("command response incorrect!\n");
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
...@@ -1118,17 +1109,17 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, ...@@ -1118,17 +1109,17 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf,
} }
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); event = (void *)(response_buf + S_DS_GEN);
while (cmd_len < pcmdptr->size) { while (cmd_len < le16_to_cpu(pcmdptr->size)) {
struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
switch(header->type) { switch (header->type) {
struct mrvlietypes_rssithreshold *Highrssi; struct mrvlietypes_rssithreshold *Highrssi;
case TLV_TYPE_RSSI_HIGH: case __constant_cpu_to_le16(TLV_TYPE_RSSI_HIGH):
Highrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len); Highrssi = (void *)(response_buf + cmd_len);
pos += snprintf(buf+pos, len-pos, "%d %d %d\n", pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
Highrssi->rssivalue, Highrssi->rssivalue,
Highrssi->rssifreq, Highrssi->rssifreq,
(event->events & 0x0010)?1:0); (event->events & cpu_to_le16(0x0010))?1:0);
default: default:
cmd_len += sizeof(struct mrvlietypes_snrthreshold); cmd_len += sizeof(struct mrvlietypes_snrthreshold);
break; break;
...@@ -1178,7 +1169,7 @@ static ssize_t libertas_highrssi_write(struct file *file, ...@@ -1178,7 +1169,7 @@ static ssize_t libertas_highrssi_write(struct file *file,
goto out_unlock; goto out_unlock;
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_set; event->action = cpu_to_le16(cmd_act_set);
pcmdptr->size = cpu_to_le16(S_DS_GEN + pcmdptr->size = cpu_to_le16(S_DS_GEN +
sizeof(struct cmd_ds_802_11_subscribe_event) + sizeof(struct cmd_ds_802_11_subscribe_event) +
sizeof(struct mrvlietypes_rssithreshold)); sizeof(struct mrvlietypes_rssithreshold));
...@@ -1186,11 +1177,11 @@ static ssize_t libertas_highrssi_write(struct file *file, ...@@ -1186,11 +1177,11 @@ static ssize_t libertas_highrssi_write(struct file *file,
ptr = (u8*) pcmdptr+cmd_len; ptr = (u8*) pcmdptr+cmd_len;
rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr);
rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH); rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH);
rssi_threshold->header.len = 2; rssi_threshold->header.len = cpu_to_le16(2);
rssi_threshold->rssivalue = cpu_to_le16(value); rssi_threshold->rssivalue = value;
rssi_threshold->rssifreq = cpu_to_le16(freq); rssi_threshold->rssifreq = freq;
event_bitmap |= subscribed ? 0x0010 : 0x0; event_bitmap |= subscribed ? 0x0010 : 0x0;
event->events = event_bitmap; event->events = cpu_to_le16(event_bitmap);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -1202,13 +1193,13 @@ static ssize_t libertas_highrssi_write(struct file *file, ...@@ -1202,13 +1193,13 @@ static ssize_t libertas_highrssi_write(struct file *file,
pcmdptr = response_buf; pcmdptr = response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
kfree(response_buf); kfree(response_buf);
return 0; return 0;
} }
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
lbs_pr_err("command response incorrect!\n"); lbs_pr_err("command response incorrect!\n");
kfree(response_buf); kfree(response_buf);
return 0; return 0;
...@@ -1241,9 +1232,8 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, ...@@ -1241,9 +1232,8 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf,
} }
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_get; event->action = cpu_to_le16(cmd_act_get);
pcmdptr->size = pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -1254,14 +1244,14 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, ...@@ -1254,14 +1244,14 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf,
pcmdptr = response_buf; pcmdptr = response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
return 0; return 0;
} }
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
lbs_pr_err("command response incorrect!\n"); lbs_pr_err("command response incorrect!\n");
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
...@@ -1269,17 +1259,17 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, ...@@ -1269,17 +1259,17 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf,
} }
cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); event = (void *)(response_buf + S_DS_GEN);
while (cmd_len < pcmdptr->size) { while (cmd_len < le16_to_cpu(pcmdptr->size)) {
struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
switch(header->type) { switch (header->type) {
struct mrvlietypes_snrthreshold *HighSnr; struct mrvlietypes_snrthreshold *HighSnr;
case TLV_TYPE_SNR_HIGH: case __constant_cpu_to_le16(TLV_TYPE_SNR_HIGH):
HighSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len); HighSnr = (void *)(response_buf + cmd_len);
pos += snprintf(buf+pos, len-pos, "%d %d %d\n", pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
HighSnr->snrvalue, HighSnr->snrvalue,
HighSnr->snrfreq, HighSnr->snrfreq,
(event->events & 0x0020)?1:0); (event->events & cpu_to_le16(0x0020))?1:0);
default: default:
cmd_len += sizeof(struct mrvlietypes_snrthreshold); cmd_len += sizeof(struct mrvlietypes_snrthreshold);
break; break;
...@@ -1329,7 +1319,7 @@ static ssize_t libertas_highsnr_write(struct file *file, ...@@ -1329,7 +1319,7 @@ static ssize_t libertas_highsnr_write(struct file *file,
goto out_unlock; goto out_unlock;
event = &pcmdptr->params.subscribe_event; event = &pcmdptr->params.subscribe_event;
event->action = cmd_act_set; event->action = cpu_to_le16(cmd_act_set);
pcmdptr->size = cpu_to_le16(S_DS_GEN + pcmdptr->size = cpu_to_le16(S_DS_GEN +
sizeof(struct cmd_ds_802_11_subscribe_event) + sizeof(struct cmd_ds_802_11_subscribe_event) +
sizeof(struct mrvlietypes_snrthreshold)); sizeof(struct mrvlietypes_snrthreshold));
...@@ -1337,11 +1327,11 @@ static ssize_t libertas_highsnr_write(struct file *file, ...@@ -1337,11 +1327,11 @@ static ssize_t libertas_highsnr_write(struct file *file,
ptr = (u8*) pcmdptr+cmd_len; ptr = (u8*) pcmdptr+cmd_len;
snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr);
snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH); snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH);
snr_threshold->header.len = 2; snr_threshold->header.len = cpu_to_le16(2);
snr_threshold->snrvalue = cpu_to_le16(value); snr_threshold->snrvalue = value;
snr_threshold->snrfreq = cpu_to_le16(freq); snr_threshold->snrfreq = freq;
event_bitmap |= subscribed ? 0x0020 : 0x0; event_bitmap |= subscribed ? 0x0020 : 0x0;
event->events = event_bitmap; event->events = cpu_to_le16(event_bitmap);
libertas_queue_cmd(adapter, pcmdnode, 1); libertas_queue_cmd(adapter, pcmdnode, 1);
wake_up_interruptible(&priv->mainthread.waitq); wake_up_interruptible(&priv->mainthread.waitq);
...@@ -1353,14 +1343,14 @@ static ssize_t libertas_highsnr_write(struct file *file, ...@@ -1353,14 +1343,14 @@ static ssize_t libertas_highsnr_write(struct file *file,
pcmdptr = response_buf; pcmdptr = response_buf;
if (pcmdptr->result) { if (pcmdptr->result) {
lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, lbs_pr_err("%s: fail, result=%d\n", __func__,
pcmdptr->result); le16_to_cpu(pcmdptr->result));
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
return 0; return 0;
} }
if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
lbs_pr_err("command response incorrect!\n"); lbs_pr_err("command response incorrect!\n");
kfree(response_buf); kfree(response_buf);
free_page(addr); free_page(addr);
......
...@@ -146,14 +146,14 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev) ...@@ -146,14 +146,14 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev)
goto done; goto done;
} }
priv->mstats.fwd_drop_rbt = mesh_access.data[0]; priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
priv->mstats.fwd_drop_ttl = mesh_access.data[1]; priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);
priv->mstats.fwd_drop_noroute = mesh_access.data[2]; priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]);
priv->mstats.fwd_drop_nobuf = mesh_access.data[3]; priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]);
priv->mstats.fwd_unicast_cnt = mesh_access.data[4]; priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]);
priv->mstats.fwd_bcast_cnt = mesh_access.data[5]; priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]);
priv->mstats.drop_blind = mesh_access.data[6]; priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]);
priv->mstats.tx_failed_cnt = mesh_access.data[7]; priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]);
ret = MESH_STATS_NUM; ret = MESH_STATS_NUM;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
*/ */
static int check_fwfile_format(u8 *data, u32 totlen) static int check_fwfile_format(u8 *data, u32 totlen)
{ {
u8 bincmd, exit; u32 bincmd, exit;
u32 blksize, offset, len; u32 blksize, offset, len;
int ret; int ret;
...@@ -27,8 +27,10 @@ static int check_fwfile_format(u8 *data, u32 totlen) ...@@ -27,8 +27,10 @@ static int check_fwfile_format(u8 *data, u32 totlen)
exit = len = 0; exit = len = 0;
do { do {
bincmd = *data; struct fwheader *fwh = (void *)data;
blksize = *(u32*)(data + offsetof(struct fwheader, datalength));
bincmd = le32_to_cpu(fwh->dnldcmd);
blksize = le32_to_cpu(fwh->datalength);
switch (bincmd) { switch (bincmd) {
case FW_HAS_DATA_TO_RECV: case FW_HAS_DATA_TO_RECV:
offset = sizeof(struct fwheader) + blksize; offset = sizeof(struct fwheader) + blksize;
...@@ -72,13 +74,12 @@ static int wlan_setup_station_hw(wlan_private * priv, char *fw_name) ...@@ -72,13 +74,12 @@ static int wlan_setup_station_hw(wlan_private * priv, char *fw_name)
if ((ret = request_firmware(&priv->firmware, fw_name, if ((ret = request_firmware(&priv->firmware, fw_name,
priv->hotplug_device)) < 0) { priv->hotplug_device)) < 0) {
lbs_pr_err("request_firmware() failed with %#x\n", lbs_pr_err("request_firmware() failed with %#x\n", ret);
ret);
lbs_pr_err("firmware %s not found\n", fw_name); lbs_pr_err("firmware %s not found\n", fw_name);
goto done; goto done;
} }
if(check_fwfile_format(priv->firmware->data, priv->firmware->size)) { if (check_fwfile_format(priv->firmware->data, priv->firmware->size)) {
release_firmware(priv->firmware); release_firmware(priv->firmware);
goto done; goto done;
} }
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
/* TxPD descriptor */ /* TxPD descriptor */
struct txpd { struct txpd {
/* Current Tx packet status */ /* Current Tx packet status */
u32 tx_status; __le32 tx_status;
/* Tx control */ /* Tx control */
u32 tx_control; __le32 tx_control;
u32 tx_packet_location; __le32 tx_packet_location;
/* Tx packet length */ /* Tx packet length */
u16 tx_packet_length; __le16 tx_packet_length;
/* First 2 byte of destination MAC address */ /* First 2 byte of destination MAC address */
u8 tx_dest_addr_high[2]; u8 tx_dest_addr_high[2];
/* Last 4 byte of destination MAC address */ /* Last 4 byte of destination MAC address */
...@@ -37,7 +37,7 @@ struct txpd { ...@@ -37,7 +37,7 @@ struct txpd {
/* RxPD Descriptor */ /* RxPD Descriptor */
struct rxpd { struct rxpd {
/* Current Rx packet status */ /* Current Rx packet status */
u16 status; __le16 status;
/* SNR */ /* SNR */
u8 snr; u8 snr;
...@@ -46,7 +46,7 @@ struct rxpd { ...@@ -46,7 +46,7 @@ struct rxpd {
u8 rx_control; u8 rx_control;
/* Pkt length */ /* Pkt length */
u16 pkt_len; __le16 pkt_len;
/* Noise Floor */ /* Noise Floor */
u8 nf; u8 nf;
...@@ -55,10 +55,10 @@ struct rxpd { ...@@ -55,10 +55,10 @@ struct rxpd {
u8 rx_rate; u8 rx_rate;
/* Pkt addr */ /* Pkt addr */
u32 pkt_ptr; __le32 pkt_ptr;
/* Next Rx RxPD addr */ /* Next Rx RxPD addr */
u32 next_rxpd_ptr; __le32 next_rxpd_ptr;
/* Pkt Priority */ /* Pkt Priority */
u8 priority; u8 priority;
...@@ -89,22 +89,22 @@ struct cmd_ctrl_node { ...@@ -89,22 +89,22 @@ struct cmd_ctrl_node {
* is determined from the keylength field. * is determined from the keylength field.
*/ */
struct WLAN_802_11_KEY { struct WLAN_802_11_KEY {
u32 len; __le32 len;
u32 flags; /* KEY_INFO_* from wlan_defs.h */ __le32 flags; /* KEY_INFO_* from wlan_defs.h */
u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH]; u8 key[MRVL_MAX_KEY_WPA_KEY_LENGTH];
u16 type; /* KEY_TYPE_* from wlan_defs.h */ __le16 type; /* KEY_TYPE_* from wlan_defs.h */
}; };
struct IE_WPA { struct IE_WPA {
u8 elementid; u8 elementid;
u8 len; u8 len;
u8 oui[4]; u8 oui[4];
u16 version; __le16 version;
}; };
struct WLAN_802_11_SSID { struct WLAN_802_11_SSID {
/* SSID length */ /* SSID length */
u32 ssidlength; __le32 ssidlength;
/* SSID information field */ /* SSID information field */
u8 ssid[IW_ESSID_MAX_SIZE]; u8 ssid[IW_ESSID_MAX_SIZE];
...@@ -122,9 +122,9 @@ struct wlan_offset_value { ...@@ -122,9 +122,9 @@ struct wlan_offset_value {
}; };
struct WLAN_802_11_FIXED_IEs { struct WLAN_802_11_FIXED_IEs {
u8 timestamp[8]; __le64 timestamp;
u16 beaconinterval; __le16 beaconinterval;
u16 capabilities; u16 capabilities; /* Actually struct ieeetypes_capinfo */
}; };
struct WLAN_802_11_VARIABLE_IEs { struct WLAN_802_11_VARIABLE_IEs {
...@@ -136,10 +136,10 @@ struct WLAN_802_11_VARIABLE_IEs { ...@@ -136,10 +136,10 @@ struct WLAN_802_11_VARIABLE_IEs {
/* Define general data structure */ /* Define general data structure */
/* cmd_DS_GEN */ /* cmd_DS_GEN */
struct cmd_ds_gen { struct cmd_ds_gen {
u16 command; __le16 command;
u16 size; __le16 size;
u16 seqnum; __le16 seqnum;
u16 result; __le16 result;
}; };
#define S_DS_GEN sizeof(struct cmd_ds_gen) #define S_DS_GEN sizeof(struct cmd_ds_gen)
...@@ -149,44 +149,44 @@ struct cmd_ds_gen { ...@@ -149,44 +149,44 @@ struct cmd_ds_gen {
*/ */
struct cmd_ds_get_hw_spec { struct cmd_ds_get_hw_spec {
/* HW Interface version number */ /* HW Interface version number */
u16 hwifversion; __le16 hwifversion;
/* HW version number */ /* HW version number */
u16 version; __le16 version;
/* Max number of TxPD FW can handle */ /* Max number of TxPD FW can handle */
u16 nr_txpd; __le16 nr_txpd;
/* Max no of Multicast address */ /* Max no of Multicast address */
u16 nr_mcast_adr; __le16 nr_mcast_adr;
/* MAC address */ /* MAC address */
u8 permanentaddr[6]; u8 permanentaddr[6];
/* region Code */ /* region Code */
u16 regioncode; __le16 regioncode;
/* Number of antenna used */ /* Number of antenna used */
u16 nr_antenna; __le16 nr_antenna;
/* FW release number, example 0x1234=1.2.3.4 */ /* FW release number, example 0x1234=1.2.3.4 */
u32 fwreleasenumber; __le32 fwreleasenumber;
/* Base Address of TxPD queue */ /* Base Address of TxPD queue */
u32 wcb_base; __le32 wcb_base;
/* Read Pointer of RxPd queue */ /* Read Pointer of RxPd queue */
u32 rxpd_rdptr; __le32 rxpd_rdptr;
/* Write Pointer of RxPd queue */ /* Write Pointer of RxPd queue */
u32 rxpd_wrptr; __le32 rxpd_wrptr;
/*FW/HW capability */ /*FW/HW capability */
u32 fwcapinfo; __le32 fwcapinfo;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_802_11_reset { struct cmd_ds_802_11_reset {
u16 action; __le16 action;
}; };
struct cmd_ds_802_11_subscribe_event { struct cmd_ds_802_11_subscribe_event {
u16 action; __le16 action;
u16 events; __le16 events;
}; };
/* /*
...@@ -205,35 +205,35 @@ struct cmd_ds_802_11_scan { ...@@ -205,35 +205,35 @@ struct cmd_ds_802_11_scan {
}; };
struct cmd_ds_802_11_scan_rsp { struct cmd_ds_802_11_scan_rsp {
u16 bssdescriptsize; __le16 bssdescriptsize;
u8 nr_sets; u8 nr_sets;
u8 bssdesc_and_tlvbuffer[1]; u8 bssdesc_and_tlvbuffer[1];
}; };
struct cmd_ds_802_11_get_log { struct cmd_ds_802_11_get_log {
u32 mcasttxframe; __le32 mcasttxframe;
u32 failed; __le32 failed;
u32 retry; __le32 retry;
u32 multiretry; __le32 multiretry;
u32 framedup; __le32 framedup;
u32 rtssuccess; __le32 rtssuccess;
u32 rtsfailure; __le32 rtsfailure;
u32 ackfailure; __le32 ackfailure;
u32 rxfrag; __le32 rxfrag;
u32 mcastrxframe; __le32 mcastrxframe;
u32 fcserror; __le32 fcserror;
u32 txframe; __le32 txframe;
u32 wepundecryptable; __le32 wepundecryptable;
}; };
struct cmd_ds_mac_control { struct cmd_ds_mac_control {
u16 action; __le16 action;
u16 reserved; __le16 reserved;
}; };
struct cmd_ds_mac_multicast_adr { struct cmd_ds_mac_multicast_adr {
u16 action; __le16 action;
u16 nr_of_adrs; __le16 nr_of_adrs;
u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE]; u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
}; };
...@@ -245,14 +245,14 @@ struct cmd_ds_802_11_authenticate { ...@@ -245,14 +245,14 @@ struct cmd_ds_802_11_authenticate {
struct cmd_ds_802_11_deauthenticate { struct cmd_ds_802_11_deauthenticate {
u8 macaddr[6]; u8 macaddr[6];
u16 reasoncode; __le16 reasoncode;
}; };
struct cmd_ds_802_11_associate { struct cmd_ds_802_11_associate {
u8 peerstaaddr[6]; u8 peerstaaddr[6];
struct ieeetypes_capinfo capinfo; struct ieeetypes_capinfo capinfo;
u16 listeninterval; __le16 listeninterval;
u16 bcnperiod; __le16 bcnperiod;
u8 dtimperiod; u8 dtimperiod;
#if 0 #if 0
...@@ -265,7 +265,7 @@ struct cmd_ds_802_11_associate { ...@@ -265,7 +265,7 @@ struct cmd_ds_802_11_associate {
struct cmd_ds_802_11_disassociate { struct cmd_ds_802_11_disassociate {
u8 destmacaddr[6]; u8 destmacaddr[6];
u16 reasoncode; __le16 reasoncode;
}; };
struct cmd_ds_802_11_associate_rsp { struct cmd_ds_802_11_associate_rsp {
...@@ -279,10 +279,10 @@ struct cmd_ds_802_11_ad_hoc_result { ...@@ -279,10 +279,10 @@ struct cmd_ds_802_11_ad_hoc_result {
struct cmd_ds_802_11_set_wep { struct cmd_ds_802_11_set_wep {
/* ACT_ADD, ACT_REMOVE or ACT_ENABLE */ /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
u16 action; __le16 action;
/* key Index selected for Tx */ /* key Index selected for Tx */
u16 keyindex; __le16 keyindex;
/* 40, 128bit or TXWEP */ /* 40, 128bit or TXWEP */
u8 keytype[4]; u8 keytype[4];
...@@ -290,96 +290,96 @@ struct cmd_ds_802_11_set_wep { ...@@ -290,96 +290,96 @@ struct cmd_ds_802_11_set_wep {
}; };
struct cmd_ds_802_3_get_stat { struct cmd_ds_802_3_get_stat {
u32 xmitok; __le32 xmitok;
u32 rcvok; __le32 rcvok;
u32 xmiterror; __le32 xmiterror;
u32 rcverror; __le32 rcverror;
u32 rcvnobuffer; __le32 rcvnobuffer;
u32 rcvcrcerror; __le32 rcvcrcerror;
}; };
struct cmd_ds_802_11_get_stat { struct cmd_ds_802_11_get_stat {
u32 txfragmentcnt; __le32 txfragmentcnt;
u32 mcasttxframecnt; __le32 mcasttxframecnt;
u32 failedcnt; __le32 failedcnt;
u32 retrycnt; __le32 retrycnt;
u32 Multipleretrycnt; __le32 Multipleretrycnt;
u32 rtssuccesscnt; __le32 rtssuccesscnt;
u32 rtsfailurecnt; __le32 rtsfailurecnt;
u32 ackfailurecnt; __le32 ackfailurecnt;
u32 frameduplicatecnt; __le32 frameduplicatecnt;
u32 rxfragmentcnt; __le32 rxfragmentcnt;
u32 mcastrxframecnt; __le32 mcastrxframecnt;
u32 fcserrorcnt; __le32 fcserrorcnt;
u32 bcasttxframecnt; __le32 bcasttxframecnt;
u32 bcastrxframecnt; __le32 bcastrxframecnt;
u32 txbeacon; __le32 txbeacon;
u32 rxbeacon; __le32 rxbeacon;
u32 wepundecryptable; __le32 wepundecryptable;
}; };
struct cmd_ds_802_11_snmp_mib { struct cmd_ds_802_11_snmp_mib {
u16 querytype; __le16 querytype;
u16 oid; __le16 oid;
u16 bufsize; __le16 bufsize;
u8 value[128]; u8 value[128];
}; };
struct cmd_ds_mac_reg_map { struct cmd_ds_mac_reg_map {
u16 buffersize; __le16 buffersize;
u8 regmap[128]; u8 regmap[128];
u16 reserved; __le16 reserved;
}; };
struct cmd_ds_bbp_reg_map { struct cmd_ds_bbp_reg_map {
u16 buffersize; __le16 buffersize;
u8 regmap[128]; u8 regmap[128];
u16 reserved; __le16 reserved;
}; };
struct cmd_ds_rf_reg_map { struct cmd_ds_rf_reg_map {
u16 buffersize; __le16 buffersize;
u8 regmap[64]; u8 regmap[64];
u16 reserved; __le16 reserved;
}; };
struct cmd_ds_mac_reg_access { struct cmd_ds_mac_reg_access {
u16 action; __le16 action;
u16 offset; __le16 offset;
u32 value; __le32 value;
}; };
struct cmd_ds_bbp_reg_access { struct cmd_ds_bbp_reg_access {
u16 action; __le16 action;
u16 offset; __le16 offset;
u8 value; u8 value;
u8 reserved[3]; u8 reserved[3];
}; };
struct cmd_ds_rf_reg_access { struct cmd_ds_rf_reg_access {
u16 action; __le16 action;
u16 offset; __le16 offset;
u8 value; u8 value;
u8 reserved[3]; u8 reserved[3];
}; };
struct cmd_ds_802_11_radio_control { struct cmd_ds_802_11_radio_control {
u16 action; __le16 action;
u16 control; __le16 control;
}; };
struct cmd_ds_802_11_sleep_params { struct cmd_ds_802_11_sleep_params {
/* ACT_GET/ACT_SET */ /* ACT_GET/ACT_SET */
u16 action; __le16 action;
/* Sleep clock error in ppm */ /* Sleep clock error in ppm */
u16 error; __le16 error;
/* Wakeup offset in usec */ /* Wakeup offset in usec */
u16 offset; __le16 offset;
/* Clock stabilization time in usec */ /* Clock stabilization time in usec */
u16 stabletime; __le16 stabletime;
/* control periodic calibration */ /* control periodic calibration */
u8 calcontrol; u8 calcontrol;
...@@ -388,100 +388,100 @@ struct cmd_ds_802_11_sleep_params { ...@@ -388,100 +388,100 @@ struct cmd_ds_802_11_sleep_params {
u8 externalsleepclk; u8 externalsleepclk;
/* reserved field, should be set to zero */ /* reserved field, should be set to zero */
u16 reserved; __le16 reserved;
}; };
struct cmd_ds_802_11_inactivity_timeout { struct cmd_ds_802_11_inactivity_timeout {
/* ACT_GET/ACT_SET */ /* ACT_GET/ACT_SET */
u16 action; __le16 action;
/* Inactivity timeout in msec */ /* Inactivity timeout in msec */
u16 timeout; __le16 timeout;
}; };
struct cmd_ds_802_11_rf_channel { struct cmd_ds_802_11_rf_channel {
u16 action; __le16 action;
u16 currentchannel; __le16 currentchannel;
u16 rftype; __le16 rftype;
u16 reserved; __le16 reserved;
u8 channellist[32]; u8 channellist[32];
}; };
struct cmd_ds_802_11_rssi { struct cmd_ds_802_11_rssi {
/* weighting factor */ /* weighting factor */
u16 N; __le16 N;
u16 reserved_0; __le16 reserved_0;
u16 reserved_1; __le16 reserved_1;
u16 reserved_2; __le16 reserved_2;
}; };
struct cmd_ds_802_11_rssi_rsp { struct cmd_ds_802_11_rssi_rsp {
u16 SNR; __le16 SNR;
u16 noisefloor; __le16 noisefloor;
u16 avgSNR; __le16 avgSNR;
u16 avgnoisefloor; __le16 avgnoisefloor;
}; };
struct cmd_ds_802_11_mac_address { struct cmd_ds_802_11_mac_address {
u16 action; __le16 action;
u8 macadd[ETH_ALEN]; u8 macadd[ETH_ALEN];
}; };
struct cmd_ds_802_11_rf_tx_power { struct cmd_ds_802_11_rf_tx_power {
u16 action; __le16 action;
u16 currentlevel; __le16 currentlevel;
}; };
struct cmd_ds_802_11_rf_antenna { struct cmd_ds_802_11_rf_antenna {
u16 action; __le16 action;
/* Number of antennas or 0xffff(diversity) */ /* Number of antennas or 0xffff(diversity) */
u16 antennamode; __le16 antennamode;
}; };
struct cmd_ds_802_11_ps_mode { struct cmd_ds_802_11_ps_mode {
u16 action; __le16 action;
u16 nullpktinterval; __le16 nullpktinterval;
u16 multipledtim; __le16 multipledtim;
u16 reserved; __le16 reserved;
u16 locallisteninterval; __le16 locallisteninterval;
}; };
struct PS_CMD_ConfirmSleep { struct PS_CMD_ConfirmSleep {
u16 command; __le16 command;
u16 size; __le16 size;
u16 seqnum; __le16 seqnum;
u16 result; __le16 result;
u16 action; __le16 action;
u16 reserved1; __le16 reserved1;
u16 multipledtim; __le16 multipledtim;
u16 reserved; __le16 reserved;
u16 locallisteninterval; __le16 locallisteninterval;
}; };
struct cmd_ds_802_11_data_rate { struct cmd_ds_802_11_data_rate {
u16 action; __le16 action;
u16 reserverd; __le16 reserverd;
u8 datarate[G_SUPPORTED_RATES]; u8 datarate[G_SUPPORTED_RATES];
}; };
struct cmd_ds_802_11_rate_adapt_rateset { struct cmd_ds_802_11_rate_adapt_rateset {
u16 action; __le16 action;
u16 enablehwauto; __le16 enablehwauto;
u16 bitmap; __le16 bitmap;
}; };
struct cmd_ds_802_11_ad_hoc_start { struct cmd_ds_802_11_ad_hoc_start {
u8 SSID[IW_ESSID_MAX_SIZE]; u8 SSID[IW_ESSID_MAX_SIZE];
u8 bsstype; u8 bsstype;
u16 beaconperiod; __le16 beaconperiod;
u8 dtimperiod; u8 dtimperiod;
union IEEEtypes_ssparamset ssparamset; union IEEEtypes_ssparamset ssparamset;
union ieeetypes_phyparamset phyparamset; union ieeetypes_phyparamset phyparamset;
u16 probedelay; __le16 probedelay;
struct ieeetypes_capinfo cap; struct ieeetypes_capinfo cap;
u8 datarate[G_SUPPORTED_RATES]; u8 datarate[G_SUPPORTED_RATES];
u8 tlv_memory_size_pad[100]; u8 tlv_memory_size_pad[100];
...@@ -491,10 +491,10 @@ struct adhoc_bssdesc { ...@@ -491,10 +491,10 @@ struct adhoc_bssdesc {
u8 BSSID[6]; u8 BSSID[6];
u8 SSID[32]; u8 SSID[32];
u8 bsstype; u8 bsstype;
u16 beaconperiod; __le16 beaconperiod;
u8 dtimperiod; u8 dtimperiod;
u8 timestamp[8]; __le64 timestamp;
u8 localtime[8]; __le64 localtime;
union ieeetypes_phyparamset phyparamset; union ieeetypes_phyparamset phyparamset;
union IEEEtypes_ssparamset ssparamset; union IEEEtypes_ssparamset ssparamset;
struct ieeetypes_capinfo cap; struct ieeetypes_capinfo cap;
...@@ -508,52 +508,52 @@ struct adhoc_bssdesc { ...@@ -508,52 +508,52 @@ struct adhoc_bssdesc {
struct cmd_ds_802_11_ad_hoc_join { struct cmd_ds_802_11_ad_hoc_join {
struct adhoc_bssdesc bssdescriptor; struct adhoc_bssdesc bssdescriptor;
u16 failtimeout; __le16 failtimeout;
u16 probedelay; __le16 probedelay;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_802_11_enable_rsn { struct cmd_ds_802_11_enable_rsn {
u16 action; __le16 action;
u16 enable; __le16 enable;
}; };
struct MrvlIEtype_keyParamSet { struct MrvlIEtype_keyParamSet {
/* type ID */ /* type ID */
u16 type; __le16 type;
/* length of Payload */ /* length of Payload */
u16 length; __le16 length;
/* type of key: WEP=0, TKIP=1, AES=2 */ /* type of key: WEP=0, TKIP=1, AES=2 */
u16 keytypeid; __le16 keytypeid;
/* key control Info specific to a keytypeid */ /* key control Info specific to a keytypeid */
u16 keyinfo; __le16 keyinfo;
/* length of key */ /* length of key */
u16 keylen; __le16 keylen;
/* key material of size keylen */ /* key material of size keylen */
u8 key[32]; u8 key[32];
}; };
struct cmd_ds_802_11_key_material { struct cmd_ds_802_11_key_material {
u16 action; __le16 action;
struct MrvlIEtype_keyParamSet keyParamSet[2]; struct MrvlIEtype_keyParamSet keyParamSet[2];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_802_11_eeprom_access { struct cmd_ds_802_11_eeprom_access {
u16 action; __le16 action;
/* multiple 4 */ /* multiple 4 */
u16 offset; __le16 offset;
u16 bytecount; __le16 bytecount;
u8 value; u8 value;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_802_11_tpc_cfg { struct cmd_ds_802_11_tpc_cfg {
u16 action; __le16 action;
u8 enable; u8 enable;
s8 P0; s8 P0;
s8 P1; s8 P1;
...@@ -562,13 +562,13 @@ struct cmd_ds_802_11_tpc_cfg { ...@@ -562,13 +562,13 @@ struct cmd_ds_802_11_tpc_cfg {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_802_11_led_ctrl { struct cmd_ds_802_11_led_ctrl {
u16 action; __le16 action;
u16 numled; __le16 numled;
u8 data[256]; u8 data[256];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_802_11_pwr_cfg { struct cmd_ds_802_11_pwr_cfg {
u16 action; __le16 action;
u8 enable; u8 enable;
s8 PA_P0; s8 PA_P0;
s8 PA_P1; s8 PA_P1;
...@@ -576,21 +576,21 @@ struct cmd_ds_802_11_pwr_cfg { ...@@ -576,21 +576,21 @@ struct cmd_ds_802_11_pwr_cfg {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_802_11_afc { struct cmd_ds_802_11_afc {
u16 afc_auto; __le16 afc_auto;
union { union {
struct { struct {
u16 threshold; __le16 threshold;
u16 period; __le16 period;
}; };
struct { struct {
s16 timing_offset; __le16 timing_offset; /* signed */
s16 carrier_offset; __le16 carrier_offset; /* signed */
}; };
}; };
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_tx_rate_query { struct cmd_tx_rate_query {
u16 txrate; __le16 txrate;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_get_tsf { struct cmd_ds_get_tsf {
...@@ -598,35 +598,35 @@ struct cmd_ds_get_tsf { ...@@ -598,35 +598,35 @@ struct cmd_ds_get_tsf {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_bt_access { struct cmd_ds_bt_access {
u16 action; __le16 action;
u32 id; __le32 id;
u8 addr1[ETH_ALEN]; u8 addr1[ETH_ALEN];
u8 addr2[ETH_ALEN]; u8 addr2[ETH_ALEN];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_fwt_access { struct cmd_ds_fwt_access {
u16 action; __le16 action;
u32 id; __le32 id;
u8 valid; u8 valid;
u8 da[ETH_ALEN]; u8 da[ETH_ALEN];
u8 dir; u8 dir;
u8 ra[ETH_ALEN]; u8 ra[ETH_ALEN];
u32 ssn; __le32 ssn;
u32 dsn; __le32 dsn;
u32 metric; __le32 metric;
u8 rate; u8 rate;
u8 hopcount; u8 hopcount;
u8 ttl; u8 ttl;
u32 expiration; __le32 expiration;
u8 sleepmode; u8 sleepmode;
u32 snr; __le32 snr;
u32 references; __le32 references;
u8 prec[ETH_ALEN]; u8 prec[ETH_ALEN];
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_mesh_access { struct cmd_ds_mesh_access {
u16 action; __le16 action;
u32 data[32]; /* last position reserved */ __le32 data[32]; /* last position reserved */
} __attribute__ ((packed)); } __attribute__ ((packed));
/* Number of stats counters returned by the firmware */ /* Number of stats counters returned by the firmware */
...@@ -634,10 +634,10 @@ struct cmd_ds_mesh_access { ...@@ -634,10 +634,10 @@ struct cmd_ds_mesh_access {
struct cmd_ds_command { struct cmd_ds_command {
/* command header */ /* command header */
u16 command; __le16 command;
u16 size; __le16 size;
u16 seqnum; __le16 seqnum;
u16 result; __le16 result;
/* command Body */ /* command Body */
union { union {
......
...@@ -27,7 +27,7 @@ int if_usb_issue_boot_command(wlan_private *priv, int ivalue) ...@@ -27,7 +27,7 @@ int if_usb_issue_boot_command(wlan_private *priv, int ivalue)
int i; int i;
/* Prepare command */ /* Prepare command */
sbootcmd.u32magicnumber = BOOT_CMD_MAGIC_NUMBER; sbootcmd.u32magicnumber = cpu_to_le32(BOOT_CMD_MAGIC_NUMBER);
sbootcmd.u8cmd_tag = ivalue; sbootcmd.u8cmd_tag = ivalue;
for (i=0; i<11; i++) for (i=0; i<11; i++)
sbootcmd.au8dumy[i]=0x00; sbootcmd.au8dumy[i]=0x00;
......
...@@ -141,7 +141,7 @@ static int if_usb_probe(struct usb_interface *intf, ...@@ -141,7 +141,7 @@ static int if_usb_probe(struct usb_interface *intf,
lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X" lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
" bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n",
udev->descriptor.bcdUSB, le16_to_cpu(udev->descriptor.bcdUSB),
udev->descriptor.bDeviceClass, udev->descriptor.bDeviceClass,
udev->descriptor.bDeviceSubClass, udev->descriptor.bDeviceSubClass,
udev->descriptor.bDeviceProtocol); udev->descriptor.bDeviceProtocol);
...@@ -153,10 +153,8 @@ static int if_usb_probe(struct usb_interface *intf, ...@@ -153,10 +153,8 @@ static int if_usb_probe(struct usb_interface *intf,
USB_ENDPOINT_XFER_BULK)) { USB_ENDPOINT_XFER_BULK)) {
/* we found a bulk in endpoint */ /* we found a bulk in endpoint */
lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n", lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n",
endpoint->wMaxPacketSize); le16_to_cpu(endpoint->wMaxPacketSize));
if (! if (!(cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
(cardp->rx_urb =
usb_alloc_urb(0, GFP_KERNEL))) {
lbs_deb_usbd(&udev->dev, lbs_deb_usbd(&udev->dev,
"Rx URB allocation failed\n"); "Rx URB allocation failed\n");
goto dealloc; goto dealloc;
...@@ -164,7 +162,7 @@ static int if_usb_probe(struct usb_interface *intf, ...@@ -164,7 +162,7 @@ static int if_usb_probe(struct usb_interface *intf,
cardp->rx_urb_recall = 0; cardp->rx_urb_recall = 0;
cardp->bulk_in_size = cardp->bulk_in_size =
endpoint->wMaxPacketSize; le16_to_cpu(endpoint->wMaxPacketSize);
cardp->bulk_in_endpointAddr = cardp->bulk_in_endpointAddr =
(endpoint-> (endpoint->
bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
...@@ -178,19 +176,17 @@ static int if_usb_probe(struct usb_interface *intf, ...@@ -178,19 +176,17 @@ static int if_usb_probe(struct usb_interface *intf,
&& ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK)) { USB_ENDPOINT_XFER_BULK)) {
/* We found bulk out endpoint */ /* We found bulk out endpoint */
if (! if (!(cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
(cardp->tx_urb =
usb_alloc_urb(0, GFP_KERNEL))) {
lbs_deb_usbd(&udev->dev, lbs_deb_usbd(&udev->dev,
"Tx URB allocation failed\n"); "Tx URB allocation failed\n");
goto dealloc; goto dealloc;
} }
cardp->bulk_out_size = cardp->bulk_out_size =
endpoint->wMaxPacketSize; le16_to_cpu(endpoint->wMaxPacketSize);
lbs_deb_usbd(&udev->dev, lbs_deb_usbd(&udev->dev,
"Bulk out size is %d\n", "Bulk out size is %d\n",
endpoint->wMaxPacketSize); le16_to_cpu(endpoint->wMaxPacketSize));
cardp->bulk_out_endpointAddr = cardp->bulk_out_endpointAddr =
endpoint->bEndpointAddress; endpoint->bEndpointAddress;
lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n", lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n",
...@@ -313,7 +309,7 @@ static int if_prog_firmware(wlan_private * priv) ...@@ -313,7 +309,7 @@ static int if_prog_firmware(wlan_private * priv)
/* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */ /* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */
memcpy(fwdata->data, &firmware[cardp->totalbytes], memcpy(fwdata->data, &firmware[cardp->totalbytes],
fwdata->fwheader.datalength); le32_to_cpu(fwdata->fwheader.datalength));
/* /*
lbs_deb_usbd(&cardp->udev->dev, lbs_deb_usbd(&cardp->udev->dev,
...@@ -322,13 +318,13 @@ static int if_prog_firmware(wlan_private * priv) ...@@ -322,13 +318,13 @@ static int if_prog_firmware(wlan_private * priv)
cardp->fwseqnum = cardp->fwseqnum + 1; cardp->fwseqnum = cardp->fwseqnum + 1;
fwdata->seqnum = cardp->fwseqnum; fwdata->seqnum = cpu_to_le32(cardp->fwseqnum);
cardp->lastseqnum = fwdata->seqnum; cardp->lastseqnum = cardp->fwseqnum;
cardp->totalbytes += fwdata->fwheader.datalength; cardp->totalbytes += le32_to_cpu(fwdata->fwheader.datalength);
if (fwheader->dnldcmd == FW_HAS_DATA_TO_RECV) { if (fwheader->dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) {
/* /*
lbs_deb_usbd(&cardp->udev->dev, "There is data to follow\n"); lbs_deb_usbd(&cardp->udev->dev, "There are data to follow\n");
lbs_deb_usbd(&cardp->udev->dev, lbs_deb_usbd(&cardp->udev->dev,
"seqnum = %d totalbytes = %d\n", cardp->fwseqnum, "seqnum = %d totalbytes = %d\n", cardp->fwseqnum,
cardp->totalbytes); cardp->totalbytes);
...@@ -486,7 +482,7 @@ static void if_usb_receive_fwload(struct urb *urb) ...@@ -486,7 +482,7 @@ static void if_usb_receive_fwload(struct urb *urb)
if (cardp->bootcmdresp == 0) { if (cardp->bootcmdresp == 0) {
memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET, memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET,
sizeof(bootcmdresp)); sizeof(bootcmdresp));
if (cardp->udev->descriptor.bcdDevice < 0x3106) { if (le16_to_cpu(cardp->udev->descriptor.bcdDevice) < 0x3106) {
kfree_skb(skb); kfree_skb(skb);
if_usb_submit_rx_urb_fwload(priv); if_usb_submit_rx_urb_fwload(priv);
cardp->bootcmdresp = 1; cardp->bootcmdresp = 1;
...@@ -494,10 +490,10 @@ static void if_usb_receive_fwload(struct urb *urb) ...@@ -494,10 +490,10 @@ static void if_usb_receive_fwload(struct urb *urb)
"Received valid boot command response\n"); "Received valid boot command response\n");
return; return;
} }
if (bootcmdresp.u32magicnumber != BOOT_CMD_MAGIC_NUMBER) { if (bootcmdresp.u32magicnumber != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) {
lbs_pr_info( lbs_pr_info(
"boot cmd response wrong magic number (0x%x)\n", "boot cmd response wrong magic number (0x%x)\n",
bootcmdresp.u32magicnumber); le32_to_cpu(bootcmdresp.u32magicnumber));
} else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) { } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) {
lbs_pr_info( lbs_pr_info(
"boot cmd response cmd_tag error (%d)\n", "boot cmd response cmd_tag error (%d)\n",
...@@ -672,7 +668,7 @@ static void if_usb_receive(struct urb *urb) ...@@ -672,7 +668,7 @@ static void if_usb_receive(struct urb *urb)
case CMD_TYPE_INDICATION: case CMD_TYPE_INDICATION:
/* Event cause handling */ /* Event cause handling */
spin_lock(&priv->adapter->driver_lock); spin_lock(&priv->adapter->driver_lock);
cardp->usb_event_cause = *(u32 *) (recvbuff + MESSAGE_HEADER_LEN); cardp->usb_event_cause = le32_to_cpu(*(__le32 *) (recvbuff + MESSAGE_HEADER_LEN));
lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n", lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n",
cardp->usb_event_cause); cardp->usb_event_cause);
if (cardp->usb_event_cause & 0xffff0000) { if (cardp->usb_event_cause & 0xffff0000) {
...@@ -680,7 +676,7 @@ static void if_usb_receive(struct urb *urb) ...@@ -680,7 +676,7 @@ static void if_usb_receive(struct urb *urb)
spin_unlock(&priv->adapter->driver_lock); spin_unlock(&priv->adapter->driver_lock);
break; break;
} }
cardp->usb_event_cause = le32_to_cpu(cardp->usb_event_cause) << 3; cardp->usb_event_cause <<= 3;
cardp->usb_int_cause |= his_cardevent; cardp->usb_int_cause |= his_cardevent;
kfree_skb(skb); kfree_skb(skb);
libertas_interrupt(priv->dev); libertas_interrupt(priv->dev);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
struct bootcmdstr struct bootcmdstr
{ {
u32 u32magicnumber; __le32 u32magicnumber;
u8 u8cmd_tag; u8 u8cmd_tag;
u8 au8dumy[11]; u8 au8dumy[11];
}; };
...@@ -30,7 +30,7 @@ struct bootcmdstr ...@@ -30,7 +30,7 @@ struct bootcmdstr
struct bootcmdrespStr struct bootcmdrespStr
{ {
u32 u32magicnumber; __le32 u32magicnumber;
u8 u8cmd_tag; u8 u8cmd_tag;
u8 u8result; u8 u8result;
u8 au8dumy[2]; u8 au8dumy[2];
...@@ -76,24 +76,24 @@ struct usb_card_rec { ...@@ -76,24 +76,24 @@ struct usb_card_rec {
/** fwheader */ /** fwheader */
struct fwheader { struct fwheader {
u32 dnldcmd; __le32 dnldcmd;
u32 baseaddr; __le32 baseaddr;
u32 datalength; __le32 datalength;
u32 CRC; __le32 CRC;
}; };
#define FW_MAX_DATA_BLK_SIZE 600 #define FW_MAX_DATA_BLK_SIZE 600
/** FWData */ /** FWData */
struct FWData { struct FWData {
struct fwheader fwheader; struct fwheader fwheader;
u32 seqnum; __le32 seqnum;
u8 data[FW_MAX_DATA_BLK_SIZE]; u8 data[FW_MAX_DATA_BLK_SIZE];
}; };
/** fwsyncheader */ /** fwsyncheader */
struct fwsyncheader { struct fwsyncheader {
u32 cmd; __le32 cmd;
u32 seqnum; __le32 seqnum;
}; };
#define FW_HAS_DATA_TO_RECV 0x00000001 #define FW_HAS_DATA_TO_RECV 0x00000001
......
...@@ -216,7 +216,7 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req) ...@@ -216,7 +216,7 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
struct iwreq *wrq = (struct iwreq *)req; struct iwreq *wrq = (struct iwreq *)req;
/* used to pass id and store the bt entry returned by the FW */ /* used to pass id and store the bt entry returned by the FW */
union { union {
int id; u32 id;
char addr1addr2[2 * ETH_ALEN]; char addr1addr2[2 * ETH_ALEN];
} param; } param;
static char outstr[64]; static char outstr[64];
...@@ -272,7 +272,7 @@ static int wlan_bt_set_invert_ioctl(wlan_private * priv, struct ifreq *req) ...@@ -272,7 +272,7 @@ static int wlan_bt_set_invert_ioctl(wlan_private * priv, struct ifreq *req)
int ret; int ret;
struct iwreq *wrq = (struct iwreq *)req; struct iwreq *wrq = (struct iwreq *)req;
union { union {
int id; u32 id;
char addr1addr2[2 * ETH_ALEN]; char addr1addr2[2 * ETH_ALEN];
} param; } param;
...@@ -300,7 +300,7 @@ static int wlan_bt_get_invert_ioctl(wlan_private * priv, struct ifreq *req) ...@@ -300,7 +300,7 @@ static int wlan_bt_get_invert_ioctl(wlan_private * priv, struct ifreq *req)
struct iwreq *wrq = (struct iwreq *)req; struct iwreq *wrq = (struct iwreq *)req;
int ret; int ret;
union { union {
int id; u32 id;
char addr1addr2[2 * ETH_ALEN]; char addr1addr2[2 * ETH_ALEN];
} param; } param;
...@@ -365,7 +365,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req) ...@@ -365,7 +365,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
fwt_access.metric = fwt_access.metric =
cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
else else
fwt_access.metric = FWT_DEFAULT_METRIC; fwt_access.metric = cpu_to_le32(FWT_DEFAULT_METRIC);
if ((ptr = next_param(ptr))) if ((ptr = next_param(ptr)))
fwt_access.dir = (u8)simple_strtoul(ptr, &ptr, 10); 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,13 +381,13 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
fwt_access.ssn = fwt_access.ssn =
cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
else else
fwt_access.ssn = FWT_DEFAULT_SSN; fwt_access.ssn = cpu_to_le32(FWT_DEFAULT_SSN);
if ((ptr = next_param(ptr))) if ((ptr = next_param(ptr)))
fwt_access.dsn = fwt_access.dsn =
cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
else else
fwt_access.dsn = FWT_DEFAULT_DSN; fwt_access.dsn = cpu_to_le32(FWT_DEFAULT_DSN);
if ((ptr = next_param(ptr))) if ((ptr = next_param(ptr)))
fwt_access.hopcount = simple_strtoul(ptr, &ptr, 10); 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,7 +403,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
fwt_access.expiration = fwt_access.expiration =
cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
else else
fwt_access.expiration = FWT_DEFAULT_EXPIRATION; fwt_access.expiration = cpu_to_le32(FWT_DEFAULT_EXPIRATION);
if ((ptr = next_param(ptr))) if ((ptr = next_param(ptr)))
fwt_access.sleepmode = (u8)simple_strtoul(ptr, &ptr, 10); 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,7 +414,7 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
fwt_access.snr = fwt_access.snr =
cpu_to_le32(simple_strtoul(ptr, &ptr, 10)); cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
else else
fwt_access.snr = FWT_DEFAULT_SNR; fwt_access.snr = cpu_to_le32(FWT_DEFAULT_SNR);
#ifdef DEBUG #ifdef DEBUG
{ {
...@@ -864,7 +864,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl) ...@@ -864,7 +864,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
return -EINVAL; return -EINVAL;
memset(&mesh_access, 0, sizeof(mesh_access)); memset(&mesh_access, 0, sizeof(mesh_access));
mesh_access.data[0] = ttl; mesh_access.data[0] = cpu_to_le32(ttl);
ret = libertas_prepare_and_send_command(priv, cmd_mesh_access, ret = libertas_prepare_and_send_command(priv, cmd_mesh_access,
cmd_act_mesh_set_ttl, cmd_act_mesh_set_ttl,
......
...@@ -306,13 +306,11 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv, ...@@ -306,13 +306,11 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv,
lbs_deb_enter(LBS_DEB_JOIN); lbs_deb_enter(LBS_DEB_JOIN);
cmd->command = cpu_to_le16(cmd_802_11_deauthenticate); cmd->command = cpu_to_le16(cmd_802_11_deauthenticate);
cmd->size = cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) +
cpu_to_le16(sizeof(struct cmd_ds_802_11_deauthenticate) +
S_DS_GEN); S_DS_GEN);
/* set AP MAC address */ /* set AP MAC address */
memmove(dauth->macaddr, adapter->curbssparams.bssid, memmove(dauth->macaddr, adapter->curbssparams.bssid, ETH_ALEN);
ETH_ALEN);
/* Reason code 3 = Station is leaving */ /* Reason code 3 = Station is leaving */
#define REASON_CODE_STA_LEAVING 3 #define REASON_CODE_STA_LEAVING 3
...@@ -333,7 +331,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, ...@@ -333,7 +331,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
u8 *card_rates; u8 *card_rates;
u8 *pos; u8 *pos;
int card_rates_size; int card_rates_size;
u16 tmpcap; u16 tmpcap, tmplen;
struct mrvlietypes_ssidparamset *ssid; struct mrvlietypes_ssidparamset *ssid;
struct mrvlietypes_phyparamset *phy; struct mrvlietypes_phyparamset *phy;
struct mrvlietypes_ssparamset *ss; struct mrvlietypes_ssparamset *ss;
...@@ -355,7 +353,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, ...@@ -355,7 +353,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
pos += sizeof(passo->peerstaaddr); pos += sizeof(passo->peerstaaddr);
/* set the listen interval */ /* set the listen interval */
passo->listeninterval = adapter->listeninterval; passo->listeninterval = cpu_to_le16(adapter->listeninterval);
pos += sizeof(passo->capinfo); pos += sizeof(passo->capinfo);
pos += sizeof(passo->listeninterval); pos += sizeof(passo->listeninterval);
...@@ -364,14 +362,14 @@ int libertas_cmd_80211_associate(wlan_private * priv, ...@@ -364,14 +362,14 @@ int libertas_cmd_80211_associate(wlan_private * priv,
ssid = (struct mrvlietypes_ssidparamset *) pos; ssid = (struct mrvlietypes_ssidparamset *) pos;
ssid->header.type = cpu_to_le16(TLV_TYPE_SSID); ssid->header.type = cpu_to_le16(TLV_TYPE_SSID);
ssid->header.len = bss->ssid.ssidlength; ssid->header.len = cpu_to_le16(bss->ssid.ssidlength);
memcpy(ssid->ssid, bss->ssid.ssid, ssid->header.len); memcpy(ssid->ssid, bss->ssid.ssid, ssid->header.len);
pos += sizeof(ssid->header) + ssid->header.len; pos += sizeof(ssid->header) + ssid->header.len;
ssid->header.len = cpu_to_le16(ssid->header.len); ssid->header.len = cpu_to_le16(ssid->header.len);
phy = (struct mrvlietypes_phyparamset *) pos; phy = (struct mrvlietypes_phyparamset *) pos;
phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS); phy->header.type = cpu_to_le16(TLV_TYPE_PHY_DS);
phy->header.len = sizeof(phy->fh_ds.dsparamset); phy->header.len = cpu_to_le16(sizeof(phy->fh_ds.dsparamset));
memcpy(&phy->fh_ds.dsparamset, memcpy(&phy->fh_ds.dsparamset,
&bss->phyparamset.dsparamset.currentchan, &bss->phyparamset.dsparamset.currentchan,
sizeof(phy->fh_ds.dsparamset)); sizeof(phy->fh_ds.dsparamset));
...@@ -380,7 +378,7 @@ int libertas_cmd_80211_associate(wlan_private * priv, ...@@ -380,7 +378,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
ss = (struct mrvlietypes_ssparamset *) pos; ss = (struct mrvlietypes_ssparamset *) pos;
ss->header.type = cpu_to_le16(TLV_TYPE_CF); ss->header.type = cpu_to_le16(TLV_TYPE_CF);
ss->header.len = sizeof(ss->cf_ibss.cfparamset); ss->header.len = cpu_to_le16(sizeof(ss->cf_ibss.cfparamset));
pos += sizeof(ss->header) + ss->header.len; pos += sizeof(ss->header) + ss->header.len;
ss->header.len = cpu_to_le16(ss->header.len); ss->header.len = cpu_to_le16(ss->header.len);
...@@ -398,33 +396,34 @@ int libertas_cmd_80211_associate(wlan_private * priv, ...@@ -398,33 +396,34 @@ int libertas_cmd_80211_associate(wlan_private * priv,
goto done; goto done;
} }
rates->header.len = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES); tmplen = min_t(size_t, strlen(rates->rates), WLAN_SUPPORTED_RATES);
adapter->curbssparams.numofrates = rates->header.len; adapter->curbssparams.numofrates = tmplen;
pos += sizeof(rates->header) + rates->header.len; pos += sizeof(rates->header) + tmplen;
rates->header.len = cpu_to_le16(rates->header.len); rates->header.len = cpu_to_le16(tmplen);
if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
rsn = (struct mrvlietypes_rsnparamset *) pos; rsn = (struct mrvlietypes_rsnparamset *) pos;
rsn->header.type = (u16) assoc_req->wpa_ie[0]; /* WPA_IE or WPA2_IE */ /* WPA_IE or WPA2_IE */
rsn->header.type = cpu_to_le16(rsn->header.type); rsn->header.type = cpu_to_le16((u16) assoc_req->wpa_ie[0]);
rsn->header.len = (u16) assoc_req->wpa_ie[1]; tmplen = (u16) assoc_req->wpa_ie[1];
memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], rsn->header.len); rsn->header.len = cpu_to_le16(tmplen);
memcpy(rsn->rsnie, &assoc_req->wpa_ie[2], tmplen);
lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn, lbs_dbg_hex("ASSOC_CMD: RSN IE", (u8 *) rsn,
sizeof(rsn->header) + rsn->header.len); sizeof(rsn->header) + tmplen);
pos += sizeof(rsn->header) + rsn->header.len; pos += sizeof(rsn->header) + tmplen;
rsn->header.len = cpu_to_le16(rsn->header.len);
} }
/* update curbssparams */ /* update curbssparams */
adapter->curbssparams.channel = adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan;
(bss->phyparamset.dsparamset.currentchan);
/* Copy the infra. association rates into Current BSS state structure */ /* Copy the infra. association rates into Current BSS state structure */
memcpy(&adapter->curbssparams.datarates, &rates->rates, memcpy(&adapter->curbssparams.datarates, &rates->rates,
min_t(size_t, sizeof(adapter->curbssparams.datarates), rates->header.len)); min_t(size_t, sizeof(adapter->curbssparams.datarates),
cpu_to_le16(rates->header.len)));
lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", rates->header.len); lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n",
cpu_to_le16(rates->header.len));
/* set IBSS field */ /* set IBSS field */
if (bss->mode == IW_MODE_INFRA) { if (bss->mode == IW_MODE_INFRA) {
...@@ -444,7 +443,6 @@ int libertas_cmd_80211_associate(wlan_private * priv, ...@@ -444,7 +443,6 @@ int libertas_cmd_80211_associate(wlan_private * priv,
tmpcap &= CAPINFO_MASK; tmpcap &= CAPINFO_MASK;
lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
tmpcap, CAPINFO_MASK); tmpcap, CAPINFO_MASK);
tmpcap = cpu_to_le16(tmpcap);
memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo)); memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo));
done: done:
...@@ -460,7 +458,6 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, ...@@ -460,7 +458,6 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
int ret = 0; int ret = 0;
int cmdappendsize = 0; int cmdappendsize = 0;
int i; int i;
u16 tmpcap;
struct assoc_request * assoc_req = pdata_buf; struct assoc_request * assoc_req = pdata_buf;
lbs_deb_enter(LBS_DEB_JOIN); lbs_deb_enter(LBS_DEB_JOIN);
...@@ -492,7 +489,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, ...@@ -492,7 +489,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
/* set the BSS type */ /* set the BSS type */
adhs->bsstype = cmd_bss_type_ibss; adhs->bsstype = cmd_bss_type_ibss;
adapter->mode = IW_MODE_ADHOC; adapter->mode = IW_MODE_ADHOC;
adhs->beaconperiod = adapter->beaconperiod; adhs->beaconperiod = cpu_to_le16(adapter->beaconperiod);
/* set Physical param set */ /* set Physical param set */
#define DS_PARA_IE_ID 3 #define DS_PARA_IE_ID 3
...@@ -514,7 +511,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, ...@@ -514,7 +511,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID; adhs->ssparamset.ibssparamset.elementid = IBSS_PARA_IE_ID;
adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN; adhs->ssparamset.ibssparamset.len = IBSS_PARA_IE_LEN;
adhs->ssparamset.ibssparamset.atimwindow = adapter->atimwindow; adhs->ssparamset.ibssparamset.atimwindow = cpu_to_le16(adapter->atimwindow);
/* set capability info */ /* set capability info */
adhs->cap.ess = 0; adhs->cap.ess = 0;
...@@ -562,13 +559,8 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv, ...@@ -562,13 +559,8 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
goto done; goto done;
} }
cmd->size = cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) +
cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_start) S_DS_GEN + cmdappendsize);
+ S_DS_GEN + cmdappendsize);
memcpy(&tmpcap, &adhs->cap, sizeof(u16));
tmpcap = cpu_to_le16(tmpcap);
memcpy(&adhs->cap, &tmpcap, sizeof(u16));
ret = 0; ret = 0;
done: done:
...@@ -605,7 +597,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, ...@@ -605,7 +597,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss; padhocjoin->bssdescriptor.bsstype = cmd_bss_type_ibss;
padhocjoin->bssdescriptor.beaconperiod = bss->beaconperiod; padhocjoin->bssdescriptor.beaconperiod = cpu_to_le16(bss->beaconperiod);
memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN); memcpy(&padhocjoin->bssdescriptor.BSSID, &bss->bssid, ETH_ALEN);
memcpy(&padhocjoin->bssdescriptor.SSID, &bss->ssid.ssid, bss->ssid.ssidlength); 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,8 +626,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT); padhocjoin->failtimeout = cpu_to_le16(MRVDRV_ASSOCIATION_TIME_OUT);
/* probedelay */ /* probedelay */
padhocjoin->probedelay = padhocjoin->probedelay = cpu_to_le16(cmd_scan_probe_delay_time);
cpu_to_le16(cmd_scan_probe_delay_time);
/* Copy Data rates from the rates recorded in scan response */ /* Copy Data rates from the rates recorded in scan response */
memset(padhocjoin->bssdescriptor.datarates, 0, memset(padhocjoin->bssdescriptor.datarates, 0,
...@@ -679,9 +670,9 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, ...@@ -679,9 +670,9 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
if (adapter->psmode == wlan802_11powermodemax_psp) { if (adapter->psmode == wlan802_11powermodemax_psp) {
/* wake up first */ /* wake up first */
enum WLAN_802_11_POWER_MODE Localpsmode; __le32 Localpsmode;
Localpsmode = wlan802_11powermodecam; Localpsmode = cpu_to_le32(wlan802_11powermodecam);
ret = libertas_prepare_and_send_command(priv, ret = libertas_prepare_and_send_command(priv,
cmd_802_11_ps_mode, cmd_802_11_ps_mode,
cmd_act_set, cmd_act_set,
...@@ -698,16 +689,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv, ...@@ -698,16 +689,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
goto done; goto done;
} }
cmd->size = cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) +
cpu_to_le16(sizeof(struct cmd_ds_802_11_ad_hoc_join) S_DS_GEN + cmdappendsize);
+ S_DS_GEN + cmdappendsize);
memcpy(&tmpcap, &padhocjoin->bssdescriptor.cap,
sizeof(struct ieeetypes_capinfo));
tmpcap = cpu_to_le16(tmpcap);
memcpy(&padhocjoin->bssdescriptor.cap,
&tmpcap, sizeof(struct ieeetypes_capinfo));
done: done:
lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret); lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
...@@ -734,11 +717,11 @@ int libertas_ret_80211_associate(wlan_private * priv, ...@@ -734,11 +717,11 @@ int libertas_ret_80211_associate(wlan_private * priv,
passocrsp = (struct ieeetypes_assocrsp *) & resp->params; passocrsp = (struct ieeetypes_assocrsp *) & resp->params;
if (passocrsp->statuscode) { if (le16_to_cpu(passocrsp->statuscode)) {
libertas_mac_event_disconnected(priv); libertas_mac_event_disconnected(priv);
lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n", lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n",
passocrsp->statuscode); le16_to_cpu(passocrsp->statuscode));
ret = -1; ret = -1;
goto done; goto done;
......
...@@ -190,7 +190,7 @@ static ssize_t libertas_mpp_get(struct device * dev, ...@@ -190,7 +190,7 @@ static ssize_t libertas_mpp_get(struct device * dev,
cmd_act_mesh_get_mpp, cmd_act_mesh_get_mpp,
cmd_option_waitforrsp, 0, (void *)&mesh_access); cmd_option_waitforrsp, 0, (void *)&mesh_access);
return snprintf(buf, 3, "%d\n", mesh_access.data[0]); return snprintf(buf, 3, "%d\n", le32_to_cpu(mesh_access.data[0]));
} }
/** /**
...@@ -199,9 +199,12 @@ static ssize_t libertas_mpp_get(struct device * dev, ...@@ -199,9 +199,12 @@ static ssize_t libertas_mpp_get(struct device * dev,
static ssize_t libertas_mpp_set(struct device * dev, static ssize_t libertas_mpp_set(struct device * dev,
struct device_attribute *attr, const char * buf, size_t count) { struct device_attribute *attr, const char * buf, size_t count) {
struct cmd_ds_mesh_access mesh_access; struct cmd_ds_mesh_access mesh_access;
uint32_t datum;
memset(&mesh_access, 0, sizeof(mesh_access)); memset(&mesh_access, 0, sizeof(mesh_access));
sscanf(buf, "%d", &(mesh_access.data[0])); sscanf(buf, "%d", &datum);
mesh_access.data[0] = cpu_to_le32(datum);
libertas_prepare_and_send_command((to_net_dev(dev))->priv, libertas_prepare_and_send_command((to_net_dev(dev))->priv,
cmd_mesh_access, cmd_mesh_access,
cmd_act_mesh_set_mpp, cmd_act_mesh_set_mpp,
...@@ -213,8 +216,7 @@ static ssize_t libertas_mpp_set(struct device * dev, ...@@ -213,8 +216,7 @@ static ssize_t libertas_mpp_set(struct device * dev,
* libertas_mpp attribute to be exported per mshX interface * libertas_mpp attribute to be exported per mshX interface
* through sysfs (/sys/class/net/mshX/libertas-mpp) * through sysfs (/sys/class/net/mshX/libertas-mpp)
*/ */
static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, libertas_mpp_set );
libertas_mpp_set );
/** /**
* @brief Check if the device can be open and wait if necessary. * @brief Check if the device can be open and wait if necessary.
......
...@@ -200,7 +200,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -200,7 +200,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
/* /*
* Check rxpd status and update 802.3 stat, * Check rxpd status and update 802.3 stat,
*/ */
if (!(p_rx_pd->status & MRVDRV_RXPD_STATUS_OK)) { if (!(p_rx_pd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
lbs_deb_rx("rx err: frame received with bad status\n"); lbs_deb_rx("rx err: frame received with bad status\n");
lbs_pr_alert("rxpd not ok\n"); lbs_pr_alert("rxpd not ok\n");
priv->stats.rx_errors++; priv->stats.rx_errors++;
...@@ -353,7 +353,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -353,7 +353,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
/* /*
* Check rxpd status and update 802.3 stat, * Check rxpd status and update 802.3 stat,
*/ */
if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) { if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK))) {
//lbs_deb_rx("rx err: frame received with bad status\n"); //lbs_deb_rx("rx err: frame received with bad status\n");
priv->stats.rx_errors++; priv->stats.rx_errors++;
} }
...@@ -386,7 +386,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb) ...@@ -386,7 +386,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
/* XXX must check no carryout */ /* XXX must check no carryout */
radiotap_hdr.antsignal = prxpd->snr + prxpd->nf; radiotap_hdr.antsignal = prxpd->snr + prxpd->nf;
radiotap_hdr.rx_flags = 0; radiotap_hdr.rx_flags = 0;
if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) if (!(prxpd->status & cpu_to_le16(MRVDRV_RXPD_STATUS_OK)))
radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS; radiotap_hdr.rx_flags |= IEEE80211_RADIOTAP_F_RX_BADFCS;
//memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18); //memset(radiotap_hdr.pad, 0x11, IEEE80211_RADIOTAP_HDRLEN - 18);
......
...@@ -323,14 +323,12 @@ static void wlan_scan_create_channel_list(wlan_private * priv, ...@@ -323,14 +323,12 @@ static void wlan_scan_create_channel_list(wlan_private * priv,
if (scantype == cmd_scan_type_passive) { if (scantype == cmd_scan_type_passive) {
scanchanlist[chanidx].maxscantime = scanchanlist[chanidx].maxscantime =
cpu_to_le16 cpu_to_le16(MRVDRV_PASSIVE_SCAN_CHAN_TIME);
(MRVDRV_PASSIVE_SCAN_CHAN_TIME);
scanchanlist[chanidx].chanscanmode.passivescan = scanchanlist[chanidx].chanscanmode.passivescan =
1; 1;
} else { } else {
scanchanlist[chanidx].maxscantime = scanchanlist[chanidx].maxscantime =
cpu_to_le16 cpu_to_le16(MRVDRV_ACTIVE_SCAN_CHAN_TIME);
(MRVDRV_ACTIVE_SCAN_CHAN_TIME);
scanchanlist[chanidx].chanscanmode.passivescan = scanchanlist[chanidx].chanscanmode.passivescan =
0; 0;
} }
...@@ -487,16 +485,11 @@ wlan_scan_setup_scan_config(wlan_private * priv, ...@@ -487,16 +485,11 @@ wlan_scan_setup_scan_config(wlan_private * priv,
/* If the input config or adapter has the number of Probes set, add tlv */ /* If the input config or adapter has the number of Probes set, add tlv */
if (numprobes) { if (numprobes) {
pnumprobestlv = (struct mrvlietypes_numprobes *) ptlvpos; pnumprobestlv = (struct mrvlietypes_numprobes *) ptlvpos;
pnumprobestlv->header.type = pnumprobestlv->header.type = cpu_to_le16(TLV_TYPE_NUMPROBES);
cpu_to_le16(TLV_TYPE_NUMPROBES); pnumprobestlv->header.len = cpu_to_le16(2);
pnumprobestlv->header.len = sizeof(pnumprobestlv->numprobes);
pnumprobestlv->numprobes = cpu_to_le16(numprobes); pnumprobestlv->numprobes = cpu_to_le16(numprobes);
ptlvpos += ptlvpos += sizeof(*pnumprobestlv);
sizeof(pnumprobestlv->header) + pnumprobestlv->header.len;
pnumprobestlv->header.len =
cpu_to_le16(pnumprobestlv->header.len);
} }
/* /*
...@@ -655,8 +648,11 @@ static int wlan_scan_channel_list(wlan_private * priv, ...@@ -655,8 +648,11 @@ static int wlan_scan_channel_list(wlan_private * priv,
ptmpchan, sizeof(pchantlvout->chanscanparam)); ptmpchan, sizeof(pchantlvout->chanscanparam));
/* Increment the TLV header length by the size appended */ /* Increment the TLV header length by the size appended */
pchantlvout->header.len += /* Ew, it would be _so_ nice if we could just declare the
sizeof(pchantlvout->chanscanparam); variable little-endian and let GCC handle it for us */
pchantlvout->header.len =
cpu_to_le16(le16_to_cpu(pchantlvout->header.len) +
sizeof(pchantlvout->chanscanparam));
/* /*
* The tlv buffer length is set to the number of bytes of the * 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,7 +666,7 @@ static int wlan_scan_channel_list(wlan_private * priv,
/* Add the size of the channel tlv header and the data length */ /* Add the size of the channel tlv header and the data length */
pscancfgout->tlvbufferlen += pscancfgout->tlvbufferlen +=
(sizeof(pchantlvout->header) (sizeof(pchantlvout->header)
+ pchantlvout->header.len); + le16_to_cpu(pchantlvout->header.len));
/* Increment the index to the channel tlv we are constructing */ /* Increment the index to the channel tlv we are constructing */
tlvidx++; tlvidx++;
...@@ -955,8 +951,7 @@ static int libertas_process_bss(struct bss_descriptor * bss, ...@@ -955,8 +951,7 @@ static int libertas_process_bss(struct bss_descriptor * bss,
if (*bytesleft >= sizeof(beaconsize)) { if (*bytesleft >= sizeof(beaconsize)) {
/* Extract & convert beacon size from the command buffer */ /* Extract & convert beacon size from the command buffer */
memcpy(&beaconsize, *pbeaconinfo, sizeof(beaconsize)); beaconsize = le16_to_cpup((void *)*pbeaconinfo);
beaconsize = le16_to_cpu(beaconsize);
*bytesleft -= sizeof(beaconsize); *bytesleft -= sizeof(beaconsize);
*pbeaconinfo += sizeof(beaconsize); *pbeaconinfo += sizeof(beaconsize);
} }
...@@ -995,20 +990,18 @@ static int libertas_process_bss(struct bss_descriptor * bss, ...@@ -995,20 +990,18 @@ static int libertas_process_bss(struct bss_descriptor * bss,
*/ */
/* RSSI is 1 byte long */ /* RSSI is 1 byte long */
bss->rssi = le32_to_cpu((long)(*pcurrentptr)); bss->rssi = *pcurrentptr;
lbs_deb_scan("process_bss: RSSI=%02X\n", *pcurrentptr); lbs_deb_scan("process_bss: RSSI=%02X\n", *pcurrentptr);
pcurrentptr += 1; pcurrentptr += 1;
bytesleftforcurrentbeacon -= 1; bytesleftforcurrentbeacon -= 1;
/* time stamp is 8 bytes long */ /* time stamp is 8 bytes long */
memcpy(fixedie.timestamp, pcurrentptr, 8); fixedie.timestamp = bss->timestamp = le64_to_cpup((void *)pcurrentptr);
memcpy(bss->timestamp, pcurrentptr, 8);
pcurrentptr += 8; pcurrentptr += 8;
bytesleftforcurrentbeacon -= 8; bytesleftforcurrentbeacon -= 8;
/* beacon interval is 2 bytes long */ /* beacon interval is 2 bytes long */
memcpy(&fixedie.beaconinterval, pcurrentptr, 2); fixedie.beaconinterval = bss->beaconperiod = le16_to_cpup((void *)pcurrentptr);
bss->beaconperiod = le16_to_cpu(fixedie.beaconinterval);
pcurrentptr += 2; pcurrentptr += 2;
bytesleftforcurrentbeacon -= 2; bytesleftforcurrentbeacon -= 2;
...@@ -1016,7 +1009,6 @@ static int libertas_process_bss(struct bss_descriptor * bss, ...@@ -1016,7 +1009,6 @@ static int libertas_process_bss(struct bss_descriptor * bss,
memcpy(&fixedie.capabilities, pcurrentptr, 2); memcpy(&fixedie.capabilities, pcurrentptr, 2);
lbs_deb_scan("process_bss: fixedie.capabilities=0x%X\n", lbs_deb_scan("process_bss: fixedie.capabilities=0x%X\n",
fixedie.capabilities); fixedie.capabilities);
fixedie.capabilities = le16_to_cpu(fixedie.capabilities);
pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities; pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities;
memcpy(&bss->cap, pcap, sizeof(struct ieeetypes_capinfo)); memcpy(&bss->cap, pcap, sizeof(struct ieeetypes_capinfo));
pcurrentptr += 2; pcurrentptr += 2;
...@@ -1077,8 +1069,10 @@ static int libertas_process_bss(struct bss_descriptor * bss, ...@@ -1077,8 +1069,10 @@ static int libertas_process_bss(struct bss_descriptor * bss,
pFH = (struct ieeetypes_fhparamset *) pcurrentptr; pFH = (struct ieeetypes_fhparamset *) pcurrentptr;
memmove(&bss->phyparamset.fhparamset, pFH, memmove(&bss->phyparamset.fhparamset, pFH,
sizeof(struct ieeetypes_fhparamset)); sizeof(struct ieeetypes_fhparamset));
#if 0 /* I think we can store these LE */
bss->phyparamset.fhparamset.dwelltime bss->phyparamset.fhparamset.dwelltime
= le16_to_cpu(bss->phyparamset.fhparamset.dwelltime); = le16_to_cpu(bss->phyparamset.fhparamset.dwelltime);
#endif
break; break;
case DS_PARAM_SET: case DS_PARAM_SET:
...@@ -1099,8 +1093,10 @@ static int libertas_process_bss(struct bss_descriptor * bss, ...@@ -1099,8 +1093,10 @@ static int libertas_process_bss(struct bss_descriptor * bss,
bss->atimwindow = le32_to_cpu(pibss->atimwindow); bss->atimwindow = le32_to_cpu(pibss->atimwindow);
memmove(&bss->ssparamset.ibssparamset, pibss, memmove(&bss->ssparamset.ibssparamset, pibss,
sizeof(struct ieeetypes_ibssparamset)); sizeof(struct ieeetypes_ibssparamset));
#if 0
bss->ssparamset.ibssparamset.atimwindow bss->ssparamset.ibssparamset.atimwindow
= le16_to_cpu(bss->ssparamset.ibssparamset.atimwindow); = le16_to_cpu(bss->ssparamset.ibssparamset.atimwindow);
#endif
break; break;
/* Handle Country Info IE */ /* Handle Country Info IE */
...@@ -1744,7 +1740,8 @@ int libertas_cmd_80211_scan(wlan_private * priv, ...@@ -1744,7 +1740,8 @@ int libertas_cmd_80211_scan(wlan_private * priv,
+ pscancfg->tlvbufferlen + S_DS_GEN); + pscancfg->tlvbufferlen + S_DS_GEN);
lbs_deb_scan("SCAN_CMD: command=%x, size=%x, seqnum=%x\n", lbs_deb_scan("SCAN_CMD: command=%x, size=%x, seqnum=%x\n",
cmd->command, cmd->size, cmd->seqnum); le16_to_cpu(cmd->command), le16_to_cpu(cmd->size),
le16_to_cpu(cmd->seqnum));
lbs_deb_leave(LBS_DEB_ASSOC); lbs_deb_leave(LBS_DEB_ASSOC);
return 0; return 0;
...@@ -1799,7 +1796,6 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp) ...@@ -1799,7 +1796,6 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
int bytesleft; int bytesleft;
int idx; int idx;
int tlvbufsize; int tlvbufsize;
u64 tsfval;
int ret; int ret;
lbs_deb_enter(LBS_DEB_ASSOC); lbs_deb_enter(LBS_DEB_ASSOC);
...@@ -1905,9 +1901,7 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp) ...@@ -1905,9 +1901,7 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
* beacon or probe response was received. * beacon or probe response was received.
*/ */
if (ptsftlv) { if (ptsftlv) {
memcpy(&tsfval, &ptsftlv->tsftable[idx], sizeof(tsfval)); new.networktsf = le64_to_cpup(&ptsftlv->tsftable[idx]);
tsfval = le64_to_cpu(tsfval);
memcpy(&new.networktsf, &tsfval, sizeof(new.networktsf));
} }
/* Copy the locally created newbssentry to the scan table */ /* Copy the locally created newbssentry to the scan table */
......
...@@ -154,7 +154,7 @@ struct bss_descriptor { ...@@ -154,7 +154,7 @@ struct bss_descriptor {
u8 mode; u8 mode;
u8 libertas_supported_rates[WLAN_SUPPORTED_RATES]; u8 libertas_supported_rates[WLAN_SUPPORTED_RATES];
u8 timestamp[8]; //!< TSF value included in the beacon/probe response __le64 timestamp; //!< TSF value included in the beacon/probe response
unsigned long last_scanned; unsigned long last_scanned;
union ieeetypes_phyparamset phyparamset; union ieeetypes_phyparamset phyparamset;
...@@ -162,7 +162,7 @@ struct bss_descriptor { ...@@ -162,7 +162,7 @@ struct bss_descriptor {
struct ieeetypes_capinfo cap; struct ieeetypes_capinfo cap;
u8 datarates[WLAN_SUPPORTED_RATES]; u8 datarates[WLAN_SUPPORTED_RATES];
__le64 networktsf; //!< TSF timestamp from the current firmware TSF u64 networktsf; //!< TSF timestamp from the current firmware TSF
struct ieeetypes_countryinfofullset countryinfo; struct ieeetypes_countryinfofullset countryinfo;
......
...@@ -85,13 +85,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) ...@@ -85,13 +85,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
memset(plocaltxpd, 0, sizeof(struct txpd)); memset(plocaltxpd, 0, sizeof(struct txpd));
plocaltxpd->tx_packet_length = skb->len; plocaltxpd->tx_packet_length = cpu_to_le16(skb->len);
/* offset of actual data */ /* offset of actual data */
plocaltxpd->tx_packet_location = sizeof(struct txpd); plocaltxpd->tx_packet_location = cpu_to_le32(sizeof(struct txpd));
/* TxCtrl set by user or default */ /* TxCtrl set by user or default */
plocaltxpd->tx_control = adapter->pkttxctrl; plocaltxpd->tx_control = cpu_to_le32(adapter->pkttxctrl);
p802x_hdr = skb->data; p802x_hdr = skb->data;
if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) { if (priv->adapter->radiomode == WLAN_RADIOMODE_RADIOTAP) {
...@@ -102,15 +102,16 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) ...@@ -102,15 +102,16 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
/* set txpd fields from the radiotap header */ /* set txpd fields from the radiotap header */
new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate); new_rate = convert_radiotap_rate_to_mv(pradiotap_hdr->rate);
if (new_rate != 0) { if (new_rate != 0) {
/* erase tx_control[4:0] */ /* use new tx_control[4:0] */
plocaltxpd->tx_control &= ~0x1f; new_rate |= (adapter->pkttxctrl & ~0x1f);
/* write new tx_control[4:0] */ plocaltxpd->tx_control = cpu_to_le32(new_rate);
plocaltxpd->tx_control |= new_rate;
} }
/* skip the radiotap header */ /* skip the radiotap header */
p802x_hdr += sizeof(struct tx_radiotap_hdr); p802x_hdr += sizeof(struct tx_radiotap_hdr);
plocaltxpd->tx_packet_length -= sizeof(struct tx_radiotap_hdr); plocaltxpd->tx_packet_length =
cpu_to_le32(le32_to_cpu(plocaltxpd->tx_packet_length)
- sizeof(struct tx_radiotap_hdr));
} }
/* copy destination address from 802.3 or 802.11 header */ /* copy destination address from 802.3 or 802.11 header */
...@@ -122,18 +123,18 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb) ...@@ -122,18 +123,18 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd)); lbs_dbg_hex("txpd", (u8 *) plocaltxpd, sizeof(struct txpd));
if (IS_MESH_FRAME(skb)) { if (IS_MESH_FRAME(skb)) {
plocaltxpd->tx_control |= TxPD_MESH_FRAME; plocaltxpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME);
} }
memcpy(ptr, plocaltxpd, sizeof(struct txpd)); memcpy(ptr, plocaltxpd, sizeof(struct txpd));
ptr += sizeof(struct txpd); ptr += sizeof(struct txpd);
lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, plocaltxpd->tx_packet_length); lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, le32_to_cpu(plocaltxpd->tx_packet_length));
memcpy(ptr, p802x_hdr, plocaltxpd->tx_packet_length); memcpy(ptr, p802x_hdr, le32_to_cpu(plocaltxpd->tx_packet_length));
ret = priv->hw_host_to_card(priv, MVMS_DAT, ret = priv->hw_host_to_card(priv, MVMS_DAT,
priv->adapter->tmptxbuf, priv->adapter->tmptxbuf,
plocaltxpd->tx_packet_length + le32_to_cpu(plocaltxpd->tx_packet_length) +
sizeof(struct txpd)); sizeof(struct txpd));
if (ret) { if (ret) {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#define _WLAN_TYPES_ #define _WLAN_TYPES_
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <asm/byteorder.h>
/** IEEE type definitions */ /** IEEE type definitions */
enum ieeetypes_elementid { enum ieeetypes_elementid {
...@@ -29,9 +30,30 @@ enum ieeetypes_elementid { ...@@ -29,9 +30,30 @@ enum ieeetypes_elementid {
EXTRA_IE = 133, EXTRA_IE = 133,
} __attribute__ ((packed)); } __attribute__ ((packed));
#ifdef __BIG_ENDIAN
#define CAPINFO_MASK (~(0xda00)) #define CAPINFO_MASK (~(0xda00))
#else
#define CAPINFO_MASK (~(0x00da))
#endif
struct ieeetypes_capinfo { struct ieeetypes_capinfo {
#ifdef __BIG_ENDIAN_BITFIELD
u8 chanagility:1;
u8 pbcc:1;
u8 shortpreamble:1;
u8 privacy:1;
u8 cfpollrqst:1;
u8 cfpollable:1;
u8 ibss:1;
u8 ess:1;
u8 rsrvd1:2;
u8 dsssofdm:1;
u8 rsvrd2:1;
u8 apsd:1;
u8 shortslottime:1;
u8 rsrvd3:1;
u8 spectrummgmt:1;
#else
u8 ess:1; u8 ess:1;
u8 ibss:1; u8 ibss:1;
u8 cfpollable:1; u8 cfpollable:1;
...@@ -47,6 +69,7 @@ struct ieeetypes_capinfo { ...@@ -47,6 +69,7 @@ struct ieeetypes_capinfo {
u8 rsvrd2:1; u8 rsvrd2:1;
u8 dsssofdm:1; u8 dsssofdm:1;
u8 rsrvd1:2; u8 rsrvd1:2;
#endif
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ieeetypes_cfparamset { struct ieeetypes_cfparamset {
...@@ -54,15 +77,15 @@ struct ieeetypes_cfparamset { ...@@ -54,15 +77,15 @@ struct ieeetypes_cfparamset {
u8 len; u8 len;
u8 cfpcnt; u8 cfpcnt;
u8 cfpperiod; u8 cfpperiod;
u16 cfpmaxduration; __le16 cfpmaxduration;
u16 cfpdurationremaining; __le16 cfpdurationremaining;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ieeetypes_ibssparamset { struct ieeetypes_ibssparamset {
u8 elementid; u8 elementid;
u8 len; u8 len;
u16 atimwindow; __le16 atimwindow;
} __attribute__ ((packed)); } __attribute__ ((packed));
union IEEEtypes_ssparamset { union IEEEtypes_ssparamset {
...@@ -73,7 +96,7 @@ union IEEEtypes_ssparamset { ...@@ -73,7 +96,7 @@ union IEEEtypes_ssparamset {
struct ieeetypes_fhparamset { struct ieeetypes_fhparamset {
u8 elementid; u8 elementid;
u8 len; u8 len;
u16 dwelltime; __le16 dwelltime;
u8 hopset; u8 hopset;
u8 hoppattern; u8 hoppattern;
u8 hopindex; u8 hopindex;
...@@ -92,8 +115,8 @@ union ieeetypes_phyparamset { ...@@ -92,8 +115,8 @@ union ieeetypes_phyparamset {
struct ieeetypes_assocrsp { struct ieeetypes_assocrsp {
struct ieeetypes_capinfo capability; struct ieeetypes_capinfo capability;
u16 statuscode; __le16 statuscode;
u16 aid; __le16 aid;
u8 iebuffer[1]; u8 iebuffer[1];
} __attribute__ ((packed)); } __attribute__ ((packed));
...@@ -138,8 +161,8 @@ struct ieeetypes_assocrsp { ...@@ -138,8 +161,8 @@ struct ieeetypes_assocrsp {
/** TLV related data structures*/ /** TLV related data structures*/
struct mrvlietypesheader { struct mrvlietypesheader {
u16 type; __le16 type;
u16 len; __le16 len;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct mrvlietypes_data { struct mrvlietypes_data {
...@@ -164,17 +187,23 @@ struct mrvlietypes_wildcardssidparamset { ...@@ -164,17 +187,23 @@ struct mrvlietypes_wildcardssidparamset {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct chanscanmode { struct chanscanmode {
#ifdef __BIG_ENDIAN_BITFIELD
u8 reserved_2_7:6;
u8 disablechanfilt:1;
u8 passivescan:1;
#else
u8 passivescan:1; u8 passivescan:1;
u8 disablechanfilt:1; u8 disablechanfilt:1;
u8 reserved_2_7:6; u8 reserved_2_7:6;
#endif
} __attribute__ ((packed)); } __attribute__ ((packed));
struct chanscanparamset { struct chanscanparamset {
u8 radiotype; u8 radiotype;
u8 channumber; u8 channumber;
struct chanscanmode chanscanmode; struct chanscanmode chanscanmode;
u16 minscantime; __le16 minscantime;
u16 maxscantime; __le16 maxscantime;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct mrvlietypes_chanlistparamset { struct mrvlietypes_chanlistparamset {
...@@ -185,12 +214,12 @@ struct mrvlietypes_chanlistparamset { ...@@ -185,12 +214,12 @@ struct mrvlietypes_chanlistparamset {
struct cfparamset { struct cfparamset {
u8 cfpcnt; u8 cfpcnt;
u8 cfpperiod; u8 cfpperiod;
u16 cfpmaxduration; __le16 cfpmaxduration;
u16 cfpdurationremaining; __le16 cfpdurationremaining;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ibssparamset { struct ibssparamset {
u16 atimwindow; __le16 atimwindow;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct mrvlietypes_ssparamset { struct mrvlietypes_ssparamset {
...@@ -202,7 +231,7 @@ struct mrvlietypes_ssparamset { ...@@ -202,7 +231,7 @@ struct mrvlietypes_ssparamset {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct fhparamset { struct fhparamset {
u16 dwelltime; __le16 dwelltime;
u8 hopset; u8 hopset;
u8 hoppattern; u8 hoppattern;
u8 hopindex; u8 hopindex;
...@@ -263,17 +292,17 @@ struct mrvlietypes_beaconsmissed { ...@@ -263,17 +292,17 @@ struct mrvlietypes_beaconsmissed {
struct mrvlietypes_numprobes { struct mrvlietypes_numprobes {
struct mrvlietypesheader header; struct mrvlietypesheader header;
u16 numprobes; __le16 numprobes;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct mrvlietypes_bcastprobe { struct mrvlietypes_bcastprobe {
struct mrvlietypesheader header; struct mrvlietypesheader header;
u16 bcastprobe; __le16 bcastprobe;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct mrvlietypes_numssidprobe { struct mrvlietypes_numssidprobe {
struct mrvlietypesheader header; struct mrvlietypesheader header;
u16 numssidprobe; __le16 numssidprobe;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct led_pin { struct led_pin {
......
...@@ -402,7 +402,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info, ...@@ -402,7 +402,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
int ret = 0; int ret = 0;
wlan_private *priv = dev->priv; wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
int rthr = vwrq->value; u32 rthr = vwrq->value;
lbs_deb_enter(LBS_DEB_WEXT); lbs_deb_enter(LBS_DEB_WEXT);
...@@ -452,7 +452,7 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, ...@@ -452,7 +452,7 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
struct iw_param *vwrq, char *extra) struct iw_param *vwrq, char *extra)
{ {
int ret = 0; int ret = 0;
int fthr = vwrq->value; u32 fthr = vwrq->value;
wlan_private *priv = dev->priv; wlan_private *priv = dev->priv;
wlan_adapter *adapter = priv->adapter; wlan_adapter *adapter = priv->adapter;
...@@ -1115,7 +1115,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) ...@@ -1115,7 +1115,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
/* Quality by TX errors */ /* Quality by TX errors */
priv->wstats.discard.retries = priv->stats.tx_errors; priv->wstats.discard.retries = priv->stats.tx_errors;
tx_retries = adapter->logmsg.retry; tx_retries = le16_to_cpu(adapter->logmsg.retry);
if (tx_retries > 75) if (tx_retries > 75)
tx_qual = (90 - tx_retries) * POOR / 15; tx_qual = (90 - tx_retries) * POOR / 15;
...@@ -1131,10 +1131,10 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev) ...@@ -1131,10 +1131,10 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
(PERFECT - VERY_GOOD) / 50 + VERY_GOOD; (PERFECT - VERY_GOOD) / 50 + VERY_GOOD;
quality = min(quality, tx_qual); quality = min(quality, tx_qual);
priv->wstats.discard.code = adapter->logmsg.wepundecryptable; priv->wstats.discard.code = le16_to_cpu(adapter->logmsg.wepundecryptable);
priv->wstats.discard.fragment = adapter->logmsg.rxfrag; priv->wstats.discard.fragment = le16_to_cpu(adapter->logmsg.rxfrag);
priv->wstats.discard.retries = tx_retries; priv->wstats.discard.retries = tx_retries;
priv->wstats.discard.misc = adapter->logmsg.ackfailure; priv->wstats.discard.misc = le16_to_cpu(adapter->logmsg.ackfailure);
/* Calculate quality */ /* Calculate quality */
priv->wstats.qual.qual = max(quality, (u32)100); priv->wstats.qual.qual = max(quality, (u32)100);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment