From: Kavita Kavita Add NL80211_NAN_CAPA_OFFLOAD_RANGING so userspace (e.g., wpa_supplicant) can determine whether firmware supports fully offloaded NAN ranging before starting a NAN ranging session. Add WIPHY_NAN_FLAGS_OFFLOAD_RANGING for drivers to report this capability and expose it through the NAN capabilities handler. Fully offloaded NAN ranging includes ranging session setup, update, and termination, FTM protocol and procedure, and ranging report. Signed-off-by: Kavita Kavita Signed-off-by: Shivani Baranwal --- include/net/cfg80211.h | 4 ++++ include/uapi/linux/nl80211.h | 4 ++++ net/wireless/nl80211.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 76f2606c2f0a..124480276b6b 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -6377,12 +6377,16 @@ struct wiphy_radio { * (IC) mode. Can only be set along with %WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC. * @WIPHY_NAN_FLAGS_OFFLOAD_NDP: Driver handles NAN Data Path (NDP) handshake * frames and data path key installation autonomously. + * @WIPHY_NAN_FLAGS_OFFLOAD_RANGING: Firmware supports fully offloaded NAN + * ranging procedure, including ranging session setup, update, and + * termination, FTM protocol and procedure, and ranging report. */ enum wiphy_nan_flags { WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC = BIT(0), WIPHY_NAN_FLAGS_USERSPACE_DE = BIT(1), WIPHY_NAN_FLAGS_INSTANT_COMM = BIT(2), WIPHY_NAN_FLAGS_OFFLOAD_NDP = BIT(3), + WIPHY_NAN_FLAGS_OFFLOAD_RANGING = BIT(4), }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 96d1b072d4a5..793015750f3f 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -9233,6 +9233,9 @@ enum nl80211_s1g_short_beacon_attrs { * of the Wi-Fi Aware Specification v4.0. Can only be set if * %NL80211_NAN_CAPA_CONFIGURABLE_SYNC is set. When IC is enabled, the IC * schedule is expected to be configured by user space. + * @NL80211_NAN_CAPA_OFFLOAD_RANGING: flag attribute. Firmware supports the + * fully offloaded NAN ranging procedure, including ranging session setup, + * update, and termination, FTM protocol and procedure, and ranging reports. * @__NL80211_NAN_CAPABILITIES_LAST: Internal * @NL80211_NAN_CAPABILITIES_MAX: Highest NAN capability attribute. */ @@ -9247,6 +9250,7 @@ enum nl80211_nan_capabilities { NL80211_NAN_CAPA_CAPABILITIES, NL80211_NAN_CAPA_PHY, NL80211_NAN_CAPA_INSTANT_COMM, + NL80211_NAN_CAPA_OFFLOAD_RANGING, /* keep last */ __NL80211_NAN_CAPABILITIES_LAST, NL80211_NAN_CAPABILITIES_MAX = __NL80211_NAN_CAPABILITIES_LAST - 1, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 4009ca4ccd1d..18da5cd456ef 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3152,6 +3152,10 @@ static int nl80211_put_nan_capa(struct wiphy *wiphy, struct sk_buff *msg) nla_put_flag(msg, NL80211_NAN_CAPA_INSTANT_COMM)) goto fail; + if ((wiphy->nan_capa.flags & WIPHY_NAN_FLAGS_OFFLOAD_RANGING) && + nla_put_flag(msg, NL80211_NAN_CAPA_OFFLOAD_RANGING)) + goto fail; + if (nla_put_u8(msg, NL80211_NAN_CAPA_OP_MODE, wiphy->nan_capa.op_mode) || nla_put_u8(msg, NL80211_NAN_CAPA_NUM_ANTENNAS, -- 2.34.1