@@ -101,8 +101,8 @@ static const u8 *iwl_mvm_find_max_pn(struct ieee80211_key_conf *key,
101
101
return ret ;
102
102
}
103
103
104
- struct wowlan_key_data {
105
- bool error , configure_keys ;
104
+ struct wowlan_key_reprogram_data {
105
+ bool error ;
106
106
int wep_key_idx ;
107
107
};
108
108
@@ -114,7 +114,7 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
114
114
{
115
115
struct iwl_mvm * mvm = IWL_MAC80211_GET_MVM (hw );
116
116
struct iwl_mvm_vif * mvmvif = iwl_mvm_vif_from_mac80211 (vif );
117
- struct wowlan_key_data * data = _data ;
117
+ struct wowlan_key_reprogram_data * data = _data ;
118
118
int ret ;
119
119
120
120
switch (key -> cipher ) {
@@ -152,18 +152,14 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
152
152
wkc .wep_key .key_offset = data -> wep_key_idx ;
153
153
}
154
154
155
- if (data -> configure_keys ) {
156
- mutex_lock (& mvm -> mutex );
157
- ret = iwl_mvm_send_cmd_pdu (mvm , WEP_KEY , 0 ,
158
- sizeof (wkc ), & wkc );
159
- data -> error = ret != 0 ;
160
-
161
- mvm -> ptk_ivlen = key -> iv_len ;
162
- mvm -> ptk_icvlen = key -> icv_len ;
163
- mvm -> gtk_ivlen = key -> iv_len ;
164
- mvm -> gtk_icvlen = key -> icv_len ;
165
- mutex_unlock (& mvm -> mutex );
166
- }
155
+ mutex_lock (& mvm -> mutex );
156
+ ret = iwl_mvm_send_cmd_pdu (mvm , WEP_KEY , 0 , sizeof (wkc ), & wkc );
157
+ data -> error = ret != 0 ;
158
+
159
+ mvm -> ptk_ivlen = key -> iv_len ;
160
+ mvm -> ptk_icvlen = key -> icv_len ;
161
+ mvm -> gtk_ivlen = key -> iv_len ;
162
+ mvm -> gtk_icvlen = key -> icv_len ;
167
163
168
164
/* don't upload key again */
169
165
return ;
@@ -190,30 +186,28 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw,
190
186
break ;
191
187
}
192
188
193
- if (data -> configure_keys ) {
194
- mutex_lock (& mvm -> mutex );
189
+ mutex_lock (& mvm -> mutex );
190
+ /*
191
+ * The D3 firmware hardcodes the key offset 0 as the key it
192
+ * uses to transmit packets to the AP, i.e. the PTK.
193
+ */
194
+ if (key -> flags & IEEE80211_KEY_FLAG_PAIRWISE ) {
195
+ mvm -> ptk_ivlen = key -> iv_len ;
196
+ mvm -> ptk_icvlen = key -> icv_len ;
197
+ ret = iwl_mvm_set_sta_key (mvm , vif , sta , key , 0 );
198
+ } else {
195
199
/*
196
- * The D3 firmware hardcodes the key offset 0 as the key it
197
- * uses to transmit packets to the AP, i.e. the PTK.
200
+ * firmware only supports TSC/RSC for a single key,
201
+ * so if there are multiple keep overwriting them
202
+ * with new ones -- this relies on mac80211 doing
203
+ * list_add_tail().
198
204
*/
199
- if (key -> flags & IEEE80211_KEY_FLAG_PAIRWISE ) {
200
- mvm -> ptk_ivlen = key -> iv_len ;
201
- mvm -> ptk_icvlen = key -> icv_len ;
202
- ret = iwl_mvm_set_sta_key (mvm , vif , sta , key , 0 );
203
- } else {
204
- /*
205
- * firmware only supports TSC/RSC for a single key,
206
- * so if there are multiple keep overwriting them
207
- * with new ones -- this relies on mac80211 doing
208
- * list_add_tail().
209
- */
210
- mvm -> gtk_ivlen = key -> iv_len ;
211
- mvm -> gtk_icvlen = key -> icv_len ;
212
- ret = iwl_mvm_set_sta_key (mvm , vif , sta , key , 1 );
213
- }
214
- mutex_unlock (& mvm -> mutex );
215
- data -> error = ret != 0 ;
205
+ mvm -> gtk_ivlen = key -> iv_len ;
206
+ mvm -> gtk_icvlen = key -> icv_len ;
207
+ ret = iwl_mvm_set_sta_key (mvm , vif , sta , key , 1 );
216
208
}
209
+ mutex_unlock (& mvm -> mutex );
210
+ data -> error = ret != 0 ;
217
211
}
218
212
219
213
struct wowlan_key_rsc_tsc_data {
@@ -839,30 +833,30 @@ static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm,
839
833
{
840
834
bool unified = fw_has_capa (& mvm -> fw -> ucode_capa ,
841
835
IWL_UCODE_TLV_CAPA_CNSLDTD_D3_D0_IMG );
842
- struct wowlan_key_data key_data = {
843
- .configure_keys = !unified ,
844
- };
836
+ struct wowlan_key_reprogram_data key_data = {};
845
837
struct iwl_mvm_vif * mvmvif = iwl_mvm_vif_from_mac80211 (vif );
846
838
int ret ;
847
839
u8 cmd_ver ;
848
840
size_t cmd_size ;
849
841
850
- /*
851
- * if we have to configure keys, call ieee80211_iter_keys(),
852
- * as we need non-atomic context in order to take the
853
- * required locks.
854
- */
855
- /*
856
- * Note that currently we don't use CMD_ASYNC in the iterator.
857
- * In case of key_data.configure_keys, all the configured commands
858
- * are SYNC, and iwl_mvm_wowlan_program_keys() will take care of
859
- * locking/unlocking mvm->mutex.
860
- */
861
- ieee80211_iter_keys (mvm -> hw , vif , iwl_mvm_wowlan_program_keys ,
862
- & key_data );
842
+ if (!unified ) {
843
+ /*
844
+ * if we have to configure keys, call ieee80211_iter_keys(),
845
+ * as we need non-atomic context in order to take the
846
+ * required locks.
847
+ */
848
+ /*
849
+ * Note that currently we don't use CMD_ASYNC in the iterator.
850
+ * In case of key_data.configure_keys, all the configured
851
+ * commands are SYNC, and iwl_mvm_wowlan_program_keys() will
852
+ * take care of locking/unlocking mvm->mutex.
853
+ */
854
+ ieee80211_iter_keys (mvm -> hw , vif , iwl_mvm_wowlan_program_keys ,
855
+ & key_data );
863
856
864
- if (key_data .error )
865
- return - EIO ;
857
+ if (key_data .error )
858
+ return - EIO ;
859
+ }
866
860
867
861
ret = iwl_mvm_wowlan_config_rsc_tsc (mvm , vif );
868
862
if (ret )
0 commit comments