Currently NL80211_ATTR_UNSOL_BCAST_PROBE_RESP attribute is parsed only by nl80211_start_ap() and nl80211_set_beacon(). Add changes to parse this attribute when NL80211 command received for channel change or BSS color code change. Add and update link_id parameter on cfg80211_color_change_settings structure to know the link on which BSS color code change is expected. This attribute will be set when AP is beaconing only on 6 GHz band and unsol_bcast_presp interval is set, in this case AP sends unsolicited broadcast probe response frame for in-band discovery. Signed-off-by: Rathees Kumar R Chinannan <quic_rrchinan@xxxxxxxxxxx> --- include/net/cfg80211.h | 7 +++++++ net/mac80211/cfg.c | 20 ++++++++++++++++++++ net/wireless/nl80211.c | 20 +++++++++++++++++++- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 496a9d4956de..7ebb5b8578e7 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1549,6 +1549,7 @@ struct cfg80211_ap_update { * @count: number of beacons until switch * @link_id: defines the link on which channel switch is expected during * MLO. 0 in case of non-MLO. + * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters */ struct cfg80211_csa_settings { struct cfg80211_chan_def chandef; @@ -1562,6 +1563,7 @@ struct cfg80211_csa_settings { bool block_tx; u8 count; u8 link_id; + struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; }; /** @@ -1575,6 +1577,9 @@ struct cfg80211_csa_settings { * @beacon_next: beacon data to be used after the color change * @count: number of beacons until the color change * @color: the color used after the change + * @link_id: defines the link on which color change is expected during + * MLO. 0 in case of non-MLO. + * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters */ struct cfg80211_color_change_settings { struct cfg80211_beacon_data beacon_color_change; @@ -1583,6 +1588,8 @@ struct cfg80211_color_change_settings { struct cfg80211_beacon_data beacon_next; u8 count; u8 color; + u8 link_id; + struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp; }; /** diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 97ffd3028467..4947e249cfaf 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -4026,6 +4026,12 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, ch_switch.block_tx = params->block_tx; ch_switch.chandef = chanreq.oper; ch_switch.count = params->count; + err = ieee80211_set_unsol_bcast_probe_resp(sdata, + ¶ms->unsol_bcast_probe_resp, + link_data, link_conf, + &changed); + if (err) + goto out; err = drv_pre_channel_switch(sdata, &ch_switch); if (err) @@ -4891,8 +4897,11 @@ ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev, { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_local *local = sdata->local; + struct ieee80211_bss_conf *link_conf; + struct ieee80211_link_data *link_data; u64 changed = 0; int err; + u8 link_id = params->link_id; lockdep_assert_wiphy(local->hw.wiphy); @@ -4907,6 +4916,11 @@ ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev, goto out; } + link_data = wiphy_dereference(wiphy, sdata->link[link_id]); + if (!link_data) + return -ENOLINK; + link_conf = link_data->conf; + err = ieee80211_set_color_change_beacon(sdata, params, &changed); if (err) goto out; @@ -4914,6 +4928,12 @@ ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev, sdata->vif.bss_conf.color_change_active = true; sdata->vif.bss_conf.color_change_color = params->color; + err = ieee80211_set_unsol_bcast_probe_resp(sdata, ¶ms->unsol_bcast_probe_resp, + link_data, link_conf, + &changed); + if (err) + goto out; + cfg80211_color_change_started_notify(sdata->dev, params->count); if (changed) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b2c6376705b3..1c665d80cbfa 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -10248,6 +10248,14 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info) if (info->attrs[NL80211_ATTR_CH_SWITCH_BLOCK_TX]) params.block_tx = true; + if (info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP]) { + err = nl80211_parse_unsol_bcast_probe_resp( + rdev, info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP], + ¶ms.unsol_bcast_probe_resp); + if (err) + goto free; + } + params.link_id = link_id; err = rdev_channel_switch(rdev, dev, ¶ms); @@ -15965,6 +15973,7 @@ static int nl80211_color_change(struct sk_buff *skb, struct genl_info *info) struct nlattr **tb; u16 offset; int err; + unsigned int link_id = nl80211_link_id(info->attrs); if (!rdev->ops->color_change) return -EOPNOTSUPP; @@ -16048,6 +16057,14 @@ static int nl80211_color_change(struct sk_buff *skb, struct genl_info *info) params.counter_offset_presp = offset; } + params.link_id = link_id; + if (info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP]) { + err = nl80211_parse_unsol_bcast_probe_resp( + rdev, info->attrs[NL80211_ATTR_UNSOL_BCAST_PROBE_RESP], + ¶ms.unsol_bcast_probe_resp); + if (err) + goto out; + } err = rdev_color_change(rdev, dev, ¶ms); @@ -17451,7 +17468,8 @@ static const struct genl_small_ops nl80211_small_ops[] = { .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, .doit = nl80211_color_change, .flags = GENL_UNS_ADMIN_PERM, - .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP), + .internal_flags = IFLAGS(NL80211_FLAG_NEED_NETDEV_UP | + NL80211_FLAG_MLO_VALID_LINK_ID), }, { .cmd = NL80211_CMD_SET_FILS_AAD, -- 2.34.1