From 47fbd5a273f417c9975cf382484e1ce75e2c43b2 Mon Sep 17 00:00:00 2001 From: Kamil Lorenc Date: Sun, 26 May 2019 16:21:13 +0200 Subject: [PATCH 1/5] Update defines for A-MPDU Define values for maximum buffer size changed in kernel. Update them --- include/wifi.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/wifi.h b/include/wifi.h index 091cd4f..040a310 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -1038,7 +1038,8 @@ typedef enum _HT_CAP_AMPDU_DENSITY { * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) */ #define IEEE80211_MIN_AMPDU_BUF 0x8 -#define IEEE80211_MAX_AMPDU_BUF 0x40 +#define IEEE80211_MAX_AMPDU_BUF_HT 0x40 +#define IEEE80211_MAX_AMPDU_BUF 0x100 /* Spatial Multiplexing Power Save Modes */ From fdf5acc152c853adb0e8dabbee8a9976f4601c15 Mon Sep 17 00:00:00 2001 From: Kamil Lorenc Date: Sun, 26 May 2019 16:21:44 +0200 Subject: [PATCH 2/5] Replace get_ds with KERNEL_DS get_ds was removed from kernel in version 5.1.0, because it always expanded to KERNEL_DS. It is safe to replace it with KERNEL_DS from at least version 2.6.11 --- os_dep/osdep_service.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index 88a3ff5..0bfb93a 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -1961,7 +1961,7 @@ static int isFileReadable(char *path) ret = PTR_ERR(fp); else { oldfs = get_fs(); - set_fs(get_ds()); + set_fs(KERNEL_DS); if (1 != readFile(fp, &buf, 1)) ret = PTR_ERR(fp); @@ -1991,7 +1991,7 @@ static int retriveFromFile(char *path, u8 *buf, u32 sz) RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp); oldfs = get_fs(); - set_fs(get_ds()); + set_fs(KERNEL_DS); ret = readFile(fp, buf, sz); set_fs(oldfs); closeFile(fp); @@ -2026,7 +2026,7 @@ static int storeToFile(char *path, u8 *buf, u32 sz) RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp); oldfs = get_fs(); - set_fs(get_ds()); + set_fs(KERNEL_DS); ret = writeFile(fp, buf, sz); set_fs(oldfs); closeFile(fp); From 7d1c32cd06c152d31e531784e6fb1d4efedd7863 Mon Sep 17 00:00:00 2001 From: Hansruedi Patzen Date: Wed, 15 May 2019 14:25:00 +0200 Subject: [PATCH 3/5] linux-5.2: disable fallback from rtw_select_queue The fallback parameter has been removed in the latest kernel (>= 5.2) See: https://github.com/torvalds/linux/commit/a350eccee5830d9a1f29e393a88dc05a15326d44 --- os_dep/linux/os_intfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 09c54e5..5f6f8e9 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1058,11 +1058,14 @@ unsigned int rtw_classify8021d(struct sk_buff *skb) return dscp >> 5; } - static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) + #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,19,0)) , void *accel_priv - #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + #else + , struct net_device *sb_dev + #endif + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)) , select_queue_fallback_t fallback #endif #endif From ae733769eacba7ba1576d020811f117187ca6fdc Mon Sep 17 00:00:00 2001 From: Kamil Lorenc Date: Sun, 26 May 2019 16:21:29 +0200 Subject: [PATCH 4/5] Replace get_monotonic_boottime This function is deprecated as of kernel 4.20. It is replaced straight away with ktime_get_boottime_ts64 --- os_dep/linux/ioctl_cfg80211.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index d19eba7..4540822 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -342,7 +342,11 @@ static const struct ieee80211_txrx_stypes static u64 rtw_get_systime_us(void) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)) + struct timespec64 ts; + ktime_get_boottime_ts64(&ts); + return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000; +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) struct timespec ts; get_monotonic_boottime(&ts); return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000; From 903d725f9f8dde5b547d087ce3fe0e09351514b9 Mon Sep 17 00:00:00 2001 From: Kamil Lorenc Date: Sun, 26 May 2019 17:19:12 +0200 Subject: [PATCH 5/5] Do not specify type in access_ok In kernels starting from 5.0.0 it is not possible to specify desired access type --- os_dep/linux/rtw_android.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/os_dep/linux/rtw_android.c b/os_dep/linux/rtw_android.c index 3831b88..d17233d 100644 --- a/os_dep/linux/rtw_android.c +++ b/os_dep/linux/rtw_android.c @@ -630,7 +630,11 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) goto exit; } + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) + if (!access_ok(priv_cmd.buf, priv_cmd.total_len)) { + #else if (!access_ok(VERIFY_READ, priv_cmd.buf, priv_cmd.total_len)) { + #endif RTW_INFO("%s: failed to access memory\n", __FUNCTION__); ret = -EFAULT; goto exit;