2022-10-31 21:09:26

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 0/3] 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(-)

--
2.30.2



2022-10-31 21:11:22

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 3/3] staging: r8188eu: use ieee80211_get_SA

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

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
index 4e9d8c8285c4..9a61eef8550b 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
@@ -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;
--
2.30.2


2022-10-31 21:11:30

by Martin Kaiser

[permalink] [raw]
Subject: [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.

Suggested-by: Joe Perches <[email protected]>
Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
index f01ae71bcdb1..10bb2e602984 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
@@ -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) {
--
2.30.2


2022-10-31 21:18:16

by Martin Kaiser

[permalink] [raw]
Subject: [PATCH 2/3] staging: r8188eu: use hdr->frame_control instead of fc

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

Signed-off-by: Martin Kaiser <[email protected]>
---
drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
index 10bb2e602984..4e9d8c8285c4 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
@@ -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;
--
2.30.2


2022-10-31 22:33:05

by Philipp Hortmann

[permalink] [raw]
Subject: Re: [PATCH 0/3] staging: r8188eu: clean up update_recvframe_phyinfo_88e

On 10/31/22 21:54, Martin Kaiser wrote:
> 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(-)
>

Tested-by: Philipp Hortmann <[email protected]> # Edimax N150