From 5ae97cd65b4b0479b0028ba80b1b4831d8acebba Mon Sep 17 00:00:00 2001 From: Shwetha G K Date: Sun, 26 Jul 2020 20:21:01 +0530 Subject: [PATCH] qcacmn: Add freeze_tlv_version in cfir_enh_dma_hdr Add freeze_tlv_version in cfir_enh_dma_hdr where, version 1: Cypress/HastingsPrime which supports single user channel capture version 2: Maple/Spruce/Moselle which supports MU channel capture for up to 4 users version 3: Pine which supports MU channel capture for up to 37 users CRs-Fixed: 2741027 Change-Id: Iadd6dc2ff82030f502776ce35988b4472450337e --- target_if/cfr/inc/target_if_cfr_enh.h | 187 ++++++++++++++++++++++++-- target_if/cfr/src/target_if_cfr_enh.c | 29 ++-- 2 files changed, 194 insertions(+), 22 deletions(-) diff --git a/target_if/cfr/inc/target_if_cfr_enh.h b/target_if/cfr/inc/target_if_cfr_enh.h index 75cde7031ff1..cbb88033214b 100644 --- a/target_if/cfr/inc/target_if_cfr_enh.h +++ b/target_if/cfr/inc/target_if_cfr_enh.h @@ -93,6 +93,18 @@ #define STREAMFS_NUM_SUBBUF_PINE 255 +/* enum macrx_freeze_tlv_version: Reported by uCode in enh_dma_header + * MACRX_FREEZE_TLV_VERSION_1: Single MU UL user info reported by MAC + * MACRX_FREEZE_TLV_VERSION_2: Upto 4 MU UL user info reported by MAC + * MACRX_FREEZE_TLV_VERSION_3: Upto 37 MU UL user info reported by MAC + */ +enum macrx_freeze_tlv_version { + MACRX_FREEZE_TLV_VERSION_1 = 1, + MACRX_FREEZE_TLV_VERSION_2 = 2, + MACRX_FREEZE_TLV_VERSION_3 = 3, + MACRX_FREEZE_TLV_VERSION_MAX +}; + /* * @tag: ucode fills this with 0xBA * @@ -169,6 +181,11 @@ * @freeze_data_incl: Indicates whether CFR header contains * MACRX_FREEZE_CAPTURE_CHANNEL TLV * + * @freeze_tlv_version: Indicates the version of freeze_tlv + * 1 - HSP, Cypress + * 2 - Maple/Spruce/Moselle + * 3 - Pine + * * @decimation_factor: FFT bins decimation * @mu_rx_num_users: Number of users in UL-MU-PPDU */ @@ -191,21 +208,95 @@ struct whal_cfir_enhanced_hdr { uint16_t total_bytes; - uint16_t header_version :4, - target_id :4, - cfr_fmt :1, - rsvd2 :1, - mu_rx_data_incl :1, - freeze_data_incl:1, - rsvd3 :4; + uint16_t header_version :4, + target_id :4, + cfr_fmt :1, + rsvd2 :1, + mu_rx_data_incl :1, + freeze_data_incl :1, + freeze_tlv_version :4; uint16_t mu_rx_num_users :8, decimation_factor :4, - rsvd4 :4; + rsvd3 :4; - uint16_t rsvd5; + uint16_t rsvd4; }; +/* + * freeze_tlv v1/v2 used by Hastings/Cypress/Maple/Spruce/Moselle supports upto + * 4 UL MU users + * + * @freeze: + * 0: Allow channel capture + * 1: Freeze channel capture + * + * @capture_reason: Field only valid when the freeze field is 1. Indicates why + * the MAC asked to capture the channel + * 0: freeze_reason_TM + * 1: freeze_reason_FTM + * 2: freeze_reason_ACK_resp_to_TM_FTM + * 3: freeze_reason_TA_RA_TYPE_FILTER + * 4: freeze readon NDP_NDP + * 5: freeze_reason_ALL_PACKET + * + * @packet_type: Packet type of captured packets. + * 0: Management + * 1: Control + * 2: Data + * 3: Extension + * + * @packet_sub_type: packet subtype of the captured packets. + * @sw_peer_id_valid: It is valid only when the freeze field is set to 1. + * 0: no TA address search on the received frame has been + * performed. This is due to the frame not having a TA address + * (like ACK frame), or the received frame being from an other + * AP to which this device is not associated. + * 1: field sw_peer_id will contain valid information. + * This implies that a (successful) address search has been + * performed on the TA address of the received frame. + * + * @sw_peer_id: Valid only when sw_peer_id_valid field is set. It is an + * identifier that allows SW to double check that the CSI info stored belongs + * to the device with this SW identifier. + * + * @phy_ppdu_id: ppdu_id of ppdu which has channel capture performed. Field + * only valid when the freeze field is set to 1. + * + * @packet_ta_lower_16: Packet’s lower 16bits transmit address in MAC header. + * + * @packet_ta_mid_16: Packet’s middle 16bits transmit address in MAC header. + * + * @packet_ta_upper_16: Packet’s upper 16bits transmit address in MAC header. + * + * @packet_ra_lower_16: Packet’s lower 16bits receive address in MAC header. + * + * @packet_ra_mid_16: Packet’s middle 16bits receive address in MAC header. + * + * @packet_ra_upper_16: Packet’s upper 16bits receive address in MAC header. + * + * @tsf_timestamp_15_0: MAC side 64bit TSF timestamp when this TLV is sent to + * PHY. Bits [15:0]. + * + * @tsf_timestamp_31_16: MAC side 64bit TSF timestamp when this TLV is sent to + * PHY. Bits [31:16]. + * + * @tsf_timestamp_47_32: MAC side 64bit TSF timestamp when this TLV is sent to + * PHY. Bits [47:32]. + * + * @tsf_timestamp_63_48: MAC side 64bit TSF timestamp when this TLV is sent to + * PHY. Bits [63:48]. + * + * @user_index_or_user_mask_5_0: When freeze_tlv_version is 1, this field from + * MAC, indicate to PHY which user's channel information need to be uploaded. + * When freeze_tlv_version is 2 & MU_SUPPORT_IN_TLV is 1, this field indicates + * bitmap of users upto 4 to which channel capture need to be uploaded. And if + * freeze_tlv_version is 2 & MU_SUPPORT_IN_TLV is 0, this field indicate to PHY + * which user's channel information need to be uploaded + * + * @directed: Indicate the frame is directed to us or not when NDPA/NDP capture + * or FTM/TM/ACK capture. 1=directed. For other modes, it is 0. + */ struct macrx_freeze_capture_channel { uint16_t freeze : 1, //[0] capture_reason : 3, //[3:1] @@ -230,7 +321,83 @@ struct macrx_freeze_capture_channel { reserved_13 : 9; //[15:7] }; -struct macrx_freeze_capture_channel_v2 { +/* + * freeze_tlv v3 used by Pine + * + * @freeze: + * 0: Allow channel capture + * 1: Freeze channel capture + * + * @capture_reason: Field only valid when the freeze field is 1. Indicates why + * the MAC asked to capture the channel + * 0: freeze_reason_TM + * 1: freeze_reason_FTM + * 2: freeze_reason_ACK_resp_to_TM_FTM + * 3: freeze_reason_TA_RA_TYPE_FILTER + * 4: freeze readon NDP_NDP + * 5: freeze_reason_ALL_PACKET + * + * @packet_type: Packet type of captured packets. + * 0: Management + * 1: Control + * 2: Data + * 3: Extension + * + * @packet_sub_type: packet subtype of the captured packets. + * + * @directed: Indicate the frame is directed to us or not when NDPA/NDP capture + * or FTM/TM/ACK capture. 1=directed. For other modes, it is 0. + * + * @sw_peer_id_valid: It is valid only when the freeze field is set to 1. + * 0: no TA address search on the received frame has been + * performed. This is due to the frame not having a TA address + * (like ACK frame), or the received frame being from an other + * AP to which this device is not associated. + * 1: field sw_peer_id will contain valid information. + * This implies that a (successful) address search has been + * performed on the TA address of the received frame. + * + * @sw_peer_id: Valid only when sw_peer_id_valid field is set. It is an + * identifier that allows SW to double check that the CSI info stored belongs + * to the device with this SW identifier. + * + * @phy_ppdu_id: ppdu_id of ppdu which has channel capture performed. Field + * only valid when the freeze field is set to 1. + * + * @packet_ta_lower_16: Packet’s lower 16bits transmit address in MAC header. + * + * @packet_ta_mid_16: Packet’s middle 16bits transmit address in MAC header. + * + * @packet_ta_upper_16: Packet’s upper 16bits transmit address in MAC header. + * + * @packet_ra_lower_16: Packet’s lower 16bits receive address in MAC header. + * + * @packet_ra_mid_16: Packet’s middle 16bits receive address in MAC header. + * + * @packet_ra_upper_16: Packet’s upper 16bits receive address in MAC header. + * + * @tsf_timestamp_15_0: MAC side 64bit TSF timestamp when this TLV is sent to + * PHY. Bits [15:0]. + * + * @tsf_timestamp_31_16: MAC side 64bit TSF timestamp when this TLV is sent to + * PHY. Bits [31:16]. + * + * @tsf_timestamp_47_32: MAC side 64bit TSF timestamp when this TLV is sent to + * PHY. Bits [47:32]. + * + * @tsf_63_48_or_user_mask_36_32: Indicates to PHY which user's channel info + * need to be uploaded. Only valid in UL MU case with MU_SUPPORT_IN_TLV = 1. + * Otherwise this indicates to PHY MSBs 63:48 of the MAC side 64bit TSF + * timestamp when this TLV is sent to PHY. + * + * @user_index_or_user_mask_15_0: Indicate to PHY which user's channel info + * need to be uploaded in UL MU case with MU_SUPPORT_IN_TLV = 1. Otherwise it + * indicate PHY which user’s channel information need to be uploaded. + * + * @user_mask_31_16: Indicate to PHY which user’s channel information need to + * be uploaded. Only valid in UL MU case with MU_SUPPORT_IN_TLV = 1. + */ +struct macrx_freeze_capture_channel_v3 { uint16_t freeze : 1, //[0] capture_reason : 3, //[3:1] packet_type : 2, //[5:4] diff --git a/target_if/cfr/src/target_if_cfr_enh.c b/target_if/cfr/src/target_if_cfr_enh.c index 9cd0cd8b82fd..808d74a2a2ad 100644 --- a/target_if/cfr/src/target_if_cfr_enh.c +++ b/target_if/cfr/src/target_if_cfr_enh.c @@ -216,16 +216,16 @@ static void dump_freeze_tlv(void *freeze_tlv, uint32_t cookie) } /** - * dump_freeze_tlv_v2() - Dump freeze TLV v2 sent in enhanced DMA header + * dump_freeze_tlv_v3() - Dump freeze TLV v2 sent in enhanced DMA header * @freeze_tlv: Freeze TLV sent from MAC to PHY * @cookie: Index into lookup table * * Return: none */ -static void dump_freeze_tlv_v2(void *freeze_tlv, uint32_t cookie) +static void dump_freeze_tlv_v3(void *freeze_tlv, uint32_t cookie) { - struct macrx_freeze_capture_channel_v2 *freeze = - (struct macrx_freeze_capture_channel_v2 *)freeze_tlv; + struct macrx_freeze_capture_channel_v3 *freeze = + (struct macrx_freeze_capture_channel_v3 *)freeze_tlv; cfr_debug("<%u>\n" "freeze: %d capture_reason: %d packet_type: 0x%x\n" @@ -406,7 +406,8 @@ static void dump_enh_dma_hdr(struct whal_cfir_enhanced_hdr *dma_hdr, "peer_id: %d ppdu_id: 0x%04x total_bytes: %d\n" "header_version: %d target_id: %d cfr_fmt: %d\n" "mu_rx_data_incl: %d freeze_data_incl: %d\n" - "mu_rx_num_users: %d decimation_factor: %d\n", + "mu_rx_num_users: %d decimation_factor: %d\n" + "freeze_tlv_version: %d\n", cookie, dma_hdr->tag, dma_hdr->length, @@ -426,11 +427,13 @@ static void dump_enh_dma_hdr(struct whal_cfir_enhanced_hdr *dma_hdr, dma_hdr->mu_rx_data_incl, dma_hdr->freeze_data_incl, dma_hdr->mu_rx_num_users, - dma_hdr->decimation_factor); + dma_hdr->decimation_factor, + dma_hdr->freeze_tlv_version); if (dma_hdr->freeze_data_incl) { - if (header->chip_type == CFR_CAPTURE_RADIO_PINE) - dump_freeze_tlv_v2(freeze_tlv, cookie); + if (dma_hdr->freeze_tlv_version == + MACRX_FREEZE_TLV_VERSION_3) + dump_freeze_tlv_v3(freeze_tlv, cookie); else dump_freeze_tlv(freeze_tlv, cookie); } @@ -447,7 +450,8 @@ static void dump_enh_dma_hdr(struct whal_cfir_enhanced_hdr *dma_hdr, "peer_id: %d ppdu_id: 0x%04x total_bytes: %d\n" "header_version: %d target_id: %d cfr_fmt: %d\n" "mu_rx_data_incl: %d freeze_data_incl: %d\n" - "mu_rx_num_users: %d decimation_factor: %d\n", + "mu_rx_num_users: %d decimation_factor: %d\n" + "freeze_tlv_version: %d\n", cookie, dma_hdr->tag, dma_hdr->length, @@ -467,7 +471,8 @@ static void dump_enh_dma_hdr(struct whal_cfir_enhanced_hdr *dma_hdr, dma_hdr->mu_rx_data_incl, dma_hdr->freeze_data_incl, dma_hdr->mu_rx_num_users, - dma_hdr->decimation_factor); + dma_hdr->decimation_factor, + dma_hdr->freeze_tlv_version); } } @@ -932,9 +937,9 @@ static bool enh_cfr_dbr_event_handler(struct wlan_objmgr_pdev *pdev, if (dma_hdr.mu_rx_data_incl) { uint8_t freeze_tlv_len; - if (pcfr->chip_type == CFR_CAPTURE_RADIO_PINE) { + if (dma_hdr.freeze_tlv_version == MACRX_FREEZE_TLV_VERSION_3) { freeze_tlv_len = - sizeof(struct macrx_freeze_capture_channel_v2); + sizeof(struct macrx_freeze_capture_channel_v3); } else { freeze_tlv_len = sizeof(struct macrx_freeze_capture_channel);