mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Update RTL8811CU driver to latest source patch driver for 5.17+ kernel (#3586)
This commit is contained in:
@@ -426,7 +426,7 @@ compilation_prepare()
|
||||
if linux-version compare "${version}" ge 3.14 && [ "$EXTRAWIFI" == yes ]; then
|
||||
|
||||
# attach to specifics tag or branch
|
||||
local rtl8811cuver="commit:2bebdb9a35c1d9b6e6a928e371fa39d5fcec8a62"
|
||||
local rtl8811cuver="commit:ef3ff12118a75ea9ca1db8f4806bb0861e4fffef"
|
||||
|
||||
display_alert "Adding" "Wireless drivers for Realtek RTL8811CU and RTL8821C chipsets ${rtl8811cuver}" "info"
|
||||
|
||||
@@ -459,12 +459,8 @@ compilation_prepare()
|
||||
sed -i '/source "drivers\/net\/wireless\/ti\/Kconfig"/a source "drivers\/net\/wireless\/rtl8811cu\/Kconfig"' \
|
||||
"$kerneldir/drivers/net/wireless/Kconfig"
|
||||
|
||||
# add support for K5.11+
|
||||
process_patch_file "${SRC}/patch/misc/wireless-rtl8811cu.patch" "applying"
|
||||
|
||||
# add support for K5.12+
|
||||
process_patch_file "${SRC}/patch/misc/wireless-realtek-8811cu-5.12.patch" "applying"
|
||||
process_patch_file "${SRC}/patch/misc/wireless-realtek-8811cu-xxx.patch" "applying"
|
||||
# add support for K5.17+
|
||||
process_patch_file "${SRC}/patch/misc/wireless-realtek-8811cu-5.17.patch" "applying"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
From bd349c1b3c436ceb1281ef08968e348b616311fe Mon Sep 17 00:00:00 2001
|
||||
From: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
Date: Sun, 16 May 2021 16:14:18 +0200
|
||||
Subject: [PATCH] wifi1
|
||||
|
||||
Signed-off-by: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
---
|
||||
drivers/net/wireless/rtl8811cu/os_dep/linux/recv_linux.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/rtl8811cu/os_dep/linux/recv_linux.c b/drivers/net/wireless/rtl8811cu/os_dep/linux/recv_linux.c
|
||||
index 7b62215a6..658216070 100755
|
||||
--- a/drivers/net/wireless/rtl8811cu/os_dep/linux/recv_linux.c
|
||||
+++ b/drivers/net/wireless/rtl8811cu/os_dep/linux/recv_linux.c
|
||||
@@ -355,8 +355,12 @@ static int napi_recv(_adapter *padapter, int budget)
|
||||
|
||||
#ifdef CONFIG_RTW_GRO
|
||||
if (pregistrypriv->en_gro) {
|
||||
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0)
|
||||
if (rtw_napi_gro_receive(&padapter->napi, pskb) != GRO_DROP)
|
||||
rx_ok = _TRUE;
|
||||
+#else
|
||||
+ rx_ok = _TRUE;
|
||||
+#endif
|
||||
goto next;
|
||||
}
|
||||
#endif /* CONFIG_RTW_GRO */
|
||||
--
|
||||
Created with Armbian build tools https://github.com/armbian/build
|
||||
|
||||
70
patch/misc/wireless-realtek-8811cu-5.17.patch
Normal file
70
patch/misc/wireless-realtek-8811cu-5.17.patch
Normal file
@@ -0,0 +1,70 @@
|
||||
From 8b6faa20db3bc324824a9e4617c884c28d85ec0b Mon Sep 17 00:00:00 2001
|
||||
From: Butterfly <gokhanlnx@gmail.com>
|
||||
Date: Tue, 22 Mar 2022 16:16:53 +0300
|
||||
Subject: [PATCH] Buildfix for Linux 5.17 (#1)
|
||||
|
||||
Buildfix for Linux 5.17
|
||||
---
|
||||
os_dep/linux/os_intfs.c | 8 ++++++++
|
||||
os_dep/linux/rtw_proc.c | 2 ++
|
||||
os_dep/osdep_service.c | 4 ++++
|
||||
3 files changed, 14 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/wireless/rtl8811cu/os_dep/linux/os_intfs.c b/drivers/net/wireless/rtl8811cu/os_dep/linux/os_intfs.c
|
||||
index 257c581..248d4f7 100644
|
||||
--- a/drivers/net/wireless/rtl8811cu/os_dep/linux/os_intfs.c
|
||||
+++ b/drivers/net/wireless/rtl8811cu/os_dep/linux/os_intfs.c
|
||||
@@ -1216,7 +1216,11 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *addr)
|
||||
}
|
||||
|
||||
_rtw_memcpy(adapter_mac_addr(padapter), sa->sa_data, ETH_ALEN); /* set mac addr to adapter */
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
|
||||
+ eth_hw_addr_set(pnetdev, sa->sa_data);
|
||||
+#else
|
||||
_rtw_memcpy(pnetdev->dev_addr, sa->sa_data, ETH_ALEN); /* set mac addr to net_device */
|
||||
+#endif
|
||||
|
||||
#if 0
|
||||
if (rtw_is_hw_init_completed(padapter)) {
|
||||
@@ -1653,7 +1657,11 @@ int rtw_os_ndev_register(_adapter *adapter, const char *name)
|
||||
/* alloc netdev name */
|
||||
rtw_init_netdev_name(ndev, name);
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
|
||||
+ eth_hw_addr_set(ndev, adapter_mac_addr(adapter));
|
||||
+#else
|
||||
_rtw_memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN);
|
||||
+#endif
|
||||
|
||||
/* Tell the network stack we exist */
|
||||
|
||||
diff --git a/drivers/net/wireless/rtl8811cu/os_dep/linux/rtw_proc.c b/drivers/net/wireless/rtl8811cu/os_dep/linux/rtw_proc.c
|
||||
index 370bd5a..e5e3cd3 100644
|
||||
--- a/drivers/net/wireless/rtl8811cu/os_dep/linux/rtw_proc.c
|
||||
+++ b/drivers/net/wireless/rtl8811cu/os_dep/linux/rtw_proc.c
|
||||
@@ -37,6 +37,8 @@ inline struct proc_dir_entry *get_rtw_drv_proc(void)
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0))
|
||||
#define PDE_DATA(inode) PDE((inode))->data
|
||||
#define proc_get_parent_data(inode) PDE((inode))->parent->data
|
||||
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
|
||||
+#define PDE_DATA(inode) pde_data(inode)
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
|
||||
diff --git a/drivers/net/wireless/rtl8811cu/os_dep/osdep_service.c b/drivers/net/wireless/rtl8811cu/os_dep/osdep_service.c
|
||||
index fea029e..d4a01c8 100644
|
||||
--- a/drivers/net/wireless/rtl8811cu/os_dep/osdep_service.c
|
||||
+++ b/drivers/net/wireless/rtl8811cu/os_dep/osdep_service.c
|
||||
@@ -1294,8 +1294,12 @@ u32 _rtw_down_sema(_sema *sema)
|
||||
inline void thread_exit(_completion *comp)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
|
||||
+ kthread_complete_and_exit(comp, 0);
|
||||
+#else
|
||||
complete_and_exit(comp, 0);
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
#ifdef PLATFORM_FREEBSD
|
||||
printf("%s", "RTKTHREAD_exit");
|
||||
@@ -1,62 +0,0 @@
|
||||
diff --git a/drivers/net/wireless/rtl8811cu/include/rtw_security.h b/drivers/net/wireless/rtl8811cu/include/rtw_security.h
|
||||
index ac8432e..5f74fb7 100755
|
||||
--- a/drivers/net/wireless/rtl8811cu/include/rtw_security.h
|
||||
+++ b/drivers/net/wireless/rtl8811cu/include/rtw_security.h
|
||||
@@ -249,7 +249,7 @@ struct security_priv {
|
||||
#define SEC_IS_BIP_KEY_INSTALLED(sec) _FALSE
|
||||
#endif
|
||||
|
||||
-struct sha256_state {
|
||||
+struct rtl_sha256_state {
|
||||
u64 length;
|
||||
u32 state[8], curlen;
|
||||
u8 buf[64];
|
||||
diff --git a/drivers/net/wireless/rtl8811cu/core/rtw_security.c b/drivers/net/wireless/rtl8811cu/core/rtw_security.c
|
||||
index b537a26..f8c42f4 100755
|
||||
--- a/drivers/net/wireless/rtl8811cu/core/rtw_security.c
|
||||
+++ b/drivers/net/wireless/rtl8811cu/core/rtw_security.c
|
||||
@@ -2133,7 +2133,7 @@ BIP_exit:
|
||||
#ifndef PLATFORM_FREEBSD
|
||||
#if defined(CONFIG_TDLS)
|
||||
/* compress 512-bits */
|
||||
-static int sha256_compress(struct sha256_state *md, unsigned char *buf)
|
||||
+static int sha256_compress(struct rtl_sha256_state *md, unsigned char *buf)
|
||||
{
|
||||
u32 S[8], W[64], t0, t1;
|
||||
u32 t;
|
||||
@@ -2181,7 +2181,7 @@ static int sha256_compress(struct sha256_state *md, unsigned char *buf)
|
||||
}
|
||||
|
||||
/* Initialize the hash state */
|
||||
-static void sha256_init(struct sha256_state *md)
|
||||
+static void sha256_init(struct rtl_sha256_state *md)
|
||||
{
|
||||
md->curlen = 0;
|
||||
md->length = 0;
|
||||
@@ -2202,7 +2202,7 @@ static void sha256_init(struct sha256_state *md)
|
||||
@param inlen The length of the data (octets)
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
-static int sha256_process(struct sha256_state *md, unsigned char *in,
|
||||
+static int sha256_process(struct rtl_sha256_state *md, unsigned char *in,
|
||||
unsigned long inlen)
|
||||
{
|
||||
unsigned long n;
|
||||
@@ -2243,7 +2243,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in,
|
||||
@param out [out] The destination of the hash (32 bytes)
|
||||
@return CRYPT_OK if successful
|
||||
*/
|
||||
-static int sha256_done(struct sha256_state *md, unsigned char *out)
|
||||
+static int sha256_done(struct rtl_sha256_state *md, unsigned char *out)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -2293,7 +2293,7 @@ static int sha256_done(struct sha256_state *md, unsigned char *out)
|
||||
static int sha256_vector(size_t num_elem, u8 *addr[], size_t *len,
|
||||
u8 *mac)
|
||||
{
|
||||
- struct sha256_state ctx;
|
||||
+ struct rtl_sha256_state ctx;
|
||||
size_t i;
|
||||
|
||||
sha256_init(&ctx);
|
||||
@@ -1,154 +0,0 @@
|
||||
From 79b1aa78b51060fb21f12ee3057ded88c8610315 Mon Sep 17 00:00:00 2001
|
||||
From: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
Date: Mon, 15 Feb 2021 15:24:19 +0100
|
||||
Subject: [PATCH] wifiiii
|
||||
|
||||
Signed-off-by: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
---
|
||||
.../rtl8811cu/os_dep/linux/ioctl_cfg80211.c | 24 ++++++++-----------
|
||||
.../wireless/rtl8811cu/os_dep/osdep_service.c | 22 +++++++++++++----
|
||||
2 files changed, 28 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/wireless/rtl8811cu/os_dep/linux/ioctl_cfg80211.c b/drivers/net/wireless/rtl8811cu/os_dep/linux/ioctl_cfg80211.c
|
||||
index c0df148f5..579bbca73 100755
|
||||
--- a/drivers/net/wireless/rtl8811cu/os_dep/linux/ioctl_cfg80211.c
|
||||
+++ b/drivers/net/wireless/rtl8811cu/os_dep/linux/ioctl_cfg80211.c
|
||||
@@ -7143,6 +7143,11 @@ static int cfg80211_rtw_mgmt_tx(struct wiphy *wiphy,
|
||||
return ret;
|
||||
}
|
||||
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
|
||||
+static void cfg80211_rtw_update_mgmt_frame_register(struct wiphy *wiphy,
|
||||
+ struct wireless_dev *wdev,
|
||||
+ struct mgmt_frame_regs *upd)
|
||||
+#else
|
||||
static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
struct wireless_dev *wdev,
|
||||
@@ -7150,6 +7155,7 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
|
||||
struct net_device *ndev,
|
||||
#endif
|
||||
u16 frame_type, bool reg)
|
||||
+#endif
|
||||
{
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
|
||||
struct net_device *ndev = wdev_to_ndev(wdev);
|
||||
@@ -7169,20 +7175,6 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
|
||||
frame_type, reg);
|
||||
#endif
|
||||
|
||||
- /* Wait QC Verify */
|
||||
- return;
|
||||
-
|
||||
- switch (frame_type) {
|
||||
- case IEEE80211_STYPE_PROBE_REQ: /* 0x0040 */
|
||||
- SET_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_PROBE_REQ, reg);
|
||||
- break;
|
||||
- case IEEE80211_STYPE_ACTION: /* 0x00D0 */
|
||||
- SET_CFG80211_REPORT_MGMT(pwdev_priv, IEEE80211_STYPE_ACTION, reg);
|
||||
- break;
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
@@ -9457,7 +9449,11 @@ static struct cfg80211_ops rtw_cfg80211_ops = {
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
.mgmt_tx = cfg80211_rtw_mgmt_tx,
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
|
||||
+ .update_mgmt_frame_registrations = cfg80211_rtw_update_mgmt_frame_register,
|
||||
+#else
|
||||
.mgmt_frame_register = cfg80211_rtw_mgmt_frame_register,
|
||||
+#endif
|
||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) && LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35))
|
||||
.action = cfg80211_rtw_mgmt_tx,
|
||||
#endif
|
||||
diff --git a/drivers/net/wireless/rtl8811cu/os_dep/osdep_service.c b/drivers/net/wireless/rtl8811cu/os_dep/osdep_service.c
|
||||
index c27d3b0ad..c7dd6a6d7 100755
|
||||
--- a/drivers/net/wireless/rtl8811cu/os_dep/osdep_service.c
|
||||
+++ b/drivers/net/wireless/rtl8811cu/os_dep/osdep_service.c
|
||||
@@ -2193,15 +2193,18 @@ static int isFileReadable(const char *path, u32 *sz)
|
||||
{
|
||||
struct file *fp;
|
||||
int ret = 0;
|
||||
+#ifdef set_fs
|
||||
mm_segment_t oldfs;
|
||||
+#endif
|
||||
char buf;
|
||||
|
||||
fp = filp_open(path, O_RDONLY, 0);
|
||||
if (IS_ERR(fp))
|
||||
ret = PTR_ERR(fp);
|
||||
else {
|
||||
+#ifdef set_fs
|
||||
oldfs = get_fs();
|
||||
-
|
||||
+#endif
|
||||
if (1 != readFile(fp, &buf, 1))
|
||||
ret = PTR_ERR(fp);
|
||||
|
||||
@@ -2212,8 +2215,9 @@ static int isFileReadable(const char *path, u32 *sz)
|
||||
*sz = i_size_read(fp->f_dentry->d_inode);
|
||||
#endif
|
||||
}
|
||||
-
|
||||
+#ifdef set_fs
|
||||
set_fs(oldfs);
|
||||
+#endif
|
||||
filp_close(fp, NULL);
|
||||
}
|
||||
return ret;
|
||||
@@ -2229,17 +2233,22 @@ static int isFileReadable(const char *path, u32 *sz)
|
||||
static int retriveFromFile(const char *path, u8 *buf, u32 sz)
|
||||
{
|
||||
int ret = -1;
|
||||
+#ifdef set_fs
|
||||
mm_segment_t oldfs;
|
||||
+#endif
|
||||
struct file *fp;
|
||||
|
||||
if (path && buf) {
|
||||
ret = openFile(&fp, path, O_RDONLY, 0);
|
||||
if (0 == ret) {
|
||||
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
|
||||
-
|
||||
+#ifdef set_fs
|
||||
oldfs = get_fs();
|
||||
ret = readFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
+#else
|
||||
+ ret = readFile(fp, buf, sz);
|
||||
+#endif
|
||||
closeFile(fp);
|
||||
|
||||
RTW_INFO("%s readFile, ret:%d\n", __FUNCTION__, ret);
|
||||
@@ -2263,17 +2272,22 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
|
||||
static int storeToFile(const char *path, u8 *buf, u32 sz)
|
||||
{
|
||||
int ret = 0;
|
||||
+#ifdef set_fs
|
||||
mm_segment_t oldfs;
|
||||
+#endif
|
||||
struct file *fp;
|
||||
|
||||
if (path && buf) {
|
||||
ret = openFile(&fp, path, O_CREAT | O_WRONLY, 0666);
|
||||
if (0 == ret) {
|
||||
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
|
||||
-
|
||||
+#ifdef set_fs
|
||||
oldfs = get_fs();
|
||||
ret = writeFile(fp, buf, sz);
|
||||
set_fs(oldfs);
|
||||
+#else
|
||||
+ ret = writeFile(fp, buf, sz);
|
||||
+#endif
|
||||
closeFile(fp);
|
||||
|
||||
RTW_INFO("%s writeFile, ret:%d\n", __FUNCTION__, ret);
|
||||
--
|
||||
Created with Armbian build tools https://github.com/armbian/build
|
||||
|
||||
Reference in New Issue
Block a user