0d571bbba3d5579bca5db8696cfd73971d7ecd3d
[dpdk.git] / drivers / net / bnxt / tf_ulp / ulp_rte_parser.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2020 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _ULP_RTE_PARSER_H_
7 #define _ULP_RTE_PARSER_H_
8
9 #include <rte_log.h>
10 #include <rte_flow.h>
11 #include <rte_flow_driver.h>
12 #include "ulp_template_db.h"
13 #include "ulp_template_struct.h"
14
15 /* defines to be used in the tunnel header parsing */
16 #define BNXT_ULP_ENCAP_IPV4_VER_HLEN_TOS        2
17 #define BNXT_ULP_ENCAP_IPV4_ID_PROTO            6
18 #define BNXT_ULP_ENCAP_IPV4_DEST_IP             4
19 #define BNXT_ULP_ENCAP_IPV4_SIZE                12
20 #define BNXT_ULP_ENCAP_IPV6_SIZE                8
21 #define BNXT_ULP_ENCAP_UDP_SIZE                 4
22
23 /* Function to handle the parsing of the RTE port id. */
24 int32_t
25 ulp_rte_parser_svif_process(struct ulp_rte_hdr_bitmap   *hdr_bitmap,
26                             struct ulp_rte_hdr_field    *hdr_field);
27
28 /*
29  * Function to handle the parsing of RTE Flows and placing
30  * the RTE flow items into the ulp structures.
31  */
32 int32_t
33 bnxt_ulp_rte_parser_hdr_parse(const struct rte_flow_item pattern[],
34                               struct ulp_rte_hdr_bitmap *hdr_bitmap,
35                               struct ulp_rte_hdr_field  *hdr_field);
36
37 /*
38  * Function to handle the parsing of RTE Flows and placing
39  * the RTE flow actions into the ulp structures.
40  */
41 int32_t
42 bnxt_ulp_rte_parser_act_parse(const struct rte_flow_action      actions[],
43                               struct ulp_rte_act_bitmap         *act_bitmap,
44                               struct ulp_rte_act_prop           *act_prop);
45
46 /* Function to handle the parsing of RTE Flow item PF Header. */
47 int32_t
48 ulp_rte_pf_hdr_handler(const struct rte_flow_item       *item,
49                        struct ulp_rte_hdr_bitmap        *hdr_bitmap,
50                        struct ulp_rte_hdr_field         *hdr_field,
51                        uint32_t                         *field_idx,
52                        uint32_t                         *vlan_idx);
53
54 /* Function to handle the parsing of RTE Flow item VF Header. */
55 int32_t
56 ulp_rte_vf_hdr_handler(const struct rte_flow_item       *item,
57                        struct ulp_rte_hdr_bitmap        *hdr_bitmap,
58                        struct ulp_rte_hdr_field         *hdr_field,
59                        uint32_t                         *field_idx,
60                        uint32_t                         *vlan_idx);
61
62 /* Function to handle the parsing of RTE Flow item port id Header. */
63 int32_t
64 ulp_rte_port_id_hdr_handler(const struct rte_flow_item  *item,
65                             struct ulp_rte_hdr_bitmap   *hdr_bitmap,
66                             struct ulp_rte_hdr_field    *hdr_field,
67                             uint32_t                    *field_idx,
68                             uint32_t                    *vlan_idx);
69
70 /* Function to handle the parsing of RTE Flow item port Header. */
71 int32_t
72 ulp_rte_phy_port_hdr_handler(const struct rte_flow_item *item,
73                              struct ulp_rte_hdr_bitmap  *hdr_bitmap,
74                              struct ulp_rte_hdr_field   *hdr_field,
75                              uint32_t                   *field_idx,
76                              uint32_t                   *vlan_idx);
77
78 /* Function to handle the RTE item Ethernet Header. */
79 int32_t
80 ulp_rte_eth_hdr_handler(const struct rte_flow_item      *item,
81                         struct ulp_rte_hdr_bitmap       *hdr_bitmap,
82                         struct ulp_rte_hdr_field        *hdr_field,
83                         uint32_t                        *field_idx,
84                         uint32_t                        *vlan_idx);
85
86 /* Function to handle the parsing of RTE Flow item Vlan Header. */
87 int32_t
88 ulp_rte_vlan_hdr_handler(const struct rte_flow_item     *item,
89                          struct ulp_rte_hdr_bitmap      *hdr_bitmap,
90                          struct ulp_rte_hdr_field       *hdr_field,
91                          uint32_t                       *field_idx,
92                          uint32_t                       *vlan_idx);
93
94 /* Function to handle the parsing of RTE Flow item IPV4 Header. */
95 int32_t
96 ulp_rte_ipv4_hdr_handler(const struct rte_flow_item     *item,
97                          struct ulp_rte_hdr_bitmap      *hdr_bitmap,
98                          struct ulp_rte_hdr_field       *hdr_field,
99                          uint32_t                       *field_idx,
100                          uint32_t                       *vlan_idx);
101
102 /* Function to handle the parsing of RTE Flow item IPV6 Header. */
103 int32_t
104 ulp_rte_ipv6_hdr_handler(const struct rte_flow_item     *item,
105                          struct ulp_rte_hdr_bitmap      *hdr_bitmap,
106                          struct ulp_rte_hdr_field       *hdr_field,
107                          uint32_t                       *field_idx,
108                          uint32_t                       *vlan_idx);
109
110 /* Function to handle the parsing of RTE Flow item UDP Header. */
111 int32_t
112 ulp_rte_udp_hdr_handler(const struct rte_flow_item      *item,
113                         struct ulp_rte_hdr_bitmap       *hdr_bitmap,
114                         struct ulp_rte_hdr_field        *hdr_field,
115                         uint32_t                        *field_idx,
116                         uint32_t                        *vlan_idx);
117
118 /* Function to handle the parsing of RTE Flow item TCP Header. */
119 int32_t
120 ulp_rte_tcp_hdr_handler(const struct rte_flow_item      *item,
121                         struct ulp_rte_hdr_bitmap       *hdr_bitmap,
122                         struct ulp_rte_hdr_field        *hdr_field,
123                         uint32_t                        *field_idx,
124                         uint32_t                        *vlan_idx);
125
126 /* Function to handle the parsing of RTE Flow item Vxlan Header. */
127 int32_t
128 ulp_rte_vxlan_hdr_handler(const struct rte_flow_item    *item,
129                           struct ulp_rte_hdr_bitmap     *hdrbitmap,
130                           struct ulp_rte_hdr_field      *hdr_field,
131                           uint32_t                      *field_idx,
132                           uint32_t                      *vlan_idx);
133
134 /* Function to handle the parsing of RTE Flow item void Header. */
135 int32_t
136 ulp_rte_void_hdr_handler(const struct rte_flow_item     *item,
137                          struct ulp_rte_hdr_bitmap      *hdr_bitmap,
138                          struct ulp_rte_hdr_field       *hdr_field,
139                          uint32_t                       *field_idx,
140                          uint32_t                       *vlan_idx);
141
142 /* Function to handle the parsing of RTE Flow action void Header. */
143 int32_t
144 ulp_rte_void_act_handler(const struct rte_flow_action   *action_item,
145                          struct ulp_rte_act_bitmap      *act,
146                          struct ulp_rte_act_prop        *act_prop);
147
148 /* Function to handle the parsing of RTE Flow action RSS Header. */
149 int32_t
150 ulp_rte_rss_act_handler(const struct rte_flow_action    *action_item,
151                         struct ulp_rte_act_bitmap       *act,
152                         struct ulp_rte_act_prop *act_prop);
153
154 /* Function to handle the parsing of RTE Flow action Mark Header. */
155 int32_t
156 ulp_rte_mark_act_handler(const struct rte_flow_action   *action_item,
157                          struct ulp_rte_act_bitmap      *act,
158                          struct ulp_rte_act_prop        *act_prop);
159
160 /* Function to handle the parsing of RTE Flow action vxlan_encap Header. */
161 int32_t
162 ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action    *action_item,
163                                 struct ulp_rte_act_bitmap       *act,
164                                 struct ulp_rte_act_prop         *act_prop);
165
166 /* Function to handle the parsing of RTE Flow action vxlan_encap Header. */
167 int32_t
168 ulp_rte_vxlan_decap_act_handler(const struct rte_flow_action    *action_item,
169                                 struct ulp_rte_act_bitmap       *act,
170                                 struct ulp_rte_act_prop         *act_prop);
171
172 /* Function to handle the parsing of RTE Flow action drop Header. */
173 int32_t
174 ulp_rte_drop_act_handler(const struct rte_flow_action   *action_item,
175                          struct ulp_rte_act_bitmap      *act,
176                          struct ulp_rte_act_prop        *act_prop);
177
178 /* Function to handle the parsing of RTE Flow action count. */
179 int32_t
180 ulp_rte_count_act_handler(const struct rte_flow_action  *action_item,
181                           struct ulp_rte_act_bitmap     *act,
182                           struct ulp_rte_act_prop       *act_prop);
183
184 /* Function to handle the parsing of RTE Flow action PF. */
185 int32_t
186 ulp_rte_pf_act_handler(const struct rte_flow_action     *action_item,
187                        struct ulp_rte_act_bitmap        *act,
188                        struct ulp_rte_act_prop          *act_prop);
189
190 /* Function to handle the parsing of RTE Flow action VF. */
191 int32_t
192 ulp_rte_vf_act_handler(const struct rte_flow_action     *action_item,
193                        struct ulp_rte_act_bitmap        *act,
194                        struct ulp_rte_act_prop          *act_prop);
195
196 /* Function to handle the parsing of RTE Flow action port_id. */
197 int32_t
198 ulp_rte_port_id_act_handler(const struct rte_flow_action        *act_item,
199                             struct ulp_rte_act_bitmap           *act,
200                             struct ulp_rte_act_prop             *act_p);
201
202 /* Function to handle the parsing of RTE Flow action phy_port. */
203 int32_t
204 ulp_rte_phy_port_act_handler(const struct rte_flow_action       *action_item,
205                              struct ulp_rte_act_bitmap          *act,
206                              struct ulp_rte_act_prop            *act_prop);
207
208 #endif /* _ULP_RTE_PARSER_H_ */