dp_rx.h 45 KB

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