All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] staging: r8188eu: remove the last get_da calls
@ 2022-10-29 17:10 Martin Kaiser
  2022-10-29 17:10 ` [PATCH 1/2] staging: r8188eu: replace get_da with ieee80211_get_DA Martin Kaiser
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Martin Kaiser @ 2022-10-29 17:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Replace the remaining two get_da calls with ieee80211_get_DA and
remove get_da.

Martin Kaiser (2):
  staging: r8188eu: replace get_da with ieee80211_get_DA
  staging: r8188eu: remove get_da

 drivers/staging/r8188eu/core/rtw_mlme_ext.c   |  3 ++-
 drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c |  3 ++-
 drivers/staging/r8188eu/include/wifi.h        | 22 -------------------
 3 files changed, 4 insertions(+), 24 deletions(-)

-- 
2.30.2


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

* [PATCH 1/2] staging: r8188eu: replace get_da with ieee80211_get_DA
  2022-10-29 17:10 [PATCH 0/2] staging: r8188eu: remove the last get_da calls Martin Kaiser
@ 2022-10-29 17:10 ` Martin Kaiser
  2022-10-29 17:10 ` [PATCH 2/2] staging: r8188eu: remove get_da Martin Kaiser
  2022-10-30 10:39 ` [PATCH 0/2] staging: r8188eu: remove the last get_da calls Philipp Hortmann
  2 siblings, 0 replies; 6+ messages in thread
From: Martin Kaiser @ 2022-10-29 17:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Replace a call to the driver-specific get_da function with
ieee80211_get_DA from ieee80211.h.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_mlme_ext.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index ffb708f242e6..127dbc4e8b9a 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -798,11 +798,12 @@ static void OnAuthClient(struct adapter *padapter, struct recv_frame *precv_fram
 	unsigned char	*p;
 	struct mlme_ext_priv	*pmlmeext = &padapter->mlmeextpriv;
 	struct mlme_ext_info	*pmlmeinfo = &pmlmeext->mlmext_info;
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)precv_frame->rx_data;
 	u8 *pframe = precv_frame->rx_data;
 	uint pkt_len = precv_frame->len;
 
 	/* check A1 matches or not */
-	if (memcmp(myid(&padapter->eeprompriv), get_da(pframe), ETH_ALEN))
+	if (memcmp(myid(&padapter->eeprompriv), ieee80211_get_DA(hdr), ETH_ALEN))
 		return;
 
 	if (!(pmlmeinfo->state & WIFI_FW_AUTH_STATE))
-- 
2.30.2


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

* [PATCH 2/2] staging: r8188eu: remove get_da
  2022-10-29 17:10 [PATCH 0/2] staging: r8188eu: remove the last get_da calls Martin Kaiser
  2022-10-29 17:10 ` [PATCH 1/2] staging: r8188eu: replace get_da with ieee80211_get_DA Martin Kaiser
@ 2022-10-29 17:10 ` Martin Kaiser
  2022-10-30 14:28   ` Joe Perches
  2022-10-30 10:39 ` [PATCH 0/2] staging: r8188eu: remove the last get_da calls Philipp Hortmann
  2 siblings, 1 reply; 6+ messages in thread
From: Martin Kaiser @ 2022-10-29 17:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Replace the last get_da call with ieee80211_get_DA and remove the get_da
function.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c |  3 ++-
 drivers/staging/r8188eu/include/wifi.h        | 22 -------------------
 2 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
