Skip to contentSkip to conversation

staging: r8188eu: clean up update_recvframe_phyinfo_88e

PATCH In review Martin Kaiser 2 participants 5 messages Oct 31, 2022 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: r8188eu: clean up update_recvframe_phyinfo_88e

Here's three simple cleanups in the update_recvframe_phyinfo_88e function.

Martin Kaiser (3):
staging: r8188eu: use ether_addr_equal for address comparison
staging: r8188eu: use hdr->frame_control instead of fc
staging: r8188eu: use ieee80211_get_SA

 drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/3 staging: r8188eu: use ether_addr_equal for address comparison

We can use ether_addr_equal instead of memcmp in update_recvframe_phyinfo_88e for comparing the incoming frame's destination address with our local address.

Both struct ieee80211_hdr and struct eeprom_priv's mac_addr component are 2-byte aligned.

---
 drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c +2 -2
index f01ae71bcdb1..10bb2e602984 100644
@@ -126,8 +126,8 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, struct phy_stat
 		 get_bssid(&padapter->mlmepriv), ETH_ALEN));
 
 	pkt_info.bPacketToSelf = pkt_info.bPacketMatchBSSID &&
-				 (!memcmp(ieee80211_get_DA(hdr),
-				  myid(&padapter->eeprompriv), ETH_ALEN));
+				 ether_addr_equal(ieee80211_get_DA(hdr),
+						  myid(&padapter->eeprompriv));
 
 	pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID && ieee80211_is_beacon(fc);
 	if (pkt_info.bPacketBeacon) {
Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/3 staging: r8188eu: use hdr->frame_control instead of fc

In reply to Martin Kaiser

We can remove the fc variable in update_recvframe_phyinfo_88e and use hdr->frame_control instead.

---
 drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c +3 -3
index 10bb2e602984..4e9d8c8285c4 100644
@@ -114,13 +114,12 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, struct phy_stat
 	struct hal_data_8188e *pHalData = &padapter->haldata;
 	struct phy_info *pPHYInfo  = &pattrib->phy_info;
 	u8 *wlanhdr = precvframe->rx_data;
-	__le16 fc = *(__le16 *)wlanhdr;
 	struct odm_per_pkt_info	pkt_info;
 	u8 *sa = NULL;
 	struct sta_priv *pstapriv;
 	struct sta_info *psta;
 
-	pkt_info.bPacketMatchBSSID = ((!ieee80211_is_ctl(fc)) &&
+	pkt_info.bPacketMatchBSSID = ((!ieee80211_is_ctl(hdr->frame_control)) &&
 		!pattrib->icv_err && !pattrib->crc_err &&
 		!memcmp(get_hdr_bssid(wlanhdr),
 		 get_bssid(&padapter->mlmepriv), ETH_ALEN));
@@ -129,7 +128,8 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, struct phy_stat
 				 ether_addr_equal(ieee80211_get_DA(hdr),
 						  myid(&padapter->eeprompriv));
 
-	pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID && ieee80211_is_beacon(fc);
+	pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID &&
+				 ieee80211_is_beacon(hdr->frame_control);
 	if (pkt_info.bPacketBeacon) {
 		if (check_fwstate(&padapter->mlmepriv, WIFI_STATION_STATE))
 			sa = padapter->mlmepriv.cur_network.network.MacAddress;
Signature · 1 line
2.30.2
#3 lore raw

PATCH 3/3 staging: r8188eu: use ieee80211_get_SA

In reply to Martin Kaiser

Use ieee80211_get_SA in update_recvframe_phyinfo_88e instead of the driver-specific get_sa function.

---
 drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c +1 -1
index 4e9d8c8285c4..9a61eef8550b 100644
@@ -135,7 +135,7 @@ void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, struct phy_stat
 			sa = padapter->mlmepriv.cur_network.network.MacAddress;
 		/* to do Ad-hoc */
 	} else {
-		sa = get_sa(wlanhdr);
+		sa = ieee80211_get_SA(hdr);
 	}
 
 	pstapriv = &padapter->stapriv;
Signature · 1 line
2.30.2
Tested-by on the v1 series
#4 lore raw
In reply to Martin Kaiser
Quoted 10 lines · Martin Kaiser

Here's three simple cleanups in the update_recvframe_phyinfo_88e function.

Martin Kaiser (3):
staging: r8188eu: use ether_addr_equal for address comparison
staging: r8188eu: use hdr->frame_control instead of fc
staging: r8188eu: use ieee80211_get_SA

  drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)