hal_rx_flow.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. /*
  2. * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #include "qdf_module.h"
  17. #include "dp_types.h"
  18. #include "hal_rx_flow.h"
  19. #if defined(WLAN_SUPPORT_RX_FISA)
  20. void hal_rx_dump_fse_table(struct hal_rx_fst *fst)
  21. {
  22. int i = 0;
  23. struct rx_flow_search_entry *fse =
  24. (struct rx_flow_search_entry *)fst->base_vaddr;
  25. dp_info("Number flow table entries %d", fst->add_flow_count);
  26. for (i = 0; i < fst->max_entries; i++) {
  27. if (fse[i].valid) {
  28. dp_info("index %d:"
  29. " src_ip_127_96 0x%x"
  30. " src_ip_95_640 0x%x"
  31. " src_ip_63_32 0x%x"
  32. " src_ip_31_0 0x%x"
  33. " dest_ip_127_96 0x%x"
  34. " dest_ip_95_64 0x%x"
  35. " dest_ip_63_32 0x%x"
  36. " dest_ip_31_0 0x%x"
  37. " src_port 0x%x"
  38. " dest_port 0x%x"
  39. " l4_protocol 0x%x"
  40. " valid 0x%x"
  41. " reo_destination_indication 0x%x"
  42. " msdu_drop 0x%x"
  43. " reo_destination_handler 0x%x"
  44. " metadata 0x%x"
  45. " aggregation_count0x%x"
  46. " lro_eligible 0x%x"
  47. " msdu_count 0x%x"
  48. " msdu_byte_count 0x%x"
  49. " timestamp 0x%x"
  50. " cumulative_l4_checksum 0x%x"
  51. " cumulative_ip_length 0x%x"
  52. " tcp_sequence_number 0x%x",
  53. i,
  54. fse[i].src_ip_127_96,
  55. fse[i].src_ip_95_64,
  56. fse[i].src_ip_63_32,
  57. fse[i].src_ip_31_0,
  58. fse[i].dest_ip_127_96,
  59. fse[i].dest_ip_95_64,
  60. fse[i].dest_ip_63_32,
  61. fse[i].dest_ip_31_0,
  62. fse[i].src_port,
  63. fse[i].dest_port,
  64. fse[i].l4_protocol,
  65. fse[i].valid,
  66. fse[i].reo_destination_indication,
  67. fse[i].msdu_drop,
  68. fse[i].reo_destination_handler,
  69. fse[i].metadata,
  70. fse[i].aggregation_count,
  71. fse[i].lro_eligible,
  72. fse[i].msdu_count,
  73. fse[i].msdu_byte_count,
  74. fse[i].timestamp,
  75. fse[i].cumulative_l4_checksum,
  76. fse[i].cumulative_ip_length,
  77. fse[i].tcp_sequence_number);
  78. }
  79. }
  80. }
  81. #else
  82. void hal_rx_dump_fse_table(struct hal_rx_fst *fst)
  83. {
  84. }
  85. #endif
  86. /**
  87. * hal_rx_flow_setup_fse() - Setup a flow search entry in HW FST
  88. * @fst: Pointer to the Rx Flow Search Table
  89. * @table_offset: offset into the table where the flow is to be setup
  90. * @flow: Flow Parameters
  91. *
  92. * Return: Success/Failure
  93. */
  94. void *
  95. hal_rx_flow_setup_fse(hal_soc_handle_t hal_soc_hdl,
  96. struct hal_rx_fst *fst, uint32_t table_offset,
  97. struct hal_rx_flow *flow)
  98. {
  99. struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
  100. if (hal_soc->ops->hal_rx_flow_setup_fse) {
  101. return hal_soc->ops->hal_rx_flow_setup_fse((uint8_t *)fst,
  102. table_offset,
  103. (uint8_t *)flow);
  104. }
  105. return NULL;
  106. }
  107. qdf_export_symbol(hal_rx_flow_setup_fse);
  108. /**
  109. * hal_rx_flow_delete_entry() - Delete a flow from the Rx Flow Search Table
  110. * @fst: Pointer to the Rx Flow Search Table
  111. * @hal_rx_fse: Pointer to the Rx Flow that is to be deleted from the FST
  112. *
  113. * Return: Success/Failure
  114. */
  115. inline QDF_STATUS
  116. hal_rx_flow_delete_entry(struct hal_rx_fst *fst, void *hal_rx_fse)
  117. {
  118. uint8_t *fse = (uint8_t *)hal_rx_fse;
  119. if (!HAL_GET_FLD(fse, RX_FLOW_SEARCH_ENTRY_9, VALID))
  120. return QDF_STATUS_E_NOENT;
  121. HAL_CLR_FLD(fse, RX_FLOW_SEARCH_ENTRY_9, VALID);
  122. return QDF_STATUS_SUCCESS;
  123. }
  124. qdf_export_symbol(hal_rx_flow_delete_entry);
  125. /**
  126. * hal_rx_fst_key_configure() - Configure the Toeplitz key in the FST
  127. * @fst: Pointer to the Rx Flow Search Table
  128. *
  129. * Return: Success/Failure
  130. */
  131. static void hal_rx_fst_key_configure(struct hal_rx_fst *fst)
  132. {
  133. uint8_t key_bytes[HAL_FST_HASH_KEY_SIZE_BYTES];
  134. qdf_mem_copy(key_bytes, fst->key, HAL_FST_HASH_KEY_SIZE_BYTES);
  135. /**
  136. * The Toeplitz algorithm as per the Microsoft spec works in a
  137. * “big-endian” manner, using the MSBs of the key to hash the
  138. * initial bytes of the input going on to use up the lower order bits
  139. * of the key to hash further bytes of the input until the LSBs of the
  140. * key are used finally.
  141. *
  142. * So first, rightshift 320-bit input key 5 times to get 315 MS bits
  143. */
  144. key_bitwise_shift_left(key_bytes, HAL_FST_HASH_KEY_SIZE_BYTES, 5);
  145. key_reverse(fst->shifted_key, key_bytes, HAL_FST_HASH_KEY_SIZE_BYTES);
  146. }
  147. /**
  148. * hal_rx_fst_get_base() - Retrieve the virtual base address of the Rx FST
  149. * @fst: Pointer to the Rx Flow Search Table
  150. *
  151. * Return: Success/Failure
  152. */
  153. static inline void *hal_rx_fst_get_base(struct hal_rx_fst *fst)
  154. {
  155. return fst->base_vaddr;
  156. }
  157. /**
  158. * hal_rx_fst_get_fse_size() - Retrieve the size of each entry(flow) in Rx FST
  159. *
  160. * Return: size of each entry/flow in Rx FST
  161. */
  162. static inline uint32_t hal_rx_fst_get_fse_size(void)
  163. {
  164. return HAL_RX_FST_ENTRY_SIZE;
  165. }
  166. /**
  167. * hal_rx_flow_get_tuple_info() - Retrieve the 5-tuple flow info for an entry
  168. * @hal_fse: Pointer to the Flow in Rx FST
  169. * @tuple_info: 5-tuple info of the flow returned to the caller
  170. *
  171. * Return: Success/Failure
  172. */
  173. QDF_STATUS hal_rx_flow_get_tuple_info(void *hal_fse,
  174. struct hal_flow_tuple_info *tuple_info)
  175. {
  176. if (!hal_fse || !tuple_info)
  177. return QDF_STATUS_E_INVAL;
  178. if (!HAL_GET_FLD(hal_fse, RX_FLOW_SEARCH_ENTRY_9, VALID))
  179. return QDF_STATUS_E_NOENT;
  180. tuple_info->src_ip_127_96 =
  181. qdf_ntohl(HAL_GET_FLD(hal_fse,
  182. RX_FLOW_SEARCH_ENTRY_0,
  183. SRC_IP_127_96));
  184. tuple_info->src_ip_95_64 =
  185. qdf_ntohl(HAL_GET_FLD(hal_fse,
  186. RX_FLOW_SEARCH_ENTRY_1,
  187. SRC_IP_95_64));
  188. tuple_info->src_ip_63_32 =
  189. qdf_ntohl(HAL_GET_FLD(hal_fse,
  190. RX_FLOW_SEARCH_ENTRY_2,
  191. SRC_IP_63_32));
  192. tuple_info->src_ip_31_0 =
  193. qdf_ntohl(HAL_GET_FLD(hal_fse,
  194. RX_FLOW_SEARCH_ENTRY_3,
  195. SRC_IP_31_0));
  196. tuple_info->dest_ip_127_96 =
  197. qdf_ntohl(HAL_GET_FLD(hal_fse,
  198. RX_FLOW_SEARCH_ENTRY_4,
  199. DEST_IP_127_96));
  200. tuple_info->dest_ip_95_64 =
  201. qdf_ntohl(HAL_GET_FLD(hal_fse,
  202. RX_FLOW_SEARCH_ENTRY_5,
  203. DEST_IP_95_64));
  204. tuple_info->dest_ip_63_32 =
  205. qdf_ntohl(HAL_GET_FLD(hal_fse,
  206. RX_FLOW_SEARCH_ENTRY_6,
  207. DEST_IP_63_32));
  208. tuple_info->dest_ip_31_0 =
  209. qdf_ntohl(HAL_GET_FLD(hal_fse,
  210. RX_FLOW_SEARCH_ENTRY_7,
  211. DEST_IP_31_0));
  212. tuple_info->dest_port = HAL_GET_FLD(hal_fse,
  213. RX_FLOW_SEARCH_ENTRY_8,
  214. DEST_PORT);
  215. tuple_info->src_port = HAL_GET_FLD(hal_fse,
  216. RX_FLOW_SEARCH_ENTRY_8,
  217. SRC_PORT);
  218. tuple_info->l4_protocol = HAL_GET_FLD(hal_fse,
  219. RX_FLOW_SEARCH_ENTRY_9,
  220. L4_PROTOCOL);
  221. return QDF_STATUS_SUCCESS;
  222. }
  223. /**
  224. * hal_flow_toeplitz_create_cache() - Calculate hashes for each possible
  225. * byte value with the key taken as is
  226. *
  227. * @fst: FST Handle
  228. * @key: Hash Key
  229. *
  230. * Return: Success/Failure
  231. */
  232. static void hal_flow_toeplitz_create_cache(struct hal_rx_fst *fst)
  233. {
  234. int bit;
  235. int val;
  236. int i;
  237. uint8_t *key = fst->shifted_key;
  238. /*
  239. * Initialise to first 32 bits of the key; shift in further key material
  240. * through the loop
  241. */
  242. uint32_t cur_key = (key[0] << 24) | (key[1] << 16) | (key[2] << 8) |
  243. key[3];
  244. for (i = 0; i < HAL_FST_HASH_KEY_SIZE_BYTES; i++) {
  245. uint8_t new_key_byte;
  246. uint32_t shifted_key[8];
  247. if (i + 4 < HAL_FST_HASH_KEY_SIZE_BYTES)
  248. new_key_byte = key[i + 4];
  249. else
  250. new_key_byte = 0;
  251. shifted_key[0] = cur_key;
  252. for (bit = 1; bit < 8; bit++) {
  253. /*
  254. * For each iteration, shift out one more bit of the
  255. * current key and shift in one more bit of the new key
  256. * material
  257. */
  258. shifted_key[bit] = cur_key << bit |
  259. new_key_byte >> (8 - bit);
  260. }
  261. for (val = 0; val < (1 << 8); val++) {
  262. uint32_t hash = 0;
  263. int mask;
  264. /*
  265. * For each bit set in the input, XOR in
  266. * the appropriately shifted key
  267. */
  268. for (bit = 0, mask = 1 << 7; bit < 8; bit++, mask >>= 1)
  269. if ((val & mask))
  270. hash ^= shifted_key[bit];
  271. fst->key_cache[i][val] = hash;
  272. }
  273. cur_key = cur_key << 8 | new_key_byte;
  274. }
  275. }
  276. /**
  277. * hal_rx_fst_attach() - Initialize Rx flow search table in HW FST
  278. *
  279. * @qdf_dev: QDF device handle
  280. * @hal_fst_base_paddr: Pointer to the physical base address of the Rx FST
  281. * @max_entries: Max number of flows allowed in the FST
  282. * @max_search: Number of collisions allowed in the hash-based FST
  283. * @hash_key: Toeplitz key used for the hash FST
  284. *
  285. * Return:
  286. */
  287. struct hal_rx_fst *
  288. hal_rx_fst_attach(qdf_device_t qdf_dev,
  289. uint64_t *hal_fst_base_paddr, uint16_t max_entries,
  290. uint16_t max_search, uint8_t *hash_key)
  291. {
  292. struct hal_rx_fst *fst = qdf_mem_malloc(sizeof(struct hal_rx_fst));
  293. if (!fst) {
  294. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  295. FL("hal fst allocation failed,"));
  296. return NULL;
  297. }
  298. qdf_mem_set(fst, 0, sizeof(struct hal_rx_fst));
  299. fst->key = hash_key;
  300. fst->max_skid_length = max_search;
  301. fst->max_entries = max_entries;
  302. fst->hash_mask = max_entries - 1;
  303. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
  304. "HAL FST allocation %pK %d * %d\n", fst,
  305. fst->max_entries, HAL_RX_FST_ENTRY_SIZE);
  306. fst->base_vaddr = (uint8_t *)qdf_mem_alloc_consistent(qdf_dev,
  307. qdf_dev->dev,
  308. (fst->max_entries * HAL_RX_FST_ENTRY_SIZE),
  309. &fst->base_paddr);
  310. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_INFO,
  311. "hal_rx_fst base address 0x%pK", (void *)fst->base_paddr);
  312. if (!fst->base_vaddr) {
  313. QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
  314. FL("hal fst->base_vaddr allocation failed"));
  315. qdf_mem_free(fst);
  316. return NULL;
  317. }
  318. QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_ANY, QDF_TRACE_LEVEL_DEBUG,
  319. (void *)fst->key, HAL_FST_HASH_KEY_SIZE_BYTES);
  320. qdf_mem_set((uint8_t *)fst->base_vaddr, 0,
  321. (fst->max_entries * HAL_RX_FST_ENTRY_SIZE));
  322. hal_rx_fst_key_configure(fst);
  323. hal_flow_toeplitz_create_cache(fst);
  324. *hal_fst_base_paddr = (uint64_t)fst->base_paddr;
  325. return fst;
  326. }
  327. qdf_export_symbol(hal_rx_fst_attach);
  328. /**
  329. * hal_rx_fst_detach() - De-init the Rx flow search table from HW
  330. *
  331. * @rx_fst: Pointer to the Rx FST
  332. * @qdf_dev: QDF device handle
  333. *
  334. * Return:
  335. */
  336. void hal_rx_fst_detach(struct hal_rx_fst *rx_fst,
  337. qdf_device_t qdf_dev)
  338. {
  339. if (!rx_fst || !qdf_dev)
  340. return;
  341. qdf_mem_free_consistent(qdf_dev, qdf_dev->dev,
  342. rx_fst->max_entries * HAL_RX_FST_ENTRY_SIZE,
  343. rx_fst->base_vaddr, rx_fst->base_paddr, 0);
  344. qdf_mem_free(rx_fst);
  345. }
  346. qdf_export_symbol(hal_rx_fst_detach);
  347. /**
  348. * hal_flow_toeplitz_hash() - Calculate Toeplitz hash by using the cached key
  349. *
  350. * @hal_fst: FST Handle
  351. * @flow: Flow Parameters
  352. *
  353. * Return: Success/Failure
  354. */
  355. uint32_t
  356. hal_flow_toeplitz_hash(void *hal_fst, struct hal_rx_flow *flow)
  357. {
  358. int i, j;
  359. uint32_t hash = 0;
  360. struct hal_rx_fst *fst = (struct hal_rx_fst *)hal_fst;
  361. uint32_t input[HAL_FST_HASH_KEY_SIZE_WORDS];
  362. uint8_t *tuple;
  363. qdf_mem_zero(input, HAL_FST_HASH_KEY_SIZE_BYTES);
  364. *(uint32_t *)&input[0] = qdf_htonl(flow->tuple_info.src_ip_127_96);
  365. *(uint32_t *)&input[1] = qdf_htonl(flow->tuple_info.src_ip_95_64);
  366. *(uint32_t *)&input[2] = qdf_htonl(flow->tuple_info.src_ip_63_32);
  367. *(uint32_t *)&input[3] = qdf_htonl(flow->tuple_info.src_ip_31_0);
  368. *(uint32_t *)&input[4] = qdf_htonl(flow->tuple_info.dest_ip_127_96);
  369. *(uint32_t *)&input[5] = qdf_htonl(flow->tuple_info.dest_ip_95_64);
  370. *(uint32_t *)&input[6] = qdf_htonl(flow->tuple_info.dest_ip_63_32);
  371. *(uint32_t *)&input[7] = qdf_htonl(flow->tuple_info.dest_ip_31_0);
  372. *(uint32_t *)&input[8] = (flow->tuple_info.dest_port << 16) |
  373. (flow->tuple_info.src_port);
  374. *(uint32_t *)&input[9] = flow->tuple_info.l4_protocol;
  375. tuple = (uint8_t *)input;
  376. QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
  377. tuple, sizeof(input));
  378. for (i = 0, j = HAL_FST_HASH_DATA_SIZE - 1;
  379. i < HAL_FST_HASH_KEY_SIZE_BYTES && j >= 0; i++, j--) {
  380. hash ^= fst->key_cache[i][tuple[j]];
  381. }
  382. QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_LOW,
  383. "Hash value %u %u truncated hash %u\n", hash,
  384. (hash >> 12), (hash >> 12) % (fst->max_entries));
  385. hash >>= 12;
  386. hash &= (fst->max_entries - 1);
  387. return hash;
  388. }
  389. qdf_export_symbol(hal_flow_toeplitz_hash);
  390. /**
  391. * hal_rx_get_hal_hash() - Retrieve hash index of a flow in the FST table
  392. *
  393. * @hal_fst: HAL Rx FST Handle
  394. * @flow_hash: Flow hash computed from flow tuple
  395. *
  396. * Return: hash index truncated to the size of the hash table
  397. */
  398. uint32_t hal_rx_get_hal_hash(struct hal_rx_fst *hal_fst, uint32_t flow_hash)
  399. {
  400. uint32_t trunc_hash = flow_hash;
  401. /* Take care of hash wrap around scenario */
  402. if (flow_hash >= hal_fst->max_entries)
  403. trunc_hash &= hal_fst->hash_mask;
  404. return trunc_hash;
  405. }
  406. qdf_export_symbol(hal_rx_get_hal_hash);
  407. /**
  408. * hal_rx_insert_flow_entry() - Add a flow into the FST table
  409. *
  410. * @hal_fst: HAL Rx FST Handle
  411. * @flow_hash: Flow hash computed from flow tuple
  412. * @flow_tuple_info: Flow tuple used to compute the hash
  413. * @flow_index: Hash index of the flow in the table when inserted successfully
  414. *
  415. * Return: Success if flow is inserted into the table, error otherwise
  416. */
  417. QDF_STATUS
  418. hal_rx_insert_flow_entry(struct hal_rx_fst *fst, uint32_t flow_hash,
  419. void *flow_tuple_info, uint32_t *flow_idx)
  420. {
  421. int i;
  422. void *hal_fse;
  423. uint32_t hal_hash;
  424. struct hal_flow_tuple_info hal_tuple_info = { 0 };
  425. QDF_STATUS status;
  426. for (i = 0; i < fst->max_skid_length; i++) {
  427. hal_hash = hal_rx_get_hal_hash(fst, (flow_hash + i));
  428. hal_fse = (uint8_t *)fst->base_vaddr +
  429. (hal_hash * HAL_RX_FST_ENTRY_SIZE);
  430. status = hal_rx_flow_get_tuple_info(hal_fse, &hal_tuple_info);
  431. if (status == QDF_STATUS_E_NOENT)
  432. break;
  433. /* Find the matching flow entry in HW FST */
  434. if (!qdf_mem_cmp(&hal_tuple_info,
  435. flow_tuple_info,
  436. sizeof(struct hal_flow_tuple_info))) {
  437. dp_err("Duplicate flow entry in FST %u at skid %u ",
  438. hal_hash, i);
  439. return QDF_STATUS_E_EXISTS;
  440. }
  441. }
  442. if (i == fst->max_skid_length) {
  443. dp_err("Max skid length reached for hash %u", flow_hash);
  444. return QDF_STATUS_E_RANGE;
  445. }
  446. *flow_idx = hal_hash;
  447. dp_info("flow_hash = %u, skid_entry = %d, flow_addr = %pK flow_idx = %d",
  448. flow_hash, i, hal_fse, *flow_idx);
  449. return QDF_STATUS_SUCCESS;
  450. }
  451. qdf_export_symbol(hal_rx_insert_flow_entry);
  452. /**
  453. * hal_rx_find_flow_from_tuple() - Find a flow in the FST table
  454. *
  455. * @fst: HAL Rx FST Handle
  456. * @flow_hash: Flow hash computed from flow tuple
  457. * @flow_tuple_info: Flow tuple used to compute the hash
  458. * @flow_index: Hash index of the flow in the table when found
  459. *
  460. * Return: Success if matching flow is found in the table, error otherwise
  461. */
  462. QDF_STATUS
  463. hal_rx_find_flow_from_tuple(struct hal_rx_fst *fst, uint32_t flow_hash,
  464. void *flow_tuple_info, uint32_t *flow_idx)
  465. {
  466. int i;
  467. void *hal_fse;
  468. uint32_t hal_hash;
  469. struct hal_flow_tuple_info hal_tuple_info = { 0 };
  470. QDF_STATUS status;
  471. for (i = 0; i < fst->max_skid_length; i++) {
  472. hal_hash = hal_rx_get_hal_hash(fst, (flow_hash + i));
  473. hal_fse = (uint8_t *)fst->base_vaddr +
  474. (hal_hash * HAL_RX_FST_ENTRY_SIZE);
  475. status = hal_rx_flow_get_tuple_info(hal_fse, &hal_tuple_info);
  476. if (status != QDF_STATUS_SUCCESS)
  477. continue;
  478. /* Find the matching flow entry in HW FST */
  479. if (!qdf_mem_cmp(&hal_tuple_info,
  480. flow_tuple_info,
  481. sizeof(struct hal_flow_tuple_info))) {
  482. break;
  483. }
  484. }
  485. if (i == fst->max_skid_length) {
  486. dp_err("Max skid length reached for hash %u", flow_hash);
  487. return QDF_STATUS_E_RANGE;
  488. }
  489. *flow_idx = hal_hash;
  490. dp_info("flow_hash = %u, skid_entry = %d, flow_addr = %pK flow_idx = %d",
  491. flow_hash, i, hal_fse, *flow_idx);
  492. return QDF_STATUS_SUCCESS;
  493. }
  494. qdf_export_symbol(hal_rx_find_flow_from_tuple);