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(). Signed-off-by: Kavita Kavita Signed-off-by: Shivani Baranwal --- include/net/cfg80211.h | 5 ++++- include/uapi/linux/nl80211.h | 4 ++++ net/wireless/nl80211.c | 7 ++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index d34b2be0edfa..76f2606c2f0a 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -6239,6 +6239,8 @@ 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". * @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. @@ -6289,7 +6291,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 fcbf613b19a9..96d1b072d4a5 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -8473,6 +8473,9 @@ 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". * * @NUM_NL80211_PMSR_FTM_TYPE_CAPA_ATTR: internal * @NL80211_PMSR_FTM_TYPE_CAPA_ATTR_MAX: highest attribute number @@ -8482,6 +8485,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 bd547f4785d0..4009ca4ccd1d 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -2739,7 +2739,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, @@ -2755,6 +2756,10 @@ 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