Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: r8188eu: use subtype helpers in collect_bss_info

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

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20221202093159.404111-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Martin Kaiser and committed by
Greg Kroah-Hartman
506783ff 3d086236

+11 -15
+11 -15
drivers/staging/r8188eu/core/rtw_mlme_ext.c
··· 5963 5963 /* collect bss info from Beacon and Probe request/response frames. */ 5964 5964 u8 collect_bss_info(struct adapter *padapter, struct recv_frame *precv_frame, struct wlan_bssid_ex *bssid) 5965 5965 { 5966 + struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)precv_frame->rx_data; 5966 5967 int i; 5967 5968 u32 len; 5968 5969 u8 *p; 5969 - u16 val16, subtype; 5970 + u16 val16; 5970 5971 u8 *pframe = precv_frame->rx_data; 5971 5972 u32 packet_len = precv_frame->len; 5972 5973 u8 ie_offset; ··· 5983 5982 5984 5983 memset(bssid, 0, sizeof(struct wlan_bssid_ex)); 5985 5984 5986 - subtype = GetFrameSubType(pframe); 5987 - 5988 - if (subtype == WIFI_BEACON) { 5985 + if (ieee80211_is_beacon(mgmt->frame_control)) { 5989 5986 bssid->Reserved[0] = 1; 5990 5987 ie_offset = _BEACON_IE_OFFSET_; 5988 + } else if (ieee80211_is_probe_req(mgmt->frame_control)) { 5989 + ie_offset = _PROBEREQ_IE_OFFSET_; 5990 + bssid->Reserved[0] = 2; 5991 + } else if (ieee80211_is_probe_resp(mgmt->frame_control)) { 5992 + ie_offset = _PROBERSP_IE_OFFSET_; 5993 + bssid->Reserved[0] = 3; 5991 5994 } else { 5992 - /* FIXME : more type */ 5993 - if (subtype == WIFI_PROBEREQ) { 5994 - ie_offset = _PROBEREQ_IE_OFFSET_; 5995 - bssid->Reserved[0] = 2; 5996 - } else if (subtype == WIFI_PROBERSP) { 5997 - ie_offset = _PROBERSP_IE_OFFSET_; 5998 - bssid->Reserved[0] = 3; 5999 - } else { 6000 - bssid->Reserved[0] = 0; 6001 - ie_offset = _FIXED_IE_LENGTH_; 6002 - } 5995 + bssid->Reserved[0] = 0; 5996 + ie_offset = _FIXED_IE_LENGTH_; 6003 5997 } 6004 5998 6005 5999 bssid->Length = sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + len;