1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2014-2020 Broadcom
6 #ifndef _ULP_RTE_PARSER_H_
7 #define _ULP_RTE_PARSER_H_
11 #include <rte_flow_driver.h>
12 #include "ulp_template_db_enum.h"
13 #include "ulp_template_struct.h"
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_VTC_FLOW 4
21 #define BNXT_ULP_ENCAP_IPV6_PROTO_TTL 2
22 #define BNXT_ULP_ENCAP_IPV6_DO 2
23 #define BNXT_ULP_ENCAP_IPV6_SIZE 24
24 #define BNXT_ULP_ENCAP_UDP_SIZE 4
25 #define BNXT_ULP_INVALID_SVIF_VAL -1U
27 #define BNXT_ULP_GET_IPV6_VER(vtcf) \
28 (((vtcf) & BNXT_ULP_PARSER_IPV6_VER_MASK) >> 28)
29 #define BNXT_ULP_GET_IPV6_TC(vtcf) \
30 (((vtcf) & BNXT_ULP_PARSER_IPV6_TC) >> 20)
31 #define BNXT_ULP_GET_IPV6_FLOWLABEL(vtcf) \
32 ((vtcf) & BNXT_ULP_PARSER_IPV6_FLOW_LABEL)
33 #define BNXT_ULP_PARSER_IPV6_VER_MASK 0xf0000000
34 #define BNXT_ULP_PARSER_IPV6_TC 0x0ff00000
35 #define BNXT_ULP_PARSER_IPV6_FLOW_LABEL 0x000fffff
37 /* Function to handle the parsing of the RTE port id. */
39 ulp_rte_parser_implicit_match_port_process(struct ulp_rte_parser_params *param);
41 /* Function to handle the implicit action port id */
43 ulp_rte_parser_implicit_act_port_process(struct ulp_rte_parser_params *params);
46 * Function to handle the parsing of RTE Flows and placing
47 * the RTE flow items into the ulp structures.
50 bnxt_ulp_rte_parser_hdr_parse(const struct rte_flow_item pattern[],
51 struct ulp_rte_parser_params *params);
54 * Function to handle the parsing of RTE Flows and placing
55 * the RTE flow actions into the ulp structures.
58 bnxt_ulp_rte_parser_act_parse(const struct rte_flow_action actions[],
59 struct ulp_rte_parser_params *params);
62 * Function to handle the post processing of the parsing details
65 bnxt_ulp_rte_parser_post_process(struct ulp_rte_parser_params *params);
67 /* Function to handle the parsing of RTE Flow item PF Header. */
69 ulp_rte_pf_hdr_handler(const struct rte_flow_item *item,
70 struct ulp_rte_parser_params *params);
72 /* Function to handle the parsing of RTE Flow item VF Header. */
74 ulp_rte_vf_hdr_handler(const struct rte_flow_item *item,
75 struct ulp_rte_parser_params *params);
77 /* Function to handle the parsing of RTE Flow item port id Header. */
79 ulp_rte_port_id_hdr_handler(const struct rte_flow_item *item,
80 struct ulp_rte_parser_params *params);
82 /* Function to handle the parsing of RTE Flow item port Header. */
84 ulp_rte_phy_port_hdr_handler(const struct rte_flow_item *item,
85 struct ulp_rte_parser_params *params);
87 /* Function to handle the RTE item Ethernet Header. */
89 ulp_rte_eth_hdr_handler(const struct rte_flow_item *item,
90 struct ulp_rte_parser_params *params);
92 /* Function to handle the parsing of RTE Flow item Vlan Header. */
94 ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item,
95 struct ulp_rte_parser_params *params);
97 /* Function to handle the parsing of RTE Flow item IPV4 Header. */
99 ulp_rte_ipv4_hdr_handler(const struct rte_flow_item *item,
100 struct ulp_rte_parser_params *params);
102 /* Function to handle the parsing of RTE Flow item IPV6 Header. */
104 ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item,
105 struct ulp_rte_parser_params *params);
107 /* Function to handle the parsing of RTE Flow item UDP Header. */
109 ulp_rte_udp_hdr_handler(const struct rte_flow_item *item,
110 struct ulp_rte_parser_params *params);
112 /* Function to handle the parsing of RTE Flow item TCP Header. */
114 ulp_rte_tcp_hdr_handler(const struct rte_flow_item *item,
115 struct ulp_rte_parser_params *params);
117 /* Function to handle the parsing of RTE Flow item Vxlan Header. */
119 ulp_rte_vxlan_hdr_handler(const struct rte_flow_item *item,
120 struct ulp_rte_parser_params *params);
122 /* Function to handle the parsing of RTE Flow item void Header. */
124 ulp_rte_void_hdr_handler(const struct rte_flow_item *item,
125 struct ulp_rte_parser_params *params);
127 /* Function to handle the parsing of RTE Flow action void Header. */
129 ulp_rte_void_act_handler(const struct rte_flow_action *action_item,
130 struct ulp_rte_parser_params *params);
132 /* Function to handle the parsing of RTE Flow action RSS Header. */
134 ulp_rte_rss_act_handler(const struct rte_flow_action *action_item,
135 struct ulp_rte_parser_params *params);
137 /* Function to handle the parsing of RTE Flow action Mark Header. */
139 ulp_rte_mark_act_handler(const struct rte_flow_action *action_item,
140 struct ulp_rte_parser_params *params);
142 /* Function to handle the parsing of RTE Flow action vxlan_encap Header. */
144 ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item,
145 struct ulp_rte_parser_params *params);
147 /* Function to handle the parsing of RTE Flow action vxlan_encap Header. */
149 ulp_rte_vxlan_decap_act_handler(const struct rte_flow_action *action_item,
150 struct ulp_rte_parser_params *params);
152 /* Function to handle the parsing of RTE Flow action drop Header. */
154 ulp_rte_drop_act_handler(const struct rte_flow_action *action_item,
155 struct ulp_rte_parser_params *params);
157 /* Function to handle the parsing of RTE Flow action count. */
159 ulp_rte_count_act_handler(const struct rte_flow_action *action_item,
160 struct ulp_rte_parser_params *params);
162 /* Function to handle the parsing of RTE Flow action PF. */
164 ulp_rte_pf_act_handler(const struct rte_flow_action *action_item,
165 struct ulp_rte_parser_params *params);
167 /* Function to handle the parsing of RTE Flow action VF. */
169 ulp_rte_vf_act_handler(const struct rte_flow_action *action_item,
170 struct ulp_rte_parser_params *params);
172 /* Function to handle the parsing of RTE Flow action port_id. */
174 ulp_rte_port_id_act_handler(const struct rte_flow_action *act_item,
175 struct ulp_rte_parser_params *params);
177 /* Function to handle the parsing of RTE Flow action phy_port. */
179 ulp_rte_phy_port_act_handler(const struct rte_flow_action *action_item,
180 struct ulp_rte_parser_params *params);
182 /* Function to handle the parsing of RTE Flow action pop vlan. */
184 ulp_rte_of_pop_vlan_act_handler(const struct rte_flow_action *action_item,
185 struct ulp_rte_parser_params *params);
187 /* Function to handle the parsing of RTE Flow action push vlan. */
189 ulp_rte_of_push_vlan_act_handler(const struct rte_flow_action *action_item,
190 struct ulp_rte_parser_params *params);
192 /* Function to handle the parsing of RTE Flow action set vlan id. */
194 ulp_rte_of_set_vlan_vid_act_handler(const struct rte_flow_action *action_item,
195 struct ulp_rte_parser_params *params);
197 /* Function to handle the parsing of RTE Flow action set vlan pcp. */
199 ulp_rte_of_set_vlan_pcp_act_handler(const struct rte_flow_action *action_item,
200 struct ulp_rte_parser_params *params);
202 /* Function to handle the parsing of RTE Flow action set ipv4 src.*/
204 ulp_rte_set_ipv4_src_act_handler(const struct rte_flow_action *action_item,
205 struct ulp_rte_parser_params *params);
207 /* Function to handle the parsing of RTE Flow action set ipv4 dst.*/
209 ulp_rte_set_ipv4_dst_act_handler(const struct rte_flow_action *action_item,
210 struct ulp_rte_parser_params *params);
212 /* Function to handle the parsing of RTE Flow action set tp src.*/
214 ulp_rte_set_tp_src_act_handler(const struct rte_flow_action *action_item,
215 struct ulp_rte_parser_params *params);
217 /* Function to handle the parsing of RTE Flow action set tp dst.*/
219 ulp_rte_set_tp_dst_act_handler(const struct rte_flow_action *action_item,
220 struct ulp_rte_parser_params *params);
222 /* Function to handle the parsing of RTE Flow action dec ttl.*/
224 ulp_rte_dec_ttl_act_handler(const struct rte_flow_action *action_item,
225 struct ulp_rte_parser_params *params);
227 #endif /* _ULP_RTE_PARSER_H_ */