summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/cmd.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-18 00:18:05 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 15:07:49 -0800
commitf70dd4515a8ad9c9d59ebb8c1d1fa2c610fb4020 (patch)
treeb9c5f3682972024fad4726a4163bbfb74a55ac0b /drivers/net/wireless/libertas/cmd.c
parent3fbe104cecdb8c812976fdb0cc41be65491b85ee (diff)
downloadblackbird-op-linux-f70dd4515a8ad9c9d59ebb8c1d1fa2c610fb4020.tar.gz
blackbird-op-linux-f70dd4515a8ad9c9d59ebb8c1d1fa2c610fb4020.zip
libertas: convert SET_WEP to a direct command
Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/cmd.c')
-rw-r--r--drivers/net/wireless/libertas/cmd.c57
1 files changed, 20 insertions, 37 deletions
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,
return 0;
}
-static int lbs_cmd_802_11_set_wep(struct lbs_private *priv,
- struct cmd_ds_command *cmd,
- u32 cmd_act,
- void * pdata_buf)
+int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action,
+ struct assoc_request *assoc)
{
- struct cmd_ds_802_11_set_wep *wep = &cmd->params.wep;
+ struct cmd_ds_802_11_set_wep cmd;
int ret = 0;
- struct assoc_request * assoc_req = pdata_buf;
lbs_deb_enter(LBS_DEB_CMD);
- cmd->command = cpu_to_le16(CMD_802_11_SET_WEP);
- cmd->size = cpu_to_le16(sizeof(*wep) + S_DS_GEN);
-
- if (cmd_act == CMD_ACT_ADD) {
- int i;
+ cmd.hdr.command = cpu_to_le16(CMD_802_11_SET_WEP);
+ cmd.hdr.size = cpu_to_le16(sizeof(cmd));
- if (!assoc_req) {
- lbs_deb_cmd("Invalid association request!\n");
- ret = -1;
- goto done;
- }
+ cmd.action = cpu_to_le16(cmd_action);
- wep->action = cpu_to_le16(CMD_ACT_ADD);
+ if (cmd_action == CMD_ACT_ADD) {
+ int i;
/* default tx key index */
- wep->keyindex = cpu_to_le16((u16)(assoc_req->wep_tx_keyidx &
- (u32)CMD_WEP_KEY_INDEX_MASK));
+ cmd.keyindex = cpu_to_le16(assoc->wep_tx_keyidx &
+ CMD_WEP_KEY_INDEX_MASK);
/* Copy key types and material to host command structure */
for (i = 0; i < 4; i++) {
- struct enc_key * pkey = &assoc_req->wep_keys[i];
+ struct enc_key *pkey = &assoc->wep_keys[i];
switch (pkey->len) {
case KEY_LEN_WEP_40:
- wep->keytype[i] = CMD_TYPE_WEP_40_BIT;
- memmove(&wep->keymaterial[i], pkey->key,
- pkey->len);
+ cmd.keytype[i] = CMD_TYPE_WEP_40_BIT;
+ memmove(cmd.keymaterial[i], pkey->key, pkey->len);
lbs_deb_cmd("SET_WEP: add key %d (40 bit)\n", i);
break;
case KEY_LEN_WEP_104:
- wep->keytype[i] = CMD_TYPE_WEP_104_BIT;
- memmove(&wep->keymaterial[i], pkey->key,
- pkey->len);
+ cmd.keytype[i] = CMD_TYPE_WEP_104_BIT;
+ memmove(cmd.keymaterial[i], pkey->key, pkey->len);
lbs_deb_cmd("SET_WEP: add key %d (104 bit)\n", i);
break;
case 0:
break;
default:
lbs_deb_cmd("SET_WEP: invalid key %d, length %d\n",
- i, pkey->len);
+ i, pkey->len);
ret = -1;
goto done;
break;
}
}
- } else if (cmd_act == CMD_ACT_REMOVE) {
+ } else if (cmd_action == CMD_ACT_REMOVE) {
/* ACT_REMOVE clears _all_ WEP keys */
- wep->action = cpu_to_le16(CMD_ACT_REMOVE);
/* default tx key index */
- wep->keyindex = cpu_to_le16((u16)(priv->wep_tx_keyidx &
- (u32)CMD_WEP_KEY_INDEX_MASK));
+ cmd.keyindex = cpu_to_le16(priv->wep_tx_keyidx &
+ CMD_WEP_KEY_INDEX_MASK);
lbs_deb_cmd("SET_WEP: remove key %d\n", priv->wep_tx_keyidx);
}
- ret = 0;
-
+ ret = lbs_cmd_with_response(priv, CMD_802_11_SET_WEP, &cmd);
done:
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
@@ -1422,10 +1409,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
ret = lbs_cmd_80211_deauthenticate(priv, cmdptr);
break;
- case CMD_802_11_SET_WEP:
- ret = lbs_cmd_802_11_set_wep(priv, cmdptr, cmd_action, pdata_buf);
- break;
-
case CMD_802_11_AD_HOC_START:
ret = lbs_cmd_80211_ad_hoc_start(priv, cmdptr, pdata_buf);
break;
OpenPOWER on IntegriCloud