Lines Matching refs:ctx
14 struct ieee80211_chanctx *ctx)
21 list_for_each_entry(sdata, &ctx->assigned_vifs, assigned_chanctx_list)
28 struct ieee80211_chanctx *ctx)
35 list_for_each_entry(sdata, &ctx->reserved_vifs, reserved_chanctx_list)
42 struct ieee80211_chanctx *ctx)
44 return ieee80211_chanctx_num_assigned(local, ctx) +
45 ieee80211_chanctx_num_reserved(local, ctx);
50 struct ieee80211_chanctx *ctx;
55 list_for_each_entry(ctx, &local->chanctx_list, list)
83 struct ieee80211_chanctx *ctx,
90 list_for_each_entry(sdata, &ctx->reserved_vifs,
106 struct ieee80211_chanctx *ctx,
113 list_for_each_entry(sdata, &ctx->assigned_vifs,
132 struct ieee80211_chanctx *ctx,
137 compat = ieee80211_chanctx_reserved_chandef(local, ctx, compat);
141 compat = ieee80211_chanctx_non_reserved_chandef(local, ctx, compat);
150 struct ieee80211_chanctx *ctx,
155 if (ieee80211_chanctx_combined_chandef(local, ctx, def))
158 if (!list_empty(&ctx->reserved_vifs) &&
159 ieee80211_chanctx_reserved_chandef(local, ctx, def))
170 struct ieee80211_chanctx *ctx;
177 list_for_each_entry(ctx, &local->chanctx_list, list) {
178 if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)
181 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE)
184 if (!ieee80211_chanctx_can_reserve_chandef(local, ctx,
188 return ctx;
210 * ctx->conf.min_def, we have to make sure to take
309 struct ieee80211_chanctx *ctx)
317 if (ctx->conf.def.width == NL80211_CHAN_WIDTH_5 ||
318 ctx->conf.def.width == NL80211_CHAN_WIDTH_10 ||
319 ctx->conf.def.width == NL80211_CHAN_WIDTH_1 ||
320 ctx->conf.def.width == NL80211_CHAN_WIDTH_2 ||
321 ctx->conf.def.width == NL80211_CHAN_WIDTH_4 ||
322 ctx->conf.def.width == NL80211_CHAN_WIDTH_8 ||
323 ctx->conf.def.width == NL80211_CHAN_WIDTH_16 ||
324 ctx->conf.radar_enabled) {
325 ctx->conf.min_def = ctx->conf.def;
329 max_bw = ieee80211_get_chanctx_max_required_bw(local, &ctx->conf);
332 min_def = ctx->conf.def;
336 if (cfg80211_chandef_identical(&ctx->conf.min_def, &min_def))
339 ctx->conf.min_def = min_def;
340 if (!ctx->driver_present)
343 drv_change_chanctx(local, ctx, IEEE80211_CHANCTX_CHANGE_MIN_WIDTH);
347 struct ieee80211_chanctx *ctx,
350 if (cfg80211_chandef_identical(&ctx->conf.def, chandef)) {
351 ieee80211_recalc_chanctx_min_def(local, ctx);
355 WARN_ON(!cfg80211_chandef_compatible(&ctx->conf.def, chandef));
357 ctx->conf.def = *chandef;
358 drv_change_chanctx(local, ctx, IEEE80211_CHANCTX_CHANGE_WIDTH);
359 ieee80211_recalc_chanctx_min_def(local, ctx);
372 struct ieee80211_chanctx *ctx;
379 list_for_each_entry(ctx, &local->chanctx_list, list) {
382 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACE_NONE)
385 if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE)
388 compat = cfg80211_chandef_compatible(&ctx->conf.def, chandef);
392 compat = ieee80211_chanctx_reserved_chandef(local, ctx,
397 ieee80211_change_chanctx(local, ctx, compat);
399 return ctx;
425 struct ieee80211_chanctx *ctx)
427 struct ieee80211_chanctx_conf *conf = &ctx->conf;
456 struct ieee80211_chanctx *ctx;
460 ctx = kzalloc(sizeof(*ctx) + local->hw.chanctx_data_size, GFP_KERNEL);
461 if (!ctx)
464 INIT_LIST_HEAD(&ctx->assigned_vifs);
465 INIT_LIST_HEAD(&ctx->reserved_vifs);
466 ctx->conf.def = *chandef;
467 ctx->conf.rx_chains_static = 1;
468 ctx->conf.rx_chains_dynamic = 1;
469 ctx->mode = mode;
470 ctx->conf.radar_enabled = false;
471 ieee80211_recalc_chanctx_min_def(local, ctx);
473 return ctx;
477 struct ieee80211_chanctx *ctx)
486 local->hw.conf.radar_enabled = ctx->conf.radar_enabled;
494 local->_oper_chandef = ctx->conf.def;
497 err = drv_add_chanctx(local, ctx);
512 struct ieee80211_chanctx *ctx;
518 ctx = ieee80211_alloc_chanctx(local, chandef, mode);
519 if (!ctx)
522 err = ieee80211_add_chanctx(local, ctx);
524 kfree(ctx);
528 list_add_rcu(&ctx->list, &local->chanctx_list);
529 return ctx;
533 struct ieee80211_chanctx *ctx)
561 drv_remove_chanctx(local, ctx);
568 struct ieee80211_chanctx *ctx)
572 WARN_ON_ONCE(ieee80211_chanctx_refcount(local, ctx) != 0);
574 list_del_rcu(&ctx->list);
575 ieee80211_del_chanctx(local, ctx);
576 kfree_rcu(ctx, rcu_head);
580 struct ieee80211_chanctx *ctx)
582 struct ieee80211_chanctx_conf *conf = &ctx->conf;
626 ieee80211_change_chanctx(local, ctx, compat);
848 struct ieee80211_chanctx *ctx = sdata->reserved_chanctx;
852 if (WARN_ON(!ctx))
858 if (ieee80211_chanctx_refcount(sdata->local, ctx) == 0) {
859 if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) {
860 if (WARN_ON(!ctx->replace_ctx))
863 WARN_ON(ctx->replace_ctx->replace_state !=
865 WARN_ON(ctx->replace_ctx->replace_ctx != ctx);
867 ctx->replace_ctx->replace_ctx = NULL;
868 ctx->replace_ctx->replace_state =
871 list_del_rcu(&ctx->list);
872 kfree_rcu(ctx, rcu_head);
874 ieee80211_free_chanctx(sdata->local, ctx);
887 struct ieee80211_chanctx *new_ctx, *curr_ctx, *ctx;
918 * Consider ctx1..3, vif1..6, each ctx has 2
928 list_for_each_entry(ctx, &local->chanctx_list,
930 if (ctx->replace_state !=
934 if (!list_empty(&ctx->reserved_vifs))
937 curr_ctx = ctx;
1197 struct ieee80211_chanctx *ctx, *old_ctx;
1208 list_for_each_entry(ctx, &local->chanctx_list, list) {
1209 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER)
1212 if (WARN_ON(!ctx->replace_ctx)) {
1217 list_for_each_entry(sdata, &ctx->reserved_vifs,
1226 vif_chsw[i].new_ctx = &ctx->conf;
1242 struct ieee80211_chanctx *ctx;
1248 list_for_each_entry(ctx, &local->chanctx_list, list) {
1249 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER)
1252 if (!list_empty(&ctx->replace_ctx->assigned_vifs))
1255 ieee80211_del_chanctx(local, ctx->replace_ctx);
1256 err = ieee80211_add_chanctx(local, ctx);
1264 WARN_ON(ieee80211_add_chanctx(local, ctx));
1265 list_for_each_entry_continue_reverse(ctx, &local->chanctx_list, list) {
1266 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER)
1269 if (!list_empty(&ctx->replace_ctx->assigned_vifs))
1272 ieee80211_del_chanctx(local, ctx);
1273 WARN_ON(ieee80211_add_chanctx(local, ctx->replace_ctx));
1282 struct ieee80211_chanctx *ctx, *ctx_tmp, *old_ctx;
1306 list_for_each_entry(ctx, &local->chanctx_list, list) {
1307 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER)
1310 if (WARN_ON(!ctx->replace_ctx)) {
1316 new_ctx = ctx;
1324 list_for_each_entry(sdata, &ctx->replace_ctx->assigned_vifs,
1345 ctx->conf.radar_enabled = false;
1346 list_for_each_entry(sdata, &ctx->reserved_vifs,
1364 ctx->conf.radar_enabled = true;
1405 list_for_each_entry(ctx, &local->chanctx_list, list) {
1406 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER)
1409 if (WARN_ON(!ctx->replace_ctx)) {
1414 list_for_each_entry(sdata, &ctx->reserved_vifs,
1421 rcu_assign_pointer(sdata->vif.chanctx_conf, &ctx->conf);
1443 ieee80211_recalc_chanctx_chantype(local, ctx);
1444 ieee80211_recalc_smps_chanctx(local, ctx);
1445 ieee80211_recalc_radar_chanctx(local, ctx);
1446 ieee80211_recalc_chanctx_min_def(local, ctx);
1448 list_for_each_entry_safe(sdata, sdata_tmp, &ctx->reserved_vifs,
1450 if (ieee80211_vif_get_chanctx(sdata) != ctx)
1455 &ctx->assigned_vifs);
1468 list_for_each_entry_safe(sdata, sdata_tmp, &ctx->reserved_vifs,
1474 if (WARN_ON(sdata->reserved_chanctx != ctx))
1502 list_for_each_entry_safe(ctx, ctx_tmp, &local->chanctx_list, list) {
1503 if (ctx->replace_state != IEEE80211_CHANCTX_WILL_BE_REPLACED)
1506 ctx->replace_ctx->replace_ctx = NULL;
1507 ctx->replace_ctx->replace_state =
1510 list_del_rcu(&ctx->list);
1511 kfree_rcu(ctx, rcu_head);
1517 list_for_each_entry(ctx, &local->chanctx_list, list) {
1518 if (ctx->replace_state != IEEE80211_CHANCTX_REPLACES_OTHER)
1521 list_for_each_entry_safe(sdata, sdata_tmp, &ctx->reserved_vifs,
1535 struct ieee80211_chanctx *ctx;
1545 ctx = container_of(conf, struct ieee80211_chanctx, conf);
1558 if (ieee80211_chanctx_refcount(local, ctx) == 0)
1559 ieee80211_free_chanctx(local, ctx);
1573 struct ieee80211_chanctx *ctx;
1600 ctx = ieee80211_find_chanctx(local, chandef, mode);
1601 if (!ctx)
1602 ctx = ieee80211_new_chanctx(local, chandef, mode);
1603 if (IS_ERR(ctx)) {
1604 ret = PTR_ERR(ctx);
1610 ret = ieee80211_assign_vif_chanctx(sdata, ctx);
1613 if (ieee80211_chanctx_refcount(local, ctx) == 0)
1614 ieee80211_free_chanctx(local, ctx);
1618 ieee80211_recalc_smps_chanctx(local, ctx);
1619 ieee80211_recalc_radar_chanctx(local, ctx);
1695 struct ieee80211_chanctx *ctx;
1722 ctx = container_of(conf, struct ieee80211_chanctx, conf);
1730 switch (ctx->replace_state) {
1732 if (!ieee80211_chanctx_reserved_chandef(local, ctx, compat)) {
1752 ieee80211_recalc_chanctx_chantype(local, ctx);
1799 struct ieee80211_chanctx *ctx;
1802 list_for_each_entry_rcu(ctx, &local->chanctx_list, list)
1803 if (ctx->driver_present)
1804 iter(hw, &ctx->conf, iter_data);