diff options
Diffstat (limited to 'src/dpdk/drivers/net/i40e/i40e_flow.c')
-rw-r--r-- | src/dpdk/drivers/net/i40e/i40e_flow.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/src/dpdk/drivers/net/i40e/i40e_flow.c b/src/dpdk/drivers/net/i40e/i40e_flow.c index 76bb3320..c6e4d877 100644 --- a/src/dpdk/drivers/net/i40e/i40e_flow.c +++ b/src/dpdk/drivers/net/i40e/i40e_flow.c @@ -1223,6 +1223,7 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern, bool is_vni_masked = 0; enum rte_flow_item_type item_type; bool vxlan_flag = 0; + uint32_t tenant_id_be = 0; for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { if (item->last) { @@ -1306,16 +1307,40 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern, } break; case RTE_FLOW_ITEM_TYPE_IPV4: + filter->ip_type = RTE_TUNNEL_IPTYPE_IPV4; + /* IPv4 is used to describe protocol, + * spec amd mask should be NULL. + */ + if (item->spec || item->mask) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid IPv4 item"); + return -rte_errno; + } + break; case RTE_FLOW_ITEM_TYPE_IPV6: + filter->ip_type = RTE_TUNNEL_IPTYPE_IPV6; + /* IPv6 is used to describe protocol, + * spec amd mask should be NULL. + */ + if (item->spec || item->mask) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid IPv6 item"); + return -rte_errno; + } + break; case RTE_FLOW_ITEM_TYPE_UDP: - /* IPv4/IPv6/UDP are used to describe protocol, + /* UDP is used to describe protocol, * spec amd mask should be NULL. */ if (item->spec || item->mask) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, - "Invalid IPv4 item"); + "Invalid UDP item"); return -rte_errno; } break; @@ -1364,8 +1389,9 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern, & I40E_TCI_MASK; if (vxlan_spec && vxlan_mask && !is_vni_masked) { /* If there's vxlan */ - rte_memcpy(&filter->tenant_id, vxlan_spec->vni, - RTE_DIM(vxlan_spec->vni)); + rte_memcpy(((uint8_t *)&tenant_id_be + 1), + vxlan_spec->vni, 3); + filter->tenant_id = rte_be_to_cpu_32(tenant_id_be); if (!o_eth_spec && !o_eth_mask && i_eth_spec && i_eth_mask) filter->filter_type = @@ -1402,8 +1428,9 @@ i40e_flow_parse_vxlan_pattern(const struct rte_flow_item *pattern, /* If there's no inner vlan */ if (vxlan_spec && vxlan_mask && !is_vni_masked) { /* If there's vxlan */ - rte_memcpy(&filter->tenant_id, vxlan_spec->vni, - RTE_DIM(vxlan_spec->vni)); + rte_memcpy(((uint8_t *)&tenant_id_be + 1), + vxlan_spec->vni, 3); + filter->tenant_id = rte_be_to_cpu_32(tenant_id_be); if (!o_eth_spec && !o_eth_mask && i_eth_spec && i_eth_mask) filter->filter_type = |