xref: /dpdk/drivers/net/bnxt/tf_ulp/ulp_rte_parser.h (revision e11bdd37745229bf26b557305c07d118c3dbaad7)
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_parser_params *params);
26 
27 /* Function to handle the implicit VNIC RTE port id */
28 int32_t
29 ulp_rte_parser_vnic_process(struct ulp_rte_parser_params *params);
30 
31 /*
32  * Function to handle the parsing of RTE Flows and placing
33  * the RTE flow items into the ulp structures.
34  */
35 int32_t
36 bnxt_ulp_rte_parser_hdr_parse(const struct rte_flow_item pattern[],
37 			      struct ulp_rte_parser_params *params);
38 
39 /*
40  * Function to handle the parsing of RTE Flows and placing
41  * the RTE flow actions into the ulp structures.
42  */
43 int32_t
44 bnxt_ulp_rte_parser_act_parse(const struct rte_flow_action actions[],
45 			      struct ulp_rte_parser_params *params);
46 
47 /* Function to handle the parsing of RTE Flow item PF Header. */
48 int32_t
49 ulp_rte_pf_hdr_handler(const struct rte_flow_item *item,
50 		       struct ulp_rte_parser_params *params);
51 
52 /* Function to handle the parsing of RTE Flow item VF Header. */
53 int32_t
54 ulp_rte_vf_hdr_handler(const struct rte_flow_item *item,
55 		       struct ulp_rte_parser_params *params);
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_parser_params *params);
61 
62 /* Function to handle the parsing of RTE Flow item port Header. */
63 int32_t
64 ulp_rte_phy_port_hdr_handler(const struct rte_flow_item *item,
65 			     struct ulp_rte_parser_params *params);
66 
67 /* Function to handle the RTE item Ethernet Header. */
68 int32_t
69 ulp_rte_eth_hdr_handler(const struct rte_flow_item *item,
70 			struct ulp_rte_parser_params *params);
71 
72 /* Function to handle the parsing of RTE Flow item Vlan Header. */
73 int32_t
74 ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item,
75 			 struct ulp_rte_parser_params *params);
76 
77 /* Function to handle the parsing of RTE Flow item IPV4 Header. */
78 int32_t
79 ulp_rte_ipv4_hdr_handler(const struct rte_flow_item *item,
80 			 struct ulp_rte_parser_params *params);
81 
82 /* Function to handle the parsing of RTE Flow item IPV6 Header. */
83 int32_t
84 ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item,
85 			 struct ulp_rte_parser_params *params);
86 
87 /* Function to handle the parsing of RTE Flow item UDP Header. */
88 int32_t
89 ulp_rte_udp_hdr_handler(const struct rte_flow_item *item,
90 			struct ulp_rte_parser_params *params);
91 
92 /* Function to handle the parsing of RTE Flow item TCP Header. */
93 int32_t
94 ulp_rte_tcp_hdr_handler(const struct rte_flow_item *item,
95 			struct ulp_rte_parser_params *params);
96 
97 /* Function to handle the parsing of RTE Flow item Vxlan Header. */
98 int32_t
99 ulp_rte_vxlan_hdr_handler(const struct rte_flow_item *item,
100 			  struct ulp_rte_parser_params *params);
101 
102 /* Function to handle the parsing of RTE Flow item void Header. */
103 int32_t
104 ulp_rte_void_hdr_handler(const struct rte_flow_item *item,
105 			 struct ulp_rte_parser_params *params);
106 
107 /* Function to handle the parsing of RTE Flow action void Header. */
108 int32_t
109 ulp_rte_void_act_handler(const struct rte_flow_action *action_item,
110 			 struct ulp_rte_parser_params *params);
111 
112 /* Function to handle the parsing of RTE Flow action RSS Header. */
113 int32_t
114 ulp_rte_rss_act_handler(const struct rte_flow_action *action_item,
115 			struct ulp_rte_parser_params *params);
116 
117 /* Function to handle the parsing of RTE Flow action Mark Header. */
118 int32_t
119 ulp_rte_mark_act_handler(const struct rte_flow_action *action_item,
120 			 struct ulp_rte_parser_params *params);
121 
122 /* Function to handle the parsing of RTE Flow action vxlan_encap Header. */
123 int32_t
124 ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item,
125 				struct ulp_rte_parser_params *params);
126 
127 /* Function to handle the parsing of RTE Flow action vxlan_encap Header. */
128 int32_t
129 ulp_rte_vxlan_decap_act_handler(const struct rte_flow_action *action_item,
130 				struct ulp_rte_parser_params *params);
131 
132 /* Function to handle the parsing of RTE Flow action drop Header. */
133 int32_t
134 ulp_rte_drop_act_handler(const struct rte_flow_action *action_item,
135 			 struct ulp_rte_parser_params *params);
136 
137 /* Function to handle the parsing of RTE Flow action count. */
138 int32_t
139 ulp_rte_count_act_handler(const struct rte_flow_action *action_item,
140 			  struct ulp_rte_parser_params *params);
141 
142 /* Function to handle the parsing of RTE Flow action PF. */
143 int32_t
144 ulp_rte_pf_act_handler(const struct rte_flow_action *action_item,
145 		       struct ulp_rte_parser_params *params);
146 
147 /* Function to handle the parsing of RTE Flow action VF. */
148 int32_t
149 ulp_rte_vf_act_handler(const struct rte_flow_action *action_item,
150 		       struct ulp_rte_parser_params *params);
151 
152 /* Function to handle the parsing of RTE Flow action port_id. */
153 int32_t
154 ulp_rte_port_id_act_handler(const struct rte_flow_action *act_item,
155 			    struct ulp_rte_parser_params *params);
156 
157 /* Function to handle the parsing of RTE Flow action phy_port. */
158 int32_t
159 ulp_rte_phy_port_act_handler(const struct rte_flow_action *action_item,
160 			     struct ulp_rte_parser_params *params);
161 
162 #endif /* _ULP_RTE_PARSER_H_ */
163