Skip to contentSkip to conversation

rtlwifi: slight optimization of addr compare

PATCH In review Ding Tianhong 3 participants 4 messages Dec 26, 2013 – Jan 6, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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
index 0e510f7..0276153 100644
@@ -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
#1 lore raw

Hello.

Quoted 19 lines · Ding Tianhong

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 +0 -0
index 0e510f7..0276153 100644

[...]

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

#2 lore raw
Quoted 24 lines · Sergei Shtylyov

Hello.

Quoted 19 lines · Ding Tianhong

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 +0 -0
index 0e510f7..0276153 100644

[...]

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.
#3 lore raw
Quoted 34 lines · John W. Linville
Quoted 24 lines · Sergei Shtylyov

Hello.

Quoted 19 lines · Ding Tianhong

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 +0 -0
index 0e510f7..0276153 100644

[...]

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.