Proximity detection applications need to receive measurement results only when devices cross specific distance boundaries to avoid unnecessary host wakeups and reduce power consumption. Currently, there is no mechanism for applications to specify these distance thresholds. Introduce configurable distance-based reporting thresholds that drivers can use to implement selective result reporting. Add ingress and egress distance parameters allowing applications to specify when results should be reported as peers cross these boundaries, enabling drivers to reduce unnecessary data transfer and host wakeups. Signed-off-by: Peddolla Harshavardhan Reddy --- include/net/cfg80211.h | 10 ++++++++++ include/uapi/linux/nl80211.h | 10 ++++++++++ net/wireless/nl80211.c | 2 ++ net/wireless/pmsr.c | 8 ++++++++ 4 files changed, 30 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 9437533d0edf..651d1645bc32 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -4449,6 +4449,14 @@ struct cfg80211_pmsr_result { * @num_measurements: number of measurements to be performed in total. * Only valid if @non_trigger_based is set. If set to 0, the firmware or * driver can automatically select an appropriate value. + * @ingress_distancemm: the measurement result of the peer needs + * to be indicated in case the device moves into this range. + * (units mm, u64) measurement results need to be sent on a burst index + * basis in this case. + * @egress_distancemm: the measurement result of the peer needs + * to be indicated in case the device moves out of this range. + * (units mm, u64). measurement results need to be sent on a burst index + * basis in this case. * * See also nl80211 for the respective attribute documentation. */ @@ -4476,6 +4484,8 @@ struct cfg80211_pmsr_ftm_request_peer { u32 nominal_time; u32 measurements_per_aw; u32 num_measurements; + u64 ingress_distancemm; + u64 egress_distancemm; }; /** diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 1217fe492af7..c1ecf61a9563 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -8089,6 +8089,13 @@ enum nl80211_peer_measurement_ftm_capa { * %NL80211_PMSR_FTM_REQ_ATTR_NON_TRIGGER_BASED is set. * If the attribute is absent ("no preference"), the driver or firmware * can choose a suitable value. + * @NL80211_PMSR_FTM_REQ_ATTR_PAD: ignore, for u64/s64 padding only. + * @NL80211_PMSR_FTM_REQ_ATTR_INGRESS: the measurement result of the peer + * needs to be indicated in case the device moves into this range. + * (units mm, u64). + * @NL80211_PMSR_FTM_REQ_ATTR_EGRESS: the measurement result of the peer + * needs to be indicated in case the device moves out of this range. + * (units mm, u64). * * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number @@ -8116,6 +8123,9 @@ enum nl80211_peer_measurement_ftm_req { NL80211_PMSR_FTM_REQ_ATTR_AW_DURATION, NL80211_PMSR_FTM_REQ_ATTR_MEAS_PER_AW, NL80211_PMSR_FTM_REQ_ATTR_NUM_MEASUREMENTS, + NL80211_PMSR_FTM_REQ_ATTR_PAD, + NL80211_PMSR_FTM_REQ_ATTR_INGRESS, + NL80211_PMSR_FTM_REQ_ATTR_EGRESS, /* keep last */ NUM_NL80211_PMSR_FTM_REQ_ATTR, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 98eef98939c1..25e5d9d5c72a 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -395,6 +395,8 @@ nl80211_pmsr_ftm_req_attr_policy[NL80211_PMSR_FTM_REQ_ATTR_MAX + 1] = { [NL80211_PMSR_FTM_REQ_ATTR_AW_DURATION] = NLA_POLICY_MAX(NLA_U32, 255), [NL80211_PMSR_FTM_REQ_ATTR_MEAS_PER_AW] = NLA_POLICY_MAX(NLA_U32, 4), [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 }, }; static const struct nla_policy diff --git a/net/wireless/pmsr.c b/net/wireless/pmsr.c index d2b43bf584a9..183b5cac015e 100644 --- a/net/wireless/pmsr.c +++ b/net/wireless/pmsr.c @@ -263,6 +263,14 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev, nla_get_u32(tb[NL80211_PMSR_FTM_REQ_ATTR_NUM_MEASUREMENTS]); } + if (tb[NL80211_PMSR_FTM_REQ_ATTR_INGRESS]) + out->ftm.ingress_distancemm = + nla_get_u64(tb[NL80211_PMSR_FTM_REQ_ATTR_INGRESS]); + + if (tb[NL80211_PMSR_FTM_REQ_ATTR_EGRESS]) + out->ftm.egress_distancemm = + nla_get_u64(tb[NL80211_PMSR_FTM_REQ_ATTR_EGRESS]); + return 0; } -- 2.34.1