1 /*
2  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef __HAL_RX_FLOW_DEFINES_H
21 #define __HAL_RX_FLOW_DEFINES_H
22 
23 #include "hal_flow.h"
24 
25 #define HAL_FST_HASH_KEY_SIZE_BYTES 40
26 #define HAL_OFFSET(block, field) block ## _ ## field ## _OFFSET
27 
28 #define HAL_RX_FST_ENTRY_SIZE (NUM_OF_DWORDS_RX_FLOW_SEARCH_ENTRY * 4)
29 
30 /**
31  * struct hal_rx_flow - Rx Flow parameters to be sent to HW
32  * @tuple_info: Rx Flow 5-tuple (src & dest IP, src & dest ports, L4 protocol)
33  * @reo_destination_handler: REO destination for this flow
34  * @reo_destination_indication: REO indication for this flow
35  * @fse_metadata: Flow metadata or tag passed to HW for marking packets
36  * @use_ppe_ds: send the pkt to REO2PPE instead of REO2HOST
37  * @priority_vld: field used by DS
38  * @service_code: field used by DS
39  */
40 struct hal_rx_flow {
41 	struct hal_flow_tuple_info tuple_info;
42 	uint8_t reo_destination_handler;
43 	uint8_t reo_destination_indication;
44 	uint32_t fse_metadata;
45 	uint8_t use_ppe_ds;
46 	uint8_t priority_vld;
47 	uint16_t service_code;
48 };
49 
50 /**
51  * struct hal_rx_fst - HAL RX Flow search table context
52  * @base_vaddr: Virtual Base address of HW FST
53  * @base_paddr: Physical Base address of HW FST
54  * @key: Pointer to 320-bit Key read from cfg
55  * @shifted_key: Pointer to left-shifted 320-bit Key used for Toeplitz Hash
56  * @max_entries : Max number of entries in flow searchh  table
57  * @max_skid_length : Max search length if there is hash collision
58  * @hash_mask: Hash mask to apply to index into FST
59  * @key_cache: Toepliz Key Cache configured key
60  * @add_flow_count: Add flow count
61  * @del_flow_count: Delete flow count
62  * @fst_entry_size: size of each flow entry
63  */
64 struct hal_rx_fst {
65 	uint8_t *base_vaddr;
66 	qdf_dma_addr_t base_paddr;
67 	uint8_t *key;
68 #ifndef WLAN_SUPPORT_RX_FISA
69 	uint8_t  shifted_key[HAL_FST_HASH_KEY_SIZE_BYTES];
70 	uint32_t key_cache[HAL_FST_HASH_KEY_SIZE_BYTES][1 << 8];
71 #endif
72 	uint16_t max_entries;
73 	uint16_t max_skid_length;
74 	uint16_t hash_mask;
75 	uint32_t add_flow_count;
76 	uint32_t del_flow_count;
77 	uint32_t fst_entry_size;
78 };
79 
80 #endif /* HAL_RX_FLOW_DEFINES_H */
81