Browse Source

rtlwifi: use ether_addr_equal_64bits

Ether_addr_equal_64bits is more efficient than ether_addr_equal, and can be
used when each argument is an array within a structure that contains at
least two bytes of data beyond the array.

The structures involved are:
ieee80211_hdr defined in include/linux/ieee80211.h and
rtl_mac defined in drivers/net/wireless/rtlwifi/wifi.h

This was done using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Julia Lawall 11 years ago
parent
commit
90908e1cd1
2 changed files with 4 additions and 4 deletions
  1. 2 2
      drivers/net/wireless/rtlwifi/base.c
  2. 2 2
      drivers/net/wireless/rtlwifi/ps.c

+ 2 - 2
drivers/net/wireless/rtlwifi/base.c

@@ -1293,7 +1293,7 @@ void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb)
 		return;
 		return;
 
 
 	/* and only beacons from the associated BSSID, please */
 	/* and only beacons from the associated BSSID, please */
-	if (!ether_addr_equal(hdr->addr3, rtlpriv->mac80211.bssid))
+	if (!ether_addr_equal_64bits(hdr->addr3, rtlpriv->mac80211.bssid))
 		return;
 		return;
 
 
 	rtlpriv->link_info.bcn_rx_inperiod++;
 	rtlpriv->link_info.bcn_rx_inperiod++;
@@ -1781,7 +1781,7 @@ void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len)
 		return;
 		return;
 
 
 	/* and only beacons from the associated BSSID, please */
 	/* and only beacons from the associated BSSID, please */
-	if (!ether_addr_equal(hdr->addr3, rtlpriv->mac80211.bssid))
+	if (!ether_addr_equal_64bits(hdr->addr3, rtlpriv->mac80211.bssid))
 		return;
 		return;
 
 
 	if (rtl_find_221_ie(hw, data, len))
 	if (rtl_find_221_ie(hw, data, len))

+ 2 - 2
drivers/net/wireless/rtlwifi/ps.c

@@ -478,7 +478,7 @@ void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len)
 		return;
 		return;
 
 
 	/* and only beacons from the associated BSSID, please */
 	/* and only beacons from the associated BSSID, please */
-	if (!ether_addr_equal(hdr->addr3, rtlpriv->mac80211.bssid))
+	if (!ether_addr_equal_64bits(hdr->addr3, rtlpriv->mac80211.bssid))
 		return;
 		return;
 
 
 	rtlpriv->psc.last_beacon = jiffies;
 	rtlpriv->psc.last_beacon = jiffies;
@@ -923,7 +923,7 @@ void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len)
 		return;
 		return;
 
 
 	/* and only beacons from the associated BSSID, please */
 	/* and only beacons from the associated BSSID, please */
-	if (!ether_addr_equal(hdr->addr3, rtlpriv->mac80211.bssid))
+	if (!ether_addr_equal_64bits(hdr->addr3, rtlpriv->mac80211.bssid))
 		return;
 		return;
 
 
 	/* check if this really is a beacon */
 	/* check if this really is a beacon */