diff options
author | David Woodhouse <dwmw2@infradead.org> | 2007-12-18 00:47:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:07:50 -0500 |
commit | 4f59abf190b15350167bec5382dda205030ac9d0 (patch) | |
tree | cf9b66dfceafa12202b9db1d5d426b922d107d9c | |
parent | f70dd4515a8ad9c9d59ebb8c1d1fa2c610fb4020 (diff) |
libertas: convert ENABLE_RSN to a direct command
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/libertas/assoc.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 32 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmd.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmdresp.c | 21 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/hostcmd.h | 3 |
5 files changed, 23 insertions, 54 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index e91cd6724de7..c622e9b63cd1 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -305,8 +305,8 @@ static int assoc_helper_secinfo(struct lbs_private *priv, | |||
305 | struct assoc_request * assoc_req) | 305 | struct assoc_request * assoc_req) |
306 | { | 306 | { |
307 | int ret = 0; | 307 | int ret = 0; |
308 | u32 do_wpa; | 308 | uint16_t do_wpa; |
309 | u32 rsn = 0; | 309 | uint16_t rsn = 0; |
310 | 310 | ||
311 | lbs_deb_enter(LBS_DEB_ASSOC); | 311 | lbs_deb_enter(LBS_DEB_ASSOC); |
312 | 312 | ||
@@ -323,28 +323,19 @@ static int assoc_helper_secinfo(struct lbs_private *priv, | |||
323 | */ | 323 | */ |
324 | 324 | ||
325 | /* Get RSN enabled/disabled */ | 325 | /* Get RSN enabled/disabled */ |
326 | ret = lbs_prepare_and_send_command(priv, | 326 | ret = lbs_cmd_802_11_enable_rsn(priv, CMD_ACT_GET, &rsn); |
327 | CMD_802_11_ENABLE_RSN, | ||
328 | CMD_ACT_GET, | ||
329 | CMD_OPTION_WAITFORRSP, | ||
330 | 0, &rsn); | ||
331 | if (ret) { | 327 | if (ret) { |
332 | lbs_deb_assoc("Failed to get RSN status: %d\n", ret); | 328 | lbs_deb_assoc("Failed to get RSN status: %d\n", ret); |
333 | goto out; | 329 | goto out; |
334 | } | 330 | } |
335 | 331 | ||
336 | /* Don't re-enable RSN if it's already enabled */ | 332 | /* Don't re-enable RSN if it's already enabled */ |
337 | do_wpa = (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled); | 333 | do_wpa = assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled; |
338 | if (do_wpa == rsn) | 334 | if (do_wpa == rsn) |
339 | goto out; | 335 | goto out; |
340 | 336 | ||
341 | /* Set RSN enabled/disabled */ | 337 | /* Set RSN enabled/disabled */ |
342 | rsn = do_wpa; | 338 | ret = lbs_cmd_802_11_enable_rsn(priv, CMD_ACT_SET, &do_wpa); |
343 | ret = lbs_prepare_and_send_command(priv, | ||
344 | CMD_802_11_ENABLE_RSN, | ||
345 | CMD_ACT_SET, | ||
346 | CMD_OPTION_WAITFORRSP, | ||
347 | 0, &rsn); | ||
348 | 339 | ||
349 | out: | 340 | out: |
350 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); | 341 | lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret); |
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 05e25cef5fe3..5d2c928fdd36 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -300,30 +300,31 @@ done: | |||
300 | return ret; | 300 | return ret; |
301 | } | 301 | } |
302 | 302 | ||
303 | static int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, | 303 | int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action, |
304 | struct cmd_ds_command *cmd, | 304 | uint16_t *enable) |
305 | u16 cmd_action, | ||
306 | void * pdata_buf) | ||
307 | { | 305 | { |
308 | struct cmd_ds_802_11_enable_rsn *penableRSN = &cmd->params.enbrsn; | 306 | struct cmd_ds_802_11_enable_rsn cmd; |
309 | u32 * enable = pdata_buf; | 307 | int ret; |
310 | 308 | ||
311 | lbs_deb_enter(LBS_DEB_CMD); | 309 | lbs_deb_enter(LBS_DEB_CMD); |
312 | 310 | ||
313 | cmd->command = cpu_to_le16(CMD_802_11_ENABLE_RSN); | 311 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
314 | cmd->size = cpu_to_le16(sizeof(*penableRSN) + S_DS_GEN); | 312 | cmd.action = cpu_to_le16(cmd_action); |
315 | penableRSN->action = cpu_to_le16(cmd_action); | ||
316 | 313 | ||
317 | if (cmd_action == CMD_ACT_SET) { | 314 | if (cmd_action == CMD_ACT_SET) { |
318 | if (*enable) | 315 | if (*enable) |
319 | penableRSN->enable = cpu_to_le16(CMD_ENABLE_RSN); | 316 | cmd.enable = cpu_to_le16(CMD_ENABLE_RSN); |
320 | else | 317 | else |
321 | penableRSN->enable = cpu_to_le16(CMD_DISABLE_RSN); | 318 | cmd.enable = cpu_to_le16(CMD_DISABLE_RSN); |
322 | lbs_deb_cmd("ENABLE_RSN: %d\n", *enable); | 319 | lbs_deb_cmd("ENABLE_RSN: %d\n", *enable); |
323 | } | 320 | } |
324 | 321 | ||
325 | lbs_deb_leave(LBS_DEB_CMD); | 322 | ret = lbs_cmd_with_response(priv, CMD_802_11_ENABLE_RSN, &cmd); |
326 | return 0; | 323 | if (!ret && cmd_action == CMD_ACT_GET) |
324 | *enable = le16_to_cpu(cmd.enable); | ||
325 | |||
326 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
327 | return ret; | ||
327 | } | 328 | } |
328 | 329 | ||
329 | 330 | ||
@@ -1473,11 +1474,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, | |||
1473 | ret = lbs_cmd_80211_ad_hoc_stop(priv, cmdptr); | 1474 | ret = lbs_cmd_80211_ad_hoc_stop(priv, cmdptr); |
1474 | break; | 1475 | break; |
1475 | 1476 | ||
1476 | case CMD_802_11_ENABLE_RSN: | ||
1477 | ret = lbs_cmd_802_11_enable_rsn(priv, cmdptr, cmd_action, | ||
1478 | pdata_buf); | ||
1479 | break; | ||
1480 | |||
1481 | case CMD_802_11_KEY_MATERIAL: | 1477 | case CMD_802_11_KEY_MATERIAL: |
1482 | ret = lbs_cmd_802_11_key_material(priv, cmdptr, cmd_action, | 1478 | ret = lbs_cmd_802_11_key_material(priv, cmdptr, cmd_action, |
1483 | cmd_oid, pdata_buf); | 1479 | cmd_oid, pdata_buf); |
diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index d9947c3a507b..6efb81ec597e 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h | |||
@@ -53,5 +53,7 @@ int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, | |||
53 | struct sleep_params *sp); | 53 | struct sleep_params *sp); |
54 | int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action, | 54 | int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action, |
55 | struct assoc_request *assoc); | 55 | struct assoc_request *assoc); |
56 | int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action, | ||
57 | uint16_t *enable); | ||
56 | 58 | ||
57 | #endif /* _LBS_CMD_H */ | 59 | #endif /* _LBS_CMD_H */ |
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index d670a811af04..8b71926d7a9f 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -372,23 +372,6 @@ static int lbs_ret_get_log(struct lbs_private *priv, | |||
372 | return 0; | 372 | return 0; |
373 | } | 373 | } |
374 | 374 | ||
375 | static int lbs_ret_802_11_enable_rsn(struct lbs_private *priv, | ||
376 | struct cmd_ds_command *resp) | ||
377 | { | ||
378 | struct cmd_ds_802_11_enable_rsn *enable_rsn = &resp->params.enbrsn; | ||
379 | uint32_t * pdata_buf = (uint32_t *)priv->cur_cmd->callback_arg; | ||
380 | |||
381 | lbs_deb_enter(LBS_DEB_CMD); | ||
382 | |||
383 | if (enable_rsn->action == cpu_to_le16(CMD_ACT_GET)) { | ||
384 | if (pdata_buf) | ||
385 | *pdata_buf = (uint32_t) le16_to_cpu(enable_rsn->enable); | ||
386 | } | ||
387 | |||
388 | lbs_deb_leave(LBS_DEB_CMD); | ||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, | 375 | static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, |
393 | struct cmd_ds_command *resp) | 376 | struct cmd_ds_command *resp) |
394 | { | 377 | { |
@@ -495,10 +478,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, | |||
495 | case CMD_RET(CMD_802_11_BEACON_STOP): | 478 | case CMD_RET(CMD_802_11_BEACON_STOP): |
496 | break; | 479 | break; |
497 | 480 | ||
498 | case CMD_RET(CMD_802_11_ENABLE_RSN): | ||
499 | ret = lbs_ret_802_11_enable_rsn(priv, resp); | ||
500 | break; | ||
501 | |||
502 | case CMD_RET(CMD_802_11_RATE_ADAPT_RATESET): | 481 | case CMD_RET(CMD_802_11_RATE_ADAPT_RATESET): |
503 | ret = lbs_ret_802_11_rate_adapt_rateset(priv, resp); | 482 | ret = lbs_ret_802_11_rate_adapt_rateset(priv, resp); |
504 | break; | 483 | break; |
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 6d76634f1e14..fffec11d0655 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h | |||
@@ -536,6 +536,8 @@ struct cmd_ds_802_11_ad_hoc_join { | |||
536 | } __attribute__ ((packed)); | 536 | } __attribute__ ((packed)); |
537 | 537 | ||
538 | struct cmd_ds_802_11_enable_rsn { | 538 | struct cmd_ds_802_11_enable_rsn { |
539 | struct cmd_header hdr; | ||
540 | |||
539 | __le16 action; | 541 | __le16 action; |
540 | __le16 enable; | 542 | __le16 enable; |
541 | } __attribute__ ((packed)); | 543 | } __attribute__ ((packed)); |
@@ -708,7 +710,6 @@ struct cmd_ds_command { | |||
708 | struct cmd_ds_802_11_rssi_rsp rssirsp; | 710 | struct cmd_ds_802_11_rssi_rsp rssirsp; |
709 | struct cmd_ds_802_11_disassociate dassociate; | 711 | struct cmd_ds_802_11_disassociate dassociate; |
710 | struct cmd_ds_802_11_mac_address macadd; | 712 | struct cmd_ds_802_11_mac_address macadd; |
711 | struct cmd_ds_802_11_enable_rsn enbrsn; | ||
712 | struct cmd_ds_802_11_key_material keymaterial; | 713 | struct cmd_ds_802_11_key_material keymaterial; |
713 | struct cmd_ds_mac_reg_access macreg; | 714 | struct cmd_ds_mac_reg_access macreg; |
714 | struct cmd_ds_bbp_reg_access bbpreg; | 715 | struct cmd_ds_bbp_reg_access bbpreg; |