| 12757 | /** set cmd facility. Reuse cmd flow's infrastructure as much as possible. */ |
| 12758 | |
| 12759 | static void |
| 12760 | update_fields(uint8_t *buf, struct rte_flow_item *item, uint16_t next_proto) |
| 12761 | { |
| 12762 | struct rte_ipv4_hdr *ipv4; |
| 12763 | struct rte_ether_hdr *eth; |
| 12764 | struct rte_ipv6_hdr *ipv6; |
| 12765 | struct rte_vxlan_hdr *vxlan; |
| 12766 | struct rte_vxlan_gpe_hdr *gpe; |
| 12767 | struct rte_flow_item_nvgre *nvgre; |
| 12768 | uint32_t ipv6_vtc_flow; |
| 12769 | |
| 12770 | switch (item->type) { |
| 12771 | case RTE_FLOW_ITEM_TYPE_ETH: |
| 12772 | eth = (struct rte_ether_hdr *)buf; |
| 12773 | if (next_proto) |
| 12774 | eth->ether_type = rte_cpu_to_be_16(next_proto); |
| 12775 | break; |
| 12776 | case RTE_FLOW_ITEM_TYPE_IPV4: |
| 12777 | ipv4 = (struct rte_ipv4_hdr *)buf; |
| 12778 | if (!ipv4->version_ihl) |
| 12779 | ipv4->version_ihl = RTE_IPV4_VHL_DEF; |
| 12780 | if (next_proto && ipv4->next_proto_id == 0) |
| 12781 | ipv4->next_proto_id = (uint8_t)next_proto; |
| 12782 | break; |
| 12783 | case RTE_FLOW_ITEM_TYPE_IPV6: |
| 12784 | ipv6 = (struct rte_ipv6_hdr *)buf; |
| 12785 | if (next_proto && ipv6->proto == 0) |
| 12786 | ipv6->proto = (uint8_t)next_proto; |
| 12787 | ipv6_vtc_flow = rte_be_to_cpu_32(ipv6->vtc_flow); |
| 12788 | ipv6_vtc_flow &= 0x0FFFFFFF; /*< reset version bits. */ |
| 12789 | ipv6_vtc_flow |= 0x60000000; /*< set ipv6 version. */ |
| 12790 | ipv6->vtc_flow = rte_cpu_to_be_32(ipv6_vtc_flow); |
| 12791 | break; |
| 12792 | case RTE_FLOW_ITEM_TYPE_VXLAN: |
| 12793 | vxlan = (struct rte_vxlan_hdr *)buf; |
| 12794 | vxlan->vx_flags = 0x08; |
| 12795 | break; |
| 12796 | case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: |
| 12797 | gpe = (struct rte_vxlan_gpe_hdr *)buf; |
| 12798 | gpe->vx_flags = 0x0C; |
| 12799 | break; |
| 12800 | case RTE_FLOW_ITEM_TYPE_NVGRE: |
| 12801 | nvgre = (struct rte_flow_item_nvgre *)buf; |
| 12802 | nvgre->protocol = rte_cpu_to_be_16(0x6558); |
| 12803 | nvgre->c_k_s_rsvd0_ver = rte_cpu_to_be_16(0x2000); |
| 12804 | break; |
| 12805 | default: |
| 12806 | break; |
| 12807 | } |
| 12808 | } |
| 12809 | |
| 12810 | /** Helper of get item's default mask. */ |
| 12811 | static const void * |
no outgoing calls
no test coverage detected