Commit 4f59abf1 authored by David Woodhouse's avatar David Woodhouse Committed by David S. Miller

libertas: convert ENABLE_RSN to a direct command

Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f70dd451
...@@ -305,8 +305,8 @@ static int assoc_helper_secinfo(struct lbs_private *priv, ...@@ -305,8 +305,8 @@ static int assoc_helper_secinfo(struct lbs_private *priv,
struct assoc_request * assoc_req) struct assoc_request * assoc_req)
{ {
int ret = 0; int ret = 0;
u32 do_wpa; uint16_t do_wpa;
u32 rsn = 0; uint16_t rsn = 0;
lbs_deb_enter(LBS_DEB_ASSOC); lbs_deb_enter(LBS_DEB_ASSOC);
...@@ -323,28 +323,19 @@ static int assoc_helper_secinfo(struct lbs_private *priv, ...@@ -323,28 +323,19 @@ static int assoc_helper_secinfo(struct lbs_private *priv,
*/ */
/* Get RSN enabled/disabled */ /* Get RSN enabled/disabled */
ret = lbs_prepare_and_send_command(priv, ret = lbs_cmd_802_11_enable_rsn(priv, CMD_ACT_GET, &rsn);
CMD_802_11_ENABLE_RSN,
CMD_ACT_GET,
CMD_OPTION_WAITFORRSP,
0, &rsn);
if (ret) { if (ret) {
lbs_deb_assoc("Failed to get RSN status: %d\n", ret); lbs_deb_assoc("Failed to get RSN status: %d\n", ret);
goto out; goto out;
} }
/* Don't re-enable RSN if it's already enabled */ /* Don't re-enable RSN if it's already enabled */
do_wpa = (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled); do_wpa = assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled;
if (do_wpa == rsn) if (do_wpa == rsn)
goto out; goto out;
/* Set RSN enabled/disabled */ /* Set RSN enabled/disabled */
rsn = do_wpa; ret = lbs_cmd_802_11_enable_rsn(priv, CMD_ACT_SET, &do_wpa);
ret = lbs_prepare_and_send_command(priv,
CMD_802_11_ENABLE_RSN,
CMD_ACT_SET,
CMD_OPTION_WAITFORRSP,
0, &rsn);
out: out:
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
......
...@@ -300,30 +300,31 @@ int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action, ...@@ -300,30 +300,31 @@ int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action,
return ret; return ret;
} }
static int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action,
struct cmd_ds_command *cmd, uint16_t *enable)
u16 cmd_action,
void * pdata_buf)
{ {
struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn; struct cmd_ds_802_11_enable_rsn cmd;
u32 * enable = pdata_buf; int ret;
lbs_deb_enter(LBS_DEB_CMD); lbs_deb_enter(LBS_DEB_CMD);
cmd->command = cpu_to_le16(CMD_802_11_ENABLE_RSN); cmd.hdr.size = cpu_to_le16(sizeof(cmd));
cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN); cmd.action = cpu_to_le16(cmd_action);
penableRSN->action = cpu_to_le16(cmd_action);
if (cmd_action == CMD_ACT_SET) { if (cmd_action == CMD_ACT_SET) {
if (*enable) if (*enable)
penableRSN->enable = cpu_to_le16(CMD_ENABLE_RSN); cmd.enable = cpu_to_le16(CMD_ENABLE_RSN);
else else
penableRSN->enable = cpu_to_le16(CMD_DISABLE_RSN); cmd.enable = cpu_to_le16(CMD_DISABLE_RSN);
lbs_deb_cmd("ENABLE_RSN: %d\n", *enable); lbs_deb_cmd("ENABLE_RSN: %d\n", *enable);
} }
lbs_deb_leave(LBS_DEB_CMD); ret = lbs_cmd_with_response(priv, CMD_802_11_ENABLE_RSN, &cmd);
return 0; if (!ret && cmd_action == CMD_ACT_GET)
*enable = le16_to_cpu(cmd.enable);
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
} }
...@@ -1473,11 +1474,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ...@@ -1473,11 +1474,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
ret = lbs_cmd_80211_ad_hoc_stop(priv, cmdptr); ret = lbs_cmd_80211_ad_hoc_stop(priv, cmdptr);
break; break;
case CMD_802_11_ENABLE_RSN:
ret = lbs_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action,
pdata_buf);
break;
case CMD_802_11_KEY_MATERIAL: case CMD_802_11_KEY_MATERIAL:
ret = lbs_cmd_802_11_key_material(priv, cmdptr, cmd_action, ret = lbs_cmd_802_11_key_material(priv, cmdptr, cmd_action,
cmd_oid, pdata_buf); cmd_oid, pdata_buf);
......
...@@ -53,5 +53,7 @@ int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, ...@@ -53,5 +53,7 @@ int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action,
struct sleep_params *sp); struct sleep_params *sp);
int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action, int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action,
struct assoc_request *assoc); struct assoc_request *assoc);
int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action,
uint16_t *enable);
#endif /* _LBS_CMD_H */ #endif /* _LBS_CMD_H */
...@@ -372,23 +372,6 @@ static int lbs_ret_get_log(struct lbs_private *priv, ...@@ -372,23 +372,6 @@ static int lbs_ret_get_log(struct lbs_private *priv,
return 0; return 0;
} }
static int lbs_ret_802_11_enable_rsn(struct lbs_private *priv,
struct cmd_ds_command *resp)
{
struct cmd_ds_802_11_enable_rsn *enable_rsn = &resp->params.enbrsn;
uint32_t * pdata_buf = (uint32_t *)priv->cur_cmd->callback_arg;
lbs_deb_enter(LBS_DEB_CMD);
if (enable_rsn->action == cpu_to_le16(CMD_ACT_GET)) {
if (pdata_buf)
*pdata_buf = (uint32_t) le16_to_cpu(enable_rsn->enable);
}
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
struct cmd_ds_command *resp) struct cmd_ds_command *resp)
{ {
...@@ -495,10 +478,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, ...@@ -495,10 +478,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
case CMD_RET(CMD_802_11_BEACON_STOP): case CMD_RET(CMD_802_11_BEACON_STOP):
break; break;
case CMD_RET(CMD_802_11_ENABLE_RSN):
ret = lbs_ret_802_11_enable_rsn(priv, resp);
break;
case CMD_RET(CMD_802_11_RATE_ADAPT_RATESET): case CMD_RET(CMD_802_11_RATE_ADAPT_RATESET):
ret = lbs_ret_802_11_rate_adapt_rateset(priv, resp); ret = lbs_ret_802_11_rate_adapt_rateset(priv, resp);
break; break;
......
...@@ -536,6 +536,8 @@ struct cmd_ds_802_11_ad_hoc_join { ...@@ -536,6 +536,8 @@ struct cmd_ds_802_11_ad_hoc_join {
} __attribute__ ((packed)); } __attribute__ ((packed));
struct cmd_ds_802_11_enable_rsn { struct cmd_ds_802_11_enable_rsn {
struct cmd_header hdr;
__le16 action; __le16 action;
__le16 enable; __le16 enable;
} __attribute__ ((packed)); } __attribute__ ((packed));
...@@ -708,7 +710,6 @@ struct cmd_ds_command { ...@@ -708,7 +710,6 @@ struct cmd_ds_command {
struct cmd_ds_802_11_rssi_rsp rssirsp; struct cmd_ds_802_11_rssi_rsp rssirsp;
struct cmd_ds_802_11_disassociate dassociate; struct cmd_ds_802_11_disassociate dassociate;
struct cmd_ds_802_11_mac_address macadd; struct cmd_ds_802_11_mac_address macadd;
struct cmd_ds_802_11_enable_rsn enbrsn;
struct cmd_ds_802_11_key_material keymaterial; struct cmd_ds_802_11_key_material keymaterial;
struct cmd_ds_mac_reg_access macreg; struct cmd_ds_mac_reg_access macreg;
struct cmd_ds_bbp_reg_access bbpreg; struct cmd_ds_bbp_reg_access bbpreg;
......
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