Devices may support different preamble and bandwidth configurations
for proximity detection (PD) ranging versus standard ranging. Add
separate pd_preambles and pd_bandwidths fields to
cfg80211_pmsr_capabilities to allow drivers to advertise PD-specific
capabilities.
Expose these over nl80211 using new attributes
NL80211_PMSR_FTM_CAPA_ATTR_PD_PREAMBLES and
NL80211_PMSR_FTM_CAPA_ATTR_PD_BANDWIDTHS, advertised only when
pd_support is set.
For PD requests, validate bandwidth and preamble against pd_bandwidths
and pd_preambles. For non-PD requests, validate against the existing
bandwidths and preambles fields.
Signed-off-by: Peddolla Harshavardhan Reddy <peddolla.reddy@oss.qualcomm.com>
Link: https://patch.msgid.link/20260420090856.2152905-11-peddolla.reddy@oss.qualcomm.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
* @ftm.concurrent_ista_rsta_support: indicates if the device can
* simultaneously act as initiator and responder in a multi-peer
* measurement request. Only valid if @ftm.rsta_support is set.
+ * @ftm.pd_preambles: bitmap of preambles supported (&enum nl80211_preamble)
+ * for PD ranging requests. Ignored if @ftm.type.pd_support is not set.
+ * @ftm.pd_bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
+ * for PD ranging requests. Ignored if @ftm.type.pd_support is not set.
*/
struct cfg80211_pmsr_capabilities {
unsigned int max_peers;
pd_support:1;
} type;
u8 concurrent_ista_rsta_support:1;
+ u32 pd_preambles;
+ u32 pd_bandwidths;
} ftm;
};
* to estimate the burst period to be given in the FTM request for the
* NTB ranging case. If non-zero, this value will be used to validate
* the nominal time in the FTM request.
+ * @NL80211_PMSR_FTM_CAPA_ATTR_PD_PREAMBLES: u32 bitmap of values from
+ * &enum nl80211_preamble indicating the supported preambles for PD
+ * ranging requests. Only valid if %NL80211_PMSR_FTM_TYPE_CAPA_ATTR_PD_SUPPORT
+ * is set.
+ * @NL80211_PMSR_FTM_CAPA_ATTR_PD_BANDWIDTHS: u32 bitmap of values from
+ * &enum nl80211_chan_width indicating the supported channel bandwidths
+ * for PD ranging requests. Only valid if
+ * %NL80211_PMSR_FTM_TYPE_CAPA_ATTR_PD_SUPPORT is set.
*
* @NUM_NL80211_PMSR_FTM_CAPA_ATTR: internal
* @NL80211_PMSR_FTM_CAPA_ATTR_MAX: highest attribute number
NL80211_PMSR_FTM_CAPA_ATTR_MAX_NUM_RX_ANTENNAS,
NL80211_PMSR_FTM_CAPA_ATTR_MIN_INTERVAL_EDCA,
NL80211_PMSR_FTM_CAPA_ATTR_MIN_INTERVAL_NTB,
+ NL80211_PMSR_FTM_CAPA_ATTR_PD_PREAMBLES,
+ NL80211_PMSR_FTM_CAPA_ATTR_PD_BANDWIDTHS,
/* keep last */
NUM_NL80211_PMSR_FTM_CAPA_ATTR,
if (cap->ftm.concurrent_ista_rsta_support &&
nla_put_flag(msg, NL80211_PMSR_FTM_CAPA_ATTR_CONCURRENT_ISTA_RSTA_SUPPORT))
return -ENOBUFS;
+
+ if (cap->ftm.type.pd_support) {
+ if (cap->ftm.pd_preambles &&
+ nla_put_u32(msg, NL80211_PMSR_FTM_CAPA_ATTR_PD_PREAMBLES,
+ cap->ftm.pd_preambles))
+ return -ENOBUFS;
+ if (cap->ftm.pd_bandwidths &&
+ nla_put_u32(msg, NL80211_PMSR_FTM_CAPA_ATTR_PD_BANDWIDTHS,
+ cap->ftm.pd_bandwidths))
+ return -ENOBUFS;
+ }
+
nla_nest_end(msg, ftm);
return 0;
}
u32 preamble = NL80211_PREAMBLE_DMG; /* only optional in DMG */
/* validate existing data */
- if (!(rdev->wiphy.pmsr_capa->ftm.bandwidths & BIT(out->chandef.width))) {
+ if (out->ftm.request_type == NL80211_PMSR_FTM_REQ_TYPE_INFRA &&
+ !(capa->ftm.bandwidths & BIT(out->chandef.width))) {
NL_SET_ERR_MSG(info->extack, "FTM: unsupported bandwidth");
return -EINVAL;
}
+ if (out->ftm.request_type == NL80211_PMSR_FTM_REQ_TYPE_PD &&
+ !(capa->ftm.pd_bandwidths & BIT(out->chandef.width))) {
+ NL_SET_ERR_MSG(info->extack,
+ "FTM: unsupported bandwidth for PD request");
+ return -EINVAL;
+ }
+
/* no validation needed - was already done via nested policy */
nla_parse_nested_deprecated(tb, NL80211_PMSR_FTM_REQ_ATTR_MAX, ftmreq,
NULL, NULL);
}
}
- if (!(capa->ftm.preambles & BIT(preamble))) {
+ if (out->ftm.request_type == NL80211_PMSR_FTM_REQ_TYPE_INFRA &&
+ !(capa->ftm.preambles & BIT(preamble))) {
NL_SET_ERR_MSG_ATTR(info->extack,
tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE],
"FTM: invalid preamble");
return -EINVAL;
}
+ if (out->ftm.request_type == NL80211_PMSR_FTM_REQ_TYPE_PD &&
+ !(capa->ftm.pd_preambles & BIT(preamble))) {
+ NL_SET_ERR_MSG_ATTR(info->extack,
+ tb[NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE],
+ "FTM: invalid preamble for PD request");
+ return -EINVAL;
+ }
+
out->ftm.preamble = preamble;
out->ftm.burst_period = 0;