dp_rx.h 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603
  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. #define dp_rx_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_RX, params)
  56. #define dp_rx_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_RX, params)
  57. #define dp_rx_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_RX, params)
  58. #define dp_rx_info(params...) \
  59. __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_RX, ## params)
  60. #define dp_rx_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_RX, params)
  61. /**
  62. * enum dp_rx_desc_state
  63. *
  64. * @RX_DESC_REPLENISH: rx desc replenished
  65. * @RX_DESC_FREELIST: rx desc in freelist
  66. */
  67. enum dp_rx_desc_state {
  68. RX_DESC_REPLENISHED,
  69. RX_DESC_IN_FREELIST,
  70. };
  71. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  72. /**
  73. * struct dp_rx_desc_dbg_info
  74. *
  75. * @freelist_caller: name of the function that put the
  76. * the rx desc in freelist
  77. * @freelist_ts: timestamp when the rx desc is put in
  78. * a freelist
  79. * @replenish_caller: name of the function that last
  80. * replenished the rx desc
  81. * @replenish_ts: last replenish timestamp
  82. */
  83. struct dp_rx_desc_dbg_info {
  84. char freelist_caller[QDF_MEM_FUNC_NAME_SIZE];
  85. uint64_t freelist_ts;
  86. char replenish_caller[QDF_MEM_FUNC_NAME_SIZE];
  87. uint64_t replenish_ts;
  88. };
  89. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  90. /**
  91. * struct dp_rx_desc
  92. *
  93. * @nbuf : VA of the "skb" posted
  94. * @rx_buf_start : VA of the original Rx buffer, before
  95. * movement of any skb->data pointer
  96. * @paddr_buf_start : PA of the original Rx buffer, before
  97. * movement of any frag pointer
  98. * @cookie : index into the sw array which holds
  99. * the sw Rx descriptors
  100. * Cookie space is 21 bits:
  101. * lower 18 bits -- index
  102. * upper 3 bits -- pool_id
  103. * @pool_id : pool Id for which this allocated.
  104. * Can only be used if there is no flow
  105. * steering
  106. * @in_use rx_desc is in use
  107. * @unmapped used to mark rx_desc an unmapped if the corresponding
  108. * nbuf is already unmapped
  109. * @in_err_state : Nbuf sanity failed for this descriptor.
  110. */
  111. struct dp_rx_desc {
  112. qdf_nbuf_t nbuf;
  113. uint8_t *rx_buf_start;
  114. qdf_dma_addr_t paddr_buf_start;
  115. uint32_t cookie;
  116. uint8_t pool_id;
  117. #ifdef RX_DESC_DEBUG_CHECK
  118. uint32_t magic;
  119. struct dp_rx_desc_dbg_info *dbg_info;
  120. #endif
  121. uint8_t in_use:1,
  122. unmapped:1,
  123. in_err_state:1;
  124. };
  125. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  126. /* RX Descriptor Multi Page memory alloc related */
  127. #define DP_RX_DESC_OFFSET_NUM_BITS 8
  128. #define DP_RX_DESC_PAGE_ID_NUM_BITS 8
  129. #define DP_RX_DESC_POOL_ID_NUM_BITS 4
  130. #define DP_RX_DESC_PAGE_ID_SHIFT DP_RX_DESC_OFFSET_NUM_BITS
  131. #define DP_RX_DESC_POOL_ID_SHIFT \
  132. (DP_RX_DESC_OFFSET_NUM_BITS + DP_RX_DESC_PAGE_ID_NUM_BITS)
  133. #define RX_DESC_MULTI_PAGE_COOKIE_POOL_ID_MASK \
  134. (((1 << DP_RX_DESC_POOL_ID_NUM_BITS) - 1) << DP_RX_DESC_POOL_ID_SHIFT)
  135. #define RX_DESC_MULTI_PAGE_COOKIE_PAGE_ID_MASK \
  136. (((1 << DP_RX_DESC_PAGE_ID_NUM_BITS) - 1) << \
  137. DP_RX_DESC_PAGE_ID_SHIFT)
  138. #define RX_DESC_MULTI_PAGE_COOKIE_OFFSET_MASK \
  139. ((1 << DP_RX_DESC_OFFSET_NUM_BITS) - 1)
  140. #define DP_RX_DESC_MULTI_PAGE_COOKIE_GET_POOL_ID(_cookie) \
  141. (((_cookie) & RX_DESC_MULTI_PAGE_COOKIE_POOL_ID_MASK) >> \
  142. DP_RX_DESC_POOL_ID_SHIFT)
  143. #define DP_RX_DESC_MULTI_PAGE_COOKIE_GET_PAGE_ID(_cookie) \
  144. (((_cookie) & RX_DESC_MULTI_PAGE_COOKIE_PAGE_ID_MASK) >> \
  145. DP_RX_DESC_PAGE_ID_SHIFT)
  146. #define DP_RX_DESC_MULTI_PAGE_COOKIE_GET_OFFSET(_cookie) \
  147. ((_cookie) & RX_DESC_MULTI_PAGE_COOKIE_OFFSET_MASK)
  148. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  149. #define RX_DESC_COOKIE_INDEX_SHIFT 0
  150. #define RX_DESC_COOKIE_INDEX_MASK 0x3ffff /* 18 bits */
  151. #define RX_DESC_COOKIE_POOL_ID_SHIFT 18
  152. #define RX_DESC_COOKIE_POOL_ID_MASK 0x1c0000
  153. #define DP_RX_DESC_COOKIE_MAX \
  154. (RX_DESC_COOKIE_INDEX_MASK | RX_DESC_COOKIE_POOL_ID_MASK)
  155. #define DP_RX_DESC_COOKIE_POOL_ID_GET(_cookie) \
  156. (((_cookie) & RX_DESC_COOKIE_POOL_ID_MASK) >> \
  157. RX_DESC_COOKIE_POOL_ID_SHIFT)
  158. #define DP_RX_DESC_COOKIE_INDEX_GET(_cookie) \
  159. (((_cookie) & RX_DESC_COOKIE_INDEX_MASK) >> \
  160. RX_DESC_COOKIE_INDEX_SHIFT)
  161. #define dp_rx_add_to_free_desc_list(head, tail, new) \
  162. __dp_rx_add_to_free_desc_list(head, tail, new, __func__)
  163. #define dp_rx_buffers_replenish(soc, mac_id, rxdma_srng, rx_desc_pool, \
  164. num_buffers, desc_list, tail) \
  165. __dp_rx_buffers_replenish(soc, mac_id, rxdma_srng, rx_desc_pool, \
  166. num_buffers, desc_list, tail, __func__)
  167. #ifdef DP_RX_SPECIAL_FRAME_NEED
  168. /**
  169. * dp_rx_is_special_frame() - check is RX frame special needed
  170. *
  171. * @nbuf: RX skb pointer
  172. * @frame_mask: the mask for speical frame needed
  173. *
  174. * Check is RX frame wanted matched with mask
  175. *
  176. * Return: true - special frame needed, false - no
  177. */
  178. static inline
  179. bool dp_rx_is_special_frame(qdf_nbuf_t nbuf, uint32_t frame_mask)
  180. {
  181. if (((frame_mask & FRAME_MASK_IPV4_ARP) &&
  182. qdf_nbuf_is_ipv4_arp_pkt(nbuf)) ||
  183. ((frame_mask & FRAME_MASK_IPV4_DHCP) &&
  184. qdf_nbuf_is_ipv4_dhcp_pkt(nbuf)) ||
  185. ((frame_mask & FRAME_MASK_IPV4_EAPOL) &&
  186. qdf_nbuf_is_ipv4_eapol_pkt(nbuf)) ||
  187. ((frame_mask & FRAME_MASK_IPV6_DHCP) &&
  188. qdf_nbuf_is_ipv6_dhcp_pkt(nbuf)))
  189. return true;
  190. return false;
  191. }
  192. /**
  193. * dp_rx_deliver_special_frame() - Deliver the RX special frame to stack
  194. * if matches mask
  195. *
  196. * @soc: Datapath soc handler
  197. * @peer: pointer to DP peer
  198. * @nbuf: pointer to the skb of RX frame
  199. * @frame_mask: the mask for speical frame needed
  200. * @rx_tlv_hdr: start of rx tlv header
  201. *
  202. * note: Msdu_len must have been stored in QDF_NBUF_CB_RX_PKT_LEN(nbuf) and
  203. * single nbuf is expected.
  204. *
  205. * return: true - nbuf has been delivered to stack, false - not.
  206. */
  207. bool dp_rx_deliver_special_frame(struct dp_soc *soc, struct dp_peer *peer,
  208. qdf_nbuf_t nbuf, uint32_t frame_mask,
  209. uint8_t *rx_tlv_hdr);
  210. #else
  211. static inline
  212. bool dp_rx_is_special_frame(qdf_nbuf_t nbuf, uint32_t frame_mask)
  213. {
  214. return false;
  215. }
  216. static inline
  217. bool dp_rx_deliver_special_frame(struct dp_soc *soc, struct dp_peer *peer,
  218. qdf_nbuf_t nbuf, uint32_t frame_mask,
  219. uint8_t *rx_tlv_hdr)
  220. {
  221. return false;
  222. }
  223. #endif
  224. /* DOC: Offset to obtain LLC hdr
  225. *
  226. * In the case of Wifi parse error
  227. * to reach LLC header from beginning
  228. * of VLAN tag we need to skip 8 bytes.
  229. * Vlan_tag(4)+length(2)+length added
  230. * by HW(2) = 8 bytes.
  231. */
  232. #define DP_SKIP_VLAN 8
  233. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  234. /**
  235. * struct dp_rx_cached_buf - rx cached buffer
  236. * @list: linked list node
  237. * @buf: skb buffer
  238. */
  239. struct dp_rx_cached_buf {
  240. qdf_list_node_t node;
  241. qdf_nbuf_t buf;
  242. };
  243. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  244. /*
  245. *dp_rx_xor_block() - xor block of data
  246. *@b: destination data block
  247. *@a: source data block
  248. *@len: length of the data to process
  249. *
  250. *Returns: None
  251. */
  252. static inline void dp_rx_xor_block(uint8_t *b, const uint8_t *a, qdf_size_t len)
  253. {
  254. qdf_size_t i;
  255. for (i = 0; i < len; i++)
  256. b[i] ^= a[i];
  257. }
  258. /*
  259. *dp_rx_rotl() - rotate the bits left
  260. *@val: unsigned integer input value
  261. *@bits: number of bits
  262. *
  263. *Returns: Integer with left rotated by number of 'bits'
  264. */
  265. static inline uint32_t dp_rx_rotl(uint32_t val, int bits)
  266. {
  267. return (val << bits) | (val >> (32 - bits));
  268. }
  269. /*
  270. *dp_rx_rotr() - rotate the bits right
  271. *@val: unsigned integer input value
  272. *@bits: number of bits
  273. *
  274. *Returns: Integer with right rotated by number of 'bits'
  275. */
  276. static inline uint32_t dp_rx_rotr(uint32_t val, int bits)
  277. {
  278. return (val >> bits) | (val << (32 - bits));
  279. }
  280. /*
  281. * dp_set_rx_queue() - set queue_mapping in skb
  282. * @nbuf: skb
  283. * @queue_id: rx queue_id
  284. *
  285. * Return: void
  286. */
  287. #ifdef QCA_OL_RX_MULTIQ_SUPPORT
  288. static inline void dp_set_rx_queue(qdf_nbuf_t nbuf, uint8_t queue_id)
  289. {
  290. qdf_nbuf_record_rx_queue(nbuf, queue_id);
  291. return;
  292. }
  293. #else
  294. static inline void dp_set_rx_queue(qdf_nbuf_t nbuf, uint8_t queue_id)
  295. {
  296. }
  297. #endif
  298. /*
  299. *dp_rx_xswap() - swap the bits left
  300. *@val: unsigned integer input value
  301. *
  302. *Returns: Integer with bits swapped
  303. */
  304. static inline uint32_t dp_rx_xswap(uint32_t val)
  305. {
  306. return ((val & 0x00ff00ff) << 8) | ((val & 0xff00ff00) >> 8);
  307. }
  308. /*
  309. *dp_rx_get_le32_split() - get little endian 32 bits split
  310. *@b0: byte 0
  311. *@b1: byte 1
  312. *@b2: byte 2
  313. *@b3: byte 3
  314. *
  315. *Returns: Integer with split little endian 32 bits
  316. */
  317. static inline uint32_t dp_rx_get_le32_split(uint8_t b0, uint8_t b1, uint8_t b2,
  318. uint8_t b3)
  319. {
  320. return b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
  321. }
  322. /*
  323. *dp_rx_get_le32() - get little endian 32 bits
  324. *@b0: byte 0
  325. *@b1: byte 1
  326. *@b2: byte 2
  327. *@b3: byte 3
  328. *
  329. *Returns: Integer with little endian 32 bits
  330. */
  331. static inline uint32_t dp_rx_get_le32(const uint8_t *p)
  332. {
  333. return dp_rx_get_le32_split(p[0], p[1], p[2], p[3]);
  334. }
  335. /*
  336. * dp_rx_put_le32() - put little endian 32 bits
  337. * @p: destination char array
  338. * @v: source 32-bit integer
  339. *
  340. * Returns: None
  341. */
  342. static inline void dp_rx_put_le32(uint8_t *p, uint32_t v)
  343. {
  344. p[0] = (v) & 0xff;
  345. p[1] = (v >> 8) & 0xff;
  346. p[2] = (v >> 16) & 0xff;
  347. p[3] = (v >> 24) & 0xff;
  348. }
  349. /* Extract michal mic block of data */
  350. #define dp_rx_michael_block(l, r) \
  351. do { \
  352. r ^= dp_rx_rotl(l, 17); \
  353. l += r; \
  354. r ^= dp_rx_xswap(l); \
  355. l += r; \
  356. r ^= dp_rx_rotl(l, 3); \
  357. l += r; \
  358. r ^= dp_rx_rotr(l, 2); \
  359. l += r; \
  360. } while (0)
  361. /**
  362. * struct dp_rx_desc_list_elem_t
  363. *
  364. * @next : Next pointer to form free list
  365. * @rx_desc : DP Rx descriptor
  366. */
  367. union dp_rx_desc_list_elem_t {
  368. union dp_rx_desc_list_elem_t *next;
  369. struct dp_rx_desc rx_desc;
  370. };
  371. #ifdef RX_DESC_MULTI_PAGE_ALLOC
  372. /**
  373. * dp_rx_desc_find() - find dp rx descriptor from page ID and offset
  374. * @page_id: Page ID
  375. * @offset: Offset of the descriptor element
  376. *
  377. * Return: RX descriptor element
  378. */
  379. union dp_rx_desc_list_elem_t *dp_rx_desc_find(uint16_t page_id, uint16_t offset,
  380. struct rx_desc_pool *rx_pool);
  381. static inline
  382. struct dp_rx_desc *dp_get_rx_desc_from_cookie(struct dp_soc *soc,
  383. struct rx_desc_pool *pool,
  384. uint32_t cookie)
  385. {
  386. uint8_t pool_id = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_POOL_ID(cookie);
  387. uint16_t page_id = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_PAGE_ID(cookie);
  388. uint8_t offset = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_OFFSET(cookie);
  389. struct rx_desc_pool *rx_desc_pool;
  390. union dp_rx_desc_list_elem_t *rx_desc_elem;
  391. if (qdf_unlikely(pool_id >= MAX_RXDESC_POOLS))
  392. return NULL;
  393. rx_desc_pool = &pool[pool_id];
  394. rx_desc_elem = (union dp_rx_desc_list_elem_t *)
  395. (rx_desc_pool->desc_pages.cacheable_pages[page_id] +
  396. rx_desc_pool->elem_size * offset);
  397. return &rx_desc_elem->rx_desc;
  398. }
  399. /**
  400. * dp_rx_cookie_2_va_rxdma_buf() - Converts cookie to a virtual address of
  401. * the Rx descriptor on Rx DMA source ring buffer
  402. * @soc: core txrx main context
  403. * @cookie: cookie used to lookup virtual address
  404. *
  405. * Return: Pointer to the Rx descriptor
  406. */
  407. static inline
  408. struct dp_rx_desc *dp_rx_cookie_2_va_rxdma_buf(struct dp_soc *soc,
  409. uint32_t cookie)
  410. {
  411. return dp_get_rx_desc_from_cookie(soc, &soc->rx_desc_buf[0], cookie);
  412. }
  413. /**
  414. * dp_rx_cookie_2_va_mon_buf() - Converts cookie to a virtual address of
  415. * the Rx descriptor on monitor ring buffer
  416. * @soc: core txrx main context
  417. * @cookie: cookie used to lookup virtual address
  418. *
  419. * Return: Pointer to the Rx descriptor
  420. */
  421. static inline
  422. struct dp_rx_desc *dp_rx_cookie_2_va_mon_buf(struct dp_soc *soc,
  423. uint32_t cookie)
  424. {
  425. return dp_get_rx_desc_from_cookie(soc, &soc->rx_desc_mon[0], cookie);
  426. }
  427. /**
  428. * dp_rx_cookie_2_va_mon_status() - Converts cookie to a virtual address of
  429. * the Rx descriptor on monitor status ring buffer
  430. * @soc: core txrx main context
  431. * @cookie: cookie used to lookup virtual address
  432. *
  433. * Return: Pointer to the Rx descriptor
  434. */
  435. static inline
  436. struct dp_rx_desc *dp_rx_cookie_2_va_mon_status(struct dp_soc *soc,
  437. uint32_t cookie)
  438. {
  439. return dp_get_rx_desc_from_cookie(soc, &soc->rx_desc_status[0], cookie);
  440. }
  441. #else
  442. void dp_rx_desc_pool_init(struct dp_soc *soc, uint32_t pool_id,
  443. uint32_t pool_size,
  444. struct rx_desc_pool *rx_desc_pool);
  445. /**
  446. * dp_rx_cookie_2_va_rxdma_buf() - Converts cookie to a virtual address of
  447. * the Rx descriptor on Rx DMA source ring buffer
  448. * @soc: core txrx main context
  449. * @cookie: cookie used to lookup virtual address
  450. *
  451. * Return: void *: Virtual Address of the Rx descriptor
  452. */
  453. static inline
  454. void *dp_rx_cookie_2_va_rxdma_buf(struct dp_soc *soc, uint32_t cookie)
  455. {
  456. uint8_t pool_id = DP_RX_DESC_COOKIE_POOL_ID_GET(cookie);
  457. uint16_t index = DP_RX_DESC_COOKIE_INDEX_GET(cookie);
  458. struct rx_desc_pool *rx_desc_pool;
  459. if (qdf_unlikely(pool_id >= MAX_RXDESC_POOLS))
  460. return NULL;
  461. rx_desc_pool = &soc->rx_desc_buf[pool_id];
  462. if (qdf_unlikely(index >= rx_desc_pool->pool_size))
  463. return NULL;
  464. return &(soc->rx_desc_buf[pool_id].array[index].rx_desc);
  465. }
  466. /**
  467. * dp_rx_cookie_2_va_mon_buf() - Converts cookie to a virtual address of
  468. * the Rx descriptor on monitor ring buffer
  469. * @soc: core txrx main context
  470. * @cookie: cookie used to lookup virtual address
  471. *
  472. * Return: void *: Virtual Address of the Rx descriptor
  473. */
  474. static inline
  475. void *dp_rx_cookie_2_va_mon_buf(struct dp_soc *soc, uint32_t cookie)
  476. {
  477. uint8_t pool_id = DP_RX_DESC_COOKIE_POOL_ID_GET(cookie);
  478. uint16_t index = DP_RX_DESC_COOKIE_INDEX_GET(cookie);
  479. /* TODO */
  480. /* Add sanity for pool_id & index */
  481. return &(soc->rx_desc_mon[pool_id].array[index].rx_desc);
  482. }
  483. /**
  484. * dp_rx_cookie_2_va_mon_status() - Converts cookie to a virtual address of
  485. * the Rx descriptor on monitor status ring buffer
  486. * @soc: core txrx main context
  487. * @cookie: cookie used to lookup virtual address
  488. *
  489. * Return: void *: Virtual Address of the Rx descriptor
  490. */
  491. static inline
  492. void *dp_rx_cookie_2_va_mon_status(struct dp_soc *soc, uint32_t cookie)
  493. {
  494. uint8_t pool_id = DP_RX_DESC_COOKIE_POOL_ID_GET(cookie);
  495. uint16_t index = DP_RX_DESC_COOKIE_INDEX_GET(cookie);
  496. /* TODO */
  497. /* Add sanity for pool_id & index */
  498. return &(soc->rx_desc_status[pool_id].array[index].rx_desc);
  499. }
  500. #endif /* RX_DESC_MULTI_PAGE_ALLOC */
  501. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  502. #ifdef DP_RX_DESC_COOKIE_INVALIDATE
  503. static inline QDF_STATUS
  504. dp_rx_cookie_check_and_invalidate(hal_ring_desc_t ring_desc)
  505. {
  506. if (qdf_unlikely(HAL_RX_REO_BUF_COOKIE_INVALID_GET(ring_desc)))
  507. return QDF_STATUS_E_FAILURE;
  508. HAL_RX_REO_BUF_COOKIE_INVALID_SET(ring_desc);
  509. return QDF_STATUS_SUCCESS;
  510. }
  511. #else
  512. static inline QDF_STATUS
  513. dp_rx_cookie_check_and_invalidate(hal_ring_desc_t ring_desc)
  514. {
  515. return QDF_STATUS_SUCCESS;
  516. }
  517. #endif
  518. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  519. QDF_STATUS dp_rx_desc_pool_is_allocated(struct rx_desc_pool *rx_desc_pool);
  520. QDF_STATUS dp_rx_desc_pool_alloc(struct dp_soc *soc,
  521. uint32_t pool_size,
  522. struct rx_desc_pool *rx_desc_pool);
  523. void dp_rx_desc_pool_init(struct dp_soc *soc, uint32_t pool_id,
  524. uint32_t pool_size,
  525. struct rx_desc_pool *rx_desc_pool);
  526. void dp_rx_pdev_mon_buf_buffers_free(struct dp_pdev *pdev, uint32_t mac_id);
  527. void dp_rx_add_desc_list_to_free_list(struct dp_soc *soc,
  528. union dp_rx_desc_list_elem_t **local_desc_list,
  529. union dp_rx_desc_list_elem_t **tail,
  530. uint16_t pool_id,
  531. struct rx_desc_pool *rx_desc_pool);
  532. uint16_t dp_rx_get_free_desc_list(struct dp_soc *soc, uint32_t pool_id,
  533. struct rx_desc_pool *rx_desc_pool,
  534. uint16_t num_descs,
  535. union dp_rx_desc_list_elem_t **desc_list,
  536. union dp_rx_desc_list_elem_t **tail);
  537. QDF_STATUS dp_rx_pdev_desc_pool_alloc(struct dp_pdev *pdev);
  538. void dp_rx_pdev_desc_pool_free(struct dp_pdev *pdev);
  539. QDF_STATUS dp_rx_pdev_desc_pool_init(struct dp_pdev *pdev);
  540. void dp_rx_pdev_desc_pool_deinit(struct dp_pdev *pdev);
  541. void dp_rx_desc_pool_deinit(struct dp_soc *soc,
  542. struct rx_desc_pool *rx_desc_pool);
  543. QDF_STATUS dp_rx_pdev_attach(struct dp_pdev *pdev);
  544. QDF_STATUS dp_rx_pdev_buffers_alloc(struct dp_pdev *pdev);
  545. void dp_rx_pdev_buffers_free(struct dp_pdev *pdev);
  546. void dp_rx_pdev_detach(struct dp_pdev *pdev);
  547. void dp_print_napi_stats(struct dp_soc *soc);
  548. /**
  549. * dp_rx_vdev_detach() - detach vdev from dp rx
  550. * @vdev: virtual device instance
  551. *
  552. * Return: QDF_STATUS_SUCCESS: success
  553. * QDF_STATUS_E_RESOURCES: Error return
  554. */
  555. QDF_STATUS dp_rx_vdev_detach(struct dp_vdev *vdev);
  556. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  557. uint32_t
  558. dp_rx_process(struct dp_intr *int_ctx, hal_ring_handle_t hal_ring_hdl,
  559. uint8_t reo_ring_num,
  560. uint32_t quota);
  561. /**
  562. * dp_rx_err_process() - Processes error frames routed to REO error ring
  563. * @int_ctx: pointer to DP interrupt context
  564. * @soc: core txrx main context
  565. * @hal_ring: opaque pointer to the HAL Rx Error Ring, which will be serviced
  566. * @quota: No. of units (packets) that can be serviced in one shot.
  567. *
  568. * This function implements error processing and top level demultiplexer
  569. * for all the frames routed to REO error ring.
  570. *
  571. * Return: uint32_t: No. of elements processed
  572. */
  573. uint32_t dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
  574. hal_ring_handle_t hal_ring_hdl, uint32_t quota);
  575. /**
  576. * dp_rx_wbm_err_process() - Processes error frames routed to WBM release ring
  577. * @int_ctx: pointer to DP interrupt context
  578. * @soc: core txrx main context
  579. * @hal_ring: opaque pointer to the HAL Rx Error Ring, which will be serviced
  580. * @quota: No. of units (packets) that can be serviced in one shot.
  581. *
  582. * This function implements error processing and top level demultiplexer
  583. * for all the frames routed to WBM2HOST sw release ring.
  584. *
  585. * Return: uint32_t: No. of elements processed
  586. */
  587. uint32_t
  588. dp_rx_wbm_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
  589. hal_ring_handle_t hal_ring_hdl, uint32_t quota);
  590. /**
  591. * dp_rx_sg_create() - create a frag_list for MSDUs which are spread across
  592. * multiple nbufs.
  593. * @soc: core txrx main context
  594. * @nbuf: pointer to the first msdu of an amsdu.
  595. *
  596. * This function implements the creation of RX frag_list for cases
  597. * where an MSDU is spread across multiple nbufs.
  598. *
  599. * Return: returns the head nbuf which contains complete frag_list.
  600. */
  601. qdf_nbuf_t dp_rx_sg_create(struct dp_soc *soc, qdf_nbuf_t nbuf);
  602. /*
  603. * dp_rx_desc_nbuf_and_pool_free() - free the sw rx desc pool called during
  604. * de-initialization of wifi module.
  605. *
  606. * @soc: core txrx main context
  607. * @pool_id: pool_id which is one of 3 mac_ids
  608. * @rx_desc_pool: rx descriptor pool pointer
  609. *
  610. * Return: None
  611. */
  612. void dp_rx_desc_nbuf_and_pool_free(struct dp_soc *soc, uint32_t pool_id,
  613. struct rx_desc_pool *rx_desc_pool);
  614. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  615. /*
  616. * dp_rx_desc_nbuf_free() - free the sw rx desc nbufs called during
  617. * de-initialization of wifi module.
  618. *
  619. * @soc: core txrx main context
  620. * @pool_id: pool_id which is one of 3 mac_ids
  621. * @rx_desc_pool: rx descriptor pool pointer
  622. *
  623. * Return: None
  624. */
  625. void dp_rx_desc_nbuf_free(struct dp_soc *soc,
  626. struct rx_desc_pool *rx_desc_pool);
  627. #ifdef DP_RX_MON_MEM_FRAG
  628. /*
  629. * dp_rx_desc_frag_free() - free the sw rx desc frag called during
  630. * de-initialization of wifi module.
  631. *
  632. * @soc: core txrx main context
  633. * @rx_desc_pool: rx descriptor pool pointer
  634. *
  635. * Return: None
  636. */
  637. void dp_rx_desc_frag_free(struct dp_soc *soc,
  638. struct rx_desc_pool *rx_desc_pool);
  639. #else
  640. static inline
  641. void dp_rx_desc_frag_free(struct dp_soc *soc,
  642. struct rx_desc_pool *rx_desc_pool)
  643. {
  644. }
  645. #endif
  646. /*
  647. * dp_rx_desc_pool_free() - free the sw rx desc array called during
  648. * de-initialization of wifi module.
  649. *
  650. * @soc: core txrx main context
  651. * @rx_desc_pool: rx descriptor pool pointer
  652. *
  653. * Return: None
  654. */
  655. void dp_rx_desc_pool_free(struct dp_soc *soc,
  656. struct rx_desc_pool *rx_desc_pool);
  657. void dp_rx_deliver_raw(struct dp_vdev *vdev, qdf_nbuf_t nbuf_list,
  658. struct dp_peer *peer);
  659. #ifdef RX_DESC_DEBUG_CHECK
  660. /**
  661. * dp_rx_desc_paddr_sanity_check() - paddr sanity for ring desc vs rx_desc
  662. * @rx_desc: rx descriptor
  663. * @ring_paddr: paddr obatined from the ring
  664. *
  665. * Returns: QDF_STATUS
  666. */
  667. static inline
  668. bool dp_rx_desc_paddr_sanity_check(struct dp_rx_desc *rx_desc,
  669. uint64_t ring_paddr)
  670. {
  671. return (ring_paddr == qdf_nbuf_get_frag_paddr(rx_desc->nbuf, 0));
  672. }
  673. /*
  674. * dp_rx_desc_alloc_dbg_info() - Alloc memory for rx descriptor debug
  675. * structure
  676. * @rx_desc: rx descriptor pointer
  677. *
  678. * Return: None
  679. */
  680. static inline
  681. void dp_rx_desc_alloc_dbg_info(struct dp_rx_desc *rx_desc)
  682. {
  683. rx_desc->dbg_info = qdf_mem_malloc(sizeof(struct dp_rx_desc_dbg_info));
  684. }
  685. /*
  686. * dp_rx_desc_free_dbg_info() - Free rx descriptor debug
  687. * structure memory
  688. * @rx_desc: rx descriptor pointer
  689. *
  690. * Return: None
  691. */
  692. static inline
  693. void dp_rx_desc_free_dbg_info(struct dp_rx_desc *rx_desc)
  694. {
  695. qdf_mem_free(rx_desc->dbg_info);
  696. }
  697. /*
  698. * dp_rx_desc_update_dbg_info() - Update rx descriptor debug info
  699. * structure memory
  700. * @rx_desc: rx descriptor pointer
  701. *
  702. * Return: None
  703. */
  704. static
  705. void dp_rx_desc_update_dbg_info(struct dp_rx_desc *rx_desc,
  706. const char *func_name, uint8_t flag)
  707. {
  708. struct dp_rx_desc_dbg_info *info = rx_desc->dbg_info;
  709. if (!info)
  710. return;
  711. if (flag == RX_DESC_REPLENISHED) {
  712. qdf_str_lcopy(info->replenish_caller, func_name,
  713. QDF_MEM_FUNC_NAME_SIZE);
  714. info->replenish_ts = qdf_get_log_timestamp();
  715. } else {
  716. qdf_str_lcopy(info->freelist_caller, func_name,
  717. QDF_MEM_FUNC_NAME_SIZE);
  718. info->freelist_ts = qdf_get_log_timestamp();
  719. }
  720. }
  721. #else
  722. static inline
  723. bool dp_rx_desc_paddr_sanity_check(struct dp_rx_desc *rx_desc,
  724. uint64_t ring_paddr)
  725. {
  726. return true;
  727. }
  728. static inline
  729. void dp_rx_desc_alloc_dbg_info(struct dp_rx_desc *rx_desc)
  730. {
  731. }
  732. static inline
  733. void dp_rx_desc_free_dbg_info(struct dp_rx_desc *rx_desc)
  734. {
  735. }
  736. static inline
  737. void dp_rx_desc_update_dbg_info(struct dp_rx_desc *rx_desc,
  738. const char *func_name, uint8_t flag)
  739. {
  740. }
  741. #endif /* RX_DESC_DEBUG_CHECK */
  742. /**
  743. * dp_rx_add_to_free_desc_list() - Adds to a local free descriptor list
  744. *
  745. * @head: pointer to the head of local free list
  746. * @tail: pointer to the tail of local free list
  747. * @new: new descriptor that is added to the free list
  748. * @func_name: caller func name
  749. *
  750. * Return: void:
  751. */
  752. static inline
  753. void __dp_rx_add_to_free_desc_list(union dp_rx_desc_list_elem_t **head,
  754. union dp_rx_desc_list_elem_t **tail,
  755. struct dp_rx_desc *new, const char *func_name)
  756. {
  757. qdf_assert(head && new);
  758. new->nbuf = NULL;
  759. new->in_use = 0;
  760. ((union dp_rx_desc_list_elem_t *)new)->next = *head;
  761. *head = (union dp_rx_desc_list_elem_t *)new;
  762. /* reset tail if head->next is NULL */
  763. if (!*tail || !(*head)->next)
  764. *tail = *head;
  765. dp_rx_desc_update_dbg_info(new, func_name, RX_DESC_IN_FREELIST);
  766. }
  767. uint8_t dp_rx_process_invalid_peer(struct dp_soc *soc, qdf_nbuf_t nbuf,
  768. uint8_t mac_id);
  769. void dp_rx_process_invalid_peer_wrapper(struct dp_soc *soc,
  770. qdf_nbuf_t mpdu, bool mpdu_done, uint8_t mac_id);
  771. void dp_rx_process_mic_error(struct dp_soc *soc, qdf_nbuf_t nbuf,
  772. uint8_t *rx_tlv_hdr, struct dp_peer *peer);
  773. void dp_2k_jump_handle(struct dp_soc *soc, qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr,
  774. uint16_t peer_id, uint8_t tid);
  775. #define DP_RX_HEAD_APPEND(head, elem) \
  776. do { \
  777. qdf_nbuf_set_next((elem), (head)); \
  778. (head) = (elem); \
  779. } while (0)
  780. #define DP_RX_LIST_APPEND(head, tail, elem) \
  781. do { \
  782. if (!(head)) { \
  783. (head) = (elem); \
  784. QDF_NBUF_CB_RX_NUM_ELEMENTS_IN_LIST(head) = 1;\
  785. } else { \
  786. qdf_nbuf_set_next((tail), (elem)); \
  787. QDF_NBUF_CB_RX_NUM_ELEMENTS_IN_LIST(head)++; \
  788. } \
  789. (tail) = (elem); \
  790. qdf_nbuf_set_next((tail), NULL); \
  791. } while (0)
  792. #define DP_RX_MERGE_TWO_LIST(phead, ptail, chead, ctail) \
  793. do { \
  794. if (!(phead)) { \
  795. (phead) = (chead); \
  796. } else { \
  797. qdf_nbuf_set_next((ptail), (chead)); \
  798. QDF_NBUF_CB_RX_NUM_ELEMENTS_IN_LIST(phead) += \
  799. QDF_NBUF_CB_RX_NUM_ELEMENTS_IN_LIST(chead); \
  800. } \
  801. (ptail) = (ctail); \
  802. qdf_nbuf_set_next((ptail), NULL); \
  803. } while (0)
  804. /*for qcn9000 emulation the pcie is complete phy and no address restrictions*/
  805. #if !defined(BUILD_X86) || defined(QCA_WIFI_QCN9000)
  806. static inline int check_x86_paddr(struct dp_soc *dp_soc, qdf_nbuf_t *rx_netbuf,
  807. qdf_dma_addr_t *paddr, struct rx_desc_pool *rx_desc_pool)
  808. {
  809. return QDF_STATUS_SUCCESS;
  810. }
  811. #else
  812. #define MAX_RETRY 100
  813. static inline int check_x86_paddr(struct dp_soc *dp_soc, qdf_nbuf_t *rx_netbuf,
  814. qdf_dma_addr_t *paddr, struct rx_desc_pool *rx_desc_pool)
  815. {
  816. uint32_t nbuf_retry = 0;
  817. int32_t ret;
  818. const uint32_t x86_phy_addr = 0x50000000;
  819. /*
  820. * in M2M emulation platforms (x86) the memory below 0x50000000
  821. * is reserved for target use, so any memory allocated in this
  822. * region should not be used by host
  823. */
  824. do {
  825. if (qdf_likely(*paddr > x86_phy_addr))
  826. return QDF_STATUS_SUCCESS;
  827. else {
  828. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
  829. "phy addr %pK exceeded 0x50000000 trying again",
  830. paddr);
  831. nbuf_retry++;
  832. if ((*rx_netbuf)) {
  833. qdf_nbuf_unmap_single(dp_soc->osdev, *rx_netbuf,
  834. QDF_DMA_FROM_DEVICE);
  835. /* Not freeing buffer intentionally.
  836. * Observed that same buffer is getting
  837. * re-allocated resulting in longer load time
  838. * WMI init timeout.
  839. * This buffer is anyway not useful so skip it.
  840. **/
  841. }
  842. *rx_netbuf = qdf_nbuf_alloc(dp_soc->osdev,
  843. rx_desc_pool->buf_size,
  844. RX_BUFFER_RESERVATION,
  845. rx_desc_pool->buf_alignment,
  846. FALSE);
  847. if (qdf_unlikely(!(*rx_netbuf)))
  848. return QDF_STATUS_E_FAILURE;
  849. ret = qdf_nbuf_map_single(dp_soc->osdev, *rx_netbuf,
  850. QDF_DMA_FROM_DEVICE);
  851. if (qdf_unlikely(ret == QDF_STATUS_E_FAILURE)) {
  852. qdf_nbuf_free(*rx_netbuf);
  853. *rx_netbuf = NULL;
  854. continue;
  855. }
  856. *paddr = qdf_nbuf_get_frag_paddr(*rx_netbuf, 0);
  857. }
  858. } while (nbuf_retry < MAX_RETRY);
  859. if ((*rx_netbuf)) {
  860. qdf_nbuf_unmap_single(dp_soc->osdev, *rx_netbuf,
  861. QDF_DMA_FROM_DEVICE);
  862. qdf_nbuf_free(*rx_netbuf);
  863. }
  864. return QDF_STATUS_E_FAILURE;
  865. }
  866. #endif
  867. /**
  868. * dp_rx_cookie_2_link_desc_va() - Converts cookie to a virtual address of
  869. * the MSDU Link Descriptor
  870. * @soc: core txrx main context
  871. * @buf_info: buf_info includes cookie that is used to lookup
  872. * virtual address of link descriptor after deriving the page id
  873. * and the offset or index of the desc on the associatde page.
  874. *
  875. * This is the VA of the link descriptor, that HAL layer later uses to
  876. * retrieve the list of MSDU's for a given MPDU.
  877. *
  878. * Return: void *: Virtual Address of the Rx descriptor
  879. */
  880. static inline
  881. void *dp_rx_cookie_2_link_desc_va(struct dp_soc *soc,
  882. struct hal_buf_info *buf_info)
  883. {
  884. void *link_desc_va;
  885. struct qdf_mem_multi_page_t *pages;
  886. uint16_t page_id = LINK_DESC_COOKIE_PAGE_ID(buf_info->sw_cookie);
  887. pages = &soc->link_desc_pages;
  888. if (!pages)
  889. return NULL;
  890. if (qdf_unlikely(page_id >= pages->num_pages))
  891. return NULL;
  892. link_desc_va = pages->dma_pages[page_id].page_v_addr_start +
  893. (buf_info->paddr - pages->dma_pages[page_id].page_p_addr);
  894. return link_desc_va;
  895. }
  896. /**
  897. * dp_rx_cookie_2_mon_link_desc_va() - Converts cookie to a virtual address of
  898. * the MSDU Link Descriptor
  899. * @pdev: core txrx pdev context
  900. * @buf_info: buf_info includes cookie that used to lookup virtual address of
  901. * link descriptor. Normally this is just an index into a per pdev array.
  902. *
  903. * This is the VA of the link descriptor in monitor mode destination ring,
  904. * that HAL layer later uses to retrieve the list of MSDU's for a given MPDU.
  905. *
  906. * Return: void *: Virtual Address of the Rx descriptor
  907. */
  908. static inline
  909. void *dp_rx_cookie_2_mon_link_desc_va(struct dp_pdev *pdev,
  910. struct hal_buf_info *buf_info,
  911. int mac_id)
  912. {
  913. void *link_desc_va;
  914. struct qdf_mem_multi_page_t *pages;
  915. uint16_t page_id = LINK_DESC_COOKIE_PAGE_ID(buf_info->sw_cookie);
  916. pages = &pdev->soc->mon_link_desc_pages[mac_id];
  917. if (!pages)
  918. return NULL;
  919. if (qdf_unlikely(page_id >= pages->num_pages))
  920. return NULL;
  921. link_desc_va = pages->dma_pages[page_id].page_v_addr_start +
  922. (buf_info->paddr - pages->dma_pages[page_id].page_p_addr);
  923. return link_desc_va;
  924. }
  925. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  926. /**
  927. * dp_rx_defrag_concat() - Concatenate the fragments
  928. *
  929. * @dst: destination pointer to the buffer
  930. * @src: source pointer from where the fragment payload is to be copied
  931. *
  932. * Return: QDF_STATUS
  933. */
  934. static inline QDF_STATUS dp_rx_defrag_concat(qdf_nbuf_t dst, qdf_nbuf_t src)
  935. {
  936. /*
  937. * Inside qdf_nbuf_cat, if it is necessary to reallocate dst
  938. * to provide space for src, the headroom portion is copied from
  939. * the original dst buffer to the larger new dst buffer.
  940. * (This is needed, because the headroom of the dst buffer
  941. * contains the rx desc.)
  942. */
  943. if (!qdf_nbuf_cat(dst, src)) {
  944. /*
  945. * qdf_nbuf_cat does not free the src memory.
  946. * Free src nbuf before returning
  947. * For failure case the caller takes of freeing the nbuf
  948. */
  949. qdf_nbuf_free(src);
  950. return QDF_STATUS_SUCCESS;
  951. }
  952. return QDF_STATUS_E_DEFRAG_ERROR;
  953. }
  954. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  955. #ifndef FEATURE_WDS
  956. static inline QDF_STATUS dp_rx_ast_set_active(struct dp_soc *soc, uint16_t sa_idx, bool is_active)
  957. {
  958. return QDF_STATUS_SUCCESS;
  959. }
  960. static inline void
  961. dp_rx_wds_srcport_learn(struct dp_soc *soc,
  962. uint8_t *rx_tlv_hdr,
  963. struct dp_peer *ta_peer,
  964. qdf_nbuf_t nbuf,
  965. struct hal_rx_msdu_metadata msdu_metadata)
  966. {
  967. }
  968. #endif
  969. /*
  970. * dp_rx_desc_dump() - dump the sw rx descriptor
  971. *
  972. * @rx_desc: sw rx descriptor
  973. */
  974. static inline void dp_rx_desc_dump(struct dp_rx_desc *rx_desc)
  975. {
  976. dp_info("rx_desc->nbuf: %pK, rx_desc->cookie: %d, rx_desc->pool_id: %d, rx_desc->in_use: %d, rx_desc->unmapped: %d",
  977. rx_desc->nbuf, rx_desc->cookie, rx_desc->pool_id,
  978. rx_desc->in_use, rx_desc->unmapped);
  979. }
  980. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  981. /*
  982. * check_qwrap_multicast_loopback() - Check if rx packet is a loopback packet.
  983. * In qwrap mode, packets originated from
  984. * any vdev should not loopback and
  985. * should be dropped.
  986. * @vdev: vdev on which rx packet is received
  987. * @nbuf: rx pkt
  988. *
  989. */
  990. #if ATH_SUPPORT_WRAP
  991. static inline bool check_qwrap_multicast_loopback(struct dp_vdev *vdev,
  992. qdf_nbuf_t nbuf)
  993. {
  994. struct dp_vdev *psta_vdev;
  995. struct dp_pdev *pdev = vdev->pdev;
  996. uint8_t *data = qdf_nbuf_data(nbuf);
  997. if (qdf_unlikely(vdev->proxysta_vdev)) {
  998. /* In qwrap isolation mode, allow loopback packets as all
  999. * packets go to RootAP and Loopback on the mpsta.
  1000. */
  1001. if (vdev->isolation_vdev)
  1002. return false;
  1003. TAILQ_FOREACH(psta_vdev, &pdev->vdev_list, vdev_list_elem) {
  1004. if (qdf_unlikely(psta_vdev->proxysta_vdev &&
  1005. !qdf_mem_cmp(psta_vdev->mac_addr.raw,
  1006. &data[QDF_MAC_ADDR_SIZE],
  1007. QDF_MAC_ADDR_SIZE))) {
  1008. /* Drop packet if source address is equal to
  1009. * any of the vdev addresses.
  1010. */
  1011. return true;
  1012. }
  1013. }
  1014. }
  1015. return false;
  1016. }
  1017. #else
  1018. static inline bool check_qwrap_multicast_loopback(struct dp_vdev *vdev,
  1019. qdf_nbuf_t nbuf)
  1020. {
  1021. return false;
  1022. }
  1023. #endif
  1024. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  1025. #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\
  1026. defined(WLAN_SUPPORT_RX_TAG_STATISTICS) ||\
  1027. defined(WLAN_SUPPORT_RX_FLOW_TAG)
  1028. #include "dp_rx_tag.h"
  1029. #endif
  1030. #ifndef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
  1031. /**
  1032. * dp_rx_update_protocol_tag() - Reads CCE metadata from the RX MSDU end TLV
  1033. * and set the corresponding tag in QDF packet
  1034. * @soc: core txrx main context
  1035. * @vdev: vdev on which the packet is received
  1036. * @nbuf: QDF pkt buffer on which the protocol tag should be set
  1037. * @rx_tlv_hdr: rBbase address where the RX TLVs starts
  1038. * @ring_index: REO ring number, not used for error & monitor ring
  1039. * @is_reo_exception: flag to indicate if rx from REO ring or exception ring
  1040. * @is_update_stats: flag to indicate whether to update stats or not
  1041. * Return: void
  1042. */
  1043. static inline void
  1044. dp_rx_update_protocol_tag(struct dp_soc *soc, struct dp_vdev *vdev,
  1045. qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr,
  1046. uint16_t ring_index,
  1047. bool is_reo_exception, bool is_update_stats)
  1048. {
  1049. }
  1050. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
  1051. #ifndef WLAN_SUPPORT_RX_FLOW_TAG
  1052. /**
  1053. * dp_rx_update_flow_tag() - Reads FSE metadata from the RX MSDU end TLV
  1054. * and set the corresponding tag in QDF packet
  1055. * @soc: core txrx main context
  1056. * @vdev: vdev on which the packet is received
  1057. * @nbuf: QDF pkt buffer on which the protocol tag should be set
  1058. * @rx_tlv_hdr: base address where the RX TLVs starts
  1059. * @is_update_stats: flag to indicate whether to update stats or not
  1060. *
  1061. * Return: void
  1062. */
  1063. static inline void
  1064. dp_rx_update_flow_tag(struct dp_soc *soc, struct dp_vdev *vdev,
  1065. qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr, bool update_stats)
  1066. {
  1067. }
  1068. #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
  1069. #if !defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) &&\
  1070. !defined(WLAN_SUPPORT_RX_FLOW_TAG)
  1071. /**
  1072. * dp_rx_mon_update_protocol_flow_tag() - Performs necessary checks for monitor
  1073. * mode and then tags appropriate packets
  1074. * @soc: core txrx main context
  1075. * @vdev: pdev on which packet is received
  1076. * @msdu: QDF packet buffer on which the protocol tag should be set
  1077. * @rx_desc: base address where the RX TLVs start
  1078. * Return: void
  1079. */
  1080. static inline
  1081. void dp_rx_mon_update_protocol_flow_tag(struct dp_soc *soc,
  1082. struct dp_pdev *dp_pdev,
  1083. qdf_nbuf_t msdu, void *rx_desc)
  1084. {
  1085. }
  1086. #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG || WLAN_SUPPORT_RX_FLOW_TAG */
  1087. /*
  1088. * dp_rx_buffers_replenish() - replenish rxdma ring with rx nbufs
  1089. * called during dp rx initialization
  1090. * and at the end of dp_rx_process.
  1091. *
  1092. * @soc: core txrx main context
  1093. * @mac_id: mac_id which is one of 3 mac_ids
  1094. * @dp_rxdma_srng: dp rxdma circular ring
  1095. * @rx_desc_pool: Pointer to free Rx descriptor pool
  1096. * @num_req_buffers: number of buffer to be replenished
  1097. * @desc_list: list of descs if called from dp_rx_process
  1098. * or NULL during dp rx initialization or out of buffer
  1099. * interrupt.
  1100. * @tail: tail of descs list
  1101. * @func_name: name of the caller function
  1102. * Return: return success or failure
  1103. */
  1104. QDF_STATUS __dp_rx_buffers_replenish(struct dp_soc *dp_soc, uint32_t mac_id,
  1105. struct dp_srng *dp_rxdma_srng,
  1106. struct rx_desc_pool *rx_desc_pool,
  1107. uint32_t num_req_buffers,
  1108. union dp_rx_desc_list_elem_t **desc_list,
  1109. union dp_rx_desc_list_elem_t **tail,
  1110. const char *func_name);
  1111. /*
  1112. * dp_pdev_rx_buffers_attach() - replenish rxdma ring with rx nbufs
  1113. * called during dp rx initialization
  1114. *
  1115. * @soc: core txrx main context
  1116. * @mac_id: mac_id which is one of 3 mac_ids
  1117. * @dp_rxdma_srng: dp rxdma circular ring
  1118. * @rx_desc_pool: Pointer to free Rx descriptor pool
  1119. * @num_req_buffers: number of buffer to be replenished
  1120. *
  1121. * Return: return success or failure
  1122. */
  1123. QDF_STATUS
  1124. dp_pdev_rx_buffers_attach(struct dp_soc *dp_soc, uint32_t mac_id,
  1125. struct dp_srng *dp_rxdma_srng,
  1126. struct rx_desc_pool *rx_desc_pool,
  1127. uint32_t num_req_buffers);
  1128. /**
  1129. * dp_rx_link_desc_return() - Return a MPDU link descriptor to HW
  1130. * (WBM), following error handling
  1131. *
  1132. * @soc: core DP main context
  1133. * @buf_addr_info: opaque pointer to the REO error ring descriptor
  1134. * @buf_addr_info: void pointer to the buffer_addr_info
  1135. * @bm_action: put to idle_list or release to msdu_list
  1136. *
  1137. * Return: QDF_STATUS_E_FAILURE for failure else QDF_STATUS_SUCCESS
  1138. */
  1139. QDF_STATUS
  1140. dp_rx_link_desc_return(struct dp_soc *soc, hal_ring_desc_t ring_desc,
  1141. uint8_t bm_action);
  1142. /**
  1143. * dp_rx_link_desc_return_by_addr - Return a MPDU link descriptor to
  1144. * (WBM) by address
  1145. *
  1146. * @soc: core DP main context
  1147. * @link_desc_addr: link descriptor addr
  1148. *
  1149. * Return: QDF_STATUS_E_FAILURE for failure else QDF_STATUS_SUCCESS
  1150. */
  1151. QDF_STATUS
  1152. dp_rx_link_desc_return_by_addr(struct dp_soc *soc,
  1153. hal_buff_addrinfo_t link_desc_addr,
  1154. uint8_t bm_action);
  1155. /**
  1156. * dp_rxdma_err_process() - RxDMA error processing functionality
  1157. * @soc: core txrx main contex
  1158. * @mac_id: mac id which is one of 3 mac_ids
  1159. * @hal_ring: opaque pointer to the HAL Rx Ring, which will be serviced
  1160. * @quota: No. of units (packets) that can be serviced in one shot.
  1161. *
  1162. * Return: num of buffers processed
  1163. */
  1164. uint32_t
  1165. dp_rxdma_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
  1166. uint32_t mac_id, uint32_t quota);
  1167. void dp_rx_fill_mesh_stats(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  1168. uint8_t *rx_tlv_hdr, struct dp_peer *peer);
  1169. QDF_STATUS dp_rx_filter_mesh_packets(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
  1170. uint8_t *rx_tlv_hdr);
  1171. int dp_wds_rx_policy_check(uint8_t *rx_tlv_hdr, struct dp_vdev *vdev,
  1172. struct dp_peer *peer);
  1173. /*
  1174. * dp_rx_dump_info_and_assert() - dump RX Ring info and Rx Desc info
  1175. *
  1176. * @soc: core txrx main context
  1177. * @hal_ring: opaque pointer to the HAL Rx Ring, which will be serviced
  1178. * @ring_desc: opaque pointer to the RX ring descriptor
  1179. * @rx_desc: host rx descriptor
  1180. *
  1181. * Return: void
  1182. */
  1183. void dp_rx_dump_info_and_assert(struct dp_soc *soc,
  1184. hal_ring_handle_t hal_ring_hdl,
  1185. hal_ring_desc_t ring_desc,
  1186. struct dp_rx_desc *rx_desc);
  1187. void dp_rx_compute_delay(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
  1188. #ifdef QCA_PEER_EXT_STATS
  1189. void dp_rx_compute_tid_delay(struct cdp_delay_tid_stats *stats,
  1190. qdf_nbuf_t nbuf);
  1191. #endif /* QCA_PEER_EXT_STATS */
  1192. #ifdef RX_DESC_DEBUG_CHECK
  1193. /**
  1194. * dp_rx_desc_check_magic() - check the magic value in dp_rx_desc
  1195. * @rx_desc: rx descriptor pointer
  1196. *
  1197. * Return: true, if magic is correct, else false.
  1198. */
  1199. static inline bool dp_rx_desc_check_magic(struct dp_rx_desc *rx_desc)
  1200. {
  1201. if (qdf_unlikely(rx_desc->magic != DP_RX_DESC_MAGIC))
  1202. return false;
  1203. rx_desc->magic = 0;
  1204. return true;
  1205. }
  1206. /**
  1207. * dp_rx_desc_prep() - prepare rx desc
  1208. * @rx_desc: rx descriptor pointer to be prepared
  1209. * @nbuf_frag_info_t: struct dp_rx_nbuf_frag_info *
  1210. *
  1211. * Note: assumption is that we are associating a nbuf which is mapped
  1212. *
  1213. * Return: none
  1214. */
  1215. static inline
  1216. void dp_rx_desc_prep(struct dp_rx_desc *rx_desc,
  1217. struct dp_rx_nbuf_frag_info *nbuf_frag_info_t)
  1218. {
  1219. rx_desc->magic = DP_RX_DESC_MAGIC;
  1220. rx_desc->nbuf = (nbuf_frag_info_t->virt_addr).nbuf;
  1221. rx_desc->unmapped = 0;
  1222. }
  1223. /**
  1224. * dp_rx_desc_frag_prep() - prepare rx desc
  1225. * @rx_desc: rx descriptor pointer to be prepared
  1226. * @nbuf_frag_info_t: struct dp_rx_nbuf_frag_info *
  1227. *
  1228. * Note: assumption is that we frag address is mapped
  1229. *
  1230. * Return: none
  1231. */
  1232. #ifdef DP_RX_MON_MEM_FRAG
  1233. static inline
  1234. void dp_rx_desc_frag_prep(struct dp_rx_desc *rx_desc,
  1235. struct dp_rx_nbuf_frag_info *nbuf_frag_info_t)
  1236. {
  1237. rx_desc->magic = DP_RX_DESC_MAGIC;
  1238. rx_desc->rx_buf_start =
  1239. (uint8_t *)((nbuf_frag_info_t->virt_addr).vaddr);
  1240. rx_desc->paddr_buf_start = nbuf_frag_info_t->paddr;
  1241. rx_desc->unmapped = 0;
  1242. }
  1243. #else
  1244. static inline
  1245. void dp_rx_desc_frag_prep(struct dp_rx_desc *rx_desc,
  1246. struct dp_rx_nbuf_frag_info *nbuf_frag_info_t)
  1247. {
  1248. }
  1249. #endif /* DP_RX_MON_MEM_FRAG */
  1250. #else
  1251. static inline bool dp_rx_desc_check_magic(struct dp_rx_desc *rx_desc)
  1252. {
  1253. return true;
  1254. }
  1255. static inline
  1256. void dp_rx_desc_prep(struct dp_rx_desc *rx_desc,
  1257. struct dp_rx_nbuf_frag_info *nbuf_frag_info_t)
  1258. {
  1259. rx_desc->nbuf = (nbuf_frag_info_t->virt_addr).nbuf;
  1260. rx_desc->unmapped = 0;
  1261. }
  1262. #ifdef DP_RX_MON_MEM_FRAG
  1263. static inline
  1264. void dp_rx_desc_frag_prep(struct dp_rx_desc *rx_desc,
  1265. struct dp_rx_nbuf_frag_info *nbuf_frag_info_t)
  1266. {
  1267. rx_desc->rx_buf_start =
  1268. (uint8_t *)((nbuf_frag_info_t->virt_addr).vaddr);
  1269. rx_desc->paddr_buf_start = nbuf_frag_info_t->paddr;
  1270. rx_desc->unmapped = 0;
  1271. }
  1272. #else
  1273. static inline
  1274. void dp_rx_desc_frag_prep(struct dp_rx_desc *rx_desc,
  1275. struct dp_rx_nbuf_frag_info *nbuf_frag_info_t)
  1276. {
  1277. }
  1278. #endif /* DP_RX_MON_MEM_FRAG */
  1279. #endif /* RX_DESC_DEBUG_CHECK */
  1280. void dp_rx_enable_mon_dest_frag(struct rx_desc_pool *rx_desc_pool,
  1281. bool is_mon_dest_desc);
  1282. void dp_rx_process_rxdma_err(struct dp_soc *soc, qdf_nbuf_t nbuf,
  1283. uint8_t *rx_tlv_hdr, struct dp_peer *peer,
  1284. uint8_t err_code, uint8_t mac_id);
  1285. #ifndef QCA_MULTIPASS_SUPPORT
  1286. static inline
  1287. bool dp_rx_multipass_process(struct dp_peer *peer, qdf_nbuf_t nbuf, uint8_t tid)
  1288. {
  1289. return false;
  1290. }
  1291. #else
  1292. bool dp_rx_multipass_process(struct dp_peer *peer, qdf_nbuf_t nbuf,
  1293. uint8_t tid);
  1294. #endif
  1295. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  1296. #ifndef WLAN_RX_PKT_CAPTURE_ENH
  1297. static inline
  1298. QDF_STATUS dp_peer_set_rx_capture_enabled(struct dp_pdev *pdev,
  1299. struct dp_peer *peer_handle,
  1300. bool value, uint8_t *mac_addr)
  1301. {
  1302. return QDF_STATUS_SUCCESS;
  1303. }
  1304. #endif
  1305. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  1306. /**
  1307. * dp_rx_deliver_to_stack() - deliver pkts to network stack
  1308. * Caller to hold peer refcount and check for valid peer
  1309. * @soc: soc
  1310. * @vdev: vdev
  1311. * @peer: peer
  1312. * @nbuf_head: skb list head
  1313. * @nbuf_tail: skb list tail
  1314. *
  1315. * Return: None
  1316. */
  1317. void dp_rx_deliver_to_stack(struct dp_soc *soc,
  1318. struct dp_vdev *vdev,
  1319. struct dp_peer *peer,
  1320. qdf_nbuf_t nbuf_head,
  1321. qdf_nbuf_t nbuf_tail);
  1322. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  1323. #ifdef QCA_OL_RX_LOCK_LESS_ACCESS
  1324. /*
  1325. * dp_rx_ring_access_start()- Wrapper function to log access start of a hal ring
  1326. * @int_ctx: pointer to DP interrupt context
  1327. * @dp_soc - DP soc structure pointer
  1328. * @hal_ring_hdl - HAL ring handle
  1329. *
  1330. * Return: 0 on success; error on failure
  1331. */
  1332. static inline int
  1333. dp_rx_srng_access_start(struct dp_intr *int_ctx, struct dp_soc *soc,
  1334. hal_ring_handle_t hal_ring_hdl)
  1335. {
  1336. return hal_srng_access_start_unlocked(soc->hal_soc, hal_ring_hdl);
  1337. }
  1338. /*
  1339. * dp_rx_ring_access_end()- Wrapper function to log access end of a hal ring
  1340. * @int_ctx: pointer to DP interrupt context
  1341. * @dp_soc - DP soc structure pointer
  1342. * @hal_ring_hdl - HAL ring handle
  1343. *
  1344. * Return - None
  1345. */
  1346. static inline void
  1347. dp_rx_srng_access_end(struct dp_intr *int_ctx, struct dp_soc *soc,
  1348. hal_ring_handle_t hal_ring_hdl)
  1349. {
  1350. hal_srng_access_end_unlocked(soc->hal_soc, hal_ring_hdl);
  1351. }
  1352. #else
  1353. static inline int
  1354. dp_rx_srng_access_start(struct dp_intr *int_ctx, struct dp_soc *soc,
  1355. hal_ring_handle_t hal_ring_hdl)
  1356. {
  1357. return dp_srng_access_start(int_ctx, soc, hal_ring_hdl);
  1358. }
  1359. static inline void
  1360. dp_rx_srng_access_end(struct dp_intr *int_ctx, struct dp_soc *soc,
  1361. hal_ring_handle_t hal_ring_hdl)
  1362. {
  1363. dp_srng_access_end(int_ctx, soc, hal_ring_hdl);
  1364. }
  1365. #endif
  1366. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  1367. /*
  1368. * dp_rx_wbm_sg_list_reset() - Initialize sg list
  1369. *
  1370. * This api should be called at soc init and afterevery sg processing.
  1371. *@soc: DP SOC handle
  1372. */
  1373. static inline void dp_rx_wbm_sg_list_reset(struct dp_soc *soc)
  1374. {
  1375. if (soc) {
  1376. soc->wbm_sg_param.wbm_is_first_msdu_in_sg = false;
  1377. soc->wbm_sg_param.wbm_sg_nbuf_head = NULL;
  1378. soc->wbm_sg_param.wbm_sg_nbuf_tail = NULL;
  1379. soc->wbm_sg_param.wbm_sg_desc_msdu_len = 0;
  1380. }
  1381. }
  1382. /*
  1383. * dp_rx_wbm_sg_list_deinit() - De-initialize sg list
  1384. *
  1385. * This api should be called in down path, to avoid any leak.
  1386. *@soc: DP SOC handle
  1387. */
  1388. static inline void dp_rx_wbm_sg_list_deinit(struct dp_soc *soc)
  1389. {
  1390. if (soc) {
  1391. if (soc->wbm_sg_param.wbm_sg_nbuf_head)
  1392. qdf_nbuf_list_free(soc->wbm_sg_param.wbm_sg_nbuf_head);
  1393. dp_rx_wbm_sg_list_reset(soc);
  1394. }
  1395. }
  1396. #ifndef QCA_HOST_MODE_WIFI_DISABLED
  1397. #ifdef WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL
  1398. #define DP_RX_PROCESS_NBUF(soc, head, tail, ebuf_head, ebuf_tail, rx_desc) \
  1399. do { \
  1400. if (!soc->rx_buff_pool[rx_desc->pool_id].is_initialized) { \
  1401. DP_RX_LIST_APPEND(head, tail, rx_desc->nbuf); \
  1402. break; \
  1403. } \
  1404. DP_RX_LIST_APPEND(ebuf_head, ebuf_tail, rx_desc->nbuf); \
  1405. if (!qdf_nbuf_is_rx_chfrag_cont(rx_desc->nbuf)) { \
  1406. if (!dp_rx_buffer_pool_refill(soc, ebuf_head, \
  1407. rx_desc->pool_id)) \
  1408. DP_RX_MERGE_TWO_LIST(head, tail, \
  1409. ebuf_head, ebuf_tail);\
  1410. ebuf_head = NULL; \
  1411. ebuf_tail = NULL; \
  1412. } \
  1413. } while (0)
  1414. #else
  1415. #define DP_RX_PROCESS_NBUF(soc, head, tail, ebuf_head, ebuf_tail, rx_desc) \
  1416. DP_RX_LIST_APPEND(head, tail, rx_desc->nbuf)
  1417. #endif /* WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL */
  1418. #endif /* QCA_HOST_MODE_WIFI_DISABLED */
  1419. /*
  1420. * dp_rx_link_desc_refill_duplicate_check() - check if link desc duplicate
  1421. to refill
  1422. * @soc: DP SOC handle
  1423. * @buf_info: the last link desc buf info
  1424. * @ring_buf_info: current buf address pointor including link desc
  1425. *
  1426. * return: none.
  1427. */
  1428. void dp_rx_link_desc_refill_duplicate_check(
  1429. struct dp_soc *soc,
  1430. struct hal_buf_info *buf_info,
  1431. hal_buff_addrinfo_t ring_buf_info);
  1432. #endif /* _DP_RX_H */