use common ieee80211 constants

Many defined constants in wifi.h are unused and/or available from
<linux/ieee80211.h>, some with slightly different names. Remove
the constants from wifi.h and use the common ones. Rename where
necessary.

Link: https://lore.kernel.org/r/20210814165518.8672-1-straube.linux@gmail.com
This commit is contained in:
Michael Straube 2021-08-14 18:55:18 +02:00 committed by Carlos Garcés
parent 22a000acb9
commit c1f70ba056
6 changed files with 21 additions and 72 deletions

View File

@ -1089,10 +1089,10 @@ void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta)
/* check if sta supports rx ampdu */
phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable;
phtpriv_sta->rx_ampdu_min_spacing = (phtpriv_sta->ht_cap.ampdu_params_info & IEEE80211_HT_CAP_AMPDU_DENSITY) >> 2;
phtpriv_sta->rx_ampdu_min_spacing = (phtpriv_sta->ht_cap.ampdu_params_info & IEEE80211_HT_AMPDU_PARM_DENSITY) >> 2;
/* bwmode */
if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH))
if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40))
psta->cmn.bw_mode = CHANNEL_WIDTH_40;
else
psta->cmn.bw_mode = CHANNEL_WIDTH_20;
@ -2271,20 +2271,20 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len)
pht_cap->cap_info &= ~(IEEE80211_HT_CAP_TX_STBC);
if (!TEST_FLAG(pmlmepriv->htpriv.stbc_cap, STBC_HT_ENABLE_RX))
pht_cap->cap_info &= ~(IEEE80211_HT_CAP_RX_STBC_3R);
pht_cap->cap_info &= ~(IEEE80211_HT_CAP_RX_STBC);
/* Update A-MPDU Parameters field */
pht_cap->ampdu_params_info &= ~(IEEE80211_HT_CAP_AMPDU_FACTOR | IEEE80211_HT_CAP_AMPDU_DENSITY);
pht_cap->ampdu_params_info &= ~(IEEE80211_HT_AMPDU_PARM_FACTOR | IEEE80211_HT_AMPDU_PARM_DENSITY);
if ((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) ||
(psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP)) {
rtw_hal_get_def_var(padapter, HW_VAR_BEST_AMPDU_DENSITY, &best_ampdu_density);
pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY & (best_ampdu_density << 2));
pht_cap->ampdu_params_info |= (IEEE80211_HT_AMPDU_PARM_DENSITY & (best_ampdu_density << 2));
} else
pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00);
pht_cap->ampdu_params_info |= (IEEE80211_HT_AMPDU_PARM_DENSITY & 0x00);
rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor);
pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_FACTOR & max_rx_ampdu_factor); /* set Max Rx AMPDU size to 64K */
pht_cap->ampdu_params_info |= (IEEE80211_HT_AMPDU_PARM_FACTOR & max_rx_ampdu_factor); /* set Max Rx AMPDU size to 64K */
_rtw_memcpy(&(pmlmeinfo->HT_caps), pht_cap, sizeof(struct HT_caps_element));
@ -3482,7 +3482,7 @@ int rtw_ht_operation_update(_adapter *padapter)
if (pmlmepriv->num_sta_no_ht /*||
(pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT)*/)
new_op_mode = OP_MODE_MIXED;
else if ((phtpriv_ap->ht_cap.cap_info & IEEE80211_HT_CAP_SUP_WIDTH)
else if ((phtpriv_ap->ht_cap.cap_info & IEEE80211_HT_CAP_SUP_WIDTH_20_40)
&& pmlmepriv->num_sta_ht_20mhz)
new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED;
else if (atomic_read(&pmlmepriv->olbc_ht))
@ -3671,7 +3671,7 @@ void bss_cap_update_on_sta_join(_adapter *padapter, struct sta_info *psta)
pmlmepriv->num_sta_ht_no_gf);
}
if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH) == 0) {
if ((ht_capab & IEEE80211_HT_CAP_SUP_WIDTH_20_40) == 0) {
if (!psta->ht_20mhz_set) {
psta->ht_20mhz_set = 1;
pmlmepriv->num_sta_ht_20mhz++;
@ -3682,7 +3682,7 @@ void bss_cap_update_on_sta_join(_adapter *padapter, struct sta_info *psta)
pmlmepriv->num_sta_ht_20mhz);
}
if (((ht_capab & RTW_IEEE80211_HT_CAP_40MHZ_INTOLERANT) != 0) &&
if (((ht_capab & IEEE80211_HT_CAP_40MHZ_INTOLERANT) != 0) &&
(psta->ht_40mhz_intolerant == 0)) {
psta->ht_40mhz_intolerant = 1;
pmlmepriv->num_sta_40mhz_intolerant++;

View File

@ -4704,7 +4704,7 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
}
if (oper_bw == CHANNEL_WIDTH_40) {
ht_capie.cap_info |= IEEE80211_HT_CAP_SUP_WIDTH;
ht_capie.cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
if (phtpriv->sgi_40m)
ht_capie.cap_info |= IEEE80211_HT_CAP_SGI_40;
}
@ -4786,7 +4786,7 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
#if defined(CONFIG_RTL8188E) && defined(CONFIG_SDIO_HCI)
ht_capie.ampdu_params_info = 2;
#else
ht_capie.ampdu_params_info = (IEEE80211_HT_CAP_AMPDU_FACTOR&0x03);
ht_capie.ampdu_params_info = (IEEE80211_HT_AMPDU_PARM_FACTOR&0x03);
#endif
*/
@ -4808,10 +4808,10 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui
*/
rtw_hal_get_def_var(padapter, HW_VAR_BEST_AMPDU_DENSITY, &best_ampdu_density);
ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY & (best_ampdu_density << 2));
ht_capie.ampdu_params_info |= (IEEE80211_HT_AMPDU_PARM_DENSITY & (best_ampdu_density << 2));
} else
ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00);
ht_capie.ampdu_params_info |= (IEEE80211_HT_AMPDU_PARM_DENSITY & 0x00);
}
#ifdef CONFIG_BEAMFORMING
ht_capie.tx_BF_cap_info = 0;
@ -4906,7 +4906,7 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel)
p = rtw_get_ie(pie + sizeof(NDIS_802_11_FIXED_IEs), _HT_CAPABILITY_IE_, &len, ie_len - sizeof(NDIS_802_11_FIXED_IEs));
if (p && len > 0) {
pht_capie = (struct rtw_ieee80211_ht_cap *)(p + 2);
max_ampdu_sz = (pht_capie->ampdu_params_info & IEEE80211_HT_CAP_AMPDU_FACTOR);
max_ampdu_sz = (pht_capie->ampdu_params_info & IEEE80211_HT_AMPDU_PARM_FACTOR);
max_ampdu_sz = 1 << (max_ampdu_sz + 3); /* max_ampdu_sz (kbytes); */
/* RTW_INFO("rtw_update_ht_cap(): max_ampdu_sz=%d\n", max_ampdu_sz); */

View File

@ -10147,8 +10147,8 @@ static int issue_action_ba(_adapter *padapter, unsigned char *raddr, unsigned ch
BA_para_set &= ~IEEE80211_ADDBA_PARAM_TID_MASK;
BA_para_set |= (tid << 2) & IEEE80211_ADDBA_PARAM_TID_MASK;
BA_para_set &= ~RTW_IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK;
BA_para_set |= (size << 6) & RTW_IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK;
BA_para_set &= ~IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK ;
BA_para_set |= (size << 6) & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK ;
if (!padapter->registrypriv.wifi_spec) {
if (pregpriv->rx_ampdu_amsdu == 0) /* disabled */
@ -12176,7 +12176,7 @@ void update_sta_info(_adapter *padapter, struct sta_info *psta)
psta->htpriv.ampdu_enable = pmlmepriv->htpriv.ampdu_enable;
psta->htpriv.rx_ampdu_min_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & IEEE80211_HT_CAP_AMPDU_DENSITY) >> 2;
psta->htpriv.rx_ampdu_min_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & IEEE80211_HT_AMPDU_PARM_DENSITY) >> 2;
if (support_short_GI(padapter, &(pmlmeinfo->HT_caps), CHANNEL_WIDTH_20))
psta->htpriv.sgi_20m = _TRUE;

View File

@ -474,7 +474,7 @@ void rtw_tdls_process_ht_cap(_adapter *padapter, struct sta_info *ptdls_sta, u8
ptdls_sta->htpriv.sgi_40m = _TRUE;
/* Bwmode would still followed AP's setting */
if (ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) {
if (ptdls_sta->htpriv.ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40)) {
if (padapter->mlmeextpriv.cur_bwmode >= CHANNEL_WIDTH_40)
ptdls_sta->cmn.bw_mode = CHANNEL_WIDTH_40;
ptdls_sta->htpriv.ch_offset = padapter->mlmeextpriv.cur_ch_offset;

View File

@ -796,11 +796,6 @@ struct rtw_ieee80211_bar {
} __attribute__((packed));
#endif
/* 802.11 BAR control masks */
#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
#if defined(PLATFORM_LINUX) || defined(CONFIG_RTL8712FW) || defined(PLATFORM_FREEBSD)
@ -974,53 +969,7 @@ typedef enum _HT_CAP_AMPDU_DENSITY {
} HT_CAP_AMPDU_DENSITY;
/* 802.11n HT capabilities masks */
#define IEEE80211_HT_CAP_LDPC_CODING 0x0001
#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
#define IEEE80211_HT_CAP_SM_PS 0x000C
#define IEEE80211_HT_CAP_GRN_FLD 0x0010
#define IEEE80211_HT_CAP_SGI_20 0x0020
#define IEEE80211_HT_CAP_SGI_40 0x0040
#define IEEE80211_HT_CAP_TX_STBC 0x0080
#define IEEE80211_HT_CAP_RX_STBC_1R 0x0100
#define IEEE80211_HT_CAP_RX_STBC_2R 0x0200
#define IEEE80211_HT_CAP_RX_STBC_3R 0x0300
#define IEEE80211_HT_CAP_DELAY_BA 0x0400
#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
#define RTW_IEEE80211_HT_CAP_40MHZ_INTOLERANT ((u16) BIT(14))
/* 802.11n HT capability AMPDU settings */
#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
/* 802.11n HT capability MSC set */
#define IEEE80211_SUPP_MCS_SET_UEQM 4
#define IEEE80211_HT_CAP_MAX_STREAMS 4
#define IEEE80211_SUPP_MCS_SET_LEN 10
/* maximum streams the spec allows */
#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01
#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02
#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C
#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10
/* 802.11n HT capability TXBF capability */
#define IEEE80211_HT_CAP_TXBF_RX_NDP 0x00000008
#define IEEE80211_HT_CAP_TXBF_TX_NDP 0x00000010
#define IEEE80211_HT_CAP_TXBF_EXPLICIT_COMP_STEERING_CAP 0x00000400
/* 802.11n HT IE masks */
#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00
#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01
#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03
#define IEEE80211_HT_IE_CHA_WIDTH 0x04
#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
/* block-ack parameters */
#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
#define RTW_IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0
#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
/*
* A-PMDU buffer sizes

View File

@ -463,7 +463,7 @@ static inline char *iwe_stream_rate_process(_adapter *padapter,
ht_cap = _TRUE;
pht_capie = (struct rtw_ieee80211_ht_cap *)(p + 2);
_rtw_memcpy(&mcs_rate , pht_capie->supp_mcs_set, 2);
bw_40MHz = (pht_capie->cap_info & IEEE80211_HT_CAP_SUP_WIDTH) ? 1 : 0;
bw_40MHz = (pht_capie->cap_info & IEEE80211_HT_CAP_SUP_WIDTH_20_40) ? 1 : 0;
short_GI = (pht_capie->cap_info & (IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40)) ? 1 : 0;
}
}