From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-3.cisco.com (alln-iport-3.cisco.com [173.37.142.90]) by dpdk.org (Postfix) with ESMTP id A12FA4CAD for ; Sat, 24 Feb 2018 20:17:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1859; q=dns/txt; s=iport; t=1519499872; x=1520709472; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=zidBev3zxJQ3t/c0ZsHtaeQT3Ffk/XQO889/mvuid5c=; b=G3kQ8jB1CsdqwXXrR8/nT2bHaG9VzlxFA8svqnaki47KRZw3KQgxXNqs 3Z9Vlg+5C7zSFuOUEc60XsYFVQruOakLHV51Pf2GgsYF1FmfDt110LzUc 0GWAdoVp0svTyVDkoGEBds1N289g9tvcdA0SfrNanFoPHt7XdI9qsQReD 0=; X-IronPort-AV: E=Sophos;i="5.47,389,1515456000"; d="scan'208";a="75516176" Received: from rcdn-core-10.cisco.com ([173.37.93.146]) by alln-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Feb 2018 19:17:51 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-10.cisco.com (8.14.5/8.14.5) with ESMTP id w1OJHpUC008093; Sat, 24 Feb 2018 19:17:51 GMT Received: by cisco.com (Postfix, from userid 392789) id 1ECA320F2009; Sat, 24 Feb 2018 11:17:51 -0800 (PST) From: John Daley To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Hyong Youb Kim Date: Sat, 24 Feb 2018 11:17:47 -0800 Message-Id: <20180224191748.20908-9-johndale@cisco.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180224191748.20908-1-johndale@cisco.com> References: <20180224191748.20908-1-johndale@cisco.com> Subject: [dpdk-dev] [PATCH] net/enic: use memcpy to avoid strict aliasing warnings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2018 19:17:53 -0000 From: Hyong Youb Kim Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- drivers/net/enic/enic_clsf.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index 3ef1d0832..9d95201ec 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -111,7 +111,6 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, struct rte_eth_fdir_masks *masks) { struct filter_generic_1 *gp = &fltr->u.generic_1; - int i; fltr->type = FILTER_DPDK_1; memset(gp, 0, sizeof(*gp)); @@ -273,18 +272,14 @@ copy_fltr_v2(struct filter_v2 *fltr, struct rte_eth_fdir_input *input, ipv6_mask.proto = masks->ipv6_mask.proto; ipv6_val.proto = input->flow.ipv6_flow.proto; } - for (i = 0; i < 4; i++) { - *(uint32_t *)&ipv6_mask.src_addr[i * 4] = - masks->ipv6_mask.src_ip[i]; - *(uint32_t *)&ipv6_val.src_addr[i * 4] = - input->flow.ipv6_flow.src_ip[i]; - } - for (i = 0; i < 4; i++) { - *(uint32_t *)&ipv6_mask.dst_addr[i * 4] = - masks->ipv6_mask.src_ip[i]; - *(uint32_t *)&ipv6_val.dst_addr[i * 4] = - input->flow.ipv6_flow.dst_ip[i]; - } + memcpy(ipv6_mask.src_addr, masks->ipv6_mask.src_ip, + sizeof(ipv6_mask.src_addr)); + memcpy(ipv6_val.src_addr, input->flow.ipv6_flow.src_ip, + sizeof(ipv6_val.src_addr)); + memcpy(ipv6_mask.dst_addr, masks->ipv6_mask.dst_ip, + sizeof(ipv6_mask.dst_addr)); + memcpy(ipv6_val.dst_addr, input->flow.ipv6_flow.dst_ip, + sizeof(ipv6_val.dst_addr)); if (input->flow.ipv6_flow.tc) { ipv6_mask.vtc_flow = masks->ipv6_mask.tc << 12; ipv6_val.vtc_flow = input->flow.ipv6_flow.tc << 12; -- 2.12.0