cw1200: slight optimization of addr compare
Subsystems (3)
PATCH 18/21 cw1200: slight optimization of addr compare
Use the recently added and possibly more efficient ether_addr_equal_unaligned to instead of memcmp.
Cc Solomon Peachy <[email protected]>
Cc "John W. Linville" <[email protected]>
Signed-off-by Weilong Chen <[email protected]>
Signed-off-by Ding Tianhong <[email protected]>
--- drivers/net/wireless/cw1200/sta.c | 4 ++-- drivers/net/wireless/cw1200/txrx.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/net/wireless/cw1200/sta.c +2 -2
@@ -555,8 +555,8 @@ u64 cw1200_prepare_multicast(struct ieee80211_hw *hw,pr_debug ("[STA] multicast: %pM\n" , ha->addr);memcpy (&priv->multicast_filter.macaddrs[count], ha->addr,ETH_ALEN ); -if (memcmp (ha->addr, broadcast_ipv4,ETH_ALEN ) && -memcmp (ha->addr, broadcast_ipv6,ETH_ALEN )) +if (!ether_addr_equal_unaligned (ha->addr, broadcast_ipv4) && + !ether_addr_equal_unaligned (ha->addr, broadcast_ipv6)) priv->has_multicast_subscription = true; count++; }
drivers/net/wireless/cw1200/txrx.c +3 -4
@@ -816,7 +816,7 @@ static int cw1200_handle_pspoll(struct cw1200_common *priv,if (priv->join_status !=CW1200_JOIN_STATUS_AP ) goto done; -if (memcmp (priv->vif->addr, pspoll->bssid,ETH_ALEN )) +if (!ether_addr_equal_unaligned (priv->vif->addr, pspoll->bssid)) goto done;rcu_read_lock ();
@@ -1166,8 +1166,7 @@ void cw1200_rx_cb(struct cw1200_common *priv,return ; }else if (ieee80211_is_beacon (frame->frame_control) && !arg->status && priv->vif && - !memcmp (ieee80211_get_SA (frame), priv->vif->bss_conf.bssid, -ETH_ALEN )) { +ether_addr_equal_unaligned (ieee80211_get_SA (frame), priv->vif->bss_conf.bssid)) {const u8 *tim_ie;u8 *ies = ((struct ieee80211_mgmt *) (skb->data))->u.beacon.variable;
@@ -1314,7 +1313,7 @@ int cw1200_find_link_id(struct cw1200_common *priv, const u8 *mac)int i, ret =0 ;spin_lock_bh (&priv->ps_state_lock);for (i =0 ; i <CW1200_MAX_STA_IN_AP_MODE ; ++i) { -if (!memcmp (mac, priv->link_id_db[i].mac,ETH_ALEN ) && +if (ether_addr_equal_unaligned (mac, priv->link_id_db[i].mac) && priv->link_id_db[i].status) { priv->link_id_db[i].timestamp = jiffies; ret = i +1 ;
Signature · 1 line
1.8.0