0ab43d2a6a8fe1bf82f259583d4c1fa9e232821f
[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 /*
24  * Function to handle the parsing of RTE Flows and placing
25  * the RTE flow items into the ulp structures.
26  */
27 int32_t
28 bnxt_ulp_rte_parser_hdr_parse(const struct rte_flow_item pattern[],
29                               struct ulp_rte_hdr_bitmap *hdr_bitmap,
30                               struct ulp_rte_hdr_field  *hdr_field);
31
32 /*
33  * Function to handle the parsing of RTE Flows and placing
34  * the RTE flow actions into the ulp structures.
35  */
36 int32_t
37 bnxt_ulp_rte_parser_act_parse(const struct rte_flow_action      actions[],
38                               struct ulp_rte_act_bitmap         *act_bitmap,
39                               struct ulp_rte_act_prop           *act_prop);
40
41 /* Function to handle the parsing of RTE Flow item PF Header. */
42 int32_t
43 ulp_rte_pf_hdr_handler(const struct rte_flow_item       *item,
44                        struct ulp_rte_hdr_bitmap        *hdr_bitmap,
45                        struct ulp_rte_hdr_field         *hdr_field,
46                        uint32_t                         *field_idx,
47                        uint32_t                         *vlan_idx);
48
49 /* Function to handle the parsing of RTE Flow item VF Header. */
50 int32_t
51 ulp_rte_vf_hdr_handler(const struct rte_flow_item       *item,
52                        struct ulp_rte_hdr_bitmap        *hdr_bitmap,
53                        struct ulp_rte_hdr_field         *hdr_field,
54                        uint32_t                         *field_idx,
55                        uint32_t                         *vlan_idx);
56
57 /* Function to handle the parsing of RTE Flow item port id Header. */
58 int32_t
59 ulp_rte_port_id_hdr_handler(const struct rte_flow_item  *item,
60                             struct ulp_rte_hdr_bitmap   *hdr_bitmap,
61                             struct ulp_rte_hdr_field    *hdr_field,
62                             uint32_t                    *field_idx,
63                             uint32_t                    *vlan_idx);
64
65 /* Function to handle the parsing of RTE Flow item port Header. */
66 int32_t
67 ulp_rte_phy_port_hdr_handler(const struct rte_flow_item *item,
68                              struct ulp_rte_hdr_bitmap  *hdr_bitmap,
69                              struct ulp_rte_hdr_field   *hdr_field,
70                              uint32_t                   *field_idx,
71                              uint32_t                   *vlan_idx);
72
73 /* Function to handle the RTE item Ethernet Header. */
74 int32_t
75 ulp_rte_eth_hdr_handler(const struct rte_flow_item      *item,
76                         struct ulp_rte_hdr_bitmap       *hdr_bitmap,
77                         struct ulp_rte_hdr_field        *hdr_field,
78                         uint32_t                        *field_idx,
79                         uint32_t                        *vlan_idx);
80
81 /* Function to handle the parsing of RTE Flow item Vlan Header. */
82 int32_t
83 ulp_rte_vlan_hdr_handler(const struct rte_flow_item     *item,
84                          struct ulp_rte_hdr_bitmap      *hdr_bitmap,
85                          struct ulp_rte_hdr_field       *hdr_field,
86                          uint32_t                       *field_idx,
87                          uint32_t                       *vlan_idx);
88
89 /* Function to handle the parsing of RTE Flow item IPV4 Header. */
90 int32_t
91 ulp_rte_ipv4_hdr_handler(const struct rte_flow_item     *item,
92                          struct ulp_rte_hdr_bitmap      *hdr_bitmap,
93                          struct ulp_rte_hdr_field       *hdr_field,
94                          uint32_t                       *field_idx,
95                          uint32_t                       *vlan_idx);
96
97 /* Function to handle the parsing of RTE Flow item IPV6 Header. */
98 int32_t
99 ulp_rte_ipv6_hdr_handler(const struct rte_flow_item     *item,
100                          struct ulp_rte_hdr_bitmap      *hdr_bitmap,
101                          struct ulp_rte_hdr_field       *hdr_field,
102                          uint32_t                       *field_idx,
103                          uint32_t                       *vlan_idx);
104
105 /* Function to handle the parsing of RTE Flow item UDP Header. */
106 int32_t
107 ulp_rte_udp_hdr_handler(const struct rte_flow_item      *item,
108                         struct ulp_rte_hdr_bitmap       *hdr_bitmap,
109                         struct ulp_rte_hdr_field        *hdr_field,
110                         uint32_t                        *field_idx,
111                         uint32_t                        *vlan_idx);
112
113 /* Function to handle the parsing of RTE Flow item TCP Header. */
114 int32_t
115 ulp_rte_tcp_hdr_handler(const struct rte_flow_item      *item,
116                         struct ulp_rte_hdr_bitmap       *hdr_bitmap,
117                         struct ulp_rte_hdr_field        *hdr_field,
118                         uint32_t                        *field_idx,
119                         uint32_t                        *vlan_idx);
120
121 /* Function to handle the parsing of RTE Flow item Vxlan Header. */
122 int32_t
123 ulp_rte_vxlan_hdr_handler(const struct rte_flow_item    *item,
124                           struct ulp_rte_hdr_bitmap     *hdrbitmap,
125                           struct ulp_rte_hdr_field      *hdr_field,
126                           uint32_t                      *field_idx,
127                           uint32_t                      *vlan_idx);
128
129 /* Function to handle the parsing of RTE Flow item void Header. */
130 int32_t
131 ulp_rte_void_hdr_handler(const struct rte_flow_item     *item,
132                          struct ulp_rte_hdr_bitmap      *hdr_bitmap,
133                          struct ulp_rte_hdr_field       *hdr_field,
134                          uint32_t                       *field_idx,
135                          uint32_t                       *vlan_idx);
136
137 /* Function to handle the parsing of RTE Flow action void Header. */
138 int32_t
139 ulp_rte_void_act_handler(const struct rte_flow_action   *action_item,
140                          struct ulp_rte_act_bitmap      *act,
141                          struct ulp_rte_act_prop        *act_prop);
142
143 /* Function to handle the parsing of RTE Flow action RSS Header. */
144 int32_t
145 ulp_rte_rss_act_handler(const struct rte_flow_action    *action_item,
146                         struct ulp_rte_act_bitmap       *act,
147                         struct ulp_rte_act_prop *act_prop);
148
149 /* Function to handle the parsing of RTE Flow action Mark Header. */
150 int32_t
151 ulp_rte_mark_act_handler(const struct rte_flow_action   *action_item,
152                          struct ulp_rte_act_bitmap      *act,
153                          struct ulp_rte_act_prop        *act_prop);
154
155 /* Function to handle the parsing of RTE Flow action vxlan_encap Header. */
156 int32_t
157 ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action    *action_item,
158                                 struct ulp_rte_act_bitmap       *act,
159                                 struct ulp_rte_act_prop         *act_prop);
160
161 /* Function to handle the parsing of RTE Flow action vxlan_encap Header. */
162 int32_t
163 ulp_rte_vxlan_decap_act_handler(const struct rte_flow_action    *action_item,
164                                 struct ulp_rte_act_bitmap       *act,
165                                 struct ulp_rte_act_prop         *act_prop);
166
167 /* Function to handle the parsing of RTE Flow action drop Header. */
168 int32_t
169 ulp_rte_drop_act_handler(const struct rte_flow_action   *action_item,
170                          struct ulp_rte_act_bitmap      *act,
171                          struct ulp_rte_act_prop        *act_prop);
172
173 /* Function to handle the parsing of RTE Flow action count. */
174 int32_t
175 ulp_rte_count_act_handler(const struct rte_flow_action  *action_item,
176                           struct ulp_rte_act_bitmap     *act,
177                           struct ulp_rte_act_prop       *act_prop);
178
179 /* Function to handle the parsing of RTE Flow action PF. */
180 int32_t
181 ulp_rte_pf_act_handler(const struct rte_flow_action     *action_item,
182                        struct ulp_rte_act_bitmap        *act,
183                        struct ulp_rte_act_prop          *act_prop);
184
185 /* Function to handle the parsing of RTE Flow action VF. */
186 int32_t
187 ulp_rte_vf_act_handler(const struct rte_flow_action     *action_item,
188                        struct ulp_rte_act_bitmap        *act,
189                        struct ulp_rte_act_prop          *act_prop);
190
191 /* Function to handle the parsing of RTE Flow action port_id. */
192 int32_t
193 ulp_rte_port_id_act_handler(const struct rte_flow_action        *act_item,
194                             struct ulp_rte_act_bitmap           *act,
195                             struct ulp_rte_act_prop             *act_p);
196
197 /* Function to handle the parsing of RTE Flow action phy_port. */
198 int32_t
199 ulp_rte_phy_port_act_handler(const struct rte_flow_action       *action_item,
200                              struct ulp_rte_act_bitmap          *act,
201                              struct ulp_rte_act_prop            *act_prop);
202
203 #endif /* _ULP_RTE_PARSER_H_ */