switch to common ieee80211 headers

This patch switches to <linux/ieee80211.h> and <net/cfg80211.h> and
deletes a lot of duplicate definitions plus many unused ones.

rtw_ieee80211_hdr_3addr_qos is duplicate of ieee80211_qos_hdr.
rtw_ieee80211_spectrum_mgmt_actioncode is a duplication of ieee80211_spectrum_mgmt_actioncode
rtw_ieee80211_hdr_3addr is duplicate of ieee80211_hdr_3addr.
rtw_ieee80211_hdr is duplicate of ieee80211_hdr
rtw_ieee80211s_hdr is duplicate of ieee80211s_hdr
rtw_ieee80211_rann_ie is duplicate of ieee80211_rann_ie
from include/linux/ieee80211.h.

Link: https://lore.kernel.org/r/20200906133236.556427-1-insafonov@gmail.com
Link: https://lore.kernel.org/r/20200609194848.166130-1-pterjan@google.com
Also port
5cd8396540b5f7ef7c3ac499e967dd4deb8e9930
bbfe286b07d8282f4957dee692e85b3bd60de770
d87f574d6923c546e7d0f75ce0581436376b98a6
36eb7d108e8de3097f373eb8629d8739d4fa3e74
1b9e6df5169b36b3242e2e28c39f9bbfc01863e8
d94971aa97670d400371baef5d9d5cf6dc8ea2b5
This commit is contained in:
Carlos Garces
2021-10-21 17:30:03 +02:00
parent 6b480dfa8e
commit 4799326c6f
23 changed files with 547 additions and 823 deletions

View File

