rtlwifi: slight optimization of addr compare
Subsystems (3)
PATCH 18/19 rtlwifi: slight optimization of addr compare
Use possibly more efficient ether_addr_equal_unaligned instead of memcmp.
--- drivers/net/wireless/rtlwifi/cam.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/rtlwifi/cam.c +2 -2
@@ -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);
Signature · 1 line
1.8.0
Hello.
Quoted 19 lines · Ding Tianhong
Use possibly more efficient
ether_addr_equal_unalignedinstead of memcmp.Cc Larry Finger <[email protected]>Cc Chaoming Li <[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/rtlwifi/cam.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/wireless/rtlwifi/cam.c +0
-0
[...]
drivers/net/wireless/rtlwifi/cam.c void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) · line 338
Quoted 6 lines
drivers/net/wireless/rtlwifi/cam.c +1
-1@@ -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))) {
It's pointless to enclose function call in parens, again.
WBR, Sergei
Quoted 24 lines · Sergei Shtylyov
Hello.
Quoted 19 lines · Ding Tianhong
Use possibly more efficient
ether_addr_equal_unalignedinstead of memcmp.Cc Larry Finger <[email protected]>Cc Chaoming Li <[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/rtlwifi/cam.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/wireless/rtlwifi/cam.c +0
-0[...]
Quoted 8 lines
drivers/net/wireless/rtlwifi/cam.c void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) · line 338
Quoted 6 lines
drivers/net/wireless/rtlwifi/cam.c +1
-1@@ -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))) {It's pointless to enclose function call in parens, again.
I'll correct that issue when merging the patch.
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
Quoted 34 lines · John W. Linville
Quoted 24 lines · Sergei Shtylyov
Hello.
Quoted 19 lines · Ding Tianhong
Use possibly more efficient
ether_addr_equal_unalignedinstead of memcmp.Cc Larry Finger <[email protected]>Cc Chaoming Li <[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/rtlwifi/cam.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/net/wireless/rtlwifi/cam.c +0
-0[...]
Quoted 8 lines
drivers/net/wireless/rtlwifi/cam.c void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) · line 338
Quoted 6 lines
drivers/net/wireless/rtlwifi/cam.c +1
-1@@ -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))) {It's pointless to enclose function call in parens, again.
Quoted 1 line
I'll correct that issue when merging the patch.
Well, that was the plan... But since ether_addr_equal_unaligned isn't in the wireless trees at the moment, it will have to wait or go through another tree that has that definition. Feel free to respin with the extra parenthesis removed...
John
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.