[dpdk-dev] [PATCH v8 1/4] lib/ether: optimize struct rte_eth_tunnel_filter_conf

Thomas Monjalon thomas.monjalon at 6wind.com
Sun Mar 13 13:01:05 CET 2016


2016-03-10 11:05, Jingjing Wu:
> From: Xutao Sun <xutao.sun at intel.com>
> 
> Change the fields of outer_mac and inner_mac in struct
> rte_eth_tunnel_filter_conf from pointer to struct in order to
> keep the code's readability.

It breaks compilation of examples/tep_termination.

> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -6628,8 +6628,10 @@ cmd_tunnel_filter_parsed(void *parsed_result,
>  	struct rte_eth_tunnel_filter_conf tunnel_filter_conf;
>  	int ret = 0;
>  
> -	tunnel_filter_conf.outer_mac = &res->outer_mac;
> -	tunnel_filter_conf.inner_mac = &res->inner_mac;
> +	rte_memcpy(&tunnel_filter_conf.outer_mac, &res->outer_mac,
> +			ETHER_ADDR_LEN);
> +	rte_memcpy(&tunnel_filter_conf.inner_mac, &res->inner_mac,
> +			ETHER_ADDR_LEN);

Please use ether_addr_copy().

> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -5839,10 +5839,10 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf,
>  	}
>  	pfilter = cld_filter;
>  
> -	(void)rte_memcpy(&pfilter->outer_mac, tunnel_filter->outer_mac,
> -			sizeof(struct ether_addr));
> -	(void)rte_memcpy(&pfilter->inner_mac, tunnel_filter->inner_mac,
> -			sizeof(struct ether_addr));
> +	(void)rte_memcpy(&pfilter->outer_mac, &tunnel_filter->outer_mac,
> +			ETHER_ADDR_LEN);
> +	(void)rte_memcpy(&pfilter->inner_mac, &tunnel_filter->inner_mac,
> +			ETHER_ADDR_LEN);

As already commented in January, please stop this useless return cast.

There is a dedicated function to copy MAC addresses:
	ether_addr_copy()



More information about the dev mailing list