From 4a360b6af470f0b8b7fa0808a315f46e2ed9f9cb Mon Sep 17 00:00:00 2001 From: Arik Nemtsov Date: Wed, 28 Nov 2012 11:42:48 +0200 Subject: [PATCH] --- yaml --- r: 352223 b: refs/heads/master c: 2fd8a3bb49400a4a0fe9d9cd9d49019e7a46403e h: refs/heads/master i: 352221: 2438d9efaccf449eeba3d8bd116cfbaad27b437a 352219: 4be47b83b61b7dac631ce941c41a9bf973569fca 352215: 00d09a688d992b25f96deab07f5cf5544ec31263 352207: f7bfd2b68a438c9165e3dbf4fb9fe34f99c27dd8 352191: 812fe48c29114d13836fecb6bc77631adf823264 v: v3 --- [refs] | 2 +- trunk/drivers/net/wireless/ti/wl18xx/main.c | 56 ++++++++++--------- trunk/drivers/net/wireless/ti/wl18xx/wl18xx.h | 4 +- 3 files changed, 34 insertions(+), 28 deletions(-) diff --git a/[refs] b/[refs] index 5987028fe9a7..d12df2375274 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0b70078c38fd1c8d69cf52b93e8c3bdd719a2394 +refs/heads/master: 2fd8a3bb49400a4a0fe9d9cd9d49019e7a46403e diff --git a/trunk/drivers/net/wireless/ti/wl18xx/main.c b/trunk/drivers/net/wireless/ti/wl18xx/main.c index ec331e9e0b74..6b57686c5b0d 100644 --- a/trunk/drivers/net/wireless/ti/wl18xx/main.c +++ b/trunk/drivers/net/wireless/ti/wl18xx/main.c @@ -1021,7 +1021,7 @@ static int wl18xx_hw_init(struct wl1271 *wl) /* (re)init private structures. Relevant on recovery as well. */ priv->last_fw_rls_idx = 0; - priv->extra_spare_vif_count = 0; + priv->extra_spare_key_count = 0; /* set the default amount of spare blocks in the bitmap */ ret = wl18xx_set_host_cfg_bitmap(wl, WL18XX_TX_HW_BLOCK_SPARE); @@ -1285,8 +1285,8 @@ static int wl18xx_get_spare_blocks(struct wl1271 *wl, bool is_gem) { struct wl18xx_priv *priv = wl->priv; - /* If we have VIFs requiring extra spare, indulge them */ - if (priv->extra_spare_vif_count) + /* If we have keys requiring extra spare, indulge them */ + if (priv->extra_spare_key_count) return WL18XX_TX_HW_EXTRA_BLOCK_SPARE; return WL18XX_TX_HW_BLOCK_SPARE; @@ -1298,42 +1298,48 @@ static int wl18xx_set_key(struct wl1271 *wl, enum set_key_cmd cmd, struct ieee80211_key_conf *key_conf) { struct wl18xx_priv *priv = wl->priv; - bool change_spare = false; + bool change_spare = false, special_enc; int ret; + wl1271_debug(DEBUG_CRYPT, "extra spare keys before: %d", + priv->extra_spare_key_count); + + special_enc = key_conf->cipher == WL1271_CIPHER_SUITE_GEM || + key_conf->cipher == WLAN_CIPHER_SUITE_TKIP; + + ret = wlcore_set_key(wl, cmd, vif, sta, key_conf); + if (ret < 0) + goto out; + /* - * when adding the first or removing the last GEM/TKIP interface, + * when adding the first or removing the last GEM/TKIP key, * we have to adjust the number of spare blocks. */ - change_spare = (key_conf->cipher == WL1271_CIPHER_SUITE_GEM || - key_conf->cipher == WLAN_CIPHER_SUITE_TKIP) && - ((priv->extra_spare_vif_count == 0 && cmd == SET_KEY) || - (priv->extra_spare_vif_count == 1 && cmd == DISABLE_KEY)); + if (special_enc) { + if (cmd == SET_KEY) { + /* first key */ + change_spare = (priv->extra_spare_key_count == 0); + priv->extra_spare_key_count++; + } else if (cmd == DISABLE_KEY) { + /* last key */ + change_spare = (priv->extra_spare_key_count == 1); + priv->extra_spare_key_count--; + } + } - /* no need to change spare - just regular set_key */ - if (!change_spare) - return wlcore_set_key(wl, cmd, vif, sta, key_conf); + wl1271_debug(DEBUG_CRYPT, "extra spare keys after: %d", + priv->extra_spare_key_count); - ret = wlcore_set_key(wl, cmd, vif, sta, key_conf); - if (ret < 0) + if (!change_spare) goto out; /* key is now set, change the spare blocks */ - if (cmd == SET_KEY) { + if (priv->extra_spare_key_count) ret = wl18xx_set_host_cfg_bitmap(wl, WL18XX_TX_HW_EXTRA_BLOCK_SPARE); - if (ret < 0) - goto out; - - priv->extra_spare_vif_count++; - } else { + else ret = wl18xx_set_host_cfg_bitmap(wl, WL18XX_TX_HW_BLOCK_SPARE); - if (ret < 0) - goto out; - - priv->extra_spare_vif_count--; - } out: return ret; diff --git a/trunk/drivers/net/wireless/ti/wl18xx/wl18xx.h b/trunk/drivers/net/wireless/ti/wl18xx/wl18xx.h index e6ea78c7da36..b6739e79efcf 100644 --- a/trunk/drivers/net/wireless/ti/wl18xx/wl18xx.h +++ b/trunk/drivers/net/wireless/ti/wl18xx/wl18xx.h @@ -49,8 +49,8 @@ struct wl18xx_priv { /* Index of last released Tx desc in FW */ u8 last_fw_rls_idx; - /* number of VIFs requiring extra spare mem-blocks */ - int extra_spare_vif_count; + /* number of keys requiring extra spare mem-blocks */ + int extra_spare_key_count; }; #define WL18XX_FW_MAX_TX_STATUS_DESC 33