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 db175abf9a24..b4a1aadf3639 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -6451,11 +6451,15 @@ struct wiphy_radio { * @WIPHY_NAN_FLAGS_USERSPACE_DE: Device doesn't support DE offload. * @WIPHY_NAN_FLAGS_INSTANT_COMM: Device can switch to Instant Communication * (IC) mode. Can only be set along with %WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC. + * @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_RANGING = BIT(3), }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index b982cb29f89e..baca5b0cb8ca 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -9297,6 +9297,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. */ @@ -9311,6 +9314,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 1bb2782b6206..ab8ec24093ac 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3206,6 +3206,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