aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-sta.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-05-04 22:22:34 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-14 16:29:45 -0400
commit133636deffc86809f59a0c8b768408d13237a9a2 (patch)
tree2c1d156db37f33ad9dd7eb311c6977d2948e9277 /drivers/net/wireless/iwlwifi/iwl-sta.c
parentdb11d6343aa14ab61258bfad9178042d4be49333 (diff)
iwlwifi: generalize iwl4965_send_add_station function
This patch moves iwl4965_send_add_station to iwlcore under new name iwl_send_add_sta. Function uses build command handler in order to support multiple HWs. 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.c54
1 files changed, 49 insertions, 5 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 0148d49e0b57..34f54244ed27 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -70,6 +70,52 @@ u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr)
70} 70}
71EXPORT_SYMBOL(iwl_find_station); 71EXPORT_SYMBOL(iwl_find_station);
72 72
73int iwl_send_add_sta(struct iwl_priv *priv,
74 struct iwl_addsta_cmd *sta, u8 flags)
75{
76 struct iwl_rx_packet *res = NULL;
77 int ret = 0;
78 u8 data[sizeof(*sta)];
79 struct iwl_host_cmd cmd = {
80 .id = REPLY_ADD_STA,
81 .meta.flags = flags,
82 .data = data,
83 };
84
85 if (!(flags & CMD_ASYNC))
86 cmd.meta.flags |= CMD_WANT_SKB;
87
88 cmd.len = priv->cfg->ops->utils->build_addsta_hcmd(sta, data);
89 ret = iwl_send_cmd(priv, &cmd);
90
91 if (ret || (flags & CMD_ASYNC))
92 return ret;
93
94 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
95 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
96 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
97 res->hdr.flags);
98 ret = -EIO;
99 }
100
101 if (ret == 0) {
102 switch (res->u.add_sta.status) {
103 case ADD_STA_SUCCESS_MSK:
104 IWL_DEBUG_INFO("REPLY_ADD_STA PASSED\n");
105 break;
106 default:
107 ret = -EIO;
108 IWL_WARNING("REPLY_ADD_STA failed\n");
109 break;
110 }
111 }
112
113 priv->alloc_rxb_skb--;
114 dev_kfree_skb_any(cmd.meta.u.skb);
115
116 return ret;
117}
118EXPORT_SYMBOL(iwl_send_add_sta);
73 119
74int iwl_get_free_ucode_key_index(struct iwl_priv *priv) 120int iwl_get_free_ucode_key_index(struct iwl_priv *priv)
75{ 121{
@@ -216,8 +262,7 @@ static int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv,
216 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 262 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
217 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 263 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
218 264
219 ret = iwl4965_send_add_station(priv, 265 ret = iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
220 &priv->stations[sta_id].sta, CMD_ASYNC);
221 266
222 spin_unlock_irqrestore(&priv->sta_lock, flags); 267 spin_unlock_irqrestore(&priv->sta_lock, flags);
223 268
@@ -265,8 +310,7 @@ static int iwl_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
265 spin_unlock_irqrestore(&priv->sta_lock, flags); 310 spin_unlock_irqrestore(&priv->sta_lock, flags);
266 311
267 IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n"); 312 IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n");
268 return iwl4965_send_add_station(priv, 313 return iwl_send_add_sta(priv, &priv->stations[sta_id].sta, CMD_ASYNC);
269 &priv->stations[sta_id].sta, CMD_ASYNC);
270} 314}
271 315
272static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv, 316static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
@@ -343,7 +387,7 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
343 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 387 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
344 388
345 IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n"); 389 IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n");
346 ret = iwl4965_send_add_station(priv, &priv->stations[sta_id].sta, 0); 390 ret = iwl_send_add_sta(priv, &priv->stations[sta_id].sta, 0);
347 spin_unlock_irqrestore(&priv->sta_lock, flags); 391 spin_unlock_irqrestore(&priv->sta_lock, flags);
348 return ret; 392 return ret;
349} 393}