From 8c2fe69b292a67ab5458e5ca62081fdffc106eea Mon Sep 17 00:00:00 2001 From: Christian B Date: Wed, 15 Nov 2017 20:07:10 +0100 Subject: [PATCH 1/9] Minor cleanup to Kernel v4.14 Support --- os_dep/osdep_service.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index 13a5bea..7a3f777 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -1919,12 +1919,10 @@ static int readFile(struct file *fp, char *buf, int len) return -EPERM; while (sum < len) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) rlen = kernel_read(fp, buf + sum, len - sum, &fp->f_pos); -#else +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)) rlen = __vfs_read(fp, buf + sum, len - sum, &fp->f_pos); -#endif #else rlen = fp->f_op->read(fp, buf + sum, len - sum, &fp->f_pos); #endif From ee4f464925b15ca6a52f06d2d89aa83920186c9b Mon Sep 17 00:00:00 2001 From: Christian B Date: Wed, 15 Nov 2017 20:13:02 +0100 Subject: [PATCH 2/9] Minor spacing cleanup --- core/efuse/rtw_efuse.c | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/core/efuse/rtw_efuse.c b/core/efuse/rtw_efuse.c index e3554f8..9dc8930 100644 --- a/core/efuse/rtw_efuse.c +++ b/core/efuse/rtw_efuse.c @@ -336,7 +336,6 @@ u16 rtw_get_efuse_mask_arraylen(PADAPTER pAdapter) return 0; } - #ifdef RTW_HALMAC #include "../../hal/hal_halmac.h" @@ -386,7 +385,6 @@ void EFUSE_GetEfuseDefinition(PADAPTER adapter, u8 efusetype, u8 type, void *out struct dvobj_priv *d; u32 v32 = 0; - d = adapter_to_dvobj(adapter); if (adapter->HalFunc.EFUSEGetEfuseDefinition) { @@ -414,7 +412,6 @@ u8 rtw_efuse_access(PADAPTER adapter, u8 write, u16 addr, u16 cnts, u8 *data) u32 size, i; int err; - d = adapter_to_dvobj(adapter); err = rtw_halmac_get_physical_efuse_size(d, &size); if (err) @@ -715,7 +712,6 @@ VOID hal_ReadEFuse_BT_logic_map( u16 i, total, used; u8 efuse_usage; - /* */ /* Do NOT excess total size of EFuse table. Added by Roger, 2008.11.10. */ /* */ @@ -830,7 +826,6 @@ exit: rtw_mfree(efuseTbl, EFUSE_BT_MAP_LEN); } - static u8 hal_EfusePartialWriteCheck( PADAPTER padapter, u8 efuseType, @@ -873,7 +868,6 @@ static u8 hal_EfusePartialWriteCheck( return bRet; } - static u8 hal_EfusePgPacketWrite2ByteHeader( PADAPTER padapter, u8 efuseType, @@ -940,7 +934,6 @@ static u8 hal_EfusePgPacketWrite2ByteHeader( return _TRUE; } - static u8 hal_EfusePgPacketWrite1ByteHeader( PADAPTER pAdapter, u8 efuseType, @@ -953,7 +946,6 @@ static u8 hal_EfusePgPacketWrite1ByteHeader( u16 efuse_addr = *pAddr; u8 repeatcnt = 0; - /* RTW_INFO("%s\n", __FUNCTION__); */ pg_header = ((pTargetPkt->offset << 4) & 0xf0) | pTargetPkt->word_en; @@ -996,7 +988,6 @@ static u8 hal_EfusePgPacketWriteHeader( return bRet; } - static u8 Hal_EfuseWordEnableDataWrite( PADAPTER padapter, @@ -1010,7 +1001,6 @@ Hal_EfuseWordEnableDataWrite( u8 badworden = 0x0F; u8 tmpdata[PGPKT_DATA_SIZE]; - /* RTW_INFO("%s: efuse_addr=%#x word_en=%#x\n", __FUNCTION__, efuse_addr, word_en); */ _rtw_memset(tmpdata, 0xFF, PGPKT_DATA_SIZE); @@ -1116,7 +1106,6 @@ u8 EfusePgPacketWrite_BT( return _TRUE; } - #else /* !RTW_HALMAC */ /* ------------------------------------------------------------------------------ */ #define REG_EFUSE_CTRL 0x0030 @@ -1469,7 +1458,6 @@ EFUSE_Write1Byte( } } /* EFUSE_Write1Byte */ - /* 11/16/2008 MH Read one byte from real Efuse. */ u8 efuse_OneByteRead( @@ -1555,7 +1543,6 @@ efuse_OneByteWrite( /* -----------------e-fuse reg ctrl --------------------------------- */ /* address */ - efuseValue = rtw_read32(pAdapter, EFUSE_CTRL); efuseValue |= (BIT21 | BIT31); efuseValue &= ~(0x3FFFF); @@ -1627,7 +1614,6 @@ Efuse_PgPacketWrite(IN PADAPTER pAdapter, return ret; } - int Efuse_PgPacketWrite_BT(IN PADAPTER pAdapter, IN u8 offset, @@ -1642,7 +1628,6 @@ Efuse_PgPacketWrite_BT(IN PADAPTER pAdapter, return ret; } - u8 Efuse_WordEnableDataWrite(IN PADAPTER pAdapter, IN u16 efuse_addr, @@ -2087,7 +2072,6 @@ efuse_ShadowRead4Byte( } /* efuse_ShadowRead4Byte */ - /*----------------------------------------------------------------------------- * Function: efuse_ShadowWrite1Byte * efuse_ShadowWrite2Byte @@ -2135,7 +2119,6 @@ efuse_ShadowWrite2Byte( PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter); - pHalData->efuse_eeprom_data[Offset] = Value & 0x00FF; pHalData->efuse_eeprom_data[Offset + 1] = Value >> 8; @@ -2157,7 +2140,6 @@ efuse_ShadowWrite4Byte( } /* efuse_ShadowWrite1Byte */ - /*----------------------------------------------------------------------------- * Function: EFUSE_ShadowRead * @@ -2225,7 +2207,6 @@ EFUSE_ShadowWrite( if (pAdapter->registrypriv.mp_mode == 0) return; - if (Type == 1) efuse_ShadowWrite1Byte(pAdapter, Offset, (u8)Value); else if (Type == 2) @@ -2344,7 +2325,6 @@ void EFUSE_ShadowMapUpdate( u8 *efuse_map = NULL; int err; - mapLen = EEPROM_MAX_SIZE; efuse_map = pHalData->efuse_eeprom_data; /* efuse default content is 0xFF */ From 7356af4990097d38984f1ebfa7bbf8c984477c74 Mon Sep 17 00:00:00 2001 From: Christian B Date: Wed, 15 Nov 2017 20:16:27 +0100 Subject: [PATCH 3/9] Add support for network namespaces --- os_dep/linux/ioctl_cfg80211.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 9af4eff..6e9f658 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -6497,6 +6497,10 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) wiphy->bands[IEEE80211_BAND_5GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_5GHZ); #endif +#if defined(CONFIG_NET_NS) + wiphy->flags |= WIPHY_FLAG_NETNS_OK; +#endif //CONFIG_NET_NS + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) #if defined(CONFIG_NET_NS) wiphy->flags |= WIPHY_FLAG_NETNS_OK; From 3e030bbd59566ebc586b6fdffd61781cea7abe1c Mon Sep 17 00:00:00 2001 From: Christian B Date: Wed, 15 Nov 2017 20:25:19 +0100 Subject: [PATCH 4/9] Added CONFIG_NET_NS Switch * Added CONFIG_NET_NS Switch to Makefile and turned ON (still TESTING purposes) --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 1bf9d4f..0374b2d 100755 --- a/Makefile +++ b/Makefile @@ -48,6 +48,7 @@ CONFIG_PCI_HCI = n CONFIG_SDIO_HCI = n CONFIG_GSPI_HCI = n ########################## Features ########################### +CONFIG_NET_NS = y CONFIG_MP_INCLUDED = y CONFIG_POWER_SAVING = n CONFIG_USB_AUTOSUSPEND = n From c9a0968521ee50c0a4f5e6f44cd4893124f165ed Mon Sep 17 00:00:00 2001 From: Christian B Date: Wed, 15 Nov 2017 20:27:34 +0100 Subject: [PATCH 5/9] Minor spacing cleanup --- os_dep/linux/rtw_radiotap.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/os_dep/linux/rtw_radiotap.c b/os_dep/linux/rtw_radiotap.c index b8df1ae..56cf92f 100644 --- a/os_dep/linux/rtw_radiotap.c +++ b/os_dep/linux/rtw_radiotap.c @@ -183,8 +183,6 @@ static void find_ns(struct ieee80211_radiotap_iterator *iterator, } } - - /** * ieee80211_radiotap_iterator_next - return next radiotap parser iterator arg * @iterator: radiotap_iterator to move to next arg (if any) @@ -366,4 +364,3 @@ int rtw_ieee80211_radiotap_iterator_next( return 0; } } - From 15b5ff9b560dd64b3969f08d2e7330a5cc3159e8 Mon Sep 17 00:00:00 2001 From: Christian B Date: Wed, 15 Nov 2017 20:31:12 +0100 Subject: [PATCH 6/9] 80211W turned ON + more DEBUG * 80211w (security feature) turned ON but will need to be "tested" further. * More debug output enabled, as we see that these drivers will acquire more work in the future. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0374b2d..2017cab 100755 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ EXTRA_CFLAGS += -Wno-unused-parameter EXTRA_CFLAGS += -Wno-unused-function EXTRA_CFLAGS += -Wno-unused EXTRA_CFLAGS += -Wno-date-time -EXTRA_CFLAGS += -Wno-misleading-indentation +#EXTRA_CFLAGS += -Wno-misleading-indentation #EXTRA_CFLAGS += -Wno-uninitialized GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc ) @@ -65,7 +65,7 @@ CONFIG_CALIBRATE_TX_POWER_TO_MAX = y CONFIG_RTW_ADAPTIVITY_EN = disable CONFIG_RTW_ADAPTIVITY_MODE = normal CONFIG_SIGNAL_SCALE_MAPPING = n -CONFIG_80211W = n +CONFIG_80211W = y CONFIG_REDUCE_TX_CPU_LOADING = n CONFIG_BR_EXT = y CONFIG_TDLS = n From 8b41ccda9af35d85b20434466686b79a607bf164 Mon Sep 17 00:00:00 2001 From: Christian B Date: Wed, 15 Nov 2017 20:40:05 +0100 Subject: [PATCH 7/9] Minor fix + spacing --- os_dep/linux/ioctl_cfg80211.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 6e9f658..1c7c1a1 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -77,7 +77,6 @@ #endif /* CONFIG_WAPI_SUPPORT */ - static const u32 rtw_cipher_suites[] = { WLAN_CIPHER_SUITE_WEP40, WLAN_CIPHER_SUITE_WEP104, @@ -196,7 +195,6 @@ static struct ieee80211_channel rtw_5ghz_a_channels[] = { CHAN5G(216, 0), }; - void rtw_2g_channels_init(struct ieee80211_channel *channels) { _rtw_memcpy((void *)channels, (void *)rtw_2ghz_channels, @@ -471,7 +469,6 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net } /* _exit_critical_bh(&pwdev_priv->scan_req_lock, &irqL); */ - channel = pnetwork->network.Configuration.DSConfig; freq = rtw_ch2freq(channel); notify_channel = ieee80211_get_channel(wiphy, freq); @@ -524,7 +521,6 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net _rtw_memcpy(pwlanhdr->addr2, pnetwork->network.MacAddress, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, pnetwork->network.MacAddress, ETH_ALEN); - /* pbuf += sizeof(struct rtw_ieee80211_hdr_3addr); */ len = sizeof(struct rtw_ieee80211_hdr_3addr); _rtw_memcpy((pbuf + len), pnetwork->network.IEs, pnetwork->network.IELength); @@ -754,10 +750,10 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter) } check_bss: - if (!rtw_cfg80211_check_bss(padapter)) + if (!rtw_cfg80211_check_bss(padapter)){ RTW_PRINT(FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter)); - if (rtw_to_roam(padapter) > 0) { + }else if (rtw_to_roam(padapter) > 0) { #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE) struct wiphy *wiphy = pwdev->wiphy; struct ieee80211_channel *notify_channel; @@ -894,7 +890,6 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally } } - #ifdef CONFIG_AP_MODE static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) { From 136fbdef54190739912922d4e3c0892b35b32bcd Mon Sep 17 00:00:00 2001 From: Christian B Date: Wed, 15 Nov 2017 20:45:51 +0100 Subject: [PATCH 8/9] Allow to set channel when in monitor mode * Added support for setting channel when in "monitor" mode. --- os_dep/linux/ioctl_cfg80211.c | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 1c7c1a1..426ea2e 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -4572,6 +4572,42 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy return 0; } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) +static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy, struct cfg80211_chan_def *chandef) +{ + struct ieee80211_channel *chan = (struct ieee80211_channel *) chandef->chan; + int chan_target = (u8) ieee80211_frequency_to_channel(chan->center_freq); + int chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + int chan_width = CHANNEL_WIDTH_20; + enum nl80211_channel_type channel_type = cfg80211_get_chandef_type(chandef); + _adapter *padapter = wiphy_to_adapter(wiphy); + + switch (channel_type) { + case NL80211_CHAN_NO_HT: + case NL80211_CHAN_HT20: + chan_width = CHANNEL_WIDTH_20; + chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + break; + case NL80211_CHAN_HT40MINUS: + chan_width = CHANNEL_WIDTH_40; + chan_offset = HAL_PRIME_CHNL_OFFSET_UPPER; + break; + case NL80211_CHAN_HT40PLUS: + chan_width = CHANNEL_WIDTH_40; + chan_offset = HAL_PRIME_CHNL_OFFSET_LOWER; + break; + default: + chan_width = CHANNEL_WIDTH_20; + chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + break; + } + + set_channel_bwmode(padapter, chan_target, chan_offset, chan_width); + DBG_871X("%s : %d", __func__, chan_target); + return 0; +} +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) */ + static int cfg80211_rtw_auth(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_auth_request *req) { @@ -6595,6 +6631,9 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .change_bss = cfg80211_rtw_change_bss, #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) .set_channel = cfg80211_rtw_set_channel, +#endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) + .set_monitor_channel = cfg80211_rtw_set_monitor_channel, #endif /* .auth = cfg80211_rtw_auth, */ /* .assoc = cfg80211_rtw_assoc, */ From 746c12ab111064668bac0328386d283ea009619c Mon Sep 17 00:00:00 2001 From: Christian B Date: Wed, 15 Nov 2017 21:51:39 +0100 Subject: [PATCH 9/9] Remove test code --- os_dep/linux/ioctl_cfg80211.c | 40 +---------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 426ea2e..20eec9a 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -4572,42 +4572,6 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy return 0; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) -static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy, struct cfg80211_chan_def *chandef) -{ - struct ieee80211_channel *chan = (struct ieee80211_channel *) chandef->chan; - int chan_target = (u8) ieee80211_frequency_to_channel(chan->center_freq); - int chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - int chan_width = CHANNEL_WIDTH_20; - enum nl80211_channel_type channel_type = cfg80211_get_chandef_type(chandef); - _adapter *padapter = wiphy_to_adapter(wiphy); - - switch (channel_type) { - case NL80211_CHAN_NO_HT: - case NL80211_CHAN_HT20: - chan_width = CHANNEL_WIDTH_20; - chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - break; - case NL80211_CHAN_HT40MINUS: - chan_width = CHANNEL_WIDTH_40; - chan_offset = HAL_PRIME_CHNL_OFFSET_UPPER; - break; - case NL80211_CHAN_HT40PLUS: - chan_width = CHANNEL_WIDTH_40; - chan_offset = HAL_PRIME_CHNL_OFFSET_LOWER; - break; - default: - chan_width = CHANNEL_WIDTH_20; - chan_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - break; - } - - set_channel_bwmode(padapter, chan_target, chan_offset, chan_width); - DBG_871X("%s : %d", __func__, chan_target); - return 0; -} -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) */ - static int cfg80211_rtw_auth(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_auth_request *req) { @@ -6632,9 +6596,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = { #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)) .set_channel = cfg80211_rtw_set_channel, #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) - .set_monitor_channel = cfg80211_rtw_set_monitor_channel, -#endif + /* .auth = cfg80211_rtw_auth, */ /* .assoc = cfg80211_rtw_assoc, */ #endif /* CONFIG_AP_MODE */