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()
302 struct ieee80211_chanctx *ctx) in ieee80211_recalc_chanctx_min_def() argument
310 if (ctx->conf.def.width == NL80211_CHAN_WIDTH_5 || in ieee80211_recalc_chanctx_min_def()
311 ctx->conf.def.width == NL80211_CHAN_WIDTH_10 || in ieee80211_recalc_chanctx_min_def()
312 ctx->conf.radar_enabled) { in ieee80211_recalc_chanctx_min_def()
313 ctx->conf.min_def = ctx->conf.def; in ieee80211_recalc_chanctx_min_def()
317 max_bw = ieee80211_get_chanctx_max_required_bw(local, &ctx->conf); in ieee80211_recalc_chanctx_min_def()
320 min_def = ctx->conf.def; in ieee80211_recalc_chanctx_min_def()
324 if (cfg80211_chandef_identical(&ctx->conf.min_def, &min_def)) in ieee80211_recalc_chanctx_min_def()
327 ctx->conf.min_def = min_def; in ieee80211_recalc_chanctx_min_def()
328 if (!ctx->driver_present) in ieee80211_recalc_chanctx_min_def()
331 drv_change_chanctx(local, ctx, IEEE80211_CHANCTX_CHANGE_MIN_WIDTH); in ieee80211_recalc_chanctx_min_def()
335 struct ieee80211_chanctx *ctx, in ieee80211_change_chanctx() argument
338 if (cfg80211_chandef_identical(&ctx->conf.def, chandef)) in ieee80211_change_chanctx()
341 WARN_ON(!cfg80211_chandef_compatible(&ctx->conf.def, chandef)); in ieee80211_change_chanctx()
343 ctx->conf.def = *chandef; in ieee80211_change_chanctx()
344 drv_change_chanctx(local, ctx, IEEE80211_CHANCTX_CHANGE_WIDTH); in ieee80211_change_chanctx()
345 ieee80211_recalc_chanctx_min_def(local, ctx); in ieee80211_change_chanctx()
358 struct ieee80211_chanctx *ctx; in ieee80211_find_chanctx() local
365 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_find_chanctx()
368 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACE_NONE) in ieee80211_find_chanctx()
371 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) in ieee80211_find_chanctx()
374 compat = cfg80211_chandef_compatible(&ctx->conf.def, chandef); in ieee80211_find_chanctx()
378 compat = ieee80211_chanctx_reserved_chandef(local, ctx, in ieee80211_find_chanctx()
383 ieee80211_change_chanctx(local, ctx, compat); in ieee80211_find_chanctx()
385 return ctx; in ieee80211_find_chanctx()
411 struct ieee80211_chanctx *ctx) in ieee80211_chanctx_radar_required() argument
413 struct ieee80211_chanctx_conf *conf = &ctx->conf; in ieee80211_chanctx_radar_required()
442 struct ieee80211_chanctx *ctx; in ieee80211_alloc_chanctx() local
446 ctx = kzalloc(sizeof(*ctx) + local->hw.chanctx_data_size, GFP_KERNEL); in ieee80211_alloc_chanctx()
447 if (!ctx) in ieee80211_alloc_chanctx()
450 INIT_LIST_HEAD(&ctx->assigned_vifs); in ieee80211_alloc_chanctx()
451 INIT_LIST_HEAD(&ctx->reserved_vifs); in ieee80211_alloc_chanctx()
452 ctx->conf.def = *chandef; in ieee80211_alloc_chanctx()
453 ctx->conf.rx_chains_static = 1; in ieee80211_alloc_chanctx()
454 ctx->conf.rx_chains_dynamic = 1; in ieee80211_alloc_chanctx()
455 ctx->mode = mode; in ieee80211_alloc_chanctx()
456 ctx->conf.radar_enabled = false; in ieee80211_alloc_chanctx()
457 ieee80211_recalc_chanctx_min_def(local, ctx); in ieee80211_alloc_chanctx()
459 return ctx; in ieee80211_alloc_chanctx()
463 struct ieee80211_chanctx *ctx) in ieee80211_add_chanctx() argument
472 local->hw.conf.radar_enabled = ctx->conf.radar_enabled; in ieee80211_add_chanctx()
480 local->_oper_chandef = ctx->conf.def; in ieee80211_add_chanctx()
483 err = drv_add_chanctx(local, ctx); in ieee80211_add_chanctx()
498 struct ieee80211_chanctx *ctx; in ieee80211_new_chanctx() local
504 ctx = ieee80211_alloc_chanctx(local, chandef, mode); in ieee80211_new_chanctx()
505 if (!ctx) in ieee80211_new_chanctx()
508 err = ieee80211_add_chanctx(local, ctx); in ieee80211_new_chanctx()
510 kfree(ctx); in ieee80211_new_chanctx()
514 list_add_rcu(&ctx->list, &local->chanctx_list); in ieee80211_new_chanctx()
515 return ctx; in ieee80211_new_chanctx()
519 struct ieee80211_chanctx *ctx) in ieee80211_del_chanctx() argument
539 drv_remove_chanctx(local, ctx); in ieee80211_del_chanctx()
546 struct ieee80211_chanctx *ctx) in ieee80211_free_chanctx() argument
550 WARN_ON_ONCE(ieee80211_chanctx_refcount(local, ctx) != 0); in ieee80211_free_chanctx()
552 list_del_rcu(&ctx->list); in ieee80211_free_chanctx()
553 ieee80211_del_chanctx(local, ctx); in ieee80211_free_chanctx()
554 kfree_rcu(ctx, rcu_head); in ieee80211_free_chanctx()
558 struct ieee80211_chanctx *ctx) in ieee80211_recalc_chanctx_chantype() argument
560 struct ieee80211_chanctx_conf *conf = &ctx->conf; in ieee80211_recalc_chanctx_chantype()
589 ieee80211_change_chanctx(local, ctx, compat); in ieee80211_recalc_chanctx_chantype()
805 struct ieee80211_chanctx *ctx = sdata->reserved_chanctx; in ieee80211_vif_unreserve_chanctx() local
809 if (WARN_ON(!ctx)) in ieee80211_vif_unreserve_chanctx()
815 if (ieee80211_chanctx_refcount(sdata->local, ctx) == 0) { in ieee80211_vif_unreserve_chanctx()
816 if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) { in ieee80211_vif_unreserve_chanctx()
817 if (WARN_ON(!ctx->replace_ctx)) in ieee80211_vif_unreserve_chanctx()
820 WARN_ON(ctx->replace_ctx->replace_state != in ieee80211_vif_unreserve_chanctx()
822 WARN_ON(ctx->replace_ctx->replace_ctx != ctx); in ieee80211_vif_unreserve_chanctx()
824 ctx->replace_ctx->replace_ctx = NULL; in ieee80211_vif_unreserve_chanctx()
825 ctx->replace_ctx->replace_state = in ieee80211_vif_unreserve_chanctx()
828 list_del_rcu(&ctx->list); in ieee80211_vif_unreserve_chanctx()
829 kfree_rcu(ctx, rcu_head); in ieee80211_vif_unreserve_chanctx()
831 ieee80211_free_chanctx(sdata->local, ctx); in ieee80211_vif_unreserve_chanctx()
844 struct ieee80211_chanctx *new_ctx, *curr_ctx, *ctx; in ieee80211_vif_reserve_chanctx() local
885 list_for_each_entry(ctx, &local->chanctx_list, in ieee80211_vif_reserve_chanctx()
887 if (ctx->replace_state != in ieee80211_vif_reserve_chanctx()
891 if (!list_empty(&ctx->reserved_vifs)) in ieee80211_vif_reserve_chanctx()
894 curr_ctx = ctx; in ieee80211_vif_reserve_chanctx()
1147 struct ieee80211_chanctx *ctx, *old_ctx; in ieee80211_chsw_switch_vifs() local
1158 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_chsw_switch_vifs()
1159 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_chsw_switch_vifs()
1162 if (WARN_ON(!ctx->replace_ctx)) { in ieee80211_chsw_switch_vifs()
1167 list_for_each_entry(sdata, &ctx->reserved_vifs, in ieee80211_chsw_switch_vifs()
1176 vif_chsw[i].new_ctx = &ctx->conf; in ieee80211_chsw_switch_vifs()
1192 struct ieee80211_chanctx *ctx; in ieee80211_chsw_switch_ctxs() local
1198 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_chsw_switch_ctxs()
1199 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_chsw_switch_ctxs()
1202 if (!list_empty(&ctx->replace_ctx->assigned_vifs)) in ieee80211_chsw_switch_ctxs()
1205 ieee80211_del_chanctx(local, ctx->replace_ctx); in ieee80211_chsw_switch_ctxs()
1206 err = ieee80211_add_chanctx(local, ctx); in ieee80211_chsw_switch_ctxs()
1214 WARN_ON(ieee80211_add_chanctx(local, ctx)); in ieee80211_chsw_switch_ctxs()
1215 list_for_each_entry_continue_reverse(ctx, &local->chanctx_list, list) { in ieee80211_chsw_switch_ctxs()
1216 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_chsw_switch_ctxs()
1219 if (!list_empty(&ctx->replace_ctx->assigned_vifs)) in ieee80211_chsw_switch_ctxs()
1222 ieee80211_del_chanctx(local, ctx); in ieee80211_chsw_switch_ctxs()
1223 WARN_ON(ieee80211_add_chanctx(local, ctx->replace_ctx)); in ieee80211_chsw_switch_ctxs()
1232 struct ieee80211_chanctx *ctx, *ctx_tmp, *old_ctx; in ieee80211_vif_use_reserved_switch() local
1256 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_vif_use_reserved_switch()
1257 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_vif_use_reserved_switch()
1260 if (WARN_ON(!ctx->replace_ctx)) { in ieee80211_vif_use_reserved_switch()
1266 new_ctx = ctx; in ieee80211_vif_use_reserved_switch()
1274 list_for_each_entry(sdata, &ctx->replace_ctx->assigned_vifs, in ieee80211_vif_use_reserved_switch()
1295 ctx->conf.radar_enabled = false; in ieee80211_vif_use_reserved_switch()
1296 list_for_each_entry(sdata, &ctx->reserved_vifs, in ieee80211_vif_use_reserved_switch()
1314 ctx->conf.radar_enabled = true; in ieee80211_vif_use_reserved_switch()
1357 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_vif_use_reserved_switch()
1358 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_vif_use_reserved_switch()
1361 if (WARN_ON(!ctx->replace_ctx)) { in ieee80211_vif_use_reserved_switch()
1366 list_for_each_entry(sdata, &ctx->reserved_vifs, in ieee80211_vif_use_reserved_switch()
1373 rcu_assign_pointer(sdata->vif.chanctx_conf, &ctx->conf); in ieee80211_vif_use_reserved_switch()
1393 ieee80211_recalc_chanctx_chantype(local, ctx); in ieee80211_vif_use_reserved_switch()
1394 ieee80211_recalc_smps_chanctx(local, ctx); in ieee80211_vif_use_reserved_switch()
1395 ieee80211_recalc_radar_chanctx(local, ctx); in ieee80211_vif_use_reserved_switch()
1396 ieee80211_recalc_chanctx_min_def(local, ctx); in ieee80211_vif_use_reserved_switch()
1398 list_for_each_entry_safe(sdata, sdata_tmp, &ctx->reserved_vifs, in ieee80211_vif_use_reserved_switch()
1400 if (ieee80211_vif_get_chanctx(sdata) != ctx) in ieee80211_vif_use_reserved_switch()
1405 &ctx->assigned_vifs); in ieee80211_vif_use_reserved_switch()
1418 list_for_each_entry_safe(sdata, sdata_tmp, &ctx->reserved_vifs, in ieee80211_vif_use_reserved_switch()
1424 if (WARN_ON(sdata->reserved_chanctx != ctx)) in ieee80211_vif_use_reserved_switch()
1452 list_for_each_entry_safe(ctx, ctx_tmp, &local->chanctx_list, list) { in ieee80211_vif_use_reserved_switch()
1453 if (ctx->replace_state != IEEE80211_CHANCTX_WILL_BE_REPLACED) in ieee80211_vif_use_reserved_switch()
1456 ctx->replace_ctx->replace_ctx = NULL; in ieee80211_vif_use_reserved_switch()
1457 ctx->replace_ctx->replace_state = in ieee80211_vif_use_reserved_switch()
1460 list_del_rcu(&ctx->list); in ieee80211_vif_use_reserved_switch()
1461 kfree_rcu(ctx, rcu_head); in ieee80211_vif_use_reserved_switch()
1467 list_for_each_entry(ctx, &local->chanctx_list, list) { in ieee80211_vif_use_reserved_switch()
1468 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER) in ieee80211_vif_use_reserved_switch()
1471 list_for_each_entry_safe(sdata, sdata_tmp, &ctx->reserved_vifs, in ieee80211_vif_use_reserved_switch()
1485 struct ieee80211_chanctx *ctx; in __ieee80211_vif_release_channel() local
1495 ctx = container_of(conf, struct ieee80211_chanctx, conf); in __ieee80211_vif_release_channel()
1508 if (ieee80211_chanctx_refcount(local, ctx) == 0) in __ieee80211_vif_release_channel()
1509 ieee80211_free_chanctx(local, ctx); in __ieee80211_vif_release_channel()
1523 struct ieee80211_chanctx *ctx; in ieee80211_vif_use_channel() local
1550 ctx = ieee80211_find_chanctx(local, chandef, mode); in ieee80211_vif_use_channel()
1551 if (!ctx) in ieee80211_vif_use_channel()
1552 ctx = ieee80211_new_chanctx(local, chandef, mode); in ieee80211_vif_use_channel()
1553 if (IS_ERR(ctx)) { in ieee80211_vif_use_channel()
1554 ret = PTR_ERR(ctx); in ieee80211_vif_use_channel()
1560 ret = ieee80211_assign_vif_chanctx(sdata, ctx); in ieee80211_vif_use_channel()
1563 if (ieee80211_chanctx_refcount(local, ctx) == 0) in ieee80211_vif_use_channel()
1564 ieee80211_free_chanctx(local, ctx); in ieee80211_vif_use_channel()
1568 ieee80211_recalc_smps_chanctx(local, ctx); in ieee80211_vif_use_channel()
1569 ieee80211_recalc_radar_chanctx(local, ctx); in ieee80211_vif_use_channel()
1648 struct ieee80211_chanctx *ctx; in ieee80211_vif_change_bandwidth() local
1675 ctx = container_of(conf, struct ieee80211_chanctx, conf); in ieee80211_vif_change_bandwidth()
1683 switch (ctx->replace_state) { in ieee80211_vif_change_bandwidth()
1685 if (!ieee80211_chanctx_reserved_chandef(local, ctx, compat)) { in ieee80211_vif_change_bandwidth()
1705 ieee80211_recalc_chanctx_chantype(local, ctx); in ieee80211_vif_change_bandwidth()
1752 struct ieee80211_chanctx *ctx; in ieee80211_iter_chan_contexts_atomic() local
1755 list_for_each_entry_rcu(ctx, &local->chanctx_list, list) in ieee80211_iter_chan_contexts_atomic()
1756 if (ctx->driver_present) in ieee80211_iter_chan_contexts_atomic()
1757 iter(hw, &ctx->conf, iter_data); in ieee80211_iter_chan_contexts_atomic()