123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- /*
- * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
- #ifndef __HAL_RX_FLOW_H
- #define __HAL_RX_FLOW_H
- #include "hal_flow.h"
- #include "wlan_cfg.h"
- #include "hal_api.h"
- #include "qdf_mem.h"
- #include "rx_flow_search_entry.h"
- #include "hal_rx_flow_info.h"
- #define HAL_FST_HASH_KEY_SIZE_BITS 315
- #define HAL_FST_HASH_KEY_SIZE_WORDS 10
- #define HAL_FST_HASH_DATA_SIZE 37
- #define HAL_FST_HASH_MASK 0x7ffff
- #define HAL_RX_FST_ENTRY_SIZE (NUM_OF_DWORDS_RX_FLOW_SEARCH_ENTRY * 4)
- /*
- * Four possible options for IP SA/DA prefix, currently use 0x0 which
- * maps to type 2 in HW spec
- */
- #define HAL_FST_IP_DA_SA_PFX_TYPE_IPV4_COMPATIBLE_IPV6 2
- #define HAL_IP_DA_SA_PREFIX_IPV4_COMPATIBLE_IPV6 0x0
- /*
- * REO destination indication is a lower 4-bits of hash value
- * This should match the REO destination used in Rx hash based routing.
- */
- #define HAL_REO_DEST_IND_HASH_MASK 0xF
- /*
- * REO destinations are valid from 16-31 for Hawkeye
- * and 0-15 are not setup for SW
- */
- #define HAL_REO_DEST_IND_START_OFFSET 0x10
- /**
- * enum hal_rx_fse_reo_destination_handler
- * @HAL_RX_FSE_REO_DEST_FT: Use this entry's destination indication
- * @HAL_RX_FSE_REO_DEST_ASPT: Use Address Search + Peer Table's entry
- * @HAL_RX_FSE_REO_DEST_FT2: Use FT2's destination indication
- * @HAL_RX_FSE_REO_DEST_CCE: Use CCE's destination indication for this entry
- */
- enum hal_rx_fse_reo_destination_handler {
- HAL_RX_FSE_REO_DEST_FT = 0,
- HAL_RX_FSE_REO_DEST_ASPT = 1,
- HAL_RX_FSE_REO_DEST_FT2 = 2,
- HAL_RX_FSE_REO_DEST_CCE = 3,
- };
- /**
- * hal_rx_flow_setup_fse() - Setup a flow search entry in HW FST
- * @hal_soc_hdl: HAL SOC handle
- * @fst: Pointer to the Rx Flow Search Table
- * @table_offset: offset into the table where the flow is to be setup
- * @flow: Flow Parameters
- *
- * Return: Success/Failure
- */
- void *
- hal_rx_flow_setup_fse(hal_soc_handle_t hal_soc_hdl,
- struct hal_rx_fst *fst, uint32_t table_offset,
- struct hal_rx_flow *flow);
- /**
- * hal_rx_flow_setup_cmem_fse() - Setup a flow search entry in HW CMEM FST
- * @hal_soc_hdl: HAL SOC handle
- * @cmem_ba: CMEM base address
- * @table_offset: offset into the table where the flow is to be setup
- * @flow: Flow Parameters
- *
- * Return: Success/Failure
- */
- uint32_t
- hal_rx_flow_setup_cmem_fse(hal_soc_handle_t hal_soc_hdl, uint32_t cmem_ba,
- uint32_t table_offset, struct hal_rx_flow *flow);
- /**
- * hal_rx_flow_get_cmem_fse_timestamp() - Get timestamp field from CMEM FSE
- * @hal_soc_hdl: HAL SOC handle
- * @fse_offset: CMEM FSE offset
- *
- * Return: Timestamp
- */
- uint32_t hal_rx_flow_get_cmem_fse_timestamp(hal_soc_handle_t hal_soc_hdl,
- uint32_t fse_offset);
- /**
- * hal_rx_flow_delete_entry() - Delete a flow from the Rx Flow Search Table
- * @hal_soc_hdl: HAL SOC handle
- * @fst: Pointer to the Rx Flow Search Table
- * @hal_rx_fse: Pointer to the Rx Flow that is to be deleted from the FST
- *
- * Return: Success/Failure
- */
- QDF_STATUS
- hal_rx_flow_delete_entry(hal_soc_handle_t hal_soc_hdl,
- struct hal_rx_fst *fst, void *hal_rx_fse);
- /**
- * hal_rx_flow_get_tuple_info() - Retrieve the 5-tuple flow info for an entry
- * @hal_soc_hdl: HAL SOC handle
- * @fst: Pointer to the Rx Flow Search Table
- * @hal_hash: HAL 5 tuple hash
- * @tuple_info: 5-tuple info of the flow returned to the caller
- *
- * Return: 5-tuple flow info
- */
- void *
- hal_rx_flow_get_tuple_info(hal_soc_handle_t hal_soc_hdl,
- struct hal_rx_fst *fst,
- uint32_t hal_hash,
- struct hal_flow_tuple_info *tuple_info);
- /**
- * hal_rx_fst_attach() - Initialize Rx flow search table in HW FST
- * @hal_soc_hdl: HAL SOC handle
- * @qdf_dev: QDF device handle
- * @hal_fst_base_paddr: Pointer to the physical base address of the Rx FST
- * @max_entries: Max number of flows allowed in the FST
- * @max_search: Number of collisions allowed in the hash-based FST
- * @hash_key: Toeplitz key used for the hash FST
- * @fst_cmem_base: FST CMEM base address
- *
- * Return: FST object on success, NULL on memory allocation failure
- */
- struct hal_rx_fst *
- hal_rx_fst_attach(hal_soc_handle_t hal_soc_hdl,
- qdf_device_t qdf_dev,
- uint64_t *hal_fst_base_paddr, uint16_t max_entries,
- uint16_t max_search, uint8_t *hash_key,
- uint64_t fst_cmem_base);
- /**
- * hal_rx_fst_detach() - De-init the Rx flow search table from HW
- * @hal_soc_hdl: HAL SOC handler
- * @rx_fst: Pointer to the Rx FST
- * @qdf_dev: QDF device handle
- * @fst_cmem_base: FST CMEM base address
- *
- * Return:
- */
- void hal_rx_fst_detach(hal_soc_handle_t hal_soc_hdl, struct hal_rx_fst *rx_fst,
- qdf_device_t qdf_dev, uint64_t fst_cmem_base);
- /**
- * hal_rx_insert_flow_entry() - Add a flow into the FST table
- * @hal_soc_hdl: HAL SOC handle
- * @fst: HAL Rx FST Handle
- * @flow_hash: Flow hash computed from flow tuple
- * @flow_tuple_info: Flow tuple used to compute the hash
- * @flow_idx: Hash index of the flow in the table when inserted successfully
- *
- * Return: Success if flow is inserted into the table, error otherwise
- */
- QDF_STATUS
- hal_rx_insert_flow_entry(hal_soc_handle_t hal_soc_hdl,
- struct hal_rx_fst *fst, uint32_t flow_hash,
- void *flow_tuple_info, uint32_t *flow_idx);
- /**
- * hal_rx_find_flow_from_tuple() - Find a flow in the FST table
- * @hal_soc_hdl: HAL SOC handle
- * @fst: HAL Rx FST Handle
- * @flow_hash: Flow hash computed from flow tuple
- * @flow_tuple_info: Flow tuple used to compute the hash
- * @flow_idx: Hash index of the flow in the table when found
- *
- * Return: Success if matching flow is found in the table, error otherwise
- */
- QDF_STATUS
- hal_rx_find_flow_from_tuple(hal_soc_handle_t hal_soc_hdl,
- struct hal_rx_fst *fst, uint32_t flow_hash,
- void *flow_tuple_info, uint32_t *flow_idx);
- /**
- * hal_rx_get_hal_hash() - Retrieve hash index of a flow in the FST table
- * @hal_fst: HAL Rx FST Handle
- * @flow_hash: Flow hash computed from flow tuple
- *
- * Return: hash index truncated to the size of the hash table
- */
- uint32_t hal_rx_get_hal_hash(struct hal_rx_fst *hal_fst, uint32_t flow_hash);
- /**
- * hal_flow_toeplitz_hash() - Calculate Toeplitz hash by using the cached key
- * @hal_fst: FST Handle
- * @flow: Flow Parameters
- *
- * Return: Success/Failure
- */
- uint32_t
- hal_flow_toeplitz_hash(void *hal_fst, struct hal_rx_flow *flow);
- /**
- * hal_rx_dump_fse_table() - Dump the RX FSE table
- * @fst: HAL RX FST table to dump
- */
- void hal_rx_dump_fse_table(struct hal_rx_fst *fst);
- /**
- * hal_rx_dump_cmem_fse() - Dump flow search table entry which is in CMEM
- * @hal_soc_hdl: HAL SOC handle
- * @fse_offset: Offset in to the CMEM where FSE is located
- * @index: FSE index
- *
- * Return: None
- */
- void hal_rx_dump_cmem_fse(hal_soc_handle_t hal_soc_hdl, uint32_t fse_offset,
- int index);
- #endif /* HAL_RX_FLOW_H */
|