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>
This commit is contained in:

committed by
John W. Linville

parent
4d196e4b2f
commit
888d04dfbe
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/slab.h>
|
||||
@@ -101,7 +102,7 @@ struct sta_info *sta_info_get(struct ieee80211_sub_if_data *sdata,
|
||||
lockdep_is_held(&local->sta_mtx));
|
||||
while (sta) {
|
||||
if (sta->sdata == sdata &&
|
||||
memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
|
||||
compare_ether_addr(sta->sta.addr, addr) == 0)
|
||||
break;
|
||||
sta = rcu_dereference_check(sta->hnext,
|
||||
lockdep_is_held(&local->sta_mtx));
|
||||
@@ -124,7 +125,7 @@ struct sta_info *sta_info_get_bss(struct ieee80211_sub_if_data *sdata,
|
||||
while (sta) {
|
||||
if ((sta->sdata == sdata ||
|
||||
(sta->sdata->bss && sta->sdata->bss == sdata->bss)) &&
|
||||
memcmp(sta->sta.addr, addr, ETH_ALEN) == 0)
|
||||
compare_ether_addr(sta->sta.addr, addr) == 0)
|
||||
break;
|
||||
sta = rcu_dereference_check(sta->hnext,
|
||||
lockdep_is_held(&local->sta_mtx));
|
||||
|
Reference in New Issue
Block a user