Lines Matching refs:ctx

13 					  struct ieee80211_chanctx *ctx)  in ieee80211_chanctx_num_assigned()  argument
20 list_for_each_entry(sdata, &ctx->assigned_vifs, assigned_chanctx_list) in ieee80211_chanctx_num_assigned()
27 struct ieee80211_chanctx *ctx) in ieee80211_chanctx_num_reserved() argument
34 list_for_each_entry(sdata, &ctx->reserved_vifs, reserved_chanctx_list) in ieee80211_chanctx_num_reserved()
41 struct ieee80211_chanctx *ctx) in ieee80211_chanctx_refcount() argument
43 return ieee80211_chanctx_num_assigned(local, ctx) + in ieee80211_chanctx_refcount()
44 ieee80211_chanctx_num_reserved(local, ctx); in ieee80211_chanctx_refcount()
49 struct ieee80211_chanctx *ctx; in ieee80211_num_chanctx() local
54 list_for_each_entry(ctx, &local->chanctx_list, list) in ieee80211_num_chanctx()
82 struct ieee80211_chanctx *ctx, in ieee80211_chanctx_reserved_chandef() argument
89 list_for_each_entry(sdata, &ctx->reserved_vifs, in ieee80211_chanctx_reserved_chandef()
105 struct ieee80211_chanctx *ctx, in ieee80211_chanctx_non_reserved_chandef() argument
112 list_for_each_entry(sdata, &ctx->assigned_vifs, in ieee80211_chanctx_non_reserved_chandef()
131 struct ieee80211_chanctx *ctx, in ieee80211_chanctx_combined_chandef() argument
136 compat = ieee80211_chanctx_reserved_chandef(local, ctx, compat); in ieee80211_chanctx_combined_chandef()
140 compat = ieee80211_chanctx_non_reserved_chandef(local, ctx, compat); in ieee80211_chanctx_combined_chandef()
149 struct ieee80211_chanctx *ctx, in ieee80211_chanctx_can_reserve_chandef() argument
154 if (ieee80211_chanctx_combined_chandef(local, ctx, def)) in ieee80211_chanctx_can_reserve_chandef()
157 if (!list_empty(&ctx->reserved_vifs) && in ieee80211_chanctx_can_reserve_chandef()
158 ieee80211_chanctx_reserved_chandef(local, ctx, def)) in ieee80211_chanctx_can_reserve_chandef()
169 struct ieee80211_chanctx *ctx; in ieee80211_find_reservation_chanctx() local
176 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_find_reservation_chanctx()
177 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_find_reservation_chanctx()
180 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) in ieee80211_find_reservation_chanctx()
183 if (!ieee80211_chanctx_can_reserve_chandef(local, ctx, in ieee80211_find_reservation_chanctx()
187 return ctx; in ieee80211_find_reservation_chanctx()
310 struct ieee80211_chanctx *ctx) in ieee80211_recalc_chanctx_min_def() argument
318 if (ctx->conf.def.width == NL80211_CHAN_WIDTH_5 || in ieee80211_recalc_chanctx_min_def()
319 ctx->conf.def.width == NL80211_CHAN_WIDTH_10 || in ieee80211_recalc_chanctx_min_def()
320 ctx->conf.radar_enabled) { in ieee80211_recalc_chanctx_min_def()
321 ctx->conf.min_def = ctx->conf.def; in ieee80211_recalc_chanctx_min_def()
325 max_bw = ieee80211_get_chanctx_max_required_bw(local, &ctx->conf); in ieee80211_recalc_chanctx_min_def()
328 min_def = ctx->conf.def; in ieee80211_recalc_chanctx_min_def()
332 if (cfg80211_chandef_identical(&ctx->conf.min_def, &min_def)) in ieee80211_recalc_chanctx_min_def()
335 ctx->conf.min_def = min_def; in ieee80211_recalc_chanctx_min_def()
336 if (!ctx->driver_present) in ieee80211_recalc_chanctx_min_def()
339 drv_change_chanctx(local, ctx, IEEE80211_CHANCTX_CHANGE_MIN_WIDTH); in ieee80211_recalc_chanctx_min_def()
343 struct ieee80211_chanctx *ctx, in ieee80211_change_chanctx() argument
346 if (cfg80211_chandef_identical(&ctx->conf.def, chandef)) in ieee80211_change_chanctx()
349 WARN_ON(!cfg80211_chandef_compatible(&ctx->conf.def, chandef)); in ieee80211_change_chanctx()
351 ctx->conf.def = *chandef; in ieee80211_change_chanctx()
352 drv_change_chanctx(local, ctx, IEEE80211_CHANCTX_CHANGE_WIDTH); in ieee80211_change_chanctx()
353 ieee80211_recalc_chanctx_min_def(local, ctx); in ieee80211_change_chanctx()
366 struct ieee80211_chanctx *ctx; in ieee80211_find_chanctx() local
373 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_find_chanctx()
376 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACE_NONE) in ieee80211_find_chanctx()
379 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) in ieee80211_find_chanctx()
382 compat = cfg80211_chandef_compatible(&ctx->conf.def, chandef); in ieee80211_find_chanctx()
386 compat = ieee80211_chanctx_reserved_chandef(local, ctx, in ieee80211_find_chanctx()
391 ieee80211_change_chanctx(local, ctx, compat); in ieee80211_find_chanctx()
393 return ctx; in ieee80211_find_chanctx()
419 struct ieee80211_chanctx *ctx) in ieee80211_chanctx_radar_required() argument
421 struct ieee80211_chanctx_conf *conf = &ctx->conf; in ieee80211_chanctx_radar_required()
450 struct ieee80211_chanctx *ctx; in ieee80211_alloc_chanctx() local
454 ctx = kzalloc(sizeof(*ctx) + local->hw.chanctx_data_size, GFP_KERNEL); in ieee80211_alloc_chanctx()
455 if (!ctx) in ieee80211_alloc_chanctx()
458 INIT_LIST_HEAD(&ctx->assigned_vifs); in ieee80211_alloc_chanctx()
459 INIT_LIST_HEAD(&ctx->reserved_vifs); in ieee80211_alloc_chanctx()
460 ctx->conf.def = *chandef; in ieee80211_alloc_chanctx()
461 ctx->conf.rx_chains_static = 1; in ieee80211_alloc_chanctx()
462 ctx->conf.rx_chains_dynamic = 1; in ieee80211_alloc_chanctx()
463 ctx->mode = mode; in ieee80211_alloc_chanctx()
464 ctx->conf.radar_enabled = false; in ieee80211_alloc_chanctx()
465 ieee80211_recalc_chanctx_min_def(local, ctx); in ieee80211_alloc_chanctx()
467 return ctx; in ieee80211_alloc_chanctx()
471 struct ieee80211_chanctx *ctx) in ieee80211_add_chanctx() argument
480 local->hw.conf.radar_enabled = ctx->conf.radar_enabled; in ieee80211_add_chanctx()
488 local->_oper_chandef = ctx->conf.def; in ieee80211_add_chanctx()
491 err = drv_add_chanctx(local, ctx); in ieee80211_add_chanctx()
506 struct ieee80211_chanctx *ctx; in ieee80211_new_chanctx() local
512 ctx = ieee80211_alloc_chanctx(local, chandef, mode); in ieee80211_new_chanctx()
513 if (!ctx) in ieee80211_new_chanctx()
516 err = ieee80211_add_chanctx(local, ctx); in ieee80211_new_chanctx()
518 kfree(ctx); in ieee80211_new_chanctx()
522 list_add_rcu(&ctx->list, &local->chanctx_list); in ieee80211_new_chanctx()
523 return ctx; in ieee80211_new_chanctx()
527 struct ieee80211_chanctx *ctx) in ieee80211_del_chanctx() argument
547 drv_remove_chanctx(local, ctx); in ieee80211_del_chanctx()
554 struct ieee80211_chanctx *ctx) in ieee80211_free_chanctx() argument
558 WARN_ON_ONCE(ieee80211_chanctx_refcount(local, ctx) != 0); in ieee80211_free_chanctx()
560 list_del_rcu(&ctx->list); in ieee80211_free_chanctx()
561 ieee80211_del_chanctx(local, ctx); in ieee80211_free_chanctx()
562 kfree_rcu(ctx, rcu_head); in ieee80211_free_chanctx()
566 struct ieee80211_chanctx *ctx) in ieee80211_recalc_chanctx_chantype() argument
568 struct ieee80211_chanctx_conf *conf = &ctx->conf; in ieee80211_recalc_chanctx_chantype()
612 ieee80211_change_chanctx(local, ctx, compat); in ieee80211_recalc_chanctx_chantype()
830 struct ieee80211_chanctx *ctx = sdata->reserved_chanctx; in ieee80211_vif_unreserve_chanctx() local
834 if (WARN_ON(!ctx)) in ieee80211_vif_unreserve_chanctx()
840 if (ieee80211_chanctx_refcount(sdata->local, ctx) == 0) { in ieee80211_vif_unreserve_chanctx()
841 if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) { in ieee80211_vif_unreserve_chanctx()
842 if (WARN_ON(!ctx->replace_ctx)) in ieee80211_vif_unreserve_chanctx()
845 WARN_ON(ctx->replace_ctx->replace_state != in ieee80211_vif_unreserve_chanctx()
847 WARN_ON(ctx->replace_ctx->replace_ctx != ctx); in ieee80211_vif_unreserve_chanctx()
849 ctx->replace_ctx->replace_ctx = NULL; in ieee80211_vif_unreserve_chanctx()
850 ctx->replace_ctx->replace_state = in ieee80211_vif_unreserve_chanctx()
853 list_del_rcu(&ctx->list); in ieee80211_vif_unreserve_chanctx()
854 kfree_rcu(ctx, rcu_head); in ieee80211_vif_unreserve_chanctx()
856 ieee80211_free_chanctx(sdata->local, ctx); in ieee80211_vif_unreserve_chanctx()
869 struct ieee80211_chanctx *new_ctx, *curr_ctx, *ctx; in ieee80211_vif_reserve_chanctx() local
910 list_for_each_entry(ctx, &local->chanctx_list, in ieee80211_vif_reserve_chanctx()
912 if (ctx->replace_state != in ieee80211_vif_reserve_chanctx()
916 if (!list_empty(&ctx->reserved_vifs)) in ieee80211_vif_reserve_chanctx()
919 curr_ctx = ctx; in ieee80211_vif_reserve_chanctx()
1178 struct ieee80211_chanctx *ctx, *old_ctx; in ieee80211_chsw_switch_vifs() local
1189 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_chsw_switch_vifs()
1190 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_chsw_switch_vifs()
1193 if (WARN_ON(!ctx->replace_ctx)) { in ieee80211_chsw_switch_vifs()
1198 list_for_each_entry(sdata, &ctx->reserved_vifs, in ieee80211_chsw_switch_vifs()
1207 vif_chsw[i].new_ctx = &ctx->conf; in ieee80211_chsw_switch_vifs()
1223 struct ieee80211_chanctx *ctx; in ieee80211_chsw_switch_ctxs() local
1229 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_chsw_switch_ctxs()
1230 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_chsw_switch_ctxs()
1233 if (!list_empty(&ctx->replace_ctx->assigned_vifs)) in ieee80211_chsw_switch_ctxs()
1236 ieee80211_del_chanctx(local, ctx->replace_ctx); in ieee80211_chsw_switch_ctxs()
1237 err = ieee80211_add_chanctx(local, ctx); in ieee80211_chsw_switch_ctxs()
1245 WARN_ON(ieee80211_add_chanctx(local, ctx)); in ieee80211_chsw_switch_ctxs()
1246 list_for_each_entry_continue_reverse(ctx, &local->chanctx_list, list) { in ieee80211_chsw_switch_ctxs()
1247 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_chsw_switch_ctxs()
1250 if (!list_empty(&ctx->replace_ctx->assigned_vifs)) in ieee80211_chsw_switch_ctxs()
1253 ieee80211_del_chanctx(local, ctx); in ieee80211_chsw_switch_ctxs()
1254 WARN_ON(ieee80211_add_chanctx(local, ctx->replace_ctx)); in ieee80211_chsw_switch_ctxs()
1263 struct ieee80211_chanctx *ctx, *ctx_tmp, *old_ctx; in ieee80211_vif_use_reserved_switch() local
1287 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_vif_use_reserved_switch()
1288 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_vif_use_reserved_switch()
1291 if (WARN_ON(!ctx->replace_ctx)) { in ieee80211_vif_use_reserved_switch()
1297 new_ctx = ctx; in ieee80211_vif_use_reserved_switch()
1305 list_for_each_entry(sdata, &ctx->replace_ctx->assigned_vifs, in ieee80211_vif_use_reserved_switch()
1326 ctx->conf.radar_enabled = false; in ieee80211_vif_use_reserved_switch()
1327 list_for_each_entry(sdata, &ctx->reserved_vifs, in ieee80211_vif_use_reserved_switch()
1345 ctx->conf.radar_enabled = true; in ieee80211_vif_use_reserved_switch()
1388 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_vif_use_reserved_switch()
1389 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_vif_use_reserved_switch()
1392 if (WARN_ON(!ctx->replace_ctx)) { in ieee80211_vif_use_reserved_switch()
1397 list_for_each_entry(sdata, &ctx->reserved_vifs, in ieee80211_vif_use_reserved_switch()
1404 rcu_assign_pointer(sdata->vif.chanctx_conf, &ctx->conf); in ieee80211_vif_use_reserved_switch()
1426 ieee80211_recalc_chanctx_chantype(local, ctx); in ieee80211_vif_use_reserved_switch()
1427 ieee80211_recalc_smps_chanctx(local, ctx); in ieee80211_vif_use_reserved_switch()
1428 ieee80211_recalc_radar_chanctx(local, ctx); in ieee80211_vif_use_reserved_switch()
1429 ieee80211_recalc_chanctx_min_def(local, ctx); in ieee80211_vif_use_reserved_switch()
1431 list_for_each_entry_safe(sdata, sdata_tmp, &ctx->reserved_vifs, in ieee80211_vif_use_reserved_switch()
1433 if (ieee80211_vif_get_chanctx(sdata) != ctx) in ieee80211_vif_use_reserved_switch()
1438 &ctx->assigned_vifs); in ieee80211_vif_use_reserved_switch()
1451 list_for_each_entry_safe(sdata, sdata_tmp, &ctx->reserved_vifs, in ieee80211_vif_use_reserved_switch()
1457 if (WARN_ON(sdata->reserved_chanctx != ctx)) in ieee80211_vif_use_reserved_switch()
1485 list_for_each_entry_safe(ctx, ctx_tmp, &local->chanctx_list, list) { in ieee80211_vif_use_reserved_switch()
1486 if (ctx->replace_state != IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_vif_use_reserved_switch()
1489 ctx->replace_ctx->replace_ctx = NULL; in ieee80211_vif_use_reserved_switch()
1490 ctx->replace_ctx->replace_state = in ieee80211_vif_use_reserved_switch()
1493 list_del_rcu(&ctx->list); in ieee80211_vif_use_reserved_switch()
1494 kfree_rcu(ctx, rcu_head); in ieee80211_vif_use_reserved_switch()
1500 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_vif_use_reserved_switch()
1501 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_vif_use_reserved_switch()
1504 list_for_each_entry_safe(sdata, sdata_tmp, &ctx->reserved_vifs, in ieee80211_vif_use_reserved_switch()
1518 struct ieee80211_chanctx *ctx; in __ieee80211_vif_release_channel() local
1528 ctx = container_of(conf, struct ieee80211_chanctx, conf); in __ieee80211_vif_release_channel()
1541 if (ieee80211_chanctx_refcount(local, ctx) == 0) in __ieee80211_vif_release_channel()
1542 ieee80211_free_chanctx(local, ctx); in __ieee80211_vif_release_channel()
1556 struct ieee80211_chanctx *ctx; in ieee80211_vif_use_channel() local
1583 ctx = ieee80211_find_chanctx(local, chandef, mode); in ieee80211_vif_use_channel()
1584 if (!ctx) in ieee80211_vif_use_channel()
1585 ctx = ieee80211_new_chanctx(local, chandef, mode); in ieee80211_vif_use_channel()
1586 if (IS_ERR(ctx)) { in ieee80211_vif_use_channel()
1587 ret = PTR_ERR(ctx); in ieee80211_vif_use_channel()
1593 ret = ieee80211_assign_vif_chanctx(sdata, ctx); in ieee80211_vif_use_channel()
1596 if (ieee80211_chanctx_refcount(local, ctx) == 0) in ieee80211_vif_use_channel()
1597 ieee80211_free_chanctx(local, ctx); in ieee80211_vif_use_channel()
1601 ieee80211_recalc_smps_chanctx(local, ctx); in ieee80211_vif_use_channel()
1602 ieee80211_recalc_radar_chanctx(local, ctx); in ieee80211_vif_use_channel()
1681 struct ieee80211_chanctx *ctx; in ieee80211_vif_change_bandwidth() local
1708 ctx = container_of(conf, struct ieee80211_chanctx, conf); in ieee80211_vif_change_bandwidth()
1716 switch (ctx->replace_state) { in ieee80211_vif_change_bandwidth()
1718 if (!ieee80211_chanctx_reserved_chandef(local, ctx, compat)) { in ieee80211_vif_change_bandwidth()
1738 ieee80211_recalc_chanctx_chantype(local, ctx); in ieee80211_vif_change_bandwidth()
1785 struct ieee80211_chanctx *ctx; in ieee80211_iter_chan_contexts_atomic() local
1788 list_for_each_entry_rcu(ctx, &local->chanctx_list, list) in ieee80211_iter_chan_contexts_atomic()
1789 if (ctx->driver_present) in ieee80211_iter_chan_contexts_atomic()
1790 iter(hw, &ctx->conf, iter_data); in ieee80211_iter_chan_contexts_atomic()