if (!deflink) { switch (sdata->vif.type) { case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP_VLAN:
ether_addr_copy(link_conf->addr,
sdata->wdev.links[link_id].addr);
link_conf->bssid = link_conf->addr;
WARN_ON(!(sdata->wdev.valid_links & BIT(link_id))); break; case NL80211_IFTYPE_STATION: /* station sets the bssid in ieee80211_mgd_setup_link */ break; default:
WARN_ON(1);
}
switch (sdata->vif.type) { case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP_VLAN: /* in an AP all links are always active */
sdata->vif.active_links = valid_links;
/* AP links are not expected to be disabled */
WARN_ON(dormant_links); break; case NL80211_IFTYPE_STATION: if (sdata->vif.active_links) break;
sdata->vif.active_links = valid_links & ~dormant_links;
WARN_ON(hweight16(sdata->vif.active_links) > 1); break; default:
WARN_ON(1);
}
}
if (old_links == new_links && dormant_links == sdata->vif.dormant_links) return 0;
/* if there were no old links, need to clear the pointers to deflink */ if (!old_links)
rem |= BIT(0);
/* allocate new link structures first */
for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
link = kzalloc(sizeof(*link), GFP_KERNEL); if (!link) {
ret = -ENOMEM; goto free;
}
links[link_id] = link;
}
/* keep track of the old pointers for the driver */
BUILD_BUG_ON(sizeof(old) != sizeof(sdata->vif.link_conf));
memcpy(old, sdata->vif.link_conf, sizeof(old)); /* and for us in error cases */
BUILD_BUG_ON(sizeof(old_data) != sizeof(sdata->link));
memcpy(old_data, sdata->link, sizeof(old_data));
/* grab old links to free later */
for_each_set_bit(link_id, &rem, IEEE80211_MLD_MAX_NUM_LINKS) { if (rcu_access_pointer(sdata->link[link_id]) != &sdata->deflink) { /* * we must have allocated the data through this path so * we know we can free both at the same time
*/
to_free[link_id] = container_of(rcu_access_pointer(sdata->link[link_id]),
typeof(*links[link_id]),
data);
}
if (!old_links)
ieee80211_debugfs_recreate_netdev(sdata, true);
/* link them into data structures */
for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
WARN_ON(!use_deflink &&
rcu_access_pointer(sdata->link[link_id]) == &sdata->deflink);
link = links[link_id];
ieee80211_link_init(sdata, link_id, &link->data, &link->conf);
ieee80211_link_setup(&link->data);
}
if (new_links == 0)
ieee80211_link_init(sdata, -1, &sdata->deflink,
&sdata->vif.bss_conf);
ret = ieee80211_check_dup_link_addrs(sdata); if (!ret) { /* for keys we will not be able to undo this */
ieee80211_tear_down_links(sdata, to_free, rem);
link = sdata_dereference(sdata->link[link_id], sdata);
ieee80211_teardown_tdls_peers(link);
__ieee80211_link_release_channel(link, true);
/* * If CSA is (still) active while the link is deactivated, * just schedule the channel switch work for the time we * had previously calculated, and we'll take the process * from there.
*/ if (link->conf->csa_active)
wiphy_hrtimer_work_queue(local->hw.wiphy,
&link->u.mgd.csa.switch_work,
link->u.mgd.csa.time -
ktime_get_boottime());
}
link = sdata_dereference(sdata->link[link_id], sdata);
/* * This call really should not fail. Unfortunately, it appears * that this may happen occasionally with some drivers. Should * it happen, we are stuck in a bad place as going backwards is * not really feasible. * * So lets just tell link_use_channel that it must not fail to * assign the channel context (from mac80211's perspective) and * assume the driver is going to trigger a recovery flow if it * had a failure. * That really is not great nor guaranteed to work. But at least * the internal mac80211 state remains consistent and there is * a chance that we can recover.
*/
ret = _ieee80211_link_use_channel(link,
&link->conf->chanreq,
IEEE80211_CHANCTX_SHARED, true);
WARN_ON_ONCE(ret);
/* * inform about the link info changed parameters after all * stations are also added
*/
}
list_for_each_entry(sta, &local->sta_list, list) { if (sdata != sta->sdata) continue;
/* this is very temporary, but do it anyway */
__ieee80211_sta_recalc_aggregates(sta,
old_active | active_links);
ret = drv_change_sta_links(local, sdata, &sta->sta,
old_active | active_links,
active_links);
WARN_ON_ONCE(ret);
/* * Do it again, just in case - the driver might very * well have called ieee80211_sta_recalc_aggregates() * from there when filling in the new links, which * would set it wrong since the vif's active links are * not switched yet...
*/
__ieee80211_sta_recalc_aggregates(sta, active_links);
}
old_active = sdata->vif.active_links; if (old_active == active_links) return 0;
if (!drv_can_activate_links(local, sdata, active_links)) return -EINVAL;
if (old_active & active_links) { /* * if there's at least one link that stays active across * the change then switch to it (to those) first, and * then enable the additional links
*/
ret = _ieee80211_set_active_links(sdata,
old_active & active_links); if (!ret)
ret = _ieee80211_set_active_links(sdata, active_links);
} else { /* otherwise switch directly */
ret = _ieee80211_set_active_links(sdata, active_links);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.