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_svif_process(struct ulp_rte_parser_params *params); 37 38 /* Function to handle the implicit VNIC RTE port id */ 39 int32_t 40 ulp_rte_parser_vnic_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 /* Function to handle the parsing of RTE Flow item PF Header. */ 59 int32_t 60 ulp_rte_pf_hdr_handler(const struct rte_flow_item *item, 61 struct ulp_rte_parser_params *params); 62 63 /* Function to handle the parsing of RTE Flow item VF Header. */ 64 int32_t 65 ulp_rte_vf_hdr_handler(const struct rte_flow_item *item, 66 struct ulp_rte_parser_params *params); 67 68 /* Function to handle the parsing of RTE Flow item port id Header. */ 69 int32_t 70 ulp_rte_port_id_hdr_handler(const struct rte_flow_item *item, 71 struct ulp_rte_parser_params *params); 72 73 /* Function to handle the parsing of RTE Flow item port Header. */ 74 int32_t 75 ulp_rte_phy_port_hdr_handler(const struct rte_flow_item *item, 76 struct ulp_rte_parser_params *params); 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_parser_params *params); 82 83 /* Function to handle the parsing of RTE Flow item Vlan Header. */ 84 int32_t 85 ulp_rte_vlan_hdr_handler(const struct rte_flow_item *item, 86 struct ulp_rte_parser_params *params); 87 88 /* Function to handle the parsing of RTE Flow item IPV4 Header. */ 89 int32_t 90 ulp_rte_ipv4_hdr_handler(const struct rte_flow_item *item, 91 struct ulp_rte_parser_params *params); 92 93 /* Function to handle the parsing of RTE Flow item IPV6 Header. */ 94 int32_t 95 ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item, 96 struct ulp_rte_parser_params *params); 97 98 /* Function to handle the parsing of RTE Flow item UDP Header. */ 99 int32_t 100 ulp_rte_udp_hdr_handler(const struct rte_flow_item *item, 101 struct ulp_rte_parser_params *params); 102 103 /* Function to handle the parsing of RTE Flow item TCP Header. */ 104 int32_t 105 ulp_rte_tcp_hdr_handler(const struct rte_flow_item *item, 106 struct ulp_rte_parser_params *params); 107 108 /* Function to handle the parsing of RTE Flow item Vxlan Header. */ 109 int32_t 110 ulp_rte_vxlan_hdr_handler(const struct rte_flow_item *item, 111 struct ulp_rte_parser_params *params); 112 113 /* Function to handle the parsing of RTE Flow item void Header. */ 114 int32_t 115 ulp_rte_void_hdr_handler(const struct rte_flow_item *item, 116 struct ulp_rte_parser_params *params); 117 118 /* Function to handle the parsing of RTE Flow action void Header. */ 119 int32_t 120 ulp_rte_void_act_handler(const struct rte_flow_action *action_item, 121 struct ulp_rte_parser_params *params); 122 123 /* Function to handle the parsing of RTE Flow action RSS Header. */ 124 int32_t 125 ulp_rte_rss_act_handler(const struct rte_flow_action *action_item, 126 struct ulp_rte_parser_params *params); 127 128 /* Function to handle the parsing of RTE Flow action Mark Header. */ 129 int32_t 130 ulp_rte_mark_act_handler(const struct rte_flow_action *action_item, 131 struct ulp_rte_parser_params *params); 132 133 /* Function to handle the parsing of RTE Flow action vxlan_encap Header. */ 134 int32_t 135 ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item, 136 struct ulp_rte_parser_params *params); 137 138 /* Function to handle the parsing of RTE Flow action vxlan_encap Header. */ 139 int32_t 140 ulp_rte_vxlan_decap_act_handler(const struct rte_flow_action *action_item, 141 struct ulp_rte_parser_params *params); 142 143 /* Function to handle the parsing of RTE Flow action drop Header. */ 144 int32_t 145 ulp_rte_drop_act_handler(const struct rte_flow_action *action_item, 146 struct ulp_rte_parser_params *params); 147 148 /* Function to handle the parsing of RTE Flow action count. */ 149 int32_t 150 ulp_rte_count_act_handler(const struct rte_flow_action *action_item, 151 struct ulp_rte_parser_params *params); 152 153 /* Function to handle the parsing of RTE Flow action PF. */ 154 int32_t 155 ulp_rte_pf_act_handler(const struct rte_flow_action *action_item, 156 struct ulp_rte_parser_params *params); 157 158 /* Function to handle the parsing of RTE Flow action VF. */ 159 int32_t 160 ulp_rte_vf_act_handler(const struct rte_flow_action *action_item, 161 struct ulp_rte_parser_params *params); 162 163 /* Function to handle the parsing of RTE Flow action port_id. */ 164 int32_t 165 ulp_rte_port_id_act_handler(const struct rte_flow_action *act_item, 166 struct ulp_rte_parser_params *params); 167 168 /* Function to handle the parsing of RTE Flow action phy_port. */ 169 int32_t 170 ulp_rte_phy_port_act_handler(const struct rte_flow_action *action_item, 171 struct ulp_rte_parser_params *params); 172 173 #endif /* _ULP_RTE_PARSER_H_ */ 174