dp_rx_mon_status.c 70 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539
  1. /*
  2. * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #include "hal_hw_headers.h"
  19. #include "dp_types.h"
  20. #include "dp_rx.h"
  21. #include "dp_peer.h"
  22. #include "hal_rx.h"
  23. #include "hal_api.h"
  24. #include "qdf_trace.h"
  25. #include "qdf_nbuf.h"
  26. #include "hal_api_mon.h"
  27. #include "dp_rx_mon.h"
  28. #include "dp_internal.h"
  29. #include "qdf_mem.h" /* qdf_mem_malloc,free */
  30. #include "htt.h"
  31. #ifdef FEATURE_PERPKT_INFO
  32. #include "dp_ratetable.h"
  33. #endif
  34. static inline
  35. QDF_STATUS dp_rx_mon_status_buffers_replenish(struct dp_soc *dp_soc,
  36. uint32_t mac_id,
  37. struct dp_srng *dp_rxdma_srng,
  38. struct rx_desc_pool *rx_desc_pool,
  39. uint32_t num_req_buffers,
  40. union dp_rx_desc_list_elem_t **desc_list,
  41. union dp_rx_desc_list_elem_t **tail,
  42. uint8_t owner);
  43. static inline void
  44. dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev,
  45. struct hal_rx_ppdu_info *ppdu_info,
  46. struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
  47. /**
  48. * dp_rx_mon_handle_status_buf_done () - Handle status buf DMA not done
  49. *
  50. * @pdev: DP pdev handle
  51. * @mon_status_srng: Monitor status SRNG
  52. *
  53. * As per MAC team's suggestion, If HP + 2 entry's DMA done is set,
  54. * skip HP + 1 entry and start processing in next interrupt.
  55. * If HP + 2 entry's DMA done is not set, poll onto HP + 1 entry
  56. * for it's DMA done TLV to be set.
  57. *
  58. * Return: enum dp_mon_reap_status
  59. */
  60. enum dp_mon_reap_status
  61. dp_rx_mon_handle_status_buf_done(struct dp_pdev *pdev,
  62. void *mon_status_srng)
  63. {
  64. struct dp_soc *soc = pdev->soc;
  65. hal_soc_handle_t hal_soc;
  66. void *ring_entry;
  67. uint32_t rx_buf_cookie;
  68. qdf_nbuf_t status_nbuf;
  69. struct dp_rx_desc *rx_desc;
  70. void *rx_tlv;
  71. QDF_STATUS buf_status;
  72. hal_soc = soc->hal_soc;
  73. ring_entry = hal_srng_src_peek_n_get_next_next(hal_soc,
  74. mon_status_srng);
  75. if (!ring_entry) {
  76. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  77. FL("Monitor status ring entry is NULL "
  78. "for SRNG: %pK"),
  79. mon_status_srng);
  80. return DP_MON_STATUS_NO_DMA;
  81. }
  82. rx_buf_cookie = HAL_RX_BUF_COOKIE_GET(ring_entry);
  83. rx_desc = dp_rx_cookie_2_va_mon_status(soc, rx_buf_cookie);
  84. qdf_assert(rx_desc);
  85. status_nbuf = rx_desc->nbuf;
  86. qdf_nbuf_sync_for_cpu(soc->osdev, status_nbuf,
  87. QDF_DMA_FROM_DEVICE);
  88. rx_tlv = qdf_nbuf_data(status_nbuf);
  89. buf_status = hal_get_rx_status_done(rx_tlv);
  90. /* If status buffer DMA is not done,
  91. * 1. As per MAC team's suggestion, If HP + 2 entry's DMA done is set,
  92. * replenish HP + 1 entry and start processing in next interrupt.
  93. * 2. If HP + 2 entry's DMA done is not set
  94. * hold on to mon destination ring.
  95. */
  96. if (buf_status != QDF_STATUS_SUCCESS) {
  97. dp_err("Monitor status ring: DMA is not done "
  98. "for nbuf: %pK", status_nbuf);
  99. pdev->rx_mon_stats.tlv_tag_status_err++;
  100. return DP_MON_STATUS_NO_DMA;
  101. }
  102. pdev->rx_mon_stats.status_buf_done_war++;
  103. return DP_MON_STATUS_REPLENISH;
  104. }
  105. #ifndef QCA_SUPPORT_FULL_MON
  106. /**
  107. * dp_rx_mon_process () - Core brain processing for monitor mode
  108. *
  109. * This API processes monitor destination ring followed by monitor status ring
  110. * Called from bottom half (tasklet/NET_RX_SOFTIRQ)
  111. *
  112. * @soc: datapath soc context
  113. * @int_ctx: interrupt context
  114. * @mac_id: mac_id on which interrupt is received
  115. * @quota: Number of status ring entry that can be serviced in one shot.
  116. *
  117. * @Return: Number of reaped status ring entries
  118. */
  119. static inline uint32_t
  120. dp_rx_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  121. uint32_t mac_id, uint32_t quota)
  122. {
  123. return quota;
  124. }
  125. #endif
  126. #ifdef WLAN_RX_PKT_CAPTURE_ENH
  127. #include "dp_rx_mon_feature.h"
  128. #else
  129. static QDF_STATUS
  130. dp_rx_handle_enh_capture(struct dp_soc *soc, struct dp_pdev *pdev,
  131. struct hal_rx_ppdu_info *ppdu_info)
  132. {
  133. return QDF_STATUS_SUCCESS;
  134. }
  135. static void
  136. dp_rx_mon_enh_capture_process(struct dp_pdev *pdev, uint32_t tlv_status,
  137. qdf_nbuf_t status_nbuf,
  138. struct hal_rx_ppdu_info *ppdu_info,
  139. bool *nbuf_used)
  140. {
  141. }
  142. #endif
  143. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  144. #include "dp_rx_mon_feature.h"
  145. #else
  146. static QDF_STATUS
  147. dp_send_ack_frame_to_stack(struct dp_soc *soc,
  148. struct dp_pdev *pdev,
  149. struct hal_rx_ppdu_info *ppdu_info)
  150. {
  151. return QDF_STATUS_SUCCESS;
  152. }
  153. #endif
  154. #ifdef FEATURE_PERPKT_INFO
  155. static inline void
  156. dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info,
  157. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  158. {
  159. uint8_t chain, bw;
  160. int8_t rssi;
  161. for (chain = 0; chain < SS_COUNT; chain++) {
  162. for (bw = 0; bw < MAX_BW; bw++) {
  163. rssi = ppdu_info->rx_status.rssi_chain[chain][bw];
  164. if (rssi != DP_RSSI_INVAL)
  165. cdp_rx_ppdu->rssi_chain[chain][bw] = rssi;
  166. else
  167. cdp_rx_ppdu->rssi_chain[chain][bw] = 0;
  168. }
  169. }
  170. }
  171. /*
  172. * dp_rx_populate_su_evm_details() - Populate su evm info
  173. * @ppdu_info: ppdu info structure from ppdu ring
  174. * @cdp_rx_ppdu: rx ppdu indication structure
  175. */
  176. static inline void
  177. dp_rx_populate_su_evm_details(struct hal_rx_ppdu_info *ppdu_info,
  178. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  179. {
  180. uint8_t pilot_evm;
  181. uint8_t nss_count;
  182. uint8_t pilot_count;
  183. nss_count = ppdu_info->evm_info.nss_count;
  184. pilot_count = ppdu_info->evm_info.pilot_count;
  185. if ((nss_count * pilot_count) > DP_RX_MAX_SU_EVM_COUNT) {
  186. qdf_err("pilot evm count is more than expected");
  187. return;
  188. }
  189. cdp_rx_ppdu->evm_info.pilot_count = pilot_count;
  190. cdp_rx_ppdu->evm_info.nss_count = nss_count;
  191. /* Populate evm for pilot_evm = nss_count*pilot_count */
  192. for (pilot_evm = 0; pilot_evm < nss_count * pilot_count; pilot_evm++) {
  193. cdp_rx_ppdu->evm_info.pilot_evm[pilot_evm] =
  194. ppdu_info->evm_info.pilot_evm[pilot_evm];
  195. }
  196. }
  197. /**
  198. * dp_rx_inc_rusize_cnt() - increment pdev stats based on RU size
  199. * @pdev: pdev ctx
  200. * @rx_user_status: mon rx user status
  201. *
  202. * Return: bool
  203. */
  204. static inline bool
  205. dp_rx_inc_rusize_cnt(struct dp_pdev *pdev,
  206. struct mon_rx_user_status *rx_user_status)
  207. {
  208. uint32_t ru_size;
  209. bool is_data;
  210. ru_size = rx_user_status->ofdma_ru_size;
  211. if (dp_is_subtype_data(rx_user_status->frame_control)) {
  212. DP_STATS_INC(pdev,
  213. ul_ofdma.data_rx_ru_size[ru_size], 1);
  214. is_data = true;
  215. } else {
  216. DP_STATS_INC(pdev,
  217. ul_ofdma.nondata_rx_ru_size[ru_size], 1);
  218. is_data = false;
  219. }
  220. return is_data;
  221. }
  222. /**
  223. * dp_rx_populate_cdp_indication_ppdu_user() - Populate per user cdp indication
  224. * @pdev: pdev ctx
  225. * @ppdu_info: ppdu info structure from ppdu ring
  226. * @cdp_rx_ppdu: Rx PPDU indication structure
  227. *
  228. * Return: none
  229. */
  230. static inline void
  231. dp_rx_populate_cdp_indication_ppdu_user(struct dp_pdev *pdev,
  232. struct hal_rx_ppdu_info *ppdu_info,
  233. struct cdp_rx_indication_ppdu
  234. *cdp_rx_ppdu)
  235. {
  236. struct dp_peer *peer;
  237. struct dp_soc *soc = pdev->soc;
  238. struct dp_ast_entry *ast_entry;
  239. uint32_t ast_index;
  240. int i;
  241. struct mon_rx_user_status *rx_user_status;
  242. struct mon_rx_user_info *rx_user_info;
  243. struct cdp_rx_stats_ppdu_user *rx_stats_peruser;
  244. int ru_size;
  245. bool is_data = false;
  246. uint32_t num_users;
  247. num_users = ppdu_info->com_info.num_users;
  248. for (i = 0; i < num_users; i++) {
  249. if (i > OFDMA_NUM_USERS)
  250. return;
  251. rx_user_status = &ppdu_info->rx_user_status[i];
  252. rx_user_info = &ppdu_info->rx_user_info[i];
  253. rx_stats_peruser = &cdp_rx_ppdu->user[i];
  254. ast_index = rx_user_status->ast_index;
  255. if (ast_index >= wlan_cfg_get_max_ast_idx(soc->wlan_cfg_ctx)) {
  256. rx_stats_peruser->peer_id = HTT_INVALID_PEER;
  257. continue;
  258. }
  259. ast_entry = soc->ast_table[ast_index];
  260. if (!ast_entry || ast_entry->peer_id == HTT_INVALID_PEER) {
  261. rx_stats_peruser->peer_id = HTT_INVALID_PEER;
  262. continue;
  263. }
  264. peer = dp_peer_get_ref_by_id(soc, ast_entry->peer_id,
  265. DP_MOD_ID_RX_PPDU_STATS);
  266. if (!peer) {
  267. rx_stats_peruser->peer_id = HTT_INVALID_PEER;
  268. continue;
  269. }
  270. rx_stats_peruser->first_data_seq_ctrl =
  271. rx_user_status->first_data_seq_ctrl;
  272. rx_stats_peruser->frame_control_info_valid =
  273. rx_user_status->frame_control_info_valid;
  274. rx_stats_peruser->frame_control =
  275. rx_user_status->frame_control;
  276. rx_stats_peruser->qos_control_info_valid =
  277. rx_user_info->qos_control_info_valid;
  278. rx_stats_peruser->qos_control =
  279. rx_user_info->qos_control;
  280. rx_stats_peruser->tcp_msdu_count =
  281. rx_user_status->tcp_msdu_count;
  282. rx_stats_peruser->udp_msdu_count =
  283. rx_user_status->udp_msdu_count;
  284. rx_stats_peruser->other_msdu_count =
  285. rx_user_status->other_msdu_count;
  286. rx_stats_peruser->num_msdu =
  287. rx_stats_peruser->tcp_msdu_count +
  288. rx_stats_peruser->udp_msdu_count +
  289. rx_stats_peruser->other_msdu_count;
  290. rx_stats_peruser->preamble_type =
  291. rx_user_status->preamble_type;
  292. rx_stats_peruser->mpdu_cnt_fcs_ok =
  293. rx_user_status->mpdu_cnt_fcs_ok;
  294. rx_stats_peruser->mpdu_cnt_fcs_err =
  295. rx_user_status->mpdu_cnt_fcs_err;
  296. qdf_mem_copy(&rx_stats_peruser->mpdu_fcs_ok_bitmap,
  297. &rx_user_status->mpdu_fcs_ok_bitmap,
  298. HAL_RX_NUM_WORDS_PER_PPDU_BITMAP *
  299. sizeof(rx_user_status->mpdu_fcs_ok_bitmap[0]));
  300. rx_stats_peruser->mpdu_ok_byte_count =
  301. rx_user_status->mpdu_ok_byte_count;
  302. rx_stats_peruser->mpdu_err_byte_count =
  303. rx_user_status->mpdu_err_byte_count;
  304. cdp_rx_ppdu->num_mpdu += rx_user_status->mpdu_cnt_fcs_ok;
  305. cdp_rx_ppdu->num_msdu += rx_stats_peruser->num_msdu;
  306. rx_stats_peruser->retries =
  307. CDP_FC_IS_RETRY_SET(rx_stats_peruser->frame_control) ?
  308. rx_stats_peruser->mpdu_cnt_fcs_ok : 0;
  309. if (rx_stats_peruser->mpdu_cnt_fcs_ok > 1)
  310. rx_stats_peruser->is_ampdu = 1;
  311. else
  312. rx_stats_peruser->is_ampdu = 0;
  313. rx_stats_peruser->tid = ppdu_info->rx_status.tid;
  314. qdf_mem_copy(rx_stats_peruser->mac_addr,
  315. peer->mac_addr.raw, QDF_MAC_ADDR_SIZE);
  316. rx_stats_peruser->peer_id = peer->peer_id;
  317. cdp_rx_ppdu->vdev_id = peer->vdev->vdev_id;
  318. rx_stats_peruser->vdev_id = peer->vdev->vdev_id;
  319. rx_stats_peruser->mu_ul_info_valid = 0;
  320. dp_peer_unref_delete(peer, DP_MOD_ID_RX_PPDU_STATS);
  321. if (cdp_rx_ppdu->u.ppdu_type == HAL_RX_TYPE_MU_OFDMA ||
  322. cdp_rx_ppdu->u.ppdu_type == HAL_RX_TYPE_MU_MIMO) {
  323. if (rx_user_status->mu_ul_info_valid) {
  324. rx_stats_peruser->nss = rx_user_status->nss;
  325. rx_stats_peruser->mcs = rx_user_status->mcs;
  326. rx_stats_peruser->mu_ul_info_valid =
  327. rx_user_status->mu_ul_info_valid;
  328. rx_stats_peruser->ofdma_ru_start_index =
  329. rx_user_status->ofdma_ru_start_index;
  330. rx_stats_peruser->ofdma_ru_width =
  331. rx_user_status->ofdma_ru_width;
  332. rx_stats_peruser->user_index = i;
  333. ru_size = rx_user_status->ofdma_ru_size;
  334. /*
  335. * max RU size will be equal to
  336. * HTT_UL_OFDMA_V0_RU_SIZE_RU_996x2
  337. */
  338. if (ru_size >= OFDMA_NUM_RU_SIZE) {
  339. dp_err("invalid ru_size %d\n",
  340. ru_size);
  341. return;
  342. }
  343. is_data = dp_rx_inc_rusize_cnt(pdev,
  344. rx_user_status);
  345. }
  346. if (is_data) {
  347. /* counter to get number of MU OFDMA */
  348. pdev->stats.ul_ofdma.data_rx_ppdu++;
  349. pdev->stats.ul_ofdma.data_users[num_users]++;
  350. }
  351. }
  352. }
  353. }
  354. /**
  355. * dp_rx_populate_cdp_indication_ppdu() - Populate cdp rx indication structure
  356. * @pdev: pdev ctx
  357. * @ppdu_info: ppdu info structure from ppdu ring
  358. * @cdp_rx_ppdu: Rx PPDU indication structure
  359. *
  360. * Return: none
  361. */
  362. static inline void
  363. dp_rx_populate_cdp_indication_ppdu(struct dp_pdev *pdev,
  364. struct hal_rx_ppdu_info *ppdu_info,
  365. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  366. {
  367. struct dp_peer *peer;
  368. struct dp_soc *soc = pdev->soc;
  369. struct dp_ast_entry *ast_entry;
  370. uint32_t ast_index;
  371. uint32_t i;
  372. cdp_rx_ppdu->first_data_seq_ctrl =
  373. ppdu_info->rx_status.first_data_seq_ctrl;
  374. cdp_rx_ppdu->frame_ctrl =
  375. ppdu_info->rx_status.frame_control;
  376. cdp_rx_ppdu->tcp_msdu_count = ppdu_info->rx_status.tcp_msdu_count;
  377. cdp_rx_ppdu->udp_msdu_count = ppdu_info->rx_status.udp_msdu_count;
  378. cdp_rx_ppdu->other_msdu_count = ppdu_info->rx_status.other_msdu_count;
  379. cdp_rx_ppdu->u.preamble = ppdu_info->rx_status.preamble_type;
  380. /* num mpdu is consolidated and added together in num user loop */
  381. cdp_rx_ppdu->num_mpdu = ppdu_info->com_info.mpdu_cnt_fcs_ok;
  382. /* num msdu is consolidated and added together in num user loop */
  383. cdp_rx_ppdu->num_msdu = (cdp_rx_ppdu->tcp_msdu_count +
  384. cdp_rx_ppdu->udp_msdu_count +
  385. cdp_rx_ppdu->other_msdu_count);
  386. cdp_rx_ppdu->retries = CDP_FC_IS_RETRY_SET(cdp_rx_ppdu->frame_ctrl) ?
  387. ppdu_info->com_info.mpdu_cnt_fcs_ok : 0;
  388. if (ppdu_info->com_info.mpdu_cnt_fcs_ok > 1)
  389. cdp_rx_ppdu->is_ampdu = 1;
  390. else
  391. cdp_rx_ppdu->is_ampdu = 0;
  392. cdp_rx_ppdu->tid = ppdu_info->rx_status.tid;
  393. ast_index = ppdu_info->rx_status.ast_index;
  394. if (ast_index >= wlan_cfg_get_max_ast_idx(soc->wlan_cfg_ctx)) {
  395. cdp_rx_ppdu->peer_id = HTT_INVALID_PEER;
  396. cdp_rx_ppdu->num_users = 0;
  397. goto end;
  398. }
  399. ast_entry = soc->ast_table[ast_index];
  400. if (!ast_entry || ast_entry->peer_id == HTT_INVALID_PEER) {
  401. cdp_rx_ppdu->peer_id = HTT_INVALID_PEER;
  402. cdp_rx_ppdu->num_users = 0;
  403. goto end;
  404. }
  405. peer = dp_peer_get_ref_by_id(soc, ast_entry->peer_id,
  406. DP_MOD_ID_RX_PPDU_STATS);
  407. if (!peer) {
  408. cdp_rx_ppdu->peer_id = HTT_INVALID_PEER;
  409. cdp_rx_ppdu->num_users = 0;
  410. goto end;
  411. }
  412. qdf_mem_copy(cdp_rx_ppdu->mac_addr,
  413. peer->mac_addr.raw, QDF_MAC_ADDR_SIZE);
  414. cdp_rx_ppdu->peer_id = peer->peer_id;
  415. cdp_rx_ppdu->vdev_id = peer->vdev->vdev_id;
  416. cdp_rx_ppdu->ppdu_id = ppdu_info->com_info.ppdu_id;
  417. cdp_rx_ppdu->length = ppdu_info->rx_status.ppdu_len;
  418. cdp_rx_ppdu->duration = ppdu_info->rx_status.duration;
  419. cdp_rx_ppdu->u.bw = ppdu_info->rx_status.bw;
  420. cdp_rx_ppdu->u.nss = ppdu_info->rx_status.nss;
  421. cdp_rx_ppdu->u.mcs = ppdu_info->rx_status.mcs;
  422. if ((ppdu_info->rx_status.sgi == VHT_SGI_NYSM) &&
  423. (ppdu_info->rx_status.preamble_type == HAL_RX_PKT_TYPE_11AC))
  424. cdp_rx_ppdu->u.gi = CDP_SGI_0_4_US;
  425. else
  426. cdp_rx_ppdu->u.gi = ppdu_info->rx_status.sgi;
  427. cdp_rx_ppdu->u.ldpc = ppdu_info->rx_status.ldpc;
  428. cdp_rx_ppdu->u.ppdu_type = ppdu_info->rx_status.reception_type;
  429. cdp_rx_ppdu->u.ltf_size = (ppdu_info->rx_status.he_data5 >>
  430. QDF_MON_STATUS_HE_LTF_SIZE_SHIFT) & 0x3;
  431. cdp_rx_ppdu->rssi = ppdu_info->rx_status.rssi_comb;
  432. cdp_rx_ppdu->timestamp = ppdu_info->rx_status.tsft;
  433. cdp_rx_ppdu->channel = ppdu_info->rx_status.chan_num;
  434. cdp_rx_ppdu->beamformed = ppdu_info->rx_status.beamformed;
  435. cdp_rx_ppdu->num_bytes = ppdu_info->rx_status.ppdu_len;
  436. cdp_rx_ppdu->lsig_a = ppdu_info->rx_status.rate;
  437. cdp_rx_ppdu->u.ltf_size = ppdu_info->rx_status.ltf_size;
  438. dp_rx_populate_rx_rssi_chain(ppdu_info, cdp_rx_ppdu);
  439. dp_rx_populate_su_evm_details(ppdu_info, cdp_rx_ppdu);
  440. cdp_rx_ppdu->rx_antenna = ppdu_info->rx_status.rx_antenna;
  441. cdp_rx_ppdu->nf = ppdu_info->rx_status.chan_noise_floor;
  442. for (i = 0; i < MAX_CHAIN; i++)
  443. cdp_rx_ppdu->per_chain_rssi[i] = ppdu_info->rx_status.rssi[i];
  444. cdp_rx_ppdu->is_mcast_bcast = ppdu_info->nac_info.mcast_bcast;
  445. cdp_rx_ppdu->num_users = ppdu_info->com_info.num_users;
  446. cdp_rx_ppdu->num_mpdu = 0;
  447. cdp_rx_ppdu->num_msdu = 0;
  448. dp_rx_populate_cdp_indication_ppdu_user(pdev, ppdu_info, cdp_rx_ppdu);
  449. dp_peer_unref_delete(peer, DP_MOD_ID_RX_PPDU_STATS);
  450. return;
  451. end:
  452. dp_rx_populate_cfr_non_assoc_sta(pdev, ppdu_info, cdp_rx_ppdu);
  453. }
  454. #else
  455. static inline void
  456. dp_rx_populate_cdp_indication_ppdu(struct dp_pdev *pdev,
  457. struct hal_rx_ppdu_info *ppdu_info,
  458. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  459. {
  460. }
  461. #endif
  462. /**
  463. * dp_rx_stats_update() - Update per-peer statistics
  464. * @soc: Datapath SOC handle
  465. * @peer: Datapath peer handle
  466. * @ppdu: PPDU Descriptor
  467. *
  468. * Return: None
  469. */
  470. #ifdef FEATURE_PERPKT_INFO
  471. static inline void dp_rx_rate_stats_update(struct dp_peer *peer,
  472. struct cdp_rx_indication_ppdu *ppdu,
  473. uint32_t user)
  474. {
  475. uint32_t ratekbps = 0;
  476. uint32_t ppdu_rx_rate = 0;
  477. uint32_t nss = 0;
  478. uint8_t mcs = 0;
  479. uint32_t rix;
  480. uint16_t ratecode;
  481. struct cdp_rx_stats_ppdu_user *ppdu_user = NULL;
  482. if (!peer || !ppdu)
  483. return;
  484. if (ppdu->u.ppdu_type != HAL_RX_TYPE_SU) {
  485. ppdu_user = &ppdu->user[user];
  486. if (ppdu_user->nss == 0)
  487. nss = 0;
  488. else
  489. nss = ppdu_user->nss - 1;
  490. mcs = ppdu_user->mcs;
  491. } else {
  492. if (ppdu->u.nss == 0)
  493. nss = 0;
  494. else
  495. nss = ppdu->u.nss - 1;
  496. mcs = ppdu->u.mcs;
  497. }
  498. ratekbps = dp_getrateindex(ppdu->u.gi,
  499. mcs,
  500. nss,
  501. ppdu->u.preamble,
  502. ppdu->u.bw,
  503. &rix,
  504. &ratecode);
  505. if (!ratekbps)
  506. return;
  507. ppdu->rix = rix;
  508. DP_STATS_UPD(peer, rx.last_rx_rate, ratekbps);
  509. dp_ath_rate_lpf(peer->stats.rx.avg_rx_rate, ratekbps);
  510. ppdu_rx_rate = dp_ath_rate_out(peer->stats.rx.avg_rx_rate);
  511. DP_STATS_UPD(peer, rx.rnd_avg_rx_rate, ppdu_rx_rate);
  512. ppdu->rx_ratekbps = ratekbps;
  513. ppdu->rx_ratecode = ratecode;
  514. if (peer->vdev)
  515. peer->vdev->stats.rx.last_rx_rate = ratekbps;
  516. }
  517. static void dp_rx_stats_update(struct dp_pdev *pdev,
  518. struct cdp_rx_indication_ppdu *ppdu)
  519. {
  520. struct dp_soc *soc = NULL;
  521. uint8_t mcs, preamble, ac = 0, nss, ppdu_type;
  522. uint16_t num_msdu;
  523. uint8_t pkt_bw_offset;
  524. struct dp_peer *peer;
  525. struct cdp_rx_stats_ppdu_user *ppdu_user;
  526. uint32_t i;
  527. enum cdp_mu_packet_type mu_pkt_type;
  528. if (pdev)
  529. soc = pdev->soc;
  530. else
  531. return;
  532. if (!soc || soc->process_rx_status)
  533. return;
  534. preamble = ppdu->u.preamble;
  535. ppdu_type = ppdu->u.ppdu_type;
  536. for (i = 0; i < ppdu->num_users && i < CDP_MU_MAX_USERS; i++) {
  537. peer = NULL;
  538. ppdu_user = &ppdu->user[i];
  539. peer = dp_peer_get_ref_by_id(soc, ppdu_user->peer_id,
  540. DP_MOD_ID_RX_PPDU_STATS);
  541. if (!peer)
  542. peer = pdev->invalid_peer;
  543. if (ppdu_type == HAL_RX_TYPE_SU) {
  544. mcs = ppdu->u.mcs;
  545. nss = ppdu->u.nss;
  546. } else {
  547. mcs = ppdu_user->mcs;
  548. nss = ppdu_user->nss;
  549. }
  550. num_msdu = ppdu_user->num_msdu;
  551. switch (ppdu->u.bw) {
  552. case CMN_BW_20MHZ:
  553. pkt_bw_offset = PKT_BW_GAIN_20MHZ;
  554. break;
  555. case CMN_BW_40MHZ:
  556. pkt_bw_offset = PKT_BW_GAIN_40MHZ;
  557. break;
  558. case CMN_BW_80MHZ:
  559. pkt_bw_offset = PKT_BW_GAIN_80MHZ;
  560. break;
  561. case CMN_BW_160MHZ:
  562. pkt_bw_offset = PKT_BW_GAIN_160MHZ;
  563. break;
  564. default:
  565. pkt_bw_offset = 0;
  566. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  567. "Invalid BW index = %d", ppdu->u.bw);
  568. }
  569. DP_STATS_UPD(peer, rx.rssi, (ppdu->rssi + pkt_bw_offset));
  570. if (peer->stats.rx.avg_rssi == INVALID_RSSI)
  571. peer->stats.rx.avg_rssi =
  572. CDP_RSSI_IN(peer->stats.rx.rssi);
  573. else
  574. CDP_RSSI_UPDATE_AVG(peer->stats.rx.avg_rssi,
  575. peer->stats.rx.rssi);
  576. if ((preamble == DOT11_A) || (preamble == DOT11_B))
  577. nss = 1;
  578. if (ppdu_type == HAL_RX_TYPE_SU) {
  579. if (nss) {
  580. DP_STATS_INC(peer, rx.nss[nss - 1], num_msdu);
  581. DP_STATS_INC(peer, rx.ppdu_nss[nss - 1], 1);
  582. }
  583. DP_STATS_INC(peer, rx.mpdu_cnt_fcs_ok,
  584. ppdu_user->mpdu_cnt_fcs_ok);
  585. DP_STATS_INC(peer, rx.mpdu_cnt_fcs_err,
  586. ppdu_user->mpdu_cnt_fcs_err);
  587. }
  588. if (ppdu_type >= HAL_RX_TYPE_MU_MIMO &&
  589. ppdu_type <= HAL_RX_TYPE_MU_OFDMA) {
  590. if (ppdu_type == HAL_RX_TYPE_MU_MIMO)
  591. mu_pkt_type = RX_TYPE_MU_MIMO;
  592. else
  593. mu_pkt_type = RX_TYPE_MU_OFDMA;
  594. if (nss) {
  595. DP_STATS_INC(peer, rx.nss[nss - 1], num_msdu);
  596. DP_STATS_INC(peer,
  597. rx.rx_mu[mu_pkt_type].ppdu_nss[nss - 1],
  598. 1);
  599. }
  600. DP_STATS_INC(peer,
  601. rx.rx_mu[mu_pkt_type].mpdu_cnt_fcs_ok,
  602. ppdu_user->mpdu_cnt_fcs_ok);
  603. DP_STATS_INC(peer,
  604. rx.rx_mu[mu_pkt_type].mpdu_cnt_fcs_err,
  605. ppdu_user->mpdu_cnt_fcs_err);
  606. }
  607. DP_STATS_INC(peer, rx.sgi_count[ppdu->u.gi], num_msdu);
  608. DP_STATS_INC(peer, rx.bw[ppdu->u.bw], num_msdu);
  609. DP_STATS_INC(peer, rx.reception_type[ppdu->u.ppdu_type],
  610. num_msdu);
  611. DP_STATS_INC(peer, rx.ppdu_cnt[ppdu->u.ppdu_type], 1);
  612. DP_STATS_INCC(peer, rx.ampdu_cnt, num_msdu,
  613. ppdu_user->is_ampdu);
  614. DP_STATS_INCC(peer, rx.non_ampdu_cnt, num_msdu,
  615. !(ppdu_user->is_ampdu));
  616. DP_STATS_UPD(peer, rx.rx_rate, mcs);
  617. DP_STATS_INCC(peer,
  618. rx.pkt_type[preamble].mcs_count[MAX_MCS - 1], num_msdu,
  619. ((mcs >= MAX_MCS_11A) && (preamble == DOT11_A)));
  620. DP_STATS_INCC(peer,
  621. rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
  622. ((mcs < MAX_MCS_11A) && (preamble == DOT11_A)));
  623. DP_STATS_INCC(peer,
  624. rx.pkt_type[preamble].mcs_count[MAX_MCS - 1], num_msdu,
  625. ((mcs >= MAX_MCS_11B) && (preamble == DOT11_B)));
  626. DP_STATS_INCC(peer,
  627. rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
  628. ((mcs < MAX_MCS_11B) && (preamble == DOT11_B)));
  629. DP_STATS_INCC(peer,
  630. rx.pkt_type[preamble].mcs_count[MAX_MCS - 1], num_msdu,
  631. ((mcs >= MAX_MCS_11A) && (preamble == DOT11_N)));
  632. DP_STATS_INCC(peer,
  633. rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
  634. ((mcs < MAX_MCS_11A) && (preamble == DOT11_N)));
  635. DP_STATS_INCC(peer,
  636. rx.pkt_type[preamble].mcs_count[MAX_MCS - 1], num_msdu,
  637. ((mcs >= MAX_MCS_11AC) && (preamble == DOT11_AC)));
  638. DP_STATS_INCC(peer,
  639. rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
  640. ((mcs < MAX_MCS_11AC) && (preamble == DOT11_AC)));
  641. DP_STATS_INCC(peer,
  642. rx.pkt_type[preamble].mcs_count[MAX_MCS - 1], num_msdu,
  643. ((mcs >= (MAX_MCS - 1)) && (preamble == DOT11_AX)));
  644. DP_STATS_INCC(peer,
  645. rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
  646. ((mcs < (MAX_MCS - 1)) && (preamble == DOT11_AX)));
  647. DP_STATS_INCC(peer,
  648. rx.su_ax_ppdu_cnt.mcs_count[MAX_MCS - 1], 1,
  649. ((mcs >= (MAX_MCS - 1)) && (preamble == DOT11_AX) &&
  650. (ppdu_type == HAL_RX_TYPE_SU)));
  651. DP_STATS_INCC(peer,
  652. rx.su_ax_ppdu_cnt.mcs_count[mcs], 1,
  653. ((mcs < (MAX_MCS - 1)) && (preamble == DOT11_AX) &&
  654. (ppdu_type == HAL_RX_TYPE_SU)));
  655. DP_STATS_INCC(peer,
  656. rx.rx_mu[RX_TYPE_MU_OFDMA].ppdu.mcs_count[MAX_MCS - 1],
  657. 1, ((mcs >= (MAX_MCS - 1)) &&
  658. (preamble == DOT11_AX) &&
  659. (ppdu_type == HAL_RX_TYPE_MU_OFDMA)));
  660. DP_STATS_INCC(peer,
  661. rx.rx_mu[RX_TYPE_MU_OFDMA].ppdu.mcs_count[mcs],
  662. 1, ((mcs < (MAX_MCS - 1)) &&
  663. (preamble == DOT11_AX) &&
  664. (ppdu_type == HAL_RX_TYPE_MU_OFDMA)));
  665. DP_STATS_INCC(peer,
  666. rx.rx_mu[RX_TYPE_MU_MIMO].ppdu.mcs_count[MAX_MCS - 1],
  667. 1, ((mcs >= (MAX_MCS - 1)) &&
  668. (preamble == DOT11_AX) &&
  669. (ppdu_type == HAL_RX_TYPE_MU_MIMO)));
  670. DP_STATS_INCC(peer,
  671. rx.rx_mu[RX_TYPE_MU_MIMO].ppdu.mcs_count[mcs],
  672. 1, ((mcs < (MAX_MCS - 1)) &&
  673. (preamble == DOT11_AX) &&
  674. (ppdu_type == HAL_RX_TYPE_MU_MIMO)));
  675. /*
  676. * If invalid TID, it could be a non-qos frame, hence do not
  677. * update any AC counters
  678. */
  679. ac = TID_TO_WME_AC(ppdu_user->tid);
  680. if (ppdu->tid != HAL_TID_INVALID)
  681. DP_STATS_INC(peer, rx.wme_ac_type[ac], num_msdu);
  682. dp_peer_stats_notify(pdev, peer);
  683. DP_STATS_UPD(peer, rx.last_rssi, ppdu->rssi);
  684. dp_peer_qos_stats_notify(pdev, ppdu_user);
  685. if (peer == pdev->invalid_peer)
  686. continue;
  687. if (dp_is_subtype_data(ppdu->frame_ctrl))
  688. dp_rx_rate_stats_update(peer, ppdu, i);
  689. #if defined(FEATURE_PERPKT_INFO) && WDI_EVENT_ENABLE
  690. dp_wdi_event_handler(WDI_EVENT_UPDATE_DP_STATS, pdev->soc,
  691. &peer->stats, ppdu->peer_id,
  692. UPDATE_PEER_STATS, pdev->pdev_id);
  693. #endif
  694. dp_peer_unref_delete(peer, DP_MOD_ID_RX_PPDU_STATS);
  695. }
  696. }
  697. #endif
  698. /**
  699. * dp_rx_handle_mcopy_mode() - Allocate and deliver first MSDU payload
  700. * @soc: core txrx main context
  701. * @pdev: pdev structure
  702. * @ppdu_info: structure for rx ppdu ring
  703. * @nbuf: QDF nbuf
  704. * @fcs_ok_mpdu_cnt: fcs passsed mpdu index
  705. * @deliver_frame: flag to deliver wdi event
  706. *
  707. * Return: QDF_STATUS_SUCCESS - If nbuf to be freed by caller
  708. * QDF_STATUS_E_ALREADY - If nbuf not to be freed by caller
  709. */
  710. #ifdef FEATURE_PERPKT_INFO
  711. static inline QDF_STATUS
  712. dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  713. struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf,
  714. uint8_t fcs_ok_mpdu_cnt, bool deliver_frame)
  715. {
  716. uint16_t size = 0;
  717. struct ieee80211_frame *wh;
  718. uint32_t *nbuf_data;
  719. if (!ppdu_info->ppdu_msdu_info[fcs_ok_mpdu_cnt].first_msdu_payload)
  720. return QDF_STATUS_SUCCESS;
  721. /* For M_COPY mode only one msdu per ppdu is sent to upper layer*/
  722. if (pdev->mcopy_mode == M_COPY) {
  723. if (pdev->m_copy_id.rx_ppdu_id == ppdu_info->com_info.ppdu_id)
  724. return QDF_STATUS_SUCCESS;
  725. }
  726. wh = (struct ieee80211_frame *)(ppdu_info->ppdu_msdu_info[fcs_ok_mpdu_cnt].first_msdu_payload + 4);
  727. size = (ppdu_info->ppdu_msdu_info[fcs_ok_mpdu_cnt].first_msdu_payload -
  728. qdf_nbuf_data(nbuf));
  729. if (qdf_nbuf_pull_head(nbuf, size) == NULL)
  730. return QDF_STATUS_SUCCESS;
  731. if (((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
  732. IEEE80211_FC0_TYPE_MGT) ||
  733. ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
  734. IEEE80211_FC0_TYPE_CTL)) {
  735. return QDF_STATUS_SUCCESS;
  736. }
  737. nbuf_data = (uint32_t *)qdf_nbuf_data(nbuf);
  738. *nbuf_data = pdev->ppdu_info.com_info.ppdu_id;
  739. /* only retain RX MSDU payload in the skb */
  740. qdf_nbuf_trim_tail(nbuf, qdf_nbuf_len(nbuf) - ppdu_info->ppdu_msdu_info[fcs_ok_mpdu_cnt].payload_len);
  741. if (deliver_frame) {
  742. pdev->m_copy_id.rx_ppdu_id = ppdu_info->com_info.ppdu_id;
  743. dp_wdi_event_handler(WDI_EVENT_RX_DATA, soc,
  744. nbuf, HTT_INVALID_PEER,
  745. WDI_NO_VAL, pdev->pdev_id);
  746. }
  747. return QDF_STATUS_E_ALREADY;
  748. }
  749. #else
  750. static inline QDF_STATUS
  751. dp_rx_handle_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  752. struct hal_rx_ppdu_info *ppdu_info, qdf_nbuf_t nbuf,
  753. uint8_t fcs_ok_cnt, bool deliver_frame)
  754. {
  755. return QDF_STATUS_SUCCESS;
  756. }
  757. #endif
  758. /**
  759. * dp_rx_mcopy_handle_last_mpdu() - cache and delive last MPDU header in a
  760. * status buffer if MPDU end tlv is received in different buffer
  761. * @soc: core txrx main context
  762. * @pdev: pdev structure
  763. * @ppdu_info: structure for rx ppdu ring
  764. * @status_nbuf: QDF nbuf
  765. *
  766. * Return: void
  767. */
  768. #ifdef FEATURE_PERPKT_INFO
  769. static inline void
  770. dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev,
  771. struct hal_rx_ppdu_info *ppdu_info,
  772. qdf_nbuf_t status_nbuf)
  773. {
  774. QDF_STATUS mcopy_status;
  775. qdf_nbuf_t nbuf_clone = NULL;
  776. /* If the MPDU end tlv and RX header are received in different buffers,
  777. * process the RX header based on fcs status.
  778. */
  779. if (pdev->mcopy_status_nbuf) {
  780. /* For M_COPY mode only one msdu per ppdu is sent to upper layer*/
  781. if (pdev->mcopy_mode == M_COPY) {
  782. if (pdev->m_copy_id.rx_ppdu_id ==
  783. ppdu_info->com_info.ppdu_id)
  784. goto end1;
  785. }
  786. if (ppdu_info->is_fcs_passed) {
  787. nbuf_clone = qdf_nbuf_clone(pdev->mcopy_status_nbuf);
  788. if (!nbuf_clone) {
  789. QDF_TRACE(QDF_MODULE_ID_TXRX,
  790. QDF_TRACE_LEVEL_ERROR,
  791. "Failed to clone nbuf",
  792. __func__, __LINE__);
  793. goto end1;
  794. }
  795. pdev->m_copy_id.rx_ppdu_id = ppdu_info->com_info.ppdu_id;
  796. dp_wdi_event_handler(WDI_EVENT_RX_DATA, soc,
  797. nbuf_clone,
  798. HTT_INVALID_PEER,
  799. WDI_NO_VAL, pdev->pdev_id);
  800. ppdu_info->is_fcs_passed = false;
  801. }
  802. end1:
  803. qdf_nbuf_free(pdev->mcopy_status_nbuf);
  804. pdev->mcopy_status_nbuf = NULL;
  805. }
  806. /* If the MPDU end tlv and RX header are received in different buffers,
  807. * preserve the RX header as the fcs status will be received in MPDU
  808. * end tlv in next buffer. So, cache the buffer to be processd in next
  809. * iteration
  810. */
  811. if ((ppdu_info->fcs_ok_cnt + ppdu_info->fcs_err_cnt) !=
  812. ppdu_info->com_info.mpdu_cnt) {
  813. pdev->mcopy_status_nbuf = qdf_nbuf_clone(status_nbuf);
  814. if (pdev->mcopy_status_nbuf) {
  815. mcopy_status = dp_rx_handle_mcopy_mode(
  816. soc, pdev,
  817. ppdu_info,
  818. pdev->mcopy_status_nbuf,
  819. ppdu_info->fcs_ok_cnt,
  820. false);
  821. if (mcopy_status == QDF_STATUS_SUCCESS) {
  822. qdf_nbuf_free(pdev->mcopy_status_nbuf);
  823. pdev->mcopy_status_nbuf = NULL;
  824. }
  825. }
  826. }
  827. }
  828. #else
  829. static inline void
  830. dp_rx_mcopy_handle_last_mpdu(struct dp_soc *soc, struct dp_pdev *pdev,
  831. struct hal_rx_ppdu_info *ppdu_info,
  832. qdf_nbuf_t status_nbuf)
  833. {
  834. }
  835. #endif
  836. /**
  837. * dp_rx_mcopy_process_ppdu_info() - update mcopy ppdu info
  838. * @ppdu_info: structure for rx ppdu ring
  839. * @tlv_status: processed TLV status
  840. *
  841. * Return: void
  842. */
  843. #ifdef FEATURE_PERPKT_INFO
  844. static inline void
  845. dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev,
  846. struct hal_rx_ppdu_info *ppdu_info,
  847. uint32_t tlv_status)
  848. {
  849. if (!pdev->mcopy_mode)
  850. return;
  851. /* The fcs status is received in MPDU end tlv. If the RX header
  852. * and its MPDU end tlv are received in different status buffer then
  853. * to process that header ppdu_info->is_fcs_passed is used.
  854. * If end tlv is received in next status buffer then com_info.mpdu_cnt
  855. * will be 0 at the time of receiving MPDU end tlv and we update the
  856. * is_fcs_passed flag based on ppdu_info->fcs_err.
  857. */
  858. if (tlv_status != HAL_TLV_STATUS_MPDU_END)
  859. return;
  860. if (!ppdu_info->fcs_err) {
  861. if (ppdu_info->fcs_ok_cnt >
  862. HAL_RX_MAX_MPDU_H_PER_STATUS_BUFFER) {
  863. dp_err("No. of MPDUs(%d) per status buff exceeded",
  864. ppdu_info->fcs_ok_cnt);
  865. return;
  866. }
  867. if (ppdu_info->com_info.mpdu_cnt)
  868. ppdu_info->fcs_ok_cnt++;
  869. else
  870. ppdu_info->is_fcs_passed = true;
  871. } else {
  872. if (ppdu_info->com_info.mpdu_cnt)
  873. ppdu_info->fcs_err_cnt++;
  874. else
  875. ppdu_info->is_fcs_passed = false;
  876. }
  877. }
  878. #else
  879. static inline void
  880. dp_rx_mcopy_process_ppdu_info(struct dp_pdev *pdev,
  881. struct hal_rx_ppdu_info *ppdu_info,
  882. uint32_t tlv_status)
  883. {
  884. }
  885. #endif
  886. #ifdef FEATURE_PERPKT_INFO
  887. static inline void
  888. dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  889. struct hal_rx_ppdu_info *ppdu_info,
  890. uint32_t tlv_status,
  891. qdf_nbuf_t status_nbuf)
  892. {
  893. QDF_STATUS mcopy_status;
  894. qdf_nbuf_t nbuf_clone = NULL;
  895. uint8_t fcs_ok_mpdu_cnt = 0;
  896. dp_rx_mcopy_handle_last_mpdu(soc, pdev, ppdu_info, status_nbuf);
  897. if (qdf_unlikely(!ppdu_info->com_info.mpdu_cnt))
  898. goto end;
  899. if (qdf_unlikely(!ppdu_info->fcs_ok_cnt))
  900. goto end;
  901. /* For M_COPY mode only one msdu per ppdu is sent to upper layer*/
  902. if (pdev->mcopy_mode == M_COPY)
  903. ppdu_info->fcs_ok_cnt = 1;
  904. while (fcs_ok_mpdu_cnt < ppdu_info->fcs_ok_cnt) {
  905. nbuf_clone = qdf_nbuf_clone(status_nbuf);
  906. if (!nbuf_clone) {
  907. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  908. "Failed to clone nbuf",
  909. __func__, __LINE__);
  910. goto end;
  911. }
  912. mcopy_status = dp_rx_handle_mcopy_mode(soc, pdev,
  913. ppdu_info,
  914. nbuf_clone,
  915. fcs_ok_mpdu_cnt,
  916. true);
  917. if (mcopy_status == QDF_STATUS_SUCCESS)
  918. qdf_nbuf_free(nbuf_clone);
  919. fcs_ok_mpdu_cnt++;
  920. }
  921. end:
  922. qdf_nbuf_free(status_nbuf);
  923. ppdu_info->fcs_ok_cnt = 0;
  924. ppdu_info->fcs_err_cnt = 0;
  925. ppdu_info->com_info.mpdu_cnt = 0;
  926. qdf_mem_zero(&ppdu_info->ppdu_msdu_info,
  927. HAL_RX_MAX_MPDU_H_PER_STATUS_BUFFER
  928. * sizeof(struct hal_rx_msdu_payload_info));
  929. }
  930. #else
  931. static inline void
  932. dp_rx_process_mcopy_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  933. struct hal_rx_ppdu_info *ppdu_info,
  934. uint32_t tlv_status,
  935. qdf_nbuf_t status_nbuf)
  936. {
  937. }
  938. #endif
  939. /**
  940. * dp_rx_handle_smart_mesh_mode() - Deliver header for smart mesh
  941. * @soc: Datapath SOC handle
  942. * @pdev: Datapath PDEV handle
  943. * @ppdu_info: Structure for rx ppdu info
  944. * @nbuf: Qdf nbuf abstraction for linux skb
  945. *
  946. * Return: 0 on success, 1 on failure
  947. */
  948. static inline int
  949. dp_rx_handle_smart_mesh_mode(struct dp_soc *soc, struct dp_pdev *pdev,
  950. struct hal_rx_ppdu_info *ppdu_info,
  951. qdf_nbuf_t nbuf)
  952. {
  953. uint8_t size = 0;
  954. if (!pdev->monitor_vdev) {
  955. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  956. "[%s]:[%d] Monitor vdev is NULL !!",
  957. __func__, __LINE__);
  958. return 1;
  959. }
  960. if (!ppdu_info->msdu_info.first_msdu_payload) {
  961. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  962. "[%s]:[%d] First msdu payload not present",
  963. __func__, __LINE__);
  964. return 1;
  965. }
  966. /* Adding 4 bytes to get to start of 802.11 frame after phy_ppdu_id */
  967. size = (ppdu_info->msdu_info.first_msdu_payload -
  968. qdf_nbuf_data(nbuf)) + 4;
  969. ppdu_info->msdu_info.first_msdu_payload = NULL;
  970. if (qdf_nbuf_pull_head(nbuf, size) == NULL) {
  971. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  972. "[%s]:[%d] No header present",
  973. __func__, __LINE__);
  974. return 1;
  975. }
  976. /* Only retain RX MSDU payload in the skb */
  977. qdf_nbuf_trim_tail(nbuf, qdf_nbuf_len(nbuf) -
  978. ppdu_info->msdu_info.payload_len);
  979. if (!qdf_nbuf_update_radiotap(&pdev->ppdu_info.rx_status, nbuf,
  980. qdf_nbuf_headroom(nbuf))) {
  981. DP_STATS_INC(pdev, dropped.mon_radiotap_update_err, 1);
  982. return 1;
  983. }
  984. pdev->monitor_vdev->osif_rx_mon(pdev->monitor_vdev->osif_vdev,
  985. nbuf, NULL);
  986. pdev->ppdu_info.rx_status.monitor_direct_used = 0;
  987. return 0;
  988. }
  989. #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
  990. /*
  991. * dp_rx_mon_handle_cfr_mu_info() - Gather macaddr and ast_index of peer(s) in
  992. * the PPDU received, this will be used for correlation of CFR data captured
  993. * for an UL-MU-PPDU
  994. * @pdev: pdev ctx
  995. * @ppdu_info: pointer to ppdu info structure populated from ppdu status TLVs
  996. * @cdp_rx_ppdu: Rx PPDU indication structure
  997. *
  998. * Return: none
  999. */
  1000. static inline void
  1001. dp_rx_mon_handle_cfr_mu_info(struct dp_pdev *pdev,
  1002. struct hal_rx_ppdu_info *ppdu_info,
  1003. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  1004. {
  1005. struct dp_peer *peer;
  1006. struct dp_soc *soc = pdev->soc;
  1007. struct dp_ast_entry *ast_entry;
  1008. struct mon_rx_user_status *rx_user_status;
  1009. struct cdp_rx_stats_ppdu_user *rx_stats_peruser;
  1010. uint32_t num_users;
  1011. int user_id;
  1012. uint32_t ast_index;
  1013. qdf_spin_lock_bh(&soc->ast_lock);
  1014. num_users = ppdu_info->com_info.num_users;
  1015. for (user_id = 0; user_id < num_users; user_id++) {
  1016. if (user_id > OFDMA_NUM_USERS) {
  1017. qdf_spin_unlock_bh(&soc->ast_lock);
  1018. return;
  1019. }
  1020. rx_user_status = &ppdu_info->rx_user_status[user_id];
  1021. rx_stats_peruser = &cdp_rx_ppdu->user[user_id];
  1022. ast_index = rx_user_status->ast_index;
  1023. if (ast_index >= wlan_cfg_get_max_ast_idx(soc->wlan_cfg_ctx)) {
  1024. rx_stats_peruser->peer_id = HTT_INVALID_PEER;
  1025. continue;
  1026. }
  1027. ast_entry = soc->ast_table[ast_index];
  1028. if (!ast_entry || ast_entry->peer_id == HTT_INVALID_PEER) {
  1029. rx_stats_peruser->peer_id = HTT_INVALID_PEER;
  1030. continue;
  1031. }
  1032. peer = dp_peer_get_ref_by_id(soc, ast_entry->peer_id,
  1033. DP_MOD_ID_RX_PPDU_STATS);
  1034. if (!peer) {
  1035. rx_stats_peruser->peer_id = HTT_INVALID_PEER;
  1036. continue;
  1037. }
  1038. qdf_mem_copy(rx_stats_peruser->mac_addr,
  1039. peer->mac_addr.raw, QDF_MAC_ADDR_SIZE);
  1040. dp_peer_unref_delete(peer, DP_MOD_ID_RX_PPDU_STATS);
  1041. }
  1042. qdf_spin_unlock_bh(&soc->ast_lock);
  1043. }
  1044. /*
  1045. * dp_rx_mon_populate_cfr_ppdu_info() - Populate cdp ppdu info from hal ppdu
  1046. * info
  1047. * @pdev: pdev ctx
  1048. * @ppdu_info: ppdu info structure from ppdu ring
  1049. * @cdp_rx_ppdu : Rx PPDU indication structure
  1050. *
  1051. * Return: none
  1052. */
  1053. static inline void
  1054. dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev,
  1055. struct hal_rx_ppdu_info *ppdu_info,
  1056. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  1057. {
  1058. int chain;
  1059. cdp_rx_ppdu->ppdu_id = ppdu_info->com_info.ppdu_id;
  1060. cdp_rx_ppdu->timestamp = ppdu_info->rx_status.tsft;
  1061. cdp_rx_ppdu->u.ppdu_type = ppdu_info->rx_status.reception_type;
  1062. cdp_rx_ppdu->num_users = ppdu_info->com_info.num_users;
  1063. for (chain = 0; chain < MAX_CHAIN; chain++)
  1064. cdp_rx_ppdu->per_chain_rssi[chain] =
  1065. ppdu_info->rx_status.rssi[chain];
  1066. dp_rx_mon_handle_cfr_mu_info(pdev, ppdu_info, cdp_rx_ppdu);
  1067. }
  1068. /**
  1069. * dp_cfr_rcc_mode_status() - Return status of cfr rcc mode
  1070. * @pdev: pdev ctx
  1071. *
  1072. * Return: True or False
  1073. */
  1074. static inline bool
  1075. dp_cfr_rcc_mode_status(struct dp_pdev *pdev)
  1076. {
  1077. return pdev->cfr_rcc_mode;
  1078. }
  1079. /*
  1080. * dp_rx_mon_populate_cfr_info() - Populate cdp ppdu info from hal cfr info
  1081. * @pdev: pdev ctx
  1082. * @ppdu_info: ppdu info structure from ppdu ring
  1083. * @cdp_rx_ppdu: Rx PPDU indication structure
  1084. *
  1085. * Return: none
  1086. */
  1087. static inline void
  1088. dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev,
  1089. struct hal_rx_ppdu_info *ppdu_info,
  1090. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  1091. {
  1092. struct cdp_rx_ppdu_cfr_info *cfr_info;
  1093. if (!dp_cfr_rcc_mode_status(pdev))
  1094. return;
  1095. cfr_info = &cdp_rx_ppdu->cfr_info;
  1096. cfr_info->bb_captured_channel
  1097. = ppdu_info->cfr_info.bb_captured_channel;
  1098. cfr_info->bb_captured_timeout
  1099. = ppdu_info->cfr_info.bb_captured_timeout;
  1100. cfr_info->bb_captured_reason
  1101. = ppdu_info->cfr_info.bb_captured_reason;
  1102. cfr_info->rx_location_info_valid
  1103. = ppdu_info->cfr_info.rx_location_info_valid;
  1104. cfr_info->chan_capture_status
  1105. = ppdu_info->cfr_info.chan_capture_status;
  1106. cfr_info->rtt_che_buffer_pointer_high8
  1107. = ppdu_info->cfr_info.rtt_che_buffer_pointer_high8;
  1108. cfr_info->rtt_che_buffer_pointer_low32
  1109. = ppdu_info->cfr_info.rtt_che_buffer_pointer_low32;
  1110. }
  1111. /**
  1112. * dp_update_cfr_dbg_stats() - Increment RCC debug statistics
  1113. * @pdev: pdev structure
  1114. * @ppdu_info: structure for rx ppdu ring
  1115. *
  1116. * Return: none
  1117. */
  1118. static inline void
  1119. dp_update_cfr_dbg_stats(struct dp_pdev *pdev,
  1120. struct hal_rx_ppdu_info *ppdu_info)
  1121. {
  1122. struct hal_rx_ppdu_cfr_info *cfr = &ppdu_info->cfr_info;
  1123. DP_STATS_INC(pdev,
  1124. rcc.chan_capture_status[cfr->chan_capture_status], 1);
  1125. if (cfr->rx_location_info_valid) {
  1126. DP_STATS_INC(pdev, rcc.rx_loc_info_valid_cnt, 1);
  1127. if (cfr->bb_captured_channel) {
  1128. DP_STATS_INC(pdev, rcc.bb_captured_channel_cnt, 1);
  1129. DP_STATS_INC(pdev,
  1130. rcc.reason_cnt[cfr->bb_captured_reason],
  1131. 1);
  1132. } else if (cfr->bb_captured_timeout) {
  1133. DP_STATS_INC(pdev, rcc.bb_captured_timeout_cnt, 1);
  1134. DP_STATS_INC(pdev,
  1135. rcc.reason_cnt[cfr->bb_captured_reason],
  1136. 1);
  1137. }
  1138. }
  1139. }
  1140. /*
  1141. * dp_rx_handle_cfr() - Gather cfr info from hal ppdu info
  1142. * @soc: core txrx main context
  1143. * @pdev: pdev ctx
  1144. * @ppdu_info: ppdu info structure from ppdu ring
  1145. *
  1146. * Return: none
  1147. */
  1148. static inline void
  1149. dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev,
  1150. struct hal_rx_ppdu_info *ppdu_info)
  1151. {
  1152. qdf_nbuf_t ppdu_nbuf;
  1153. struct cdp_rx_indication_ppdu *cdp_rx_ppdu;
  1154. dp_update_cfr_dbg_stats(pdev, ppdu_info);
  1155. if (!ppdu_info->cfr_info.bb_captured_channel)
  1156. return;
  1157. ppdu_nbuf = qdf_nbuf_alloc(soc->osdev,
  1158. sizeof(struct cdp_rx_indication_ppdu),
  1159. 0,
  1160. 0,
  1161. FALSE);
  1162. if (ppdu_nbuf) {
  1163. cdp_rx_ppdu = (struct cdp_rx_indication_ppdu *)ppdu_nbuf->data;
  1164. dp_rx_mon_populate_cfr_info(pdev, ppdu_info, cdp_rx_ppdu);
  1165. dp_rx_mon_populate_cfr_ppdu_info(pdev, ppdu_info, cdp_rx_ppdu);
  1166. qdf_nbuf_put_tail(ppdu_nbuf,
  1167. sizeof(struct cdp_rx_indication_ppdu));
  1168. dp_wdi_event_handler(WDI_EVENT_RX_PPDU_DESC, soc,
  1169. ppdu_nbuf, HTT_INVALID_PEER,
  1170. WDI_NO_VAL, pdev->pdev_id);
  1171. }
  1172. }
  1173. /**
  1174. * dp_rx_populate_cfr_non_assoc_sta() - Populate cfr ppdu info for PPDUs from
  1175. * non-associated stations
  1176. * @pdev: pdev ctx
  1177. * @ppdu_info: ppdu info structure from ppdu ring
  1178. * @cdp_rx_ppdu: Rx PPDU indication structure
  1179. *
  1180. * Return: none
  1181. */
  1182. static inline void
  1183. dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev,
  1184. struct hal_rx_ppdu_info *ppdu_info,
  1185. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  1186. {
  1187. if (!dp_cfr_rcc_mode_status(pdev))
  1188. return;
  1189. if (ppdu_info->cfr_info.bb_captured_channel)
  1190. dp_rx_mon_populate_cfr_ppdu_info(pdev, ppdu_info, cdp_rx_ppdu);
  1191. }
  1192. /**
  1193. * dp_bb_captured_chan_status() - Get the bb_captured_channel status
  1194. * @ppdu_info: structure for rx ppdu ring
  1195. *
  1196. * Return: Success/ Failure
  1197. */
  1198. static inline QDF_STATUS
  1199. dp_bb_captured_chan_status(struct dp_pdev *pdev,
  1200. struct hal_rx_ppdu_info *ppdu_info)
  1201. {
  1202. QDF_STATUS status = QDF_STATUS_E_FAILURE;
  1203. struct hal_rx_ppdu_cfr_info *cfr = &ppdu_info->cfr_info;
  1204. if (dp_cfr_rcc_mode_status(pdev)) {
  1205. if (cfr->bb_captured_channel)
  1206. status = QDF_STATUS_SUCCESS;
  1207. }
  1208. return status;
  1209. }
  1210. #else
  1211. static inline void
  1212. dp_rx_mon_handle_cfr_mu_info(struct dp_pdev *pdev,
  1213. struct hal_rx_ppdu_info *ppdu_info,
  1214. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  1215. {
  1216. }
  1217. static inline void
  1218. dp_rx_mon_populate_cfr_ppdu_info(struct dp_pdev *pdev,
  1219. struct hal_rx_ppdu_info *ppdu_info,
  1220. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  1221. {
  1222. }
  1223. static inline void
  1224. dp_rx_mon_populate_cfr_info(struct dp_pdev *pdev,
  1225. struct hal_rx_ppdu_info *ppdu_info,
  1226. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  1227. {
  1228. }
  1229. static inline void
  1230. dp_rx_handle_cfr(struct dp_soc *soc, struct dp_pdev *pdev,
  1231. struct hal_rx_ppdu_info *ppdu_info)
  1232. {
  1233. }
  1234. static inline void
  1235. dp_rx_populate_cfr_non_assoc_sta(struct dp_pdev *pdev,
  1236. struct hal_rx_ppdu_info *ppdu_info,
  1237. struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
  1238. {
  1239. }
  1240. static inline void
  1241. dp_update_cfr_dbg_stats(struct dp_pdev *pdev,
  1242. struct hal_rx_ppdu_info *ppdu_info)
  1243. {
  1244. }
  1245. static inline QDF_STATUS
  1246. dp_bb_captured_chan_status(struct dp_pdev *pdev,
  1247. struct hal_rx_ppdu_info *ppdu_info)
  1248. {
  1249. return QDF_STATUS_E_NOSUPPORT;
  1250. }
  1251. static inline bool
  1252. dp_cfr_rcc_mode_status(struct dp_pdev *pdev)
  1253. {
  1254. return false;
  1255. }
  1256. #endif
  1257. /**
  1258. * dp_rx_handle_ppdu_stats() - Allocate and deliver ppdu stats to cdp layer
  1259. * @soc: core txrx main context
  1260. * @pdev: pdev strcuture
  1261. * @ppdu_info: structure for rx ppdu ring
  1262. *
  1263. * Return: none
  1264. */
  1265. #ifdef FEATURE_PERPKT_INFO
  1266. static inline void
  1267. dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev,
  1268. struct hal_rx_ppdu_info *ppdu_info)
  1269. {
  1270. qdf_nbuf_t ppdu_nbuf;
  1271. struct cdp_rx_indication_ppdu *cdp_rx_ppdu;
  1272. /*
  1273. * Do not allocate if fcs error,
  1274. * ast idx invalid / fctl invalid
  1275. *
  1276. * In CFR RCC mode - PPDU status TLVs of error pkts are also needed
  1277. */
  1278. if (ppdu_info->com_info.mpdu_cnt_fcs_ok == 0)
  1279. return;
  1280. if (ppdu_info->nac_info.fc_valid &&
  1281. ppdu_info->nac_info.to_ds_flag &&
  1282. ppdu_info->nac_info.mac_addr2_valid) {
  1283. struct dp_neighbour_peer *peer = NULL;
  1284. uint8_t rssi = ppdu_info->rx_status.rssi_comb;
  1285. qdf_spin_lock_bh(&pdev->neighbour_peer_mutex);
  1286. if (pdev->neighbour_peers_added) {
  1287. TAILQ_FOREACH(peer, &pdev->neighbour_peers_list,
  1288. neighbour_peer_list_elem) {
  1289. if (!qdf_mem_cmp(&peer->neighbour_peers_macaddr,
  1290. &ppdu_info->nac_info.mac_addr2,
  1291. QDF_MAC_ADDR_SIZE)) {
  1292. peer->rssi = rssi;
  1293. break;
  1294. }
  1295. }
  1296. }
  1297. qdf_spin_unlock_bh(&pdev->neighbour_peer_mutex);
  1298. }
  1299. /* need not generate wdi event when mcopy, cfr rcc mode and
  1300. * enhanced stats are not enabled
  1301. */
  1302. if (!pdev->mcopy_mode && !pdev->enhanced_stats_en &&
  1303. !dp_cfr_rcc_mode_status(pdev))
  1304. return;
  1305. if (dp_cfr_rcc_mode_status(pdev))
  1306. dp_update_cfr_dbg_stats(pdev, ppdu_info);
  1307. if (!ppdu_info->rx_status.frame_control_info_valid ||
  1308. (ppdu_info->rx_status.ast_index == HAL_AST_IDX_INVALID)) {
  1309. if (!(pdev->mcopy_mode ||
  1310. (dp_bb_captured_chan_status(pdev, ppdu_info) ==
  1311. QDF_STATUS_SUCCESS)))
  1312. return;
  1313. }
  1314. ppdu_nbuf = qdf_nbuf_alloc(soc->osdev,
  1315. sizeof(struct cdp_rx_indication_ppdu),
  1316. 0, 0, FALSE);
  1317. if (ppdu_nbuf) {
  1318. cdp_rx_ppdu = (struct cdp_rx_indication_ppdu *)ppdu_nbuf->data;
  1319. dp_rx_mon_populate_cfr_info(pdev, ppdu_info, cdp_rx_ppdu);
  1320. dp_rx_populate_cdp_indication_ppdu(pdev,
  1321. ppdu_info, cdp_rx_ppdu);
  1322. if (!qdf_nbuf_put_tail(ppdu_nbuf,
  1323. sizeof(struct cdp_rx_indication_ppdu)))
  1324. return;
  1325. dp_rx_stats_update(pdev, cdp_rx_ppdu);
  1326. if (cdp_rx_ppdu->peer_id != HTT_INVALID_PEER) {
  1327. dp_wdi_event_handler(WDI_EVENT_RX_PPDU_DESC,
  1328. soc, ppdu_nbuf,
  1329. cdp_rx_ppdu->peer_id,
  1330. WDI_NO_VAL, pdev->pdev_id);
  1331. } else if (pdev->mcopy_mode || dp_cfr_rcc_mode_status(pdev)) {
  1332. dp_wdi_event_handler(WDI_EVENT_RX_PPDU_DESC, soc,
  1333. ppdu_nbuf, HTT_INVALID_PEER,
  1334. WDI_NO_VAL, pdev->pdev_id);
  1335. } else {
  1336. qdf_nbuf_free(ppdu_nbuf);
  1337. }
  1338. }
  1339. }
  1340. #else
  1341. static inline void
  1342. dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev,
  1343. struct hal_rx_ppdu_info *ppdu_info)
  1344. {
  1345. }
  1346. #endif
  1347. /**
  1348. * dp_rx_process_peer_based_pktlog() - Process Rx pktlog if peer based
  1349. * filtering enabled
  1350. * @soc: core txrx main context
  1351. * @ppdu_info: Structure for rx ppdu info
  1352. * @status_nbuf: Qdf nbuf abstraction for linux skb
  1353. * @pdev_id: mac_id/pdev_id correspondinggly for MCL and WIN
  1354. *
  1355. * Return: none
  1356. */
  1357. static inline void
  1358. dp_rx_process_peer_based_pktlog(struct dp_soc *soc,
  1359. struct hal_rx_ppdu_info *ppdu_info,
  1360. qdf_nbuf_t status_nbuf, uint32_t pdev_id)
  1361. {
  1362. struct dp_peer *peer;
  1363. struct dp_ast_entry *ast_entry;
  1364. uint32_t ast_index;
  1365. ast_index = ppdu_info->rx_status.ast_index;
  1366. if (ast_index < wlan_cfg_get_max_ast_idx(soc->wlan_cfg_ctx)) {
  1367. ast_entry = soc->ast_table[ast_index];
  1368. if (ast_entry) {
  1369. peer = dp_peer_get_ref_by_id(soc, ast_entry->peer_id,
  1370. DP_MOD_ID_RX_PPDU_STATS);
  1371. if (peer) {
  1372. if ((peer->peer_id != HTT_INVALID_PEER) &&
  1373. (peer->peer_based_pktlog_filter)) {
  1374. dp_wdi_event_handler(
  1375. WDI_EVENT_RX_DESC, soc,
  1376. status_nbuf,
  1377. peer->peer_id,
  1378. WDI_NO_VAL, pdev_id);
  1379. }
  1380. dp_peer_unref_delete(peer,
  1381. DP_MOD_ID_RX_PPDU_STATS);
  1382. }
  1383. }
  1384. }
  1385. }
  1386. #if defined(HTT_UL_OFDMA_USER_INFO_V0_W0_VALID_M)
  1387. static inline void
  1388. dp_rx_ul_ofdma_ru_size_to_width(
  1389. uint32_t ru_size,
  1390. uint32_t *ru_width)
  1391. {
  1392. uint32_t width;
  1393. width = 0;
  1394. switch (ru_size) {
  1395. case HTT_UL_OFDMA_V0_RU_SIZE_RU_26:
  1396. width = 1;
  1397. break;
  1398. case HTT_UL_OFDMA_V0_RU_SIZE_RU_52:
  1399. width = 2;
  1400. break;
  1401. case HTT_UL_OFDMA_V0_RU_SIZE_RU_106:
  1402. width = 4;
  1403. break;
  1404. case HTT_UL_OFDMA_V0_RU_SIZE_RU_242:
  1405. width = 9;
  1406. break;
  1407. case HTT_UL_OFDMA_V0_RU_SIZE_RU_484:
  1408. width = 18;
  1409. break;
  1410. case HTT_UL_OFDMA_V0_RU_SIZE_RU_996:
  1411. width = 37;
  1412. break;
  1413. case HTT_UL_OFDMA_V0_RU_SIZE_RU_996x2:
  1414. width = 74;
  1415. break;
  1416. default:
  1417. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  1418. "RU size to width convert err");
  1419. break;
  1420. }
  1421. *ru_width = width;
  1422. }
  1423. static inline void
  1424. dp_rx_mon_handle_mu_ul_info(struct hal_rx_ppdu_info *ppdu_info)
  1425. {
  1426. struct mon_rx_user_status *mon_rx_user_status;
  1427. uint32_t num_users;
  1428. uint32_t i;
  1429. uint32_t mu_ul_user_v0_word0;
  1430. uint32_t mu_ul_user_v0_word1;
  1431. uint32_t ru_width;
  1432. uint32_t ru_size;
  1433. if (!(ppdu_info->rx_status.reception_type == HAL_RX_TYPE_MU_OFDMA ||
  1434. ppdu_info->rx_status.reception_type == HAL_RX_TYPE_MU_MIMO))
  1435. return;
  1436. num_users = ppdu_info->com_info.num_users;
  1437. if (num_users > HAL_MAX_UL_MU_USERS)
  1438. num_users = HAL_MAX_UL_MU_USERS;
  1439. for (i = 0; i < num_users; i++) {
  1440. mon_rx_user_status = &ppdu_info->rx_user_status[i];
  1441. mu_ul_user_v0_word0 =
  1442. mon_rx_user_status->mu_ul_user_v0_word0;
  1443. mu_ul_user_v0_word1 =
  1444. mon_rx_user_status->mu_ul_user_v0_word1;
  1445. if (HTT_UL_OFDMA_USER_INFO_V0_W0_VALID_GET(
  1446. mu_ul_user_v0_word0) &&
  1447. !HTT_UL_OFDMA_USER_INFO_V0_W0_VER_GET(
  1448. mu_ul_user_v0_word0)) {
  1449. mon_rx_user_status->mcs =
  1450. HTT_UL_OFDMA_USER_INFO_V0_W1_MCS_GET(
  1451. mu_ul_user_v0_word1);
  1452. mon_rx_user_status->nss =
  1453. HTT_UL_OFDMA_USER_INFO_V0_W1_NSS_GET(
  1454. mu_ul_user_v0_word1) + 1;
  1455. mon_rx_user_status->mu_ul_info_valid = 1;
  1456. mon_rx_user_status->ofdma_ru_start_index =
  1457. HTT_UL_OFDMA_USER_INFO_V0_W1_RU_START_GET(
  1458. mu_ul_user_v0_word1);
  1459. ru_size =
  1460. HTT_UL_OFDMA_USER_INFO_V0_W1_RU_SIZE_GET(
  1461. mu_ul_user_v0_word1);
  1462. dp_rx_ul_ofdma_ru_size_to_width(ru_size, &ru_width);
  1463. mon_rx_user_status->ofdma_ru_width = ru_width;
  1464. mon_rx_user_status->ofdma_ru_size = ru_size;
  1465. }
  1466. }
  1467. }
  1468. #else
  1469. static inline void
  1470. dp_rx_mon_handle_mu_ul_info(struct hal_rx_ppdu_info *ppdu_info)
  1471. {
  1472. }
  1473. #endif
  1474. /**
  1475. * dp_rx_mon_status_process_tlv() - Process status TLV in status
  1476. * buffer on Rx status Queue posted by status SRNG processing.
  1477. * @soc: core txrx main context
  1478. * @int_ctx: interrupt context
  1479. * @mac_id: mac_id which is one of 3 mac_ids _ring
  1480. * @quota: amount of work which can be done
  1481. *
  1482. * Return: none
  1483. */
  1484. static inline void
  1485. dp_rx_mon_status_process_tlv(struct dp_soc *soc, struct dp_intr *int_ctx,
  1486. uint32_t mac_id, uint32_t quota)
  1487. {
  1488. struct dp_pdev *pdev = dp_get_pdev_for_lmac_id(soc, mac_id);
  1489. struct hal_rx_ppdu_info *ppdu_info;
  1490. qdf_nbuf_t status_nbuf;
  1491. uint8_t *rx_tlv;
  1492. uint8_t *rx_tlv_start;
  1493. uint32_t tlv_status = HAL_TLV_STATUS_BUF_DONE;
  1494. QDF_STATUS enh_log_status = QDF_STATUS_SUCCESS;
  1495. struct cdp_pdev_mon_stats *rx_mon_stats;
  1496. int smart_mesh_status;
  1497. enum WDI_EVENT pktlog_mode = WDI_NO_VAL;
  1498. bool nbuf_used;
  1499. uint32_t rx_enh_capture_mode;
  1500. if (!pdev) {
  1501. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  1502. "pdev is null for mac_id = %d", mac_id);
  1503. return;
  1504. }
  1505. ppdu_info = &pdev->ppdu_info;
  1506. rx_mon_stats = &pdev->rx_mon_stats;
  1507. if (pdev->mon_ppdu_status != DP_PPDU_STATUS_START)
  1508. return;
  1509. rx_enh_capture_mode = pdev->rx_enh_capture_mode;
  1510. while (!qdf_nbuf_is_queue_empty(&pdev->rx_status_q)) {
  1511. status_nbuf = qdf_nbuf_queue_remove(&pdev->rx_status_q);
  1512. rx_tlv = qdf_nbuf_data(status_nbuf);
  1513. rx_tlv_start = rx_tlv;
  1514. nbuf_used = false;
  1515. if ((pdev->monitor_vdev) || (pdev->enhanced_stats_en) ||
  1516. (pdev->mcopy_mode) || (dp_cfr_rcc_mode_status(pdev)) ||
  1517. (rx_enh_capture_mode != CDP_RX_ENH_CAPTURE_DISABLED)) {
  1518. do {
  1519. tlv_status = hal_rx_status_get_tlv_info(rx_tlv,
  1520. ppdu_info, pdev->soc->hal_soc,
  1521. status_nbuf);
  1522. dp_rx_mon_update_dbg_ppdu_stats(ppdu_info,
  1523. rx_mon_stats);
  1524. dp_rx_mon_enh_capture_process(pdev, tlv_status,
  1525. status_nbuf, ppdu_info,
  1526. &nbuf_used);
  1527. dp_rx_mcopy_process_ppdu_info(pdev,
  1528. ppdu_info,
  1529. tlv_status);
  1530. rx_tlv = hal_rx_status_get_next_tlv(rx_tlv);
  1531. if ((rx_tlv - rx_tlv_start) >=
  1532. RX_MON_STATUS_BUF_SIZE)
  1533. break;
  1534. } while ((tlv_status == HAL_TLV_STATUS_PPDU_NOT_DONE) ||
  1535. (tlv_status == HAL_TLV_STATUS_HEADER) ||
  1536. (tlv_status == HAL_TLV_STATUS_MPDU_END) ||
  1537. (tlv_status == HAL_TLV_STATUS_MSDU_END));
  1538. }
  1539. if (pdev->dp_peer_based_pktlog) {
  1540. dp_rx_process_peer_based_pktlog(soc, ppdu_info,
  1541. status_nbuf,
  1542. pdev->pdev_id);
  1543. } else {
  1544. if (pdev->rx_pktlog_mode == DP_RX_PKTLOG_FULL)
  1545. pktlog_mode = WDI_EVENT_RX_DESC;
  1546. else if (pdev->rx_pktlog_mode == DP_RX_PKTLOG_LITE)
  1547. pktlog_mode = WDI_EVENT_LITE_RX;
  1548. if (pktlog_mode != WDI_NO_VAL)
  1549. dp_wdi_event_handler(pktlog_mode, soc,
  1550. status_nbuf,
  1551. HTT_INVALID_PEER,
  1552. WDI_NO_VAL, pdev->pdev_id);
  1553. }
  1554. /* smart monitor vap and m_copy cannot co-exist */
  1555. if (ppdu_info->rx_status.monitor_direct_used && pdev->neighbour_peers_added
  1556. && pdev->monitor_vdev) {
  1557. smart_mesh_status = dp_rx_handle_smart_mesh_mode(soc,
  1558. pdev, ppdu_info, status_nbuf);
  1559. if (smart_mesh_status)
  1560. qdf_nbuf_free(status_nbuf);
  1561. } else if (qdf_unlikely(pdev->mcopy_mode)) {
  1562. dp_rx_process_mcopy_mode(soc, pdev,
  1563. ppdu_info, tlv_status,
  1564. status_nbuf);
  1565. } else if (rx_enh_capture_mode != CDP_RX_ENH_CAPTURE_DISABLED) {
  1566. if (!nbuf_used)
  1567. qdf_nbuf_free(status_nbuf);
  1568. if (tlv_status == HAL_TLV_STATUS_PPDU_DONE)
  1569. enh_log_status =
  1570. dp_rx_handle_enh_capture(soc,
  1571. pdev, ppdu_info);
  1572. } else {
  1573. qdf_nbuf_free(status_nbuf);
  1574. }
  1575. if (tlv_status == HAL_TLV_STATUS_PPDU_NON_STD_DONE) {
  1576. dp_rx_mon_deliver_non_std(soc, mac_id);
  1577. } else if (tlv_status == HAL_TLV_STATUS_PPDU_DONE) {
  1578. rx_mon_stats->status_ppdu_done++;
  1579. dp_rx_mon_handle_mu_ul_info(ppdu_info);
  1580. if (pdev->tx_capture_enabled
  1581. != CDP_TX_ENH_CAPTURE_DISABLED)
  1582. dp_send_ack_frame_to_stack(soc, pdev,
  1583. ppdu_info);
  1584. if (pdev->enhanced_stats_en ||
  1585. pdev->mcopy_mode || pdev->neighbour_peers_added)
  1586. dp_rx_handle_ppdu_stats(soc, pdev, ppdu_info);
  1587. else if (dp_cfr_rcc_mode_status(pdev))
  1588. dp_rx_handle_cfr(soc, pdev, ppdu_info);
  1589. pdev->mon_ppdu_status = DP_PPDU_STATUS_DONE;
  1590. /*
  1591. * if chan_num is not fetched correctly from ppdu RX TLV,
  1592. * get it from pdev saved.
  1593. */
  1594. if (qdf_unlikely(pdev->ppdu_info.rx_status.chan_num == 0))
  1595. pdev->ppdu_info.rx_status.chan_num = pdev->mon_chan_num;
  1596. /*
  1597. * if chan_freq is not fetched correctly from ppdu RX TLV,
  1598. * get it from pdev saved.
  1599. */
  1600. if (qdf_unlikely(pdev->ppdu_info.rx_status.chan_freq == 0)) {
  1601. pdev->ppdu_info.rx_status.chan_freq =
  1602. pdev->mon_chan_freq;
  1603. }
  1604. if (!soc->full_mon_mode)
  1605. dp_rx_mon_dest_process(soc, int_ctx, mac_id,
  1606. quota);
  1607. pdev->mon_ppdu_status = DP_PPDU_STATUS_START;
  1608. }
  1609. }
  1610. return;
  1611. }
  1612. /*
  1613. * dp_rx_nbuf_prepare() - prepare RX nbuf
  1614. * @soc: core txrx main context
  1615. * @pdev: core txrx pdev context
  1616. *
  1617. * This function alloc & map nbuf for RX dma usage, retry it if failed
  1618. * until retry times reaches max threshold or succeeded.
  1619. *
  1620. * Return: qdf_nbuf_t pointer if succeeded, NULL if failed.
  1621. */
  1622. static inline qdf_nbuf_t
  1623. dp_rx_nbuf_prepare(struct dp_soc *soc, struct dp_pdev *pdev)
  1624. {
  1625. uint8_t *buf;
  1626. int32_t nbuf_retry_count;
  1627. QDF_STATUS ret;
  1628. qdf_nbuf_t nbuf = NULL;
  1629. for (nbuf_retry_count = 0; nbuf_retry_count <
  1630. QDF_NBUF_ALLOC_MAP_RETRY_THRESHOLD;
  1631. nbuf_retry_count++) {
  1632. /* Allocate a new skb using alloc_skb */
  1633. nbuf = qdf_nbuf_alloc_no_recycler(RX_MON_STATUS_BUF_SIZE,
  1634. RX_MON_STATUS_BUF_RESERVATION,
  1635. RX_DATA_BUFFER_ALIGNMENT);
  1636. if (!nbuf) {
  1637. DP_STATS_INC(pdev, replenish.nbuf_alloc_fail, 1);
  1638. continue;
  1639. }
  1640. buf = qdf_nbuf_data(nbuf);
  1641. memset(buf, 0, RX_MON_STATUS_BUF_SIZE);
  1642. ret = qdf_nbuf_map_nbytes_single(soc->osdev, nbuf,
  1643. QDF_DMA_FROM_DEVICE,
  1644. RX_MON_STATUS_BUF_SIZE);
  1645. /* nbuf map failed */
  1646. if (qdf_unlikely(QDF_IS_STATUS_ERROR(ret))) {
  1647. qdf_nbuf_free(nbuf);
  1648. DP_STATS_INC(pdev, replenish.map_err, 1);
  1649. continue;
  1650. }
  1651. /* qdf_nbuf alloc and map succeeded */
  1652. break;
  1653. }
  1654. /* qdf_nbuf still alloc or map failed */
  1655. if (qdf_unlikely(nbuf_retry_count >=
  1656. QDF_NBUF_ALLOC_MAP_RETRY_THRESHOLD))
  1657. return NULL;
  1658. return nbuf;
  1659. }
  1660. /*
  1661. * dp_rx_mon_status_srng_process() - Process monitor status ring
  1662. * post the status ring buffer to Rx status Queue for later
  1663. * processing when status ring is filled with status TLV.
  1664. * Allocate a new buffer to status ring if the filled buffer
  1665. * is posted.
  1666. * @soc: core txrx main context
  1667. * @int_ctx: interrupt context
  1668. * @mac_id: mac_id which is one of 3 mac_ids
  1669. * @quota: No. of ring entry that can be serviced in one shot.
  1670. * Return: uint32_t: No. of ring entry that is processed.
  1671. */
  1672. static inline uint32_t
  1673. dp_rx_mon_status_srng_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  1674. uint32_t mac_id, uint32_t quota)
  1675. {
  1676. struct dp_pdev *pdev = dp_get_pdev_for_lmac_id(soc, mac_id);
  1677. hal_soc_handle_t hal_soc;
  1678. void *mon_status_srng;
  1679. void *rxdma_mon_status_ring_entry;
  1680. QDF_STATUS status;
  1681. enum dp_mon_reap_status reap_status;
  1682. uint32_t work_done = 0;
  1683. if (!pdev) {
  1684. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  1685. "pdev is null for mac_id = %d", mac_id);
  1686. return work_done;
  1687. }
  1688. mon_status_srng = soc->rxdma_mon_status_ring[mac_id].hal_srng;
  1689. qdf_assert(mon_status_srng);
  1690. if (!mon_status_srng || !hal_srng_initialized(mon_status_srng)) {
  1691. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  1692. "%s %d : HAL Monitor Status Ring Init Failed -- %pK",
  1693. __func__, __LINE__, mon_status_srng);
  1694. return work_done;
  1695. }
  1696. hal_soc = soc->hal_soc;
  1697. qdf_assert(hal_soc);
  1698. if (qdf_unlikely(dp_srng_access_start(int_ctx, soc, mon_status_srng)))
  1699. goto done;
  1700. /* mon_status_ring_desc => WBM_BUFFER_RING STRUCT =>
  1701. * BUFFER_ADDR_INFO STRUCT
  1702. */
  1703. while (qdf_likely((rxdma_mon_status_ring_entry =
  1704. hal_srng_src_peek_n_get_next(hal_soc, mon_status_srng))
  1705. && quota--)) {
  1706. uint32_t rx_buf_cookie;
  1707. qdf_nbuf_t status_nbuf;
  1708. struct dp_rx_desc *rx_desc;
  1709. uint8_t *status_buf;
  1710. qdf_dma_addr_t paddr;
  1711. uint64_t buf_addr;
  1712. struct rx_desc_pool *rx_desc_pool;
  1713. rx_desc_pool = &soc->rx_desc_status[mac_id];
  1714. buf_addr =
  1715. (HAL_RX_BUFFER_ADDR_31_0_GET(
  1716. rxdma_mon_status_ring_entry) |
  1717. ((uint64_t)(HAL_RX_BUFFER_ADDR_39_32_GET(
  1718. rxdma_mon_status_ring_entry)) << 32));
  1719. if (qdf_likely(buf_addr)) {
  1720. rx_buf_cookie =
  1721. HAL_RX_BUF_COOKIE_GET(
  1722. rxdma_mon_status_ring_entry);
  1723. rx_desc = dp_rx_cookie_2_va_mon_status(soc,
  1724. rx_buf_cookie);
  1725. qdf_assert(rx_desc);
  1726. status_nbuf = rx_desc->nbuf;
  1727. qdf_nbuf_sync_for_cpu(soc->osdev, status_nbuf,
  1728. QDF_DMA_FROM_DEVICE);
  1729. status_buf = qdf_nbuf_data(status_nbuf);
  1730. status = hal_get_rx_status_done(status_buf);
  1731. if (status != QDF_STATUS_SUCCESS) {
  1732. uint32_t hp, tp;
  1733. hal_get_sw_hptp(hal_soc, mon_status_srng,
  1734. &tp, &hp);
  1735. dp_info_rl("tlv tag status error hp:%u, tp:%u",
  1736. hp, tp);
  1737. /* RxDMA status done bit might not be set even
  1738. * though tp is moved by HW.
  1739. */
  1740. /* If done status is missing:
  1741. * 1. As per MAC team's suggestion,
  1742. * when HP + 1 entry is peeked and if DMA
  1743. * is not done and if HP + 2 entry's DMA done
  1744. * is set. skip HP + 1 entry and
  1745. * start processing in next interrupt.
  1746. * 2. If HP + 2 entry's DMA done is not set,
  1747. * poll onto HP + 1 entry DMA done to be set.
  1748. * Check status for same buffer for next time
  1749. * dp_rx_mon_status_srng_process
  1750. */
  1751. reap_status = dp_rx_mon_handle_status_buf_done(pdev,
  1752. mon_status_srng);
  1753. if (reap_status == DP_MON_STATUS_NO_DMA)
  1754. continue;
  1755. else if (reap_status == DP_MON_STATUS_REPLENISH) {
  1756. qdf_nbuf_unmap_nbytes_single(
  1757. soc->osdev, status_nbuf,
  1758. QDF_DMA_FROM_DEVICE,
  1759. rx_desc_pool->buf_size);
  1760. qdf_nbuf_free(status_nbuf);
  1761. goto buf_replenish;
  1762. }
  1763. }
  1764. qdf_nbuf_set_pktlen(status_nbuf,
  1765. RX_MON_STATUS_BUF_SIZE);
  1766. qdf_nbuf_unmap_nbytes_single(soc->osdev, status_nbuf,
  1767. QDF_DMA_FROM_DEVICE,
  1768. rx_desc_pool->buf_size);
  1769. /* Put the status_nbuf to queue */
  1770. qdf_nbuf_queue_add(&pdev->rx_status_q, status_nbuf);
  1771. } else {
  1772. union dp_rx_desc_list_elem_t *desc_list = NULL;
  1773. union dp_rx_desc_list_elem_t *tail = NULL;
  1774. uint32_t num_alloc_desc;
  1775. num_alloc_desc = dp_rx_get_free_desc_list(soc, mac_id,
  1776. rx_desc_pool,
  1777. 1,
  1778. &desc_list,
  1779. &tail);
  1780. /*
  1781. * No free descriptors available
  1782. */
  1783. if (qdf_unlikely(num_alloc_desc == 0)) {
  1784. work_done++;
  1785. break;
  1786. }
  1787. rx_desc = &desc_list->rx_desc;
  1788. }
  1789. buf_replenish:
  1790. status_nbuf = dp_rx_nbuf_prepare(soc, pdev);
  1791. /*
  1792. * qdf_nbuf alloc or map failed,
  1793. * free the dp rx desc to free list,
  1794. * fill in NULL dma address at current HP entry,
  1795. * keep HP in mon_status_ring unchanged,
  1796. * wait next time dp_rx_mon_status_srng_process
  1797. * to fill in buffer at current HP.
  1798. */
  1799. if (qdf_unlikely(!status_nbuf)) {
  1800. union dp_rx_desc_list_elem_t *desc_list = NULL;
  1801. union dp_rx_desc_list_elem_t *tail = NULL;
  1802. struct rx_desc_pool *rx_desc_pool;
  1803. rx_desc_pool = &soc->rx_desc_status[mac_id];
  1804. dp_info_rl("fail to allocate or map qdf_nbuf");
  1805. dp_rx_add_to_free_desc_list(&desc_list,
  1806. &tail, rx_desc);
  1807. dp_rx_add_desc_list_to_free_list(soc, &desc_list,
  1808. &tail, mac_id, rx_desc_pool);
  1809. hal_rxdma_buff_addr_info_set(
  1810. rxdma_mon_status_ring_entry,
  1811. 0, 0, HAL_RX_BUF_RBM_SW3_BM);
  1812. work_done++;
  1813. break;
  1814. }
  1815. paddr = qdf_nbuf_get_frag_paddr(status_nbuf, 0);
  1816. rx_desc->nbuf = status_nbuf;
  1817. rx_desc->in_use = 1;
  1818. hal_rxdma_buff_addr_info_set(rxdma_mon_status_ring_entry,
  1819. paddr, rx_desc->cookie, HAL_RX_BUF_RBM_SW3_BM);
  1820. hal_srng_src_get_next(hal_soc, mon_status_srng);
  1821. work_done++;
  1822. }
  1823. done:
  1824. dp_srng_access_end(int_ctx, soc, mon_status_srng);
  1825. return work_done;
  1826. }
  1827. uint32_t
  1828. dp_rx_mon_status_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  1829. uint32_t mac_id, uint32_t quota)
  1830. {
  1831. uint32_t work_done;
  1832. work_done = dp_rx_mon_status_srng_process(soc, int_ctx, mac_id, quota);
  1833. quota -= work_done;
  1834. dp_rx_mon_status_process_tlv(soc, int_ctx, mac_id, quota);
  1835. return work_done;
  1836. }
  1837. #ifndef DISABLE_MON_CONFIG
  1838. uint32_t
  1839. dp_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  1840. uint32_t mac_id, uint32_t quota)
  1841. {
  1842. if (qdf_unlikely(soc->full_mon_mode))
  1843. return dp_rx_mon_process(soc, int_ctx, mac_id, quota);
  1844. return dp_rx_mon_status_process(soc, int_ctx, mac_id, quota);
  1845. }
  1846. #else
  1847. uint32_t
  1848. dp_mon_process(struct dp_soc *soc, struct dp_intr *int_ctx,
  1849. uint32_t mac_id, uint32_t quota)
  1850. {
  1851. return 0;
  1852. }
  1853. #endif
  1854. QDF_STATUS
  1855. dp_rx_pdev_mon_status_buffers_alloc(struct dp_pdev *pdev, uint32_t mac_id)
  1856. {
  1857. uint8_t pdev_id = pdev->pdev_id;
  1858. struct dp_soc *soc = pdev->soc;
  1859. struct dp_srng *mon_status_ring;
  1860. uint32_t num_entries;
  1861. struct rx_desc_pool *rx_desc_pool;
  1862. struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx;
  1863. union dp_rx_desc_list_elem_t *desc_list = NULL;
  1864. union dp_rx_desc_list_elem_t *tail = NULL;
  1865. soc_cfg_ctx = soc->wlan_cfg_ctx;
  1866. mon_status_ring = &soc->rxdma_mon_status_ring[mac_id];
  1867. num_entries = mon_status_ring->num_entries;
  1868. rx_desc_pool = &soc->rx_desc_status[mac_id];
  1869. dp_debug("Mon RX Desc Pool[%d] entries=%u",
  1870. pdev_id, num_entries);
  1871. return dp_rx_mon_status_buffers_replenish(soc, mac_id, mon_status_ring,
  1872. rx_desc_pool, num_entries,
  1873. &desc_list, &tail,
  1874. HAL_RX_BUF_RBM_SW3_BM);
  1875. }
  1876. QDF_STATUS
  1877. dp_rx_pdev_mon_status_desc_pool_alloc(struct dp_pdev *pdev, uint32_t mac_id)
  1878. {
  1879. uint8_t pdev_id = pdev->pdev_id;
  1880. struct dp_soc *soc = pdev->soc;
  1881. struct dp_srng *mon_status_ring;
  1882. uint32_t num_entries;
  1883. struct rx_desc_pool *rx_desc_pool;
  1884. struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx;
  1885. soc_cfg_ctx = soc->wlan_cfg_ctx;
  1886. mon_status_ring = &soc->rxdma_mon_status_ring[mac_id];
  1887. num_entries = mon_status_ring->num_entries;
  1888. rx_desc_pool = &soc->rx_desc_status[mac_id];
  1889. dp_debug("Mon RX Desc Pool[%d] entries=%u", pdev_id, num_entries);
  1890. rx_desc_pool->desc_type = DP_RX_DESC_STATUS_TYPE;
  1891. return dp_rx_desc_pool_alloc(soc, num_entries + 1, rx_desc_pool);
  1892. }
  1893. void
  1894. dp_rx_pdev_mon_status_desc_pool_init(struct dp_pdev *pdev, uint32_t mac_id)
  1895. {
  1896. uint32_t i;
  1897. uint8_t pdev_id = pdev->pdev_id;
  1898. struct dp_soc *soc = pdev->soc;
  1899. struct dp_srng *mon_status_ring;
  1900. uint32_t num_entries;
  1901. struct rx_desc_pool *rx_desc_pool;
  1902. struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx;
  1903. soc_cfg_ctx = soc->wlan_cfg_ctx;
  1904. mon_status_ring = &soc->rxdma_mon_status_ring[mac_id];
  1905. num_entries = mon_status_ring->num_entries;
  1906. rx_desc_pool = &soc->rx_desc_status[mac_id];
  1907. dp_debug("Mon RX Desc status Pool[%d] init entries=%u",
  1908. pdev_id, num_entries);
  1909. rx_desc_pool->owner = HAL_RX_BUF_RBM_SW3_BM;
  1910. rx_desc_pool->buf_size = RX_MON_STATUS_BUF_SIZE;
  1911. rx_desc_pool->buf_alignment = RX_DATA_BUFFER_ALIGNMENT;
  1912. /* Disable frag processing flag */
  1913. dp_rx_enable_mon_dest_frag(rx_desc_pool, false);
  1914. dp_rx_desc_pool_init(soc, mac_id, num_entries + 1, rx_desc_pool);
  1915. qdf_nbuf_queue_init(&pdev->rx_status_q);
  1916. pdev->mon_ppdu_status = DP_PPDU_STATUS_START;
  1917. qdf_mem_zero(&pdev->ppdu_info, sizeof(pdev->ppdu_info));
  1918. /*
  1919. * Set last_ppdu_id to HAL_INVALID_PPDU_ID in order to avoid ppdu_id
  1920. * match with '0' ppdu_id from monitor status ring
  1921. */
  1922. pdev->ppdu_info.com_info.last_ppdu_id = HAL_INVALID_PPDU_ID;
  1923. qdf_mem_zero(&pdev->rx_mon_stats, sizeof(pdev->rx_mon_stats));
  1924. dp_rx_mon_init_dbg_ppdu_stats(&pdev->ppdu_info,
  1925. &pdev->rx_mon_stats);
  1926. for (i = 0; i < MAX_MU_USERS; i++) {
  1927. qdf_nbuf_queue_init(&pdev->mpdu_q[i]);
  1928. pdev->is_mpdu_hdr[i] = true;
  1929. }
  1930. qdf_mem_zero(pdev->msdu_list, sizeof(pdev->msdu_list[MAX_MU_USERS]));
  1931. pdev->rx_enh_capture_mode = CDP_RX_ENH_CAPTURE_DISABLED;
  1932. }
  1933. void
  1934. dp_rx_pdev_mon_status_desc_pool_deinit(struct dp_pdev *pdev, uint32_t mac_id) {
  1935. uint8_t pdev_id = pdev->pdev_id;
  1936. struct dp_soc *soc = pdev->soc;
  1937. struct rx_desc_pool *rx_desc_pool;
  1938. rx_desc_pool = &soc->rx_desc_status[mac_id];
  1939. dp_debug("Mon RX Desc status Pool[%d] deinit", pdev_id);
  1940. dp_rx_desc_pool_deinit(soc, rx_desc_pool);
  1941. }
  1942. void
  1943. dp_rx_pdev_mon_status_desc_pool_free(struct dp_pdev *pdev, uint32_t mac_id) {
  1944. uint8_t pdev_id = pdev->pdev_id;
  1945. struct dp_soc *soc = pdev->soc;
  1946. struct rx_desc_pool *rx_desc_pool;
  1947. rx_desc_pool = &soc->rx_desc_status[mac_id];
  1948. dp_debug("Mon RX Status Desc Pool Free pdev[%d]", pdev_id);
  1949. dp_rx_desc_pool_free(soc, rx_desc_pool);
  1950. }
  1951. void
  1952. dp_rx_pdev_mon_status_buffers_free(struct dp_pdev *pdev, uint32_t mac_id)
  1953. {
  1954. uint8_t pdev_id = pdev->pdev_id;
  1955. struct dp_soc *soc = pdev->soc;
  1956. struct rx_desc_pool *rx_desc_pool;
  1957. rx_desc_pool = &soc->rx_desc_status[mac_id];
  1958. dp_debug("Mon RX Status Desc Pool Free pdev[%d]", pdev_id);
  1959. dp_rx_desc_nbuf_free(soc, rx_desc_pool);
  1960. }
  1961. /*
  1962. * dp_rx_buffers_replenish() - replenish monitor status ring with
  1963. * rx nbufs called during dp rx
  1964. * monitor status ring initialization
  1965. *
  1966. * @soc: core txrx main context
  1967. * @mac_id: mac_id which is one of 3 mac_ids
  1968. * @dp_rxdma_srng: dp monitor status circular ring
  1969. * @rx_desc_pool; Pointer to Rx descriptor pool
  1970. * @num_req_buffers: number of buffer to be replenished
  1971. * @desc_list: list of descs if called from dp rx monitor status
  1972. * process or NULL during dp rx initialization or
  1973. * out of buffer interrupt
  1974. * @tail: tail of descs list
  1975. * @owner: who owns the nbuf (host, NSS etc...)
  1976. * Return: return success or failure
  1977. */
  1978. static inline
  1979. QDF_STATUS dp_rx_mon_status_buffers_replenish(struct dp_soc *dp_soc,
  1980. uint32_t mac_id,
  1981. struct dp_srng *dp_rxdma_srng,
  1982. struct rx_desc_pool *rx_desc_pool,
  1983. uint32_t num_req_buffers,
  1984. union dp_rx_desc_list_elem_t **desc_list,
  1985. union dp_rx_desc_list_elem_t **tail,
  1986. uint8_t owner)
  1987. {
  1988. uint32_t num_alloc_desc;
  1989. uint16_t num_desc_to_free = 0;
  1990. uint32_t num_entries_avail;
  1991. uint32_t count = 0;
  1992. int sync_hw_ptr = 1;
  1993. qdf_dma_addr_t paddr;
  1994. qdf_nbuf_t rx_netbuf;
  1995. void *rxdma_ring_entry;
  1996. union dp_rx_desc_list_elem_t *next;
  1997. void *rxdma_srng;
  1998. struct dp_pdev *dp_pdev = dp_get_pdev_for_lmac_id(dp_soc, mac_id);
  1999. if (!dp_pdev) {
  2000. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2001. "pdev is null for mac_id = %d", mac_id);
  2002. return QDF_STATUS_E_FAILURE;
  2003. }
  2004. rxdma_srng = dp_rxdma_srng->hal_srng;
  2005. qdf_assert(rxdma_srng);
  2006. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2007. "[%s][%d] requested %d buffers for replenish",
  2008. __func__, __LINE__, num_req_buffers);
  2009. /*
  2010. * if desc_list is NULL, allocate the descs from freelist
  2011. */
  2012. if (!(*desc_list)) {
  2013. num_alloc_desc = dp_rx_get_free_desc_list(dp_soc, mac_id,
  2014. rx_desc_pool,
  2015. num_req_buffers,
  2016. desc_list,
  2017. tail);
  2018. if (!num_alloc_desc) {
  2019. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  2020. "[%s][%d] no free rx_descs in freelist",
  2021. __func__, __LINE__);
  2022. return QDF_STATUS_E_NOMEM;
  2023. }
  2024. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2025. "[%s][%d] %d rx desc allocated", __func__, __LINE__,
  2026. num_alloc_desc);
  2027. num_req_buffers = num_alloc_desc;
  2028. }
  2029. hal_srng_access_start(dp_soc->hal_soc, rxdma_srng);
  2030. num_entries_avail = hal_srng_src_num_avail(dp_soc->hal_soc,
  2031. rxdma_srng, sync_hw_ptr);
  2032. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2033. "[%s][%d] no of available entries in rxdma ring: %d",
  2034. __func__, __LINE__, num_entries_avail);
  2035. if (num_entries_avail < num_req_buffers) {
  2036. num_desc_to_free = num_req_buffers - num_entries_avail;
  2037. num_req_buffers = num_entries_avail;
  2038. }
  2039. while (count <= num_req_buffers) {
  2040. rx_netbuf = dp_rx_nbuf_prepare(dp_soc, dp_pdev);
  2041. /*
  2042. * qdf_nbuf alloc or map failed,
  2043. * keep HP in mon_status_ring unchanged,
  2044. * wait dp_rx_mon_status_srng_process
  2045. * to fill in buffer at current HP.
  2046. */
  2047. if (qdf_unlikely(!rx_netbuf)) {
  2048. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  2049. "%s: qdf_nbuf allocate or map fail, count %d",
  2050. __func__, count);
  2051. break;
  2052. }
  2053. paddr = qdf_nbuf_get_frag_paddr(rx_netbuf, 0);
  2054. next = (*desc_list)->next;
  2055. rxdma_ring_entry = hal_srng_src_get_cur_hp_n_move_next(
  2056. dp_soc->hal_soc,
  2057. rxdma_srng);
  2058. if (qdf_unlikely(!rxdma_ring_entry)) {
  2059. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
  2060. "[%s][%d] rxdma_ring_entry is NULL, count - %d",
  2061. __func__, __LINE__, count);
  2062. qdf_nbuf_unmap_nbytes_single(dp_soc->osdev, rx_netbuf,
  2063. QDF_DMA_FROM_DEVICE,
  2064. rx_desc_pool->buf_size);
  2065. qdf_nbuf_free(rx_netbuf);
  2066. break;
  2067. }
  2068. (*desc_list)->rx_desc.nbuf = rx_netbuf;
  2069. (*desc_list)->rx_desc.in_use = 1;
  2070. count++;
  2071. hal_rxdma_buff_addr_info_set(rxdma_ring_entry, paddr,
  2072. (*desc_list)->rx_desc.cookie, owner);
  2073. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2074. "[%s][%d] rx_desc=%pK, cookie=%d, nbuf=%pK, \
  2075. paddr=%pK",
  2076. __func__, __LINE__, &(*desc_list)->rx_desc,
  2077. (*desc_list)->rx_desc.cookie, rx_netbuf,
  2078. (void *)paddr);
  2079. *desc_list = next;
  2080. }
  2081. hal_srng_access_end(dp_soc->hal_soc, rxdma_srng);
  2082. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2083. "successfully replenished %d buffers", num_req_buffers);
  2084. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  2085. "%d rx desc added back to free list", num_desc_to_free);
  2086. /*
  2087. * add any available free desc back to the free list
  2088. */
  2089. if (*desc_list) {
  2090. dp_rx_add_desc_list_to_free_list(dp_soc, desc_list, tail,
  2091. mac_id, rx_desc_pool);
  2092. }
  2093. return QDF_STATUS_SUCCESS;
  2094. }
  2095. #if !defined(DISABLE_MON_CONFIG) && defined(MON_ENABLE_DROP_FOR_MAC)
  2096. /**
  2097. * dp_mon_status_srng_drop_for_mac() - Drop the mon status ring packets for
  2098. * a given mac
  2099. * @pdev: DP pdev
  2100. * @mac_id: mac id
  2101. * @quota: maximum number of ring entries that can be processed
  2102. *
  2103. * Return: Number of ring entries reaped
  2104. */
  2105. static uint32_t
  2106. dp_mon_status_srng_drop_for_mac(struct dp_pdev *pdev, uint32_t mac_id,
  2107. uint32_t quota)
  2108. {
  2109. struct dp_soc *soc = pdev->soc;
  2110. void *mon_status_srng;
  2111. hal_soc_handle_t hal_soc;
  2112. void *ring_desc;
  2113. uint32_t reap_cnt = 0;
  2114. if (qdf_unlikely(!soc || !soc->hal_soc))
  2115. return reap_cnt;
  2116. mon_status_srng = soc->rxdma_mon_status_ring[mac_id].hal_srng;
  2117. if (qdf_unlikely(!mon_status_srng ||
  2118. !hal_srng_initialized(mon_status_srng)))
  2119. return reap_cnt;
  2120. hal_soc = soc->hal_soc;
  2121. if (qdf_unlikely(hal_srng_access_start(hal_soc, mon_status_srng)))
  2122. return reap_cnt;
  2123. while ((ring_desc =
  2124. hal_srng_src_peek_n_get_next(hal_soc, mon_status_srng)) &&
  2125. reap_cnt < MON_DROP_REAP_LIMIT && quota--) {
  2126. uint64_t buf_addr;
  2127. buf_addr = (HAL_RX_BUFFER_ADDR_31_0_GET(ring_desc) |
  2128. ((uint64_t)(HAL_RX_BUFFER_ADDR_39_32_GET(ring_desc)) << 32));
  2129. if (qdf_unlikely(!buf_addr)) {
  2130. struct rx_desc_pool *rx_desc_pool;
  2131. qdf_dma_addr_t iova;
  2132. qdf_nbuf_t status_nbuf;
  2133. struct dp_rx_desc *rx_desc;
  2134. union dp_rx_desc_list_elem_t *rx_desc_elem;
  2135. rx_desc_pool = dp_rx_get_mon_desc_pool(soc, mac_id,
  2136. pdev->pdev_id);
  2137. qdf_spin_lock_bh(&rx_desc_pool->lock);
  2138. if (!rx_desc_pool->freelist) {
  2139. qdf_spin_unlock_bh(&rx_desc_pool->lock);
  2140. break;
  2141. }
  2142. rx_desc_elem = rx_desc_pool->freelist;
  2143. rx_desc_pool->freelist = rx_desc_pool->freelist->next;
  2144. qdf_spin_unlock_bh(&rx_desc_pool->lock);
  2145. rx_desc = &rx_desc_elem->rx_desc;
  2146. status_nbuf = dp_rx_nbuf_prepare(soc, pdev);
  2147. if (qdf_unlikely(!status_nbuf)) {
  2148. union dp_rx_desc_list_elem_t *desc_list = NULL;
  2149. union dp_rx_desc_list_elem_t *tail = NULL;
  2150. dp_info_rl("fail to allocate or map nbuf");
  2151. dp_rx_add_to_free_desc_list(&desc_list, &tail,
  2152. rx_desc);
  2153. dp_rx_add_desc_list_to_free_list(soc,
  2154. &desc_list,
  2155. &tail, mac_id,
  2156. rx_desc_pool);
  2157. hal_rxdma_buff_addr_info_set(ring_desc, 0, 0,
  2158. HAL_RX_BUF_RBM_SW3_BM);
  2159. break;
  2160. }
  2161. iova = qdf_nbuf_get_frag_paddr(status_nbuf, 0);
  2162. rx_desc->nbuf = status_nbuf;
  2163. rx_desc->in_use = 1;
  2164. hal_rxdma_buff_addr_info_set(ring_desc, iova,
  2165. rx_desc->cookie,
  2166. HAL_RX_BUF_RBM_SW3_BM);
  2167. }
  2168. reap_cnt++;
  2169. hal_srng_src_get_next(hal_soc, mon_status_srng);
  2170. }
  2171. hal_srng_access_end(hal_soc, mon_status_srng);
  2172. return reap_cnt;
  2173. }
  2174. uint32_t dp_mon_drop_packets_for_mac(struct dp_pdev *pdev, uint32_t mac_id,
  2175. uint32_t quota)
  2176. {
  2177. uint32_t work_done;
  2178. work_done = dp_mon_status_srng_drop_for_mac(pdev, mac_id, quota);
  2179. dp_mon_dest_srng_drop_for_mac(pdev, mac_id);
  2180. return work_done;
  2181. }
  2182. #else
  2183. uint32_t dp_mon_drop_packets_for_mac(struct dp_pdev *pdev, uint32_t mac_id,
  2184. uint32_t quota)
  2185. {
  2186. return 0;
  2187. }
  2188. #endif