Proximity detection applications may not need detailed ranging measurements for every request, yet currently receive all results causing unnecessary data transfer, host wakeups, and processing overhead. Currently, there is no mechanism for applications to suppress result reporting when only proximity detection is needed. Introduce optional result suppression control that drivers can use to implement selective result reporting. Add a flag allowing applications to disable ranging reports when only proximity detection is needed, enabling drivers to reduce unnecessary data transfer and host wakeups. This flag cannot be combined with range report or LMR feedback requests in RSTA mode as these require result reporting. Signed-off-by: Peddolla Harshavardhan Reddy --- include/net/cfg80211.h | 8 +++++++- include/uapi/linux/nl80211.h | 7 +++++++ net/wireless/nl80211.c | 1 + net/wireless/pmsr.c | 18 ++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index e398a594082a..8dc2ccafb88b 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -4448,6 +4448,11 @@ struct cfg80211_pmsr_result { * basis in this case. * @range_report: negotiate for FTM range report. Only valid for * EDCA based ranging. + * @pd_suppress_range_results: flag to suppress ranging results for PD + * requests. When set, ranging measurements are performed but results + * are not reported to userspace, regardless of ranging role or type. + * Only valid when @pd_request is set. Cannot be used with @range_report + * or @lmr_feedback as these require result reporting. * * See also nl80211 for the respective attribute documentation. */ @@ -4474,7 +4479,8 @@ struct cfg80211_pmsr_ftm_request_peer { u32 measurements_per_aw; u64 ingress_distancemm; u64 egress_distancemm; - u8 range_report:1; + u8 range_report:1, + pd_suppress_range_results:1; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index a70dcb2aa111..cafa73280758 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -8082,6 +8082,12 @@ enum nl80211_peer_measurement_ftm_capa { * (units mm, u64) * @NL80211_PMSR_FTM_REQ_ATTR_RANGE_REPORT: Negotiate Range report in case of * EDCA based ranging (flag). + * @NL80211_PMSR_FTM_REQ_ATTR_PD_SUPPRESS_RESULTS: Flag to suppress ranging + * results for PD requests. When set, ranging measurements are performed + * but results are not reported to userspace, regardless of ranging role + * or type. Only valid when %NL80211_PMSR_PEER_ATTR_PD_REQUEST is set. + * Cannot be used with %NL80211_PMSR_FTM_REQ_ATTR_RANGE_REPORT or + * %NL80211_PMSR_FTM_REQ_ATTR_LMR_FEEDBACK as these require result reporting. * * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number @@ -8112,6 +8118,7 @@ enum nl80211_peer_measurement_ftm_req { NL80211_PMSR_FTM_REQ_ATTR_INGRESS, NL80211_PMSR_FTM_REQ_ATTR_EGRESS, NL80211_PMSR_FTM_REQ_ATTR_RANGE_REPORT, + NL80211_PMSR_FTM_REQ_ATTR_PD_SUPPRESS_RESULTS, /* keep last */ NUM_NL80211_PMSR_FTM_REQ_ATTR, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index ea46c5e215ba..02e7c9f9b12f 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -384,6 +384,7 @@ nl80211_pmsr_ftm_req_attr_policy[NL80211_PMSR_FTM_REQ_ATTR_MAX + 1] = { [NL80211_PMSR_FTM_REQ_ATTR_INGRESS] = { .type = NLA_U64 }, [NL80211_PMSR_FTM_REQ_ATTR_EGRESS] = { .type = NLA_U64 }, [NL80211_PMSR_FTM_REQ_ATTR_RANGE_REPORT] = { .type = NLA_FLAG }, + [NL80211_PMSR_FTM_REQ_ATTR_PD_SUPPRESS_RESULTS] = { .type = NLA_FLAG }, }; static const struct nla_policy diff --git a/net/wireless/pmsr.c b/net/wireless/pmsr.c index 2b3d7d260e35..2897876e45b2 100644 --- a/net/wireless/pmsr.c +++ b/net/wireless/pmsr.c @@ -268,6 +268,24 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev, return -EINVAL; } + out->ftm.pd_suppress_range_results = + nla_get_flag(tb[NL80211_PMSR_FTM_REQ_ATTR_PD_SUPPRESS_RESULTS]); + + if (!out->pd_request && out->ftm.pd_suppress_range_results) { + NL_SET_ERR_MSG_ATTR(info->extack, + tb[NL80211_PMSR_FTM_REQ_ATTR_PD_SUPPRESS_RESULTS], + "FTM: suppress range result flag only valid for PD requests"); + return -EINVAL; + } + + if (out->ftm.pd_suppress_range_results && out->ftm.rsta && + (out->ftm.range_report || out->ftm.lmr_feedback)) { + NL_SET_ERR_MSG_ATTR(info->extack, + tb[NL80211_PMSR_FTM_REQ_ATTR_PD_SUPPRESS_RESULTS], + "FTM: cannot report with suppressed results"); + return -EINVAL; + } + return 0; } -- 2.34.1