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 2BED245B5F; Thu, 17 Oct 2024 16:22:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C6857402F1; Thu, 17 Oct 2024 16:22:36 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id 0B1C74021E for ; Thu, 17 Oct 2024 16:22:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729174953; x=1760710953; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C+F6cAQ7PNOLiKTfBzYjAIvMxOYZ/zDdAqSWldPR7ek=; b=FSt+JIZzR0JMpIEuiOZQnb0ym03gS1tZlK1sZLeCqiyx5mIiRyFAI49L akD5JPWZizI1UzdYq85Hpa/sAAivdhjikv06M7MBwwHIB9JCVBHm6Crjz YGbE7caLRoVAZwJVJ+jioMl2zh+pCud445RMPK75MCn5WVMMOMJGAVvDe GxNIgj2tMLWJgD7Ogxpm2FJ1JVRjXu6jt+if4kit8Mwt2gOUwnOUpYcuZ sezfzif07DRb002G603Mv0GNpjkZB0hHcWA6cmWXpMLV0M4KGp8aQTvrB 5LJzEFC9zJLcuMfCrjNxsu1oCSBmfBlIpKBtpVP7G1Xdx9asulhLRpmBw A==; X-CSE-ConnectionGUID: ihhmscx0R6emQrmiblq73w== X-CSE-MsgGUID: zQspiZ9eRL6uvM835ER6tg== X-IronPort-AV: E=McAfee;i="6700,10204,11228"; a="28131720" X-IronPort-AV: E=Sophos;i="6.11,211,1725346800"; d="scan'208";a="28131720" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2024 07:22:33 -0700 X-CSE-ConnectionGUID: S2Enmpi0SeajWQSIM3A/rw== X-CSE-MsgGUID: hEXees9MREew9qNSWy6Yew== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,211,1725346800"; d="scan'208";a="101867834" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.25]) by fmviesa002.fm.intel.com with ESMTP; 17 Oct 2024 07:22:31 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev Subject: [PATCH 1/6] ip_frag: remove use of unaligned variable Date: Thu, 17 Oct 2024 15:22:08 +0100 Message-ID: <20241017142214.1669370-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241017142214.1669370-1-bruce.richardson@intel.com> References: <20241017142214.1669370-1-bruce.richardson@intel.com> MIME-Version: 1.0 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 --- 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