rtlwifi: slight optimization of addr compare
authordingtianhong <dingtianhong@huawei.com>
Thu, 26 Dec 2013 11:41:30 +0000 (19:41 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 26 Dec 2013 18:31:35 +0000 (13:31 -0500)
Use possibly more efficient ether_addr_equal_unaligned
instead of memcmp.

Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Chaoming Li <chaoming_li@realsil.com.cn>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Weilong Chen <chenweilong@huawei.com>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wireless/rtlwifi/cam.c

index 0e510f73041ab88659b131c2a392598046e127fe..0276153c72cc2b8f65a8eed5cfeb638b793012f9 100644 (file)
@@ -295,7 +295,7 @@ u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr)
        /* Does STA already exist? */
        for (i = 4; i < TOTAL_CAM_ENTRY; i++) {
                addr = rtlpriv->sec.hwsec_cam_sta_addr[i];
-               if (memcmp(addr, sta_addr, ETH_ALEN) == 0)
+               if (ether_addr_equal_unaligned(addr, sta_addr))
                        return i;
        }
        /* Get a free CAM entry. */
@@ -335,7 +335,7 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr)
                addr = rtlpriv->sec.hwsec_cam_sta_addr[i];
                bitmap = (rtlpriv->sec.hwsec_cam_bitmap) >> i;
                if (((bitmap & BIT(0)) == BIT(0)) &&
-                   (memcmp(addr, sta_addr, ETH_ALEN) == 0)) {
+                   (ether_addr_equal_unaligned(addr, sta_addr))) {
                        /* Remove from HW Security CAM */
                        eth_zero_addr(rtlpriv->sec.hwsec_cam_sta_addr[i]);
                        rtlpriv->sec.hwsec_cam_bitmap &= ~(BIT(0) << i);