Commit 0fc8bb50 authored by Daniel Mack's avatar Daniel Mack Committed by Kalle Valo

wcn36xx: pass correct BSS index when deleting BSS keys

The firmware message to delete BSS keys expects a BSS index to be passed.
This field is currently hard-coded to 0. Fix this by passing in the index
we received from the firmware when the BSS was configured.

The encryption type in that message also needs to be set to what was used
when the key was set, so the assignment of vif_priv->encrypt_type is now
done after the firmware command was sent. This reportedly fixes the
following error in AP mode:

  wcn36xx: ERROR hal_remove_bsskey response failed err=6

Also, AFAIU, when a BSS is deleted, the firmware apparently drops all the
keys associated with it. Trying to remove the key explicitly afterwards
will hence lead to the following message:

  wcn36xx: ERROR hal_remove_bsskey response failed err=16

This is now suppressed with an extra check for the BSS index validity.
Signed-off-by: default avatarDaniel Mack <daniel@zonque.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent fa3440fa
...@@ -549,6 +549,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ...@@ -549,6 +549,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
} else { } else {
wcn36xx_smd_set_bsskey(wcn, wcn36xx_smd_set_bsskey(wcn,
vif_priv->encrypt_type, vif_priv->encrypt_type,
vif_priv->bss_index,
key_conf->keyidx, key_conf->keyidx,
key_conf->keylen, key_conf->keylen,
key); key);
...@@ -566,10 +567,13 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ...@@ -566,10 +567,13 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
break; break;
case DISABLE_KEY: case DISABLE_KEY:
if (!(IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags)) { if (!(IEEE80211_KEY_FLAG_PAIRWISE & key_conf->flags)) {
vif_priv->encrypt_type = WCN36XX_HAL_ED_NONE; if (vif_priv->bss_index != WCN36XX_HAL_BSS_INVALID_IDX)
wcn36xx_smd_remove_bsskey(wcn, wcn36xx_smd_remove_bsskey(wcn,
vif_priv->encrypt_type, vif_priv->encrypt_type,
vif_priv->bss_index,
key_conf->keyidx); key_conf->keyidx);
vif_priv->encrypt_type = WCN36XX_HAL_ED_NONE;
} else { } else {
sta_priv->is_data_encrypted = false; sta_priv->is_data_encrypted = false;
/* do not remove key if disassociated */ /* do not remove key if disassociated */
......
...@@ -1636,6 +1636,7 @@ int wcn36xx_smd_set_stakey(struct wcn36xx *wcn, ...@@ -1636,6 +1636,7 @@ int wcn36xx_smd_set_stakey(struct wcn36xx *wcn,
int wcn36xx_smd_set_bsskey(struct wcn36xx *wcn, int wcn36xx_smd_set_bsskey(struct wcn36xx *wcn,
enum ani_ed_type enc_type, enum ani_ed_type enc_type,
u8 bssidx,
u8 keyidx, u8 keyidx,
u8 keylen, u8 keylen,
u8 *key) u8 *key)
...@@ -1645,7 +1646,7 @@ int wcn36xx_smd_set_bsskey(struct wcn36xx *wcn, ...@@ -1645,7 +1646,7 @@ int wcn36xx_smd_set_bsskey(struct wcn36xx *wcn,
mutex_lock(&wcn->hal_mutex); mutex_lock(&wcn->hal_mutex);
INIT_HAL_MSG(msg_body, WCN36XX_HAL_SET_BSSKEY_REQ); INIT_HAL_MSG(msg_body, WCN36XX_HAL_SET_BSSKEY_REQ);
msg_body.bss_idx = 0; msg_body.bss_idx = bssidx;
msg_body.enc_type = enc_type; msg_body.enc_type = enc_type;
msg_body.num_keys = 1; msg_body.num_keys = 1;
msg_body.keys[0].id = keyidx; msg_body.keys[0].id = keyidx;
...@@ -1706,6 +1707,7 @@ int wcn36xx_smd_remove_stakey(struct wcn36xx *wcn, ...@@ -1706,6 +1707,7 @@ int wcn36xx_smd_remove_stakey(struct wcn36xx *wcn,
int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn, int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn,
enum ani_ed_type enc_type, enum ani_ed_type enc_type,
u8 bssidx,
u8 keyidx) u8 keyidx)
{ {
struct wcn36xx_hal_remove_bss_key_req_msg msg_body; struct wcn36xx_hal_remove_bss_key_req_msg msg_body;
...@@ -1713,7 +1715,7 @@ int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn, ...@@ -1713,7 +1715,7 @@ int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn,
mutex_lock(&wcn->hal_mutex); mutex_lock(&wcn->hal_mutex);
INIT_HAL_MSG(msg_body, WCN36XX_HAL_RMV_BSSKEY_REQ); INIT_HAL_MSG(msg_body, WCN36XX_HAL_RMV_BSSKEY_REQ);
msg_body.bss_idx = 0; msg_body.bss_idx = bssidx;
msg_body.enc_type = enc_type; msg_body.enc_type = enc_type;
msg_body.key_id = keyidx; msg_body.key_id = keyidx;
......
...@@ -97,6 +97,7 @@ int wcn36xx_smd_set_stakey(struct wcn36xx *wcn, ...@@ -97,6 +97,7 @@ int wcn36xx_smd_set_stakey(struct wcn36xx *wcn,
u8 sta_index); u8 sta_index);
int wcn36xx_smd_set_bsskey(struct wcn36xx *wcn, int wcn36xx_smd_set_bsskey(struct wcn36xx *wcn,
enum ani_ed_type enc_type, enum ani_ed_type enc_type,
u8 bssidx,
u8 keyidx, u8 keyidx,
u8 keylen, u8 keylen,
u8 *key); u8 *key);
...@@ -106,6 +107,7 @@ int wcn36xx_smd_remove_stakey(struct wcn36xx *wcn, ...@@ -106,6 +107,7 @@ int wcn36xx_smd_remove_stakey(struct wcn36xx *wcn,
u8 sta_index); u8 sta_index);
int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn, int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn,
enum ani_ed_type enc_type, enum ani_ed_type enc_type,
u8 bssidx,
u8 keyidx); u8 keyidx);
int wcn36xx_smd_enter_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif); int wcn36xx_smd_enter_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif);
int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif); int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn, struct ieee80211_vif *vif);
......
Markdown is supported
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