All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] staging: r8188eu: use ieee80211 helpers for subtype
@ 2022-12-02  9:31 Martin Kaiser
  2022-12-02  9:31 ` [PATCH 1/2] staging: r8188eu: use subtype helpers in collect_bss_info Martin Kaiser
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Martin Kaiser @ 2022-12-02  9:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Use the ieee80211 helper functions in some places where the frame subtype
is checked.

Martin Kaiser (2):
  staging: r8188eu: use subtype helpers in collect_bss_info
  staging: r8188eu: use subtype helper in rtw_check_bcn_info

 drivers/staging/r8188eu/core/rtw_mlme_ext.c  | 26 +++++++++-----------
 drivers/staging/r8188eu/core/rtw_wlan_util.c |  7 +++---
 2 files changed, 14 insertions(+), 19 deletions(-)

-- 
2.30.2


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

* [PATCH 1/2] staging: r8188eu: use subtype helpers in collect_bss_info
  2022-12-02  9:31 [PATCH 0/2] staging: r8188eu: use ieee80211 helpers for subtype Martin Kaiser
@ 2022-12-02  9:31 ` Martin Kaiser
  2022-12-02  9:31 ` [PATCH 2/2] staging: r8188eu: use subtype helper in rtw_check_bcn_info Martin Kaiser
  2022-12-02 21:07 ` [PATCH 0/2] staging: r8188eu: use ieee80211 helpers for subtype Philipp Hortmann
  2 siblings, 0 replies; 4+ messages in thread
From: Martin Kaiser @ 2022-12-02  9:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Use the iee80211 helper functions to check the frame subtype in
collect_bss_info. Replace the call to the driver-specific
GetFrameSubType function.

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

diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
index 95a9470f4c99..1b9cf7596a76 100644
--- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c
@@ -5963,10 +5963,11 @@ void site_survey(struct adapter *padapter)
 /* collect bss info from Beacon and Probe request/response frames. */
 u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, struct wlan_bssid_ex *bssid)
 {
+	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data;
 	int	i;
 	u32	len;
 	u8 *p;
-	u16 val16, subtype;
+	u16 val16;
 	u8 *pframe = precv_frame->rx_data;
 	u32	packet_len = precv_frame->len;
 	u8 ie_offset;
@@ -5982,23 +5983,18 @@ u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, st
 
 	memset(bssid, 0, sizeof(struct wlan_bssid_ex));
 
-	subtype = GetFrameSubType(pframe);
-
-	if (subtype == WIFI_BEACON) {
+	if (ieee80211_is_beacon(mgmt->frame_control)) {
 		bssid->Reserved[0] = 1;
 		ie_offset = _BEACON_IE_OFFSET_;
+	} else if (ieee80211_is_probe_req(mgmt->frame_control)) {
+		ie_offset = _PROBEREQ_IE_OFFSET_;
+		bssid->Reserved[0] = 2;
+	} else if (ieee80211_is_probe_resp(mgmt->frame_control)) {
+		ie_offset = _PROBERSP_IE_OFFSET_;
+		bssid->Reserved[0] = 3;
 	} else {
-		/*  FIXME : more type */
-		if (subtype == WIFI_PROBEREQ) {
-			ie_offset = _PROBEREQ_IE_OFFSET_;
-			bssid->Reserved[0] = 2;
-		} else if (subtype == WIFI_PROBERSP) {
-			ie_offset = _PROBERSP_IE_OFFSET_;
-			bssid->Reserved[0] = 3;
-		} else {
-			bssid->Reserved[0] = 0;
-			ie_offset = _FIXED_IE_LENGTH_;
-		}
+		bssid->Reserved[0] = 0;
+		ie_offset = _FIXED_IE_LENGTH_;
 	}
 
 	bssid->Length = sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + len;
-- 
2.30.2


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

* [PATCH 2/2] staging: r8188eu: use subtype helper in rtw_check_bcn_info
  2022-12-02  9:31 [PATCH 0/2] staging: r8188eu: use ieee80211 helpers for subtype Martin Kaiser
  2022-12-02  9:31 ` [PATCH 1/2] staging: r8188eu: use subtype helpers in collect_bss_info Martin Kaiser
@ 2022-12-02  9:31 ` Martin Kaiser
  2022-12-02 21:07 ` [PATCH 0/2] staging: r8188eu: use ieee80211 helpers for subtype Philipp Hortmann
  2 siblings, 0 replies; 4+ messages in thread
From: Martin Kaiser @ 2022-12-02  9:31 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Use ieee80211_is_beacon to check the frame subtype in rtw_check_bcn_info.
Replace the call to the driver-specific GetFrameSubType function.

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

diff --git a/drivers/staging/r8188eu/core/rtw_wlan_util.c b/drivers/staging/r8188eu/core/rtw_wlan_util.c
index da3465d6bb0f..f1ebb5358cb9 100644
--- a/drivers/staging/r8188eu/core/rtw_wlan_util.c
+++ b/drivers/staging/r8188eu/core/rtw_wlan_util.c
@@ -874,9 +874,10 @@ void VCS_update(struct adapter *padapter, struct sta_info *psta)
 
 int rtw_check_bcn_info(struct adapter  *Adapter, u8 *pframe, u32 packet_len)
 {
+	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)pframe;
 	unsigned int		len;
 	unsigned char		*p;
-	unsigned short	val16, subtype;
+	unsigned short	val16;
 	struct wlan_network *cur_network = &Adapter->mlmepriv.cur_network;
 	/* u8 wpa_ie[255], rsn_ie[255]; */
 	u16 wpa_len = 0, rsn_len = 0;
@@ -908,9 +909,7 @@ int rtw_check_bcn_info(struct adapter  *Adapter, u8 *pframe, u32 packet_len)
 	if (!bssid)
 		return _FAIL;
 
-	subtype = GetFrameSubType(pframe) >> 4;
-
-	if (subtype == WIFI_BEACON)
+	if (ieee80211_is_beacon(mgmt->frame_control))
 		bssid->Reserved[0] = 1;
 
 	bssid->Length = sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + len;
-- 
2.30.2


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

* Re: [PATCH 0/2] staging: r8188eu: use ieee80211 helpers for subtype
  2022-12-02  9:31 [PATCH 0/2] staging: r8188eu: use ieee80211 helpers for subtype Martin Kaiser
  2022-12-02  9:31 ` [PATCH 1/2] staging: r8188eu: use subtype helpers in collect_bss_info Martin Kaiser
  2022-12-02  9:31 ` [PATCH 2/2] staging: r8188eu: use subtype helper in rtw_check_bcn_info Martin Kaiser
@ 2022-12-02 21:07 ` Philipp Hortmann
  2 siblings, 0 replies; 4+ messages in thread
From: Philipp Hortmann @ 2022-12-02 21:07 UTC (permalink / raw)
  To: Martin Kaiser, Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel

On 12/2/22 10:31, Martin Kaiser wrote:
> Use the ieee80211 helper functions in some places where the frame subtype
> is checked.
> 
> Martin Kaiser (2):
>    staging: r8188eu: use subtype helpers in collect_bss_info
>    staging: r8188eu: use subtype helper in rtw_check_bcn_info
> 
>   drivers/staging/r8188eu/core/rtw_mlme_ext.c  | 26 +++++++++-----------
>   drivers/staging/r8188eu/core/rtw_wlan_util.c |  7 +++---
>   2 files changed, 14 insertions(+), 19 deletions(-)
> 
Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150

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

end of thread, other threads:[~2022-12-02 21:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-02  9:31 [PATCH 0/2] staging: r8188eu: use ieee80211 helpers for subtype Martin Kaiser
2022-12-02  9:31 ` [PATCH 1/2] staging: r8188eu: use subtype helpers in collect_bss_info Martin Kaiser
2022-12-02  9:31 ` [PATCH 2/2] staging: r8188eu: use subtype helper in rtw_check_bcn_info Martin Kaiser
2022-12-02 21:07 ` [PATCH 0/2] staging: r8188eu: use ieee80211 helpers for subtype 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.