diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-03-01 09:22:09 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-03-05 15:38:31 -0500 |
commit | 888d04dfbe7e09f930fdaafb257cce2c54c9c3f3 (patch) | |
tree | cdf0c4d4008860fd91db31bcc620a8ecd3d95bc1 /net/mac80211/sta_info.c | |
parent | 4d196e4b2ffd734393b54f351507462f19d737b5 (diff) |
mac80211: use compare_ether_addr on MAC addresses instead of memcmp
Because of the constant size and guaranteed 16 bit alignment, the inline
compare_ether_addr function is much cheaper than calling memcmp.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/sta_info.c')
-rw-r--r-- | net/mac80211/sta_info.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index cd0f265f42e5..38137cb5f6f0 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/etherdevice.h> | ||
12 | #include <linux/netdevice.h> | 13 | #include <linux/netdevice.h> |
13 | #include <linux/types.h> | 14 | #include <linux/types.h> |
14 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
@@ -101,7 +102,7 @@ struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata, | |||
101 | lockdep_is_held(&local->sta_mtx)); | 102 | lockdep_is_held(&local->sta_mtx)); |
102 | while (sta) { | 103 | while (sta) { |
103 | if (sta->sdata == sdata && | 104 | if (sta->sdata == sdata && |
104 | memcmp(sta->sta.addr, addr, ETH_ALEN) == 0) | 105 | compare_ether_addr(sta->sta.addr, addr) == 0) |
105 | break; | 106 | break; |
106 | sta = rcu_dereference_check(sta->hnext, | 107 | sta = rcu_dereference_check(sta->hnext, |
107 | lockdep_is_held(&local->sta_mtx)); | 108 | lockdep_is_held(&local->sta_mtx)); |
@@ -124,7 +125,7 @@ struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata, | |||
124 | while (sta) { | 125 | while (sta) { |
125 | if ((sta->sdata == sdata || | 126 | if ((sta->sdata == sdata || |
126 | (sta->sdata->bss && sta->sdata->bss == sdata->bss)) && | 127 | (sta->sdata->bss && sta->sdata->bss == sdata->bss)) && |
127 | memcmp(sta->sta.addr, addr, ETH_ALEN) == 0) | 128 | compare_ether_addr(sta->sta.addr, addr) == 0) |
128 | break; | 129 | break; |
129 | sta = rcu_dereference_check(sta->hnext, | 130 | sta = rcu_dereference_check(sta->hnext, |
130 | lockdep_is_held(&local->sta_mtx)); | 131 | lockdep_is_held(&local->sta_mtx)); |