Dispatch parsed buffer to function calls. */
| 13131 | |
| 13132 | /** Dispatch parsed buffer to function calls. */ |
| 13133 | static void |
| 13134 | cmd_set_raw_parsed(const struct buffer *in) |
| 13135 | { |
| 13136 | uint32_t n = in->args.vc.pattern_n; |
| 13137 | int i = 0; |
| 13138 | struct rte_flow_item *item = NULL; |
| 13139 | size_t size = 0; |
| 13140 | uint8_t *data = NULL; |
| 13141 | uint8_t *data_tail = NULL; |
| 13142 | size_t *total_size = NULL; |
| 13143 | uint16_t upper_layer = 0; |
| 13144 | uint16_t proto = 0; |
| 13145 | uint16_t idx = in->port; /* We borrow port field as index */ |
| 13146 | int gtp_psc = -1; /* GTP PSC option index. */ |
| 13147 | const void *src_spec; |
| 13148 | |
| 13149 | if (in->command == SET_SAMPLE_ACTIONS) |
| 13150 | return cmd_set_raw_parsed_sample(in); |
| 13151 | else if (in->command == SET_IPV6_EXT_PUSH || |
| 13152 | in->command == SET_IPV6_EXT_REMOVE) |
| 13153 | return cmd_set_ipv6_ext_parsed(in); |
| 13154 | RTE_ASSERT(in->command == SET_RAW_ENCAP || |
| 13155 | in->command == SET_RAW_DECAP); |
| 13156 | if (in->command == SET_RAW_ENCAP) { |
| 13157 | total_size = &raw_encap_confs[idx].size; |
| 13158 | data = (uint8_t *)&raw_encap_confs[idx].data; |
| 13159 | } else { |
| 13160 | total_size = &raw_decap_confs[idx].size; |
| 13161 | data = (uint8_t *)&raw_decap_confs[idx].data; |
| 13162 | } |
| 13163 | *total_size = 0; |
| 13164 | memset(data, 0x00, ACTION_RAW_ENCAP_MAX_DATA); |
| 13165 | /* process hdr from upper layer to low layer (L3/L4 -> L2). */ |
| 13166 | data_tail = data + ACTION_RAW_ENCAP_MAX_DATA; |
| 13167 | for (i = n - 1 ; i >= 0; --i) { |
| 13168 | const struct rte_flow_item_gtp *gtp; |
| 13169 | const struct rte_flow_item_geneve_opt *opt; |
| 13170 | struct rte_flow_item_ipv6_routing_ext *ext; |
| 13171 | |
| 13172 | item = in->args.vc.pattern + i; |
| 13173 | if (item->spec == NULL) |
| 13174 | item->spec = flow_item_default_mask(item); |
| 13175 | src_spec = item->spec; |
| 13176 | switch (item->type) { |
| 13177 | case RTE_FLOW_ITEM_TYPE_ETH: |
| 13178 | size = sizeof(struct rte_ether_hdr); |
| 13179 | break; |
| 13180 | case RTE_FLOW_ITEM_TYPE_VLAN: |
| 13181 | size = sizeof(struct rte_vlan_hdr); |
| 13182 | proto = RTE_ETHER_TYPE_VLAN; |
| 13183 | break; |
| 13184 | case RTE_FLOW_ITEM_TYPE_IPV4: |
| 13185 | size = sizeof(struct rte_ipv4_hdr); |
| 13186 | proto = RTE_ETHER_TYPE_IPV4; |
| 13187 | break; |
| 13188 | case RTE_FLOW_ITEM_TYPE_IPV6: |
| 13189 | size = sizeof(struct rte_ipv6_hdr); |
| 13190 | proto = RTE_ETHER_TYPE_IPV6; |
no test coverage detected