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 7943145BCB; Fri, 25 Oct 2024 18:51:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 696E5402D8; Fri, 25 Oct 2024 18:51:20 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by mails.dpdk.org (Postfix) with ESMTP id 1840D40156 for ; Fri, 25 Oct 2024 18:51:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729875075; x=1761411075; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YoTxt29Trz0N8RkOmnQCczyDJguxbijKaxm7bq7Xpd4=; b=oHwFGJP3xa5yvG8wPSKiEyUe39/diQc7UlV4IB+Gs2tcZQApgAd+13tN 1NokfCTheGYuzyqRLbKxANnld86ykz+qBVP/TGoQVuzi/Q+jdUduHnDSk XbZItrw+BYianP26aj02c/aTmVtBkJFinnYak8PaMQ2E3Lj0AvE7gako1 9lZb4xNzWZ/rnvi61xZc1f1AzLh+pZJM+Pc0tU7B4oU4W2y58yKjrD72g /kASq4m3mmnX04t7I7G1Mx/JvaPuh/CgvkDrRME8u4EHZXLZkxb+tqPgK fJKLPPMi7nLmCtFegQ5OsS8cDjebEl3pfKRmghIRGlov3Y41C9tnoML3T w==; X-CSE-ConnectionGUID: 6pX9cwVrRSK5y0oeHeIw4w== X-CSE-MsgGUID: AMvIt8+6Sq6sg4S0yivohQ== X-IronPort-AV: E=McAfee;i="6700,10204,11236"; a="54956132" X-IronPort-AV: E=Sophos;i="6.11,232,1725346800"; d="scan'208";a="54956132" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2024 09:50:36 -0700 X-CSE-ConnectionGUID: EA3VcM5MRdOSyn0dlTaRUg== X-CSE-MsgGUID: RiahY+SeQ/2lWxvMSgvCeA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,232,1725346800"; d="scan'208";a="118417478" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by orviesa001.jf.intel.com with ESMTP; 25 Oct 2024 09:50:35 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: david.marchand@redhat.com, Bruce Richardson , Stephen Hemminger , Konstantin Ananyev , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Konstantin Ananyev Subject: [PATCH v2 1/6] ip_frag: remove use of unaligned variable Date: Fri, 25 Oct 2024 17:50:14 +0100 Message-ID: <20241025165020.1856733-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241025165020.1856733-1-bruce.richardson@intel.com> References: <20241017142214.1669370-1-bruce.richardson@intel.com> <20241025165020.1856733-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Signed-off-by: Bruce Richardson Acked-by: Stephen Hemminger Acked-by: Konstantin Ananyev Acked-by: Morten Brørup --- lib/ip_frag/rte_ipv4_reassembly.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/ip_frag/rte_ipv4_reassembly.c b/lib/ip_frag/rte_ipv4_reassembly.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_tbl *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_tbl *tbl, ip_ofs = (uint16_t)(flag_offset & RTE_IPV4_HDR_OFFSET_MASK); ip_flag = (uint16_t)(flag_offset & RTE_IPV4_HDR_MF_FLAG); - psd = (unaligned_uint64_t *)&ip_hdr->src_addr; /* use first 8 bytes only */ - key.src_dst[0] = psd[0]; + memcpy(&key.src_dst[0], &ip_hdr->src_addr, 8); key.id = ip_hdr->packet_id; key.key_len = IPV4_KEYLEN; -- 2.43.0