From: Kavita Kavita Add NL80211_PMSR_FTM_TYPE_CAPA_ATTR_NAN_SUPPORT to the FTM type capability enum so that userspace (e.g., wpa_supplicant) can query whether the driver supports FTM-based ranging within a NAN Ranging Session before initiating a NAN Ranging Request. Add the corresponding nan_support bit to cfg80211_pmsr_capabilities and include it in the capability advertisement in nl80211_send_pmsr_ftm_capa(). NAN ranging always uses ASAP and a single burst, independent of the generic ASAP capability. Signed-off-by: Kavita Kavita Signed-off-by: Shivani Baranwal --- include/net/cfg80211.h | 6 +++++- include/uapi/linux/nl80211.h | 6 ++++++ net/wireless/nl80211.c | 8 +++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 7609b79f71d6..4768dfcc95fe 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -6315,6 +6315,9 @@ cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type); * @ftm.type.pd_support: supports peer-to-peer ranging as mentioned in the * specification "PR Implementation Consideration Draft 1.9 rev 1" where * PD stands for proximity detection + * @ftm.type.nan_support: supports NAN ranging as defined in + * the "Wi-Fi Aware Specification v4.0, clause 8". NAN ranging always uses + * ASAP and a single burst, regardless of @ftm.asap. * @ftm.concurrent_ista_rsta_support: indicates if the device can * simultaneously act as initiator and responder in a multi-peer * measurement request. Only valid if @ftm.rsta_support is set. @@ -6365,7 +6368,8 @@ struct cfg80211_pmsr_capabilities { u32 min_allowed_ranging_interval_ntb; struct { u8 infra_support:1, - pd_support:1; + pd_support:1, + nan_support:1; } type; u8 concurrent_ista_rsta_support:1; u32 pd_preambles; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index abc2d1ef7a50..b5f37c784d0f 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -8535,6 +8535,11 @@ enum nl80211_peer_measurement_ftm_capa { * the device supports peer-to-peer ranging as mentioned in the * specification "PR Implementation Consideration Draft 1.9 rev 1" where * PD stands for proximity detection + * @NL80211_PMSR_FTM_TYPE_CAPA_ATTR_NAN_SUPPORT: flag attribute indicating + * that the device supports NAN ranging between two NAN devices as defined + * in the "Wi-Fi Aware Specification v4.0, clause 8". NAN ranging uses ASAP + * and a single burst, irrespective of whether + * %NL80211_PMSR_FTM_CAPA_ATTR_ASAP is advertised. * * @NUM_NL80211_PMSR_FTM_TYPE_CAPA_ATTR: internal * @NL80211_PMSR_FTM_TYPE_CAPA_ATTR_MAX: highest attribute number @@ -8544,6 +8549,7 @@ enum nl80211_peer_measurement_ftm_type_capa { NL80211_PMSR_FTM_TYPE_CAPA_ATTR_INFRA_SUPPORT, NL80211_PMSR_FTM_TYPE_CAPA_ATTR_PD_SUPPORT, + NL80211_PMSR_FTM_TYPE_CAPA_ATTR_NAN_SUPPORT, /* keep last */ NUM_NL80211_PMSR_FTM_TYPE_CAPA_ATTR, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7b6e61d98b89..ac1c42726d2d 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -2793,7 +2793,8 @@ nl80211_send_pmsr_ftm_capa(const struct cfg80211_pmsr_capabilities *cap, cap->ftm.min_allowed_ranging_interval_ntb)) return -ENOBUFS; - if (cap->ftm.type.infra_support || cap->ftm.type.pd_support) { + if (cap->ftm.type.infra_support || cap->ftm.type.pd_support || + cap->ftm.type.nan_support) { struct nlattr *pd_caps; pd_caps = nla_nest_start_noflag(msg, @@ -2809,6 +2810,11 @@ nl80211_send_pmsr_ftm_capa(const struct cfg80211_pmsr_capabilities *cap, nla_put_flag(msg, NL80211_PMSR_FTM_TYPE_CAPA_ATTR_PD_SUPPORT)) return -ENOBUFS; + if (cap->ftm.type.nan_support && + nla_put_flag(msg, + NL80211_PMSR_FTM_TYPE_CAPA_ATTR_NAN_SUPPORT)) + return -ENOBUFS; + nla_nest_end(msg, pd_caps); } -- 2.34.1