netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] batadv: Slight optimization of batadv_compare_eth
@ 2013-12-06  8:18 Joe Perches
  2013-12-06 10:10 ` Antonio Quartulli
  2013-12-06 20:39 ` David Miller
  0 siblings, 2 replies; 11+ messages in thread
From: Joe Perches @ 2013-12-06  8:18 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: David S. Miller, b.a.t.m.a.n, netdev, linux-kernel

Use CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS to check if
this function can be optimized by using the generic
ether_addr_equal.

Remove the unnecessary ?: after the unoptimized memcmp.

Signed-off-by: Joe Perches <joe@perches.com>
---
 net/batman-adv/main.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h
index f94f287b..74a7a3f 100644
--- a/net/batman-adv/main.h
+++ b/net/batman-adv/main.h
@@ -266,7 +266,11 @@ static inline void batadv_dbg(int type __always_unused,
  */
 static inline int batadv_compare_eth(const void *data1, const void *data2)
 {
-	return (memcmp(data1, data2, ETH_ALEN) == 0 ? 1 : 0);
+#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
+	return ether_addr_equal(data1, data2);
+#else
+	return memcmp(data1, data2, ETH_ALEN) == 0;
+#endif
 }
 
 /**

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

end of thread, other threads:[~2013-12-10  1:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-06  8:18 [PATCH -next] batadv: Slight optimization of batadv_compare_eth Joe Perches
2013-12-06 10:10 ` Antonio Quartulli
2013-12-06 20:39 ` David Miller
     [not found]   ` <20131206.153944.1382127535160341376.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2013-12-06 21:17     ` Joe Perches
2013-12-06 21:38       ` David Miller
     [not found]         ` <20131206.163806.1555069105347405484.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2013-12-06 22:21           ` [PATCH -next] etherdevice: Add ether_addr_equal_unaligned Joe Perches
2013-12-06 22:39             ` [PATCH -next] batadv: Slight optimization of batadv_compare_eth Joe Perches
2013-12-10  1:58               ` David Miller
2013-12-06 23:44             ` [PATCH -next] etherdevice: Optimize a few is_<foo>_ether_addr functions Joe Perches
2013-12-10  1:58               ` David Miller
2013-12-10  1:58             ` [PATCH -next] etherdevice: Add ether_addr_equal_unaligned David Miller

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).