Add separate bandwidth capability reporting for proximity detection (PD) requests with EDCA and NTB-based ranging. This allows devices to advertise different supported bandwidths for PD operations versus regular FTM measurements, enabling more flexible capability negotiation for proximity ranging scenarios. Signed-off-by: Peddolla Harshavardhan Reddy --- include/net/cfg80211.h | 8 ++++++++ include/uapi/linux/nl80211.h | 14 ++++++++++++++ net/wireless/nl80211.c | 6 ++++++ net/wireless/pmsr.c | 10 +++++++++- 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 73ef64d86a63..5224a68867cc 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5772,6 +5772,12 @@ cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type); * @ftm.support_rsta: supports operating as RSTA in PMSR FTM request * @ftm.support_edca_responder: supports operating as FTM responder in PMSR FTM * request for EDCA-based ranging + * @ftm.pd_edca_bandwidths: bitmap of bandwidths supported + * (&enum nl80211_chan_width) in case of PD request with EDCA based + * initiator or responder role. ignored if @pd_support is not set. + * @ftm.pd_ntb_bandwidths: bitmap of bandwidths supported + * (&enum nl80211_chan_width) in case of PD request with NTB based + * initiator or responder role. ignored if @pd_support is not set. */ struct cfg80211_pmsr_capabilities { unsigned int max_peers; @@ -5807,6 +5813,8 @@ struct cfg80211_pmsr_capabilities { u32 min_allowed_ranging_interval_ntb; u8 support_rsta:1, support_edca_responder:1; + u32 pd_edca_bandwidths; + u32 pd_ntb_bandwidths; } ftm; }; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 4d91c73a4ed2..181595ec960e 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -7863,6 +7863,18 @@ enum nl80211_peer_measurement_attrs { * @NL80211_PMSR_FTM_CAPA_ATTR_MIN_INTERVAL_NTB: u32 attribute indicating * the minimum NTB ranging interval supported by the device * in milli seconds. (0 means unknown) + * @NL80211_PMSR_FTM_CAPA_ATTR_PD_EDCA_BANDWIDTHS: bitmap of values from + * &enum nl80211_chan_width indicating the supported channel + * bandwidths for FTM in case of PD based EDCA initiator or responder role. + * Note that a higher channel bandwidth may be configured to allow for + * other measurements types with different bandwidth requirement in the + * same measurement. + * @NL80211_PMSR_FTM_CAPA_ATTR_PD_NTB_BANDWIDTHS: bitmap of values from + * &enum nl80211_chan_width indicating the supported channel + * bandwidths for FTM in case of PD based NTB initiator or responder role. + * Note that a higher channel bandwidth may be configured to allow for + * other measurements types with different bandwidth requirement in the + * same measurement. * * @NUM_NL80211_PMSR_FTM_CAPA_ATTR: internal * @NL80211_PMSR_FTM_CAPA_ATTR_MAX: highest attribute number @@ -7893,6 +7905,8 @@ enum nl80211_peer_measurement_ftm_capa { NL80211_PMSR_FTM_CAPA_ATTR_MAX_NUM_RX_ANTENNAS, NL80211_PMSR_FTM_CAPA_ATTR_MIN_INTERVAL_EDCA, NL80211_PMSR_FTM_CAPA_ATTR_MIN_INTERVAL_NTB, + NL80211_PMSR_FTM_CAPA_ATTR_PD_EDCA_BANDWIDTHS, + NL80211_PMSR_FTM_CAPA_ATTR_PD_NTB_BANDWIDTHS, /* keep last */ NUM_NL80211_PMSR_FTM_CAPA_ATTR, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b1865668feb4..571d96a5ddf4 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -2378,6 +2378,12 @@ nl80211_send_pmsr_ftm_capa(const struct cfg80211_pmsr_capabilities *cap, nla_put_u32(msg, NL80211_PMSR_FTM_CAPA_ATTR_MIN_INTERVAL_NTB, cap->ftm.min_allowed_ranging_interval_ntb)) return -ENOBUFS; + if (nla_put_u32(msg, NL80211_PMSR_FTM_CAPA_ATTR_PD_EDCA_BANDWIDTHS, + cap->ftm.pd_edca_bandwidths)) + return -ENOBUFS; + if (nla_put_u32(msg, NL80211_PMSR_FTM_CAPA_ATTR_PD_NTB_BANDWIDTHS, + cap->ftm.pd_ntb_bandwidths)) + return -ENOBUFS; nla_nest_end(msg, ftm); return 0; diff --git a/net/wireless/pmsr.c b/net/wireless/pmsr.c index c9915b1f57cb..0ed0f401db11 100644 --- a/net/wireless/pmsr.c +++ b/net/wireless/pmsr.c @@ -17,11 +17,19 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev, u32 preamble = NL80211_PREAMBLE_DMG; /* only optional in DMG */ /* validate existing data */ - if (!(rdev->wiphy.pmsr_capa->ftm.bandwidths & BIT(out->chandef.width))) { + if (!out->pd_request && + !(rdev->wiphy.pmsr_capa->ftm.bandwidths & BIT(out->chandef.width))) { NL_SET_ERR_MSG(info->extack, "FTM: unsupported bandwidth"); return -EINVAL; } + if (out->pd_request && + (!(rdev->wiphy.pmsr_capa->ftm.pd_edca_bandwidths & BIT(out->chandef.width)) && + !(rdev->wiphy.pmsr_capa->ftm.pd_ntb_bandwidths & BIT(out->chandef.width)))) { + NL_SET_ERR_MSG(info->extack, "FTM: unsupported bandwidth for pd request"); + return -EINVAL; + } + /* no validation needed - was already done via nested policy */ nla_parse_nested_deprecated(tb, NL80211_PMSR_FTM_REQ_ATTR_MAX, ftmreq, NULL, NULL); -- 2.34.1