diff options
-rw-r--r-- | drivers/net/wireless/libertas/assoc.c | 26 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 57 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmd.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/cmdresp.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/hostcmd.h | 7 |
5 files changed, 34 insertions, 59 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index 882e51c16a75..e91cd6724de7 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -258,7 +258,7 @@ static int assoc_helper_channel(struct lbs_private *priv, | |||
258 | 258 | ||
259 | 259 | ||
260 | static int assoc_helper_wep_keys(struct lbs_private *priv, | 260 | static int assoc_helper_wep_keys(struct lbs_private *priv, |
261 | struct assoc_request * assoc_req) | 261 | struct assoc_request *assoc_req) |
262 | { | 262 | { |
263 | int i; | 263 | int i; |
264 | int ret = 0; | 264 | int ret = 0; |
@@ -266,22 +266,11 @@ static int assoc_helper_wep_keys(struct lbs_private *priv, | |||
266 | lbs_deb_enter(LBS_DEB_ASSOC); | 266 | lbs_deb_enter(LBS_DEB_ASSOC); |
267 | 267 | ||
268 | /* Set or remove WEP keys */ | 268 | /* Set or remove WEP keys */ |
269 | if ( assoc_req->wep_keys[0].len | 269 | if (assoc_req->wep_keys[0].len || assoc_req->wep_keys[1].len || |
270 | || assoc_req->wep_keys[1].len | 270 | assoc_req->wep_keys[2].len || assoc_req->wep_keys[3].len) |
271 | || assoc_req->wep_keys[2].len | 271 | ret = lbs_cmd_802_11_set_wep(priv, CMD_ACT_ADD, assoc_req); |
272 | || assoc_req->wep_keys[3].len) { | 272 | else |
273 | ret = lbs_prepare_and_send_command(priv, | 273 | ret = lbs_cmd_802_11_set_wep(priv, CMD_ACT_REMOVE, assoc_req); |
274 | CMD_802_11_SET_WEP, | ||
275 | CMD_ACT_ADD, | ||
276 | CMD_OPTION_WAITFORRSP, | ||
277 | 0, assoc_req); | ||
278 | } else { | ||
279 | ret = lbs_prepare_and_send_command(priv, | ||
280 | CMD_802_11_SET_WEP, | ||
281 | CMD_ACT_REMOVE, | ||
282 | CMD_OPTION_WAITFORRSP, | ||
283 | 0, NULL); | ||
284 | } | ||
285 | 274 | ||
286 | if (ret) | 275 | if (ret) |
287 | goto out; | 276 | goto out; |
@@ -291,6 +280,7 @@ static int assoc_helper_wep_keys(struct lbs_private *priv, | |||
291 | priv->currentpacketfilter |= CMD_ACT_MAC_WEP_ENABLE; | 280 | priv->currentpacketfilter |= CMD_ACT_MAC_WEP_ENABLE; |
292 | else | 281 | else |
293 | priv->currentpacketfilter &= ~CMD_ACT_MAC_WEP_ENABLE; | 282 | priv->currentpacketfilter &= ~CMD_ACT_MAC_WEP_ENABLE; |
283 | |||
294 | ret = lbs_set_mac_packet_filter(priv); | 284 | ret = lbs_set_mac_packet_filter(priv); |
295 | if (ret) | 285 | if (ret) |
296 | goto out; | 286 | goto out; |
@@ -300,7 +290,7 @@ static int assoc_helper_wep_keys(struct lbs_private *priv, | |||
300 | /* Copy WEP keys into priv wep key fields */ | 290 | /* Copy WEP keys into priv wep key fields */ |
301 | for (i = 0; i < 4; i++) { | 291 | for (i = 0; i < 4; i++) { |
302 | memcpy(&priv->wep_keys[i], &assoc_req->wep_keys[i], | 292 | memcpy(&priv->wep_keys[i], &assoc_req->wep_keys[i], |
303 | sizeof(struct enc_key)); | 293 | sizeof(struct enc_key)); |
304 | } | 294 | } |
305 | priv->wep_tx_keyidx = assoc_req->wep_tx_keyidx; | 295 | priv->wep_tx_keyidx = assoc_req->wep_tx_keyidx; |
306 | 296 | ||
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 3d9ad0ec9542..05e25cef5fe3 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -240,74 +240,61 @@ int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, | |||
240 | return 0; | 240 | return 0; |
241 | } | 241 | } |
242 | 242 | ||
243 | static int lbs_cmd_802_11_set_wep(struct lbs_private *priv, | 243 | int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action, |
244 | struct cmd_ds_command *cmd, | 244 | struct assoc_request *assoc) |
245 | u32 cmd_act, | ||
246 | void * pdata_buf) | ||
247 | { | 245 | { |
248 | struct cmd_ds_802_11_set_wep *wep = &cmd->params.wep; | 246 | struct cmd_ds_802_11_set_wep cmd; |
249 | int ret = 0; | 247 | int ret = 0; |
250 | struct assoc_request * assoc_req = pdata_buf; | ||
251 | 248 | ||
252 | lbs_deb_enter(LBS_DEB_CMD); | 249 | lbs_deb_enter(LBS_DEB_CMD); |
253 | 250 | ||
254 | cmd->command = cpu_to_le16(CMD_802_11_SET_WEP); | 251 | cmd.hdr.command = cpu_to_le16(CMD_802_11_SET_WEP); |
255 | cmd->size = cpu_to_le16(sizeof(*wep) + S_DS_GEN); | 252 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
256 | |||
257 | if (cmd_act == CMD_ACT_ADD) { | ||
258 | int i; | ||
259 | 253 | ||
260 | if (!assoc_req) { | 254 | cmd.action = cpu_to_le16(cmd_action); |
261 | lbs_deb_cmd("Invalid association request!\n"); | ||
262 | ret = -1; | ||
263 | goto done; | ||
264 | } | ||
265 | 255 | ||
266 | wep->action = cpu_to_le16(CMD_ACT_ADD); | 256 | if (cmd_action == CMD_ACT_ADD) { |
257 | int i; | ||
267 | 258 | ||
268 | /* default tx key index */ | 259 | /* default tx key index */ |
269 | wep->keyindex = cpu_to_le16((u16)(assoc_req->wep_tx_keyidx & | 260 | cmd.keyindex = cpu_to_le16(assoc->wep_tx_keyidx & |
270 | (u32)CMD_WEP_KEY_INDEX_MASK)); | 261 | CMD_WEP_KEY_INDEX_MASK); |
271 | 262 | ||
272 | /* Copy key types and material to host command structure */ | 263 | /* Copy key types and material to host command structure */ |
273 | for (i = 0; i < 4; i++) { | 264 | for (i = 0; i < 4; i++) { |
274 | struct enc_key * pkey = &assoc_req->wep_keys[i]; | 265 | struct enc_key *pkey = &assoc->wep_keys[i]; |
275 | 266 | ||
276 | switch (pkey->len) { | 267 | switch (pkey->len) { |
277 | case KEY_LEN_WEP_40: | 268 | case KEY_LEN_WEP_40: |
278 | wep->keytype[i] = CMD_TYPE_WEP_40_BIT; | 269 | cmd.keytype[i] = CMD_TYPE_WEP_40_BIT; |
279 | memmove(&wep->keymaterial[i], pkey->key, | 270 | memmove(cmd.keymaterial[i], pkey->key, pkey->len); |
280 | pkey->len); | ||
281 | lbs_deb_cmd("SET_WEP: add key %d (40 bit)\n", i); | 271 | lbs_deb_cmd("SET_WEP: add key %d (40 bit)\n", i); |
282 | break; | 272 | break; |
283 | case KEY_LEN_WEP_104: | 273 | case KEY_LEN_WEP_104: |
284 | wep->keytype[i] = CMD_TYPE_WEP_104_BIT; | 274 | cmd.keytype[i] = CMD_TYPE_WEP_104_BIT; |
285 | memmove(&wep->keymaterial[i], pkey->key, | 275 | memmove(cmd.keymaterial[i], pkey->key, pkey->len); |
286 | pkey->len); | ||
287 | lbs_deb_cmd("SET_WEP: add key %d (104 bit)\n", i); | 276 | lbs_deb_cmd("SET_WEP: add key %d (104 bit)\n", i); |
288 | break; | 277 | break; |
289 | case 0: | 278 | case 0: |
290 | break; | 279 | break; |
291 | default: | 280 | default: |
292 | lbs_deb_cmd("SET_WEP: invalid key %d, length %d\n", | 281 | lbs_deb_cmd("SET_WEP: invalid key %d, length %d\n", |
293 | i, pkey->len); | 282 | i, pkey->len); |
294 | ret = -1; | 283 | ret = -1; |
295 | goto done; | 284 | goto done; |
296 | break; | 285 | break; |
297 | } | 286 | } |
298 | } | 287 | } |
299 | } else if (cmd_act == CMD_ACT_REMOVE) { | 288 | } else if (cmd_action == CMD_ACT_REMOVE) { |
300 | /* ACT_REMOVE clears _all_ WEP keys */ | 289 | /* ACT_REMOVE clears _all_ WEP keys */ |
301 | wep->action = cpu_to_le16(CMD_ACT_REMOVE); | ||
302 | 290 | ||
303 | /* default tx key index */ | 291 | /* default tx key index */ |
304 | wep->keyindex = cpu_to_le16((u16)(priv->wep_tx_keyidx & | 292 | cmd.keyindex = cpu_to_le16(priv->wep_tx_keyidx & |
305 | (u32)CMD_WEP_KEY_INDEX_MASK)); | 293 | CMD_WEP_KEY_INDEX_MASK); |
306 | lbs_deb_cmd("SET_WEP: remove key %d\n", priv->wep_tx_keyidx); | 294 | lbs_deb_cmd("SET_WEP: remove key %d\n", priv->wep_tx_keyidx); |
307 | } | 295 | } |
308 | 296 | ||
309 | ret = 0; | 297 | ret = lbs_cmd_with_response(priv, CMD_802_11_SET_WEP, &cmd); |
310 | |||
311 | done: | 298 | done: |
312 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | 299 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); |
313 | return ret; | 300 | return ret; |
@@ -1422,10 +1409,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, | |||
1422 | ret = lbs_cmd_80211_deauthenticate(priv, cmdptr); | 1409 | ret = lbs_cmd_80211_deauthenticate(priv, cmdptr); |
1423 | break; | 1410 | break; |
1424 | 1411 | ||
1425 | case CMD_802_11_SET_WEP: | ||
1426 | ret = lbs_cmd_802_11_set_wep(priv, cmdptr, cmd_action, pdata_buf); | ||
1427 | break; | ||
1428 | |||
1429 | case CMD_802_11_AD_HOC_START: | 1412 | case CMD_802_11_AD_HOC_START: |
1430 | ret = lbs_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf); | 1413 | ret = lbs_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf); |
1431 | break; | 1414 | break; |
diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h index ca09b1803d15..d9947c3a507b 100644 --- a/drivers/net/wireless/libertas/cmd.h +++ b/drivers/net/wireless/libertas/cmd.h | |||
@@ -51,5 +51,7 @@ int lbs_cmd_802_11_inactivity_timeout(struct lbs_private *priv, | |||
51 | uint16_t cmd_action, uint16_t *timeout); | 51 | uint16_t cmd_action, uint16_t *timeout); |
52 | int lbs_cmd_802_11_sleep_params(struct lbs_private *priv, uint16_t cmd_action, | 52 | 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, | ||
55 | struct assoc_request *assoc); | ||
54 | 56 | ||
55 | #endif /* _LBS_CMD_H */ | 57 | #endif /* _LBS_CMD_H */ |
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 40615a88dc88..d670a811af04 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -490,7 +490,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, | |||
490 | 490 | ||
491 | case CMD_RET(CMD_MAC_MULTICAST_ADR): | 491 | case CMD_RET(CMD_MAC_MULTICAST_ADR): |
492 | case CMD_RET(CMD_MAC_CONTROL): | 492 | case CMD_RET(CMD_MAC_CONTROL): |
493 | case CMD_RET(CMD_802_11_SET_WEP): | ||
494 | case CMD_RET(CMD_802_11_RESET): | 493 | case CMD_RET(CMD_802_11_RESET): |
495 | case CMD_RET(CMD_802_11_AUTHENTICATE): | 494 | case CMD_RET(CMD_802_11_AUTHENTICATE): |
496 | case CMD_RET(CMD_802_11_BEACON_STOP): | 495 | case CMD_RET(CMD_802_11_BEACON_STOP): |
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h index 855c2d0df863..6d76634f1e14 100644 --- a/drivers/net/wireless/libertas/hostcmd.h +++ b/drivers/net/wireless/libertas/hostcmd.h | |||
@@ -256,6 +256,8 @@ struct cmd_ds_802_11_ad_hoc_result { | |||
256 | }; | 256 | }; |
257 | 257 | ||
258 | struct cmd_ds_802_11_set_wep { | 258 | struct cmd_ds_802_11_set_wep { |
259 | struct cmd_header hdr; | ||
260 | |||
259 | /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */ | 261 | /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */ |
260 | __le16 action; | 262 | __le16 action; |
261 | 263 | ||
@@ -263,8 +265,8 @@ struct cmd_ds_802_11_set_wep { | |||
263 | __le16 keyindex; | 265 | __le16 keyindex; |
264 | 266 | ||
265 | /* 40, 128bit or TXWEP */ | 267 | /* 40, 128bit or TXWEP */ |
266 | u8 keytype[4]; | 268 | uint8_t keytype[4]; |
267 | u8 keymaterial[4][16]; | 269 | uint8_t keymaterial[4][16]; |
268 | }; | 270 | }; |
269 | 271 | ||
270 | struct cmd_ds_802_3_get_stat { | 272 | struct cmd_ds_802_3_get_stat { |
@@ -688,7 +690,6 @@ struct cmd_ds_command { | |||
688 | struct cmd_ds_mac_control macctrl; | 690 | struct cmd_ds_mac_control macctrl; |
689 | struct cmd_ds_802_11_associate associate; | 691 | struct cmd_ds_802_11_associate associate; |
690 | struct cmd_ds_802_11_deauthenticate deauth; | 692 | struct cmd_ds_802_11_deauthenticate deauth; |
691 | struct cmd_ds_802_11_set_wep wep; | ||
692 | struct cmd_ds_802_11_ad_hoc_start ads; | 693 | struct cmd_ds_802_11_ad_hoc_start ads; |
693 | struct cmd_ds_802_11_reset reset; | 694 | struct cmd_ds_802_11_reset reset; |
694 | struct cmd_ds_802_11_ad_hoc_result result; | 695 | struct cmd_ds_802_11_ad_hoc_result result; |