[dpdk-dev] [PATCH v3 1/2] app/testpmd: add VXLAN encap/decap support

Ori Kam orika at mellanox.com
Tue Jun 19 09:09:28 CEST 2018



> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Nelio Laranjeiro
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro at 6wind.com>
> ---
>  app/test-pmd/cmdline.c                      | 129 ++++++++++++++++++
>  app/test-pmd/cmdline_flow.c                 | 139 ++++++++++++++++++++
>  app/test-pmd/testpmd.c                      |  17 +++
>  app/test-pmd/testpmd.h                      |  17 +++
>  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  13 ++
>  5 files changed, 315 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 27e2aa8c8..93573606f 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> +static void cmd_set_vxlan_parsed(void *parsed_result,
> +	__attribute__((unused)) struct cmdline *cl,
> +	__attribute__((unused)) void *data)
> +{
> +	struct cmd_set_vxlan_result *res = parsed_result;
> +	uint32_t vni = rte_cpu_to_be_32(res->vni) >> 8;

Is this also correct in case of big endian system? 
I think it will  remove part of the vni. 

> +
> +	if (strcmp(res->vxlan, "vxlan") == 0)
> +		vxlan_encap_conf.select_vlan = 0;
> +	else if (strcmp(res->vxlan, "vxlan-with-vlan") == 0)
> +		vxlan_encap_conf.select_vlan = 1;
> +	if (strcmp(res->ip_version, "ipv4") == 0)
> +		vxlan_encap_conf.select_ipv4 = 1;
> +	else if (strcmp(res->ip_version, "ipv6") == 0)
> +		vxlan_encap_conf.select_ipv4 = 0;
> +	else
> +		return;
> +	memcpy(vxlan_encap_conf.vni, &vni, 3);

I don't think this line is correct when running on big endian system.

> +	vxlan_encap_conf.udp_src = rte_cpu_to_be_16(res->udp_src);
> +	vxlan_encap_conf.udp_dst = rte_cpu_to_be_16(res->udp_dst);
> +	if (vxlan_encap_conf.select_ipv4) {
> +		IPV4_ADDR_TO_UINT(res->ip_src,
> vxlan_encap_conf.ipv4_src);
> +		IPV4_ADDR_TO_UINT(res->ip_dst,
> vxlan_encap_conf.ipv4_dst);
> +	} else {
> +		IPV6_ADDR_TO_ARRAY(res->ip_src,
> vxlan_encap_conf.ipv6_src);
> +		IPV6_ADDR_TO_ARRAY(res->ip_dst,
> vxlan_encap_conf.ipv6_dst);
> +	}
> +	if (vxlan_encap_conf.select_vlan)
> +		vxlan_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci);
> +	memcpy(vxlan_encap_conf.eth_src, res->eth_src.addr_bytes,
> +	       ETHER_ADDR_LEN);
> +	memcpy(vxlan_encap_conf.eth_dst, res->eth_dst.addr_bytes,
> +	       ETHER_ADDR_LEN);
> +}
> 
> --
> 2.17.1

Best,
Ori



More information about the dev mailing list