Lines Matching refs:local

15 static int ieee80211_chanctx_num_assigned(struct ieee80211_local *local,
21 lockdep_assert_wiphy(local->hw.wiphy);
29 static int ieee80211_chanctx_num_reserved(struct ieee80211_local *local,
35 lockdep_assert_wiphy(local->hw.wiphy);
43 int ieee80211_chanctx_refcount(struct ieee80211_local *local,
46 return ieee80211_chanctx_num_assigned(local, ctx) +
47 ieee80211_chanctx_num_reserved(local, ctx);
50 static int ieee80211_num_chanctx(struct ieee80211_local *local)
55 lockdep_assert_wiphy(local->hw.wiphy);
57 list_for_each_entry(ctx, &local->chanctx_list, list)
63 static bool ieee80211_can_create_new_chanctx(struct ieee80211_local *local)
65 lockdep_assert_wiphy(local->hw.wiphy);
67 return ieee80211_num_chanctx(local) < ieee80211_max_num_channels(local);
73 struct ieee80211_local *local __maybe_unused = link->sdata->local;
77 lockdep_is_held(&local->hw.wiphy->mtx));
136 ieee80211_chanctx_reserved_chanreq(struct ieee80211_local *local,
143 lockdep_assert_wiphy(local->hw.wiphy);
158 ieee80211_chanctx_non_reserved_chandef(struct ieee80211_local *local,
166 lockdep_assert_wiphy(local->hw.wiphy);
184 ieee80211_chanctx_can_reserve(struct ieee80211_local *local,
190 lockdep_assert_wiphy(local->hw.wiphy);
192 if (!ieee80211_chanctx_reserved_chanreq(local, ctx, req, &tmp))
195 if (!ieee80211_chanctx_non_reserved_chandef(local, ctx, req, &tmp))
199 ieee80211_chanctx_reserved_chanreq(local, ctx, req, &tmp))
206 ieee80211_find_reservation_chanctx(struct ieee80211_local *local,
212 lockdep_assert_wiphy(local->hw.wiphy);
217 list_for_each_entry(ctx, &local->chanctx_list, list) {
224 if (!ieee80211_chanctx_can_reserve(local, ctx, chanreq))
239 link_sta = wiphy_dereference(sta->local->hw.wiphy, sta->link[link_id]);
284 list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) {
296 ieee80211_get_chanctx_max_required_bw(struct ieee80211_local *local,
304 for_each_sdata_link(local, link) {
346 sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata);
360 _ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local,
367 lockdep_assert_wiphy(local->hw.wiphy);
382 max_bw = ieee80211_get_chanctx_max_required_bw(local, ctx, rsvd_for);
402 static void ieee80211_chan_bw_change(struct ieee80211_local *local,
408 local->hw.wiphy->bands[ctx->conf.def.chan->band];
411 list_for_each_entry_rcu(sta, &local->sta_list,
447 rate_control_rate_update(local, sband, sta, link_id,
459 void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local,
463 u32 changed = _ieee80211_recalc_chanctx_min_def(local, ctx, rsvd_for);
469 ieee80211_chan_bw_change(local, ctx, true);
471 drv_change_chanctx(local, ctx, changed);
474 ieee80211_chan_bw_change(local, ctx, false);
477 static void _ieee80211_change_chanctx(struct ieee80211_local *local,
508 ieee80211_chan_bw_change(local, old_ctx, true);
511 ieee80211_recalc_chanctx_min_def(local, ctx, rsvd_for);
515 WARN_ON(ieee80211_chanctx_refcount(local, ctx) > 1 &&
518 ieee80211_remove_wbrf(local, &ctx->conf.def);
532 changed |= _ieee80211_recalc_chanctx_min_def(local, ctx, rsvd_for);
534 ieee80211_add_wbrf(local, &ctx->conf.def);
536 drv_change_chanctx(local, ctx, changed);
539 ieee80211_chan_bw_change(local, old_ctx, false);
542 static void ieee80211_change_chanctx(struct ieee80211_local *local,
547 _ieee80211_change_chanctx(local, ctx, old_ctx, chanreq, NULL);
551 ieee80211_find_chanctx(struct ieee80211_local *local,
558 lockdep_assert_wiphy(local->hw.wiphy);
563 list_for_each_entry(ctx, &local->chanctx_list, list) {
576 compat = ieee80211_chanctx_reserved_chanreq(local, ctx,
581 ieee80211_change_chanctx(local, ctx, ctx, compat);
589 bool ieee80211_is_radar_required(struct ieee80211_local *local)
593 lockdep_assert_wiphy(local->hw.wiphy);
595 for_each_sdata_link(local, link) {
604 ieee80211_chanctx_radar_required(struct ieee80211_local *local,
610 lockdep_assert_wiphy(local->hw.wiphy);
612 for_each_sdata_link(local, link) {
624 ieee80211_alloc_chanctx(struct ieee80211_local *local,
630 lockdep_assert_wiphy(local->hw.wiphy);
632 ctx = kzalloc(sizeof(*ctx) + local->hw.chanctx_data_size, GFP_KERNEL);
644 _ieee80211_recalc_chanctx_min_def(local, ctx, NULL);
649 static int ieee80211_add_chanctx(struct ieee80211_local *local,
655 lockdep_assert_wiphy(local->hw.wiphy);
657 ieee80211_add_wbrf(local, &ctx->conf.def);
660 changed = ieee80211_idle_off(local);
662 ieee80211_hw_config(local, changed);
664 err = drv_add_chanctx(local, ctx);
666 ieee80211_recalc_idle(local);
674 ieee80211_new_chanctx(struct ieee80211_local *local,
681 lockdep_assert_wiphy(local->hw.wiphy);
683 ctx = ieee80211_alloc_chanctx(local, chanreq, mode);
687 err = ieee80211_add_chanctx(local, ctx);
693 list_add_rcu(&ctx->list, &local->chanctx_list);
697 static void ieee80211_del_chanctx(struct ieee80211_local *local,
700 lockdep_assert_wiphy(local->hw.wiphy);
702 drv_remove_chanctx(local, ctx);
704 ieee80211_recalc_idle(local);
706 ieee80211_remove_wbrf(local, &ctx->conf.def);
709 static void ieee80211_free_chanctx(struct ieee80211_local *local,
712 lockdep_assert_wiphy(local->hw.wiphy);
714 WARN_ON_ONCE(ieee80211_chanctx_refcount(local, ctx) != 0);
717 ieee80211_del_chanctx(local, ctx);
721 void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local,
730 lockdep_assert_wiphy(local->hw.wiphy);
732 for_each_sdata_link(local, link) {
756 list_for_each_entry(sta, &local->sta_list, list) {
773 ieee80211_change_chanctx(local, ctx, ctx, compat);
776 static void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local,
781 lockdep_assert_wiphy(local->hw.wiphy);
783 radar_enabled = ieee80211_chanctx_radar_required(local, chanctx);
790 drv_change_chanctx(local, chanctx, IEEE80211_CHANCTX_CHANGE_RADAR);
797 struct ieee80211_local *local = sdata->local;
807 lockdep_is_held(&local->hw.wiphy->mtx));
812 drv_unassign_vif_chanctx(local, sdata, link->conf, curr_ctx);
819 ieee80211_recalc_chanctx_min_def(local, new_ctx, link);
821 ret = drv_assign_vif_chanctx(local, sdata, link->conf, new_ctx);
833 if (curr_ctx && ieee80211_chanctx_num_assigned(local, curr_ctx) > 0) {
834 ieee80211_recalc_chanctx_chantype(local, curr_ctx);
835 ieee80211_recalc_smps_chanctx(local, curr_ctx);
836 ieee80211_recalc_radar_chanctx(local, curr_ctx);
837 ieee80211_recalc_chanctx_min_def(local, curr_ctx, NULL);
840 if (new_ctx && ieee80211_chanctx_num_assigned(local, new_ctx) > 0) {
842 ieee80211_recalc_chanctx_min_def(local, new_ctx, NULL);
851 for_each_sdata_link(local, tmp) {
872 void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
879 lockdep_assert_wiphy(local->hw.wiphy);
884 for_each_sdata_link(local, link) {
928 sdata = wiphy_dereference(local->hw.wiphy, local->monitor_sdata);
931 rx_chains_dynamic = rx_chains_static = local->rx_chains;
939 drv_change_chanctx(local, chanctx, IEEE80211_CHANCTX_CHANGE_RX_CHAINS);
949 struct ieee80211_local *local __maybe_unused = sdata->local;
956 lockdep_assert_wiphy(local->hw.wiphy);
965 lockdep_is_held(&local->hw.wiphy->mtx));
974 vlan_conf = wiphy_dereference(local->hw.wiphy,
986 struct ieee80211_local *local = link->sdata->local;
988 lockdep_assert_wiphy(local->hw.wiphy);
998 lockdep_assert_wiphy(sdata->local->hw.wiphy);
1006 if (ieee80211_chanctx_refcount(sdata->local, ctx) == 0) {
1022 ieee80211_free_chanctx(sdata->local, ctx);
1035 struct ieee80211_local *local = sdata->local;
1038 lockdep_assert_wiphy(local->hw.wiphy);
1041 if (curr_ctx && !local->ops->switch_vif_chanctx)
1044 new_ctx = ieee80211_find_reservation_chanctx(local, chanreq, mode);
1046 if (ieee80211_can_create_new_chanctx(local)) {
1047 new_ctx = ieee80211_new_chanctx(local, chanreq, mode);
1077 list_for_each_entry(ctx, &local->chanctx_list,
1101 new_ctx = ieee80211_alloc_chanctx(local, chanreq, mode);
1113 list_add_rcu(&new_ctx->list, &local->chanctx_list);
1136 wiphy_work_queue(sdata->local->hw.wiphy,
1140 wiphy_delayed_work_queue(sdata->local->hw.wiphy,
1173 vlan_conf = wiphy_dereference(sdata->local->hw.wiphy,
1187 struct ieee80211_local *local = sdata->local;
1195 lockdep_assert_wiphy(local->hw.wiphy);
1213 chanreq = ieee80211_chanctx_non_reserved_chandef(local, new_ctx,
1224 _ieee80211_change_chanctx(local, new_ctx, old_ctx, chanreq, link);
1234 err = drv_switch_vif_chanctx(local, vif_chsw, 1,
1237 if (ieee80211_chanctx_refcount(local, new_ctx) == 0)
1238 ieee80211_free_chanctx(local, new_ctx);
1251 if (ieee80211_chanctx_refcount(local, old_ctx) == 0)
1252 ieee80211_free_chanctx(local, old_ctx);
1254 ieee80211_recalc_chanctx_min_def(local, new_ctx, NULL);
1255 ieee80211_recalc_smps_chanctx(local, new_ctx);
1256 ieee80211_recalc_radar_chanctx(local, new_ctx);
1270 struct ieee80211_local *local = sdata->local;
1292 chanreq = ieee80211_chanctx_non_reserved_chandef(local, new_ctx,
1298 ieee80211_change_chanctx(local, new_ctx, new_ctx, chanreq);
1305 if (ieee80211_chanctx_refcount(local, new_ctx) == 0)
1306 ieee80211_free_chanctx(local, new_ctx);
1322 lockdep_assert_wiphy(sdata->local->hw.wiphy);
1342 static int ieee80211_chsw_switch_vifs(struct ieee80211_local *local,
1350 lockdep_assert_wiphy(local->hw.wiphy);
1357 list_for_each_entry(ctx, &local->chanctx_list, list) {
1381 err = drv_switch_vif_chanctx(local, vif_chsw, n_vifs,
1389 static int ieee80211_chsw_switch_ctxs(struct ieee80211_local *local)
1394 lockdep_assert_wiphy(local->hw.wiphy);
1396 list_for_each_entry(ctx, &local->chanctx_list, list) {
1403 ieee80211_del_chanctx(local, ctx->replace_ctx);
1404 err = ieee80211_add_chanctx(local, ctx);
1412 WARN_ON(ieee80211_add_chanctx(local, ctx));
1413 list_for_each_entry_continue_reverse(ctx, &local->chanctx_list, list) {
1420 ieee80211_del_chanctx(local, ctx);
1421 WARN_ON(ieee80211_add_chanctx(local, ctx->replace_ctx));
1427 static int ieee80211_vif_use_reserved_switch(struct ieee80211_local *local)
1433 lockdep_assert_wiphy(local->hw.wiphy);
1451 list_for_each_entry(ctx, &local->chanctx_list, list) {
1480 wiphy_info(local->hw.wiphy,
1526 err = ieee80211_chsw_switch_vifs(local, n_vifs_switch);
1532 err = ieee80211_chsw_switch_ctxs(local);
1541 list_for_each_entry(ctx, &local->chanctx_list, list) {
1584 ieee80211_recalc_chanctx_chantype(local, ctx);
1585 ieee80211_recalc_smps_chanctx(local, ctx);
1586 ieee80211_recalc_radar_chanctx(local, ctx);
1587 ieee80211_recalc_chanctx_min_def(local, ctx, NULL);
1630 cfg80211_stop_iface(local->hw.wiphy,
1641 list_for_each_entry_safe(ctx, ctx_tmp, &local->chanctx_list, list) {
1656 list_for_each_entry(ctx, &local->chanctx_list, list) {
1676 struct ieee80211_local *local = sdata->local;
1681 lockdep_assert_wiphy(local->hw.wiphy);
1684 lockdep_is_held(&local->hw.wiphy->mtx));
1692 ieee80211_chanctx_num_reserved(local, link->reserved_chanctx) > 1)
1699 if (ieee80211_chanctx_refcount(local, ctx) == 0)
1700 ieee80211_free_chanctx(local, ctx);
1706 ieee80211_vif_use_reserved_switch(local);
1714 struct ieee80211_local *local = sdata->local;
1719 lockdep_assert_wiphy(local->hw.wiphy);
1726 ret = cfg80211_chandef_dfs_required(local->hw.wiphy,
1743 ctx = ieee80211_find_chanctx(local, chanreq, mode);
1745 ctx = ieee80211_new_chanctx(local, chanreq, mode);
1756 if (ieee80211_chanctx_refcount(local, ctx) == 0)
1757 ieee80211_free_chanctx(local, ctx);
1761 ieee80211_recalc_smps_chanctx(local, ctx);
1762 ieee80211_recalc_radar_chanctx(local, ctx);
1773 struct ieee80211_local *local = sdata->local;
1778 lockdep_assert_wiphy(local->hw.wiphy);
1816 err = ieee80211_vif_use_reserved_switch(local);
1822 wiphy_info(local->hw.wiphy,
1841 ieee80211_chanctx_recheck(struct ieee80211_local *local,
1850 lockdep_assert_wiphy(local->hw.wiphy);
1852 for_each_sdata_link(local, link) {
1883 struct ieee80211_local *local = sdata->local;
1889 lockdep_assert_wiphy(local->hw.wiphy);
1891 if (!cfg80211_chandef_usable(sdata->local->hw.wiphy,
1907 lockdep_is_held(&local->hw.wiphy->mtx));
1913 compat = ieee80211_chanctx_recheck(local, link, ctx, chanreq, &tmp);
1919 if (!ieee80211_chanctx_reserved_chanreq(local, ctx, compat,
1937 ieee80211_recalc_chanctx_chantype(local, ctx);
1947 lockdep_assert_wiphy(sdata->local->hw.wiphy);
1959 struct ieee80211_local *local = sdata->local;
1963 lockdep_assert_wiphy(local->hw.wiphy);
1970 ap_conf = wiphy_dereference(local->hw.wiphy,
1972 conf = wiphy_dereference(local->hw.wiphy,
1984 struct ieee80211_local *local = hw_to_local(hw);
1988 list_for_each_entry_rcu(ctx, &local->chanctx_list, list)