Skip to content

Commit 539c89c

Browse files
committed
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 <[email protected]>
2 parents 306d7f7 + 692e516 commit 539c89c

File tree

34 files changed

+94
-101
lines changed

34 files changed

+94
-101
lines changed

drivers/atm/nicstar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include <asm/io.h>
5353
#include <asm/uaccess.h>
5454
#include <linux/atomic.h>
55+
#include <linux/etherdevice.h>
5556
#include "nicstar.h"
5657
#ifdef CONFIG_ATM_NICSTAR_USE_SUNI
5758
#include "suni.h"
@@ -781,8 +782,7 @@ static int ns_init_card(int i, struct pci_dev *pcidev)
781782
if (mac[i] == NULL || !mac_pton(mac[i], card->atmdev->esi)) {
782783
nicstar_read_eprom(card->membase, NICSTAR_EPROM_MAC_ADDR_OFFSET,
783784
card->atmdev->esi, 6);
784-
if (memcmp(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00", 6) ==
785-
0) {
785+
if (ether_addr_equal(card->atmdev->esi, "\x00\x00\x00\x00\x00\x00")) {
786786
nicstar_read_eprom(card->membase,
787787
NICSTAR_EPROM_MAC_ADDR_OFFSET_ALT,
788788
card->atmdev->esi, 6);

drivers/infiniband/hw/nes/nes_cm.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,8 +1354,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi
13541354
neigh->ha, ntohl(rt->rt_gateway));
13551355

13561356
if (arpindex >= 0) {
1357-
if (!memcmp(nesadapter->arp_table[arpindex].mac_addr,
1358-
neigh->ha, ETH_ALEN)) {
1357+
if (ether_addr_equal(nesadapter->arp_table[arpindex].mac_addr, neigh->ha)) {
13591358
/* Mac address same as in nes_arp_table */
13601359
goto out;
13611360
}

drivers/isdn/i4l/isdn_net.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@ isdn_net_type_trans(struct sk_buff *skb, struct net_device *dev)
13711371
eth = eth_hdr(skb);
13721372

13731373
if (*eth->h_dest & 1) {
1374-
if (memcmp(eth->h_dest, dev->broadcast, ETH_ALEN) == 0)
1374+
if (ether_addr_equal(eth->h_dest, dev->broadcast))
13751375
skb->pkt_type = PACKET_BROADCAST;
13761376
else
13771377
skb->pkt_type = PACKET_MULTICAST;
@@ -1382,7 +1382,7 @@ isdn_net_type_trans(struct sk_buff *skb, struct net_device *dev)
13821382
*/
13831383

13841384
else if (dev->flags & (IFF_PROMISC /*| IFF_ALLMULTI*/)) {
1385-
if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN))
1385+
if (!ether_addr_equal(eth->h_dest, dev->dev_addr))
13861386
skb->pkt_type = PACKET_OTHERHOST;
13871387
}
13881388
if (ntohs(eth->h_proto) >= ETH_P_802_3_MIN)

drivers/media/dvb-core/dvb_net.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb,
179179
eth = eth_hdr(skb);
180180

181181
if (*eth->h_dest & 1) {
182-
if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)
182+
if(ether_addr_equal(eth->h_dest,dev->broadcast))
183183
skb->pkt_type=PACKET_BROADCAST;
184184
else
185185
skb->pkt_type=PACKET_MULTICAST;
@@ -674,11 +674,13 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
674674
if (priv->rx_mode != RX_MODE_PROMISC) {
675675
if (priv->ule_skb->data[0] & 0x01) {
676676
/* multicast or broadcast */
677-
if (memcmp(priv->ule_skb->data, bc_addr, ETH_ALEN)) {
677+
if (!ether_addr_equal(priv->ule_skb->data, bc_addr)) {
678678
/* multicast */
679679
if (priv->rx_mode == RX_MODE_MULTI) {
680680
int i;
681-
for(i = 0; i < priv->multi_num && memcmp(priv->ule_skb->data, priv->multi_macs[i], ETH_ALEN); i++)
681+
for(i = 0; i < priv->multi_num &&
682+
!ether_addr_equal(priv->ule_skb->data,
683+
priv->multi_macs[i]); i++)
682684
;
683685
if (i == priv->multi_num)
684686
drop = 1;
@@ -688,7 +690,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
688690
}
689691
/* else: broadcast */
690692
}
691-
else if (memcmp(priv->ule_skb->data, dev->dev_addr, ETH_ALEN))
693+
else if (!ether_addr_equal(priv->ule_skb->data, dev->dev_addr))
692694
drop = 1;
693695
/* else: destination address matches the MAC address of our receiver device */
694696
}

drivers/net/ethernet/amd/pcnet32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1668,7 +1668,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
16681668
for (i = 0; i < ETH_ALEN; i++)
16691669
promaddr[i] = inb(ioaddr + i);
16701670

1671-
if (memcmp(promaddr, dev->dev_addr, ETH_ALEN) ||
1671+
if (!ether_addr_equal(promaddr, dev->dev_addr) ||
16721672
!is_valid_ether_addr(dev->dev_addr)) {
16731673
if (is_valid_ether_addr(promaddr)) {
16741674
if (pcnet32_debug & NETIF_MSG_PROBE) {

drivers/net/ethernet/atheros/atlx/atl1.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3122,7 +3122,8 @@ static void atl1_remove(struct pci_dev *pdev)
31223122
* from the BIOS during POST. If we've been messing with the MAC
31233123
* address, we need to save the permanent one.
31243124
*/
3125-
if (memcmp(adapter->hw.mac_addr, adapter->hw.perm_mac_addr, ETH_ALEN)) {
3125+
if (!ether_addr_equal_unaligned(adapter->hw.mac_addr,
3126+
adapter->hw.perm_mac_addr)) {
31263127
memcpy(adapter->hw.mac_addr, adapter->hw.perm_mac_addr,
31273128
ETH_ALEN);
31283129
atl1_set_mac_addr(&adapter->hw);

drivers/net/ethernet/freescale/ucc_geth.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,6 @@ static void hw_add_addr_in_hash(struct ucc_geth_private *ugeth,
435435
QE_CR_PROTOCOL_ETHERNET, 0);
436436
}
437437

438-
static inline int compare_addr(u8 **addr1, u8 **addr2)
439-
{
440-
return memcmp(addr1, addr2, ETH_ALEN);
441-
}
442-
443438
#ifdef DEBUG
444439
static void get_statistics(struct ucc_geth_private *ugeth,
445440
struct ucc_geth_tx_firmware_statistics *

drivers/net/hamradio/bpqether.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
208208
eth = eth_hdr(skb);
209209

210210
if (!(bpq->acpt_addr[0] & 0x01) &&
211-
memcmp(eth->h_source, bpq->acpt_addr, ETH_ALEN))
211+
!ether_addr_equal(eth->h_source, bpq->acpt_addr))
212212
goto drop_unlock;
213213

214214
if (skb_cow(skb, sizeof(struct ethhdr)))

drivers/net/ppp/pppoe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ static inline struct pppoe_net *pppoe_pernet(struct net *net)
131131

132132
static inline int cmp_2_addr(struct pppoe_addr *a, struct pppoe_addr *b)
133133
{
134-
return a->sid == b->sid && !memcmp(a->remote, b->remote, ETH_ALEN);
134+
return a->sid == b->sid && ether_addr_equal(a->remote, b->remote);
135135
}
136136

137137
static inline int cmp_addr(struct pppoe_addr *a, __be16 sid, char *addr)
138138
{
139-
return a->sid == sid && !memcmp(a->remote, addr, ETH_ALEN);
139+
return a->sid == sid && ether_addr_equal(a->remote, addr);
140140
}
141141

142142
#if 8 % PPPOE_HASH_BITS

drivers/net/wireless/adm8211.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ static void adm8211_bss_info_changed(struct ieee80211_hw *dev,
13141314
if (!(changes & BSS_CHANGED_BSSID))
13151315
return;
13161316

1317-
if (memcmp(conf->bssid, priv->bssid, ETH_ALEN)) {
1317+
if (!ether_addr_equal(conf->bssid, priv->bssid)) {
13181318
adm8211_set_bssid(dev, conf->bssid);
13191319
memcpy(priv->bssid, conf->bssid, ETH_ALEN);
13201320
}

drivers/net/wireless/brcm80211/brcmfmac/p2p.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ bool brcmf_p2p_scan_finding_common_channel(struct brcmf_cfg80211_info *cfg,
12431243
IEEE80211_P2P_ATTR_DEVICE_ID,
12441244
p2p_dev_addr, sizeof(p2p_dev_addr));
12451245
if ((err >= 0) &&
1246-
(!memcmp(p2p_dev_addr, afx_hdl->tx_dst_addr, ETH_ALEN))) {
1246+
(ether_addr_equal(p2p_dev_addr, afx_hdl->tx_dst_addr))) {
12471247
if (!bi->ctl_ch) {
12481248
ch.chspec = le16_to_cpu(bi->chanspec);
12491249
cfg->d11inf.decchspec(&ch);
@@ -1380,8 +1380,7 @@ int brcmf_p2p_notify_action_frame_rx(struct brcmf_if *ifp,
13801380
(brcmf_p2p_gon_req_collision(p2p, (u8 *)e->addr))) {
13811381
if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL,
13821382
&p2p->status) &&
1383-
(memcmp(afx_hdl->tx_dst_addr, e->addr,
1384-
ETH_ALEN) == 0)) {
1383+
(ether_addr_equal(afx_hdl->tx_dst_addr, e->addr))) {
13851384
afx_hdl->peer_chan = ch.chnum;
13861385
brcmf_dbg(INFO, "GON request: Peer found, channel=%d\n",
13871386
afx_hdl->peer_chan);
@@ -1865,7 +1864,7 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp,
18651864
cfg->d11inf.decchspec(&ch);
18661865

18671866
if (test_bit(BRCMF_P2P_STATUS_FINDING_COMMON_CHANNEL, &p2p->status) &&
1868-
(memcmp(afx_hdl->tx_dst_addr, e->addr, ETH_ALEN) == 0)) {
1867+
(ether_addr_equal(afx_hdl->tx_dst_addr, e->addr))) {
18691868
afx_hdl->peer_chan = ch.chnum;
18701869
brcmf_dbg(INFO, "PROBE REQUEST: Peer found, channel=%d\n",
18711870
afx_hdl->peer_chan);

drivers/net/wireless/cw1200/sta.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/sched.h>
1414
#include <linux/firmware.h>
1515
#include <linux/module.h>
16+
#include <linux/etherdevice.h>
1617

1718
#include "cw1200.h"
1819
#include "sta.h"
@@ -555,8 +556,8 @@ u64 cw1200_prepare_multicast(struct ieee80211_hw *hw,
555556
pr_debug("[STA] multicast: %pM\n", ha->addr);
556557
memcpy(&priv->multicast_filter.macaddrs[count],
557558
ha->addr, ETH_ALEN);
558-
if (memcmp(ha->addr, broadcast_ipv4, ETH_ALEN) &&
559-
memcmp(ha->addr, broadcast_ipv6, ETH_ALEN))
559+
if (!ether_addr_equal(ha->addr, broadcast_ipv4) &&
560+
!ether_addr_equal(ha->addr, broadcast_ipv6))
560561
priv->has_multicast_subscription = true;
561562
count++;
562563
}

drivers/net/wireless/cw1200/txrx.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,8 +1166,7 @@ void cw1200_rx_cb(struct cw1200_common *priv,
11661166
return;
11671167
} else if (ieee80211_is_beacon(frame->frame_control) &&
11681168
!arg->status && priv->vif &&
1169-
!memcmp(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid,
1170-
ETH_ALEN)) {
1169+
ether_addr_equal(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid)) {
11711170
const u8 *tim_ie;
11721171
u8 *ies = ((struct ieee80211_mgmt *)
11731172
(skb->data))->u.beacon.variable;

drivers/net/wireless/hostap/hostap_80211_rx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr *hdr, u16 fc,
563563

564564
/* Possible WDS frame: either IEEE 802.11 compliant (if FromDS)
565565
* or own non-standard frame with 4th address after payload */
566-
if (memcmp(hdr->addr1, local->dev->dev_addr, ETH_ALEN) != 0 &&
566+
if (!ether_addr_equal(hdr->addr1, local->dev->dev_addr) &&
567567
(hdr->addr1[0] != 0xff || hdr->addr1[1] != 0xff ||
568568
hdr->addr1[2] != 0xff || hdr->addr1[3] != 0xff ||
569569
hdr->addr1[4] != 0xff || hdr->addr1[5] != 0xff)) {
@@ -622,12 +622,12 @@ static int hostap_is_eapol_frame(local_info_t *local, struct sk_buff *skb)
622622
/* check that the frame is unicast frame to us */
623623
if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
624624
IEEE80211_FCTL_TODS &&
625-
memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0 &&
626-
memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) {
625+
ether_addr_equal(hdr->addr1, dev->dev_addr) &&
626+
ether_addr_equal(hdr->addr3, dev->dev_addr)) {
627627
/* ToDS frame with own addr BSSID and DA */
628628
} else if ((fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) ==
629629
IEEE80211_FCTL_FROMDS &&
630-
memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {
630+
ether_addr_equal(hdr->addr1, dev->dev_addr)) {
631631
/* FromDS frame with own addr as DA */
632632
} else
633633
return 0;

drivers/net/wireless/hostap/hostap_80211_tx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <linux/slab.h>
22
#include <linux/export.h>
3+
#include <linux/etherdevice.h>
34

45
#include "hostap_80211.h"
56
#include "hostap_common.h"
@@ -103,8 +104,7 @@ netdev_tx_t hostap_data_start_xmit(struct sk_buff *skb,
103104
return NETDEV_TX_OK;
104105
} else if (local->iw_mode == IW_MODE_INFRA &&
105106
(local->wds_type & HOSTAP_WDS_AP_CLIENT) &&
106-
memcmp(skb->data + ETH_ALEN, dev->dev_addr,
107-
ETH_ALEN) != 0) {
107+
!ether_addr_equal(skb->data + ETH_ALEN, dev->dev_addr)) {
108108
/* AP client mode: send frames with foreign src addr
109109
* using 4-addr WDS frames */
110110
use_wds = WDS_COMPLIANT_FRAME;

drivers/net/wireless/hostap/hostap_ap.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/slab.h>
2525
#include <linux/export.h>
2626
#include <linux/moduleparam.h>
27+
#include <linux/etherdevice.h>
2728

2829
#include "hostap_wlan.h"
2930
#include "hostap.h"
@@ -106,13 +107,12 @@ static void ap_sta_hash_del(struct ap_data *ap, struct sta_info *sta)
106107

107108
s = ap->sta_hash[STA_HASH(sta->addr)];
108109
if (s == NULL) return;
109-
if (memcmp(s->addr, sta->addr, ETH_ALEN) == 0) {
110+
if (ether_addr_equal(s->addr, sta->addr)) {
110111
ap->sta_hash[STA_HASH(sta->addr)] = s->hnext;
111112
return;
112113
}
113114

114-
while (s->hnext != NULL && memcmp(s->hnext->addr, sta->addr, ETH_ALEN)
115-
!= 0)
115+
while (s->hnext != NULL && !ether_addr_equal(s->hnext->addr, sta->addr))
116116
s = s->hnext;
117117
if (s->hnext != NULL)
118118
s->hnext = s->hnext->hnext;
@@ -435,7 +435,7 @@ int ap_control_del_mac(struct mac_restrictions *mac_restrictions, u8 *mac)
435435
ptr != &mac_restrictions->mac_list; ptr = ptr->next) {
436436
entry = list_entry(ptr, struct mac_entry, list);
437437

438-
if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
438+
if (ether_addr_equal(entry->addr, mac)) {
439439
list_del(ptr);
440440
kfree(entry);
441441
mac_restrictions->entries--;
@@ -459,7 +459,7 @@ static int ap_control_mac_deny(struct mac_restrictions *mac_restrictions,
459459

460460
spin_lock_bh(&mac_restrictions->lock);
461461
list_for_each_entry(entry, &mac_restrictions->mac_list, list) {
462-
if (memcmp(entry->addr, mac, ETH_ALEN) == 0) {
462+
if (ether_addr_equal(entry->addr, mac)) {
463463
found = 1;
464464
break;
465465
}
@@ -957,7 +957,7 @@ static struct sta_info* ap_get_sta(struct ap_data *ap, u8 *sta)
957957
struct sta_info *s;
958958

959959
s = ap->sta_hash[STA_HASH(sta)];
960-
while (s != NULL && memcmp(s->addr, sta, ETH_ALEN) != 0)
960+
while (s != NULL && !ether_addr_equal(s->addr, sta))
961961
s = s->hnext;
962962
return s;
963963
}
@@ -1391,7 +1391,7 @@ static void handle_authen(local_info_t *local, struct sk_buff *skb,
13911391
status_code = __le16_to_cpu(*pos);
13921392
pos++;
13931393

1394-
if (memcmp(dev->dev_addr, hdr->addr2, ETH_ALEN) == 0 ||
1394+
if (ether_addr_equal(dev->dev_addr, hdr->addr2) ||
13951395
ap_control_mac_deny(&ap->mac_restrictions, hdr->addr2)) {
13961396
txt = "authentication denied";
13971397
resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
@@ -1935,7 +1935,7 @@ static void handle_pspoll(local_info_t *local,
19351935
PDEBUG(DEBUG_PS2, "handle_pspoll: BSSID=%pM, TA=%pM PWRMGT=%d\n",
19361936
hdr->addr1, hdr->addr2, !!ieee80211_has_pm(hdr->frame_control));
19371937

1938-
if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
1938+
if (!ether_addr_equal(hdr->addr1, dev->dev_addr)) {
19391939
PDEBUG(DEBUG_AP,
19401940
"handle_pspoll - addr1(BSSID)=%pM not own MAC\n",
19411941
hdr->addr1);
@@ -2230,7 +2230,7 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
22302230
goto done;
22312231
}
22322232

2233-
if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
2233+
if (!ether_addr_equal(hdr->addr1, dev->dev_addr)) {
22342234
PDEBUG(DEBUG_AP, "handle_ap_item - addr1(BSSID)=%pM"
22352235
" not own MAC\n", hdr->addr1);
22362236
goto done;
@@ -2267,13 +2267,13 @@ static void handle_ap_item(local_info_t *local, struct sk_buff *skb,
22672267
goto done;
22682268
}
22692269

2270-
if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) {
2270+
if (!ether_addr_equal(hdr->addr1, dev->dev_addr)) {
22712271
PDEBUG(DEBUG_AP, "handle_ap_item - addr1(DA)=%pM"
22722272
" not own MAC\n", hdr->addr1);
22732273
goto done;
22742274
}
22752275

2276-
if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) {
2276+
if (!ether_addr_equal(hdr->addr3, dev->dev_addr)) {
22772277
PDEBUG(DEBUG_AP, "handle_ap_item - addr3(BSSID)=%pM"
22782278
" not own MAC\n", hdr->addr3);
22792279
goto done;
@@ -3035,7 +3035,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
30353035
if (!wds) {
30363036
/* FromDS frame - not for us; probably
30373037
* broadcast/multicast in another BSS - drop */
3038-
if (memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {
3038+
if (ether_addr_equal(hdr->addr1, dev->dev_addr)) {
30393039
printk(KERN_DEBUG "Odd.. FromDS packet "
30403040
"received with own BSSID\n");
30413041
hostap_dump_rx_80211(dev->name, skb, rx_stats);
@@ -3044,7 +3044,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
30443044
goto out;
30453045
}
30463046
} else if (stype == IEEE80211_STYPE_NULLFUNC && sta == NULL &&
3047-
memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN) == 0) {
3047+
ether_addr_equal(hdr->addr1, dev->dev_addr)) {
30483048

30493049
if (local->hostapd) {
30503050
prism2_rx_80211(local->apdev, skb, rx_stats,
@@ -3073,7 +3073,7 @@ ap_rx_ret hostap_handle_sta_rx(local_info_t *local, struct net_device *dev,
30733073
/* If BSSID (Addr3) is foreign, this frame is a normal
30743074
* broadcast frame from an IBSS network. Drop it silently.
30753075
* If BSSID is own, report the dropping of this frame. */
3076-
if (memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN) == 0) {
3076+
if (ether_addr_equal(hdr->addr3, dev->dev_addr)) {
30773077
printk(KERN_DEBUG "%s: dropped received packet from %pM"
30783078
" with no ToDS flag "
30793079
"(type=0x%02x, subtype=0x%02x)\n", dev->name,

drivers/net/wireless/hostap/hostap_hw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2175,7 +2175,7 @@ static void hostap_tx_callback(local_info_t *local,
21752175
struct hostap_tx_callback_info *cb;
21762176

21772177
/* Make sure that frame was from us. */
2178-
if (memcmp(txdesc->addr2, local->dev->dev_addr, ETH_ALEN)) {
2178+
if (!ether_addr_equal(txdesc->addr2, local->dev->dev_addr)) {
21792179
printk(KERN_DEBUG "%s: TX callback - foreign frame\n",
21802180
local->dev->name);
21812181
return;

drivers/net/wireless/hostap/hostap_ioctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ static int hostap_join_ap(struct net_device *dev)
655655
if (!local->last_scan_results)
656656
break;
657657
entry = &local->last_scan_results[i];
658-
if (memcmp(local->preferred_ap, entry->bssid, ETH_ALEN) == 0) {
658+
if (ether_addr_equal(local->preferred_ap, entry->bssid)) {
659659
req.channel = entry->chid;
660660
break;
661661
}
@@ -1978,7 +1978,7 @@ static inline int prism2_translate_scan(local_info_t *local,
19781978
list_for_each(ptr, &local->bss_list) {
19791979
struct hostap_bss_info *bss;
19801980
bss = list_entry(ptr, struct hostap_bss_info, list);
1981-
if (memcmp(bss->bssid, scan->bssid, ETH_ALEN) == 0) {
1981+
if (ether_addr_equal(bss->bssid, scan->bssid)) {
19821982
bss->included = 1;
19831983
current_ev = __prism2_translate_scan(
19841984
local, info, scan, bss, current_ev,

0 commit comments

Comments
 (0)