From 3873db1e101a9c2164d6ee76e0ccfeee89dc0df1 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Mon, 27 Aug 2018 20:05:18 +0200 Subject: [PATCH] Added HT Greenfield capabilities --- dkms.conf | 2 +- os_dep/linux/ioctl_cfg80211.c | 77 ++++++++++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/dkms.conf b/dkms.conf index c23a887..ab54802 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="realtek-rtl88xxau" -PACKAGE_VERSION="5.2.20.2~20180825" +PACKAGE_VERSION="5.2.20.2~20180827" CLEAN="'make' clean" BUILT_MODULE_NAME[0]=88XXau PROCS_NUM=`nproc` diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 3f1ddaf..8dc055d 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -8798,7 +8798,13 @@ static void rtw_cfg80211_init_ht_capab(_adapter *padapter ht_cap->ht_supported = _TRUE; - ht_cap->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | + /* According to the comment in rtw_ap.c: + * "Note: currently we switch to the MIXED op mode if HT non-greenfield + * station is associated. Probably it's a theoretical case, since + * it looks like all known HT STAs support greenfield." + * Therefore Greenfield is added to ht_cap + */ + ht_cap->cap = IEEE80211_HT_CAP_SUP_WIDTH_20_40 | IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_40 | IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_DSSSCCK40 | IEEE80211_HT_CAP_MAX_AMSDU; rtw_cfg80211_init_ht_capab_ex(padapter, ht_cap, band, rf_type); @@ -8883,6 +8889,75 @@ void rtw_cfg80211_init_wdev_data(_adapter *padapter) #endif } +static void rtw_cfg80211_init_vht_capab_ex(_adapter *padapter, struct ieee80211_sta_vht_cap *vht_cap, u8 rf_type) +{ +//todo: Support for other bandwidths +/* NSS = Number of Spatial Streams */ +#define MAX_BIT_RATE_80MHZ_NSS3 1300 /* Mbps */ +#define MAX_BIT_RATE_80MHZ_NSS2 867 /* Mbps */ +#define MAX_BIT_RATE_80MHZ_NSS1 434 /* Mbps */ + struct registry_priv *pregistrypriv = &padapter->registrypriv; + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; + struct vht_priv *pvhtpriv = &pmlmepriv->vhtpriv; + rtw_vht_use_default_setting(padapter); + /* RX LDPC */ + if (TEST_FLAG(pvhtpriv->ldpc_cap, LDPC_VHT_ENABLE_RX)) + vht_cap->cap |= IEEE80211_VHT_CAP_RXLDPC; + /* TX STBC */ + if (TEST_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_TX)) + vht_cap->cap |= IEEE80211_VHT_CAP_TXSTBC; + /* RX STBC */ + if (TEST_FLAG(pvhtpriv->stbc_cap, STBC_VHT_ENABLE_RX)) { + switch (rf_type) { + case RF_1T1R: + vht_cap->cap |= IEEE80211_VHT_CAP_RXSTBC_1;/*RX STBC One spatial stream*/ + break; + case RF_2T2R: + case RF_1T2R: + vht_cap->cap |= IEEE80211_VHT_CAP_RXSTBC_2;/*RX STBC Two spatial streams*/ + break; + case RF_3T3R: + case RF_3T4R: + case RF_4T4R: + vht_cap->cap |= IEEE80211_VHT_CAP_RXSTBC_3;/*RX STBC Three spatial streams*/ + break; + default: + /* DBG_871X("[warning] rf_type %d is not expected\n", rf_type); */ + break; + } + } + /* switch (rf_type) { + case RF_1T1R: + vht_cap->vht_mcs.tx_highest = MAX_BIT_RATE_80MHZ_NSS1; + vht_cap->vht_mcs.rx_highest = MAX_BIT_RATE_80MHZ_NSS1; + break; + case RF_2T2R: + case RF_1T2R: + vht_cap->vht_mcs.tx_highest = MAX_BIT_RATE_80MHZ_NSS2; + vht_cap->vht_mcs.rx_highest = MAX_BIT_RATE_80MHZ_NSS2; + break; + case RF_3T3R: + case RF_3T4R: + case RF_4T4R: + vht_cap->vht_mcs.tx_highest = MAX_BIT_RATE_80MHZ_NSS3; + vht_cap->vht_mcs.rx_highest = MAX_BIT_RATE_80MHZ_NSS3; + break; + default: + DBG_871X("[warning] rf_type %d is not expected\n", rf_type); + break; + } */ + /* MCS map */ + vht_cap->vht_mcs.tx_mcs_map = pvhtpriv->vht_mcs_map[0] | (pvhtpriv->vht_mcs_map[1] << 8); + vht_cap->vht_mcs.rx_mcs_map = vht_cap->vht_mcs.tx_mcs_map; + if (rf_type == RF_1T1R) { + vht_cap->vht_mcs.tx_highest = MAX_BIT_RATE_80MHZ_NSS1; + vht_cap->vht_mcs.rx_highest = MAX_BIT_RATE_80MHZ_NSS1; + } + if (pvhtpriv->sgi_80m) + vht_cap->cap |= IEEE80211_VHT_CAP_SHORT_GI_80; + vht_cap->cap |= (pvhtpriv->ampdu_len << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT); +} + void rtw_cfg80211_init_wiphy(_adapter *padapter) { u8 rf_type;