aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-03-01 09:22:09 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-05 15:38:31 -0500
commit888d04dfbe7e09f930fdaafb257cce2c54c9c3f3 (patch)
treecdf0c4d4008860fd91db31bcc620a8ecd3d95bc1
parent4d196e4b2ffd734393b54f351507462f19d737b5 (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>
-rw-r--r--net/mac80211/ibss.c10
-rw-r--r--net/mac80211/mesh.c2
-rw-r--r--net/mac80211/mesh_hwmp.c19
-rw-r--r--net/mac80211/mesh_pathtbl.c14
-rw-r--r--net/mac80211/mlme.c30
-rw-r--r--net/mac80211/rx.c6
-rw-r--r--net/mac80211/scan.c3
-rw-r--r--net/mac80211/sta_info.c5
-rw-r--r--net/mac80211/sta_info.h3
-rw-r--r--net/mac80211/status.c3
10 files changed, 53 insertions, 42 deletions
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 7f9ac577600a..33fd8d9f714e 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;
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index c707c8bf6d2c..e5fbb7cf3562 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -204,7 +204,7 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr,
204 kmem_cache_free(rm_cache, p); 204 kmem_cache_free(rm_cache, p);
205 --entries; 205 --entries;
206 } else if ((seqnum == p->seqnum) && 206 } else if ((seqnum == p->seqnum) &&
207 (memcmp(sa, p->sa, ETH_ALEN) == 0)) 207 (compare_ether_addr(sa, p->sa) == 0))
208 return -1; 208 return -1;
209 } 209 }
210 210
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 639db14f43d2..ae82ea75bc74 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <linux/etherdevice.h>
11#include <asm/unaligned.h> 12#include <asm/unaligned.h>
12#include "wme.h" 13#include "wme.h"
13#include "mesh.h" 14#include "mesh.h"
@@ -419,7 +420,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
419 new_metric = MAX_METRIC; 420 new_metric = MAX_METRIC;
420 exp_time = TU_TO_EXP_TIME(orig_lifetime); 421 exp_time = TU_TO_EXP_TIME(orig_lifetime);
421 422
422 if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0) { 423 if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0) {
423 /* This MP is the originator, we are not interested in this 424 /* This MP is the originator, we are not interested in this
424 * frame, except for updating transmitter's path info. 425 * frame, except for updating transmitter's path info.
425 */ 426 */
@@ -469,7 +470,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata,
469 470
470 /* Update and check transmitter routing info */ 471 /* Update and check transmitter routing info */
471 ta = mgmt->sa; 472 ta = mgmt->sa;
472 if (memcmp(orig_addr, ta, ETH_ALEN) == 0) 473 if (compare_ether_addr(orig_addr, ta) == 0)
473 fresh_info = false; 474 fresh_info = false;
474 else { 475 else {
475 fresh_info = true; 476 fresh_info = true;
@@ -530,7 +531,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata,
530 531
531 mhwmp_dbg("received PREQ from %pM", orig_addr); 532 mhwmp_dbg("received PREQ from %pM", orig_addr);
532 533
533 if (memcmp(target_addr, sdata->vif.addr, ETH_ALEN) == 0) { 534 if (compare_ether_addr(target_addr, sdata->vif.addr) == 0) {
534 mhwmp_dbg("PREQ is for us"); 535 mhwmp_dbg("PREQ is for us");
535 forward = false; 536 forward = false;
536 reply = true; 537 reply = true;
@@ -627,7 +628,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata,
627 mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem)); 628 mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem));
628 629
629 orig_addr = PREP_IE_ORIG_ADDR(prep_elem); 630 orig_addr = PREP_IE_ORIG_ADDR(prep_elem);
630 if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0) 631 if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0)
631 /* destination, no forwarding required */ 632 /* destination, no forwarding required */
632 return; 633 return;
633 634
@@ -697,10 +698,12 @@ static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata,
697 rcu_read_lock(); 698 rcu_read_lock();
698 mpath = mesh_path_lookup(target_addr, sdata); 699 mpath = mesh_path_lookup(target_addr, sdata);
699 if (mpath) { 700 if (mpath) {
701 struct sta_info *sta;
702
700 spin_lock_bh(&mpath->state_lock); 703 spin_lock_bh(&mpath->state_lock);
704 sta = next_hop_deref_protected(mpath);
701 if (mpath->flags & MESH_PATH_ACTIVE && 705 if (mpath->flags & MESH_PATH_ACTIVE &&
702 memcmp(ta, next_hop_deref_protected(mpath)->sta.addr, 706 compare_ether_addr(ta, sta->sta.addr) == 0 &&
703 ETH_ALEN) == 0 &&
704 (!(mpath->flags & MESH_PATH_SN_VALID) || 707 (!(mpath->flags & MESH_PATH_SN_VALID) ||
705 SN_GT(target_sn, mpath->sn))) { 708 SN_GT(target_sn, mpath->sn))) {
706 mpath->flags &= ~MESH_PATH_ACTIVE; 709 mpath->flags &= ~MESH_PATH_ACTIVE;
@@ -742,7 +745,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
742 metric = rann->rann_metric; 745 metric = rann->rann_metric;
743 746
744 /* Ignore our own RANNs */ 747 /* Ignore our own RANNs */
745 if (memcmp(orig_addr, sdata->vif.addr, ETH_ALEN) == 0) 748 if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0)
746 return; 749 return;
747 750
748 mhwmp_dbg("received RANN from %pM via neighbour %pM (is_gate=%d)", 751 mhwmp_dbg("received RANN from %pM via neighbour %pM (is_gate=%d)",
@@ -1074,7 +1077,7 @@ int mesh_nexthop_lookup(struct sk_buff *skb,
1074 if (time_after(jiffies, 1077 if (time_after(jiffies,
1075 mpath->exp_time - 1078 mpath->exp_time -
1076 msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) && 1079 msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) &&
1077 !memcmp(sdata->vif.addr, hdr->addr4, ETH_ALEN) && 1080 !compare_ether_addr(sdata->vif.addr, hdr->addr4) &&
1078 !(mpath->flags & MESH_PATH_RESOLVING) && 1081 !(mpath->flags & MESH_PATH_RESOLVING) &&
1079 !(mpath->flags & MESH_PATH_FIXED)) 1082 !(mpath->flags & MESH_PATH_FIXED))
1080 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); 1083 mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH);
diff --git a/net/mac80211/mesh_pathtbl.c b/net/mac80211/mesh_pathtbl.c
index dc51669e67d8..157642f780b9 100644
--- a/net/mac80211/mesh_pathtbl.c
+++ b/net/mac80211/mesh_pathtbl.c
@@ -348,7 +348,7 @@ static struct mesh_path *mpath_lookup(struct mesh_table *tbl, u8 *dst,
348 hlist_for_each_entry_rcu(node, n, bucket, list) { 348 hlist_for_each_entry_rcu(node, n, bucket, list) {
349 mpath = node->mpath; 349 mpath = node->mpath;
350 if (mpath->sdata == sdata && 350 if (mpath->sdata == sdata &&
351 memcmp(dst, mpath->dst, ETH_ALEN) == 0) { 351 compare_ether_addr(dst, mpath->dst) == 0) {
352 if (MPATH_EXPIRED(mpath)) { 352 if (MPATH_EXPIRED(mpath)) {
353 spin_lock_bh(&mpath->state_lock); 353 spin_lock_bh(&mpath->state_lock);
354 mpath->flags &= ~MESH_PATH_ACTIVE; 354 mpath->flags &= ~MESH_PATH_ACTIVE;
@@ -523,7 +523,7 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
523 int err = 0; 523 int err = 0;
524 u32 hash_idx; 524 u32 hash_idx;
525 525
526 if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0) 526 if (compare_ether_addr(dst, sdata->vif.addr) == 0)
527 /* never add ourselves as neighbours */ 527 /* never add ourselves as neighbours */
528 return -ENOTSUPP; 528 return -ENOTSUPP;
529 529
@@ -564,7 +564,8 @@ int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata)
564 err = -EEXIST; 564 err = -EEXIST;
565 hlist_for_each_entry(node, n, bucket, list) { 565 hlist_for_each_entry(node, n, bucket, list) {
566 mpath = node->mpath; 566 mpath = node->mpath;
567 if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0) 567 if (mpath->sdata == sdata &&
568 compare_ether_addr(dst, mpath->dst) == 0)
568 goto err_exists; 569 goto err_exists;
569 } 570 }
570 571
@@ -655,7 +656,7 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
655 int err = 0; 656 int err = 0;
656 u32 hash_idx; 657 u32 hash_idx;
657 658
658 if (memcmp(dst, sdata->vif.addr, ETH_ALEN) == 0) 659 if (compare_ether_addr(dst, sdata->vif.addr) == 0)
659 /* never add ourselves as neighbours */ 660 /* never add ourselves as neighbours */
660 return -ENOTSUPP; 661 return -ENOTSUPP;
661 662
@@ -692,7 +693,8 @@ int mpp_path_add(u8 *dst, u8 *mpp, struct ieee80211_sub_if_data *sdata)
692 err = -EEXIST; 693 err = -EEXIST;
693 hlist_for_each_entry(node, n, bucket, list) { 694 hlist_for_each_entry(node, n, bucket, list) {
694 mpath = node->mpath; 695 mpath = node->mpath;
695 if (mpath->sdata == sdata && memcmp(dst, mpath->dst, ETH_ALEN) == 0) 696 if (mpath->sdata == sdata &&
697 compare_ether_addr(dst, mpath->dst) == 0)
696 goto err_exists; 698 goto err_exists;
697 } 699 }
698 700
@@ -886,7 +888,7 @@ int mesh_path_del(u8 *addr, struct ieee80211_sub_if_data *sdata)
886 hlist_for_each_entry(node, n, bucket, list) { 888 hlist_for_each_entry(node, n, bucket, list) {
887 mpath = node->mpath; 889 mpath = node->mpath;
888 if (mpath->sdata == sdata && 890 if (mpath->sdata == sdata &&
889 memcmp(addr, mpath->dst, ETH_ALEN) == 0) { 891 compare_ether_addr(addr, mpath->dst) == 0) {
890 __mesh_path_del(tbl, node); 892 __mesh_path_del(tbl, node);
891 goto enddel; 893 goto enddel;
892 } 894 }
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index caf97f5a2937..7190da4f2138 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1822,7 +1822,7 @@ ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
1822 1822
1823 memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN); 1823 memcpy(bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN);
1824 1824
1825 if (memcmp(bssid, mgmt->bssid, ETH_ALEN)) 1825 if (compare_ether_addr(bssid, mgmt->bssid))
1826 return RX_MGMT_NONE; 1826 return RX_MGMT_NONE;
1827 1827
1828 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg); 1828 auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
@@ -1903,7 +1903,7 @@ ieee80211_rx_mgmt_deauth(struct ieee80211_sub_if_data *sdata,
1903 return RX_MGMT_NONE; 1903 return RX_MGMT_NONE;
1904 1904
1905 if (!ifmgd->associated || 1905 if (!ifmgd->associated ||
1906 memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN)) 1906 compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
1907 return RX_MGMT_NONE; 1907 return RX_MGMT_NONE;
1908 1908
1909 bssid = ifmgd->associated->bssid; 1909 bssid = ifmgd->associated->bssid;
@@ -1936,7 +1936,7 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
1936 return RX_MGMT_NONE; 1936 return RX_MGMT_NONE;
1937 1937
1938 if (!ifmgd->associated || 1938 if (!ifmgd->associated ||
1939 memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN)) 1939 compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
1940 return RX_MGMT_NONE; 1940 return RX_MGMT_NONE;
1941 1941
1942 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); 1942 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code);
@@ -2203,7 +2203,7 @@ ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
2203 2203
2204 if (!assoc_data) 2204 if (!assoc_data)
2205 return RX_MGMT_NONE; 2205 return RX_MGMT_NONE;
2206 if (memcmp(assoc_data->bss->bssid, mgmt->bssid, ETH_ALEN)) 2206 if (compare_ether_addr(assoc_data->bss->bssid, mgmt->bssid))
2207 return RX_MGMT_NONE; 2207 return RX_MGMT_NONE;
2208 2208
2209 /* 2209 /*
@@ -2291,8 +2291,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
2291 bool need_ps = false; 2291 bool need_ps = false;
2292 2292
2293 if (sdata->u.mgd.associated && 2293 if (sdata->u.mgd.associated &&
2294 memcmp(mgmt->bssid, sdata->u.mgd.associated->bssid, 2294 compare_ether_addr(mgmt->bssid, sdata->u.mgd.associated->bssid)
2295 ETH_ALEN) == 0) { 2295 == 0) {
2296 bss = (void *)sdata->u.mgd.associated->priv; 2296 bss = (void *)sdata->u.mgd.associated->priv;
2297 /* not previously set so we may need to recalc */ 2297 /* not previously set so we may need to recalc */
2298 need_ps = !bss->dtim_period; 2298 need_ps = !bss->dtim_period;
@@ -2347,7 +2347,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
2347 2347
2348 ASSERT_MGD_MTX(ifmgd); 2348 ASSERT_MGD_MTX(ifmgd);
2349 2349
2350 if (memcmp(mgmt->da, sdata->vif.addr, ETH_ALEN)) 2350 if (compare_ether_addr(mgmt->da, sdata->vif.addr))
2351 return; /* ignore ProbeResp to foreign address */ 2351 return; /* ignore ProbeResp to foreign address */
2352 2352
2353 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt; 2353 baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
@@ -2360,11 +2360,12 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
2360 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false); 2360 ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems, false);
2361 2361
2362 if (ifmgd->associated && 2362 if (ifmgd->associated &&
2363 memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN) == 0) 2363 compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid) == 0)
2364 ieee80211_reset_ap_probe(sdata); 2364 ieee80211_reset_ap_probe(sdata);
2365 2365
2366 if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies && 2366 if (ifmgd->auth_data && !ifmgd->auth_data->bss->proberesp_ies &&
2367 memcmp(mgmt->bssid, ifmgd->auth_data->bss->bssid, ETH_ALEN) == 0) { 2367 compare_ether_addr(mgmt->bssid, ifmgd->auth_data->bss->bssid)
2368 == 0) {
2368 /* got probe response, continue with auth */ 2369 /* got probe response, continue with auth */
2369 printk(KERN_DEBUG "%s: direct probe responded\n", sdata->name); 2370 printk(KERN_DEBUG "%s: direct probe responded\n", sdata->name);
2370 ifmgd->auth_data->tries = 0; 2371 ifmgd->auth_data->tries = 0;
@@ -2421,7 +2422,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
2421 return; 2422 return;
2422 2423
2423 if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon && 2424 if (ifmgd->assoc_data && !ifmgd->assoc_data->have_beacon &&
2424 memcmp(mgmt->bssid, ifmgd->assoc_data->bss->bssid, ETH_ALEN) == 0) { 2425 compare_ether_addr(mgmt->bssid, ifmgd->assoc_data->bss->bssid)
2426 == 0) {
2425 ieee802_11_parse_elems(mgmt->u.beacon.variable, 2427 ieee802_11_parse_elems(mgmt->u.beacon.variable,
2426 len - baselen, &elems); 2428 len - baselen, &elems);
2427 2429
@@ -2436,7 +2438,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
2436 } 2438 }
2437 2439
2438 if (!ifmgd->associated || 2440 if (!ifmgd->associated ||
2439 memcmp(mgmt->bssid, ifmgd->associated->bssid, ETH_ALEN)) 2441 compare_ether_addr(mgmt->bssid, ifmgd->associated->bssid))
2440 return; 2442 return;
2441 bssid = ifmgd->associated->bssid; 2443 bssid = ifmgd->associated->bssid;
2442 2444
@@ -3299,7 +3301,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3299 bool match; 3301 bool match;
3300 3302
3301 /* keep sta info, bssid if matching */ 3303 /* keep sta info, bssid if matching */
3302 match = memcmp(ifmgd->bssid, req->bss->bssid, ETH_ALEN) == 0; 3304 match = compare_ether_addr(ifmgd->bssid, req->bss->bssid) == 0;
3303 ieee80211_destroy_auth_data(sdata, match); 3305 ieee80211_destroy_auth_data(sdata, match);
3304 } 3306 }
3305 3307
@@ -3421,7 +3423,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3421 goto err_clear; 3423 goto err_clear;
3422 } 3424 }
3423 } else 3425 } else
3424 WARN_ON_ONCE(memcmp(ifmgd->bssid, req->bss->bssid, ETH_ALEN)); 3426 WARN_ON_ONCE(compare_ether_addr(ifmgd->bssid, req->bss->bssid));
3425 3427
3426 if (!bss->dtim_period && 3428 if (!bss->dtim_period &&
3427 sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) { 3429 sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
@@ -3471,7 +3473,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
3471 sdata->name, req->bssid, req->reason_code); 3473 sdata->name, req->bssid, req->reason_code);
3472 3474
3473 if (ifmgd->associated && 3475 if (ifmgd->associated &&
3474 memcmp(ifmgd->associated->bssid, req->bssid, ETH_ALEN) == 0) 3476 compare_ether_addr(ifmgd->associated->bssid, req->bssid) == 0)
3475 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, 3477 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
3476 req->reason_code, true, frame_buf); 3478 req->reason_code, true, frame_buf);
3477 else 3479 else
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 7a4ff02af261..3cf011fc97f4 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -489,12 +489,12 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
489 if (ieee80211_has_tods(hdr->frame_control) || 489 if (ieee80211_has_tods(hdr->frame_control) ||
490 !ieee80211_has_fromds(hdr->frame_control)) 490 !ieee80211_has_fromds(hdr->frame_control))
491 return RX_DROP_MONITOR; 491 return RX_DROP_MONITOR;
492 if (memcmp(hdr->addr3, dev_addr, ETH_ALEN) == 0) 492 if (compare_ether_addr(hdr->addr3, dev_addr) == 0)
493 return RX_DROP_MONITOR; 493 return RX_DROP_MONITOR;
494 } else { 494 } else {
495 if (!ieee80211_has_a4(hdr->frame_control)) 495 if (!ieee80211_has_a4(hdr->frame_control))
496 return RX_DROP_MONITOR; 496 return RX_DROP_MONITOR;
497 if (memcmp(hdr->addr4, dev_addr, ETH_ALEN) == 0) 497 if (compare_ether_addr(hdr->addr4, dev_addr) == 0)
498 return RX_DROP_MONITOR; 498 return RX_DROP_MONITOR;
499 } 499 }
500 } 500 }
@@ -2336,7 +2336,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
2336 if (sdata->vif.type != NL80211_IFTYPE_STATION) 2336 if (sdata->vif.type != NL80211_IFTYPE_STATION)
2337 break; 2337 break;
2338 2338
2339 if (memcmp(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN)) 2339 if (compare_ether_addr(mgmt->bssid, sdata->u.mgd.bssid))
2340 break; 2340 break;
2341 2341
2342 goto queue; 2342 goto queue;
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 9270771702fe..a9d7235df7c3 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/if_arp.h> 15#include <linux/if_arp.h>
16#include <linux/etherdevice.h>
16#include <linux/rtnetlink.h> 17#include <linux/rtnetlink.h>
17#include <linux/pm_qos.h> 18#include <linux/pm_qos.h>
18#include <net/sch_generic.h> 19#include <net/sch_generic.h>
@@ -176,7 +177,7 @@ ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
176 presp = ieee80211_is_probe_resp(fc); 177 presp = ieee80211_is_probe_resp(fc);
177 if (presp) { 178 if (presp) {
178 /* ignore ProbeResp to foreign address */ 179 /* ignore ProbeResp to foreign address */
179 if (memcmp(mgmt->da, sdata->vif.addr, ETH_ALEN)) 180 if (compare_ether_addr(mgmt->da, sdata->vif.addr))
180 return RX_DROP_MONITOR; 181 return RX_DROP_MONITOR;
181 182
182 presp = true; 183 presp = true;
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));
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
index 23a97c9dc042..3336d54e5558 100644
--- a/net/mac80211/sta_info.h
+++ b/net/mac80211/sta_info.h
@@ -14,6 +14,7 @@
14#include <linux/if_ether.h> 14#include <linux/if_ether.h>
15#include <linux/workqueue.h> 15#include <linux/workqueue.h>
16#include <linux/average.h> 16#include <linux/average.h>
17#include <linux/etherdevice.h>
17#include "key.h" 18#include "key.h"
18 19
19/** 20/**
@@ -489,7 +490,7 @@ void for_each_sta_info_type_check(struct ieee80211_local *local,
489 nxt = _sta ? rcu_dereference(_sta->hnext) : NULL \ 490 nxt = _sta ? rcu_dereference(_sta->hnext) : NULL \
490 ) \ 491 ) \
491 /* compare address and run code only if it matches */ \ 492 /* compare address and run code only if it matches */ \
492 if (memcmp(_sta->sta.addr, (_addr), ETH_ALEN) == 0) 493 if (compare_ether_addr(_sta->sta.addr, (_addr)) == 0)
493 494
494/* 495/*
495 * Get STA info by index, BROKEN! 496 * Get STA info by index, BROKEN!
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index c928e4a4effd..5f8f89e89d6b 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/export.h> 12#include <linux/export.h>
13#include <linux/etherdevice.h>
13#include <net/mac80211.h> 14#include <net/mac80211.h>
14#include <asm/unaligned.h> 15#include <asm/unaligned.h>
15#include "ieee80211_i.h" 16#include "ieee80211_i.h"
@@ -377,7 +378,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
377 378
378 for_each_sta_info(local, hdr->addr1, sta, tmp) { 379 for_each_sta_info(local, hdr->addr1, sta, tmp) {
379 /* skip wrong virtual interface */ 380 /* skip wrong virtual interface */
380 if (memcmp(hdr->addr2, sta->sdata->vif.addr, ETH_ALEN)) 381 if (compare_ether_addr(hdr->addr2, sta->sdata->vif.addr))
381 continue; 382 continue;
382 383
383 if (info->flags & IEEE80211_TX_STATUS_EOSP) 384 if (info->flags & IEEE80211_TX_STATUS_EOSP)