Add support for Proximity Detection (PD) capabilities in Peer Measurement Service (PMSR) as defined in the Wi-Fi Alliance specification "PR Implementation Consideration Draft 1.9 Rev 1". This includes the PD support flag, concurrent ISTA/RSTA support for simultaneous initiator and responder roles. Additionally, extend FTM capabilities with antenna configuration, ranging intervals for EDCA/NTB-based ranging, and EDCA based responder support flags with corresponding netlink attributes and capability reporting. Signed-off-by: Peddolla Harshavardhan Reddy --- include/net/cfg80211.h | 28 ++++++++++++++++++++++++++-- include/uapi/linux/nl80211.h | 29 +++++++++++++++++++++++++++++ net/wireless/nl80211.c | 32 ++++++++++++++++++++++++++++++++ net/wireless/pmsr.c | 3 ++- 4 files changed, 89 insertions(+), 3 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 83dbe9aeab4d..fedff0a8b982 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5633,6 +5633,13 @@ cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type); * @max_peers: maximum number of peers in a single measurement * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement * @randomize_mac_addr: can randomize MAC address for measurement + * @pd_support: supports peer-to-peer ranging as mentioned in the specification + * "PR Implementation Consideration Draft 1.9 rev 1" where PD stands for + * proximity detection + * @pd_concurrent_ista_rsta_support: As the peer measurement request can be a + * multi-peer request this will indicate if the device can act + * simultaneously as initiator and a responder. Only valid if @pd_support + * is set. * @ftm: FTM measurement data * @ftm.supported: FTM measurement is supported * @ftm.asap: ASAP-mode is supported @@ -5659,12 +5666,24 @@ cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type); * (0 means unknown) * @ftm.max_total_ltf_rx: maximum total number of LTFs that can be received * (0 means unknown) + * @ftm.max_no_of_tx_antennas: maximum number of transmit antennas supported for + * ranging + * @ftm.max_no_of_rx_antennas: maximum number of receive antennas supported for + * ranging + * @ftm.min_allowed_ranging_interval_edca: Minimum EDCA ranging + * interval supported by the device in milli seconds. (0 means unknown) + * @ftm.min_allowed_ranging_interval_ntb: Minimum NTB ranging + * interval supported by the device in milli seconds. (0 means unknown) * @ftm.support_rsta: supports operating as RSTA in PMSR FTM request + * @ftm.support_edca_responder: supports operating as FTM responder in PMSR FTM + * request for EDCA-based ranging */ struct cfg80211_pmsr_capabilities { unsigned int max_peers; u8 report_ap_tsf:1, - randomize_mac_addr:1; + randomize_mac_addr:1, + pd_support:1, + pd_concurrent_ista_rsta_support:1; struct { u32 preambles; @@ -5685,7 +5704,12 @@ struct cfg80211_pmsr_capabilities { u8 max_rx_sts; u8 max_total_ltf_tx; u8 max_total_ltf_rx; - u8 support_rsta:1; + u8 max_no_of_tx_antennas; + u8 max_no_of_rx_antennas; + u32 min_allowed_ranging_interval_edca; + u32 min_allowed_ranging_interval_ntb; + u8 support_rsta:1, + support_edca_responder:1; } ftm; }; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index d4738bcc9914..6a858e46bf3e 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -7745,6 +7745,15 @@ enum nl80211_peer_measurement_peer_attrs { * meaningless, just a list of peers to measure with, with the * sub-attributes taken from * &enum nl80211_peer_measurement_peer_attrs. + * @NL80211_PMSR_ATTR_PD_SUPPORT: flag attribute in capability indicating + * that the device supports peer-to-peer ranging as mentioned in the + * specification "PR Implementation Consideration Draft 1.9 rev 1" where + * PD stands for proximity detection + * @NL80211_PMSR_ATTR_PD_CONCURRENT_ISTA_RSTA_SUPPORT: flag attribute in + * capability indicating that as the peer measurement request can be a + * multi-peer request, the device can act simultaneously as initiator and + * a responder, where the multiple requests are being processed + * simultaneously * * @NUM_NL80211_PMSR_ATTR: internal * @NL80211_PMSR_ATTR_MAX: highest attribute number @@ -7757,6 +7766,8 @@ enum nl80211_peer_measurement_attrs { NL80211_PMSR_ATTR_RANDOMIZE_MAC_ADDR, NL80211_PMSR_ATTR_TYPE_CAPA, NL80211_PMSR_ATTR_PEERS, + NL80211_PMSR_ATTR_PD_SUPPORT, + NL80211_PMSR_ATTR_PD_CONCURRENT_ISTA_RSTA_SUPPORT, /* keep last */ NUM_NL80211_PMSR_ATTR, @@ -7815,6 +7826,19 @@ enum nl80211_peer_measurement_attrs { * This limits the allowed combinations of LTF repetitions and STS. * @NL80211_PMSR_FTM_CAPA_ATTR_RSTA_SUPPORT: flag attribute indicating the * device supports operating as the RSTA in PMSR FTM request + * @NL80211_PMSR_FTM_CAPA_ATTR_EDCA_BASED_RESPONDER: flag attribute indicating + * the device supports operating as the Responder in PMSR FTM request for + * EDCA-based ranging. + * @NL80211_PMSR_FTM_CAPA_ATTR_MAX_NUM_TX_ANTENNAS: u8 attribute indicating + * the maximum number of transmit antennas supported for ranging + * @NL80211_PMSR_FTM_CAPA_ATTR_MAX_NUM_RX_ANTENNAS: u8 attribute indicating + * the maximum number of receive antennas supported for ranging + * @NL80211_PMSR_FTM_CAPA_ATTR_MIN_INTERVAL_EDCA: u32 attribute indicating + * the minimum EDCA ranging interval supported by the device + * in milli seconds. (0 means unknown) + * @NL80211_PMSR_FTM_CAPA_ATTR_MIN_INTERVAL_NTB: u32 attribute indicating + * the minimum NTB ranging interval supported by the device + * in milli seconds. (0 means unknown) * * @NUM_NL80211_PMSR_FTM_CAPA_ATTR: internal * @NL80211_PMSR_FTM_CAPA_ATTR_MAX: highest attribute number @@ -7840,6 +7864,11 @@ enum nl80211_peer_measurement_ftm_capa { NL80211_PMSR_FTM_CAPA_ATTR_MAX_TOTAL_LTF_TX, NL80211_PMSR_FTM_CAPA_ATTR_MAX_TOTAL_LTF_RX, NL80211_PMSR_FTM_CAPA_ATTR_RSTA_SUPPORT, + NL80211_PMSR_FTM_CAPA_ATTR_EDCA_BASED_RESPONDER, + NL80211_PMSR_FTM_CAPA_ATTR_MAX_NUM_TX_ANTENNAS, + 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, /* keep last */ NUM_NL80211_PMSR_FTM_CAPA_ATTR, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 9aa83a6943a2..accbc80b4a90 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -394,6 +394,10 @@ nl80211_pmsr_attr_policy[NL80211_PMSR_ATTR_MAX + 1] = { [NL80211_PMSR_ATTR_TYPE_CAPA] = { .type = NLA_REJECT }, [NL80211_PMSR_ATTR_PEERS] = NLA_POLICY_NESTED_ARRAY(nl80211_pmsr_peer_attr_policy), + [NL80211_PMSR_ATTR_PD_SUPPORT] = { .type = NLA_REJECT }, + [NL80211_PMSR_ATTR_PD_CONCURRENT_ISTA_RSTA_SUPPORT] = { + .type = NLA_REJECT + }, }; static const struct nla_policy @@ -2340,6 +2344,25 @@ nl80211_send_pmsr_ftm_capa(const struct cfg80211_pmsr_capabilities *cap, if (cap->ftm.support_rsta && nla_put_flag(msg, NL80211_PMSR_FTM_CAPA_ATTR_RSTA_SUPPORT)) return -ENOBUFS; + if (cap->ftm.support_edca_responder && + nla_put_flag(msg, NL80211_PMSR_FTM_CAPA_ATTR_EDCA_BASED_RESPONDER)) + return -ENOBUFS; + if (cap->ftm.max_no_of_tx_antennas > 0 && + nla_put_u8(msg, NL80211_PMSR_FTM_CAPA_ATTR_MAX_NUM_TX_ANTENNAS, + cap->ftm.max_no_of_tx_antennas)) + return -ENOBUFS; + if (cap->ftm.max_no_of_rx_antennas > 0 && + nla_put_u8(msg, NL80211_PMSR_FTM_CAPA_ATTR_MAX_NUM_RX_ANTENNAS, + cap->ftm.max_no_of_rx_antennas)) + return -ENOBUFS; + if (cap->ftm.min_allowed_ranging_interval_edca > 0 && + nla_put_u32(msg, NL80211_PMSR_FTM_CAPA_ATTR_MIN_INTERVAL_EDCA, + cap->ftm.min_allowed_ranging_interval_edca)) + return -ENOBUFS; + if (cap->ftm.min_allowed_ranging_interval_ntb > 0 && + nla_put_u32(msg, NL80211_PMSR_FTM_CAPA_ATTR_MIN_INTERVAL_NTB, + cap->ftm.min_allowed_ranging_interval_ntb)) + return -ENOBUFS; nla_nest_end(msg, ftm); return 0; @@ -2374,6 +2397,15 @@ static int nl80211_send_pmsr_capa(struct cfg80211_registered_device *rdev, nla_put_flag(msg, NL80211_PMSR_ATTR_RANDOMIZE_MAC_ADDR)) return -ENOBUFS; + if (cap->pd_support) { + if (nla_put_flag(msg, NL80211_PMSR_ATTR_PD_SUPPORT)) + return -ENOBUFS; + + if (cap->pd_concurrent_ista_rsta_support && + nla_put_flag(msg, + NL80211_PMSR_ATTR_PD_CONCURRENT_ISTA_RSTA_SUPPORT)) + return -ENOBUFS; + } caps = nla_nest_start_noflag(msg, NL80211_PMSR_ATTR_TYPE_CAPA); if (!caps) return -ENOBUFS; diff --git a/net/wireless/pmsr.c b/net/wireless/pmsr.c index 4db6c40dd782..8cc8d6be0e98 100644 --- a/net/wireless/pmsr.c +++ b/net/wireless/pmsr.c @@ -188,7 +188,8 @@ static int pmsr_parse_ftm(struct cfg80211_registered_device *rdev, } out->ftm.rsta = !!tb[NL80211_PMSR_FTM_REQ_ATTR_RSTA]; - if (out->ftm.rsta && !capa->ftm.support_rsta) { + if (out->ftm.rsta && !capa->ftm.support_rsta && + !capa->ftm.support_edca_responder) { NL_SET_ERR_MSG_ATTR(info->extack, tb[NL80211_PMSR_FTM_REQ_ATTR_RSTA], "FTM: RSTA not supported by device"); -- 2.34.1