Message ID | 20220323191640.31230-1-quic_alokad@quicinc.com |
---|---|
State | New |
Headers | show |
Series | [v2,1/4] nl80211: advertise RU puncturing support to userspace | expand |
On Wed, 2022-03-23 at 13:45 -0700, Aloka Dixit wrote: > On 3/23/2022 12:16 PM, Aloka Dixit wrote: > > RU preamble puncturing is allowed for bandwidths more that 80 MHz > > except 80+80. Drivers may not support puncturing at all or have > > restrictions for a minimum bandwidth. > > Add new attribute NL80211_ATTR_RU_PUNCT_SUPP_BW to advertise the > > driver support to the userspace. Default value (0) will indicate that > > RU puncturing is not supported. > > > > Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com> > > --- > > v2: Moved boundary check for ru_punct_supp_bw to wiphy_register(). > > > > These patches depend on EHT support from > https://patchwork.kernel.org/project/linux-wireless/list/?series=614176&state=%2A&archive=both > which are not yet present in mac80211-next tree. > There's no mac80211-next tree anymore. Well, it exists, but we've moved to a combined tree in wireless-next. johannes
> + * @ru_punct_bitmap: RU puncturing bitmap. Each bit represents a 20 MHz channel > + * with lowest bit corresponding to the smallest frequency. Bit set to 1 > + * indicates that the channel is punctured, otherwise the channel is active > + * @ru_punct_bitmap_supp_he: Indicates whether RU puncturing bitmap validation > + * should include OFDMA bitmaps. > */ > struct cfg80211_chan_def { > struct ieee80211_channel *chan; > @@ -750,6 +755,8 @@ struct cfg80211_chan_def { > u32 center_freq2; > struct ieee80211_edmg edmg; > u16 freq1_offset; > + u16 ru_punct_bitmap; > + bool ru_punct_bitmap_supp_he; I don't feel we finished the discussion on why it should be in the chandef. On the one hand, I can see how you argue that it's a part of how the channel is defined, after all, this is now in a sense different from the non- or differently-punctured channel since some parts of it are "gone". This makes saying that two chandefs are only identical if also their puncturing matches completely sensible, as seen in the changed implementation of cfg80211_chandef_identical(). On the other hand, however, I don't think this makes a lot of sense with mac80211's channel contexts, and especially not in a client-side implementation. If you were to e.g. have two simultaneous connections to two different APs on the "same" channel but different puncturing configuration, I'm not convinced it makes sense to treat that as requiring two entirely separate channel contexts and have to go to powersave on one AP to receive on the other etc.? At least from my (Intel HW) POV that doesn't make much sense. As a result, we treat the puncturing more of a bss_conf type thing, and we indeed have a patch to do that for the client side, which I should get sent out so we can have a better discussion about both sides. But honestly part of that probably is that I don't really entirely understand the need for puncturing in the first place. (and also, you included all kinds of random other things in these patches, specifically in nl80211.h, so there's no way I can apply them as is anyway) johannes
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 68713388b617..46630a125e8e 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5129,6 +5129,10 @@ struct wiphy_iftype_akm_suites { * @ema_max_profile_periodicity: maximum profile periodicity supported by * the driver. Setting this field to a non-zero value indicates that the * driver supports enhanced multi-BSSID advertisements (EMA AP). + * + * @ru_punct_supp_bw: Whether the driver supports RU puncturing, and if so, + * for which bandwidths. See &enum nl80211_ru_punct_supp_bw for the + * possible values for this field. */ struct wiphy { struct mutex mtx; @@ -5276,6 +5280,8 @@ struct wiphy { u8 mbssid_max_interfaces; u8 ema_max_profile_periodicity; + enum nl80211_ru_punct_supp_bw ru_punct_supp_bw; + char priv[] __aligned(NETDEV_ALIGN); }; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 0568a79097b8..bdd2cb22b5a0 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2663,6 +2663,10 @@ enum nl80211_commands { * association request when used with NL80211_CMD_NEW_STATION). Can be set * only if %NL80211_STA_FLAG_WME is set. * + * @NL80211_ATTR_RU_PUNCT_SUPP_BW: (u8) Minimum bandwidth for which + * the driver supports preamble puncturing, value should be of type + * &enum nl80211_ru_punct_supp_bw + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use @@ -3175,6 +3179,8 @@ enum nl80211_attrs { NL80211_ATTR_EHT_CAPABILITY, + NL80211_ATTR_RU_PUNCT_SUPP_BW, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST, @@ -7600,4 +7606,20 @@ enum nl80211_ap_settings_flags { NL80211_AP_SETTINGS_SA_QUERY_OFFLOAD_SUPPORT = 1 << 1, }; +/** + * enum nl80211_ru_punct_supp_bw - Bandwidths supporting preamble puncturing + * + * @NL80211_RU_PUNCT_NOT_SUPP: preamble puncturing is not supported + * @NL80211_RU_PUNCT_SUPP_BW_80: puncturing supported within channels of at + * least 80 MHz bandwidth + * @NL80211_RU_PUNCT_SUPP_BW_160: puncturing supported within channels of at + * least 160 MHz bandwidth + * @NL80211_RU_PUNCT_SUPP_BW_320: puncturing supported within 320 MHz. + */ +enum nl80211_ru_punct_supp_bw { + NL80211_RU_PUNCT_NOT_SUPP, + NL80211_RU_PUNCT_SUPP_BW_80, + NL80211_RU_PUNCT_SUPP_BW_160, + NL80211_RU_PUNCT_SUPP_BW_320, +}; #endif /* __LINUX_NL80211_H */ diff --git a/net/wireless/core.c b/net/wireless/core.c index f08d4b3bb148..795f2400373d 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -892,6 +892,10 @@ int wiphy_register(struct wiphy *wiphy) return -EINVAL; } + if (WARN_ON(rdev->wiphy.ru_punct_supp_bw > + NL80211_RU_PUNCT_SUPP_BW_320)) + return -EINVAL; + for (i = 0; i < rdev->wiphy.n_vendor_commands; i++) { /* * Validate we have a policy (can be explicitly set to diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index ee1c2b6b6971..1fbfda2b3b14 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -790,6 +790,8 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { NLA_POLICY_RANGE(NLA_BINARY, NL80211_EHT_MIN_CAPABILITY_LEN, NL80211_EHT_MAX_CAPABILITY_LEN), + [NL80211_ATTR_RU_PUNCT_SUPP_BW] = + NLA_POLICY_MAX(NLA_U8, NL80211_RU_PUNCT_SUPP_BW_320), }; /* policy for the key attributes */ @@ -2301,6 +2303,20 @@ static int nl80211_put_mbssid_support(struct wiphy *wiphy, struct sk_buff *msg) return -ENOBUFS; } +static int +nl80211_put_ru_punct_supp_bw(struct cfg80211_registered_device *rdev, + struct sk_buff *msg) +{ + if (!rdev->wiphy.ru_punct_supp_bw) + return 0; + + if (nla_put_u8(msg, NL80211_ATTR_RU_PUNCT_SUPP_BW, + rdev->wiphy.ru_punct_supp_bw)) + return -ENOBUFS; + + return 0; +} + struct nl80211_dump_wiphy_state { s64 filter_wiphy; long start; @@ -2889,6 +2905,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, if (nl80211_put_mbssid_support(&rdev->wiphy, msg)) goto nla_put_failure; + if (nl80211_put_ru_punct_supp_bw(rdev, msg)) + goto nla_put_failure; + /* done */ state->split_start = 0; break;
RU preamble puncturing is allowed for bandwidths more that 80 MHz except 80+80. Drivers may not support puncturing at all or have restrictions for a minimum bandwidth. Add new attribute NL80211_ATTR_RU_PUNCT_SUPP_BW to advertise the driver support to the userspace. Default value (0) will indicate that RU puncturing is not supported. Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com> --- v2: Moved boundary check for ru_punct_supp_bw to wiphy_register(). include/net/cfg80211.h | 6 ++++++ include/uapi/linux/nl80211.h | 22 ++++++++++++++++++++++ net/wireless/core.c | 4 ++++ net/wireless/nl80211.c | 19 +++++++++++++++++++ 4 files changed, 51 insertions(+) base-commit: f5ba9781dde28f87d1e6db580ab63b308b5b5e1b