From c5f30cb5ccc589309463945ecb129f729a6a36fd Mon Sep 17 00:00:00 2001 From: Carlos Garces Date: Mon, 18 Oct 2021 16:05:53 +0200 Subject: [PATCH] remove enum WIFI_FRAME_SUBTYPE The values defined in enum WIFI_FRAME_SUBTYPE are the same the #define IEEE80211_STYPE_xxx from . Port 33ed2b7079f6c38abce6abbaf1e6be4edad919d8 --- core/mesh/rtw_mesh.c | 2 +- core/mesh/rtw_mesh_hwmp.c | 4 +- core/rtw_beamforming.c | 10 +-- core/rtw_iol.c | 2 +- core/rtw_mi.c | 2 +- core/rtw_mlme_ext.c | 138 +++++++++++++++++----------------- core/rtw_mp.c | 2 +- core/rtw_mp_ioctl.c | 2 +- core/rtw_p2p.c | 12 +-- core/rtw_recv.c | 60 +++++++-------- core/rtw_rm.c | 12 +-- core/rtw_security.c | 22 +++--- core/rtw_tdls.c | 4 +- core/rtw_wapi.c | 2 +- core/rtw_wapi_sms4.c | 8 +- core/rtw_wlan_util.c | 8 +- core/rtw_xmit.c | 28 +++---- hal/hal_com.c | 34 ++++----- include/wifi.h | 57 ++------------ os_dep/linux/ioctl_cfg80211.c | 18 ++--- os_dep/linux/ioctl_linux.c | 2 +- 21 files changed, 193 insertions(+), 236 deletions(-) diff --git a/core/mesh/rtw_mesh.c b/core/mesh/rtw_mesh.c index 215d480..7409aa0 100644 --- a/core/mesh/rtw_mesh.c +++ b/core/mesh/rtw_mesh.c @@ -2528,7 +2528,7 @@ static u8 *rtw_mesh_construct_peer_mesh_close(_adapter *adapter, struct mesh_pli memcpy(whdr->addr2, plink->addr, ETH_ALEN); memcpy(whdr->addr3, adapter_mac_addr(adapter), ETH_ALEN); - set_frame_sub_type(frame, WIFI_ACTION); + set_frame_sub_type(frame, IEEE80211_STYPE_ACTION); pos += sizeof(struct rtw_ieee80211_hdr_3addr); *(pos++) = RTW_WLAN_CATEGORY_SELF_PROTECTED; diff --git a/core/mesh/rtw_mesh_hwmp.c b/core/mesh/rtw_mesh_hwmp.c index 8e993c5..42b1a29 100644 --- a/core/mesh/rtw_mesh_hwmp.c +++ b/core/mesh/rtw_mesh_hwmp.c @@ -245,7 +245,7 @@ static int rtw_mesh_path_sel_frame_tx(enum rtw_mpath_frame_type mpath_action, u8 SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pos, WIFI_ACTION); + set_frame_sub_type(pos, IEEE80211_STYPE_ACTION); pos += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -358,7 +358,7 @@ int rtw_mesh_path_error_tx(_adapter *adapter, SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pos, WIFI_ACTION); + set_frame_sub_type(pos, IEEE80211_STYPE_ACTION); pos += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); diff --git a/core/rtw_beamforming.c b/core/rtw_beamforming.c index 91ff1ae..d0898b7 100644 --- a/core/rtw_beamforming.c +++ b/core/rtw_beamforming.c @@ -205,7 +205,7 @@ static u8 _send_ht_ndpa_packet(PADAPTER adapter, u8 *ra, enum channel_width bw) /* update attribute */ attrib = &pmgntframe->attrib; update_mgntframe_attrib(adapter, attrib); - /*attrib->type = WIFI_MGT_TYPE;*/ /* set in update_mgntframe_attrib() */ + /*attrib->type = IEEE80211_FTYPE_MGMT;*/ /* set in update_mgntframe_attrib() */ attrib->subtype = WIFI_ACTION_NOACK; attrib->bwmode = bw; /*attrib->qsel = QSLT_MGNT;*/ /* set in update_mgntframe_attrib() */ @@ -301,7 +301,7 @@ static u8 _send_vht_ndpa_packet(PADAPTER adapter, u8 *ra, u16 aid, enum channel_ /* update attribute */ attrib = &pmgntframe->attrib; update_mgntframe_attrib(adapter, attrib); - /*pattrib->type = WIFI_MGT_TYPE;*/ /* set in update_mgntframe_attrib() */ + /*pattrib->type = IEEE80211_FTYPE_MGMT;*/ /* set in update_mgntframe_attrib() */ attrib->subtype = WIFI_NDPA; attrib->bwmode = bw; /*attrib->qsel = QSLT_MGNT;*/ /* set in update_mgntframe_attrib() */ @@ -414,7 +414,7 @@ static u8 _send_vht_mu_ndpa_packet(PADAPTER adapter, enum channel_width bw) /* update attribute */ attrib = &pmgntframe->attrib; update_mgntframe_attrib(adapter, attrib); - /*attrib->type = WIFI_MGT_TYPE;*/ /* set in update_mgntframe_attrib() */ + /*attrib->type = IEEE80211_FTYPE_MGMT;*/ /* set in update_mgntframe_attrib() */ attrib->subtype = WIFI_NDPA; attrib->bwmode = bw; /*attrib->qsel = QSLT_MGNT;*/ /* set in update_mgntframe_attrib() */ @@ -507,7 +507,7 @@ static u8 _send_bf_report_poll(PADAPTER adapter, u8 *ra, u8 bFinalPoll) /* update attribute */ attrib = &pmgntframe->attrib; update_mgntframe_attrib(adapter, attrib); - /*attrib->type = WIFI_MGT_TYPE;*/ /* set in update_mgntframe_attrib() */ + /*attrib->type = IEEE80211_FTYPE_MGMT;*/ /* set in update_mgntframe_attrib() */ attrib->subtype = WIFI_BF_REPORT_POLL; attrib->bwmode = CHANNEL_WIDTH_20; /*attrib->qsel = QSLT_MGNT;*/ /* set in update_mgntframe_attrib() */ @@ -1709,7 +1709,7 @@ u8 rtw_bf_send_vht_gid_mgnt_packet(PADAPTER adapter, u8 *ra, u8 *gid, u8 *positi update_mgntframe_attrib(adapter, attrib); attrib->rate = MGN_6M; attrib->bwmode = CHANNEL_WIDTH_20; - attrib->subtype = WIFI_ACTION; + attrib->subtype = IEEE80211_STYPE_ACTION; memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET); diff --git a/core/rtw_iol.c b/core/rtw_iol.c index 19a2cda..e287b36 100644 --- a/core/rtw_iol.c +++ b/core/rtw_iol.c @@ -46,7 +46,7 @@ struct xmit_frame *rtw_IOL_accquire_xmit_frame(ADAPTER *adapter) pattrib = &xmit_frame->attrib; update_mgntframe_attrib(adapter, pattrib); pattrib->qsel = QSLT_BEACON;/* Beacon */ - pattrib->subtype = WIFI_BEACON; + pattrib->subtype = IEEE80211_STYPE_BEACON; pattrib->pktlen = pattrib->last_txcmdsz = 0; #else diff --git a/core/rtw_mi.c b/core/rtw_mi.c index 5e1a23f..da0d31c 100644 --- a/core/rtw_mi.c +++ b/core/rtw_mi.c @@ -1451,7 +1451,7 @@ void rtw_mi_buddy_clone_bcmc_packet(_adapter *padapter, union recv_frame *precvf continue; if (rtw_is_adapter_up(iface) == _FALSE || iface->registered == 0) continue; - if (type == WIFI_DATA_TYPE && !adapter_allow_bmc_data_rx(iface)) + if (type == IEEE80211_FTYPE_DATA && !adapter_allow_bmc_data_rx(iface)) continue; pcloneframe = rtw_alloc_recvframe(pfree_recv_queue); diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index dd357af..61ba46e 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -22,47 +22,47 @@ struct mlme_handler mlme_sta_tbl[] = { - {WIFI_ASSOCREQ, "OnAssocReq", &OnAssocReq}, - {WIFI_ASSOCRSP, "OnAssocRsp", &OnAssocRsp}, - {WIFI_REASSOCREQ, "OnReAssocReq", &OnAssocReq}, - {WIFI_REASSOCRSP, "OnReAssocRsp", &OnAssocRsp}, - {WIFI_PROBEREQ, "OnProbeReq", &OnProbeReq}, - {WIFI_PROBERSP, "OnProbeRsp", &OnProbeRsp}, + {IEEE80211_STYPE_ASSOC_REQ, "OnAssocReq", &OnAssocReq}, + {IEEE80211_STYPE_ASSOC_RESP, "OnAssocRsp", &OnAssocRsp}, + {IEEE80211_STYPE_REASSOC_REQ, "OnReAssocReq", &OnAssocReq}, + {IEEE80211_STYPE_REASSOC_RESP, "OnReAssocRsp", &OnAssocRsp}, + {IEEE80211_STYPE_PROBE_REQ, "OnProbeReq", &OnProbeReq}, + {IEEE80211_STYPE_PROBE_RESP, "OnProbeRsp", &OnProbeRsp}, /*---------------------------------------------------------- below 2 are reserved -----------------------------------------------------------*/ {0, "DoReserved", &DoReserved}, {0, "DoReserved", &DoReserved}, - {WIFI_BEACON, "OnBeacon", &OnBeacon}, - {WIFI_ATIM, "OnATIM", &OnAtim}, - {WIFI_DISASSOC, "OnDisassoc", &OnDisassoc}, - {WIFI_AUTH, "OnAuth", &OnAuthClient}, - {WIFI_DEAUTH, "OnDeAuth", &OnDeAuth}, - {WIFI_ACTION, "OnAction", &OnAction}, + {IEEE80211_STYPE_BEACON, "OnBeacon", &OnBeacon}, + {IEEE80211_STYPE_ATIM, "OnATIM", &OnAtim}, + {IEEE80211_STYPE_DISASSOC, "OnDisassoc", &OnDisassoc}, + {IEEE80211_STYPE_AUTH, "OnAuth", &OnAuthClient}, + {IEEE80211_STYPE_DEAUTH, "OnDeAuth", &OnDeAuth}, + {IEEE80211_STYPE_ACTION, "OnAction", &OnAction}, {WIFI_ACTION_NOACK, "OnActionNoAck", &OnAction}, }; #ifdef _CONFIG_NATIVEAP_MLME_ struct mlme_handler mlme_ap_tbl[] = { - {WIFI_ASSOCREQ, "OnAssocReq", &OnAssocReq}, - {WIFI_ASSOCRSP, "OnAssocRsp", &OnAssocRsp}, - {WIFI_REASSOCREQ, "OnReAssocReq", &OnAssocReq}, - {WIFI_REASSOCRSP, "OnReAssocRsp", &OnAssocRsp}, - {WIFI_PROBEREQ, "OnProbeReq", &OnProbeReq}, - {WIFI_PROBERSP, "OnProbeRsp", &OnProbeRsp}, + {IEEE80211_STYPE_ASSOC_REQ, "OnAssocReq", &OnAssocReq}, + {IEEE80211_STYPE_ASSOC_RESP, "OnAssocRsp", &OnAssocRsp}, + {IEEE80211_STYPE_REASSOC_REQ, "OnReAssocReq", &OnAssocReq}, + {IEEE80211_STYPE_REASSOC_RESP, "OnReAssocRsp", &OnAssocRsp}, + {IEEE80211_STYPE_PROBE_REQ, "OnProbeReq", &OnProbeReq}, + {IEEE80211_STYPE_PROBE_RESP, "OnProbeRsp", &OnProbeRsp}, /*---------------------------------------------------------- below 2 are reserved -----------------------------------------------------------*/ {0, "DoReserved", &DoReserved}, {0, "DoReserved", &DoReserved}, - {WIFI_BEACON, "OnBeacon", &OnBeacon}, - {WIFI_ATIM, "OnATIM", &OnAtim}, - {WIFI_DISASSOC, "OnDisassoc", &OnDisassoc}, - {WIFI_AUTH, "OnAuth", &OnAuth}, - {WIFI_DEAUTH, "OnDeAuth", &OnDeAuth}, - {WIFI_ACTION, "OnAction", &OnAction}, + {IEEE80211_STYPE_BEACON, "OnBeacon", &OnBeacon}, + {IEEE80211_STYPE_ATIM, "OnATIM", &OnAtim}, + {IEEE80211_STYPE_DISASSOC, "OnDisassoc", &OnDisassoc}, + {IEEE80211_STYPE_AUTH, "OnAuth", &OnAuth}, + {IEEE80211_STYPE_DEAUTH, "OnDeAuth", &OnDeAuth}, + {IEEE80211_STYPE_ACTION, "OnAction", &OnAction}, {WIFI_ACTION_NOACK, "OnActionNoAck", &OnAction}, }; #endif @@ -1271,7 +1271,7 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame) } #endif - if (GetFrameType(pframe) != WIFI_MGT_TYPE) { + if (GetFrameType(pframe) != IEEE80211_FTYPE_MGMT) { return; } @@ -1303,7 +1303,7 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame) index = get_frame_sub_type(pframe) >> 4; #ifdef CONFIG_TDLS - if ((index << 4) == WIFI_ACTION) { + if ((index << 4) == IEEE80211_STYPE_ACTION) { /* category==public (4), action==TDLS_DISCOVERY_RESPONSE */ if (*(pframe + 24) == RTW_WLAN_CATEGORY_PUBLIC && *(pframe + 25) == TDLS_DISCOVERY_RESPONSE) { RTW_INFO("[TDLS] Recv %s from "MAC_FMT"\n", rtw_tdls_action_txt(TDLS_DISCOVERY_RESPONSE), MAC_ARG(get_addr2_ptr(pframe))); @@ -1338,7 +1338,7 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame) #ifdef CONFIG_AP_MODE switch (get_frame_sub_type(pframe)) { - case WIFI_AUTH: + case IEEE80211_STYPE_AUTH: if (MLME_IS_AP(padapter) || MLME_IS_MESH(padapter)) ptable->func = &OnAuth; else @@ -1348,25 +1348,25 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame) #else __attribute__ ((__fallthrough__)); #endif - case WIFI_ASSOCREQ: - case WIFI_REASSOCREQ: + case IEEE80211_STYPE_ASSOC_REQ: + case IEEE80211_STYPE_REASSOC_REQ: _mgt_dispatcher(padapter, ptable, precv_frame); #ifdef CONFIG_HOSTAPD_MLME if (MLME_IS_AP(padapter)) rtw_hostapd_mlme_rx(padapter, precv_frame); #endif break; - case WIFI_PROBEREQ: + case IEEE80211_STYPE_PROBE_REQ: _mgt_dispatcher(padapter, ptable, precv_frame); #ifdef CONFIG_HOSTAPD_MLME if (MLME_IS_AP(padapter)) rtw_hostapd_mlme_rx(padapter, precv_frame); #endif break; - case WIFI_BEACON: + case IEEE80211_STYPE_BEACON: _mgt_dispatcher(padapter, ptable, precv_frame); break; - case WIFI_ACTION: + case IEEE80211_STYPE_ACTION: _mgt_dispatcher(padapter, ptable, precv_frame); break; default: @@ -2438,10 +2438,10 @@ unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame) return _FAIL; frame_type = get_frame_sub_type(pframe); - if (frame_type == WIFI_ASSOCREQ) { + if (frame_type == IEEE80211_STYPE_ASSOC_REQ) { reassoc = 0; ie_offset = _ASOCREQ_IE_OFFSET_; - } else { /* WIFI_REASSOCREQ */ + } else { /* IEEE80211_STYPE_REASSOC_REQ */ reassoc = 1; ie_offset = _REASOCREQ_IE_OFFSET_; } @@ -2665,10 +2665,10 @@ unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame) status = _STATS_REFUSED_TEMPORARILY_; #endif /* CONFIG_IEEE80211W */ /* .2 issue assoc rsp before notify station join event. */ - if (frame_type == WIFI_ASSOCREQ) - issue_asocrsp(padapter, status, pstat, WIFI_ASSOCRSP); + if (frame_type == IEEE80211_STYPE_ASSOC_REQ) + issue_asocrsp(padapter, status, pstat, IEEE80211_STYPE_ASSOC_RESP); else - issue_asocrsp(padapter, status, pstat, WIFI_REASSOCRSP); + issue_asocrsp(padapter, status, pstat, IEEE80211_STYPE_REASSOC_RESP); #ifdef CONFIG_IOCTL_CFG80211 _enter_critical_bh(&pstat->lock, &irqL); @@ -2716,10 +2716,10 @@ OnAssocReqFail: #ifdef CONFIG_NATIVEAP_MLME pstat->cmn.aid = 0; - if (frame_type == WIFI_ASSOCREQ) - issue_asocrsp(padapter, status, pstat, WIFI_ASSOCRSP); + if (frame_type == IEEE80211_STYPE_ASSOC_REQ) + issue_asocrsp(padapter, status, pstat, IEEE80211_STYPE_ASSOC_RESP); else - issue_asocrsp(padapter, status, pstat, WIFI_REASSOCRSP); + issue_asocrsp(padapter, status, pstat, IEEE80211_STYPE_REASSOC_RESP); #endif @@ -3779,7 +3779,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -4178,7 +4178,7 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -4590,7 +4590,7 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8 *raddr, u8 result) SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -4826,7 +4826,7 @@ void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -5123,7 +5123,7 @@ void issue_p2p_invitation_response(_adapter *padapter, u8 *raddr, u8 dialogToken SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -5359,7 +5359,7 @@ void issue_p2p_provision_request(_adapter *padapter, u8 *pssid, u8 ussidlen, u8 SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -5500,7 +5500,7 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(fctrl, WIFI_PROBERSP); + set_frame_sub_type(fctrl, IEEE80211_STYPE_PROBE_RESP); pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = pattrib->hdrlen; @@ -5839,7 +5839,7 @@ int _issue_probereq_p2p(_adapter *padapter, u8 *da, int wait_ack) SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_PROBEREQ); + set_frame_sub_type(pframe, IEEE80211_STYPE_PROBE_REQ); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -7160,7 +7160,7 @@ void rtw_wnm_issue_action(_adapter *padapter, u8 action, u8 reason) SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -7844,7 +7844,7 @@ void issue_beacon(_adapter *padapter, int timeout_ms) SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/); /* pmlmeext->mgnt_seq++; */ - set_frame_sub_type(pframe, WIFI_BEACON); + set_frame_sub_type(pframe, IEEE80211_STYPE_BEACON); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -8155,7 +8155,7 @@ void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probe SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(fctrl, WIFI_PROBERSP); + set_frame_sub_type(fctrl, IEEE80211_STYPE_PROBE_RESP); pattrib->hdrlen = sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = pattrib->hdrlen; @@ -8456,7 +8456,7 @@ int _issue_probereq(_adapter *padapter, const NDIS_802_11_SSID *pssid, const u8 SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; } - set_frame_sub_type(pframe, WIFI_PROBEREQ); + set_frame_sub_type(pframe, IEEE80211_STYPE_PROBE_REQ); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -8608,7 +8608,7 @@ void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_AUTH); + set_frame_sub_type(pframe, IEEE80211_STYPE_AUTH); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -8778,7 +8778,7 @@ void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *p SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - if ((pkt_type == WIFI_ASSOCRSP) || (pkt_type == WIFI_REASSOCRSP)) + if ((pkt_type == IEEE80211_STYPE_ASSOC_RESP) || (pkt_type == IEEE80211_STYPE_REASSOC_RESP)) set_frame_sub_type(pwlanhdr, pkt_type); else return; @@ -9014,9 +9014,9 @@ void _issue_assocreq(_adapter *padapter, u8 is_reassoc) SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; if (is_reassoc == _TRUE) - set_frame_sub_type(pframe, WIFI_REASSOCREQ); + set_frame_sub_type(pframe, IEEE80211_STYPE_REASSOC_REQ); else - set_frame_sub_type(pframe, WIFI_ASSOCREQ); + set_frame_sub_type(pframe, IEEE80211_STYPE_ASSOC_REQ); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -9508,7 +9508,7 @@ static int _issue_nulldata(_adapter *padapter, unsigned char *da, unsigned int p SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_DATA_NULL); + set_frame_sub_type(pframe, IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC); pframe += sizeof(struct rtw_ieee80211_hdr_3addr) + a4_shift; pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr) + a4_shift; @@ -9662,7 +9662,7 @@ static int _issue_qos_nulldata(_adapter *padapter, unsigned char *da, u16 tid, u SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_QOS_DATA_NULL); + set_frame_sub_type(pframe, IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); pframe += sizeof(struct rtw_ieee80211_hdr_3addr_qos) + a4_shift; pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr_qos) + a4_shift; @@ -9786,7 +9786,7 @@ static int _issue_deauth(_adapter *padapter, unsigned char *da, unsigned short r SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_DEAUTH); + set_frame_sub_type(pframe, IEEE80211_STYPE_DEAUTH); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -9909,7 +9909,7 @@ void issue_action_spct_ch_switch(_adapter *padapter, u8 *ra, u8 new_ch, u8 ch_of SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -9984,7 +9984,7 @@ void issue_action_SA_Query(_adapter *padapter, unsigned char *raddr, unsigned ch SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -10085,7 +10085,7 @@ static int issue_action_ba(_adapter *padapter, unsigned char *raddr, unsigned ch SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -10422,7 +10422,7 @@ void issue_action_BSSCoexistPacket(_adapter *padapter) SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -10572,7 +10572,7 @@ int _issue_action_SM_PS(_adapter *padapter , unsigned char *raddr , u8 NewMimoP SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -10931,15 +10931,15 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI subtype = get_frame_sub_type(pframe); - if (subtype == WIFI_BEACON) { + if (subtype == IEEE80211_STYPE_BEACON) { bssid->Reserved[0] = BSS_TYPE_BCN; ie_offset = _BEACON_IE_OFFSET_; } else { /* FIXME : more type */ - if (subtype == WIFI_PROBERSP) { + if (subtype == IEEE80211_STYPE_PROBE_RESP) { ie_offset = _PROBERSP_IE_OFFSET_; bssid->Reserved[0] = BSS_TYPE_PROB_RSP; - } else if (subtype == WIFI_PROBEREQ) { + } else if (subtype == IEEE80211_STYPE_PROBE_REQ) { ie_offset = _PROBEREQ_IE_OFFSET_; bssid->Reserved[0] = BSS_TYPE_PROB_REQ; } else { @@ -11034,7 +11034,7 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI } #ifdef CONFIG_P2P - if (subtype == WIFI_PROBEREQ) { + if (subtype == IEEE80211_STYPE_PROBE_REQ) { u8 *p2p_ie; u32 p2p_ielen; /* Set Listion Channel */ @@ -13505,7 +13505,7 @@ void rtw_ft_issue_action_req(_adapter *padapter, u8 *pTargetAddr) SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); diff --git a/core/rtw_mp.c b/core/rtw_mp.c index 55dafbe..4114604 100644 --- a/core/rtw_mp.c +++ b/core/rtw_mp.c @@ -189,7 +189,7 @@ static void mp_init_xmit_attrib(struct mp_tx *pmptx, PADAPTER padapter) pattrib->ack_policy = 0; /* pattrib->pkt_hdrlen = ETH_HLEN; */ pattrib->hdrlen = WLAN_HDR_A3_LEN; - pattrib->subtype = WIFI_DATA; + pattrib->subtype = (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); pattrib->priority = 0; pattrib->qsel = pattrib->priority; /* do_queue_select(padapter, pattrib); */ diff --git a/core/rtw_mp_ioctl.c b/core/rtw_mp_ioctl.c index bd730ba..096b980 100644 --- a/core/rtw_mp_ioctl.c +++ b/core/rtw_mp_ioctl.c @@ -2299,7 +2299,7 @@ unsigned int mp_ioctl_xmit_packet_hdl(struct oid_par_priv *poid_par_priv) fctrl = &(pwlanhdr->frame_ctl); *(fctrl) = 0; - set_frame_sub_type(pframe, WIFI_DATA); + set_frame_sub_type(pframe, (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA)); memcpy(pwlanhdr->addr1, pethhdr->h_dest, ETH_ALEN); memcpy(pwlanhdr->addr2, pethhdr->h_source, ETH_ALEN); diff --git a/core/rtw_p2p.c b/core/rtw_p2p.c index 6cc2867..fc0310d 100644 --- a/core/rtw_p2p.c +++ b/core/rtw_p2p.c @@ -177,7 +177,7 @@ static void issue_group_disc_req(struct wifidirect_info *pwdinfo, u8 *da) SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -237,7 +237,7 @@ static void issue_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 s SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -314,7 +314,7 @@ static void issue_p2p_provision_resp(struct wifidirect_info *pwdinfo, u8 *raddr, SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -418,7 +418,7 @@ static void issue_p2p_presence_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -2331,9 +2331,9 @@ u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pframe, uint l return P2P_STATUS_FAIL_REQUEST_UNABLE; frame_type = get_frame_sub_type(pframe); - if (frame_type == WIFI_ASSOCREQ) + if (frame_type == IEEE80211_STYPE_ASSOC_REQ) ie_offset = _ASOCREQ_IE_OFFSET_; - else /* WIFI_REASSOCREQ */ + else /* IEEE80211_STYPE_REASSOC_REQ */ ie_offset = _REASOCREQ_IE_OFFSET_; ies = pframe + WLAN_HDR_A3_LEN + ie_offset; diff --git a/core/rtw_recv.c b/core/rtw_recv.c index e2c4fa0..d9d11a2 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -584,7 +584,7 @@ union recv_frame *decryptor(_adapter *padapter, union recv_frame *precv_frame) } if (prxattrib->encrypt && !prxattrib->bdecrypted) { - if (GetFrameType(get_recvframe_data(precv_frame)) == WIFI_DATA + if (GetFrameType(get_recvframe_data(precv_frame)) == (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA) #ifdef CONFIG_CONCURRENT_MODE && !is_multicast_ether_addr(prxattrib->ra) /* bc/mc packets may use sw decryption for concurrent mode */ #endif @@ -1240,7 +1240,7 @@ sint sta2sta_data_frame( process_pwrbit_data(adapter, precv_frame, ptdls_sta); /* if NULL-frame, check pwrbit */ - if ((get_frame_sub_type(ptr) & WIFI_DATA_NULL) == WIFI_DATA_NULL) { + if ((get_frame_sub_type(ptr) & IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC) == IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC) { /* NULL-frame with pwrbit=1, buffer_STA should buffer frames for sleep_STA */ if (GetPwrMgt(ptr)) { /* it would be triggered when we are off channel and receiving NULL DATA */ @@ -1262,7 +1262,7 @@ sint sta2sta_data_frame( goto exit; } - if ((get_frame_sub_type(ptr) & WIFI_QOS_DATA_TYPE) == WIFI_QOS_DATA_TYPE) + if ((get_frame_sub_type(ptr) & (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) process_wmmps_data(adapter, precv_frame, ptdls_sta); ptdls_sta->tdls_sta_state &= ~(TDLS_WAIT_PTR_STATE); @@ -1396,7 +1396,7 @@ sint ap2sta_data_frame( goto exit; } - /*if ((get_frame_sub_type(ptr) & WIFI_QOS_DATA_TYPE) == WIFI_QOS_DATA_TYPE) { + /*if ((get_frame_sub_type(ptr) & (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) { } */ @@ -1500,7 +1500,7 @@ sint sta2ap_data_frame( process_pwrbit_data(adapter, precv_frame, *psta); - if ((get_frame_sub_type(ptr) & WIFI_QOS_DATA_TYPE) == WIFI_QOS_DATA_TYPE) + if ((get_frame_sub_type(ptr) & (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) process_wmmps_data(adapter, precv_frame, *psta); if (get_frame_sub_type(ptr) & BIT(6)) { @@ -1561,7 +1561,7 @@ sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame) /* RTW_INFO("+validate_recv_ctrl_frame\n"); */ - if (GetFrameType(pframe) != WIFI_CTRL_TYPE) + if (GetFrameType(pframe) != IEEE80211_FTYPE_CTL) return _FAIL; /* receive the frames that ra(a1) is my address */ @@ -1577,7 +1577,7 @@ sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame) psta->sta_stats.rx_ctrl_pkts++; /* only handle ps-poll */ - if (get_frame_sub_type(pframe) == WIFI_PSPOLL) { + if (get_frame_sub_type(pframe) == (IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL)) { #ifdef CONFIG_AP_MODE u16 aid; u8 wmmps_ac = 0; @@ -1697,7 +1697,7 @@ sint validate_recv_ctrl_frame(_adapter *padapter, union recv_frame *precv_frame) #ifdef CONFIG_BEAMFORMING rtw_beamforming_get_ndpa_frame(padapter, precv_frame); #endif/*CONFIG_BEAMFORMING*/ - } else if (get_frame_sub_type(pframe) == WIFI_BAR) { + } else if (get_frame_sub_type(pframe) == IEEE80211_STYPE_BACK_REQ) { rtw_process_bar_frame(padapter, precv_frame); } @@ -1746,15 +1746,15 @@ static sint validate_mgmt_protect(_adapter *adapter, union recv_frame *precv_fra is_bmc = is_multicast_ether_addr(GetAddr1Ptr(ptr)); #if DBG_VALIDATE_MGMT_PROTECT - if (subtype == WIFI_DEAUTH) { + if (subtype == IEEE80211_STYPE_DEAUTH) { RTW_INFO(FUNC_ADPT_FMT" bmc:%u, deauth, privacy:%u, encrypt:%u, bdecrypted:%u\n" , FUNC_ADPT_ARG(adapter) , is_bmc, pattrib->privacy, pattrib->encrypt, pattrib->bdecrypted); - } else if (subtype == WIFI_DISASSOC) { + } else if (subtype == IEEE80211_STYPE_DISASSOC) { RTW_INFO(FUNC_ADPT_FMT" bmc:%u, disassoc, privacy:%u, encrypt:%u, bdecrypted:%u\n" , FUNC_ADPT_ARG(adapter) , is_bmc, pattrib->privacy, pattrib->encrypt, pattrib->bdecrypted); - } if (subtype == WIFI_ACTION) { + } if (subtype == IEEE80211_STYPE_ACTION) { if (pattrib->privacy) { RTW_INFO(FUNC_ADPT_FMT" bmc:%u, action(?), privacy:%u, encrypt:%u, bdecrypted:%u\n" , FUNC_ADPT_ARG(adapter) @@ -1774,12 +1774,12 @@ static sint validate_mgmt_protect(_adapter *adapter, union recv_frame *precv_fra goto exit; } - if (subtype == WIFI_ACTION) + if (subtype == IEEE80211_STYPE_ACTION) category = *(ptr + sizeof(struct rtw_ieee80211_hdr_3addr)); if (is_bmc) { /* broadcast cases */ - if (subtype == WIFI_ACTION) { + if (subtype == IEEE80211_STYPE_ACTION) { if (CATEGORY_IS_GROUP_PRIVACY(category)) { /* drop broadcast group privacy action frame without encryption */ #if DBG_VALIDATE_MGMT_PROTECT @@ -1793,7 +1793,7 @@ static sint validate_mgmt_protect(_adapter *adapter, union recv_frame *precv_fra goto bip_verify; } } - if (subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC) { + if (subtype == IEEE80211_STYPE_DEAUTH || subtype == IEEE80211_STYPE_DISASSOC) { /* broadcast deauth or disassoc frame need BIP check */ goto bip_verify; } @@ -1802,13 +1802,13 @@ static sint validate_mgmt_protect(_adapter *adapter, union recv_frame *precv_fra } else { /* unicast cases */ #ifdef CONFIG_IEEE80211W - if (subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC) { + if (subtype == IEEE80211_STYPE_DEAUTH || subtype == IEEE80211_STYPE_DISASSOC) { if (!MLME_IS_MESH(adapter)) { unsigned short reason = le16_to_cpu(*(unsigned short *)(ptr + WLAN_HDR_A3_LEN)); #if DBG_VALIDATE_MGMT_PROTECT RTW_INFO(FUNC_ADPT_FMT" unicast %s, reason=%d w/o encrypt\n" - , FUNC_ADPT_ARG(adapter), subtype == WIFI_DEAUTH ? "deauth" : "disassoc", reason); + , FUNC_ADPT_ARG(adapter), subtype == IEEE80211_STYPE_DEAUTH ? "deauth" : "disassoc", reason); #endif if (reason == 6 || reason == 7) { /* issue sa query request */ @@ -1819,7 +1819,7 @@ static sint validate_mgmt_protect(_adapter *adapter, union recv_frame *precv_fra } #endif - if (subtype == WIFI_ACTION && CATEGORY_IS_ROBUST(category)) { + if (subtype == IEEE80211_STYPE_ACTION && CATEGORY_IS_ROBUST(category)) { if (psta->bpairwise_key_installed == _TRUE) { #if DBG_VALIDATE_MGMT_PROTECT RTW_INFO(FUNC_ADPT_FMT" unicast robust action(%d) w/o encrypt\n" @@ -1959,11 +1959,11 @@ sint validate_recv_mgnt_frame(PADAPTER padapter, union recv_frame *precv_frame) if (psta) { psta->sta_stats.last_rx_time = jiffies; psta->sta_stats.rx_mgnt_pkts++; - if (get_frame_sub_type(precv_frame->u.hdr.rx_data) == WIFI_BEACON) + if (get_frame_sub_type(precv_frame->u.hdr.rx_data) == IEEE80211_STYPE_BEACON) psta->sta_stats.rx_beacon_pkts++; - else if (get_frame_sub_type(precv_frame->u.hdr.rx_data) == WIFI_PROBEREQ) + else if (get_frame_sub_type(precv_frame->u.hdr.rx_data) == IEEE80211_STYPE_PROBE_REQ) psta->sta_stats.rx_probereq_pkts++; - else if (get_frame_sub_type(precv_frame->u.hdr.rx_data) == WIFI_PROBERSP) { + else if (get_frame_sub_type(precv_frame->u.hdr.rx_data) == IEEE80211_STYPE_PROBE_RESP) { if (_rtw_memcmp(adapter_mac_addr(padapter), GetAddr1Ptr(precv_frame->u.hdr.rx_data), ETH_ALEN) == _TRUE) psta->sta_stats.rx_probersp_pkts++; else if (is_broadcast_mac_addr(GetAddr1Ptr(precv_frame->u.hdr.rx_data)) @@ -2290,14 +2290,14 @@ sint validate_recv_frame(_adapter *adapter, union recv_frame *precv_frame) rtw_hal_get_def_var(adapter, HAL_DEF_DBG_DUMP_RXPKT, &(bDumpRxPkt)); if (bDumpRxPkt == 1) /* dump all rx packets */ dump_rx_packet(ptr); - else if ((bDumpRxPkt == 2) && (type == WIFI_MGT_TYPE)) + else if ((bDumpRxPkt == 2) && (type == IEEE80211_FTYPE_MGMT)) dump_rx_packet(ptr); - else if ((bDumpRxPkt == 3) && (type == WIFI_DATA_TYPE)) + else if ((bDumpRxPkt == 3) && (type == IEEE80211_FTYPE_DATA)) dump_rx_packet(ptr); } #endif switch (type) { - case WIFI_MGT_TYPE: /* mgnt */ + case IEEE80211_FTYPE_MGMT: /* mgnt */ DBG_COUNTER(adapter->rx_logs.core_rx_pre_mgmt); retval = validate_recv_mgnt_frame(adapter, precv_frame); if (retval == _FAIL) { @@ -2305,7 +2305,7 @@ sint validate_recv_frame(_adapter *adapter, union recv_frame *precv_frame) } retval = _FAIL; /* only data frame return _SUCCESS */ break; - case WIFI_CTRL_TYPE: /* ctrl */ + case IEEE80211_FTYPE_CTL: /* ctrl */ DBG_COUNTER(adapter->rx_logs.core_rx_pre_ctrl); retval = validate_recv_ctrl_frame(adapter, precv_frame); if (retval == _FAIL) { @@ -2313,7 +2313,7 @@ sint validate_recv_frame(_adapter *adapter, union recv_frame *precv_frame) } retval = _FAIL; /* only data frame return _SUCCESS */ break; - case WIFI_DATA_TYPE: /* data */ + case IEEE80211_FTYPE_DATA: /* data */ DBG_COUNTER(adapter->rx_logs.core_rx_pre_data); #ifdef CONFIG_WAPI_SUPPORT if (pattrib->qos) @@ -2765,7 +2765,7 @@ union recv_frame *recvframe_chk_defrag(PADAPTER padapter, union recv_frame *prec psta = rtw_get_stainfo(pstapriv, psta_addr); if (psta == NULL) { u8 type = GetFrameType(pfhdr->rx_data); - if (type != WIFI_DATA_TYPE) { + if (type != IEEE80211_FTYPE_DATA) { psta = rtw_get_bcmc_stainfo(padapter); if (psta) pdefrag_q = &psta->sta_recvpriv.defrag_q; @@ -3820,7 +3820,7 @@ int mp_recv_frame(_adapter *padapter, union recv_frame *rframe) pattrib->privacy = GetPrivacy(ptr); pattrib->order = GetOrder(ptr); - if (type == WIFI_DATA_TYPE) { + if (type == IEEE80211_FTYPE_DATA) { pda = get_da(ptr); psa = get_sa(ptr); pbssid = get_hdr_bssid(ptr); @@ -4431,7 +4431,7 @@ int recv_func(_adapter *padapter, union recv_frame *rframe) {} #ifdef CONFIG_CUSTOMER_ALIBABA_GENERAL type = GetFrameType(ptr); - if ((type == WIFI_DATA_TYPE)&& check_fwstate(mlmepriv, WIFI_STATION_STATE)) { + if ((type == IEEE80211_FTYPE_DATA)&& check_fwstate(mlmepriv, WIFI_STATION_STATE)) { struct wlan_network *cur_network = &(mlmepriv->cur_network); if ( _rtw_memcmp(get_addr2_ptr(ptr), cur_network->network.MacAddress, ETH_ALEN)==0) { recv_frame_monitor(padapter, rframe); @@ -4817,7 +4817,7 @@ void rx_query_phy_status( && _rtw_memcmp(ra, adapter_mac_addr(padapter), ETH_ALEN); pkt_info.is_packet_beacon = pkt_info.is_packet_match_bssid - && (get_frame_sub_type(wlanhdr) == WIFI_BEACON); + && (get_frame_sub_type(wlanhdr) == IEEE80211_STYPE_BEACON); if (psta && IsFrameTypeData(wlanhdr)) { if (is_ra_bmc) @@ -4939,7 +4939,7 @@ bypass_concurrent_hdl: #endif /* CONFIG_CONCURRENT_MODE */ if (primary_padapter->registrypriv.mp_mode != 1) { /* skip unnecessary bmc data frame for primary adapter */ - if (ra_is_bmc == _TRUE && GetFrameType(pbuf) == WIFI_DATA_TYPE + if (ra_is_bmc == _TRUE && GetFrameType(pbuf) == IEEE80211_FTYPE_DATA && !adapter_allow_bmc_data_rx(precvframe->u.hdr.adapter) ) { rtw_free_recvframe(precvframe, &precvframe->u.hdr.adapter->recvpriv.free_recv_queue); diff --git a/core/rtw_rm.c b/core/rtw_rm.c index 5489664..2df4186 100644 --- a/core/rtw_rm.c +++ b/core/rtw_rm.c @@ -347,7 +347,7 @@ static u8 *build_wlan_hdr(_adapter *padapter, struct xmit_frame *pmgntframe, pmlmeext->mgnt_seq++; SetFragNum(pframe, 0); - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattr->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -410,7 +410,7 @@ int issue_null_reply(struct rm_obj *prm) return _FALSE; } pattr = &pmgntframe->attrib; - pframe = build_wlan_hdr(padapter, pmgntframe, prm->psta, WIFI_ACTION); + pframe = build_wlan_hdr(padapter, pmgntframe, prm->psta, IEEE80211_STYPE_ACTION); pframe = rtw_set_fixed_ie(pframe, 3, &prm->p.category, &pattr->pktlen); my_len = 0; @@ -1556,7 +1556,7 @@ int issue_beacon_rep(struct rm_obj *prm) } pattr = &pmgntframe->attrib; pframe = build_wlan_hdr(padapter, - pmgntframe, prm->psta, WIFI_ACTION); + pmgntframe, prm->psta, IEEE80211_STYPE_ACTION); pframe = rtw_set_fixed_ie(pframe, 3, &prm->p.category, &pattr->pktlen); @@ -1600,7 +1600,7 @@ int issue_nb_req(struct rm_obj *prm) return _FALSE; } pattr = &pmgntframe->attrib; - pframe = build_wlan_hdr(padapter, pmgntframe, psta, WIFI_ACTION); + pframe = build_wlan_hdr(padapter, pmgntframe, psta, IEEE80211_STYPE_ACTION); pframe = rtw_set_fixed_ie(pframe, 3, &prm->q.category, &pattr->pktlen); @@ -1743,7 +1743,7 @@ int issue_radio_meas_req(struct rm_obj *prm) return _FALSE; } pattr = &pmgntframe->attrib; - pframe = build_wlan_hdr(padapter, pmgntframe, prm->psta, WIFI_ACTION); + pframe = build_wlan_hdr(padapter, pmgntframe, prm->psta, IEEE80211_STYPE_ACTION); pframe = rtw_set_fixed_ie(pframe, 3, &prm->q.category, &pattr->pktlen); /* repeat */ @@ -1917,7 +1917,7 @@ int issue_radio_meas_rep(struct rm_obj *prm) return _FALSE; } pattr = &pmgntframe->attrib; - pframe = build_wlan_hdr(padapter, pmgntframe, psta, WIFI_ACTION); + pframe = build_wlan_hdr(padapter, pmgntframe, psta, IEEE80211_STYPE_ACTION); pframe = rtw_set_fixed_ie(pframe, 3, &prm->p.category, &pattr->pktlen); diff --git a/core/rtw_security.c b/core/rtw_security.c index 45dab27..526cb03 100644 --- a/core/rtw_security.c +++ b/core/rtw_security.c @@ -1180,7 +1180,7 @@ static void construct_mic_iv( mic_iv[1] = 0x00; #if defined(CONFIG_IEEE80211W) || defined(CONFIG_RTW_MESH) /* 802.11w management frame should set management bit(4) */ - if (frtype == WIFI_MGT_TYPE) + if (frtype == IEEE80211_FTYPE_MGMT) mic_iv[1] |= BIT(4); #endif for (i = 2; i < 8; i++) @@ -1214,7 +1214,7 @@ static void construct_mic_header1( mic_header1[1] = (u8)((header_length - 2) % 256); #if defined(CONFIG_IEEE80211W) || defined(CONFIG_RTW_MESH) /* 802.11w management frame don't AND subtype bits 4,5,6 of frame control field */ - if (frtype == WIFI_MGT_TYPE) + if (frtype == IEEE80211_FTYPE_MGMT) mic_header1[2] = mpdu[0]; else #endif @@ -1315,7 +1315,7 @@ static void construct_ctr_preload( ctr_preload[1] = mpdu[24] & 0x0f; #if defined(CONFIG_IEEE80211W) || defined(CONFIG_RTW_MESH) /* 802.11w management frame should set management bit(4) */ - if (frtype == WIFI_MGT_TYPE) + if (frtype == IEEE80211_FTYPE_MGMT) ctr_preload[1] |= BIT(4); #endif for (i = 2; i < 8; i++) @@ -1383,15 +1383,15 @@ static sint aes_cipher(u8 *key, uint hdrlen, a4_exists = 1; if ( - ((frtype | frsubtype) == WIFI_DATA_CFACK) || - ((frtype | frsubtype) == WIFI_DATA_CFPOLL) || - ((frtype | frsubtype) == WIFI_DATA_CFACKPOLL)) { + ((frtype | frsubtype) == (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA_CFACK)) || + ((frtype | frsubtype) == (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA_CFPOLL)) || + ((frtype | frsubtype) == (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA_CFACKPOLL))) { qc_exists = 1; if (hdrlen != WLAN_HDR_A3_QOS_LEN && hdrlen != WLAN_HDR_A4_QOS_LEN) hdrlen += 2; } /* add for CONFIG_IEEE80211W, none 11w also can use */ - else if ((frtype == WIFI_DATA) && + else if ((frtype == (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA)) && ((frsubtype == 0x08) || (frsubtype == 0x09) || (frsubtype == 0x0a) || @@ -1702,14 +1702,14 @@ static sint aes_decipher(u8 *key, uint hdrlen, a4_exists = 1; if ( - ((frtype | frsubtype) == WIFI_DATA_CFACK) || - ((frtype | frsubtype) == WIFI_DATA_CFPOLL) || - ((frtype | frsubtype) == WIFI_DATA_CFACKPOLL)) { + ((frtype | frsubtype) == (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA_CFACK)) || + ((frtype | frsubtype) == (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA_CFPOLL)) || + ((frtype | frsubtype) == (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA_CFACKPOLL))) { qc_exists = 1; if (hdrlen != WLAN_HDR_A3_QOS_LEN && hdrlen != WLAN_HDR_A4_QOS_LEN) hdrlen += 2; } /* only for data packet . add for CONFIG_IEEE80211W, none 11w also can use */ - else if ((frtype == WIFI_DATA) && + else if ((frtype == (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA)) && ((frsubtype == 0x08) || (frsubtype == 0x09) || (frsubtype == 0x0a) || diff --git a/core/rtw_tdls.c b/core/rtw_tdls.c index e91e07c..785bb5f 100644 --- a/core/rtw_tdls.c +++ b/core/rtw_tdls.c @@ -327,7 +327,7 @@ int _issue_nulldata_to_TDLS_peer_STA(_adapter *padapter, unsigned char *da, unsi SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_QOS_DATA_NULL); + set_frame_sub_type(pframe, IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); pframe += sizeof(struct rtw_ieee80211_hdr_3addr_qos); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr_qos); @@ -1538,7 +1538,7 @@ int issue_tdls_dis_rsp(_adapter *padapter, struct tdls_txmgmt *ptxmgmt, u8 priva SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); diff --git a/core/rtw_wapi.c b/core/rtw_wapi.c index 403c53d..d852764 100644 --- a/core/rtw_wapi.c +++ b/core/rtw_wapi.c @@ -396,7 +396,7 @@ u8 rtw_wapi_is_wai_packet(_adapter *padapter, u8 *pkt_data) WAPI_TRACE(WAPI_TX | WAPI_RX, "%s: bFind=%d pTaddr="MAC_FMT"\n", __FUNCTION__, bFind, MAC_ARG(pTaddr)); - if (pkt_data[0] == WIFI_QOS_DATA_TYPE) + if (pkt_data[0] == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) Offset_TypeWAI += 2; /* 88b4? */ diff --git a/core/rtw_wapi_sms4.c b/core/rtw_wapi_sms4.c index d96865a..5acdf84 100644 --- a/core/rtw_wapi_sms4.c +++ b/core/rtw_wapi_sms4.c @@ -482,7 +482,7 @@ u8 WapiCheckPnInSwDecrypt( if ((_rtw_memcmp(pRaddr, padapter->pnetdev->dev_addr, ETH_ALEN) == 0) && !(pDaddr) - && (GetFrameType(&fc) == WIFI_QOS_DATA_TYPE)) + && (GetFrameType(&fc) == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA))) /* && ieee->pHTInfo->bCurrentHTSupport && */ /* ieee->pHTInfo->bCurRxReorderEnable) */ ret = false; @@ -509,7 +509,7 @@ int SecSMS4HeaderFillIV(_adapter *padapter, u8 *pxmitframe) return ret; #if 0 hdr_len = sMacHdrLng; - if (GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE) + if (GetFrameType(pskb->data) == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) hdr_len += 2; /* hdr_len += SNAP_SIZE + sizeof(u16); */ @@ -694,7 +694,7 @@ u8 SecSWSMS4Decryption( WAPI_DATA(WAPI_RX, "Decryption - Before decryption", pskb->data, pskb->len); IVOffset = sMacHdrLng; - bQosData = GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE; + bQosData = GetFrameType(pskb->data) == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA); if (bQosData) IVOffset += 2; @@ -757,7 +757,7 @@ u8 SecSWSMS4Decryption( if (pWapiSta->wapiUsk.keyId == KeyIdx && pWapiSta->wapiUsk.bSet) { WAPI_TRACE(WAPI_RX, "%s: Use USK for Decryption!!!\n", __FUNCTION__); if (precv_hdr->bWapiCheckPNInDecrypt) { - if (GetFrameType(pskb->data) == WIFI_QOS_DATA_TYPE) { + if (GetFrameType(pskb->data) == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) { WapiGetLastRxUnicastPNForQoSData(TID, pWapiSta, lastRxPNforQoS); pLastRxPN = lastRxPNforQoS; } else diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index 14df13b..9f51b3e 100644 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -2370,15 +2370,15 @@ void rtw_absorb_ssid_ifneed(_adapter *padapter, WLAN_BSSID_EX *bssid, u8 *pframe if ((!bssid) || (!pframe)) return; - if (subtype == WIFI_BEACON) { + if (subtype == IEEE80211_STYPE_BEACON) { bssid->Reserved[0] = BSS_TYPE_BCN; ie_offset = _BEACON_IE_OFFSET_; } else { /* FIXME : more type */ - if (subtype == WIFI_PROBERSP) { + if (subtype == IEEE80211_STYPE_PROBE_RESP) { ie_offset = _PROBERSP_IE_OFFSET_; bssid->Reserved[0] = BSS_TYPE_PROB_RSP; - } else if (subtype == WIFI_PROBEREQ) { + } else if (subtype == IEEE80211_STYPE_PROBE_REQ) { ie_offset = _PROBEREQ_IE_OFFSET_; bssid->Reserved[0] = BSS_TYPE_PROB_REQ; } else { @@ -4200,7 +4200,7 @@ unsigned int setup_beacon_frame(_adapter *padapter, unsigned char *beacon_frame) memcpy(pwlanhdr->addr2, adapter_mac_addr(padapter), ETH_ALEN); memcpy(pwlanhdr->addr3, get_my_bssid(cur_network), ETH_ALEN); - set_frame_sub_type(pframe, WIFI_BEACON); + set_frame_sub_type(pframe, IEEE80211_STYPE_BEACON); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); len = sizeof(struct rtw_ieee80211_hdr_3addr); diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 534bb94..c547dcf 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -1158,7 +1158,7 @@ static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib) #endif/*CONFIG_IP_R_MONITOR*/ pattrib->priority = UserPriority; pattrib->hdrlen = WLAN_HDR_A3_QOS_LEN; - pattrib->subtype = WIFI_QOS_DATA_TYPE; + pattrib->subtype = (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA); } #ifdef CONFIG_TDLS @@ -1223,11 +1223,11 @@ s32 update_tdls_attrib(_adapter *padapter, struct pkt_attrib *pattrib) if (pqospriv->qos_option && psta->qos_option) { pattrib->priority = 4; /* tdls management frame should be AC_VI */ pattrib->hdrlen = WLAN_HDR_A3_QOS_LEN; - pattrib->subtype = WIFI_QOS_DATA_TYPE; + pattrib->subtype = (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA); } else { pattrib->priority = 0; pattrib->hdrlen = WLAN_HDR_A3_LEN; - pattrib->subtype = WIFI_DATA_TYPE; + pattrib->subtype = IEEE80211_FTYPE_DATA; } /* TODO:_lock */ @@ -1490,7 +1490,7 @@ get_sta_info: pattrib->pkt_hdrlen = ETH_HLEN;/* (pattrib->ether_type == 0x8100) ? (14 + 4 ): 14; */ /* vlan tag */ pattrib->hdrlen = WLAN_HDR_A3_LEN; - pattrib->subtype = WIFI_DATA_TYPE; + pattrib->subtype = IEEE80211_FTYPE_DATA; pattrib->qos_en = psta->qos_option; pattrib->priority = 0; @@ -1757,7 +1757,7 @@ s32 rtw_make_wlanhdr(_adapter *padapter , u8 *hdr, struct pkt_attrib *pattrib) set_frame_sub_type(fctrl, pattrib->subtype); - if (pattrib->subtype & WIFI_DATA_TYPE) { + if (pattrib->subtype & IEEE80211_FTYPE_DATA) { if ((check_fwstate(pmlmepriv, WIFI_STATION_STATE) == _TRUE)) { #ifdef CONFIG_TDLS if (pattrib->direct_link == _TRUE) { @@ -2796,9 +2796,9 @@ s32 rtw_mgmt_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame subtype = get_frame_sub_type(pframe); /* bit(7)~bit(2) */ /* check if robust mgmt frame */ - if (subtype != WIFI_DEAUTH && subtype != WIFI_DISASSOC && subtype != WIFI_ACTION) + if (subtype != IEEE80211_STYPE_DEAUTH && subtype != IEEE80211_STYPE_DISASSOC && subtype != IEEE80211_STYPE_ACTION) return _SUCCESS; - if (subtype == WIFI_ACTION) { + if (subtype == IEEE80211_STYPE_ACTION) { category = *(pframe + sizeof(struct rtw_ieee80211_hdr_3addr)); if (CATEGORY_IS_NON_ROBUST(category)) return _SUCCESS; @@ -2831,7 +2831,7 @@ s32 rtw_mgmt_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame _enter_critical_bh(&padapter->security_key_mutex, &irqL); if (bmcst) { - if (subtype == WIFI_ACTION && CATEGORY_IS_GROUP_PRIVACY(category)) { + if (subtype == IEEE80211_STYPE_ACTION && CATEGORY_IS_GROUP_PRIVACY(category)) { /* broadcast group privacy action frame */ #if DBG_MGMT_XMIT_COALESEC_DUMP RTW_INFO(FUNC_ADPT_FMT" broadcast gp action(%u)\n" @@ -2866,11 +2866,11 @@ s32 rtw_mgmt_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame goto xmitframe_coalesce_success; #if DBG_MGMT_XMIT_COALESEC_DUMP - if (subtype == WIFI_DEAUTH) + if (subtype == IEEE80211_STYPE_DEAUTH) RTW_INFO(FUNC_ADPT_FMT" braodcast deauth\n", FUNC_ADPT_ARG(padapter)); - else if (subtype == WIFI_DISASSOC) + else if (subtype == IEEE80211_STYPE_DISASSOC) RTW_INFO(FUNC_ADPT_FMT" braodcast disassoc\n", FUNC_ADPT_ARG(padapter)); - else if (subtype == WIFI_ACTION) { + else if (subtype == IEEE80211_STYPE_ACTION) { RTW_INFO(FUNC_ADPT_FMT" braodcast action(%u)\n" , FUNC_ADPT_ARG(padapter), category); } @@ -2952,13 +2952,13 @@ s32 rtw_mgmt_xmitframe_coalesce(_adapter *padapter, _pkt *pkt, struct xmit_frame else { /* unicast robust mgmt frame */ #if DBG_MGMT_XMIT_COALESEC_DUMP - if (subtype == WIFI_DEAUTH) { + if (subtype == IEEE80211_STYPE_DEAUTH) { RTW_INFO(FUNC_ADPT_FMT" unicast deauth to "MAC_FMT"\n" , FUNC_ADPT_ARG(padapter), MAC_ARG(pattrib->ra)); - } else if (subtype == WIFI_DISASSOC) { + } else if (subtype == IEEE80211_STYPE_DISASSOC) { RTW_INFO(FUNC_ADPT_FMT" unicast disassoc to "MAC_FMT"\n" , FUNC_ADPT_ARG(padapter), MAC_ARG(pattrib->ra)); - } else if (subtype == WIFI_ACTION) { + } else if (subtype == IEEE80211_STYPE_ACTION) { RTW_INFO(FUNC_ADPT_FMT" unicast action(%u) to "MAC_FMT"\n" , FUNC_ADPT_ARG(padapter), category, MAC_ARG(pattrib->ra)); } diff --git a/hal/hal_com.c b/hal/hal_com.c index 8fda3a3..b542a1b 100644 --- a/hal/hal_com.c +++ b/hal/hal_com.c @@ -5994,7 +5994,7 @@ static void rtw_hal_construct_P2PBeacon(_adapter *padapter, u8 *pframe, u32 *pLe SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/); /* pmlmeext->mgnt_seq++; */ - set_frame_sub_type(pframe, WIFI_BEACON); + set_frame_sub_type(pframe, IEEE80211_STYPE_BEACON); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -6273,7 +6273,7 @@ static void rtw_hal_construct_P2PProbeRsp(_adapter *padapter, u8 *pframe, u32 *p memcpy(pwlanhdr->addr3, mac, ETH_ALEN); SetSeqNum(pwlanhdr, 0); - set_frame_sub_type(fctrl, WIFI_PROBERSP); + set_frame_sub_type(fctrl, IEEE80211_STYPE_PROBE_RESP); pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); pframe += pktlen; @@ -6596,7 +6596,7 @@ static void rtw_hal_construct_P2PNegoRsp(_adapter *padapter, u8 *pframe, u32 *pL memcpy(pwlanhdr->addr3, adapter_mac_addr(padapter), ETH_ALEN); SetSeqNum(pwlanhdr, 0); - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); pframe += pktlen; @@ -6997,7 +6997,7 @@ static void rtw_hal_construct_P2PInviteRsp(_adapter *padapter, u8 *pframe, u32 * memset(pwlanhdr->addr3, 0, ETH_ALEN); SetSeqNum(pwlanhdr, 0); - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -7240,7 +7240,7 @@ static void rtw_hal_construct_P2PProvisionDisRsp(_adapter *padapter, u8 *pframe, memcpy(pwlanhdr->addr3, adapter_mac_addr(padapter), ETH_ALEN); SetSeqNum(pwlanhdr, 0); - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -7405,7 +7405,7 @@ void rtw_hal_construct_beacon(_adapter *padapter, SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/); /* pmlmeext->mgnt_seq++; */ - set_frame_sub_type(pframe, WIFI_BEACON); + set_frame_sub_type(pframe, IEEE80211_STYPE_BEACON); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -7498,7 +7498,7 @@ static void rtw_hal_construct_PSPoll(_adapter *padapter, fctrl = &(pwlanhdr->frame_ctl); *(fctrl) = 0; SetPwrMgt(fctrl); - set_frame_sub_type(pframe, WIFI_PSPOLL); + set_frame_sub_type(pframe, (IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL)); /* AID. */ set_duration(pframe, (pmlmeinfo->aid | 0xc000)); @@ -7542,7 +7542,7 @@ void rtw_hal_construct_fw_dbg_msg_pkt( SetSeqNum(pwlanhdr, 0); - set_frame_sub_type(pframe, WIFI_DATA); + set_frame_sub_type(pframe, (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA)); pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -7611,7 +7611,7 @@ void rtw_hal_construct_NullFunctionData( if (bQoS == _TRUE) { struct rtw_ieee80211_hdr_3addr_qos *pwlanqoshdr; - set_frame_sub_type(pframe, WIFI_QOS_DATA_NULL); + set_frame_sub_type(pframe, IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC); pwlanqoshdr = (struct rtw_ieee80211_hdr_3addr_qos *)pframe; SetPriority(&pwlanqoshdr->qc, AC); @@ -7619,7 +7619,7 @@ void rtw_hal_construct_NullFunctionData( pktlen = sizeof(struct rtw_ieee80211_hdr_3addr_qos); } else { - set_frame_sub_type(pframe, WIFI_DATA_NULL); + set_frame_sub_type(pframe, IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC); pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); } @@ -7653,7 +7653,7 @@ void rtw_hal_construct_ProbeRsp(_adapter *padapter, u8 *pframe, u32 *pLength, memcpy(pwlanhdr->addr3, bssid, ETH_ALEN); SetSeqNum(pwlanhdr, 0); - set_frame_sub_type(fctrl, WIFI_PROBERSP); + set_frame_sub_type(fctrl, IEEE80211_STYPE_PROBE_RESP); pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); pframe += pktlen; @@ -7749,7 +7749,7 @@ static void rtw_hal_construct_ARPRsp( /* ------------------------------------------------------------------------- */ /* MAC Header. */ /* ------------------------------------------------------------------------- */ - SetFrameType(fctrl, WIFI_DATA); + SetFrameType(fctrl, (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA)); /* set_frame_sub_type(fctrl, 0); */ SetToDs(fctrl); memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); @@ -7883,7 +7883,7 @@ static void rtw_hal_construct_na_message(_adapter *padapter, /* ------------------------------------------------------------------------- */ /* MAC Header. */ /* ------------------------------------------------------------------------- */ - SetFrameType(fctrl, WIFI_DATA); + SetFrameType(fctrl, (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA)); SetToDs(fctrl); memcpy(pwlanhdr->addr1, get_my_bssid(&(pmlmeinfo->network)), ETH_ALEN); @@ -8054,7 +8054,7 @@ static void rtw_hal_construct_ProbeReq(_adapter *padapter, u8 *pframe, memcpy(pwlanhdr->addr2, mac, ETH_ALEN); SetSeqNum(pwlanhdr, 0); - set_frame_sub_type(pframe, WIFI_PROBEREQ); + set_frame_sub_type(pframe, IEEE80211_STYPE_PROBE_REQ); pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); pframe += pktlen; @@ -8232,7 +8232,7 @@ static void rtw_hal_construct_GTKRsp( /* ------------------------------------------------------------------------- */ /* MAC Header. */ /* ------------------------------------------------------------------------- */ - SetFrameType(fctrl, WIFI_DATA); + SetFrameType(fctrl, (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA)); /* set_frame_sub_type(fctrl, 0); */ SetToDs(fctrl); @@ -12523,9 +12523,9 @@ void rtw_store_phy_info(_adapter *padapter, union recv_frame *prframe) } } #ifdef DBG_RX_DFRAME_RAW_DATA - if ((dframe_type == WIFI_DATA_TYPE) || (dframe_type == WIFI_QOS_DATA_TYPE) || (padapter->registrypriv.mp_mode == 1)) { + if ((dframe_type == IEEE80211_FTYPE_DATA) || (dframe_type == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) || (padapter->registrypriv.mp_mode == 1)) { - /*RTW_INFO("=>%s WIFI_DATA_TYPE or WIFI_QOS_DATA_TYPE\n", __FUNCTION__);*/ + /*RTW_INFO("=>%s IEEE80211_FTYPE_DATA or (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)\n", __FUNCTION__);*/ if (psta) { if (is_multicast_ether_addr(get_ra(get_recvframe_data(prframe)))) psta_dframe_info = &psta->sta_dframe_info_bmc; diff --git a/include/wifi.h b/include/wifi.h index dcdc034..8f24a5d 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -71,53 +71,10 @@ #pragma pack(1) #endif -enum WIFI_FRAME_TYPE { - WIFI_MGT_TYPE = (0), - WIFI_CTRL_TYPE = (BIT(2)), - WIFI_DATA_TYPE = (BIT(3)), - WIFI_QOS_DATA_TYPE = (BIT(7) | BIT(3)), /* !< QoS Data */ -}; - -enum WIFI_FRAME_SUBTYPE { - - /* below is for mgt frame */ - WIFI_ASSOCREQ = (0 | WIFI_MGT_TYPE), - WIFI_ASSOCRSP = (BIT(4) | WIFI_MGT_TYPE), - WIFI_REASSOCREQ = (BIT(5) | WIFI_MGT_TYPE), - WIFI_REASSOCRSP = (BIT(5) | BIT(4) | WIFI_MGT_TYPE), - WIFI_PROBEREQ = (BIT(6) | WIFI_MGT_TYPE), - WIFI_PROBERSP = (BIT(6) | BIT(4) | WIFI_MGT_TYPE), - WIFI_BEACON = (BIT(7) | WIFI_MGT_TYPE), - WIFI_ATIM = (BIT(7) | BIT(4) | WIFI_MGT_TYPE), - WIFI_DISASSOC = (BIT(7) | BIT(5) | WIFI_MGT_TYPE), - WIFI_AUTH = (BIT(7) | BIT(5) | BIT(4) | WIFI_MGT_TYPE), - WIFI_DEAUTH = (BIT(7) | BIT(6) | WIFI_MGT_TYPE), - WIFI_ACTION = (BIT(7) | BIT(6) | BIT(4) | WIFI_MGT_TYPE), - WIFI_ACTION_NOACK = (BIT(7) | BIT(6) | BIT(5) | WIFI_MGT_TYPE), - - /* below is for control frame */ - WIFI_BF_REPORT_POLL = (BIT(6) | WIFI_CTRL_TYPE), - WIFI_NDPA = (BIT(6) | BIT(4) | WIFI_CTRL_TYPE), - WIFI_BAR = (BIT(7) | WIFI_CTRL_TYPE), - WIFI_PSPOLL = (BIT(7) | BIT(5) | WIFI_CTRL_TYPE), - WIFI_RTS = (BIT(7) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE), - WIFI_CTS = (BIT(7) | BIT(6) | WIFI_CTRL_TYPE), - WIFI_ACK = (BIT(7) | BIT(6) | BIT(4) | WIFI_CTRL_TYPE), - WIFI_CFEND = (BIT(7) | BIT(6) | BIT(5) | WIFI_CTRL_TYPE), - WIFI_CFEND_CFACK = (BIT(7) | BIT(6) | BIT(5) | BIT(4) | WIFI_CTRL_TYPE), - - /* below is for data frame */ - WIFI_DATA = (0 | WIFI_DATA_TYPE), - WIFI_DATA_CFACK = (BIT(4) | WIFI_DATA_TYPE), - WIFI_DATA_CFPOLL = (BIT(5) | WIFI_DATA_TYPE), - WIFI_DATA_CFACKPOLL = (BIT(5) | BIT(4) | WIFI_DATA_TYPE), - WIFI_DATA_NULL = (BIT(6) | WIFI_DATA_TYPE), - WIFI_CF_ACK = (BIT(6) | BIT(4) | WIFI_DATA_TYPE), - WIFI_CF_POLL = (BIT(6) | BIT(5) | WIFI_DATA_TYPE), - WIFI_CF_ACKPOLL = (BIT(6) | BIT(5) | BIT(4) | WIFI_DATA_TYPE), - WIFI_QOS_DATA_NULL = (BIT(6) | WIFI_QOS_DATA_TYPE), -}; - +/*ieee80211 management */ +#define WIFI_ACTION_NOACK (BIT(7) | BIT(6) | BIT(5) | IEEE80211_FTYPE_MGMT) +/* below is for control frame */ +#define WIFI_NDPA (BIT(6) | BIT(4) | IEEE80211_FTYPE_CTL) /* Reason codes (IEEE 802.11-2007, 7.3.1.7, Table 7-22) */ enum { @@ -390,21 +347,21 @@ __inline static unsigned char *get_hdr_bssid(unsigned char *pframe) __inline static int IsFrameTypeCtrl(unsigned char *pframe) { - if (WIFI_CTRL_TYPE == GetFrameType(pframe)) + if (IEEE80211_FTYPE_CTL == GetFrameType(pframe)) return _TRUE; else return _FALSE; } static inline int IsFrameTypeMgnt(unsigned char *pframe) { - if (GetFrameType(pframe) == WIFI_MGT_TYPE) + if (GetFrameType(pframe) == IEEE80211_FTYPE_MGMT) return _TRUE; else return _FALSE; } static inline int IsFrameTypeData(unsigned char *pframe) { - if (GetFrameType(pframe) == WIFI_DATA_TYPE) + if (GetFrameType(pframe) == IEEE80211_FTYPE_DATA) return _TRUE; else return _FALSE; diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index c054262..6bdb7a9 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -862,12 +862,12 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net SetSeqNum(pwlanhdr, 0/*pmlmeext->mgnt_seq*/); /* pmlmeext->mgnt_seq++; */ - if (pnetwork->network.Reserved[0] == BSS_TYPE_BCN) { /* WIFI_BEACON */ + if (pnetwork->network.Reserved[0] == BSS_TYPE_BCN) { /* IEEE80211_STYPE_BEACON */ memcpy(pwlanhdr->addr1, bc_addr, ETH_ALEN); - set_frame_sub_type(pbuf, WIFI_BEACON); + set_frame_sub_type(pbuf, IEEE80211_STYPE_BEACON); } else { memcpy(pwlanhdr->addr1, adapter_mac_addr(padapter), ETH_ALEN); - set_frame_sub_type(pbuf, WIFI_PROBERSP); + set_frame_sub_type(pbuf, IEEE80211_STYPE_PROBE_RESP); } memcpy(pwlanhdr->addr2, pnetwork->network.MacAddress, ETH_ALEN); @@ -904,7 +904,7 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)) #ifndef COMPAT_KERNEL_RELEASE /* patch for cfg80211, update beacon ies to information_elements */ - if (pnetwork->network.Reserved[0] == BSS_TYPE_BCN) { /* WIFI_BEACON */ + if (pnetwork->network.Reserved[0] == BSS_TYPE_BCN) { /* IEEE80211_STYPE_BEACON */ if (bss->len_information_elements != bss->len_beacon_ies) { bss->information_elements = bss->beacon_ies; @@ -4344,9 +4344,9 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f { struct station_info sinfo; u8 ie_offset; - if (get_frame_sub_type(pmgmt_frame) == WIFI_ASSOCREQ) + if (get_frame_sub_type(pmgmt_frame) == IEEE80211_STYPE_ASSOC_REQ) ie_offset = _ASOCREQ_IE_OFFSET_; - else /* WIFI_REASSOCREQ */ + else /* IEEE80211_STYPE_REASSOC_REQ */ ie_offset = _REASOCREQ_IE_OFFSET_; memset(&sinfo, 0, sizeof(sinfo)); @@ -4416,7 +4416,7 @@ void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, const u8 *da, unsign SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pmgmt_frame, WIFI_DEAUTH); + set_frame_sub_type(pmgmt_frame, IEEE80211_STYPE_DEAUTH); pmgmt_frame += sizeof(struct rtw_ieee80211_hdr_3addr); frame_len = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -6380,7 +6380,7 @@ void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, SetSeqNum(pwlanhdr, pmlmeext->mgnt_seq); pmlmeext->mgnt_seq++; - set_frame_sub_type(pframe, WIFI_ACTION); + set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION); pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); @@ -6569,7 +6569,7 @@ void rtw_cfg80211_external_auth_request(_adapter *padapter, union recv_frame *rf cfg80211_external_auth_request(netdev, (struct cfg80211_external_auth_params *)¶ms, GFP_ATOMIC); #elif (KERNEL_VERSION(2, 6, 37) <= LINUX_VERSION_CODE) - set_frame_sub_type(frame, WIFI_AUTH); + set_frame_sub_type(frame, IEEE80211_STYPE_AUTH); memcpy(frame + 4, get_my_bssid(&pmlmeinfo->network), ETH_ALEN); memcpy(frame + 10, adapter_mac_addr(padapter), ETH_ALEN); diff --git a/os_dep/linux/ioctl_linux.c b/os_dep/linux/ioctl_linux.c index ae07a71..798d7e4 100644 --- a/os_dep/linux/ioctl_linux.c +++ b/os_dep/linux/ioctl_linux.c @@ -11493,7 +11493,7 @@ static struct xmit_frame *createloopbackpkt(PADAPTER padapter, u32 size) pattrib->ack_policy = 0; /* pattrib->pkt_hdrlen = ETH_HLEN; */ pattrib->hdrlen = WLAN_HDR_A3_LEN; - pattrib->subtype = WIFI_DATA; + pattrib->subtype = (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); pattrib->priority = 0; pattrib->qsel = pattrib->priority; /* do_queue_select(padapter, pattrib); */