From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Chemparathy Subject: [PATCH 07/10] app/test: use struct ether_addr instead of a byte array cast Date: Wed, 29 Apr 2015 09:15:31 -0700 Message-ID: <1430324134-25654-8-git-send-email-cchemparathy@ezchip.com> References: <1430324134-25654-1-git-send-email-cchemparathy@ezchip.com> To: dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <1430324134-25654-1-git-send-email-cchemparathy-d5a29ZRxExrQT0dZR+AlfA@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.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. 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 49a494d..5810e7f 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -229,13 +229,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), -- 2.1.2