From patchwork Fri Jun 19 17:34:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Chemparathy X-Patchwork-Id: 5628 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 02339C9C0; Fri, 19 Jun 2015 19:35:29 +0200 (CEST) Received: from sclab-apps-2.localdomain (sc-fw1.tilera.com [12.218.212.162]) by dpdk.org (Postfix) with ESMTP id 1DC17C8FC for ; Fri, 19 Jun 2015 19:35:15 +0200 (CEST) X-CheckPoint: {558452D2-10-A3D4DA0C-C0000002} Received: by sclab-apps-2.localdomain (Postfix, from userid 1318) id 3E523220494; Fri, 19 Jun 2015 10:35:03 -0700 (PDT) From: Cyril Chemparathy To: dev@dpdk.org Date: Fri, 19 Jun 2015 10:34:50 -0700 Message-Id: <1434735293-15469-8-git-send-email-cchemparathy@ezchip.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1434735293-15469-1-git-send-email-cchemparathy@ezchip.com> References: <1434735293-15469-1-git-send-email-cchemparathy@ezchip.com> Subject: [dpdk-dev] [PATCH v2 07/10] app/test: use struct ether_addr instead of a byte array cast X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch instantiates struct ether_addr instead of type casting a uint8_t pointer to the same structure. The type cast breaks on machines that enforce strict alignment. Acked-by: Olivier Matz Signed-off-by: Cyril Chemparathy --- app/test/test_pmd_perf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 1fd6843..c5253d0 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -228,13 +228,13 @@ init_traffic(struct rte_mempool *mp, struct ipv4_hdr pkt_ipv4_hdr; struct udp_hdr pkt_udp_hdr; uint32_t pktlen; - static uint8_t src_mac[] = { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF }; - static uint8_t dst_mac[] = { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA }; - + static struct ether_addr src_mac = + { { 0x00, 0xFF, 0xAA, 0xFF, 0xAA, 0xFF } }; + static struct ether_addr dst_mac = + { { 0x00, 0xAA, 0xFF, 0xAA, 0xFF, 0xAA } }; initialize_eth_header(&pkt_eth_hdr, - (struct ether_addr *)src_mac, - (struct ether_addr *)dst_mac, ETHER_TYPE_IPv4, 0, 0); + &src_mac, &dst_mac, ETHER_TYPE_IPv4, 0, 0); pktlen = initialize_ipv4_header(&pkt_ipv4_hdr, IPV4_ADDR(10, 0, 0, 1),