1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975 |
- /*
- * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
- #ifndef _HAL_BE_GENERIC_API_H_
- #define _HAL_BE_GENERIC_API_H_
- #include <hal_be_hw_headers.h>
- #include "hal_be_tx.h"
- #include "hal_be_reo.h"
- #include <hal_api_mon.h>
- #include <hal_generic_api.h>
- #include <hal_be_api_mon.h>
- /**
- * Debug macro to print the TLV header tag
- */
- #define SHOW_DEFINED(x) do {} while (0)
- #if defined(WLAN_FEATURE_TSF_UPLINK_DELAY) || defined(CONFIG_SAWF)
- static inline void
- hal_tx_comp_get_buffer_timestamp_be(void *desc,
- struct hal_tx_completion_status *ts)
- {
- ts->buffer_timestamp = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
- BUFFER_TIMESTAMP);
- }
- #else /* !WLAN_FEATURE_TSF_UPLINK_DELAY || CONFIG_SAWF */
- static inline void
- hal_tx_comp_get_buffer_timestamp_be(void *desc,
- struct hal_tx_completion_status *ts)
- {
- }
- #endif /* WLAN_FEATURE_TSF_UPLINK_DELAY || CONFIG_SAWF */
- /**
- * hal_tx_comp_get_status() - TQM Release reason
- * @hal_desc: completion ring Tx status
- *
- * This function will parse the WBM completion descriptor and populate in
- * HAL structure
- *
- * Return: none
- */
- static inline void
- hal_tx_comp_get_status_generic_be(void *desc, void *ts1,
- struct hal_soc *hal)
- {
- uint8_t rate_stats_valid = 0;
- uint32_t rate_stats = 0;
- struct hal_tx_completion_status *ts =
- (struct hal_tx_completion_status *)ts1;
- ts->ppdu_id = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
- TQM_STATUS_NUMBER);
- ts->ack_frame_rssi = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
- ACK_FRAME_RSSI);
- ts->first_msdu = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
- FIRST_MSDU);
- ts->last_msdu = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
- LAST_MSDU);
- #if 0
- // TODO - This has to be calculated form first and last msdu
- ts->msdu_part_of_amsdu = HAL_TX_DESC_GET(desc,
- WBM2SW_COMPLETION_RING_TX,
- MSDU_PART_OF_AMSDU);
- #endif
- ts->peer_id = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
- SW_PEER_ID);
- ts->tid = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX, TID);
- ts->transmit_cnt = HAL_TX_DESC_GET(desc, WBM2SW_COMPLETION_RING_TX,
- TRANSMIT_COUNT);
- rate_stats = HAL_TX_DESC_GET(desc, HAL_TX_COMP, TX_RATE_STATS);
- rate_stats_valid = HAL_TX_MS(TX_RATE_STATS_INFO,
- TX_RATE_STATS_INFO_VALID, rate_stats);
- ts->valid = rate_stats_valid;
- if (rate_stats_valid) {
- ts->bw = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_BW,
- rate_stats);
- ts->pkt_type = HAL_TX_MS(TX_RATE_STATS_INFO,
- TRANSMIT_PKT_TYPE, rate_stats);
- ts->stbc = HAL_TX_MS(TX_RATE_STATS_INFO,
- TRANSMIT_STBC, rate_stats);
- ts->ldpc = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_LDPC,
- rate_stats);
- ts->sgi = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_SGI,
- rate_stats);
- ts->mcs = HAL_TX_MS(TX_RATE_STATS_INFO, TRANSMIT_MCS,
- rate_stats);
- ts->ofdma = HAL_TX_MS(TX_RATE_STATS_INFO, OFDMA_TRANSMISSION,
- rate_stats);
- ts->tones_in_ru = HAL_TX_MS(TX_RATE_STATS_INFO, TONES_IN_RU,
- rate_stats);
- }
- ts->release_src = hal_tx_comp_get_buffer_source_generic_be(desc);
- ts->status = hal_tx_comp_get_release_reason(
- desc,
- hal_soc_to_hal_soc_handle(hal));
- ts->tsf = HAL_TX_DESC_GET(desc, UNIFIED_WBM_RELEASE_RING_6,
- TX_RATE_STATS_INFO_TX_RATE_STATS);
- hal_tx_comp_get_buffer_timestamp_be(desc, ts);
- }
- /**
- * hal_tx_set_pcp_tid_map_generic_be() - Configure default PCP to TID map table
- * @soc: HAL SoC context
- * @map: PCP-TID mapping table
- *
- * PCP are mapped to 8 TID values using TID values programmed
- * in one set of mapping registers PCP_TID_MAP_<0 to 6>
- * The mapping register has TID mapping for 8 PCP values
- *
- * Return: none
- */
- static void hal_tx_set_pcp_tid_map_generic_be(struct hal_soc *soc, uint8_t *map)
- {
- uint32_t addr, value;
- addr = HWIO_TCL_R0_PCP_TID_MAP_ADDR(
- MAC_TCL_REG_REG_BASE);
- value = (map[0] |
- (map[1] << HWIO_TCL_R0_PCP_TID_MAP_PCP_1_SHFT) |
- (map[2] << HWIO_TCL_R0_PCP_TID_MAP_PCP_2_SHFT) |
- (map[3] << HWIO_TCL_R0_PCP_TID_MAP_PCP_3_SHFT) |
- (map[4] << HWIO_TCL_R0_PCP_TID_MAP_PCP_4_SHFT) |
- (map[5] << HWIO_TCL_R0_PCP_TID_MAP_PCP_5_SHFT) |
- (map[6] << HWIO_TCL_R0_PCP_TID_MAP_PCP_6_SHFT) |
- (map[7] << HWIO_TCL_R0_PCP_TID_MAP_PCP_7_SHFT));
- HAL_REG_WRITE(soc, addr, (value & HWIO_TCL_R0_PCP_TID_MAP_RMSK));
- }
- /**
- * hal_tx_update_pcp_tid_generic_be() - Update the pcp tid map table with
- * value received from user-space
- * @soc: HAL SoC context
- * @pcp: pcp value
- * @tid : tid value
- *
- * Return: void
- */
- static void
- hal_tx_update_pcp_tid_generic_be(struct hal_soc *soc,
- uint8_t pcp, uint8_t tid)
- {
- uint32_t addr, value, regval;
- addr = HWIO_TCL_R0_PCP_TID_MAP_ADDR(
- MAC_TCL_REG_REG_BASE);
- value = (uint32_t)tid << (HAL_TX_BITS_PER_TID * pcp);
- /* Read back previous PCP TID config and update
- * with new config.
- */
- regval = HAL_REG_READ(soc, addr);
- regval &= ~(HAL_TX_TID_BITS_MASK << (HAL_TX_BITS_PER_TID * pcp));
- regval |= value;
- HAL_REG_WRITE(soc, addr,
- (regval & HWIO_TCL_R0_PCP_TID_MAP_RMSK));
- }
- /**
- * hal_tx_update_tidmap_prty_generic_be() - Update the tid map priority
- * @soc: HAL SoC context
- * @val: priority value
- *
- * Return: void
- */
- static
- void hal_tx_update_tidmap_prty_generic_be(struct hal_soc *soc, uint8_t value)
- {
- uint32_t addr;
- addr = HWIO_TCL_R0_TID_MAP_PRTY_ADDR(
- MAC_TCL_REG_REG_BASE);
- HAL_REG_WRITE(soc, addr,
- (value & HWIO_TCL_R0_TID_MAP_PRTY_RMSK));
- }
- /**
- * hal_rx_get_tlv_size_generic_be() - Get rx packet tlv size
- * @rx_pkt_tlv_size: TLV size for regular RX packets
- * @rx_mon_pkt_tlv_size: TLV size for monitor mode packets
- *
- * Return: size of rx pkt tlv before the actual data
- */
- static void hal_rx_get_tlv_size_generic_be(uint16_t *rx_pkt_tlv_size,
- uint16_t *rx_mon_pkt_tlv_size)
- {
- *rx_pkt_tlv_size = RX_PKT_TLVS_LEN;
- /* For now mon pkt tlv is same as rx pkt tlv */
- *rx_mon_pkt_tlv_size = RX_PKT_TLVS_LEN;
- }
- /**
- * hal_rx_flow_get_tuple_info_be() - Setup a flow search entry in HW FST
- * @fst: Pointer to the Rx Flow Search Table
- * @hal_hash: HAL 5 tuple hash
- * @tuple_info: 5-tuple info of the flow returned to the caller
- *
- * Return: Success/Failure
- */
- static void *
- hal_rx_flow_get_tuple_info_be(uint8_t *rx_fst, uint32_t hal_hash,
- uint8_t *flow_tuple_info)
- {
- struct hal_rx_fst *fst = (struct hal_rx_fst *)rx_fst;
- void *hal_fse = NULL;
- struct hal_flow_tuple_info *tuple_info
- = (struct hal_flow_tuple_info *)flow_tuple_info;
- hal_fse = (uint8_t *)fst->base_vaddr +
- (hal_hash * HAL_RX_FST_ENTRY_SIZE);
- if (!hal_fse || !tuple_info)
- return NULL;
- if (!HAL_GET_FLD(hal_fse, RX_FLOW_SEARCH_ENTRY, VALID))
- return NULL;
- tuple_info->src_ip_127_96 =
- qdf_ntohl(HAL_GET_FLD(hal_fse,
- RX_FLOW_SEARCH_ENTRY,
- SRC_IP_127_96));
- tuple_info->src_ip_95_64 =
- qdf_ntohl(HAL_GET_FLD(hal_fse,
- RX_FLOW_SEARCH_ENTRY,
- SRC_IP_95_64));
- tuple_info->src_ip_63_32 =
- qdf_ntohl(HAL_GET_FLD(hal_fse,
- RX_FLOW_SEARCH_ENTRY,
- SRC_IP_63_32));
- tuple_info->src_ip_31_0 =
- qdf_ntohl(HAL_GET_FLD(hal_fse,
- RX_FLOW_SEARCH_ENTRY,
- SRC_IP_31_0));
- tuple_info->dest_ip_127_96 =
- qdf_ntohl(HAL_GET_FLD(hal_fse,
- RX_FLOW_SEARCH_ENTRY,
- DEST_IP_127_96));
- tuple_info->dest_ip_95_64 =
- qdf_ntohl(HAL_GET_FLD(hal_fse,
- RX_FLOW_SEARCH_ENTRY,
- DEST_IP_95_64));
- tuple_info->dest_ip_63_32 =
- qdf_ntohl(HAL_GET_FLD(hal_fse,
- RX_FLOW_SEARCH_ENTRY,
- DEST_IP_63_32));
- tuple_info->dest_ip_31_0 =
- qdf_ntohl(HAL_GET_FLD(hal_fse,
- RX_FLOW_SEARCH_ENTRY,
- DEST_IP_31_0));
- tuple_info->dest_port = HAL_GET_FLD(hal_fse,
- RX_FLOW_SEARCH_ENTRY,
- DEST_PORT);
- tuple_info->src_port = HAL_GET_FLD(hal_fse,
- RX_FLOW_SEARCH_ENTRY,
- SRC_PORT);
- tuple_info->l4_protocol = HAL_GET_FLD(hal_fse,
- RX_FLOW_SEARCH_ENTRY,
- L4_PROTOCOL);
- return hal_fse;
- }
- /**
- * hal_rx_flow_delete_entry_be() - Setup a flow search entry in HW FST
- * @fst: Pointer to the Rx Flow Search Table
- * @hal_rx_fse: Pointer to the Rx Flow that is to be deleted from the FST
- *
- * Return: Success/Failure
- */
- static QDF_STATUS
- hal_rx_flow_delete_entry_be(uint8_t *rx_fst, void *hal_rx_fse)
- {
- uint8_t *fse = (uint8_t *)hal_rx_fse;
- if (!HAL_GET_FLD(fse, RX_FLOW_SEARCH_ENTRY, VALID))
- return QDF_STATUS_E_NOENT;
- HAL_CLR_FLD(fse, RX_FLOW_SEARCH_ENTRY, VALID);
- return QDF_STATUS_SUCCESS;
- }
- /**
- * hal_rx_fst_get_fse_size_be() - Retrieve the size of each entry in Rx FST
- *
- * Return: size of each entry/flow in Rx FST
- */
- static inline uint32_t
- hal_rx_fst_get_fse_size_be(void)
- {
- return HAL_RX_FST_ENTRY_SIZE;
- }
- /*
- * TX MONITOR
- */
- #ifdef QCA_MONITOR_2_0_SUPPORT
- /**
- * hal_txmon_get_buffer_addr_generic_be() - api to get buffer address
- * @tx_tlv: pointer to TLV header
- * @status: hal mon buffer address status
- *
- * Return: Address to qdf_frag_t
- */
- static inline qdf_frag_t
- hal_txmon_get_buffer_addr_generic_be(void *tx_tlv,
- struct hal_mon_buf_addr_status *status)
- {
- struct mon_buffer_addr *hal_buffer_addr =
- (struct mon_buffer_addr *)((uint8_t *)tx_tlv +
- HAL_RX_TLV64_HDR_SIZE);
- qdf_frag_t buf_addr = NULL;
- buf_addr = (qdf_frag_t)(uintptr_t)((hal_buffer_addr->buffer_virt_addr_31_0 |
- ((unsigned long long)hal_buffer_addr->buffer_virt_addr_63_32 <<
- 32)));
- /* qdf_frag_t is derived from buffer address tlv */
- if (qdf_unlikely(status)) {
- qdf_mem_copy(status,
- (uint8_t *)tx_tlv + HAL_RX_TLV64_HDR_SIZE,
- sizeof(struct hal_mon_buf_addr_status));
- /* update hal_mon_buf_addr_status */
- }
- return buf_addr;
- }
- #if defined(TX_MONITOR_WORD_MASK)
- /**
- * hal_txmon_get_num_users() - get num users from tx_fes_setup tlv
- *
- * @tx_tlv: pointer to tx_fes_setup tlv header
- *
- * Return: number of users
- */
- static inline uint8_t
- hal_txmon_get_num_users(void *tx_tlv)
- {
- hal_tx_fes_setup_t *tx_fes_setup = (hal_tx_fes_setup_t *)tx_tlv;
- return tx_fes_setup->number_of_users;
- }
- /**
- * hal_txmon_parse_tx_fes_setup() - parse tx_fes_setup tlv
- *
- * @tx_tlv: pointer to tx_fes_setup tlv header
- * @ppdu_info: pointer to hal_tx_ppdu_info
- *
- * Return: void
- */
- static inline void
- hal_txmon_parse_tx_fes_setup(void *tx_tlv,
- struct hal_tx_ppdu_info *tx_ppdu_info)
- {
- hal_tx_fes_setup_t *tx_fes_setup = (hal_tx_fes_setup_t *)tx_tlv;
- tx_ppdu_info->num_users = tx_fes_setup->number_of_users;
- if (tx_ppdu_info->num_users == 0)
- tx_ppdu_info->num_users = 1;
- tx_ppdu_info->ppdu_id = tx_fes_setup->schedule_id;
- }
- /**
- * hal_txmon_parse_pcu_ppdu_setup_init() - parse pcu_ppdu_setup_init tlv
- *
- * @tx_tlv: pointer to pcu_ppdu_setup_init tlv header
- * @data_status_info: pointer to data hal_tx_status_info
- * @prot_status_info: pointer to protection hal_tx_status_info
- *
- * Return: void
- */
- static inline void
- hal_txmon_parse_pcu_ppdu_setup_init(void *tx_tlv,
- struct hal_tx_status_info *data_status_info,
- struct hal_tx_status_info *prot_status_info)
- {
- }
- /**
- * hal_txmon_parse_peer_entry() - parse peer entry tlv
- *
- * @tx_tlv: pointer to peer_entry tlv header
- * @user_id: user_id
- * @tx_ppdu_info: pointer to hal_tx_ppdu_info
- * @tx_status_info: pointer to hal_tx_status_info
- *
- * Return: void
- */
- static inline void
- hal_txmon_parse_peer_entry(void *tx_tlv,
- uint8_t user_id,
- struct hal_tx_ppdu_info *tx_ppdu_info,
- struct hal_tx_status_info *tx_status_info)
- {
- }
- /**
- * hal_txmon_parse_queue_exten() - parse queue exten tlv
- *
- * @tx_tlv: pointer to queue exten tlv header
- * @tx_ppdu_info: pointer to hal_tx_ppdu_info
- *
- * Return: void
- */
- static inline void
- hal_txmon_parse_queue_exten(void *tx_tlv,
- struct hal_tx_ppdu_info *tx_ppdu_info)
- {
- }
- /**
- * hal_txmon_parse_mpdu_start() - parse mpdu start tlv
- *
- * @tx_tlv: pointer to mpdu start tlv header
- * @user_id: user id
- * @tx_ppdu_info: pointer to hal_tx_ppdu_info
- *
- * Return: void
- */
- static inline void
- hal_txmon_parse_mpdu_start(void *tx_tlv, uint8_t user_id,
- struct hal_tx_ppdu_info *tx_ppdu_info)
- {
- }
- #else
- /**
- * hal_txmon_get_num_users() - get num users from tx_fes_setup tlv
- *
- * @tx_tlv: pointer to tx_fes_setup tlv header
- *
- * Return: number of users
- */
- static inline uint8_t
- hal_txmon_get_num_users(void *tx_tlv)
- {
- uint8_t num_users = HAL_TX_DESC_GET_64(tx_tlv,
- TX_FES_SETUP, NUMBER_OF_USERS);
- return num_users;
- }
- /**
- * hal_txmon_parse_tx_fes_setup() - parse tx_fes_setup tlv
- *
- * @tx_tlv: pointer to tx_fes_setup tlv header
- * @ppdu_info: pointer to hal_tx_ppdu_info
- *
- * Return: void
- */
- static inline void
- hal_txmon_parse_tx_fes_setup(void *tx_tlv,
- struct hal_tx_ppdu_info *tx_ppdu_info)
- {
- uint32_t num_users = 0;
- uint32_t ppdu_id = 0;
- num_users = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_SETUP, NUMBER_OF_USERS);
- ppdu_id = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_SETUP, SCHEDULE_ID);
- if (num_users == 0)
- num_users = 1;
- tx_ppdu_info->num_users = num_users;
- tx_ppdu_info->ppdu_id = ppdu_id;
- }
- /**
- * hal_txmon_parse_pcu_ppdu_setup_init() - parse pcu_ppdu_setup_init tlv
- *
- * @tx_tlv: pointer to pcu_ppdu_setup_init tlv header
- * @data_status_info: pointer to data hal_tx_status_info
- * @prot_status_info: pointer to protection hal_tx_status_info
- *
- * Return: void
- */
- static inline void
- hal_txmon_parse_pcu_ppdu_setup_init(void *tx_tlv,
- struct hal_tx_status_info *data_status_info,
- struct hal_tx_status_info *prot_status_info)
- {
- prot_status_info->protection_addr =
- HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
- USE_ADDRESS_FIELDS_FOR_PROTECTION);
- /* protection frame address 1 */
- *(uint32_t *)&prot_status_info->addr1[0] =
- HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
- PROTECTION_FRAME_AD1_31_0);
- *(uint32_t *)&prot_status_info->addr1[4] =
- HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
- PROTECTION_FRAME_AD1_47_32);
- /* protection frame address 2 */
- *(uint32_t *)&prot_status_info->addr2[0] =
- HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
- PROTECTION_FRAME_AD2_15_0);
- *(uint32_t *)&prot_status_info->addr2[2] =
- HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
- PROTECTION_FRAME_AD2_47_16);
- /* protection frame address 3 */
- *(uint32_t *)&prot_status_info->addr3[0] =
- HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
- PROTECTION_FRAME_AD3_31_0);
- *(uint32_t *)&prot_status_info->addr3[4] =
- HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
- PROTECTION_FRAME_AD3_47_32);
- /* protection frame address 4 */
- *(uint32_t *)&prot_status_info->addr4[0] =
- HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
- PROTECTION_FRAME_AD4_15_0);
- *(uint32_t *)&prot_status_info->addr4[2] =
- HAL_TX_DESC_GET_64(tx_tlv, PCU_PPDU_SETUP_INIT,
- PROTECTION_FRAME_AD4_47_16);
- }
- /**
- * hal_txmon_parse_peer_entry() - parse peer entry tlv
- *
- * @tx_tlv: pointer to peer_entry tlv header
- * @user_id: user_id
- * @tx_ppdu_info: pointer to hal_tx_ppdu_info
- * @tx_status_info: pointer to hal_tx_status_info
- *
- * Return: void
- */
- static inline void
- hal_txmon_parse_peer_entry(void *tx_tlv,
- uint8_t user_id,
- struct hal_tx_ppdu_info *tx_ppdu_info,
- struct hal_tx_status_info *tx_status_info)
- {
- *(uint32_t *)&tx_status_info->addr1[0] =
- HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_A_31_0);
- *(uint32_t *)&tx_status_info->addr1[4] =
- HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_A_47_32);
- *(uint32_t *)&tx_status_info->addr2[0] =
- HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_B_15_0);
- *(uint32_t *)&tx_status_info->addr2[2] =
- HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, MAC_ADDR_B_47_16);
- TXMON_HAL_USER(tx_ppdu_info, user_id, sw_peer_id) =
- HAL_TX_DESC_GET_64(tx_tlv, TX_PEER_ENTRY, SW_PEER_ID);
- }
- /**
- * hal_txmon_parse_queue_exten() - parse queue exten tlv
- *
- * @tx_tlv: pointer to queue exten tlv header
- * @tx_ppdu_info: pointer to hal_tx_ppdu_info
- *
- * Return: void
- */
- static inline void
- hal_txmon_parse_queue_exten(void *tx_tlv,
- struct hal_tx_ppdu_info *tx_ppdu_info)
- {
- TXMON_HAL_STATUS(tx_ppdu_info, frame_control) =
- HAL_TX_DESC_GET_64(tx_tlv, TX_QUEUE_EXTENSION,
- FRAME_CTL);
- TXMON_HAL_STATUS(tx_ppdu_info, frame_control_info_valid) = true;
- }
- /**
- * hal_txmon_parse_mpdu_start() - parse mpdu start tlv
- *
- * @tx_tlv: pointer to mpdu start tlv header
- * @user_id: user id
- * @tx_ppdu_info: pointer to hal_tx_ppdu_info
- *
- * Return: void
- */
- static inline void
- hal_txmon_parse_mpdu_start(void *tx_tlv, uint8_t user_id,
- struct hal_tx_ppdu_info *tx_ppdu_info)
- {
- TXMON_HAL_USER(tx_ppdu_info, user_id,
- start_seq) = HAL_TX_DESC_GET_64(tx_tlv, TX_MPDU_START,
- MPDU_SEQUENCE_NUMBER);
- TXMON_HAL(tx_ppdu_info, cur_usr_idx) = user_id;
- }
- #endif
- /**
- * hal_txmon_status_get_num_users_generic_be() - api to get num users
- * from start of fes window
- *
- * @tx_tlv_hdr: pointer to TLV header
- * @num_users: reference to number of user
- *
- * Return: status
- */
- static inline uint32_t
- hal_txmon_status_get_num_users_generic_be(void *tx_tlv_hdr, uint8_t *num_users)
- {
- uint32_t tlv_tag, user_id, tlv_len;
- uint32_t tlv_status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
- void *tx_tlv;
- tlv_tag = HAL_RX_GET_USER_TLV32_TYPE(tx_tlv_hdr);
- user_id = HAL_RX_GET_USER_TLV32_USERID(tx_tlv_hdr);
- tlv_len = HAL_RX_GET_USER_TLV32_LEN(tx_tlv_hdr);
- tx_tlv = (uint8_t *)tx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
- /* window starts with either initiator or response */
- switch (tlv_tag) {
- case WIFITX_FES_SETUP_E:
- {
- *num_users = hal_txmon_get_num_users(tx_tlv);
- if (*num_users == 0)
- *num_users = 1;
- tlv_status = HAL_MON_TX_FES_SETUP;
- break;
- }
- case WIFIRX_RESPONSE_REQUIRED_INFO_E:
- {
- *num_users = HAL_TX_DESC_GET_64(tx_tlv,
- RX_RESPONSE_REQUIRED_INFO,
- RESPONSE_STA_COUNT);
- if (*num_users == 0)
- *num_users = 1;
- tlv_status = HAL_MON_RX_RESPONSE_REQUIRED_INFO;
- break;
- }
- };
- return tlv_status;
- }
- /**
- * hal_txmon_free_status_buffer() - api to free status buffer
- * @pdev_handle: DP_PDEV handle
- * @status_frag: qdf_frag_t buffer
- * @end_offset: end offset within buffer that has valid data
- *
- * Return status
- */
- static inline QDF_STATUS
- hal_txmon_status_free_buffer_generic_be(qdf_frag_t status_frag,
- uint32_t end_offset)
- {
- uint32_t tlv_tag, tlv_len;
- uint32_t tlv_status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
- uint8_t *tx_tlv;
- uint8_t *tx_tlv_start;
- qdf_frag_t frag_buf = NULL;
- QDF_STATUS status = QDF_STATUS_E_ABORTED;
- tx_tlv = (uint8_t *)status_frag;
- tx_tlv_start = tx_tlv;
- /* parse tlv and populate tx_ppdu_info */
- do {
- tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(tx_tlv);
- tlv_len = HAL_RX_GET_USER_TLV64_LEN(tx_tlv);
- if (((tx_tlv - tx_tlv_start) + tlv_len) > end_offset)
- return QDF_STATUS_E_ABORTED;
- if (tlv_tag == WIFIMON_BUFFER_ADDR_E) {
- frag_buf = hal_txmon_get_buffer_addr_generic_be(tx_tlv,
- NULL);
- if (frag_buf)
- qdf_frag_free(frag_buf);
- frag_buf = NULL;
- }
- if (WIFITX_FES_STATUS_END_E == tlv_tag ||
- WIFIRESPONSE_END_STATUS_E == tlv_tag ||
- WIFIDUMMY_E == tlv_tag) {
- status = QDF_STATUS_SUCCESS;
- break;
- }
- /* need api definition for hal_tx_status_get_next_tlv */
- tx_tlv = hal_tx_status_get_next_tlv(tx_tlv);
- if ((tx_tlv - tx_tlv_start) >= end_offset)
- break;
- } while (tlv_status == HAL_MON_TX_STATUS_PPDU_NOT_DONE);
- return status;
- }
- /**
- * hal_tx_get_ppdu_info() - api to get tx ppdu info
- * @pdev_handle: DP_PDEV handle
- * @prot_ppdu_info: populate dp_ppdu_info protection
- * @tx_data_ppdu_info: populate dp_ppdu_info data
- * @tlv_tag: Tag
- *
- * Return: dp_tx_ppdu_info pointer
- */
- static inline void *
- hal_tx_get_ppdu_info(void *data_info, void *prot_info, uint32_t tlv_tag)
- {
- struct hal_tx_ppdu_info *prot_ppdu_info = prot_info;
- switch (tlv_tag) {
- case WIFITX_FES_SETUP_E:/* DOWNSTREAM */
- case WIFITX_FLUSH_E:/* DOWNSTREAM */
- case WIFIPCU_PPDU_SETUP_INIT_E:/* DOWNSTREAM */
- case WIFITX_PEER_ENTRY_E:/* DOWNSTREAM */
- case WIFITX_QUEUE_EXTENSION_E:/* DOWNSTREAM */
- case WIFITX_MPDU_START_E:/* DOWNSTREAM */
- case WIFITX_MSDU_START_E:/* DOWNSTREAM */
- case WIFITX_DATA_E:/* DOWNSTREAM */
- case WIFIMON_BUFFER_ADDR_E:/* DOWNSTREAM */
- case WIFITX_MPDU_END_E:/* DOWNSTREAM */
- case WIFITX_MSDU_END_E:/* DOWNSTREAM */
- case WIFITX_LAST_MPDU_FETCHED_E:/* DOWNSTREAM */
- case WIFITX_LAST_MPDU_END_E:/* DOWNSTREAM */
- case WIFICOEX_TX_REQ_E:/* DOWNSTREAM */
- case WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E:/* DOWNSTREAM */
- case WIFINDP_PREAMBLE_DONE_E:/* DOWNSTREAM */
- case WIFISCH_CRITICAL_TLV_REFERENCE_E:/* DOWNSTREAM */
- case WIFITX_LOOPBACK_SETUP_E:/* DOWNSTREAM */
- case WIFITX_FES_SETUP_COMPLETE_E:/* DOWNSTREAM */
- case WIFITQM_MPDU_GLOBAL_START_E:/* DOWNSTREAM */
- case WIFITX_WUR_DATA_E:/* DOWNSTREAM */
- case WIFISCHEDULER_END_E:/* DOWNSTREAM */
- case WIFITX_FES_STATUS_START_PPDU_E:/* UPSTREAM */
- {
- return data_info;
- }
- }
- /*
- * check current prot_tlv_status is start protection
- * check current tlv_tag is either start protection or end protection
- */
- if (TXMON_HAL(prot_ppdu_info,
- prot_tlv_status) == WIFITX_FES_STATUS_START_PROT_E) {
- return prot_info;
- } else if (tlv_tag == WIFITX_FES_STATUS_PROT_E ||
- tlv_tag == WIFITX_FES_STATUS_START_PROT_E) {
- TXMON_HAL(prot_ppdu_info, prot_tlv_status) = tlv_tag;
- return prot_info;
- } else {
- TXMON_HAL(prot_ppdu_info, prot_tlv_status) = tlv_tag;
- return data_info;
- }
- return data_info;
- }
- /**
- * hal_txmon_status_parse_tlv_generic_be() - api to parse status tlv.
- * @data_ppdu_info: hal_txmon data ppdu info
- * @prot_ppdu_info: hal_txmon prot ppdu info
- * @data_status_info: pointer to data status info
- * @prot_status_info: pointer to prot status info
- * @tx_tlv_hdr: fragment of tx_tlv_hdr
- * @status_frag: qdf_frag_t buffer
- *
- * Return: status
- */
- static inline uint32_t
- hal_txmon_status_parse_tlv_generic_be(void *data_ppdu_info,
- void *prot_ppdu_info,
- void *data_status_info,
- void *prot_status_info,
- void *tx_tlv_hdr,
- qdf_frag_t status_frag)
- {
- struct hal_tx_ppdu_info *ppdu_info;
- struct hal_tx_status_info *tx_status_info;
- uint32_t tlv_tag, user_id, tlv_len;
- qdf_frag_t frag_buf = NULL;
- uint32_t status = HAL_MON_TX_STATUS_PPDU_NOT_DONE;
- void *tx_tlv;
- tlv_tag = HAL_RX_GET_USER_TLV64_TYPE(tx_tlv_hdr);
- /* user_id start with 1, decrement by 1 to start from 0 */
- user_id = HAL_RX_GET_USER_TLV64_USERID(tx_tlv_hdr) - 1;
- tlv_len = HAL_RX_GET_USER_TLV64_LEN(tx_tlv_hdr);
- tx_tlv = (uint8_t *)tx_tlv_hdr + HAL_RX_TLV64_HDR_SIZE;
- /* parse tlv and populate tx_ppdu_info */
- ppdu_info = hal_tx_get_ppdu_info(data_ppdu_info,
- prot_ppdu_info, tlv_tag);
- tx_status_info = (ppdu_info->is_data ? data_status_info :
- prot_status_info);
- user_id = user_id > ppdu_info->num_users ? 0 : ppdu_info->num_users;
- switch (tlv_tag) {
- /* start of initiator FES window */
- case WIFITX_FES_SETUP_E:/* DOWNSTREAM */
- {
- /* initiator PPDU window start */
- hal_txmon_parse_tx_fes_setup(tx_tlv, ppdu_info);
- status = HAL_MON_TX_FES_SETUP;
- SHOW_DEFINED(WIFITX_FES_SETUP_E);
- break;
- }
- /* end of initiator FES window */
- case WIFITX_FES_STATUS_END_E:/* UPSTREAM */
- {
- /* initiator PPDU window end */
- uint32_t ppdu_timestamp_start = 0;
- uint32_t ppdu_timestamp_end = 0;
- uint8_t response_type = 0;
- uint8_t r2r_end_status_follow = 0;
- status = HAL_MON_TX_FES_STATUS_END;
- ppdu_timestamp_start =
- HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
- START_OF_FRAME_TIMESTAMP_15_0) |
- (HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
- START_OF_FRAME_TIMESTAMP_31_16) <<
- HAL_TX_LSB(TX_FES_STATUS_END,
- START_OF_FRAME_TIMESTAMP_31_16));
- ppdu_timestamp_end =
- HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
- END_OF_FRAME_TIMESTAMP_15_0) |
- (HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
- END_OF_FRAME_TIMESTAMP_31_16) <<
- HAL_TX_LSB(TX_FES_STATUS_END,
- END_OF_FRAME_TIMESTAMP_31_16));
- response_type = HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
- RESPONSE_TYPE);
- /*
- * r2r end status follow to inform whether to look for
- * rx_response_required_info
- */
- r2r_end_status_follow =
- HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_END,
- R2R_END_STATUS_TO_FOLLOW);
- TXMON_STATUS_INFO(tx_status_info,
- response_type) = response_type;
- TXMON_STATUS_INFO(tx_status_info,
- r2r_to_follow) = r2r_end_status_follow;
- /* update phy timestamp to ppdu timestamp */
- TXMON_HAL_STATUS(ppdu_info,
- ppdu_timestamp) = ppdu_timestamp_start;
- SHOW_DEFINED(WIFITX_FES_STATUS_END_E);
- break;
- }
- /* response window open */
- case WIFIRX_RESPONSE_REQUIRED_INFO_E:/* UPSTREAM */
- {
- /* response PPDU window start */
- uint32_t ppdu_id = 0;
- uint8_t reception_type = 0;
- uint8_t response_sta_count = 0;
- status = HAL_MON_RX_RESPONSE_REQUIRED_INFO;
- ppdu_id = HAL_TX_DESC_GET_64(tx_tlv,
- RX_RESPONSE_REQUIRED_INFO,
- PHY_PPDU_ID);
- reception_type =
- HAL_TX_DESC_GET_64(tx_tlv, RX_RESPONSE_REQUIRED_INFO,
- SU_OR_UPLINK_MU_RECEPTION);
- response_sta_count =
- HAL_TX_DESC_GET_64(tx_tlv, RX_RESPONSE_REQUIRED_INFO,
- RESPONSE_STA_COUNT);
- /* get mac address */
- *(uint32_t *)&tx_status_info->addr1[0] =
- HAL_TX_DESC_GET_64(tx_tlv,
- RX_RESPONSE_REQUIRED_INFO,
- ADDR1_31_0);
- *(uint32_t *)&tx_status_info->addr1[4] =
- HAL_TX_DESC_GET_64(tx_tlv,
- RX_RESPONSE_REQUIRED_INFO,
- ADDR1_47_32);
- *(uint32_t *)&tx_status_info->addr2[0] =
- HAL_TX_DESC_GET_64(tx_tlv,
- RX_RESPONSE_REQUIRED_INFO,
- ADDR2_15_0);
- *(uint32_t *)&tx_status_info->addr2[2] =
- HAL_TX_DESC_GET_64(tx_tlv,
- RX_RESPONSE_REQUIRED_INFO,
- ADDR2_47_16);
- TXMON_HAL(ppdu_info, ppdu_id) = ppdu_id;
- TXMON_HAL_STATUS(ppdu_info, ppdu_id) = ppdu_id;
- if (response_sta_count == 0)
- response_sta_count = 1;
- TXMON_HAL(ppdu_info, num_users) = response_sta_count;
- if (reception_type)
- TXMON_STATUS_INFO(tx_status_info,
- transmission_type) =
- TXMON_SU_TRANSMISSION;
- else
- TXMON_STATUS_INFO(tx_status_info,
- transmission_type) =
- TXMON_MU_TRANSMISSION;
- SHOW_DEFINED(WIFIRX_RESPONSE_REQUIRED_INFO_E);
- break;
- }
- /* Response window close */
- case WIFIRESPONSE_END_STATUS_E:/* UPSTREAM */
- {
- /* response PPDU window end */
- uint8_t generated_response = 0;
- uint32_t bandwidth = 0;
- uint32_t ppdu_timestamp_start = 0;
- uint32_t ppdu_timestamp_end = 0;
- status = HAL_MON_RESPONSE_END_STATUS_INFO;
- generated_response = HAL_TX_DESC_GET_64(tx_tlv,
- RESPONSE_END_STATUS,
- GENERATED_RESPONSE);
- bandwidth = HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
- COEX_BASED_TX_BW);
- /* 32 bits TSF */
- ppdu_timestamp_start =
- (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
- START_OF_FRAME_TIMESTAMP_15_0) |
- (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
- START_OF_FRAME_TIMESTAMP_31_16) <<
- 16));
- ppdu_timestamp_end =
- (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
- END_OF_FRAME_TIMESTAMP_15_0) |
- (HAL_TX_DESC_GET_64(tx_tlv, RESPONSE_END_STATUS,
- END_OF_FRAME_TIMESTAMP_31_16) <<
- 16));
- TXMON_HAL_STATUS(ppdu_info, bw) = bandwidth;
- /* update phy timestamp to ppdu timestamp */
- TXMON_HAL_STATUS(ppdu_info,
- ppdu_timestamp) = ppdu_timestamp_start;
- TXMON_STATUS_INFO(tx_status_info,
- generated_response) = generated_response;
- SHOW_DEFINED(WIFIRESPONSE_END_STATUS_E);
- break;
- }
- case WIFITX_FLUSH_E:/* DOWNSTREAM */
- {
- SHOW_DEFINED(WIFITX_FLUSH_E);
- break;
- }
- /* Downstream tlv */
- case WIFIPCU_PPDU_SETUP_INIT_E:/* DOWNSTREAM */
- {
- hal_txmon_parse_pcu_ppdu_setup_init(tx_tlv, data_status_info,
- prot_status_info);
- status = HAL_MON_TX_PCU_PPDU_SETUP_INIT;
- SHOW_DEFINED(WIFIPCU_PPDU_SETUP_INIT_E);
- break;
- }
- case WIFITX_PEER_ENTRY_E:/* DOWNSTREAM */
- {
- hal_txmon_parse_peer_entry(tx_tlv, user_id,
- ppdu_info, tx_status_info);
- SHOW_DEFINED(WIFITX_PEER_ENTRY_E);
- break;
- }
- case WIFITX_QUEUE_EXTENSION_E:/* DOWNSTREAM */
- {
- status = HAL_MON_TX_QUEUE_EXTENSION;
- hal_txmon_parse_queue_exten(tx_tlv, ppdu_info);
- SHOW_DEFINED(WIFITX_QUEUE_EXTENSION_E);
- break;
- }
- /* payload and data frame handling */
- case WIFITX_MPDU_START_E:/* DOWNSTREAM */
- {
- hal_txmon_parse_mpdu_start(tx_tlv, user_id, ppdu_info);
- status = HAL_MON_TX_MPDU_START;
- SHOW_DEFINED(WIFITX_MPDU_START_E);
- break;
- }
- case WIFITX_MSDU_START_E:/* DOWNSTREAM */
- {
- /* compacted */
- /* we expect frame to be 802.11 frame type */
- status = HAL_MON_TX_MSDU_START;
- SHOW_DEFINED(WIFITX_MSDU_START_E);
- break;
- }
- case WIFITX_DATA_E:/* DOWNSTREAM */
- {
- status = HAL_MON_TX_DATA;
- /*
- * TODO: do we need a conversion api to convert
- * user_id from hw to get host user_index
- */
- TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
- TXMON_STATUS_INFO(tx_status_info,
- buffer) = (void *)status_frag;
- TXMON_STATUS_INFO(tx_status_info,
- offset) = ((void *)tx_tlv -
- (void *)status_frag);
- TXMON_STATUS_INFO(tx_status_info,
- length) = tlv_len;
- /*
- * reference of the status buffer will be held in
- * dp_tx_update_ppdu_info_status()
- */
- status = HAL_MON_TX_DATA;
- SHOW_DEFINED(WIFITX_DATA_E);
- break;
- }
- case WIFIMON_BUFFER_ADDR_E:/* DOWNSTREAM */
- {
- struct hal_mon_buf_addr_status buf_status = {0};
- status = HAL_MON_TX_BUFFER_ADDR;
- /*
- * TODO: do we need a conversion api to convert
- * user_id from hw to get host user_index
- */
- TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
- frag_buf = hal_txmon_get_buffer_addr_generic_be(tx_tlv,
- &buf_status);
- TXMON_STATUS_INFO(tx_status_info,
- buffer) = (void *)frag_buf;
- TXMON_STATUS_INFO(tx_status_info, offset) = 0;
- TXMON_STATUS_INFO(tx_status_info,
- length) = buf_status.dma_length;
- SHOW_DEFINED(WIFIMON_BUFFER_ADDR_E);
- break;
- }
- case WIFITX_MPDU_END_E:/* DOWNSTREAM */
- {
- /* no tlv content */
- SHOW_DEFINED(WIFITX_MPDU_END_E);
- break;
- }
- case WIFITX_MSDU_END_E:/* DOWNSTREAM */
- {
- /* no tlv content */
- SHOW_DEFINED(WIFITX_MSDU_END_E);
- break;
- }
- case WIFITX_LAST_MPDU_FETCHED_E:/* DOWNSTREAM */
- {
- /* no tlv content */
- SHOW_DEFINED(WIFITX_LAST_MPDU_FETCHED_E);
- break;
- }
- case WIFITX_LAST_MPDU_END_E:/* DOWNSTREAM */
- {
- /* no tlv content */
- SHOW_DEFINED(WIFITX_LAST_MPDU_END_E);
- break;
- }
- case WIFICOEX_TX_REQ_E:/* DOWNSTREAM */
- {
- /*
- * transmitting power
- * minimum transmitting power
- * desired nss
- * tx chain mask
- * desired bw
- * duration of transmit and response
- *
- * since most of the field we are deriving from other tlv
- * we don't need to enable this in our tlv.
- */
- SHOW_DEFINED(WIFICOEX_TX_REQ_E);
- break;
- }
- case WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E:/* DOWNSTREAM */
- {
- /* user tlv */
- /*
- * All Tx monitor will have 802.11 hdr
- * we don't need to enable this TLV
- */
- SHOW_DEFINED(WIFITX_RAW_OR_NATIVE_FRAME_SETUP_E);
- break;
- }
- case WIFINDP_PREAMBLE_DONE_E:/* DOWNSTREAM */
- {
- /*
- * no tlv content
- *
- * TLV that indicates to TXPCU that preamble phase for the NDP
- * frame transmission is now over
- */
- SHOW_DEFINED(WIFINDP_PREAMBLE_DONE_E);
- break;
- }
- case WIFISCH_CRITICAL_TLV_REFERENCE_E:/* DOWNSTREAM */
- {
- /*
- * no tlv content
- *
- * TLV indicates to the SCH that all timing critical TLV
- * has been passed on to the transmit path
- */
- SHOW_DEFINED(WIFISCH_CRITICAL_TLV_REFERENCE_E);
- break;
- }
- case WIFITX_LOOPBACK_SETUP_E:/* DOWNSTREAM */
- {
- /*
- * Loopback specific setup info - not needed for Tx monitor
- */
- SHOW_DEFINED(WIFITX_LOOPBACK_SETUP_E);
- break;
- }
- case WIFITX_FES_SETUP_COMPLETE_E:/* DOWNSTREAM */
- {
- /*
- * no tlv content
- *
- * TLV indicates that other modules besides the scheduler can
- * now also start generating TLV's
- * prevent colliding or generating TLV's out of order
- */
- SHOW_DEFINED(WIFITX_FES_SETUP_COMPLETE_E);
- break;
- }
- case WIFITQM_MPDU_GLOBAL_START_E:/* DOWNSTREAM */
- {
- /*
- * no tlv content
- *
- * TLV indicates to SCH that a burst of MPDU info will
- * start to come in over the TLV
- */
- SHOW_DEFINED(WIFITQM_MPDU_GLOBAL_START_E);
- break;
- }
- case WIFITX_WUR_DATA_E:/* DOWNSTREAM */
- {
- SHOW_DEFINED(WIFITX_WUR_DATA_E);
- break;
- }
- case WIFISCHEDULER_END_E:/* DOWNSTREAM */
- {
- /*
- * no tlv content
- *
- * TLV indicates END of all TLV's within the scheduler TLV
- */
- SHOW_DEFINED(WIFISCHEDULER_END_E);
- break;
- }
- /* Upstream tlv */
- case WIFIPDG_TX_REQ_E:
- {
- SHOW_DEFINED(WIFIPDG_TX_REQ_E);
- break;
- }
- case WIFITX_FES_STATUS_START_E:
- {
- /*
- * TLV indicating that first transmission on the medium
- */
- uint8_t medium_prot_type = 0;
- status = HAL_MON_TX_FES_STATUS_START;
- medium_prot_type = HAL_TX_DESC_GET_64(tx_tlv,
- TX_FES_STATUS_START,
- MEDIUM_PROT_TYPE);
- ppdu_info = (struct hal_tx_ppdu_info *)prot_ppdu_info;
- /* update what type of medium protection frame */
- TXMON_STATUS_INFO(tx_status_info,
- medium_prot_type) = medium_prot_type;
- SHOW_DEFINED(WIFITX_FES_STATUS_START_E);
- break;
- }
- case WIFITX_FES_STATUS_PROT_E:
- {
- uint32_t start_timestamp = 0;
- uint32_t end_timestamp = 0;
- /*
- * generated by TXPCU to indicate the result of having
- * received of the expected protection frame
- */
- status = HAL_MON_TX_FES_STATUS_PROT;
- start_timestamp =
- HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
- START_OF_FRAME_TIMESTAMP_15_0);
- start_timestamp |=
- (HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
- START_OF_FRAME_TIMESTAMP_31_16) <<
- 15);
- end_timestamp = HAL_TX_DESC_GET_64(tx_tlv,
- TX_FES_STATUS_PROT,
- END_OF_FRAME_TIMESTAMP_15_0);
- end_timestamp |=
- HAL_TX_DESC_GET_64(tx_tlv, TX_FES_STATUS_PROT,
- END_OF_FRAME_TIMESTAMP_31_16) << 15;
- /* ppdu timestamp as phy timestamp */
- TXMON_HAL_STATUS(ppdu_info,
- ppdu_timestamp) = start_timestamp;
- SHOW_DEFINED(WIFITX_FES_STATUS_PROT_E);
- break;
- }
- case WIFITX_FES_STATUS_START_PROT_E:
- {
- uint64_t tsft_64;
- uint32_t response_type;
- status = HAL_MON_TX_FES_STATUS_START_PROT;
- TXMON_HAL(ppdu_info, prot_tlv_status) = tlv_tag;
- /* timestamp */
- tsft_64 = HAL_TX_DESC_GET_64(tx_tlv,
- TX_FES_STATUS_START_PROT,
- PROT_TIMESTAMP_LOWER_32);
- tsft_64 |= (HAL_TX_DESC_GET_64(tx_tlv,
- TX_FES_STATUS_START_PROT,
- PROT_TIMESTAMP_UPPER_32) << 32);
- response_type = HAL_TX_DESC_GET_64(tx_tlv,
- TX_FES_STATUS_START_PROT,
- RESPONSE_TYPE);
- TXMON_STATUS_INFO(tx_status_info,
- response_type) = response_type;
- TXMON_HAL_STATUS(ppdu_info, tsft) = tsft_64;
- SHOW_DEFINED(WIFITX_FES_STATUS_START_PROT_E);
- break;
- }
- case WIFIPROT_TX_END_E:
- {
- /*
- * no tlv content
- *
- * generated by TXPCU the moment that protection frame
- * transmission has finished on the medium
- */
- SHOW_DEFINED(WIFIPROT_TX_END_E);
- break;
- }
- case WIFITX_FES_STATUS_START_PPDU_E:
- {
- uint64_t tsft_64;
- uint8_t ndp_frame;
- status = HAL_MON_TX_FES_STATUS_START_PPDU;
- tsft_64 = HAL_TX_DESC_GET_64(tx_tlv,
- TX_FES_STATUS_START_PPDU,
- PPDU_TIMESTAMP_LOWER_32);
- tsft_64 |= (HAL_TX_DESC_GET_64(tx_tlv,
- TX_FES_STATUS_START_PPDU,
- PPDU_TIMESTAMP_UPPER_32) << 32);
- ndp_frame = HAL_TX_DESC_GET_64(tx_tlv,
- TX_FES_STATUS_START_PPDU,
- NDP_FRAME);
- TXMON_STATUS_INFO(tx_status_info, ndp_frame) = ndp_frame;
- TXMON_HAL_STATUS(ppdu_info, tsft) = tsft_64;
- SHOW_DEFINED(WIFITX_FES_STATUS_START_PPDU_E);
- break;
- }
- case WIFITX_FES_STATUS_USER_PPDU_E:
- {
- /* user tlv */
- uint16_t duration;
- uint8_t transmitted_tid;
- duration = HAL_TX_DESC_GET_64(tx_tlv,
- TX_FES_STATUS_USER_PPDU,
- DURATION);
- transmitted_tid = HAL_TX_DESC_GET_64(tx_tlv,
- TX_FES_STATUS_USER_PPDU,
- TRANSMITTED_TID);
- TXMON_HAL(ppdu_info, cur_usr_idx) = user_id;
- TXMON_HAL_USER(ppdu_info, user_id, tid) = transmitted_tid;
- TXMON_HAL_USER(ppdu_info, user_id, duration) = duration;
- status = HAL_MON_TX_FES_STATUS_USER_PPDU;
- SHOW_DEFINED(WIFITX_FES_STATUS_USER_PPDU_E);
- break;
- }
- case WIFIPPDU_TX_END_E:
- {
- /*
- * no tlv content
- *
- * generated by TXPCU the moment that PPDU transmission has
- * finished on the medium
- */
- SHOW_DEFINED(WIFIPPDU_TX_END_E);
- break;
- }
- case WIFITX_FES_STATUS_USER_RESPONSE_E:
- {
- /*
- * TLV contains the FES transmit result of the each
- * of the MAC users. TLV are forwarded to HWSCH
- */
- SHOW_DEFINED(WIFITX_FES_STATUS_USER_RESPONSE_E);
- break;
- }
- case WIFITX_FES_STATUS_ACK_OR_BA_E:
- {
- /* user tlv */
- /*
- * TLV generated by RXPCU and provide information related to
- * the received BA or ACK frame
- */
- SHOW_DEFINED(WIFITX_FES_STATUS_ACK_OR_BA_E);
- break;
- }
- case WIFITX_FES_STATUS_1K_BA_E:
- {
- /* user tlv */
- /*
- * TLV generated by RXPCU and providing information related
- * to the received BA frame in case of 512/1024 bitmaps
- */
- SHOW_DEFINED(WIFITX_FES_STATUS_1K_BA_E);
- break;
- }
- case WIFIRECEIVED_RESPONSE_USER_7_0_E:
- {
- SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_7_0_E);
- break;
- }
- case WIFIRECEIVED_RESPONSE_USER_15_8_E:
- {
- SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_15_8_E);
- break;
- }
- case WIFIRECEIVED_RESPONSE_USER_23_16_E:
- {
- SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_23_16_E);
- break;
- }
- case WIFIRECEIVED_RESPONSE_USER_31_24_E:
- {
- SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_31_24_E);
- break;
- }
- case WIFIRECEIVED_RESPONSE_USER_36_32_E:
- {
- /*
- * RXPCU generates this TLV when it receives a response frame
- * that TXPCU pre-announced it was waiting for and in
- * RXPCU_SETUP TLV, TLV generated before the
- * RECEIVED_RESPONSE_INFO TLV.
- *
- * received info user fields are there which is not needed
- * for TX monitor
- */
- SHOW_DEFINED(WIFIRECEIVED_RESPONSE_USER_36_32_E);
- break;
- }
- case WIFITXPCU_BUFFER_STATUS_E:
- {
- SHOW_DEFINED(WIFITXPCU_BUFFER_STATUS_E);
- break;
- }
- case WIFITXPCU_USER_BUFFER_STATUS_E:
- {
- /*
- * WIFITXPCU_USER_BUFFER_STATUS_E - user tlv
- * for TX monitor we aren't interested in this tlv
- */
- SHOW_DEFINED(WIFITXPCU_USER_BUFFER_STATUS_E);
- break;
- }
- case WIFITXDMA_STOP_REQUEST_E:
- {
- /*
- * no tlv content
- *
- * TLV is destined to TXDMA and informs TXDMA to stop
- * pushing data into the transmit path.
- */
- SHOW_DEFINED(WIFITXDMA_STOP_REQUEST_E);
- break;
- }
- case WIFITX_CBF_INFO_E:
- {
- /*
- * After NDPA + NDP is received, RXPCU sends the TX_CBF_INFO to
- * TXPCU to respond the CBF frame
- *
- * compressed beamforming pkt doesn't has mac header
- * Tx monitor not interested in this pkt.
- */
- SHOW_DEFINED(WIFITX_CBF_INFO_E);
- break;
- }
- case WIFITX_MPDU_COUNT_TRANSFER_END_E:
- {
- /*
- * no tlv content
- *
- * TLV indicates that TXPCU has finished generating the
- * TQM_UPDATE_TX_MPDU_COUNT TLV for all users
- */
- SHOW_DEFINED(WIFITX_MPDU_COUNT_TRANSFER_END_E);
- break;
- }
- case WIFIPDG_RESPONSE_E:
- {
- /*
- * most of the feilds are already covered in
- * other TLV
- * This is generated by TX_PCU to PDG to calculate
- * all the PHY header info.
- *
- * some useful fields like min transmit power,
- * rate used for transmitting packet is present.
- */
- SHOW_DEFINED(WIFIPDG_RESPONSE_E);
- break;
- }
- case WIFIPDG_TRIG_RESPONSE_E:
- {
- /* no tlv content */
- SHOW_DEFINED(WIFIPDG_TRIG_RESPONSE_E);
- break;
- }
- case WIFIRECEIVED_TRIGGER_INFO_E:
- {
- /*
- * TLV generated by RXPCU to inform the scheduler that
- * a trigger frame has been received
- */
- SHOW_DEFINED(WIFIRECEIVED_TRIGGER_INFO_E);
- break;
- }
- case WIFIOFDMA_TRIGGER_DETAILS_E:
- {
- SHOW_DEFINED(WIFIOFDMA_TRIGGER_DETAILS_E);
- break;
- }
- case WIFIRX_FRAME_BITMAP_ACK_E:
- {
- /* user tlv */
- status = HAL_MON_RX_FRAME_BITMAP_ACK;
- SHOW_DEFINED(WIFIRX_FRAME_BITMAP_ACK_E);
- break;
- }
- case WIFIRX_FRAME_1K_BITMAP_ACK_E:
- {
- /* user tlv */
- status = HAL_MON_RX_FRAME_BITMAP_BLOCK_ACK_1K;
- SHOW_DEFINED(WIFIRX_FRAME_1K_BITMAP_ACK_E);
- break;
- }
- case WIFIRESPONSE_START_STATUS_E:
- {
- /*
- * TLV indicates which HW response the TXPCU
- * started generating
- *
- * HW generated frames like
- * ACK frame - handled
- * CTS frame - handled
- * BA frame - handled
- * MBA frame - handled
- * CBF frame - no frame header
- * Trigger response - TODO
- * NDP LMR - no frame header
- */
- SHOW_DEFINED(WIFIRESPONSE_START_STATUS_E);
- break;
- }
- case WIFIRX_START_PARAM_E:
- {
- /*
- * RXPCU send this TLV after PHY RX detected a frame
- * in the medium
- *
- * TX monitor not interested in this TLV
- */
- SHOW_DEFINED(WIFIRX_START_PARAM_E);
- break;
- }
- case WIFIRXPCU_EARLY_RX_INDICATION_E:
- {
- /*
- * early indication of pkt type and mcs rate
- * already captured in other tlv
- */
- SHOW_DEFINED(WIFIRXPCU_EARLY_RX_INDICATION_E);
- break;
- }
- case WIFIRX_PM_INFO_E:
- {
- SHOW_DEFINED(WIFIRX_PM_INFO_E);
- break;
- }
- /* Active window */
- case WIFITX_FLUSH_REQ_E:
- {
- SHOW_DEFINED(WIFITX_FLUSH_REQ_E);
- break;
- }
- case WIFICOEX_TX_STATUS_E:
- {
- /* duration are retrieved from coex tx status */
- uint16_t duration;
- uint8_t status_reason;
- status = HAL_MON_COEX_TX_STATUS;
- duration = HAL_TX_DESC_GET_64(tx_tlv,
- COEX_TX_STATUS,
- CURRENT_TX_DURATION);
- status_reason = HAL_TX_DESC_GET_64(tx_tlv,
- COEX_TX_STATUS,
- TX_STATUS_REASON);
- /* update duration */
- if (status_reason == COEX_FES_TX_START ||
- status_reason == COEX_RESPONSE_TX_START)
- TXMON_HAL_USER(ppdu_info, user_id, duration) = duration;
- SHOW_DEFINED(WIFICOEX_TX_STATUS_E);
- break;
- }
- case WIFIR2R_STATUS_END_E:
- {
- SHOW_DEFINED(WIFIR2R_STATUS_END_E);
- break;
- }
- case WIFIRX_PREAMBLE_E:
- {
- SHOW_DEFINED(WIFIRX_PREAMBLE_E);
- break;
- }
- case WIFIMACTX_SERVICE_E:
- {
- SHOW_DEFINED(WIFIMACTX_SERVICE_E);
- break;
- }
- case WIFIMACTX_U_SIG_EHT_SU_MU_E:
- {
- SHOW_DEFINED(WIFIMACTX_U_SIG_EHT_SU_MU_E);
- break;
- }
- case WIFIMACTX_U_SIG_EHT_TB_E:
- {
- /* TODO: no radiotap info available */
- SHOW_DEFINED(WIFIMACTX_U_SIG_EHT_TB_E);
- break;
- }
- case WIFIMACTX_EHT_SIG_USR_OFDMA_E:
- {
- SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_OFDMA_E);
- break;
- }
- case WIFIMACTX_EHT_SIG_USR_MU_MIMO_E:
- {
- SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_MU_MIMO_E);
- break;
- }
- case WIFIMACTX_EHT_SIG_USR_SU_E:
- {
- SHOW_DEFINED(WIFIMACTX_EHT_SIG_USR_SU_E);
- /* TODO: no radiotap info available */
- break;
- }
- case WIFIMACTX_HE_SIG_A_SU_E:
- {
- SHOW_DEFINED(WIFIMACTX_HE_SIG_A_SU_E);
- break;
- }
- case WIFIMACTX_HE_SIG_A_MU_DL_E:
- {
- SHOW_DEFINED(WIFIMACTX_HE_SIG_A_MU_DL_E);
- break;
- }
- case WIFIMACTX_HE_SIG_A_MU_UL_E:
- {
- SHOW_DEFINED(WIFIMACTX_HE_SIG_A_MU_UL_E);
- break;
- }
- case WIFIMACTX_HE_SIG_B1_MU_E:
- {
- status = HAL_MON_MACTX_HE_SIG_B1_MU;
- SHOW_DEFINED(WIFIMACTX_HE_SIG_B1_MU_E);
- break;
- }
- case WIFIMACTX_HE_SIG_B2_MU_E:
- {
- /* user tlv */
- status = HAL_MON_MACTX_HE_SIG_B2_MU;
- SHOW_DEFINED(WIFIMACTX_HE_SIG_B2_MU_E);
- break;
- }
- case WIFIMACTX_HE_SIG_B2_OFDMA_E:
- {
- /* user tlv */
- status = HAL_MON_MACTX_HE_SIG_B2_OFDMA;
- SHOW_DEFINED(WIFIMACTX_HE_SIG_B2_OFDMA_E);
- break;
- }
- case WIFIMACTX_L_SIG_A_E:
- {
- status = HAL_MON_MACTX_L_SIG_A;
- SHOW_DEFINED(WIFIMACTX_L_SIG_A_E);
- break;
- }
- case WIFIMACTX_L_SIG_B_E:
- {
- status = HAL_MON_MACTX_L_SIG_B;
- SHOW_DEFINED(WIFIMACTX_L_SIG_B_E);
- break;
- }
- case WIFIMACTX_HT_SIG_E:
- {
- status = HAL_MON_MACTX_HT_SIG;
- SHOW_DEFINED(WIFIMACTX_HT_SIG_E);
- break;
- }
- case WIFIMACTX_VHT_SIG_A_E:
- {
- status = HAL_MON_MACTX_VHT_SIG_A;
- SHOW_DEFINED(WIFIMACTX_VHT_SIG_A_E);
- break;
- }
- case WIFIMACTX_VHT_SIG_B_MU160_E:
- {
- SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU160_E);
- break;
- }
- case WIFIMACTX_VHT_SIG_B_MU80_E:
- {
- SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU80_E);
- break;
- }
- case WIFIMACTX_VHT_SIG_B_MU40_E:
- {
- SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU40_E);
- break;
- }
- case WIFIMACTX_VHT_SIG_B_MU20_E:
- {
- SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_MU20_E);
- break;
- }
- case WIFIMACTX_VHT_SIG_B_SU160_E:
- {
- SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU160_E);
- break;
- }
- case WIFIMACTX_VHT_SIG_B_SU80_E:
- {
- SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU80_E);
- break;
- }
- case WIFIMACTX_VHT_SIG_B_SU40_E:
- {
- SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU40_E);
- break;
- }
- case WIFIMACTX_VHT_SIG_B_SU20_E:
- {
- SHOW_DEFINED(WIFIMACTX_VHT_SIG_B_SU20_E);
- break;
- }
- case WIFIPHYTX_PPDU_HEADER_INFO_REQUEST_E:
- {
- SHOW_DEFINED(WIFIPHYTX_PPDU_HEADER_INFO_REQUEST_E);
- break;
- }
- case WIFIMACTX_USER_DESC_PER_USER_E:
- {
- status = HAL_MON_MACTX_USER_DESC_PER_USER;
- SHOW_DEFINED(WIFIMACTX_USER_DESC_PER_USER_E);
- break;
- }
- case WIFIMACTX_USER_DESC_COMMON_E:
- {
- SHOW_DEFINED(WIFIMACTX_USER_DESC_COMMON_E);
- break;
- }
- case WIFIMACTX_PHY_DESC_E:
- {
- status = HAL_MON_MACTX_PHY_DESC;
- SHOW_DEFINED(WIFIMACTX_PHY_DESC_E);
- break;
- }
- case WIFICOEX_RX_STATUS_E:
- {
- SHOW_DEFINED(WIFICOEX_RX_STATUS_E);
- break;
- }
- case WIFIRX_PPDU_ACK_REPORT_E:
- {
- SHOW_DEFINED(WIFIRX_PPDU_ACK_REPORT_E);
- break;
- }
- case WIFIRX_PPDU_NO_ACK_REPORT_E:
- {
- SHOW_DEFINED(WIFIRX_PPDU_NO_ACK_REPORT_E);
- break;
- }
- case WIFITXPCU_PHYTX_OTHER_TRANSMIT_INFO32_E:
- {
- SHOW_DEFINED(WIFITXPCU_PHYTX_OTHER_TRANSMIT_INFO32_E);
- break;
- }
- case WIFITXPCU_PHYTX_DEBUG32_E:
- {
- SHOW_DEFINED(WIFITXPCU_PHYTX_DEBUG32_E);
- break;
- }
- case WIFITXPCU_PREAMBLE_DONE_E:
- {
- SHOW_DEFINED(WIFITXPCU_PREAMBLE_DONE_E);
- break;
- }
- case WIFIRX_PHY_SLEEP_E:
- {
- SHOW_DEFINED(WIFIRX_PHY_SLEEP_E);
- break;
- }
- case WIFIRX_FRAME_BITMAP_REQ_E:
- {
- SHOW_DEFINED(WIFIRX_FRAME_BITMAP_REQ_E);
- break;
- }
- case WIFIRXPCU_TX_SETUP_CLEAR_E:
- {
- SHOW_DEFINED(WIFIRXPCU_TX_SETUP_CLEAR_E);
- break;
- }
- case WIFIRX_TRIG_INFO_E:
- {
- SHOW_DEFINED(WIFIRX_TRIG_INFO_E);
- break;
- }
- case WIFIEXPECTED_RESPONSE_E:
- {
- SHOW_DEFINED(WIFIEXPECTED_RESPONSE_E);
- break;
- }
- case WIFITRIGGER_RESPONSE_TX_DONE_E:
- {
- SHOW_DEFINED(WIFITRIGGER_RESPONSE_TX_DONE_E);
- break;
- }
- }
- return status;
- }
- #endif /* QCA_MONITOR_2_0_SUPPORT */
- #ifdef REO_SHARED_QREF_TABLE_EN
- static void hal_reo_shared_qaddr_cache_clear_be(hal_soc_handle_t hal_soc_hdl)
- {
- struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
- uint32_t reg_val = 0;
- /* Set Qdesc clear bit to erase REO internal storage for Qdesc pointers
- * of 37 peer/tids
- */
- reg_val = HAL_REG_READ(hal, HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE));
- reg_val |= HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, CLEAR_QDESC_ARRAY, 1);
- HAL_REG_WRITE(hal,
- HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
- reg_val);
- /* Clear Qdesc clear bit to erase REO internal storage for Qdesc pointers
- * of 37 peer/tids
- */
- reg_val &= ~(HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, CLEAR_QDESC_ARRAY, 1));
- HAL_REG_WRITE(hal,
- HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
- reg_val);
- hal_verbose_debug("hal_soc: %pK :Setting CLEAR_DESC_ARRAY field of"
- "WCSS_UMAC_REO_R0_QDESC_ADDR_READ and resetting back"
- "to erase stale entries in reo storage: regval:%x", hal, reg_val);
- }
- /* hal_reo_shared_qaddr_write(): Write REO tid queue addr
- * LUT shared by SW and HW at the index given by peer id
- * and tid.
- *
- * @hal_soc: hal soc pointer
- * @reo_qref_addr: pointer to index pointed to be peer_id
- * and tid
- * @tid: tid queue number
- * @hw_qdesc_paddr: reo queue addr
- */
- static void hal_reo_shared_qaddr_write_be(hal_soc_handle_t hal_soc_hdl,
- uint16_t peer_id,
- int tid,
- qdf_dma_addr_t hw_qdesc_paddr)
- {
- struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
- struct rx_reo_queue_reference *reo_qref;
- uint32_t peer_tid_idx;
- /* Plug hw_desc_addr in Host reo queue reference table */
- if (HAL_PEER_ID_IS_MLO(peer_id)) {
- peer_tid_idx = ((peer_id - HAL_ML_PEER_ID_START) *
- DP_MAX_TIDS) + tid;
- reo_qref = (struct rx_reo_queue_reference *)
- &hal->reo_qref.mlo_reo_qref_table_vaddr[peer_tid_idx];
- } else {
- peer_tid_idx = (peer_id * DP_MAX_TIDS) + tid;
- reo_qref = (struct rx_reo_queue_reference *)
- &hal->reo_qref.non_mlo_reo_qref_table_vaddr[peer_tid_idx];
- }
- reo_qref->rx_reo_queue_desc_addr_31_0 =
- hw_qdesc_paddr & 0xffffffff;
- reo_qref->rx_reo_queue_desc_addr_39_32 =
- (hw_qdesc_paddr & 0xff00000000) >> 32;
- if (hw_qdesc_paddr != 0)
- reo_qref->receive_queue_number = tid;
- else
- reo_qref->receive_queue_number = 0;
- hal_reo_shared_qaddr_cache_clear_be(hal_soc_hdl);
- hal_verbose_debug("hw_qdesc_paddr: %pK, tid: %d, reo_qref:%pK,"
- "rx_reo_queue_desc_addr_31_0: %x,"
- "rx_reo_queue_desc_addr_39_32: %x",
- (void *)hw_qdesc_paddr, tid, reo_qref,
- reo_qref->rx_reo_queue_desc_addr_31_0,
- reo_qref->rx_reo_queue_desc_addr_39_32);
- }
- /**
- * hal_reo_shared_qaddr_setup() - Allocate MLO and Non MLO reo queue
- * reference table shared between SW and HW and initialize in Qdesc Base0
- * base1 registers provided by HW.
- *
- * @hal_soc: HAL Soc handle
- *
- * Return: None
- */
- static void hal_reo_shared_qaddr_setup_be(hal_soc_handle_t hal_soc_hdl)
- {
- struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
- hal->reo_qref.reo_qref_table_en = 1;
- hal->reo_qref.mlo_reo_qref_table_vaddr =
- (uint64_t *)qdf_mem_alloc_consistent(
- hal->qdf_dev, hal->qdf_dev->dev,
- REO_QUEUE_REF_ML_TABLE_SIZE,
- &hal->reo_qref.mlo_reo_qref_table_paddr);
- hal->reo_qref.non_mlo_reo_qref_table_vaddr =
- (uint64_t *)qdf_mem_alloc_consistent(
- hal->qdf_dev, hal->qdf_dev->dev,
- REO_QUEUE_REF_NON_ML_TABLE_SIZE,
- &hal->reo_qref.non_mlo_reo_qref_table_paddr);
- hal_verbose_debug("MLO table start paddr:%pK,"
- "Non-MLO table start paddr:%pK,"
- "MLO table start vaddr: %pK,"
- "Non MLO table start vaddr: %pK",
- (void *)hal->reo_qref.mlo_reo_qref_table_paddr,
- (void *)hal->reo_qref.non_mlo_reo_qref_table_paddr,
- hal->reo_qref.mlo_reo_qref_table_vaddr,
- hal->reo_qref.non_mlo_reo_qref_table_vaddr);
- }
- /**
- * hal_reo_shared_qaddr_init() - Zero out REO qref LUT and
- * write start addr of MLO and Non MLO table in HW
- *
- * @hal_soc: HAL Soc handle
- *
- * Return: None
- */
- static void hal_reo_shared_qaddr_init_be(hal_soc_handle_t hal_soc_hdl)
- {
- struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
- qdf_mem_zero(hal->reo_qref.mlo_reo_qref_table_vaddr,
- REO_QUEUE_REF_ML_TABLE_SIZE);
- qdf_mem_zero(hal->reo_qref.non_mlo_reo_qref_table_vaddr,
- REO_QUEUE_REF_NON_ML_TABLE_SIZE);
- /* LUT_BASE0 and BASE1 registers expect upper 32bits of LUT base address
- * and lower 8 bits to be 0. Shift the physical address by 8 to plug
- * upper 32bits only
- */
- HAL_REG_WRITE(hal,
- HWIO_REO_R0_QDESC_LUT_BASE0_ADDR_ADDR(REO_REG_REG_BASE),
- hal->reo_qref.non_mlo_reo_qref_table_paddr >> 8);
- HAL_REG_WRITE(hal,
- HWIO_REO_R0_QDESC_LUT_BASE1_ADDR_ADDR(REO_REG_REG_BASE),
- hal->reo_qref.mlo_reo_qref_table_paddr >> 8);
- HAL_REG_WRITE(hal,
- HWIO_REO_R0_QDESC_ADDR_READ_ADDR(REO_REG_REG_BASE),
- HAL_SM(HWIO_REO_R0_QDESC_ADDR_READ, LUT_FEATURE_ENABLE,
- 1));
- HAL_REG_WRITE(hal,
- HWIO_REO_R0_QDESC_MAX_SW_PEER_ID_ADDR(REO_REG_REG_BASE),
- HAL_MS(HWIO_REO_R0_QDESC, MAX_SW_PEER_ID_MAX_SUPPORTED,
- 0x1fff));
- }
- /**
- * hal_reo_shared_qaddr_detach() - Free MLO and Non MLO reo queue
- * reference table shared between SW and HW
- *
- * @hal_soc: HAL Soc handle
- *
- * Return: None
- */
- static void hal_reo_shared_qaddr_detach_be(hal_soc_handle_t hal_soc_hdl)
- {
- struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl;
- HAL_REG_WRITE(hal,
- HWIO_REO_R0_QDESC_LUT_BASE0_ADDR_ADDR(REO_REG_REG_BASE),
- 0);
- HAL_REG_WRITE(hal,
- HWIO_REO_R0_QDESC_LUT_BASE1_ADDR_ADDR(REO_REG_REG_BASE),
- 0);
- qdf_mem_free_consistent(hal->qdf_dev, hal->qdf_dev->dev,
- REO_QUEUE_REF_ML_TABLE_SIZE,
- hal->reo_qref.mlo_reo_qref_table_vaddr,
- hal->reo_qref.mlo_reo_qref_table_paddr, 0);
- qdf_mem_free_consistent(hal->qdf_dev, hal->qdf_dev->dev,
- REO_QUEUE_REF_NON_ML_TABLE_SIZE,
- hal->reo_qref.non_mlo_reo_qref_table_vaddr,
- hal->reo_qref.non_mlo_reo_qref_table_paddr, 0);
- }
- #endif
- #endif /* _HAL_BE_GENERIC_API_H_ */
|