Signed-off-by: Peddolla Harshavardhan Reddy <peddolla@xxxxxxxxxxxxxxxx> --- src/common/proximity_ranging.c | 60 ++++++++++++++++++++++++++++++++++ src/common/proximity_ranging.h | 49 +++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) diff --git a/src/common/proximity_ranging.c b/src/common/proximity_ranging.c index 5e0872749..18701646b 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) { @@ -273,12 +303,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) @@ -292,6 +347,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 0b3dc0a06..df4a898b8 100644 --- a/src/common/proximity_ranging.h +++ b/src/common/proximity_ranging.h @@ -92,6 +92,55 @@ struct edca_capabilities { struct pr_channels channels; }; +struct ntb_capabilities { + bool ista_support; + + bool rsta_support; + + bool secure_he_ltf; + +#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 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap