dp_rx.h 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132
  1. /*
  2. * Copyright (c) 2016-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. #ifndef _DP_RX_H
  19. #define _DP_RX_H
  20. #include "hal_rx.h"
  21. #include "dp_tx.h"
  22. #include "dp_peer.h"
  23. #include "dp_internal.h"
  24. #ifdef RXDMA_OPTIMIZATION
  25. #ifndef RX_DATA_BUFFER_ALIGNMENT
  26. #define RX_DATA_BUFFER_ALIGNMENT 128
  27. #endif
  28. #ifndef RX_MONITOR_BUFFER_ALIGNMENT
  29. #define RX_MONITOR_BUFFER_ALIGNMENT 128
  30. #endif
  31. #else /* RXDMA_OPTIMIZATION */
  32. #define RX_DATA_BUFFER_ALIGNMENT 4
  33. #define RX_MONITOR_BUFFER_ALIGNMENT 4
  34. #endif /* RXDMA_OPTIMIZATION */
  35. #ifdef QCA_HOST2FW_RXBUF_RING
  36. #define DP_WBM2SW_RBM HAL_RX_BUF_RBM_SW1_BM
  37. /* RBM value used for re-injecting defragmented packets into REO */
  38. #define DP_DEFRAG_RBM HAL_RX_BUF_RBM_SW3_BM
  39. #else
  40. #define DP_WBM2SW_RBM HAL_RX_BUF_RBM_SW3_BM
  41. #define DP_DEFRAG_RBM DP_WBM2SW_RBM
  42. #endif /* QCA_HOST2FW_RXBUF_RING */
  43. #define RX_BUFFER_RESERVATION 0
  44. #define DP_PEER_METADATA_PEER_ID_MASK 0x0000ffff
  45. #define DP_PEER_METADATA_PEER_ID_SHIFT 0
  46. #define DP_PEER_METADATA_VDEV_ID_MASK 0x003f0000
  47. #define DP_PEER_METADATA_VDEV_ID_SHIFT 16
  48. #define DP_PEER_METADATA_PEER_ID_GET(_peer_metadata) \
  49. (((_peer_metadata) & DP_PEER_METADATA_PEER_ID_MASK) \
  50. >> DP_PEER_METADATA_PEER_ID_SHIFT)
  51. #define DP_PEER_METADATA_VDEV_ID_GET(_peer_metadata) \
  52. (((_peer_metadata) & DP_PEER_METADATA_VDEV_ID_MASK) \
  53. >> DP_PEER_METADATA_VDEV_ID_SHIFT)
  54. #define DP_RX_DESC_MAGIC 0xdec0de
  55. /**
  56. * struct dp_rx_desc
  57. *
  58. * @nbuf : VA of the "skb" posted
  59. * @rx_buf_start : VA of the original Rx buffer, before
  60. * movement of any skb->data pointer
  61. * @cookie : index into the sw array which holds
  62. * the sw Rx descriptors
  63. * Cookie space is 21 bits:
  64. * lower 18 bits -- index
  65. * upper 3 bits -- pool_id
  66. * @pool_id : pool Id for which this allocated.
  67. * Can only be used if there is no flow
  68. * steering
  69. * @in_use rx_desc is in use
  70. * @unmapped used to mark rx_desc an unmapped if the corresponding
  71. * nbuf is already unmapped
  72. */
  73. struct dp_rx_desc {
  74. qdf_nbuf_t nbuf;
  75. uint8_t *rx_buf_start;
  76. uint32_t cookie;
  77. uint8_t pool_id;
  78. #ifdef RX_DESC_DEBUG_CHECK
  79. uint32_t magic;
  80. #endif
  81. uint8_t in_use:1,
  82. unmapped:1;
  83. };
  84. /* RX Descriptor Multi Page memory alloc related */
  85. #define DP_RX_DESC_OFFSET_NUM_BITS 8
  86. #define DP_RX_DESC_PAGE_ID_NUM_BITS 8
  87. #define DP_RX_DESC_POOL_ID_NUM_BITS 4
  88. #define DP_RX_DESC_PAGE_ID_SHIFT DP_RX_DESC_OFFSET_NUM_BITS
  89. #define DP_RX_DESC_POOL_ID_SHIFT \
  90. (DP_RX_DESC_OFFSET_NUM_BITS + DP_RX_DESC_PAGE_ID_NUM_BITS)
  91. #define RX_DESC_MULTI_PAGE_COOKIE_POOL_ID_MASK \
  92. (((1 << DP_RX_DESC_POOL_ID_NUM_BITS) - 1) << DP_RX_DESC_POOL_ID_SHIFT)
  93. #define RX_DESC_MULTI_PAGE_COOKIE_PAGE_ID_MASK \
  94. (((1 << DP_RX_DESC_PAGE_ID_NUM_BITS) - 1) << \
  95. DP_RX_DESC_PAGE_ID_SHIFT)
  96. #define RX_DESC_MULTI_PAGE_COOKIE_OFFSET_MASK \
  97. ((1 << DP_RX_DESC_OFFSET_NUM_BITS) - 1)
  98. #define DP_RX_DESC_MULTI_PAGE_COOKIE_GET_POOL_ID(_cookie) \
  99. (((_cookie) & RX_DESC_MULTI_PAGE_COOKIE_POOL_ID_MASK) >> \
  100. DP_RX_DESC_POOL_ID_SHIFT)
  101. #define DP_RX_DESC_MULTI_PAGE_COOKIE_GET_PAGE_ID(_cookie) \
  102. (((_cookie) & RX_DESC_MULTI_PAGE_COOKIE_PAGE_ID_MASK) >> \
  103. DP_RX_DESC_PAGE_ID_SHIFT)
  104. #define DP_RX_DESC_MULTI_PAGE_COOKIE_GET_OFFSET(_cookie) \
  105. ((_cookie) & RX_DESC_MULTI_PAGE_COOKIE_OFFSET_MASK)
  106. #define RX_DESC_COOKIE_INDEX_SHIFT 0
  107. #define RX_DESC_COOKIE_INDEX_MASK 0x3ffff /* 18 bits */
  108. #define RX_DESC_COOKIE_POOL_ID_SHIFT 18
  109. #define RX_DESC_COOKIE_POOL_ID_MASK 0x1c0000
  110. #define DP_RX_DESC_COOKIE_MAX \
  111. (RX_DESC_COOKIE_INDEX_MASK | RX_DESC_COOKIE_POOL_ID_MASK)
  112. #define DP_RX_DESC_COOKIE_POOL_ID_GET(_cookie) \
  113. (((_cookie) & RX_DESC_COOKIE_POOL_ID_MASK) >> \
  114. RX_DESC_COOKIE_POOL_ID_SHIFT)
  115. #define DP_RX_DESC_COOKIE_INDEX_GET(_cookie) \
  116. (((_cookie) & RX_DESC_COOKIE_INDEX_MASK) >> \
  117. RX_DESC_COOKIE_INDEX_SHIFT)
  118. /* DOC: Offset to obtain LLC hdr
  119. *
  120. * In the case of Wifi parse error
  121. * to reach LLC header from beginning
  122. * of VLAN tag we need to skip 8 bytes.
  123. * Vlan_tag(4)+length(2)+length added
  124. * by HW(2) = 8 bytes.
  125. */
  126. #define DP_SKIP_VLAN 8
  127. /**
  128. * struct dp_rx_cached_buf - rx cached buffer
  129. * @list: linked list node
  130. * @buf: skb buffer
  131. */
  132. struct dp_rx_cached_buf {
  133. qdf_list_node_t node;
  134. qdf_nbuf_t buf;
  135. };
  136. /*
  137. *dp_rx_xor_block() - xor block of data
  138. *@b: destination data block
  139. *@a: source data block
  140. *@len: length of the data to process
  141. *
  142. *Returns: None
  143. */
  144. static inline void dp_rx_xor_block(uint8_t *b, const uint8_t *a, qdf_size_t len)
  145. {
  146. qdf_size_t i;
  147. for (i = 0; i < len; i++)
  148. b[i] ^= a[i];
  149. }
  150. /*
  151. *dp_rx_rotl() - rotate the bits left
  152. *@val: unsigned integer input value
  153. *@bits: number of bits
  154. *
  155. *Returns: Integer with left rotated by number of 'bits'
  156. */
  157. static inline uint32_t dp_rx_rotl(uint32_t val, int bits)
  158. {
  159. return (val << bits) | (val >> (32 - bits));
  160. }
  161. /*
  162. *dp_rx_rotr() - rotate the bits right
  163. *@val: unsigned integer input value
  164. *@bits: number of bits
  165. *
  166. *Returns: Integer with right rotated by number of 'bits'
  167. */
  168. static inline uint32_t dp_rx_rotr(uint32_t val, int bits)
  169. {
  170. return (val >> bits) | (val << (32 - bits));
  171. }
  172. /*
  173. * dp_set_rx_queue() - set queue_mapping in skb
  174. * @nbuf: skb
  175. * @queue_id: rx queue_id
  176. *
  177. * Return: void
  178. */
  179. #ifdef QCA_OL_RX_MULTIQ_SUPPORT
  180. static inline void dp_set_rx_queue(qdf_nbuf_t nbuf, uint8_t queue_id)
  181. {
  182. qdf_nbuf_record_rx_queue(nbuf, queue_id);
  183. return;
  184. }
  185. #else
  186. static inline void dp_set_rx_queue(qdf_nbuf_t nbuf, uint8_t queue_id)
  187. {
  188. }
  189. #endif
  190. /*
  191. *dp_rx_xswap() - swap the bits left
  192. *@val: unsigned integer input value
  193. *
  194. *Returns: Integer with bits swapped
  195. */
  196. static inline uint32_t dp_rx_xswap(uint32_t val)
  197. {
  198. return ((val & 0x00ff00ff) << 8) | ((val & 0xff00ff00) >> 8);
  199. }
  200. /*
  201. *dp_rx_get_le32_split() - get little endian 32 bits split
  202. *@b0: byte 0
  203. *@b1: byte 1
  204. *@b2: byte 2
  205. *@b3: byte 3
  206. *
  207. *Returns: Integer with split little endian 32 bits
  208. */
  209. static inline uint32_t dp_rx_get_le32_split(uint8_t b0, uint8_t b1, uint8_t b2,
  210. uint8_t b3)
  211. {
  212. return b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
  213. }
  214. /*
  215. *dp_rx_get_le32() - get little endian 32 bits
  216. *@b0: byte 0
  217. *@b1: byte 1
  218. *@b2: byte 2
  219. *@b3: byte 3
  220. *
  221. *Returns: Integer with little endian 32 bits
  222. */
  223. static inline uint32_t dp_rx_get_le32(const uint8_t *p)
  224. {
  225. return dp_rx_get_le32_split(p[0], p[1], p[2], p[3]);
  226. }
  227. /*
  228. * dp_rx_put_le32() - put little endian 32 bits
  229. * @p: destination char array
  230. * @v: source 32-bit integer
  231. *
  232. * Returns: None
  233. */
  234. static inline void dp_rx_put_le32(uint8_t *p, uint32_t v)
  235. {
  236. p[0] = (v) & 0xff;
  237. p[1] = (v >> 8) & 0xff;
  238. p[2] = (v >> 16) & 0xff;
  239. p[3] = (v >> 24) & 0xff;
  240. }
  241. /* Extract michal mic block of data */
  242. #define dp_rx_michael_block(l, r) \
  243. do { \
  244. r ^= dp_rx_rotl(l, 17); \
  245. l += r; \
  246. r ^= dp_rx_xswap(l); \
  247. l += r; \
  248. r ^= dp_rx_rotl(l, 3); \
  249. l += r; \
  250. r ^= dp_rx_rotr(l, 2); \
  251. l += r; \
  252. } while (0)
  253. /**
  254. * struct dp_rx_desc_list_elem_t
  255. *
  256. * @next : Next pointer to form free list
  257. * @rx_desc : DP Rx descriptor
  258. */
  259. union dp_rx_desc_list_elem_t {
  260. union dp_rx_desc_list_elem_t *next;
  261. struct dp_rx_desc rx_desc;
  262. };
  263. #ifdef RX_DESC_MULTI_PAGE_ALLOC
  264. /**
  265. * dp_rx_desc_find() - find dp rx descriptor from page ID and offset
  266. * @page_id: Page ID
  267. * @offset: Offset of the descriptor element
  268. *
  269. * Return: RX descriptor element
  270. */
  271. union dp_rx_desc_list_elem_t *dp_rx_desc_find(uint16_t page_id, uint16_t offset,
  272. struct rx_desc_pool *rx_pool);
  273. static inline
  274. struct dp_rx_desc *dp_get_rx_desc_from_cookie(struct dp_soc *soc,
  275. struct rx_desc_pool *pool,
  276. uint32_t cookie)
  277. {
  278. uint8_t pool_id = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_POOL_ID(cookie);
  279. uint16_t page_id = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_PAGE_ID(cookie);
  280. uint8_t offset = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_OFFSET(cookie);
  281. struct rx_desc_pool *rx_desc_pool;
  282. union dp_rx_desc_list_elem_t *rx_desc_elem;
  283. if (qdf_unlikely(pool_id >= MAX_RXDESC_POOLS))
  284. return NULL;
  285. rx_desc_pool = &pool[pool_id];
  286. rx_desc_elem = (union dp_rx_desc_list_elem_t *)
  287. (rx_desc_pool->desc_pages.cacheable_pages[page_id] +
  288. rx_desc_pool->elem_size * offset);
  289. return &rx_desc_elem->rx_desc;
  290. }
  291. /**
  292. * dp_rx_cookie_2_va_rxdma_buf() - Converts cookie to a virtual address of
  293. * the Rx descriptor on Rx DMA source ring buffer
  294. * @soc: core txrx main context
  295. * @cookie: cookie used to lookup virtual address
  296. *
  297. * Return: Pointer to the Rx descriptor
  298. */
  299. static inline
  300. struct dp_rx_desc *dp_rx_cookie_2_va_rxdma_buf(struct dp_soc *soc,
  301. uint32_t cookie)
  302. {
  303. return dp_get_rx_desc_from_cookie(soc, &soc->rx_desc_buf[0], cookie);
  304. }
  305. /**
  306. * dp_rx_cookie_2_va_mon_buf() - Converts cookie to a virtual address of
  307. * the Rx descriptor on monitor ring buffer
  308. * @soc: core txrx main context
  309. * @cookie: cookie used to lookup virtual address
  310. *
  311. * Return: Pointer to the Rx descriptor
  312. */
  313. static inline
  314. struct dp_rx_desc *dp_rx_cookie_2_va_mon_buf(struct dp_soc *soc,
  315. uint32_t cookie)
  316. {
  317. return dp_get_rx_desc_from_cookie(soc, &soc->rx_desc_mon[0], cookie);
  318. }
  319. /**
  320. * dp_rx_cookie_2_va_mon_status() - Converts cookie to a virtual address of
  321. * the Rx descriptor on monitor status ring buffer
  322. * @soc: core txrx main context
  323. * @cookie: cookie used to lookup virtual address
  324. *
  325. * Return: Pointer to the Rx descriptor
  326. */
  327. static inline
  328. struct dp_rx_desc *dp_rx_cookie_2_va_mon_status(struct dp_soc *soc,
  329. uint32_t cookie)
  330. {
  331. return dp_get_rx_desc_from_cookie(soc, &soc->rx_desc_status[0], cookie);
  332. }
  333. #else
  334. /**
  335. * dp_rx_cookie_2_va_rxdma_buf() - Converts cookie to a virtual address of
  336. * the Rx descriptor on Rx DMA source ring buffer
  337. * @soc: core txrx main context
  338. * @cookie: cookie used to lookup virtual address
  339. *
  340. * Return: void *: Virtual Address of the Rx descriptor
  341. */
  342. static inline
  343. void *dp_rx_cookie_2_va_rxdma_buf(struct dp_soc *soc, uint32_t cookie)
  344. {
  345. uint8_t pool_id = DP_RX_DESC_COOKIE_POOL_ID_GET(cookie);
  346. uint16_t index = DP_RX_DESC_COOKIE_INDEX_GET(cookie);
  347. struct rx_desc_pool *rx_desc_pool;
  348. if (qdf_unlikely(pool_id >= MAX_RXDESC_POOLS))
  349. return NULL;
  350. rx_desc_pool = &soc->rx_desc_buf[pool_id];
  351. if (qdf_unlikely(index >= rx_desc_pool->pool_size))
  352. return NULL;
  353. return &(soc->rx_desc_buf[pool_id].array[index].rx_desc);
  354. }
  355. /**
  356. * dp_rx_cookie_2_va_mon_buf() - Converts cookie to a virtual address of
  357. * the Rx descriptor on monitor ring buffer
  358. * @soc: core txrx main context
  359. * @cookie: cookie used to lookup virtual address
  360. *
  361. * Return: void *: Virtual Address of the Rx descriptor
  362. */
  363. static inline
  364. void *dp_rx_cookie_2_va_mon_buf(struct dp_soc *soc, uint32_t cookie)
  365. {
  366. uint8_t pool_id = DP_RX_DESC_COOKIE_POOL_ID_GET(cookie);
  367. uint16_t index = DP_RX_DESC_COOKIE_INDEX_GET(cookie);
  368. /* TODO */
  369. /* Add sanity for pool_id & index */
  370. return &(soc->rx_desc_mon[pool_id].array[index].rx_desc);
  371. }
  372. /**
  373. * dp_rx_cookie_2_va_mon_status() - Converts cookie to a virtual address of
  374. * the Rx descriptor on monitor status ring buffer
  375. * @soc: core txrx main context
  376. * @cookie: cookie used to lookup virtual address
  377. *
  378. * Return: void *: Virtual Address of the Rx descriptor
  379. */
  380. static inline
  381. void *dp_rx_cookie_2_va_mon_status(struct dp_soc *soc, uint32_t cookie)
  382. {
  383. uint8_t pool_id = DP_RX_DESC_COOKIE_POOL_ID_GET(cookie);
  384. uint16_t index = DP_RX_DESC_COOKIE_INDEX_GET(cookie);
  385. /* TODO */
  386. /* Add sanity for pool_id & index */
  387. return &(soc->rx_desc_status[pool_id].array[index].rx_desc);
  388. }
  389. #endif /* RX_DESC_MULTI_PAGE_ALLOC */
  390. void dp_rx_add_desc_list_to_free_list(struct dp_soc *soc,
  391. union dp_rx_desc_list_elem_t **local_desc_list,
  392. union dp_rx_desc_list_elem_t **tail,
  393. uint16_t pool_id,
  394. struct rx_desc_pool *rx_desc_pool);
  395. uint16_t dp_rx_get_free_desc_list(struct dp_soc *soc, uint32_t pool_id,
  396. struct rx_desc_pool *rx_desc_pool,
  397. uint16_t num_descs,
  398. union dp_rx_desc_list_elem_t **desc_list,
  399. union dp_rx_desc_list_elem_t **tail);
  400. QDF_STATUS dp_rx_pdev_attach(struct dp_pdev *pdev);
  401. void dp_rx_pdev_detach(struct dp_pdev *pdev);
  402. void dp_print_napi_stats(struct dp_soc *soc);
  403. /**
  404. * dp_rx_vdev_detach() - detach vdev from dp rx
  405. * @vdev: virtual device instance
  406. *
  407. * Return: QDF_STATUS_SUCCESS: success
  408. * QDF_STATUS_E_RESOURCES: Error return
  409. */
  410. QDF_STATUS dp_rx_vdev_detach(struct dp_vdev *vdev);
  411. uint32_t
  412. dp_rx_process(struct dp_intr *int_ctx, hal_ring_handle_t hal_ring_hdl,
  413. uint8_t reo_ring_num,
  414. uint32_t quota);
  415. /**
  416. * dp_rx_err_process() - Processes error frames routed to REO error ring
  417. * @int_ctx: pointer to DP interrupt context
  418. * @soc: core txrx main context
  419. * @hal_ring: opaque pointer to the HAL Rx Error Ring, which will be serviced
  420. * @quota: No. of units (packets) that can be serviced in one shot.
  421. *
  422. * This function implements error processing and top level demultiplexer
  423. * for all the frames routed to REO error ring.
  424. *
  425. * Return: uint32_t: No. of elements processed
  426. */
  427. uint32_t dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
  428. hal_ring_handle_t hal_ring_hdl, uint32_t quota);
  429. /**
  430. * dp_rx_wbm_err_process() - Processes error frames routed to WBM release ring
  431. * @int_ctx: pointer to DP interrupt context
  432. * @soc: core txrx main context
  433. * @hal_ring: opaque pointer to the HAL Rx Error Ring, which will be serviced
  434. * @quota: No. of units (packets) that can be serviced in one shot.
  435. *
  436. * This function implements error processing and top level demultiplexer
  437. * for all the frames routed to WBM2HOST sw release ring.
  438. *
  439. * Return: uint32_t: No. of elements processed
  440. */
  441. uint32_t
  442. dp_rx_wbm_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
  443. hal_ring_handle_t hal_ring_hdl, uint32_t quota);
  444. /**
  445. * dp_rx_sg_create() - create a frag_list for MSDUs which are spread across
  446. * multiple nbufs.
  447. * @nbuf: pointer to the first msdu of an amsdu.
  448. *
  449. * This function implements the creation of RX frag_list for cases
  450. * where an MSDU is spread across multiple nbufs.
  451. *
  452. * Return: returns the head nbuf which contains complete frag_list.
  453. */
  454. qdf_nbuf_t dp_rx_sg_create(qdf_nbuf_t nbuf);
  455. /*
  456. * dp_rx_desc_pool_alloc() - create a pool of software rx_descs
  457. * at the time of dp rx initialization
  458. *
  459. * @soc: core txrx main context
  460. * @pool_id: pool_id which is one of 3 mac_ids
  461. * @pool_size: number of Rx descriptor in the pool
  462. * @rx_desc_pool: rx descriptor pool pointer
  463. *
  464. * Return: QDF status
  465. */
  466. QDF_STATUS dp_rx_desc_pool_alloc(struct dp_soc *soc, uint32_t pool_id,
  467. uint32_t pool_size, struct rx_desc_pool *pool);
  468. /*
  469. * dp_rx_desc_nbuf_and_pool_free() - free the sw rx desc pool called during
  470. * de-initialization of wifi module.
  471. *
  472. * @soc: core txrx main context
  473. * @pool_id: pool_id which is one of 3 mac_ids
  474. * @rx_desc_pool: rx descriptor pool pointer
  475. *
  476. * Return: None
  477. */
  478. void dp_rx_desc_nbuf_and_pool_free(struct dp_soc *soc, uint32_t pool_id,
  479. struct rx_desc_pool *rx_desc_pool);
  480. /*
  481. * dp_rx_desc_nbuf_free() - free the sw rx desc nbufs called during
  482. * de-initialization of wifi module.
  483. *
  484. * @soc: core txrx main context
  485. * @pool_id: pool_id which is one of 3 mac_ids
  486. * @rx_desc_pool: rx descriptor pool pointer
  487. *
  488. * Return: None
  489. */
  490. void dp_rx_desc_nbuf_free(struct dp_soc *soc,
  491. struct rx_desc_pool *rx_desc_pool);
  492. /*
  493. * dp_rx_desc_pool_free() - free the sw rx desc array called during
  494. * de-initialization of wifi module.
  495. *
  496. * @soc: core txrx main context
  497. * @rx_desc_pool: rx descriptor pool pointer
  498. *
  499. * Return: None
  500. */
  501. void dp_rx_desc_pool_free(struct dp_soc *soc,
  502. struct rx_desc_pool *rx_desc_pool);
  503. void dp_rx_deliver_raw(struct dp_vdev *vdev, qdf_nbuf_t nbuf_list,
  504. struct dp_peer *peer);
  505. /**
  506. * dp_rx_add_to_free_desc_list() - Adds to a local free descriptor list
  507. *
  508. * @head: pointer to the head of local free list
  509. * @tail: pointer to the tail of local free list
  510. * @new: new descriptor that is added to the free list
  511. *
  512. * Return: void:
  513. */
  514. static inline
  515. void dp_rx_add_to_free_desc_list(union dp_rx_desc_list_elem_t **head,
  516. union dp_rx_desc_list_elem_t **tail,
  517. struct dp_rx_desc *new)
  518. {
  519. qdf_assert(head && new);
  520. new->nbuf = NULL;
  521. new->in_use = 0;
  522. ((union dp_rx_desc_list_elem_t *)new)->next = *head;
  523. *head = (union dp_rx_desc_list_elem_t *)new;
  524. /* reset tail if head->next is NULL */
  525. if (!*tail || !(*head)->next)
  526. *tail = *head;
  527. }
  528. uint8_t dp_rx_process_invalid_peer(struct dp_soc *soc, qdf_nbuf_t nbuf,
  529. uint8_t mac_id);
  530. void dp_rx_process_invalid_peer_wrapper(struct dp_soc *soc,
  531. qdf_nbuf_t mpdu, bool mpdu_done, uint8_t mac_id);
  532. void dp_rx_process_mic_error(struct dp_soc *soc, qdf_nbuf_t nbuf,
  533. uint8_t *rx_tlv_hdr, struct dp_peer *peer);
  534. void dp_2k_jump_handle(struct dp_soc *soc, qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr,
  535. uint16_t peer_id, uint8_t tid);
  536. #define DP_RX_LIST_APPEND(head, tail, elem) \
  537. do { \
  538. if (!(head)) { \
  539. (head) = (elem); \
  540. QDF_NBUF_CB_RX_NUM_ELEMENTS_IN_LIST(head) = 1;\
  541. } else { \
  542. qdf_nbuf_set_next((tail), (elem)); \
  543. QDF_NBUF_CB_RX_NUM_ELEMENTS_IN_LIST(head)++; \
  544. } \
  545. (tail) = (elem); \
  546. qdf_nbuf_set_next((tail), NULL); \
  547. } while (0)
  548. /*for qcn9000 emulation the pcie is complete phy and no address restrictions*/
  549. #if !defined(BUILD_X86) || defined(QCA_WIFI_QCN9000)
  550. static inline int check_x86_paddr(struct dp_soc *dp_soc, qdf_nbuf_t *rx_netbuf,
  551. qdf_dma_addr_t *paddr, struct rx_desc_pool *rx_desc_pool)
  552. {
  553. return QDF_STATUS_SUCCESS;
  554. }
  555. #else
  556. #define MAX_RETRY 100
  557. static inline int check_x86_paddr(struct dp_soc *dp_soc, qdf_nbuf_t *rx_netbuf,
  558. qdf_dma_addr_t *paddr, struct rx_desc_pool *rx_desc_pool)
  559. {
  560. uint32_t nbuf_retry = 0;
  561. int32_t ret;
  562. const uint32_t x86_phy_addr = 0x50000000;
  563. /*
  564. * in M2M emulation platforms (x86) the memory below 0x50000000
  565. * is reserved for target use, so any memory allocated in this
  566. * region should not be used by host
  567. */
  568. do {
  569. if (qdf_likely(*paddr > x86_phy_addr))
  570. return QDF_STATUS_SUCCESS;
  571. else {
  572. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
  573. "phy addr %pK exceeded 0x50000000 trying again",
  574. paddr);
  575. nbuf_retry++;
  576. if ((*rx_netbuf)) {
  577. qdf_nbuf_unmap_single(dp_soc->osdev, *rx_netbuf,
  578. QDF_DMA_FROM_DEVICE);
  579. /* Not freeing buffer intentionally.
  580. * Observed that same buffer is getting
  581. * re-allocated resulting in longer load time
  582. * WMI init timeout.
  583. * This buffer is anyway not useful so skip it.
  584. **/
  585. }
  586. *rx_netbuf = qdf_nbuf_alloc(dp_soc->osdev,
  587. rx_desc_pool->buf_size,
  588. RX_BUFFER_RESERVATION,
  589. rx_desc_pool->buf_alignment,
  590. FALSE);
  591. if (qdf_unlikely(!(*rx_netbuf)))
  592. return QDF_STATUS_E_FAILURE;
  593. ret = qdf_nbuf_map_single(dp_soc->osdev, *rx_netbuf,
  594. QDF_DMA_FROM_DEVICE);
  595. if (qdf_unlikely(ret == QDF_STATUS_E_FAILURE)) {
  596. qdf_nbuf_free(*rx_netbuf);
  597. *rx_netbuf = NULL;
  598. continue;
  599. }
  600. *paddr = qdf_nbuf_get_frag_paddr(*rx_netbuf, 0);
  601. }
  602. } while (nbuf_retry < MAX_RETRY);
  603. if ((*rx_netbuf)) {
  604. qdf_nbuf_unmap_single(dp_soc->osdev, *rx_netbuf,
  605. QDF_DMA_FROM_DEVICE);
  606. qdf_nbuf_free(*rx_netbuf);
  607. }
  608. return QDF_STATUS_E_FAILURE;
  609. }
  610. #endif
  611. /**
  612. * dp_rx_cookie_2_link_desc_va() - Converts cookie to a virtual address of
  613. * the MSDU Link Descriptor
  614. * @soc: core txrx main context
  615. * @buf_info: buf_info includes cookie that is used to lookup
  616. * virtual address of link descriptor after deriving the page id
  617. * and the offset or index of the desc on the associatde page.
  618. *
  619. * This is the VA of the link descriptor, that HAL layer later uses to
  620. * retrieve the list of MSDU's for a given MPDU.
  621. *
  622. * Return: void *: Virtual Address of the Rx descriptor
  623. */
  624. static inline
  625. void *dp_rx_cookie_2_link_desc_va(struct dp_soc *soc,
  626. struct hal_buf_info *buf_info)
  627. {
  628. void *link_desc_va;
  629. struct qdf_mem_multi_page_t *pages;
  630. uint16_t page_id = LINK_DESC_COOKIE_PAGE_ID(buf_info->sw_cookie);
  631. pages = &soc->link_desc_pages;
  632. if (!pages)
  633. return NULL;
  634. if (qdf_unlikely(page_id >= pages->num_pages))
  635. return NULL;
  636. link_desc_va = pages->dma_pages[page_id].page_v_addr_start +
  637. (buf_info->paddr - pages->dma_pages[page_id].page_p_addr);
  638. return link_desc_va;
  639. }
  640. /**
  641. * dp_rx_cookie_2_mon_link_desc_va() - Converts cookie to a virtual address of
  642. * the MSDU Link Descriptor
  643. * @pdev: core txrx pdev context
  644. * @buf_info: buf_info includes cookie that used to lookup virtual address of
  645. * link descriptor. Normally this is just an index into a per pdev array.
  646. *
  647. * This is the VA of the link descriptor in monitor mode destination ring,
  648. * that HAL layer later uses to retrieve the list of MSDU's for a given MPDU.
  649. *
  650. * Return: void *: Virtual Address of the Rx descriptor
  651. */
  652. static inline
  653. void *dp_rx_cookie_2_mon_link_desc_va(struct dp_pdev *pdev,
  654. struct hal_buf_info *buf_info,
  655. int mac_id)
  656. {
  657. void *link_desc_va;
  658. /* TODO */
  659. /* Add sanity for cookie */
  660. link_desc_va =
  661. pdev->soc->mon_link_desc_banks[mac_id][buf_info->sw_cookie]
  662. .base_vaddr +
  663. (buf_info->paddr -
  664. pdev->soc->mon_link_desc_banks[mac_id][buf_info->sw_cookie]
  665. .base_paddr);
  666. return link_desc_va;
  667. }
  668. /**
  669. * dp_rx_defrag_concat() - Concatenate the fragments
  670. *
  671. * @dst: destination pointer to the buffer
  672. * @src: source pointer from where the fragment payload is to be copied
  673. *
  674. * Return: QDF_STATUS
  675. */
  676. static inline QDF_STATUS dp_rx_defrag_concat(qdf_nbuf_t dst, qdf_nbuf_t src)
  677. {
  678. /*
  679. * Inside qdf_nbuf_cat, if it is necessary to reallocate dst
  680. * to provide space for src, the headroom portion is copied from
  681. * the original dst buffer to the larger new dst buffer.
  682. * (This is needed, because the headroom of the dst buffer
  683. * contains the rx desc.)
  684. */
  685. if (!qdf_nbuf_cat(dst, src)) {
  686. /*
  687. * qdf_nbuf_cat does not free the src memory.
  688. * Free src nbuf before returning
  689. * For failure case the caller takes of freeing the nbuf
  690. */
  691. qdf_nbuf_free(src);
  692. return QDF_STATUS_SUCCESS;
  693. }
  694. return QDF_STATUS_E_DEFRAG_ERROR;
  695. }
  696. #ifndef FEATURE_WDS
  697. static inline QDF_STATUS dp_rx_ast_set_active(struct dp_soc *soc, uint16_t sa_idx, bool is_active)
  698. {
  699. return QDF_STATUS_SUCCESS;
  700. }
  701. static inline void
  702. dp_rx_wds_srcport_learn(struct dp_soc *soc,
  703. uint8_t *rx_tlv_hdr,
  704. struct dp_peer *ta_peer,
  705. qdf_nbuf_t nbuf,
  706. struct hal_rx_msdu_metadata msdu_metadata)
  707. {
  708. }
  709. #endif
  710. /*
  711. * dp_rx_desc_dump() - dump the sw rx descriptor
  712. *
  713. * @rx_desc: sw rx descriptor
  714. */
  715. static inline void dp_rx_desc_dump(struct dp_rx_desc *rx_desc)
  716. {
  717. dp_info("rx_desc->nbuf: %pK, rx_desc->cookie: %d, rx_desc->pool_id: %d, rx_desc->in_use: %d, rx_desc->unmapped: %d",
  718. rx_desc->nbuf, rx_desc->cookie, rx_desc->pool_id,
  719. rx_desc->in_use, rx_desc->unmapped);
  720. }
  721. /*
  722. * check_qwrap_multicast_loopback() - Check if rx packet is a loopback packet.
  723. * In qwrap mode, packets originated from
  724. * any vdev should not loopback and
  725. * should be dropped.
  726. * @vdev: vdev on which rx packet is received
  727. * @nbuf: rx pkt
  728. *
  729. */
  730. #if ATH_SUPPORT_WRAP
  731. static inline bool check_qwrap_multicast_loopback(struct dp_vdev *vdev,
  732. qdf_nbuf_t nbuf)
  733. {
  734. struct dp_vdev *psta_vdev;
  735. struct dp_pdev *pdev = vdev->pdev;
  736. uint8_t *data = qdf_nbuf_data(nbuf);
  737. if (qdf_unlikely(vdev->proxysta_vdev)) {
  738. /* In qwrap isolation mode, allow loopback packets as all
  739. * packets go to RootAP and Loopback on the mpsta.
  740. */
  741. if (vdev->isolation_vdev)
  742. return false;
  743. TAILQ_FOREACH(psta_vdev, &pdev->vdev_list, vdev_list_elem) {
  744. if (qdf_unlikely(psta_vdev->proxysta_vdev &&
  745. !qdf_mem_cmp(psta_vdev->mac_addr.raw,
  746. &data[QDF_MAC_ADDR_SIZE],
  747. QDF_MAC_ADDR_SIZE))) {
  748. /* Drop packet if source address is equal to
  749. * any of the vdev addresses.
  750. */
  751. return true;
  752. }
  753. }
  754. }
  755. return false;
  756. }
  757. #else
  758. static inline bool check_qwrap_multicast_loopback(struct dp_vdev *vdev,
  759. qdf_nbuf_t nbuf)
  760. {
  761. return false;
  762. }
  763. #endif
  764. #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\
  765. defined(WLAN_SUPPORT_RX_TAG_STATISTICS) ||\
  766. defined(WLAN_SUPPORT_RX_FLOW_TAG)
  767. #include "dp_rx_tag.h"
  768. #endif
  769. #ifndef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
  770. /**
  771. * dp_rx_update_protocol_tag() - Reads CCE metadata from the RX MSDU end TLV
  772. * and set the corresponding tag in QDF packet
  773. * @soc: core txrx main context
  774. * @vdev: vdev on which the packet is received
  775. * @nbuf: QDF pkt buffer on which the protocol tag should be set
  776. * @rx_tlv_hdr: rBbase address where the RX TLVs starts
  777. * @ring_index: REO ring number, not used for error & monitor ring
  778. * @is_reo_exception: flag to indicate if rx from REO ring or exception ring
  779. * @is_update_stats: flag to indicate whether to update stats or not
  780. * Return: void
  781. */
  782. static inline void
  783. dp_rx_update_protocol_tag(struct dp_soc *soc, struct dp_vdev *vdev,
  784. qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr,
  785. uint16_t ring_index,
  786. bool is_reo_exception, bool is_update_stats)
  787. {
  788. }
  789. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
  790. #ifndef WLAN_SUPPORT_RX_FLOW_TAG
  791. /**
  792. * dp_rx_update_flow_tag() - Reads FSE metadata from the RX MSDU end TLV
  793. * and set the corresponding tag in QDF packet
  794. * @soc: core txrx main context
  795. * @vdev: vdev on which the packet is received
  796. * @nbuf: QDF pkt buffer on which the protocol tag should be set
  797. * @rx_tlv_hdr: base address where the RX TLVs starts
  798. * @is_update_stats: flag to indicate whether to update stats or not
  799. *
  800. * Return: void
  801. */
  802. static inline void
  803. dp_rx_update_flow_tag(struct dp_soc *soc, struct dp_vdev *vdev,
  804. qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr, bool update_stats)
  805. {
  806. }
  807. #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
  808. #if !defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) &&\
  809. !defined(WLAN_SUPPORT_RX_FLOW_TAG)
  810. /**
  811. * dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor
  812. * mode and then tags appropriate packets
  813. * @soc: core txrx main context
  814. * @vdev: pdev on which packet is received
  815. * @msdu: QDF packet buffer on which the protocol tag should be set
  816. * @rx_desc: base address where the RX TLVs start
  817. * Return: void
  818. */
  819. static inline
  820. void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
  821. struct dp_pdev *dp_pdev,
  822. qdf_nbuf_t msdu, void *rx_desc)
  823. {
  824. }
  825. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */
  826. /*
  827. * dp_rx_buffers_replenish() - replenish rxdma ring with rx nbufs
  828. * called during dp rx initialization
  829. * and at the end of dp_rx_process.
  830. *
  831. * @soc: core txrx main context
  832. * @mac_id: mac_id which is one of 3 mac_ids
  833. * @dp_rxdma_srng: dp rxdma circular ring
  834. * @rx_desc_pool: Pointer to free Rx descriptor pool
  835. * @num_req_buffers: number of buffer to be replenished
  836. * @desc_list: list of descs if called from dp_rx_process
  837. * or NULL during dp rx initialization or out of buffer
  838. * interrupt.
  839. * @tail: tail of descs list
  840. * Return: return success or failure
  841. */
  842. QDF_STATUS dp_rx_buffers_replenish(struct dp_soc *dp_soc, uint32_t mac_id,
  843. struct dp_srng *dp_rxdma_srng,
  844. struct rx_desc_pool *rx_desc_pool,
  845. uint32_t num_req_buffers,
  846. union dp_rx_desc_list_elem_t **desc_list,
  847. union dp_rx_desc_list_elem_t **tail);
  848. /*
  849. * dp_pdev_rx_buffers_attach() - replenish rxdma ring with rx nbufs
  850. * called during dp rx initialization
  851. *
  852. * @soc: core txrx main context
  853. * @mac_id: mac_id which is one of 3 mac_ids
  854. * @dp_rxdma_srng: dp rxdma circular ring
  855. * @rx_desc_pool: Pointer to free Rx descriptor pool
  856. * @num_req_buffers: number of buffer to be replenished
  857. *
  858. * Return: return success or failure
  859. */
  860. QDF_STATUS
  861. dp_pdev_rx_buffers_attach(struct dp_soc *dp_soc, uint32_t mac_id,
  862. struct dp_srng *dp_rxdma_srng,
  863. struct rx_desc_pool *rx_desc_pool,
  864. uint32_t num_req_buffers);
  865. /**
  866. * dp_rx_link_desc_return() - Return a MPDU link descriptor to HW
  867. * (WBM), following error handling
  868. *
  869. * @soc: core DP main context
  870. * @buf_addr_info: opaque pointer to the REO error ring descriptor
  871. * @buf_addr_info: void pointer to the buffer_addr_info
  872. * @bm_action: put to idle_list or release to msdu_list
  873. *
  874. * Return: QDF_STATUS_E_FAILURE for failure else QDF_STATUS_SUCCESS
  875. */
  876. QDF_STATUS
  877. dp_rx_link_desc_return(struct dp_soc *soc, hal_ring_desc_t ring_desc,
  878. uint8_t bm_action);
  879. /**
  880. * dp_rx_link_desc_return_by_addr - Return a MPDU link descriptor to
  881. * (WBM) by address
  882. *
  883. * @soc: core DP main context
  884. * @link_desc_addr: link descriptor addr
  885. *
  886. * Return: QDF_STATUS_E_FAILURE for failure else QDF_STATUS_SUCCESS
  887. */
  888. QDF_STATUS
  889. dp_rx_link_desc_return_by_addr(struct dp_soc *soc,
  890. hal_buff_addrinfo_t link_desc_addr,
  891. uint8_t bm_action);
  892. /**
  893. * dp_rxdma_err_process() - RxDMA error processing functionality
  894. * @soc: core txrx main contex
  895. * @mac_id: mac id which is one of 3 mac_ids
  896. * @hal_ring: opaque pointer to the HAL Rx Ring, which will be serviced
  897. * @quota: No. of units (packets) that can be serviced in one shot.
  898. *
  899. * Return: num of buffers processed
  900. */
  901. uint32_t
  902. dp_rxdma_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
  903. uint32_t mac_id, uint32_t quota);
  904. void dp_rx_fill_mesh_stats(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  905. uint8_t *rx_tlv_hdr, struct dp_peer *peer);
  906. QDF_STATUS dp_rx_filter_mesh_packets(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  907. uint8_t *rx_tlv_hdr);
  908. int dp_wds_rx_policy_check(uint8_t *rx_tlv_hdr, struct dp_vdev *vdev,
  909. struct dp_peer *peer);
  910. qdf_nbuf_t
  911. dp_rx_nbuf_prepare(struct dp_soc *soc, struct dp_pdev *pdev);
  912. /*
  913. * dp_rx_dump_info_and_assert() - dump RX Ring info and Rx Desc info
  914. *
  915. * @soc: core txrx main context
  916. * @hal_ring: opaque pointer to the HAL Rx Ring, which will be serviced
  917. * @ring_desc: opaque pointer to the RX ring descriptor
  918. * @rx_desc: host rs descriptor
  919. *
  920. * Return: void
  921. */
  922. void dp_rx_dump_info_and_assert(struct dp_soc *soc,
  923. hal_ring_handle_t hal_ring_hdl,
  924. hal_ring_desc_t ring_desc,
  925. struct dp_rx_desc *rx_desc);
  926. void dp_rx_compute_delay(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  927. #ifdef RX_DESC_DEBUG_CHECK
  928. /**
  929. * dp_rx_desc_check_magic() - check the magic value in dp_rx_desc
  930. * @rx_desc: rx descriptor pointer
  931. *
  932. * Return: true, if magic is correct, else false.
  933. */
  934. static inline bool dp_rx_desc_check_magic(struct dp_rx_desc *rx_desc)
  935. {
  936. if (qdf_unlikely(rx_desc->magic != DP_RX_DESC_MAGIC))
  937. return false;
  938. rx_desc->magic = 0;
  939. return true;
  940. }
  941. /**
  942. * dp_rx_desc_prep() - prepare rx desc
  943. * @rx_desc: rx descriptor pointer to be prepared
  944. * @nbuf: nbuf to be associated with rx_desc
  945. *
  946. * Note: assumption is that we are associating a nbuf which is mapped
  947. *
  948. * Return: none
  949. */
  950. static inline void dp_rx_desc_prep(struct dp_rx_desc *rx_desc, qdf_nbuf_t nbuf)
  951. {
  952. rx_desc->magic = DP_RX_DESC_MAGIC;
  953. rx_desc->nbuf = nbuf;
  954. rx_desc->unmapped = 0;
  955. }
  956. #else
  957. static inline bool dp_rx_desc_check_magic(struct dp_rx_desc *rx_desc)
  958. {
  959. return true;
  960. }
  961. static inline void dp_rx_desc_prep(struct dp_rx_desc *rx_desc, qdf_nbuf_t nbuf)
  962. {
  963. rx_desc->nbuf = nbuf;
  964. rx_desc->unmapped = 0;
  965. }
  966. #endif /* RX_DESC_DEBUG_CHECK */
  967. void dp_rx_process_rxdma_err(struct dp_soc *soc, qdf_nbuf_t nbuf,
  968. uint8_t *rx_tlv_hdr, struct dp_peer *peer,
  969. uint8_t err_code, uint8_t mac_id);
  970. #ifdef PEER_CACHE_RX_PKTS
  971. /**
  972. * dp_rx_flush_rx_cached() - flush cached rx frames
  973. * @peer: peer
  974. * @drop: set flag to drop frames
  975. *
  976. * Return: None
  977. */
  978. void dp_rx_flush_rx_cached(struct dp_peer *peer, bool drop);
  979. #else
  980. static inline void dp_rx_flush_rx_cached(struct dp_peer *peer, bool drop)
  981. {
  982. }
  983. #endif
  984. #ifndef QCA_MULTIPASS_SUPPORT
  985. static inline
  986. bool dp_rx_multipass_process(struct dp_peer *peer, qdf_nbuf_t nbuf, uint8_t tid)
  987. {
  988. return false;
  989. }
  990. #else
  991. bool dp_rx_multipass_process(struct dp_peer *peer, qdf_nbuf_t nbuf,
  992. uint8_t tid);
  993. #endif
  994. #ifndef WLAN_RX_PKT_CAPTURE_ENH
  995. static inline
  996. QDF_STATUS dp_peer_set_rx_capture_enabled(struct dp_pdev *pdev,
  997. struct dp_peer *peer_handle,
  998. bool value, uint8_t *mac_addr)
  999. {
  1000. return QDF_STATUS_SUCCESS;
  1001. }
  1002. #endif
  1003. /**
  1004. * dp_rx_deliver_to_stack() - deliver pkts to network stack
  1005. * Caller to hold peer refcount and check for valid peer
  1006. * @soc: soc
  1007. * @vdev: vdev
  1008. * @peer: peer
  1009. * @nbuf_head: skb list head
  1010. * @nbuf_tail: skb list tail
  1011. *
  1012. * Return: None
  1013. */
  1014. void dp_rx_deliver_to_stack(struct dp_soc *soc,
  1015. struct dp_vdev *vdev,
  1016. struct dp_peer *peer,
  1017. qdf_nbuf_t nbuf_head,
  1018. qdf_nbuf_t nbuf_tail);
  1019. #endif /* _DP_RX_H */