@@ -143,7 +143,7 @@ static void issue_group_disc_req(struct wifidirect_info *pwdinfo, u8 *da)
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
struct rtw_ieee80211_hdr *pwlanhdr;
struct ieee80211_hdr *pwlanhdr;
unsigned short *fctrl;
_adapter *padapter = pwdinfo->padapter;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
@@ -166,9 +166,9 @@ static void issue_group_disc_req(struct wifidirect_info *pwdinfo, u8 *da)
memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
pwlanhdr = (struct ieee80211_hdr *)pframe;
fctrl = &(pwlanhdr->frame_ctl);
fctrl =&pwlanhdr->frame_control;
*(fctrl) = 0;
memcpy(pwlanhdr->addr1, da, ETH_ALEN);
@@ -179,8 +179,8 @@ static void issue_group_disc_req(struct wifidirect_info *pwdinfo, u8 *da)
pmlmeext->mgnt_seq++;
set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION);
pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
pframe += sizeof(struct ieee80211_hdr_3addr);
pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);
/* Build P2P action frame header */
pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
@@ -201,7 +201,7 @@ static void issue_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 s
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
struct rtw_ieee80211_hdr *pwlanhdr;
struct ieee80211_hdr *pwlanhdr;
unsigned short *fctrl;
_adapter *padapter = pwdinfo->padapter;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
@@ -226,9 +226,9 @@ static void issue_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 s
memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
pwlanhdr = (struct ieee80211_hdr *)pframe;
fctrl = &(pwlanhdr->frame_ctl);
fctrl =&pwlanhdr->frame_control;
*(fctrl) = 0;
memcpy(pwlanhdr->addr1, da, ETH_ALEN);
@@ -239,8 +239,8 @@ static void issue_p2p_devdisc_resp(struct wifidirect_info *pwdinfo, u8 *da, u8 s
pmlmeext->mgnt_seq++;
set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION);
pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
pframe += sizeof(struct ieee80211_hdr_3addr);
pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);
/* Build P2P public action frame header */
pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
@@ -286,7 +286,7 @@ static void issue_p2p_provision_resp(struct wifidirect_info *pwdinfo, u8 *raddr,
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
struct rtw_ieee80211_hdr *pwlanhdr;
struct ieee80211_hdr *pwlanhdr;
unsigned short *fctrl;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
@@ -303,9 +303,9 @@ static void issue_p2p_provision_resp(struct wifidirect_info *pwdinfo, u8 *raddr,
memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
pwlanhdr = (struct ieee80211_hdr *)pframe;
fctrl = &(pwlanhdr->frame_ctl);
fctrl =&pwlanhdr->frame_control;
*(fctrl) = 0;
memcpy(pwlanhdr->addr1, raddr, ETH_ALEN);
@@ -316,8 +316,8 @@ static void issue_p2p_provision_resp(struct wifidirect_info *pwdinfo, u8 *raddr,
pmlmeext->mgnt_seq++;
set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION);
pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
pframe += sizeof(struct ieee80211_hdr_3addr);
pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);
pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
pframe = rtw_set_fixed_ie(pframe, 1, &(action), &(pattrib->pktlen));
@@ -382,7 +382,7 @@ static void issue_p2p_presence_resp(struct wifidirect_info *pwdinfo, u8 *da, u8
struct xmit_frame *pmgntframe;
struct pkt_attrib *pattrib;
unsigned char *pframe;
struct rtw_ieee80211_hdr *pwlanhdr;
struct ieee80211_hdr *pwlanhdr;
unsigned short *fctrl;
_adapter *padapter = pwdinfo->padapter;
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
@@ -407,9 +407,9 @@ static void issue_p2p_presence_resp(struct wifidirect_info *pwdinfo, u8 *da, u8
memset(pmgntframe->buf_addr, 0, WLANHDR_OFFSET + TXDESC_OFFSET);
pframe = (u8 *)(pmgntframe->buf_addr) + TXDESC_OFFSET;
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
pwlanhdr = (struct ieee80211_hdr *)pframe;
fctrl = &(pwlanhdr->frame_ctl);
fctrl =&pwlanhdr->frame_control;
*(fctrl) = 0;
memcpy(pwlanhdr->addr1, da, ETH_ALEN);
@@ -420,8 +420,8 @@ static void issue_p2p_presence_resp(struct wifidirect_info *pwdinfo, u8 *da, u8
pmlmeext->mgnt_seq++;
set_frame_sub_type(pframe, IEEE80211_STYPE_ACTION);
pframe += sizeof(struct rtw_ieee80211_hdr_3addr);
pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr);
pframe += sizeof(struct ieee80211_hdr_3addr);
pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);
/* Build P2P action frame header */
pframe = rtw_set_fixed_ie(pframe, 1, &(category), &(pattrib->pktlen));
@@ -2428,7 +2428,7 @@ u32 process_p2p_devdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint le
u8 *p2p_ie;
u32 p2p_ielen = 0;
frame_body = (unsigned char *)(pframe + sizeof(struct rtw_ieee80211_hdr_3addr));
frame_body = (unsigned char *)(pframe + sizeof(struct ieee80211_hdr_3addr));
dialogToken = frame_body[7];
status = P2P_STATUS_FAIL_UNKNOWN_P2PGROUP;
@@ -2506,7 +2506,7 @@ u8 process_p2p_provdisc_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint l
u16 uconfig_method = 0;
frame_body = (pframe + sizeof(struct rtw_ieee80211_hdr_3addr));
frame_body = (pframe + sizeof(struct ieee80211_hdr_3addr));
wpsie = rtw_get_wps_ie(frame_body + _PUBLIC_ACTION_IE_OFFSET_, len - _PUBLIC_ACTION_IE_OFFSET_, NULL, &wps_ielen);
if (wpsie) {
@@ -3050,7 +3050,7 @@ u8 process_p2p_presence_req(struct wifidirect_info *pwdinfo, u8 *pframe, uint le
u8 dialogToken = 0;
u8 status = P2P_STATUS_SUCCESS;
frame_body = (unsigned char *)(pframe + sizeof(struct rtw_ieee80211_hdr_3addr));
frame_body = (unsigned char *)(pframe + sizeof(struct ieee80211_hdr_3addr));
dialogToken = frame_body[6];
@@ -3735,7 +3735,7 @@ u32 rtw_xframe_build_wfd_ie(struct xmit_frame *xframe)
_adapter *adapter = xframe->padapter;
struct wifidirect_info *wdinfo = &adapter->wdinfo;
u8 *frame = xframe->buf_addr + TXDESC_OFFSET;
u8 *frame_body = frame + sizeof(struct rtw_ieee80211_hdr_3addr);
u8 *frame_body = frame + sizeof(struct ieee80211_hdr_3addr);
u8 *frame_tail = frame + xframe->attrib.pktlen;
u8 category, action, OUI_Subtype, dialogToken = 0;
u32 wfdielen = 0;
@@ -3743,7 +3743,7 @@ u32 rtw_xframe_build_wfd_ie(struct xmit_frame *xframe)
category = frame_body[0];
if (category == WLAN_CATEGORY_PUBLIC) {
action = frame_body[1];
if (action == ACT_PUBLIC_VENDOR
if (action == WLAN_PUB_ACTION_VENDOR_SPECIFIC
&& _rtw_memcmp(frame_body + 2, P2P_OUI, 4) == _TRUE
) {
OUI_Subtype = frame_body[6];
@@ -3812,7 +3812,7 @@ bool rtw_xframe_del_wfd_ie(struct xmit_frame *xframe)
{
#define DBG_XFRAME_DEL_WFD_IE 0
u8 *frame = xframe->buf_addr + TXDESC_OFFSET;
u8 *frame_body = frame + sizeof(struct rtw_ieee80211_hdr_3addr);
u8 *frame_body = frame + sizeof(struct ieee80211_hdr_3addr);
u8 *frame_tail = frame + xframe->attrib.pktlen;
u8 category, action, OUI_Subtype;
u8 *ies = NULL;
@@ -3822,7 +3822,7 @@ bool rtw_xframe_del_wfd_ie(struct xmit_frame *xframe)
category = frame_body[0];
if (category == WLAN_CATEGORY_PUBLIC) {
action = frame_body[1];
if (action == ACT_PUBLIC_VENDOR
if (action == WLAN_PUB_ACTION_VENDOR_SPECIFIC
&& _rtw_memcmp(frame_body + 2, P2P_OUI, 4) == _TRUE
) {
OUI_Subtype = frame_body[6];
@@ -3958,12 +3958,12 @@ int rtw_p2p_check_frames(_adapter *padapter, const u8 *buf, u32 len, u8 tx)
u8 *iaddr = NULL;
u8 *gbssid = NULL;
frame_body = (unsigned char *)(buf + sizeof(struct rtw_ieee80211_hdr_3addr));
frame_body = (unsigned char *)(buf + sizeof(struct ieee80211_hdr_3addr));
category = frame_body[0];
/* just for check */
if (category == WLAN_CATEGORY_PUBLIC) {
action = frame_body[1];
if (action == ACT_PUBLIC_VENDOR
if (action == WLAN_PUB_ACTION_VENDOR_SPECIFIC
&& _rtw_memcmp(frame_body + 2, P2P_OUI, 4) == _TRUE
) {
OUI_Subtype = frame_body[6];
@@ -3971,13 +3971,13 @@ int rtw_p2p_check_frames(_adapter *padapter, const u8 *buf, u32 len, u8 tx)
is_p2p_frame = OUI_Subtype;
#ifdef CONFIG_DEBUG_CFG80211
RTW_INFO("ACTION_CATEGORY_PUBLIC: ACT_PUBLIC_VENDOR, OUI=0x%x, OUI_Subtype=%d, dialogToken=%d\n",
RTW_INFO("ACTION_CATEGORY_PUBLIC: WLAN_PUB_ACTION_VENDOR_SPECIFIC , OUI=0x%x, OUI_Subtype=%d, dialogToken=%d\n",
cpu_to_be32(*((u32 *)(frame_body + 2))), OUI_Subtype, dialogToken);
#endif
p2p_ie = rtw_get_p2p_ie(
(u8 *)buf + sizeof(struct rtw_ieee80211_hdr_3addr) + _PUBLIC_ACTION_IE_OFFSET_
, len - sizeof(struct rtw_ieee80211_hdr_3addr) - _PUBLIC_ACTION_IE_OFFSET_
(u8 *)buf + sizeof(struct ieee80211_hdr_3addr) + _PUBLIC_ACTION_IE_OFFSET_
, len - sizeof(struct ieee80211_hdr_3addr) - _PUBLIC_ACTION_IE_OFFSET_
, NULL, &p2p_ielen);
switch (OUI_Subtype) { /* OUI Subtype */
@@ -3996,7 +3996,7 @@ int rtw_p2p_check_frames(_adapter *padapter, const u8 *buf, u32 len, u8 tx)
#if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_CFG80211_ONECHANNEL_UNDER_CONCURRENT)
if (rtw_mi_check_status(padapter, MI_LINKED) && padapter->registrypriv.full_ch_in_p2p_handshake == 0)
rtw_cfg80211_adjust_p2pie_channel(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr));
rtw_cfg80211_adjust_p2pie_channel(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr));
#endif
}
@@ -4036,10 +4036,10 @@ int rtw_p2p_check_frames(_adapter *padapter, const u8 *buf, u32 len, u8 tx)
if (!tx) {
#if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_CFG80211_ONECHANNEL_UNDER_CONCURRENT)
if (rtw_mi_check_status(padapter, MI_LINKED)
&& rtw_chk_p2pie_ch_list_with_buddy(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr)) == _FALSE
&& rtw_chk_p2pie_ch_list_with_buddy(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr)) == _FALSE
&& padapter->registrypriv.full_ch_in_p2p_handshake == 0) {
RTW_INFO(FUNC_ADPT_FMT" ch_list has no intersect with buddy\n", FUNC_ADPT_ARG(padapter));
rtw_change_p2pie_ch_list(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr), 0);
rtw_change_p2pie_ch_list(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr), 0);
}
#endif
}
@@ -4052,7 +4052,7 @@ int rtw_p2p_check_frames(_adapter *padapter, const u8 *buf, u32 len, u8 tx)
if (tx) {
#if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_CFG80211_ONECHANNEL_UNDER_CONCURRENT)
if (rtw_mi_check_status(padapter, MI_LINKED) && padapter->registrypriv.full_ch_in_p2p_handshake == 0)
rtw_cfg80211_adjust_p2pie_channel(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr));
rtw_cfg80211_adjust_p2pie_channel(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr));
#endif
}
@@ -4093,10 +4093,10 @@ int rtw_p2p_check_frames(_adapter *padapter, const u8 *buf, u32 len, u8 tx)
pwdev_priv->provdisc_req_issued = _FALSE;
#if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_CFG80211_ONECHANNEL_UNDER_CONCURRENT)
if (rtw_mi_check_status(padapter, MI_LINKED)
&& rtw_chk_p2pie_ch_list_with_buddy(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr)) == _FALSE
&& rtw_chk_p2pie_ch_list_with_buddy(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr)) == _FALSE
&& padapter->registrypriv.full_ch_in_p2p_handshake == 0) {
RTW_INFO(FUNC_ADPT_FMT" ch_list has no intersect with buddy\n", FUNC_ADPT_ARG(padapter));
rtw_change_p2pie_ch_list(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr), 0);
rtw_change_p2pie_ch_list(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr), 0);
}
#endif
}
@@ -4110,7 +4110,7 @@ int rtw_p2p_check_frames(_adapter *padapter, const u8 *buf, u32 len, u8 tx)
if (tx) {
#if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_CFG80211_ONECHANNEL_UNDER_CONCURRENT)
if (rtw_mi_check_status(padapter, MI_LINKED) && padapter->registrypriv.full_ch_in_p2p_handshake == 0)
rtw_cfg80211_adjust_p2pie_channel(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr));
rtw_cfg80211_adjust_p2pie_channel(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr));
#endif
}
@@ -4153,7 +4153,7 @@ int rtw_p2p_check_frames(_adapter *padapter, const u8 *buf, u32 len, u8 tx)
#if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_CFG80211_ONECHANNEL_UNDER_CONCURRENT)
if (rtw_mi_check_status(padapter, MI_LINKED)
&& padapter->registrypriv.full_ch_in_p2p_handshake == 0)
rtw_cfg80211_adjust_p2pie_channel(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr));
rtw_cfg80211_adjust_p2pie_channel(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr));
#endif
}
@@ -4190,14 +4190,14 @@ int rtw_p2p_check_frames(_adapter *padapter, const u8 *buf, u32 len, u8 tx)
#if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_CFG80211_ONECHANNEL_UNDER_CONCURRENT)
if (rtw_mi_check_status(padapter, MI_LINKED) && padapter->registrypriv.full_ch_in_p2p_handshake == 0) {
#if defined(CONFIG_P2P_INVITE_IOT)
if (op_ch != -1 && rtw_chk_p2pie_op_ch_with_buddy(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr)) == _FALSE) {
if (op_ch != -1 && rtw_chk_p2pie_op_ch_with_buddy(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr)) == _FALSE) {
RTW_INFO(FUNC_ADPT_FMT" op_ch:%u has no intersect with buddy\n", FUNC_ADPT_ARG(padapter), op_ch);
rtw_change_p2pie_ch_list(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr), 0);
rtw_change_p2pie_ch_list(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr), 0);
} else
#endif
if (rtw_chk_p2pie_ch_list_with_buddy(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr)) == _FALSE) {
if (rtw_chk_p2pie_ch_list_with_buddy(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr)) == _FALSE) {
RTW_INFO(FUNC_ADPT_FMT" ch_list has no intersect with buddy\n", FUNC_ADPT_ARG(padapter));
rtw_change_p2pie_ch_list(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr), 0);
rtw_change_p2pie_ch_list(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr), 0);
}
}
#endif
@@ -4211,7 +4211,7 @@ int rtw_p2p_check_frames(_adapter *padapter, const u8 *buf, u32 len, u8 tx)
if (tx) {
#if defined(CONFIG_CONCURRENT_MODE) && defined(CONFIG_CFG80211_ONECHANNEL_UNDER_CONCURRENT)
if (rtw_mi_check_status(padapter, MI_LINKED) && padapter->registrypriv.full_ch_in_p2p_handshake == 0)
rtw_cfg80211_adjust_p2pie_channel(padapter, frame_body, len - sizeof(struct rtw_ieee80211_hdr_3addr));
rtw_cfg80211_adjust_p2pie_channel(padapter, frame_body, len - sizeof(struct ieee80211_hdr_3addr));
#endif
}
@@ -4261,7 +4261,7 @@ int rtw_p2p_check_frames(_adapter *padapter, const u8 *buf, u32 len, u8 tx)
RTW_INFO("RTW_%s:P2P_DEVDISC_RESP, dialogToken=%d, status:%d\n", (tx == _TRUE) ? "Tx" : "Rx", dialogToken, cont ? *cont : -1);
break;
case P2P_PROVISION_DISC_REQ: {
size_t frame_body_len = len - sizeof(struct rtw_ieee80211_hdr_3addr);
size_t frame_body_len = len - sizeof(struct ieee80211_hdr_3addr);
u8 *p2p_ie;
uint p2p_ielen = 0;
uint contentlen = 0;