Use possibly more efficient ether_addr_equal_unaligned
instead of memcmp.

Cc: Larry Finger <larry.fin...@lwfinger.net>
Cc: Chaoming Li <chaoming...@realsil.com.cn>
Cc: John W. Linville <linvi...@tuxdriver.com>
Cc: linux-wirel...@vger.kernel.org
Cc: net...@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Weilong Chen <chenweil...@huawei.com>
Signed-off-by: Ding Tianhong <dingtianh...@huawei.com>
---
 drivers/net/wireless/rtlwifi/cam.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/cam.c 
b/drivers/net/wireless/rtlwifi/cam.c
index 0e510f7..0276153 100644
--- a/drivers/net/wireless/rtlwifi/cam.c
+++ b/drivers/net/wireless/rtlwifi/cam.c
@@ -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);
-- 
1.8.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to