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_enum.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 #define BNXT_ULP_INVALID_SVIF_VAL -1U 23 24 #define BNXT_ULP_GET_IPV6_VER(vtcf) \ 25 (((vtcf) & BNXT_ULP_PARSER_IPV6_VER_MASK) >> 28) 26 #define BNXT_ULP_GET_IPV6_TC(vtcf) \ 27 (((vtcf) & BNXT_ULP_PARSER_IPV6_TC) >> 20) 28 #define BNXT_ULP_GET_IPV6_FLOWLABEL(vtcf) \ 29 ((vtcf) & BNXT_ULP_PARSER_IPV6_FLOW_LABEL) 30 #define BNXT_ULP_PARSER_IPV6_VER_MASK 0xf0000000 31 #define BNXT_ULP_PARSER_IPV6_TC 0x0ff00000 32 #define BNXT_ULP_PARSER_IPV6_FLOW_LABEL 0x000fffff 33 34 /* Function to handle the parsing of the RTE port id. */ 35 int32_t 36 ulp_rte_parser_implicit_match_port_process(struct ulp_rte_parser_params *param); 37 38 /* Function to handle the implicit action port id */ 39 int32_t 40 ulp_rte_parser_implicit_act_port_process(struct ulp_rte_parser_params *params); 41 42 /* 43 * Function to handle the parsing of RTE Flows and placing 44 * the RTE flow items into the ulp structures. 45 */ 46 int32_t 47 bnxt_ulp_rte_parser_hdr_parse(const struct rte_flow_item pattern[], 48 struct ulp_rte_parser_params *params); 49 50 /* 51 * Function to handle the parsing of RTE Flows and placing 52 * the RTE flow actions into the ulp structures. 53 */ 54 int32_t 55 bnxt_ulp_rte_parser_act_parse(const struct rte_flow_action actions[], 56 struct ulp_rte_parser_params *params); 57 58 /* 59 * Function to handle the post processing of the parsing details 60 */ 61 int32_t 62 bnxt_ulp_rte_parser_post_process(struct ulp_rte_parser_params *params); 63 64 /* Function to handle the parsing of RTE Flow item PF Header. */ 65 int32_t 66 ulp_rte_pf_hdr_handler(const struct rte_flow_item *item, 67 struct ulp_rte_parser_params *params); 68 69 /* Function to handle the parsing of RTE Flow item VF Header. */ 70 int32_t 71 ulp_rte_vf_hdr_handler(const struct rte_flow_item *item, 72 struct ulp_rte_parser_params *params); 73 74 /* Function to handle the parsing of RTE Flow item port id Header. */ 75 int32_t 76 ulp_rte_port_id_hdr_handler(const struct rte_flow_item *item, 77 struct ulp_rte_parser_params *params); 78 79 /* Function to handle the parsing of RTE Flow item port Header. */ 80 int32_t 81 ulp_rte_phy_port_hdr_handler(const struct rte_flow_item *item, 82 struct ulp_rte_parser_params *params); 83 84 /* Function to handle the RTE item Ethernet Header. */ 85 int32_t 86 ulp_rte_eth_hdr_handler(const struct rte_flow_item *item, 87 struct ulp_rte_parser_params *params); 88 89 /* Function to handle the parsing of RTE Flow item Vlan Header. */ 90 int32_t 91 ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item, 92 struct ulp_rte_parser_params *params); 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_parser_params *params); 98 99 /* Function to handle the parsing of RTE Flow item IPV6 Header. */ 100 int32_t 101 ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item, 102 struct ulp_rte_parser_params *params); 103 104 /* Function to handle the parsing of RTE Flow item UDP Header. */ 105 int32_t 106 ulp_rte_udp_hdr_handler(const struct rte_flow_item *item, 107 struct ulp_rte_parser_params *params); 108 109 /* Function to handle the parsing of RTE Flow item TCP Header. */ 110 int32_t 111 ulp_rte_tcp_hdr_handler(const struct rte_flow_item *item, 112 struct ulp_rte_parser_params *params); 113 114 /* Function to handle the parsing of RTE Flow item Vxlan Header. */ 115 int32_t 116 ulp_rte_vxlan_hdr_handler(const struct rte_flow_item *item, 117 struct ulp_rte_parser_params *params); 118 119 /* Function to handle the parsing of RTE Flow item void Header. */ 120 int32_t 121 ulp_rte_void_hdr_handler(const struct rte_flow_item *item, 122 struct ulp_rte_parser_params *params); 123 124 /* Function to handle the parsing of RTE Flow action void Header. */ 125 int32_t 126 ulp_rte_void_act_handler(const struct rte_flow_action *action_item, 127 struct ulp_rte_parser_params *params); 128 129 /* Function to handle the parsing of RTE Flow action RSS Header. */ 130 int32_t 131 ulp_rte_rss_act_handler(const struct rte_flow_action *action_item, 132 struct ulp_rte_parser_params *params); 133 134 /* Function to handle the parsing of RTE Flow action Mark Header. */ 135 int32_t 136 ulp_rte_mark_act_handler(const struct rte_flow_action *action_item, 137 struct ulp_rte_parser_params *params); 138 139 /* Function to handle the parsing of RTE Flow action vxlan_encap Header. */ 140 int32_t 141 ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item, 142 struct ulp_rte_parser_params *params); 143 144 /* Function to handle the parsing of RTE Flow action vxlan_encap Header. */ 145 int32_t 146 ulp_rte_vxlan_decap_act_handler(const struct rte_flow_action *action_item, 147 struct ulp_rte_parser_params *params); 148 149 /* Function to handle the parsing of RTE Flow action drop Header. */ 150 int32_t 151 ulp_rte_drop_act_handler(const struct rte_flow_action *action_item, 152 struct ulp_rte_parser_params *params); 153 154 /* Function to handle the parsing of RTE Flow action count. */ 155 int32_t 156 ulp_rte_count_act_handler(const struct rte_flow_action *action_item, 157 struct ulp_rte_parser_params *params); 158 159 /* Function to handle the parsing of RTE Flow action PF. */ 160 int32_t 161 ulp_rte_pf_act_handler(const struct rte_flow_action *action_item, 162 struct ulp_rte_parser_params *params); 163 164 /* Function to handle the parsing of RTE Flow action VF. */ 165 int32_t 166 ulp_rte_vf_act_handler(const struct rte_flow_action *action_item, 167 struct ulp_rte_parser_params *params); 168 169 /* Function to handle the parsing of RTE Flow action port_id. */ 170 int32_t 171 ulp_rte_port_id_act_handler(const struct rte_flow_action *act_item, 172 struct ulp_rte_parser_params *params); 173 174 /* Function to handle the parsing of RTE Flow action phy_port. */ 175 int32_t 176 ulp_rte_phy_port_act_handler(const struct rte_flow_action *action_item, 177 struct ulp_rte_parser_params *params); 178 179 /* Function to handle the parsing of RTE Flow action pop vlan. */ 180 int32_t 181 ulp_rte_of_pop_vlan_act_handler(const struct rte_flow_action *action_item, 182 struct ulp_rte_parser_params *params); 183 184 /* Function to handle the parsing of RTE Flow action push vlan. */ 185 int32_t 186 ulp_rte_of_push_vlan_act_handler(const struct rte_flow_action *action_item, 187 struct ulp_rte_parser_params *params); 188 189 /* Function to handle the parsing of RTE Flow action set vlan id. */ 190 int32_t 191 ulp_rte_of_set_vlan_vid_act_handler(const struct rte_flow_action *action_item, 192 struct ulp_rte_parser_params *params); 193 194 /* Function to handle the parsing of RTE Flow action set vlan pcp. */ 195 int32_t 196 ulp_rte_of_set_vlan_pcp_act_handler(const struct rte_flow_action *action_item, 197 struct ulp_rte_parser_params *params); 198 199 /* Function to handle the parsing of RTE Flow action set ipv4 src.*/ 200 int32_t 201 ulp_rte_set_ipv4_src_act_handler(const struct rte_flow_action *action_item, 202 struct ulp_rte_parser_params *params); 203 204 /* Function to handle the parsing of RTE Flow action set ipv4 dst.*/ 205 int32_t 206 ulp_rte_set_ipv4_dst_act_handler(const struct rte_flow_action *action_item, 207 struct ulp_rte_parser_params *params); 208 209 /* Function to handle the parsing of RTE Flow action set tp src.*/ 210 int32_t 211 ulp_rte_set_tp_src_act_handler(const struct rte_flow_action *action_item, 212 struct ulp_rte_parser_params *params); 213 214 /* Function to handle the parsing of RTE Flow action set tp dst.*/ 215 int32_t 216 ulp_rte_set_tp_dst_act_handler(const struct rte_flow_action *action_item, 217 struct ulp_rte_parser_params *params); 218 219 #endif /* _ULP_RTE_PARSER_H_ */ 220