[PATCH 06/34] PR: API to add EDCA capabilities in USD PR IE

Peddolla Harshavardhan Reddy peddolla at qti.qualcomm.com
Thu Jun 19 08:36:59 PDT 2025


Add changes to create buffer that contains EDCA(802.11mc) based
ranging capabilities of a device which will be part of a Proximity
Ranging IE used to advertise Ranging capabilities of a device. These
capabilities are added to USD frames to enable their exchange with
peer devices. The EDCA based ranging capabilities have attributes such
as the ability to act as an EDCA based ranging initiator, the ability
to act as a EDCA based ranging responder, the channels on which the
EDCA 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 | 75 ++++++++++++++++++++++++++++++++++
 src/common/proximity_ranging.h | 33 +++++++++++++++
 2 files changed, 108 insertions(+)

diff --git a/src/common/proximity_ranging.c b/src/common/proximity_ranging.c
index da0ea65ee..fab74fa1a 100644
--- a/src/common/proximity_ranging.c
+++ b/src/common/proximity_ranging.c
@@ -163,6 +163,51 @@ static void pr_get_ranging_capabilities(struct pr_data *pr,
 }
 
 
+static void pr_get_edca_capabilities(struct pr_data *pr,
+				     struct edca_capabilities *capab)
+{
+	u16 edca_hw_caps = 0;
+
+	os_memset(capab, 0, sizeof(struct edca_capabilities));
+	capab->ista_support = pr->cfg->edca_ista_support;
+	capab->rsta_support = pr->cfg->edca_rsta_support;
+	os_memcpy(capab->country, pr->cfg->country, 3);
+
+	edca_hw_caps |= (pr->cfg->edca_format_and_bw & EDCA_FORMAT_AND_BW_MASK);
+	edca_hw_caps |= ((pr->cfg->max_tx_antenna & EDCA_MAX_TX_ANTENNA_MASK) << EDCA_MAX_TX_ANTENNA);
+	edca_hw_caps |= ((pr->cfg->max_rx_antenna & EDCA_MAX_RX_ANTENNA_MASK) << EDCA_MAX_RX_ANTENNA);
+
+	capab->edca_hw_caps = edca_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)
+{
+	u8 *len;
+	size_t i;
+
+	wpabuf_put_data(buf, country, 3);
+	len = wpabuf_put(buf, 1); /* IE length to be filled */
+
+	/* Channel List */
+	for (i = 0; i < chan->op_classes; i++) {
+		struct pr_op_class *c = &chan->op_class[i];
+
+		wpabuf_put_u8(buf, c->op_class);
+		wpabuf_put_u8(buf, c->channels);
+		wpabuf_put_data(buf, c->channel, c->channels);
+	}
+
+	/* Update attribute length */
+	*len = chan->op_classes;
+	wpa_hexdump(MSG_DEBUG, "PR: * Channel List",
+		    len + 1, (u8 *) wpabuf_put(buf, 0) - len - 1);
+}
+
+
 static void pr_buf_add_ranging_capa_info(struct wpabuf *buf,
 					 struct pr_capabilities *capab)
 {
@@ -202,11 +247,36 @@ static void pr_buf_add_ranging_capa_info(struct wpabuf *buf,
 }
 
 
+static void pr_buf_add_edca_capa_info(struct wpabuf *buf,
+				      struct edca_capabilities *edca_data)
+{
+	u8 *len;
+	u8 ranging_role = 0;
+
+	wpabuf_put_u8(buf, PR_ATTR_EDCA_CAPABILITY);
+	len = wpabuf_put(buf, 2);
+
+	if (edca_data->ista_support)
+		ranging_role |= PR_ISTA_SUPPORT;
+	if (edca_data->rsta_support)
+		ranging_role |= PR_RSTA_SUPPORT;
+
+	wpabuf_put_u8(buf, ranging_role);
+	wpabuf_put_be16(buf, edca_data->edca_hw_caps);
+	pr_buf_add_channel_list(buf, edca_data->country, &edca_data->channels);
+
+	WPA_PUT_LE16(len, (u8 *) wpabuf_put(buf, 0) - len - 2);
+	wpa_hexdump(MSG_DEBUG, "PR: * EDCA 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;
 
 	buf = wpabuf_alloc(1000);
 	if (!buf)
@@ -215,6 +285,11 @@ struct wpabuf * pr_prepare_usd_elems(struct pr_data *pr, const char *country)
 	pr_get_ranging_capabilities(pr, &pr_caps);
 	pr_buf_add_ranging_capa_info(buf, &pr_caps);
 
+	if (pr->cfg->edca_ista_support || pr->cfg->edca_rsta_support) {
+		pr_get_edca_capabilities(pr, &edca_caps);
+		pr_buf_add_edca_capa_info(buf, &edca_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 831e731a1..ea4a41bd6 100644
--- a/src/common/proximity_ranging.h
+++ b/src/common/proximity_ranging.h
@@ -28,6 +28,7 @@
  */
 #define PR_MAX_PEER 100
 
+
 /**
  * struct pr_channels - List of supported channels
  */
@@ -72,6 +73,30 @@ struct pr_capabilities {
 	bool support_6ghz;
 };
 
+struct edca_capabilities {
+	bool ista_support;
+
+	bool rsta_support;
+
+/**
+ * Device specific EDCA capabilities
+ * Proximity Ranging Implementation Considerations for P2P Operation 2025,
+ * 3.3.4, Table 8.
+ */
+#define EDCA_FORMAT_AND_BW  0
+#define EDCA_MAX_TX_ANTENNA 6
+#define EDCA_MAX_RX_ANTENNA 9
+
+#define EDCA_FORMAT_AND_BW_MASK  0x003F
+#define EDCA_MAX_TX_ANTENNA_MASK 0x0007
+#define EDCA_MAX_RX_ANTENNA_MASK 0x0007
+	u16 edca_hw_caps;
+
+	char country[3];
+
+	struct pr_channels channels;
+};
+
 
 enum pr_attr_id {
 	PR_ATTR_STATUS = 0,
@@ -93,6 +118,14 @@ enum pr_attr_id {
 #define PR_NTB_SECURE_LTF_BASED_RANGING BIT(1)
 #define PR_NTB_OPEN_BASED_RANGING BIT(2)
 
+/**
+ * Initiator and Responder support
+ * Proximity Ranging Implementation Considerations for P2P Operation 2025,
+ * 3.3.4, Table 8.
+ */
+#define PR_ISTA_SUPPORT BIT(0)
+#define PR_RSTA_SUPPORT BIT(1)
+
 /**
  * struct pr_device_info - Proximity ranging peer information
  */
-- 
2.34.1




More information about the Hostap mailing list