public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [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; 9+ messages in thread
From: Joe Perches @ 2013-12-06  8:18 UTC (permalink / raw)
  To: Marek Lindner, Simon Wunderlich, Antonio Quartulli
  Cc: netdev, b.a.t.m.a.n, David S. Miller, 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] 9+ messages in thread

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

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-06  8:18 [B.A.T.M.A.N.] [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
2013-12-06 21:17   ` Joe Perches
2013-12-06 21:38     ` David Miller
2013-12-06 22:21       ` [B.A.T.M.A.N.] [PATCH -next] etherdevice: Add ether_addr_equal_unaligned Joe Perches
2013-12-06 22:39         ` [B.A.T.M.A.N.] [PATCH -next] batadv: Slight optimization of batadv_compare_eth Joe Perches
2013-12-10  1:58           ` David Miller
2013-12-10  1:58         ` [B.A.T.M.A.N.] [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