DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [[RFC PATCH]] lib/ether: fix 16-bit unaligned access
@ 2015-12-08 19:29 Jan Viktorin
  2015-12-08 20:02 ` Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Jan Viktorin @ 2015-12-08 19:29 UTC (permalink / raw)
  To: dev

Hello,
	
I was looking at some warnings generated during ARM build. I can see
53 warnings for my build based on v2.2.0-rc3, spread among:

 app/test-pmd/{flowgen,icmpecho,txonly}.c
 app/test/{packet_burst_generator,test_hash_functions,test_thash}.c
 lib/librte_ether/rte_ether.h
 drivers/net/bonding/rte_eth_bond_pmd.c
 lib/librte_acl/{acl_gen,acl_run}.c
 lib/librte_eal/linuxapp/eal/{eal_interrupts,eal_pci_vfio_mp_sync}.c
 lib/librte_hash/rte_cuckoo_hash.c
 lib/librte_ip_frag/rte_ipv4_reassembly.c
 lib/librte_sched/{rte_bitmap.h,rte_sched.c}

I think, some of them are false-positives. In this RFC patch I tried to fix
only the rte_ether.h which uses the unaligned_uint16_t data type. I didn't
test it as it is just the first kick to solve more of those warns.

Regards
Jan

(I considered to not add the cover-letter as this is just a single small patch.
I hope it does not matter a lot. Is there any convention how to do this?)
---
This commit removes warning reported when building for ARMv7 target.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
---
 lib/librte_ether/rte_ether.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ether/rte_ether.h b/lib/librte_ether/rte_ether.h
index 07c17d7..ba8a80a 100644
--- a/lib/librte_ether/rte_ether.h
+++ b/lib/librte_ether/rte_ether.h
@@ -175,10 +175,9 @@ static inline int is_multicast_ether_addr(const struct ether_addr *ea)
  */
 static inline int is_broadcast_ether_addr(const struct ether_addr *ea)
 {
-	const unaligned_uint16_t *ea_words = (const unaligned_uint16_t *)ea;
+	const uint32_t *ea_words = (const uint32_t *)ea;
 
-	return (ea_words[0] == 0xFFFF && ea_words[1] == 0xFFFF &&
-		ea_words[2] == 0xFFFF);
+	return ea_words[0] == 0xFFFFFFFF && (ea_words[1] & 0x0FFFF) == 0x0FFFF;
 }
 
 /**
-- 
2.6.3

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-02-29 17:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-08 19:29 [dpdk-dev] [[RFC PATCH]] lib/ether: fix 16-bit unaligned access Jan Viktorin
2015-12-08 20:02 ` Stephen Hemminger
2015-12-08 20:53   ` Jan Viktorin
2015-12-08 20:30 ` Thomas Monjalon
2015-12-08 20:55   ` Jan Viktorin
2015-12-08 20:57     ` Thomas Monjalon
2015-12-08 21:17       ` Jan Viktorin
2015-12-09 15:16 ` [dpdk-dev] [PATCH 1/1] arm: set CONFIG_RTE_ARCH_STRICT_ALIGN=y for armv7 target Jan Viktorin
2016-02-29 15:14   ` Thomas Monjalon
2016-02-29 15:55     ` Jan Viktorin
2016-02-29 17:13       ` Jan Viktorin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).