diff options
author | David S. Miller <davem@davemloft.net> | 2013-12-26 18:31:45 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-26 18:31:45 (GMT) |
commit | 539c89cfdb0e4b58d22a8a89321f36572b299fbc (patch) | |
tree | 0c7c97774c2c5bcf092de4852da404c543d725d9 /drivers/staging/ozwpan | |
parent | 306d7f79bb8169f73180dd1e5986eaca75ffb1d6 (diff) | |
parent | 692e5167b4487c96123c2de4c8d9577d50606112 (diff) | |
download | linux-539c89cfdb0e4b58d22a8a89321f36572b299fbc.tar.xz |
Merge branch 'addr_compare'
Ding Tianhong says:
====================
slight optimization of addr compare for some modules
Joe Perches add ether_addr_equal_unaligned to test if
possibly unaligned to u16 Ethernet addresses are equal.
If CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is set, this uses
the slightly faster generic routine ether_addr_equal,
otherwise this uses memcmp.
So I use the recently added and possibly more efficient
ether_addr_equal_unaligned to instead of memcmp for slight
optimization.
v2: Because a lot of places are already using 16b aligned MAC
address for both operands, so use the ether_addr_equal to
instead of ether_addr_equal_unaligned.Thanks for Joe, Alex
and Antonio's opinions.
Also remove the patch for bridge.
v3: According Joe's suggestion, the patch
(net: slight optimization of addr compare for some modules)
should be broken into several patches, and it will be good
to review for maintainers. So I will send rest of the patches
for first step, and next step, I will seperate the netdev patch
and send them by another patchset for net-next.
also fix some changelog.
v3.5 Change some style for patch 8 and patch 13. Thanks for
Sergei's suggestion.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/staging/ozwpan')
-rw-r--r-- | drivers/staging/ozwpan/ozcdev.c | 2 | ||||
-rw-r--r-- | drivers/staging/ozwpan/ozproto.c | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c index 6ce0af9..5de5981 100644 --- a/drivers/staging/ozwpan/ozcdev.c +++ b/drivers/staging/ozwpan/ozcdev.c @@ -448,7 +448,7 @@ int oz_cdev_start(struct oz_pd *pd, int resume) } spin_lock(&g_cdev.lock); if ((g_cdev.active_pd == NULL) && - (memcmp(pd->mac_addr, g_cdev.active_addr, ETH_ALEN) == 0)) { + ether_addr_equal(pd->mac_addr, g_cdev.active_addr)) { oz_pd_get(pd); g_cdev.active_pd = pd; oz_dbg(ON, "Active PD arrived\n"); diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c index 88714ec..19a2521 100644 --- a/drivers/staging/ozwpan/ozproto.c +++ b/drivers/staging/ozwpan/ozproto.c @@ -9,6 +9,7 @@ #include <linux/timer.h> #include <linux/sched.h> #include <linux/netdevice.h> +#include <linux/etherdevice.h> #include <linux/errno.h> #include <linux/ieee80211.h> #include "ozdbg.h" @@ -180,7 +181,7 @@ static struct oz_pd *oz_connect_req(struct oz_pd *cur_pd, struct oz_elt *elt, spin_lock_bh(&g_polling_lock); list_for_each(e, &g_pd_list) { pd2 = container_of(e, struct oz_pd, link); - if (memcmp(pd2->mac_addr, pd_addr, ETH_ALEN) == 0) { + if (ether_addr_equal(pd2->mac_addr, pd_addr)) { free_pd = pd; pd = pd2; break; @@ -597,7 +598,7 @@ struct oz_pd *oz_pd_find(const u8 *mac_addr) spin_lock_bh(&g_polling_lock); list_for_each(e, &g_pd_list) { pd = container_of(e, struct oz_pd, link); - if (memcmp(pd->mac_addr, mac_addr, ETH_ALEN) == 0) { + if (ether_addr_equal(pd->mac_addr, mac_addr)) { atomic_inc(&pd->ref_count); spin_unlock_bh(&g_polling_lock); return pd; |