linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] staging: r8188eu: clean up update_recvframe_phyinfo_88e
@ 2022-10-31 20:54 Martin Kaiser
  2022-10-31 20:54 ` [PATCH 1/3] staging: r8188eu: use ether_addr_equal for address comparison Martin Kaiser
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Martin Kaiser @ 2022-10-31 20:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, 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(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] staging: r8188eu: use ether_addr_equal for address comparison
  2022-10-31 20:54 [PATCH 0/3] staging: r8188eu: clean up update_recvframe_phyinfo_88e Martin Kaiser
@ 2022-10-31 20:54 ` Martin Kaiser
  2022-10-31 20:54 ` [PATCH 2/3] staging: r8188eu: use hdr->frame_control instead of fc Martin Kaiser
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Martin Kaiser @ 2022-10-31 20:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser, Joe Perches

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 <joe@perches.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] staging: r8188eu: use hdr->frame_control instead of fc
  2022-10-31 20:54 [PATCH 0/3] staging: r8188eu: clean up update_recvframe_phyinfo_88e Martin Kaiser
  2022-10-31 20:54 ` [PATCH 1/3] staging: r8188eu: use ether_addr_equal for address comparison Martin Kaiser
@ 2022-10-31 20:54 ` Martin Kaiser
  2022-10-31 20:54 ` [PATCH 3/3] staging: r8188eu: use ieee80211_get_SA Martin Kaiser
  2022-10-31 22:01 ` [PATCH 0/3] staging: r8188eu: clean up update_recvframe_phyinfo_88e Philipp Hortmann
  3 siblings, 0 replies; 5+ messages in thread
From: Martin Kaiser @ 2022-10-31 20:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

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

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] staging: r8188eu: use ieee80211_get_SA
  2022-10-31 20:54 [PATCH 0/3] staging: r8188eu: clean up update_recvframe_phyinfo_88e Martin Kaiser
  2022-10-31 20:54 ` [PATCH 1/3] staging: r8188eu: use ether_addr_equal for address comparison Martin Kaiser
  2022-10-31 20:54 ` [PATCH 2/3] staging: r8188eu: use hdr->frame_control instead of fc Martin Kaiser
@ 2022-10-31 20:54 ` Martin Kaiser
  2022-10-31 22:01 ` [PATCH 0/3] staging: r8188eu: clean up update_recvframe_phyinfo_88e Philipp Hortmann
  3 siblings, 0 replies; 5+ messages in thread
From: Martin Kaiser @ 2022-10-31 20:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

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

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] staging: r8188eu: clean up update_recvframe_phyinfo_88e
  2022-10-31 20:54 [PATCH 0/3] staging: r8188eu: clean up update_recvframe_phyinfo_88e Martin Kaiser
                   ` (2 preceding siblings ...)
  2022-10-31 20:54 ` [PATCH 3/3] staging: r8188eu: use ieee80211_get_SA Martin Kaiser
@ 2022-10-31 22:01 ` Philipp Hortmann
  3 siblings, 0 replies; 5+ messages in thread
From: Philipp Hortmann @ 2022-10-31 22:01 UTC (permalink / raw)
  To: Martin Kaiser, Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel

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 <philipp.g.hortmann@gmail.com> # Edimax N150

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-31 22:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-31 20:54 [PATCH 0/3] staging: r8188eu: clean up update_recvframe_phyinfo_88e Martin Kaiser
2022-10-31 20:54 ` [PATCH 1/3] staging: r8188eu: use ether_addr_equal for address comparison Martin Kaiser
2022-10-31 20:54 ` [PATCH 2/3] staging: r8188eu: use hdr->frame_control instead of fc Martin Kaiser
2022-10-31 20:54 ` [PATCH 3/3] staging: r8188eu: use ieee80211_get_SA Martin Kaiser
2022-10-31 22:01 ` [PATCH 0/3] staging: r8188eu: clean up update_recvframe_phyinfo_88e Philipp Hortmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).