]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: cfg80211: allow suppressing FTM result reporting for PD requests
authorPeddolla Harshavardhan Reddy <peddolla.reddy@oss.qualcomm.com>
Mon, 20 Apr 2026 09:08:54 +0000 (14:38 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 5 May 2026 11:46:06 +0000 (13:46 +0200)
Proximity detection often does not require detailed ranging
measurements, yet userspace currently receives full FTM results for
every request, causing unnecessary data transfer, host wakeups, and
processing overhead.

Add an optional control to suppress ranging result reporting for
peer-to-peer PD requests. Introduce the
NL80211_PMSR_FTM_REQ_ATTR_PD_SUPPRESS_RESULTS flag; when set with a
PD request, the device may perform the measurements (e.g. when acting
as RSTA) but must not report the measurement results to userspace.

Validate that the flag is only accepted when request_type is set to
NL80211_PMSR_FTM_REQ_TYPE_PD, reject otherwise.

Signed-off-by: Peddolla Harshavardhan Reddy <peddolla.reddy@oss.qualcomm.com>
Link: https://patch.msgid.link/20260420090856.2152905-12-peddolla.reddy@oss.qualcomm.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
include/uapi/linux/nl80211.h
net/wireless/nl80211.c
net/wireless/pmsr.c

index f5a47a0c75329f3f15e2ed34a12b620f6db468b7..fdc8363b296c8e0877fbfc6654649f2f398348e3 100644 (file)
@@ -4634,6 +4634,11 @@ struct cfg80211_pmsr_result {
  *     is set, only the specified threshold is used. If both are set, both
  *     thresholds are applied. If neither is set, results are reported without
  *     threshold filtering.
+ * @pd_suppress_range_results: flag to suppress ranging results for PD
+ *     requests. When set, the device performs ranging measurements to
+ *     provide ranging services to a peer (e.g. in RSTA role) but does
+ *     not report the measurement results to userspace. Only valid when
+ *     @request_type is %NL80211_PMSR_FTM_REQ_TYPE_PD.
  *
  * See also nl80211 for the respective attribute documentation.
  */
@@ -4662,6 +4667,7 @@ struct cfg80211_pmsr_ftm_request_peer {
        u32 num_measurements;
        u64 ingress_distance;
        u64 egress_distance;
+       u8 pd_suppress_range_results:1;
 };
 
 /**
index 5bef8fd252709a09408321ab644f96042ca797d5..1da4dc3fc816fa87156c13f1f49726ca16ff4e1b 100644 (file)
@@ -8363,6 +8363,11 @@ enum nl80211_peer_measurement_ftm_type_capa {
  *     threshold is used. If both are specified, both thresholds are applied.
  *     If neither is specified, results are reported without threshold
  *     filtering.
+ * @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_REQ_TYPE is set to
+ *     %NL80211_PMSR_FTM_REQ_TYPE_PD.
  *
  * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal
  * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number
@@ -8392,6 +8397,7 @@ enum nl80211_peer_measurement_ftm_req {
        NL80211_PMSR_FTM_REQ_ATTR_PAD,
        NL80211_PMSR_FTM_REQ_ATTR_INGRESS,
        NL80211_PMSR_FTM_REQ_ATTR_EGRESS,
+       NL80211_PMSR_FTM_REQ_ATTR_PD_SUPPRESS_RESULTS,
 
        /* keep last */
        NUM_NL80211_PMSR_FTM_REQ_ATTR,
index 84f17032fdd928013b6fe5382aaba5c9c5ac32a2..b33f688b983ad90306b410b4c92f08d19ef849e6 100644 (file)
@@ -487,6 +487,7 @@ nl80211_pmsr_ftm_req_attr_policy[NL80211_PMSR_FTM_REQ_ATTR_MAX + 1] = {
        [NL80211_PMSR_FTM_REQ_ATTR_NUM_MEASUREMENTS] = { .type = NLA_U32 },
        [NL80211_PMSR_FTM_REQ_ATTR_INGRESS] = { .type = NLA_U64 },
        [NL80211_PMSR_FTM_REQ_ATTR_EGRESS] = { .type = NLA_U64 },
+       [NL80211_PMSR_FTM_REQ_ATTR_PD_SUPPRESS_RESULTS] = { .type = NLA_FLAG },
 };
 
 static const struct nla_policy
index 8b7843f75db2f335ef70dc58fb0b42269977df0c..f77658b6fccceb49061ff4e6e2291324ad875a6f 100644 (file)
@@ -289,6 +289,17 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev,
                out->ftm.egress_distance =
                        nla_get_u64(tb[NL80211_PMSR_FTM_REQ_ATTR_EGRESS]);
 
+       out->ftm.pd_suppress_range_results =
+               nla_get_flag(tb[NL80211_PMSR_FTM_REQ_ATTR_PD_SUPPRESS_RESULTS]);
+
+       if (out->ftm.request_type != NL80211_PMSR_FTM_REQ_TYPE_PD &&
+           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;
+       }
+
        return 0;
 }