net/bnxt: cleanup ULP parser and mapper
[dpdk.git] / drivers / net / bnxt / hcapi / cfa / hcapi_cfa_p58.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2021 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _HCAPI_CFA_P58_H_
7 #define _HCAPI_CFA_P58_H_
8
9 /**
10  * EEM Key entry sizes
11  */
12 #define CFA_P58_EEM_KEY_MAX_SIZE 80
13 #define CFA_P58_EEM_KEY_RECORD_SIZE 80
14
15 #define CFA_P58_EM_FKB_NUM_WORDS 4
16 #define CFA_P58_EM_FKB_NUM_ENTRIES 64
17 #define CFA_P58_WC_TCAM_FKB_NUM_WORDS 4
18 #define CFA_P58_WC_TCAM_FKB_NUM_ENTRIES 64
19
20 /** CFA phase 5.8 fix formatted table(layout) ID definition
21  *
22  */
23 enum cfa_p58_tbl_id {
24         CFA_P58_TBL_ILT = 0,
25         CFA_P58_TBL_L2CTXT_TCAM,
26         CFA_P58_TBL_L2CTXT_REMAP,
27         CFA_P58_TBL_PROF_TCAM,
28         CFA_P58_TBL_PROF_TCAM_REMAP,
29         CFA_P58_TBL_WC_TCAM,
30         CFA_P58_TBL_WC_TCAM_REC,
31         CFA_P58_TBL_VEB_TCAM,
32         CFA_P58_TBL_SP_TCAM,
33         /** Default Profile TCAM/Lookup Action Record Pointer Table */
34         CFA_P58_TBL_PROF_PARIF_DFLT_ACT_REC_PTR,
35         /** Error Profile TCAM Miss Action Record Pointer Table */
36         CFA_P58_TBL_PROF_PARIF_ERR_ACT_REC_PTR,
37         /** VNIC/SVIF Properties Table */
38         CFA_P58_TBL_VSPT,
39         CFA_P58_TBL_MAX
40 };
41
42 #define CFA_P58_PROF_MAX_KEYS 4
43 enum cfa_p58_mac_sel_mode {
44         CFA_P58_MAC_SEL_MODE_FIRST = 0,
45         CFA_P58_MAC_SEL_MODE_LOWEST = 1,
46 };
47
48 struct cfa_p58_prof_key_cfg {
49         uint8_t mac_sel[CFA_P58_PROF_MAX_KEYS];
50 #define CFA_P58_PROF_MAC_SEL_DMAC0 (1 << 0)
51 #define CFA_P58_PROF_MAC_SEL_T_MAC0 (1 << 1)
52 #define CFA_P58_PROF_MAC_SEL_OUTERMOST_MAC0 (1 << 2)
53 #define CFA_P58_PROF_MAC_SEL_DMAC1 (1 << 3)
54 #define CFA_P58_PROF_MAC_SEL_T_MAC1 (1 << 4)
55 #define CFA_P58_PROF_MAC_OUTERMOST_MAC1 (1 << 5)
56         uint8_t vlan_sel[CFA_P58_PROF_MAX_KEYS];
57 #define CFA_P58_PROFILER_VLAN_SEL_INNER_HDR 0
58 #define CFA_P58_PROFILER_VLAN_SEL_TUNNEL_HDR 1
59 #define CFA_P58_PROFILER_VLAN_SEL_OUTERMOST_HDR 2
60         uint8_t pass_cnt;
61         enum cfa_p58_mac_sel_mode mode;
62 };
63
64 /**
65  * Enumeration of SRAM entry types, used for allocation of
66  * fixed SRAM entities. The memory model for CFA HCAPI
67  * determines if an SRAM entry type is supported.
68  */
69 enum cfa_p58_action_sram_entry_type {
70         /* NOTE: Any additions to this enum must be reflected on FW
71          * side as well.
72          */
73
74         /** SRAM Action Record */
75         CFA_P58_ACTION_SRAM_ENTRY_TYPE_ACT,
76         /** SRAM Action Encap 8 Bytes */
77         CFA_P58_ACTION_SRAM_ENTRY_TYPE_ENCAP_8B,
78         /** SRAM Action Encap 16 Bytes */
79         CFA_P58_ACTION_SRAM_ENTRY_TYPE_ENCAP_16B,
80         /** SRAM Action Encap 64 Bytes */
81         CFA_P58_ACTION_SRAM_ENTRY_TYPE_ENCAP_64B,
82         /** SRAM Action Modify IPv4 Source */
83         CFA_P58_ACTION_SRAM_ENTRY_TYPE_MODIFY_IPV4_SRC,
84         /** SRAM Action Modify IPv4 Destination */
85         CFA_P58_ACTION_SRAM_ENTRY_TYPE_MODIFY_IPV4_DEST,
86         /** SRAM Action Source Properties SMAC */
87         CFA_P58_ACTION_SRAM_ENTRY_TYPE_SP_SMAC,
88         /** SRAM Action Source Properties SMAC IPv4 */
89         CFA_P58_ACTION_SRAM_ENTRY_TYPE_SP_SMAC_IPV4,
90         /** SRAM Action Source Properties SMAC IPv6 */
91         CFA_P58_ACTION_SRAM_ENTRY_TYPE_SP_SMAC_IPV6,
92         /** SRAM Action Statistics 64 Bits */
93         CFA_P58_ACTION_SRAM_ENTRY_TYPE_STATS_64,
94         CFA_P58_ACTION_SRAM_ENTRY_TYPE_MAX
95 };
96
97 /**
98  * SRAM Action Record structure holding either an action index or an
99  * action ptr.
100  */
101 union cfa_p58_action_sram_act_record {
102         /** SRAM Action idx specifies the offset of the SRAM
103          * element within its SRAM Entry Type block. This
104          * index can be written into i.e. an L2 Context. Use
105          * this type for all SRAM Action Record types except
106          * SRAM Full Action records. Use act_ptr instead.
107          */
108         uint16_t act_idx;
109         /** SRAM Full Action is special in that it needs an
110          * action record pointer. This pointer can be written
111          * into i.e. a Wildcard TCAM entry.
112          */
113         uint32_t act_ptr;
114 };
115
116 /**
117  * cfa_p58_action_param parameter definition
118  */
119 struct cfa_p58_action_param {
120         /**
121          * [in] receive or transmit direction
122          */
123         uint8_t dir;
124         /**
125          * [in] type of the sram allocation type
126          */
127         enum cfa_p58_action_sram_entry_type type;
128         /**
129          * [in] action record to set. The 'type' specified lists the
130          *      record definition to use in the passed in record.
131          */
132         union cfa_p58_action_sram_act_record record;
133         /**
134          * [in] number of elements in act_data
135          */
136         uint32_t act_size;
137         /**
138          * [in] ptr to array of action data
139          */
140         uint64_t *act_data;
141 };
142 #endif /* _CFA_HW_P58_H_ */