[dpdk-dev] [PATCH] net/i40e: fix parsing tunnel filter issue

Ferruh Yigit ferruh.yigit at intel.com
Tue Jan 24 16:17:30 CET 2017


On 1/24/2017 2:44 AM, Beilei Xing wrote:
> VNI of VXLAN is parsed wrongly. The root cause is that
> array vni in item VXLAN also uses network byte ordering.
> 
> Fixes: d416530e6358 ("net/i40e: parse tunnel filter")
> 
> Signed-off-by: Beilei Xing <beilei.xing at intel.com>
> ---
>  drivers/net/i40e/i40e_flow.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
> index 76bb332..51b3223 100644
> --- a/drivers/net/i40e/i40e_flow.c
> +++ b/drivers/net/i40e/i40e_flow.c
> @@ -1196,6 +1196,20 @@ i40e_check_tenant_id_mask(const uint8_t *mask)
>  	return is_masked;
>  }
>  
> +static uint32_t
> +i40e_flow_set_tenant_id(const uint8_t *vni)
> +{
> +	uint32_t tenant_id;
> +
> +#if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> +	tenant_id = (vni[0] << 16) | (vni[1] << 8) | vni[2];
> +#else
> +	tenant_id = vni[0] | (vni[1] << 8) | (vni[2] << 16);
> +#endif

Instead of a new function, will following do the same?:

uint32_t tenant_id_be= 0;
rte_memcpy(((uint8_t *)&tenant_id_be + 1), vxlan_spec->vni, 3)
filter->tenant_id = rte_be_to_cpu(tenant_id_be);

I think it is easier to understand, what do you think?

Thanks,
ferruh



More information about the dev mailing list