[PATCH 07/34] PR: API to add NTB capabilities in USD PR IE
Peddolla Harshavardhan Reddy
peddolla at qti.qualcomm.com
Thu Jun 19 08:37:00 PDT 2025
Add changes to create a buffer that contains the NTB (802.11az)
ranging capabilities of a device. This buffer will be part of
the Proximity Ranging Information Element (IE) used to
advertise the device's ranging capabilities. These capabilities
are added to USD frames to enable their exchange with peer
devices.
The NTB-based ranging capabilities include attributes such as
the ability to act as an NTB ranging initiator, the ability to
act as an NTB ranging responder, the channels on which NTB
ranging is supported by the device, and other device-specific
capabilities.
Signed-off-by: Peddolla Harshavardhan Reddy <peddolla at qti.qualcomm.com>
---
src/common/proximity_ranging.c | 60 ++++++++++++++++++++++++++++++++++
src/common/proximity_ranging.h | 54 ++++++++++++++++++++++++++++++
2 files changed, 114 insertions(+)
diff --git a/src/common/proximity_ranging.c b/src/common/proximity_ranging.c
index fab74fa1a..47d0efdb3 100644
--- a/src/common/proximity_ranging.c
+++ b/src/common/proximity_ranging.c
@@ -183,6 +183,36 @@ static void pr_get_edca_capabilities(struct pr_data *pr,
}
+static void pr_get_ntb_capabilities(struct pr_data *pr,
+ struct ntb_capabilities *capab)
+{
+ u32 ntb_hw_caps = 0;
+
+ os_memset(capab, 0, sizeof(struct ntb_capabilities));
+ capab->ista_support = pr->cfg->ntb_ista_support;
+ capab->rsta_support = pr->cfg->ntb_rsta_support;
+ os_memcpy(capab->country, pr->cfg->country, 3);
+ capab->secure_he_ltf = pr->cfg->secure_he_ltf;
+
+ ntb_hw_caps |= (pr->cfg->ntb_format_and_bw & NTB_FORMAT_AND_BW_MASK);
+ ntb_hw_caps |= ((pr->cfg->max_tx_ltf_repetations & MAX_TX_LTF_REPETATIONS_MASK) << MAX_TX_LTF_REPETATIONS);
+ ntb_hw_caps |= ((pr->cfg->max_rx_ltf_repetations & MAX_RX_LTF_REPETATIONS_MASK) << MAX_RX_LTF_REPETATIONS);
+
+ ntb_hw_caps |= ((pr->cfg->max_rx_ltf_total & MAX_RX_LTF_TOTAL_MASK) << MAX_RX_LTF_TOTAL);
+ ntb_hw_caps |= ((pr->cfg->max_tx_ltf_total & MAX_TX_LTF_TOTAL_MASK) << MAX_TX_LTF_TOTAL);
+
+ ntb_hw_caps |= ((pr->cfg->max_rx_sts_le_80 & MAX_RX_STS_LE_80_MASK) << MAX_RX_STS_LE_80);
+ ntb_hw_caps |= ((pr->cfg->max_rx_sts_gt_80 & MAX_RX_STS_GT_80_MASK) << MAX_RX_STS_GT_80);
+
+ ntb_hw_caps |= ((pr->cfg->max_tx_sts_le_80 & MAX_TX_STS_LE_80_MASK) << MAX_TX_STS_LE_80);
+ ntb_hw_caps |= ((pr->cfg->max_rx_sts_gt_80 & MAX_TX_STS_GT_80_MASK) << MAX_TX_STS_GT_80);
+
+ capab->ntb_hw_caps = ntb_hw_caps;
+ os_memcpy(&capab->channels, &pr->cfg->edca_channels,
+ sizeof(struct pr_channels));
+}
+
+
static void pr_buf_add_channel_list(struct wpabuf *buf, const char *country,
struct pr_channels *chan)
{
@@ -271,12 +301,37 @@ static void pr_buf_add_edca_capa_info(struct wpabuf *buf,
}
+static void pr_buf_add_ntb_capa_info(struct wpabuf *buf,
+ struct ntb_capabilities *ntb_data)
+{
+ u8 *len;
+ u8 ranging_role = 0;
+
+ wpabuf_put_u8(buf, PR_ATTR_NTB_CAPABILITY);
+ len = wpabuf_put(buf, 2);
+
+ if (ntb_data->ista_support)
+ ranging_role |= PR_ISTA_SUPPORT;
+ if (ntb_data->rsta_support)
+ ranging_role |= PR_RSTA_SUPPORT;
+
+ wpabuf_put_u8(buf, ranging_role);
+ wpabuf_put_be32(buf, ntb_data->ntb_hw_caps);
+ pr_buf_add_channel_list(buf, ntb_data->country, &ntb_data->channels);
+
+ WPA_PUT_LE16(len, (u8 *) wpabuf_put(buf, 0) - len - 2);
+ wpa_hexdump(MSG_DEBUG, "PR: * NTB data",
+ len + 2, (u8 *) wpabuf_put(buf, 0) - len - 2);
+}
+
+
struct wpabuf * pr_prepare_usd_elems(struct pr_data *pr, const char *country)
{
u32 ie_type;
struct wpabuf *buf, *buf2;
struct pr_capabilities pr_caps;
struct edca_capabilities edca_caps;
+ struct ntb_capabilities ntb_caps;
buf = wpabuf_alloc(1000);
if (!buf)
@@ -290,6 +345,11 @@ struct wpabuf * pr_prepare_usd_elems(struct pr_data *pr, const char *country)
pr_buf_add_edca_capa_info(buf, &edca_caps);
}
+ if (pr->cfg->ntb_ista_support || pr->cfg->ntb_rsta_support) {
+ pr_get_ntb_capabilities(pr, &ntb_caps);
+ pr_buf_add_ntb_capa_info(buf, &ntb_caps);
+ }
+
ie_type = (OUI_WFA << 8) | PR_OUI_TYPE;
buf2 = pr_encaps_ie(buf, ie_type);
wpabuf_free(buf);
diff --git a/src/common/proximity_ranging.h b/src/common/proximity_ranging.h
index ea4a41bd6..b80f607f6 100644
--- a/src/common/proximity_ranging.h
+++ b/src/common/proximity_ranging.h
@@ -97,6 +97,60 @@ struct edca_capabilities {
struct pr_channels channels;
};
+struct ntb_capabilities {
+ bool ista_support;
+
+ bool rsta_support;
+
+ bool secure_he_ltf;
+
+/**
+ * Device specific NTB capabilities
+ * Proximity Ranging Implementation Considerations for P2P Operation 2025,
+ * 3.3.5, Table 9.
+ */
+#define NTB_FORMAT_AND_BW 0
+#define MAX_TX_LTF_REPETATIONS 3
+#define MAX_RX_LTF_REPETATIONS 6
+#define MAX_RX_LTF_TOTAL 9
+#define MAX_TX_LTF_TOTAL 11
+#define MAX_RX_STS_LE_80 13
+#define MAX_RX_STS_GT_80 16
+#define MAX_TX_STS_LE_80 19
+#define MAX_TX_STS_GT_80 22
+
+
+#define NTB_FORMAT_AND_BW_MASK 0x00000007
+
+/* Max Tx LTF repetations supported for non trigger based ranging */
+#define MAX_TX_LTF_REPETATIONS_MASK 0x00000007
+
+/* Max Rx LTF repetations supported for non trigger based ranging */
+#define MAX_RX_LTF_REPETATIONS_MASK 0x00000007
+
+/* Max Rx LTF total supported for non trigger based ranging */
+#define MAX_RX_LTF_TOTAL_MASK 0x00000003
+
+/* Max Tx LTF total supported for non trigger based ranging */
+#define MAX_TX_LTF_TOTAL_MASK 0x00000003
+
+/* To configure max R2I STS for Bandwidth less than or equal to 80Mz */
+#define MAX_RX_STS_LE_80_MASK 0x00000007
+
+/* To configure max R2I STS for Bandwidth greater than 80Mz */
+#define MAX_RX_STS_GT_80_MASK 0x00000007
+
+/* To configure max I2R STS for Bandwidth less than or equal to 80Mz */
+#define MAX_TX_STS_LE_80_MASK 0x00000007
+
+/* To configure max I2R STS for Bandwidth greater than 80Mz */
+#define MAX_TX_STS_GT_80_MASK 0x00000007
+ u32 ntb_hw_caps;
+
+ char country[3];
+
+ struct pr_channels channels;
+};
enum pr_attr_id {
PR_ATTR_STATUS = 0,
--
2.34.1
More information about the Hostap
mailing list