BACKPORT: FROMGIT: wifi: cfg80211: do some rework towards MLO link APIs

In order to support multi-link operation with multiple links,
start adding some APIs. The notable addition here is to have
the link ID in a new nl80211 attribute, that will be used to
differentiate the links in many nl80211 operations.

So far, this patch adds the netlink NL80211_ATTR_MLO_LINK_ID
attribute (as well as the NL80211_ATTR_MLO_LINKS attribute)
and plugs it through the system in some places, checking the
validity etc. along with other infrastructure needed for it.

For now, I've decided to include only the over-the-air link
ID in the API. I know we discussed that we eventually need to
have to have other ways of identifying a link, but for local
AP mode and auth/assoc commands as well as set_key etc. we'll
use the OTA ID.

Also included in this patch is some refactoring of the data
structures in struct wireless_dev, splitting for the first
time the data into type dependent pieces, to make reasoning
about these things easier.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 238103864
Change-Id: Ie4d10818f409b60878076e41676e932f9da1a069
(cherry picked from commit 7b0a0e3c3a88260b6fcb017e49f198463aa62ed1
 https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main)
[quic_vjakkam: bring delta changes from wireless-next.git main branch commit]
Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
This commit is contained in:
Johannes Berg 2022-07-15 17:53:27 +05:30 committed by Treehugger Robot
parent fef5659933
commit 32fe94103e
1 changed files with 9 additions and 5 deletions

View File

@ -15625,6 +15625,7 @@ static int nl80211_add_link(struct sk_buff *skb, struct genl_info *info)
!is_valid_ether_addr(nla_data(info->attrs[NL80211_ATTR_MAC])))
return -EINVAL;
wdev_lock(wdev);
wdev->valid_links |= BIT(link_id);
ether_addr_copy(wdev->links[link_id].addr,
nla_data(info->attrs[NL80211_ATTR_MAC]));
@ -15634,6 +15635,7 @@ static int nl80211_add_link(struct sk_buff *skb, struct genl_info *info)
wdev->valid_links &= ~BIT(link_id);
eth_zero_addr(wdev->links[link_id].addr);
}
wdev_unlock(wdev);
return ret;
}
@ -15658,11 +15660,13 @@ static int nl80211_remove_link(struct sk_buff *skb, struct genl_info *info)
/* FIXME: stop the link operations first */
wdev_lock(wdev);
wdev->valid_links &= ~BIT(link_id);
rdev_del_intf_link(rdev, wdev, link_id);
eth_zero_addr(wdev->links[link_id].addr);
wdev_unlock(wdev);
return 0;
}
@ -15834,11 +15838,11 @@ static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb,
}
if (internal_flags & NL80211_FLAG_MLO_UNSUPPORTED) {
if (info->attrs[NL80211_ATTR_MLO_LINK_ID])
return -EINVAL;
if (wdev->valid_links)
return -EINVAL;
if (info->attrs[NL80211_ATTR_MLO_LINK_ID] ||
(wdev && wdev->valid_links)) {
err = -EINVAL;
goto out_unlock;
}
}
if (rdev && !(internal_flags & NL80211_FLAG_NO_WIPHY_MTX)) {