aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-sta.c
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2008-04-15 00:16:07 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-16 15:59:58 -0400
commit0211ddda9deb681a804572936cd49e466a1aa88b (patch)
treea9bb069458364ba40c8c7024352f9ac36a8bdfcf /drivers/net/wireless/iwlwifi/iwl-sta.c
parent6974e36356524fa856435cb1be40aaffbac9601a (diff)
iwlwifi: add 1X HW WEP support
This patch adds support for HW encryption/decryption in 1X WEP. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-sta.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index a48e228e2ffd..cb964196ad2a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -35,6 +35,7 @@
35#include "iwl-sta.h" 35#include "iwl-sta.h"
36#include "iwl-io.h" 36#include "iwl-io.h"
37#include "iwl-helpers.h" 37#include "iwl-helpers.h"
38#include "iwl-4965.h"
38 39
39int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty) 40int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty)
40{ 41{
@@ -117,3 +118,49 @@ int iwl_set_default_wep_key(struct iwl_priv *priv,
117 return ret; 118 return ret;
118} 119}
119 120
121int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv,
122 struct ieee80211_key_conf *keyconf,
123 u8 sta_id)
124{
125 unsigned long flags;
126 __le16 key_flags = 0;
127 int ret;
128
129 keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV;
130 keyconf->hw_key_idx = keyconf->keyidx;
131
132 key_flags |= (STA_KEY_FLG_WEP | STA_KEY_FLG_MAP_KEY_MSK);
133 key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
134 key_flags &= ~STA_KEY_FLG_INVALID;
135
136 if (keyconf->keylen == WEP_KEY_LEN_128)
137 key_flags |= STA_KEY_FLG_KEY_SIZE_MSK;
138
139 if (sta_id == priv->hw_setting.bcast_sta_id)
140 key_flags |= STA_KEY_MULTICAST_MSK;
141
142 spin_lock_irqsave(&priv->sta_lock, flags);
143
144 priv->stations[sta_id].keyinfo.alg = keyconf->alg;
145 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen;
146 priv->stations[sta_id].keyinfo.keyidx = keyconf->keyidx;
147
148 memcpy(priv->stations[sta_id].keyinfo.key,
149 keyconf->key, keyconf->keylen);
150
151 memcpy(&priv->stations[sta_id].sta.key.key[3],
152 keyconf->key, keyconf->keylen);
153
154 priv->stations[sta_id].sta.key.key_offset = sta_id % 8; /* FIXME */
155 priv->stations[sta_id].sta.key.key_flags = key_flags;
156
157 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
158 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
159
160 ret = iwl4965_send_add_station(priv,
161 &priv->stations[sta_id].sta, CMD_ASYNC);
162
163 spin_unlock_irqrestore(&priv->sta_lock, flags);
164
165 return ret;
166}