From ab44eb808ed5e59fb80deace6e6ce2e49e5315e8 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Sun, 22 Oct 2017 22:56:29 +0200 Subject: [PATCH 1/3] Added VHT capabilities and HT Greenfield capab --- include/wifi.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/include/wifi.h b/include/wifi.h index 504dce9..091cd4f 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -990,6 +990,42 @@ typedef enum _HT_CAP_AMPDU_DENSITY { #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 +/* 802.11ac VHT Capabilities */ +#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 +#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 +#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 +#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004 +#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008 +#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK 0x0000000C +#define IEEE80211_VHT_CAP_RXLDPC 0x00000010 +#define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020 +#define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040 +#define IEEE80211_VHT_CAP_TXSTBC 0x00000080 +#define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100 +#define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200 +#define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300 +#define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400 +#define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 +#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 +#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 +#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 +#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK \ + (7 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT) +#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 +#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK \ + (7 << IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) +#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 +#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 +#define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000 +#define IEEE80211_VHT_CAP_HTC_VHT 0x00400000 +#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23 +#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ + (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT) +#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB 0x08000000 +#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000 +#define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 +#define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 + /* block-ack parameters */ #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C From 8c60bf3c7770dbec1975177e73f394420e2ef368 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Sun, 22 Oct 2017 23:00:28 +0200 Subject: [PATCH 2/3] Added VHT capabilities and HT Greenfield capab * Added VHT capabilities and HT Greenfield capability --- os_dep/linux/ioctl_cfg80211.c | 88 ++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index b6881d3..83891e1 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -6119,7 +6119,13 @@ static void rtw_cfg80211_init_ht_capab(_adapter *padapter, struct ieee80211_sta_ 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); @@ -6320,6 +6326,86 @@ static void rtw_cfg80211_create_vht_cap(_adapter *padapter, struct ieee80211_sta #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; From 6cd132687800cc6ec531daf68f89ba9b40b5bc07 Mon Sep 17 00:00:00 2001 From: Christian kimocoder Date: Sun, 22 Oct 2017 23:09:32 +0200 Subject: [PATCH 3/3] Removed some spaces * Removed some spaces --- os_dep/linux/mlme_linux.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/os_dep/linux/mlme_linux.c b/os_dep/linux/mlme_linux.c index b2b85cb..daaa815 100644 --- a/os_dep/linux/mlme_linux.c +++ b/os_dep/linux/mlme_linux.c @@ -18,20 +18,16 @@ * ******************************************************************************/ - #define _MLME_OSDEP_C_ #include - #ifdef RTK_DMP_PLATFORM void Linkup_workitem_callback(struct work_struct *work) { struct mlme_priv *pmlmepriv = container_of(work, struct mlme_priv, Linkup_workitem); _adapter *padapter = container_of(pmlmepriv, _adapter, mlmepriv); - - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 12)) kobject_uevent(&padapter->pnetdev->dev.kobj, KOBJ_LINKUP); #else @@ -45,8 +41,6 @@ void Linkdown_workitem_callback(struct work_struct *work) struct mlme_priv *pmlmepriv = container_of(work, struct mlme_priv, Linkdown_workitem); _adapter *padapter = container_of(pmlmepriv, _adapter, mlmepriv); - - #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 12)) kobject_uevent(&padapter->pnetdev->dev.kobj, KOBJ_LINKDOWN); #else @@ -56,7 +50,6 @@ void Linkdown_workitem_callback(struct work_struct *work) } #endif - /* void sitesurvey_ctrl_handler(void *FunctionContext) { @@ -74,14 +67,12 @@ void rtw_join_timeout_handler(void *FunctionContext) _rtw_join_timeout_handler(adapter); } - void _rtw_scan_timeout_handler(void *FunctionContext) { _adapter *adapter = (_adapter *)FunctionContext; rtw_scan_timeout_handler(adapter); } - void _dynamic_check_timer_handlder(void *FunctionContext) { struct dvobj_priv *pdvobj = (struct dvobj_priv *)FunctionContext; @@ -108,7 +99,6 @@ void _rtw_set_scan_deny_timer_hdl(void *FunctionContext) } #endif - void rtw_init_mlme_timer(_adapter *padapter) { struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -157,7 +147,6 @@ void rtw_os_indicate_connect(_adapter *adapter) _set_workitem(&adapter->mlmepriv.Linkup_workitem); #endif - } extern void indicate_wx_scan_complete_event(_adapter *padapter); @@ -237,7 +226,6 @@ void rtw_os_indicate_disconnect(_adapter *adapter, u16 reason, u8 locally_gener { /* RT_PMKID_LIST backupPMKIDList[NUM_PMKID_CACHE]; */ - netif_carrier_off(adapter->pnetdev); /* Do it first for tx broadcast pkt after disconnection issue! */ #ifdef CONFIG_IOCTL_CFG80211 @@ -252,7 +240,6 @@ void rtw_os_indicate_disconnect(_adapter *adapter, u16 reason, u8 locally_gener /* modify for CONFIG_IEEE80211W, none 11w also can use the same command */ rtw_reset_securitypriv_cmd(adapter); - } void rtw_report_sec_ie(_adapter *adapter, u8 authmode, u8 *sec_ie) @@ -261,8 +248,6 @@ void rtw_report_sec_ie(_adapter *adapter, u8 authmode, u8 *sec_ie) u8 *buff, *p, i; union iwreq_data wrqu; - - buff = NULL; if (authmode == _WPA_IE_ID_) { @@ -297,7 +282,6 @@ void rtw_report_sec_ie(_adapter *adapter, u8 authmode, u8 *sec_ie) rtw_mfree(buff, IW_CUSTOM_MAX); } - } void _survey_timer_hdl(void *FunctionContext) @@ -384,7 +368,6 @@ void rtw_indicate_sta_assoc_event(_adapter *padapter, struct sta_info *psta) if (pstapriv->sta_aid[psta->aid - 1] != psta) return; - wrqu.addr.sa_family = ARPHRD_ETHER; _rtw_memcpy(wrqu.addr.sa_data, psta->hwaddr, ETH_ALEN); @@ -411,7 +394,6 @@ void rtw_indicate_sta_disassoc_event(_adapter *padapter, struct sta_info *psta) if (pstapriv->sta_aid[psta->aid - 1] != psta) return; - wrqu.addr.sa_family = ARPHRD_ETHER; _rtw_memcpy(wrqu.addr.sa_data, psta->hwaddr, ETH_ALEN); @@ -424,7 +406,6 @@ void rtw_indicate_sta_disassoc_event(_adapter *padapter, struct sta_info *psta) } - #ifdef CONFIG_HOSTAPD_MLME static int mgnt_xmit_entry(struct sk_buff *skb, struct net_device *pnetdev) @@ -443,7 +424,6 @@ static int mgnt_netdev_open(struct net_device *pnetdev) RTW_INFO("mgnt_netdev_open: MAC Address:" MAC_FMT "\n", MAC_ARG(pnetdev->dev_addr)); - init_usb_anchor(&phostapdpriv->anchored); rtw_netif_wake_queue(pnetdev); @@ -536,15 +516,11 @@ int hostapd_mode_init(_adapter *padapter) pnetdev->features |= NETIF_F_IP_CSUM; #endif - - if (dev_alloc_name(pnetdev, "mgnt.wlan%d") < 0) RTW_INFO("hostapd_mode_init(): dev_alloc_name, fail!\n"); - /* SET_NETDEV_DEV(pnetdev, pintfpriv->udev); */ - mac[0] = 0x00; mac[1] = 0xe0; mac[2] = 0x4c; @@ -554,10 +530,8 @@ int hostapd_mode_init(_adapter *padapter) _rtw_memcpy(pnetdev->dev_addr, mac, ETH_ALEN); - netif_carrier_off(pnetdev); - /* Tell the network stack we exist */ if (register_netdev(pnetdev) != 0) { RTW_INFO("hostapd_mode_init(): register_netdev fail!\n");