Lines Matching defs:sdata

62 update_vlan_tailroom_need_count(struct ieee80211_sub_if_data *sdata, int delta)
66 if (sdata->vif.type != NL80211_IFTYPE_AP)
70 assert_key_lock(sdata->local);
74 list_for_each_entry_rcu(vlan, &sdata->u.ap.vlans, u.vlan.list)
80 static void increment_tailroom_need_count(struct ieee80211_sub_if_data *sdata)
101 assert_key_lock(sdata->local);
103 update_vlan_tailroom_need_count(sdata, 1);
105 if (!sdata->crypto_tx_tailroom_needed_cnt++) {
114 static void decrease_tailroom_need_count(struct ieee80211_sub_if_data *sdata,
117 assert_key_lock(sdata->local);
119 WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt < delta);
121 update_vlan_tailroom_need_count(sdata, -delta);
122 sdata->crypto_tx_tailroom_needed_cnt -= delta;
127 struct ieee80211_sub_if_data *sdata = key->sdata;
145 increment_tailroom_need_count(sdata);
169 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
180 ret = drv_set_key(key->local, SET_KEY, sdata,
189 decrease_tailroom_need_count(sdata, 1);
201 sdata_err(sdata,
232 struct ieee80211_sub_if_data *sdata;
247 sdata = key->sdata;
252 increment_tailroom_need_count(sdata);
255 ret = drv_set_key(key->local, DISABLE_KEY, sdata,
259 sdata_err(sdata,
342 ieee80211_flush_queues(local, old->sdata, false);
347 static void __ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata,
352 assert_key_lock(sdata->local);
355 key = key_mtx_dereference(sdata->local, sdata->keys[idx]);
358 rcu_assign_pointer(sdata->default_unicast_key, key);
359 ieee80211_check_fast_xmit_iface(sdata);
360 if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
361 drv_set_default_unicast_key(sdata->local, sdata, idx);
365 rcu_assign_pointer(sdata->default_multicast_key, key);
367 ieee80211_debugfs_key_update_default(sdata);
370 void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx,
373 mutex_lock(&sdata->local->key_mtx);
374 __ieee80211_set_default_key(sdata, idx, uni, multi);
375 mutex_unlock(&sdata->local->key_mtx);
379 __ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, int idx)
383 assert_key_lock(sdata->local);
387 key = key_mtx_dereference(sdata->local, sdata->keys[idx]);
389 rcu_assign_pointer(sdata->default_mgmt_key, key);
391 ieee80211_debugfs_key_update_default(sdata);
394 void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata,
397 mutex_lock(&sdata->local->key_mtx);
398 __ieee80211_set_default_mgmt_key(sdata, idx);
399 mutex_unlock(&sdata->local->key_mtx);
403 __ieee80211_set_default_beacon_key(struct ieee80211_sub_if_data *sdata, int idx)
407 assert_key_lock(sdata->local);
412 key = key_mtx_dereference(sdata->local, sdata->keys[idx]);
414 rcu_assign_pointer(sdata->default_beacon_key, key);
416 ieee80211_debugfs_key_update_default(sdata);
419 void ieee80211_set_default_beacon_key(struct ieee80211_sub_if_data *sdata,
422 mutex_lock(&sdata->local->key_mtx);
423 __ieee80211_set_default_beacon_key(sdata, idx);
424 mutex_unlock(&sdata->local->key_mtx);
427 static int ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
442 list_add_tail_rcu(&new->list, &sdata->key_list);
489 old == key_mtx_dereference(sdata->local,
490 sdata->default_unicast_key);
492 old == key_mtx_dereference(sdata->local,
493 sdata->default_multicast_key);
495 old == key_mtx_dereference(sdata->local,
496 sdata->default_mgmt_key);
498 old == key_mtx_dereference(sdata->local,
499 sdata->default_beacon_key);
502 __ieee80211_set_default_key(sdata, -1, true, false);
504 __ieee80211_set_default_key(sdata, -1, false, true);
506 __ieee80211_set_default_mgmt_key(sdata, -1);
508 __ieee80211_set_default_beacon_key(sdata, -1);
510 rcu_assign_pointer(sdata->keys[idx], new);
512 __ieee80211_set_default_key(sdata, new->conf.keyidx,
515 __ieee80211_set_default_key(sdata, new->conf.keyidx,
518 __ieee80211_set_default_mgmt_key(sdata,
521 __ieee80211_set_default_beacon_key(sdata,
727 struct ieee80211_sub_if_data *sdata = key->sdata;
733 sdata->crypto_tx_tailroom_pending_dec++;
734 schedule_delayed_work(&sdata->dec_tailroom_needed_wk,
737 decrease_tailroom_need_count(sdata, 1);
761 WARN_ON(key->sdata || key->local);
765 static bool ieee80211_key_identical(struct ieee80211_sub_if_data *sdata,
783 if (sdata->vif.type == NL80211_IFTYPE_STATION &&
799 struct ieee80211_sub_if_data *sdata,
811 bool delay_tailroom = sdata->vif.type == NL80211_IFTYPE_STATION;
814 mutex_lock(&sdata->local->key_mtx);
819 old_key = key_mtx_dereference(sdata->local, sta->ptk[idx]);
820 alt_key = key_mtx_dereference(sdata->local, sta->ptk[idx ^ 1]);
829 old_key = key_mtx_dereference(sdata->local, sta->gtk[idx]);
831 old_key = key_mtx_dereference(sdata->local, sdata->keys[idx]);
844 if (ieee80211_key_identical(sdata, old_key, key)) {
850 key->local = sdata->local;
851 key->sdata = sdata;
860 increment_tailroom_need_count(sdata);
862 ret = ieee80211_key_replace(sdata, sta, pairwise, old_key, key);
872 mutex_unlock(&sdata->local->key_mtx);
885 if (key->sdata)
886 ieee80211_key_replace(key->sdata, key->sta,
892 void ieee80211_reenable_keys(struct ieee80211_sub_if_data *sdata)
899 mutex_lock(&sdata->local->key_mtx);
901 sdata->crypto_tx_tailroom_needed_cnt = 0;
902 sdata->crypto_tx_tailroom_pending_dec = 0;
904 if (sdata->vif.type == NL80211_IFTYPE_AP) {
905 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) {
911 if (ieee80211_sdata_running(sdata)) {
912 list_for_each_entry(key, &sdata->key_list, list) {
913 increment_tailroom_need_count(sdata);
918 mutex_unlock(&sdata->local->key_mtx);
932 struct ieee80211_sub_if_data *sdata;
938 sdata = vif_to_sdata(vif);
939 list_for_each_entry_safe(key, tmp, &sdata->key_list, list)
940 iter(hw, &sdata->vif,
944 list_for_each_entry(sdata, &local->interfaces, list)
946 &sdata->key_list, list)
947 iter(hw, &sdata->vif,
957 struct ieee80211_sub_if_data *sdata,
967 list_for_each_entry_rcu(key, &sdata->key_list, list) {
974 iter(hw, &sdata->vif,
990 struct ieee80211_sub_if_data *sdata;
993 sdata = vif_to_sdata(vif);
994 _ieee80211_iter_keys_rcu(hw, sdata, iter, iter_data);
996 list_for_each_entry_rcu(sdata, &local->interfaces, list)
997 _ieee80211_iter_keys_rcu(hw, sdata, iter, iter_data);
1002 static void ieee80211_free_keys_iface(struct ieee80211_sub_if_data *sdata,
1007 decrease_tailroom_need_count(sdata,
1008 sdata->crypto_tx_tailroom_pending_dec);
1009 sdata->crypto_tx_tailroom_pending_dec = 0;
1011 ieee80211_debugfs_key_remove_mgmt_default(sdata);
1012 ieee80211_debugfs_key_remove_beacon_default(sdata);
1014 list_for_each_entry_safe(key, tmp, &sdata->key_list, list) {
1015 ieee80211_key_replace(key->sdata, key->sta,
1021 ieee80211_debugfs_key_update_default(sdata);
1024 void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata,
1027 struct ieee80211_local *local = sdata->local;
1033 cancel_delayed_work_sync(&sdata->dec_tailroom_needed_wk);
1037 ieee80211_free_keys_iface(sdata, &keys);
1039 if (sdata->vif.type == NL80211_IFTYPE_AP) {
1040 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
1049 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
1050 if (sdata->bss) {
1051 master = container_of(sdata->bss,
1055 WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt !=
1059 WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt ||
1060 sdata->crypto_tx_tailroom_pending_dec);
1063 if (sdata->vif.type == NL80211_IFTYPE_AP) {
1064 list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list)
1083 ieee80211_key_replace(key->sdata, key->sta,
1086 __ieee80211_key_destroy(key, key->sdata->vif.type ==
1094 ieee80211_key_replace(key->sdata, key->sta,
1097 __ieee80211_key_destroy(key, key->sdata->vif.type ==
1106 struct ieee80211_sub_if_data *sdata;
1108 sdata = container_of(wk, struct ieee80211_sub_if_data,
1127 mutex_lock(&sdata->local->key_mtx);
1128 decrease_tailroom_need_count(sdata,
1129 sdata->crypto_tx_tailroom_pending_dec);
1130 sdata->crypto_tx_tailroom_pending_dec = 0;
1131 mutex_unlock(&sdata->local->key_mtx);
1137 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
1139 trace_api_gtk_rekey_notify(sdata, bssid, replay_ctr);
1141 cfg80211_gtk_rekey_notify(sdata->dev, bssid, replay_ctr, gfp);
1272 increment_tailroom_need_count(key->sdata);
1283 struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
1284 struct ieee80211_local *local = sdata->local;
1300 if (sdata->u.mgd.mfp != IEEE80211_MFP_DISABLED)
1303 err = ieee80211_key_link(key, sdata, NULL);