Skip to content

Commit 4f29739

Browse files
dingtianhongdavem330
authored andcommitted
rtlwifi: slight optimization of addr compare
Use possibly more efficient ether_addr_equal_unaligned instead of memcmp. Cc: Larry Finger <[email protected]> Cc: Chaoming Li <[email protected]> Cc: John W. Linville <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: Weilong Chen <[email protected]> Signed-off-by: Ding Tianhong <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent fcad766 commit 4f29739

File tree

1 file changed

+2
-2
lines changed
  • drivers/net/wireless/rtlwifi

1 file changed

+2
-2
lines changed

drivers/net/wireless/rtlwifi/cam.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr)
295295
/* Does STA already exist? */
296296
for (i = 4; i < TOTAL_CAM_ENTRY; i++) {
297297
addr = rtlpriv->sec.hwsec_cam_sta_addr[i];
298-
if (memcmp(addr, sta_addr, ETH_ALEN) == 0)
298+
if (ether_addr_equal_unaligned(addr, sta_addr))
299299
return i;
300300
}
301301
/* Get a free CAM entry. */
@@ -335,7 +335,7 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr)
335335
addr = rtlpriv->sec.hwsec_cam_sta_addr[i];
336336
bitmap = (rtlpriv->sec.hwsec_cam_bitmap) >> i;
337337
if (((bitmap & BIT(0)) == BIT(0)) &&
338-
(memcmp(addr, sta_addr, ETH_ALEN) == 0)) {
338+
(ether_addr_equal_unaligned(addr, sta_addr))) {
339339
/* Remove from HW Security CAM */
340340
eth_zero_addr(rtlpriv->sec.hwsec_cam_sta_addr[i]);
341341
rtlpriv->sec.hwsec_cam_bitmap &= ~(BIT(0) << i);

0 commit comments

Comments
 (0)