[dpdk-dev] [PATCH] examples/l3fwd: fix unaligned memory access

Ruifeng Wang (Arm Technology China) Ruifeng.Wang at arm.com
Thu Jul 25 09:01:47 CEST 2019


Hi,

> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of hgovindh
> Sent: Thursday, July 25, 2019 00:44
> To: Remy Horton <remy.horton at intel.com>; Marko Kovacevic
> <marko.kovacevic at intel.com>; Ori Kam <orika at mellanox.com>; Bruce
> Richardson <bruce.richardson at intel.com>; Pablo de Lara
> <pablo.de.lara.guarch at intel.com>; Radu Nicolau <radu.nicolau at intel.com>;
> Akhil.goyal at nxp.com; Tomasz Kantecki <tomasz.kantecki at intel.com>
> Cc: dev at dpdk.org; hgovindh <hariprasad.govindharajan at intel.com>;
> maciej.czekaj at caviumnetworks.com; stable at dpdk.org
> Subject: [dpdk-dev] [PATCH] examples/l3fwd: fix unaligned memory access
> 
> Fix unaligned memory access when reading IPv6 header which leads to
> segmentation fault by changing aligned memory read to unaligned memory
> read.
> 
> Bugzilla ID: 279
> Fixes: 64d3955de1de ("examples/l3fwd: fix ARM build")
> Cc: maciej.czekaj at caviumnetworks.com
> Cc: stable at dpdk.org
> Signed-off-by: hgovindh <hariprasad.govindharajan at intel.com>
> ---
>  examples/l3fwd/l3fwd_em.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
> index fa8f82be6..f0c443dae 100644
> --- a/examples/l3fwd/l3fwd_em.c
> +++ b/examples/l3fwd/l3fwd_em.c
> @@ -285,7 +285,7 @@ em_get_ipv6_dst_port(void *ipv6_hdr, uint16_t
> portid, void *lookup_struct)
>  	 * Get part of 5 tuple: dst IP address lower 96 bits
>  	 * and src IP address higher 32 bits.
>  	 */
> -	key.xmm[1] = *(xmm_t *)data1;
> +	key.xmm[1] = _mm_loadu_si128((xmm_t *)data1);

The use of SSE intrinsics on general path will break build on other architectures.
How about use em_mask_key() instead?
> 
>  	/*
>  	 * Get part of 5 tuple: dst port and src port
> --
> 2.22.0



More information about the dev mailing list