Commit 42986796 authored by Winkler, Tomas's avatar Winkler, Tomas Committed by John W. Linville
Browse files

iwlwifi: fix iwl_mac_set_key and iwl3945_mac_set_key



This patch fix iwl_mac_set_key function changed in patch
"mac80211: clean up set_key callback"

1. removing 'static' const u8 *addr' that can possible cause
conflict when two or more NICs are present in the system.
2. simplifying functions
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 5cd19c5f
...@@ -2998,12 +2998,10 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ...@@ -2998,12 +2998,10 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
struct ieee80211_key_conf *key) struct ieee80211_key_conf *key)
{ {
struct iwl_priv *priv = hw->priv; struct iwl_priv *priv = hw->priv;
int ret = 0; const u8 *addr;
u8 sta_id = IWL_INVALID_STATION; int ret;
u8 is_default_wep_key = 0; u8 sta_id;
static const u8 bcast_addr[ETH_ALEN] = bool is_default_wep_key = false;
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, };
static const u8 *addr;
IWL_DEBUG_MAC80211("enter\n"); IWL_DEBUG_MAC80211("enter\n");
...@@ -3011,9 +3009,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ...@@ -3011,9 +3009,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n"); IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
addr = sta ? sta->addr : iwl_bcast_addr;
addr = sta ? sta->addr : bcast_addr;
sta_id = iwl_find_station(priv, addr); sta_id = iwl_find_station(priv, addr);
if (sta_id == IWL_INVALID_STATION) { if (sta_id == IWL_INVALID_STATION) {
IWL_DEBUG_MAC80211("leave - %pM not in station map.\n", IWL_DEBUG_MAC80211("leave - %pM not in station map.\n",
......
...@@ -6500,10 +6500,8 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ...@@ -6500,10 +6500,8 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
{ {
struct iwl_priv *priv = hw->priv; struct iwl_priv *priv = hw->priv;
const u8 *addr; const u8 *addr;
int rc = 0; int ret;
u8 sta_id; u8 sta_id;
static const u8 bcast_addr[ETH_ALEN] =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
IWL_DEBUG_MAC80211("enter\n"); IWL_DEBUG_MAC80211("enter\n");
...@@ -6512,8 +6510,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ...@@ -6512,8 +6510,7 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
addr = sta ? sta->addr : bcast_addr; addr = sta ? sta->addr : iwl_bcast_addr;
sta_id = iwl3945_hw_find_station(priv, addr); sta_id = iwl3945_hw_find_station(priv, addr);
if (sta_id == IWL_INVALID_STATION) { if (sta_id == IWL_INVALID_STATION) {
IWL_DEBUG_MAC80211("leave - %pM not in station map.\n", IWL_DEBUG_MAC80211("leave - %pM not in station map.\n",
...@@ -6527,8 +6524,8 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ...@@ -6527,8 +6524,8 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
switch (cmd) { switch (cmd) {
case SET_KEY: case SET_KEY:
rc = iwl3945_update_sta_key_info(priv, key, sta_id); ret = iwl3945_update_sta_key_info(priv, key, sta_id);
if (!rc) { if (!ret) {
iwl3945_set_rxon_hwcrypto(priv, 1); iwl3945_set_rxon_hwcrypto(priv, 1);
iwl3945_commit_rxon(priv); iwl3945_commit_rxon(priv);
key->hw_key_idx = sta_id; key->hw_key_idx = sta_id;
...@@ -6537,21 +6534,21 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ...@@ -6537,21 +6534,21 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
} }
break; break;
case DISABLE_KEY: case DISABLE_KEY:
rc = iwl3945_clear_sta_key_info(priv, sta_id); ret = iwl3945_clear_sta_key_info(priv, sta_id);
if (!rc) { if (!ret) {
iwl3945_set_rxon_hwcrypto(priv, 0); iwl3945_set_rxon_hwcrypto(priv, 0);
iwl3945_commit_rxon(priv); iwl3945_commit_rxon(priv);
IWL_DEBUG_MAC80211("disable hwcrypto key\n"); IWL_DEBUG_MAC80211("disable hwcrypto key\n");
} }
break; break;
default: default:
rc = -EINVAL; ret = -EINVAL;
} }
IWL_DEBUG_MAC80211("leave\n"); IWL_DEBUG_MAC80211("leave\n");
mutex_unlock(&priv->mutex); mutex_unlock(&priv->mutex);
return rc; return ret;
} }
static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, u16 queue, static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment