From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A26CF45B60; Thu, 17 Oct 2024 18:42:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3AD584025F; Thu, 17 Oct 2024 18:42:23 +0200 (CEST) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 90DD44021E for ; Thu, 17 Oct 2024 18:42:21 +0200 (CEST) Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4XTtrz63bKz6K9C9; Fri, 18 Oct 2024 00:41:39 +0800 (CST) Received: from frapeml500007.china.huawei.com (unknown [7.182.85.172]) by mail.maildlp.com (Postfix) with ESMTPS id 81C091400DB; Fri, 18 Oct 2024 00:42:20 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by frapeml500007.china.huawei.com (7.182.85.172) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 17 Oct 2024 18:42:20 +0200 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.039; Thu, 17 Oct 2024 18:42:20 +0200 From: Konstantin Ananyev To: Bruce Richardson , "dev@dpdk.org" CC: Konstantin Ananyev Subject: RE: [PATCH 1/6] ip_frag: remove use of unaligned variable Thread-Topic: [PATCH 1/6] ip_frag: remove use of unaligned variable Thread-Index: AQHbIKAXqk/Ca6FrPkO9ZE3hEvQbl7KLJVjw Date: Thu, 17 Oct 2024 16:42:20 +0000 Message-ID: References: <20241017142214.1669370-1-bruce.richardson@intel.com> <20241017142214.1669370-2-bruce.richardson@intel.com> In-Reply-To: <20241017142214.1669370-2-bruce.richardson@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.206.138.42] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > If compiling with -Waddress-of-packed-member, we get a warning about the > use of the unaligned uint64_t value which is used to copy 8 bytes from > ip_hdr to the key. Replace this unaligned assignment with an equivalent > 8-byte constant-sized memcpy, allowing the compiler to choose optimal > instructions to do the assignment. >=20 > Signed-off-by: Bruce Richardson > --- > lib/ip_frag/rte_ipv4_reassembly.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) >=20 > diff --git a/lib/ip_frag/rte_ipv4_reassembly.c b/lib/ip_frag/rte_ipv4_rea= ssembly.c > index 4a89a5f536..5818f50f40 100644 > --- a/lib/ip_frag/rte_ipv4_reassembly.c > +++ b/lib/ip_frag/rte_ipv4_reassembly.c > @@ -101,7 +101,6 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tb= l *tbl, > { > struct ip_frag_pkt *fp; > struct ip_frag_key key; > - const unaligned_uint64_t *psd; > uint16_t flag_offset, ip_ofs, ip_flag; > int32_t ip_len; > int32_t trim; > @@ -110,9 +109,8 @@ rte_ipv4_frag_reassemble_packet(struct rte_ip_frag_tb= l *tbl, > ip_ofs =3D (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); > ip_flag =3D (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); >=20 > - psd =3D (unaligned_uint64_t *)&ip_hdr->src_addr; > /* use first 8 bytes only */ > - key.src_dst[0] =3D psd[0]; > + memcpy(&key.src_dst[0], &ip_hdr->src_addr, 8); > key.id =3D ip_hdr->packet_id; > key.key_len =3D IPV4_KEYLEN; >=20 > -- As a small nit, might be better: memcpy(&key.src_dst[0], &ip_hdr->src_addr, sizeof(key.src_dst[0])); =20 Acked-by: Konstantin Ananyev > 2.43.0