index dff0cba751df..f01ae71bcdb1 100644
--- a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
+++ b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
@@ -108,6 +108,7 @@ void update_recvframe_attrib_88e(struct recv_frame *precvframe, struct recv_stat
  */
 void update_recvframe_phyinfo_88e(struct recv_frame *precvframe, struct phy_stat *pphy_status)
 {
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)precvframe->rx_data;
 	struct adapter *padapter = precvframe->adapter;
 	struct rx_pkt_attrib *pattrib = &precvframe->attrib;
 	struct hal_data_8188e *pHalData = &padapter->haldata;
@@ -125,7 +126,7 @@ 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(get_da(wlanhdr),
+				 (!memcmp(ieee80211_get_DA(hdr),
 				  myid(&padapter->eeprompriv), ETH_ALEN));
 
 	pkt_info.bPacketBeacon = pkt_info.bPacketMatchBSSID && ieee80211_is_beacon(fc);
diff --git a/drivers/staging/r8188eu/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h
index 6b50089cea29..92a584a8b6c0 100644
--- a/drivers/staging/r8188eu/include/wifi.h
+++ b/drivers/staging/r8188eu/include/wifi.h
@@ -217,28 +217,6 @@ enum WIFI_REG_DOMAIN {
 
 #define GetAddr4Ptr(pbuf)	((unsigned char *)((size_t)(pbuf) + 24))
 
-static inline unsigned char *get_da(unsigned char *pframe)
-{
-	unsigned char	*da;
-	unsigned int to_fr_ds = (GetToDs(pframe) << 1) | GetFrDs(pframe);
-
-	switch (to_fr_ds) {
-	case 0x00:	/*  ToDs=0, FromDs=0 */
-		da = GetAddr1Ptr(pframe);
-		break;
-	case 0x01:	/*  ToDs=0, FromDs=1 */
-		da = GetAddr1Ptr(pframe);
-		break;
-	case 0x02:	/*  ToDs=1, FromDs=0 */
-		da = GetAddr3Ptr(pframe);
-		break;
-	default:	/*  ToDs=1, FromDs=1 */
-		da = GetAddr3Ptr(pframe);
-		break;
-	}
-	return da;
-}
-
 static inline unsigned char *get_sa(unsigned char *pframe)
 {
 	unsigned char	*sa;
-- 
2.30.2


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

* Re: [PATCH 0/2] staging: r8188eu: remove the last get_da calls
  2022-10-29 17:10 [PATCH 0/2] staging: r8188eu: remove the last get_da calls Martin Kaiser
  2022-10-29 17:10 ` [PATCH 1/2] staging: r8188eu: replace get_da with ieee80211_get_DA Martin Kaiser
  2022-10-29 17:10 ` [PATCH 2/2] staging: r8188eu: remove get_da Martin Kaiser
@ 2022-10-30 10:39 ` Philipp Hortmann
  2 siblings, 0 replies; 6+ messages in thread
From: Philipp Hortmann @ 2022-10-30 10:39 UTC (permalink / raw)
  To: Martin Kaiser, Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel

On 10/29/22 19:10, Martin Kaiser wrote:
> Replace the remaining two get_da calls with ieee80211_get_DA and
> remove get_da.
> 
> Martin Kaiser (2):
>    staging: r8188eu: replace get_da with ieee80211_get_DA
>    staging: r8188eu: remove get_da
> 
>   drivers/staging/r8188eu/core/rtw_mlme_ext.c   |  3 ++-
>   drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c |  3 ++-
>   drivers/staging/r8188eu/include/wifi.h        | 22 -------------------
>   3 files changed, 4 insertions(+), 24 deletions(-)
> 


Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150

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

* Re: [PATCH 2/2] staging: r8188eu: remove get_da
  2022-10-29 17:10 ` [PATCH 2/2] staging: r8188eu: remove get_da Martin Kaiser
@ 2022-10-30 14:28   ` Joe Perches
  2022-10-30 18:49     ` Martin Kaiser
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Perches @ 2022-10-30 14:28 UTC (permalink / raw)
  To: Martin Kaiser, Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel

On Sat, 2022-10-29 at 19:10 +0200, Martin Kaiser wrote:
> Replace the last get_da call with ieee80211_get_DA and remove the get_da
> function.
[]
> diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
[]
> @@ -125,7 +126,7 @@ 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(get_da(wlanhdr),
> +				 (!memcmp(ieee80211_get_DA(hdr),
>  				  myid(&padapter->eeprompriv), ETH_ALEN));

trivia:

As both of the addresses returned are minimum __aligned(2),
these memcmp uses could be ether_addr_equal

Look for ETH_ALEN

$ git grep ETH_ALEN drivers/staging/r8188eu/

Perhaps see if the memcpy/memcmp uses with ETH_ALEN could be
converted to ether_addr_copy/ether_addr_equal or any of the
other is_<foo>_ether_addr calls.


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

* Re: [PATCH 2/2] staging: r8188eu: remove get_da
  2022-10-30 14:28   ` Joe Perches
@ 2022-10-30 18:49     ` Martin Kaiser
  0 siblings, 0 replies; 6+ messages in thread
From: Martin Kaiser @ 2022-10-30 18:49 UTC (permalink / raw)
  To: Joe Perches
  Cc: Greg Kroah-Hartman, Larry Finger, Phillip Potter,
	Michael Straube, Pavel Skripkin, linux-staging, linux-kernel

Thus wrote Joe Perches (joe@perches.com):

> On Sat, 2022-10-29 at 19:10 +0200, Martin Kaiser wrote:
> > Replace the last get_da call with ieee80211_get_DA and remove the get_da
> > function.
> []
> > diff --git a/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c b/drivers/staging/r8188eu/hal/rtl8188e_rxdesc.c
> []
> > @@ -125,7 +126,7 @@ 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(get_da(wlanhdr),
> > +				 (!memcmp(ieee80211_get_DA(hdr),
> >  				  myid(&padapter->eeprompriv), ETH_ALEN));

> trivia:

> As both of the addresses returned are minimum __aligned(2),
> these memcmp uses could be ether_addr_equal

Thanks, I'll fix this in a separate patch and keep this pattern in mind
for other parts of the code.

> Look for ETH_ALEN

> $ git grep ETH_ALEN drivers/staging/r8188eu/

> Perhaps see if the memcpy/memcmp uses with ETH_ALEN could be
> converted to ether_addr_copy/ether_addr_equal or any of the
> other is_<foo>_ether_addr calls.


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

end of thread, other threads:[~2022-10-30 18:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-29 17:10 [PATCH 0/2] staging: r8188eu: remove the last get_da calls Martin Kaiser
2022-10-29 17:10 ` [PATCH 1/2] staging: r8188eu: replace get_da with ieee80211_get_DA Martin Kaiser
2022-10-29 17:10 ` [PATCH 2/2] staging: r8188eu: remove get_da Martin Kaiser
2022-10-30 14:28   ` Joe Perches
2022-10-30 18:49     ` Martin Kaiser
2022-10-30 10:39 ` [PATCH 0/2] staging: r8188eu: remove the last get_da calls Philipp Hortmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.