From 300aaecb1583139cbd5b727fe01729f8bccfc3af Mon Sep 17 00:00:00 2001 From: Aaradhana Sahu Date: Tue, 24 Jan 2023 11:57:23 +0530 Subject: [PATCH] nl80211: add agile DFS support for MLO Currently, background cac start and stop related command only supported for non MLO case, while for MLO command throws below error. command failed: Invalid argument (-22) Add changes to support background cac command for MLO vaps by parsing link id. Also added changes to validate link band information so that bgcac should be triggered only for 5G. Signed-off-by: Aaradhana Sahu --- net/wireless/nl80211.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -10424,7 +10424,7 @@ static int nl80211_start_radar_detection struct wireless_dev *wdev = dev->ieee80211_ptr; struct wiphy *wiphy = wdev->wiphy; int link_id = nl80211_link_id(info->attrs); - struct cfg80211_chan_def chandef; + struct cfg80211_chan_def chandef, *chandef_link; enum nl80211_dfs_regions dfs_region; unsigned int cac_time_ms; int err = -EINVAL; @@ -10442,6 +10442,19 @@ static int nl80211_start_radar_detection if (err) goto unlock; + chandef_link = wdev_chandef(wdev, link_id); + if (!chandef_link) { + err = -EINVAL; + goto unlock; + } + + if (chandef_link->chan) { + if (chandef_link->chan->band != chandef.chan->band) { + err = -EINVAL; + goto unlock; + } + } + err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype); if (err < 0) goto unlock; @@ -10509,6 +10522,21 @@ static int nl80211_stop_radar_detection( { struct net_device *dev = info->user_ptr[1]; struct wireless_dev *wdev = dev->ieee80211_ptr; + struct cfg80211_registered_device *rdev = info->user_ptr[0]; + int link_id = nl80211_link_id(info->attrs); + struct cfg80211_chan_def *chandef_link, *chandef; + + if (!rdev->background_radar_wdev) + return -EINVAL; + + chandef = &rdev->background_radar_chandef; + chandef_link = wdev_chandef(wdev, link_id); + + if (!chandef_link) + return -EINVAL; + + if (chandef_link->chan->band != chandef->chan->band) + return -EINVAL; cfg80211_stop_background_radar_detection(wdev); @@ -17969,7 +17997,7 @@ static const struct genl_small_ops nl802 .flags = GENL_UNS_ADMIN_PERM, .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP | NL80211_FLAG_NO_WIPHY_MTX | - NL80211_FLAG_MLO_UNSUPPORTED), + NL80211_FLAG_MLO_VALID_LINK_ID), }, };