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/ibss.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/ibss.c')
-rw-r--r-- | net/mac80211/ibss.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 7f9ac577600..33fd8d9f714 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -66,7 +66,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, | |||
66 | skb_reset_tail_pointer(skb); | 66 | skb_reset_tail_pointer(skb); |
67 | skb_reserve(skb, sdata->local->hw.extra_tx_headroom); | 67 | skb_reserve(skb, sdata->local->hw.extra_tx_headroom); |
68 | 68 | ||
69 | if (memcmp(ifibss->bssid, bssid, ETH_ALEN)) | 69 | if (compare_ether_addr(ifibss->bssid, bssid)) |
70 | sta_info_flush(sdata->local, sdata); | 70 | sta_info_flush(sdata->local, sdata); |
71 | 71 | ||
72 | /* if merging, indicate to driver that we leave the old IBSS */ | 72 | /* if merging, indicate to driver that we leave the old IBSS */ |
@@ -403,7 +403,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
403 | return; | 403 | return; |
404 | 404 | ||
405 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC && | 405 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC && |
406 | memcmp(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0) { | 406 | compare_ether_addr(mgmt->bssid, sdata->u.ibss.bssid) == 0) { |
407 | 407 | ||
408 | rcu_read_lock(); | 408 | rcu_read_lock(); |
409 | sta = sta_info_get(sdata, mgmt->sa); | 409 | sta = sta_info_get(sdata, mgmt->sa); |
@@ -508,7 +508,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, | |||
508 | goto put_bss; | 508 | goto put_bss; |
509 | 509 | ||
510 | /* same BSSID */ | 510 | /* same BSSID */ |
511 | if (memcmp(cbss->bssid, sdata->u.ibss.bssid, ETH_ALEN) == 0) | 511 | if (compare_ether_addr(cbss->bssid, sdata->u.ibss.bssid) == 0) |
512 | goto put_bss; | 512 | goto put_bss; |
513 | 513 | ||
514 | if (rx_status->flag & RX_FLAG_MACTIME_MPDU) { | 514 | if (rx_status->flag & RX_FLAG_MACTIME_MPDU) { |
@@ -831,8 +831,8 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, | |||
831 | if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da)) | 831 | if (!tx_last_beacon && is_multicast_ether_addr(mgmt->da)) |
832 | return; | 832 | return; |
833 | 833 | ||
834 | if (memcmp(mgmt->bssid, ifibss->bssid, ETH_ALEN) != 0 && | 834 | if (compare_ether_addr(mgmt->bssid, ifibss->bssid) != 0 && |
835 | memcmp(mgmt->bssid, "\xff\xff\xff\xff\xff\xff", ETH_ALEN) != 0) | 835 | !is_broadcast_ether_addr(mgmt->bssid)) |
836 | return; | 836 | return; |
837 | 837 | ||
838 | end = ((u8 *) mgmt) + len; | 838 | end = ((u8 *) mgmt) + len; |