rtl8821cu: fix build with mac80211 6.1
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
parent
3ad16a8b69
commit
8565bca9d1
@ -1,10 +1,6 @@
|
||||
# SDPX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
# <https://immortalwrt.org>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# Copyright (C) 2021-2022 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
@ -17,9 +13,8 @@ PKG_SOURCE_DATE:=2022-04-09
|
||||
PKG_SOURCE_VERSION:=8c2226a74ae718439d56248bd2e44ccf717086d5
|
||||
PKG_MIRROR_HASH:=3353a3bc4c73652eceaab95809aab27c3ae8bbf7e915b73488361a061ba91b84
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINTER:=CN_SZTL <cnsztl@immortalwrt.org>
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
@ -37,7 +32,7 @@ define KernelPackage/rtl8821cu
|
||||
PROVIDES:=kmod-rtl8821cu
|
||||
endef
|
||||
|
||||
NOSTDINC_FLAGS = \
|
||||
NOSTDINC_FLAGS:= \
|
||||
-I$(PKG_BUILD_DIR) \
|
||||
-I$(PKG_BUILD_DIR)/include \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport \
|
||||
@ -47,15 +42,7 @@ NOSTDINC_FLAGS = \
|
||||
-include backport/autoconf.h \
|
||||
-include backport/backport.h
|
||||
|
||||
EXTRA_KCONFIG:= \
|
||||
CONFIG_RTL8821CU=m \
|
||||
USER_MODULE_NAME=rtl8821cu
|
||||
|
||||
ifeq ($(ARCH),aarch64)
|
||||
EXTRA_KCONFIG += CONFIG_MP_VHT_HW_TX_MODE=n
|
||||
endif
|
||||
|
||||
EXTRA_CFLAGS:= \
|
||||
NOSTDINC_FLAGS+= \
|
||||
-DRTW_SINGLE_WIPHY \
|
||||
-DRTW_USE_CFG80211_STA_EVENT \
|
||||
-DCONFIG_IOCTL_CFG80211 \
|
||||
@ -63,19 +50,16 @@ EXTRA_CFLAGS:= \
|
||||
-DBUILD_OPENWRT
|
||||
|
||||
ifeq ($(BOARD),x86)
|
||||
EXTRA_CFLAGS += -mhard-float
|
||||
NOSTDINC_FLAGS+= -mhard-float
|
||||
endif
|
||||
|
||||
MAKE_OPTS:= \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||
USER_EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
|
||||
$(EXTRA_KCONFIG)
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
$(MAKE_OPTS) \
|
||||
+$(KERNEL_MAKE) $(PKG_JOBS) \
|
||||
M="$(PKG_BUILD_DIR)" \
|
||||
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||
CONFIG_RTL8821CU=m \
|
||||
$(if $(CONFIG_aarch64),CONFIG_MP_VHT_HW_TX_MODE=n) \
|
||||
USER_MODULE_NAME=rtl8821cu \
|
||||
modules
|
||||
endef
|
||||
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
Fix wireless.h to use linux kernel header files
|
||||
including uapi version of wireless.h
|
||||
|
||||
--- a/include/linux/wireless.h
|
||||
+++ b/include/linux/wireless.h
|
||||
@@ -18,16 +18,17 @@
|
||||
|
||||
/***************************** INCLUDES *****************************/
|
||||
|
||||
-#if 0
|
||||
+#if 1
|
||||
#include <linux/types.h> /* for __u* and __s* typedefs */
|
||||
#include <linux/socket.h> /* for "struct sockaddr" et al */
|
||||
#include <linux/if.h> /* for IFNAMSIZ and co... */
|
||||
+ #include <linux/wireless.h>
|
||||
+ #include <uapi/linux/wireless.h>
|
||||
#else
|
||||
#define __user
|
||||
/* typedef uint16_t __u16; */
|
||||
#include <sys/socket.h> /* for "struct sockaddr" et al */
|
||||
#include <net/if.h> /* for IFNAMSIZ and co... */
|
||||
-#endif
|
||||
|
||||
/****************************** TYPES ******************************/
|
||||
#ifdef CONFIG_COMPAT
|
||||
@@ -84,4 +85,5 @@ struct iwreq {
|
||||
union iwreq_data u;
|
||||
};
|
||||
|
||||
+#endif
|
||||
#endif /* _LINUX_WIRELESS_H */
|
||||
170
package/kernel/rtl8821cu/patches/050-fix-for-6.1.patch
Normal file
170
package/kernel/rtl8821cu/patches/050-fix-for-6.1.patch
Normal file
@ -0,0 +1,170 @@
|
||||
From ced770c458ec56e00c9a60e487292f9c83bb2bf4 Mon Sep 17 00:00:00 2001
|
||||
From: Shiwei Zhang <ylxdzsw@gmail.com>
|
||||
Date: Fri, 23 Dec 2022 14:27:38 +0800
|
||||
Subject: [PATCH 3/3] fix for linux 6.1
|
||||
|
||||
---
|
||||
os_dep/linux/ioctl_cfg80211.c | 14 +++++++-------
|
||||
os_dep/linux/os_intfs.c | 2 +-
|
||||
os_dep/osdep_service.c | 18 +++++++++---------
|
||||
3 files changed, 17 insertions(+), 17 deletions(-)
|
||||
|
||||
--- a/include/ieee80211.h
|
||||
+++ b/include/ieee80211.h
|
||||
@@ -1529,18 +1529,18 @@ enum ieee80211_state {
|
||||
(((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \
|
||||
(((Addr[5]) & 0xff) == 0xff))
|
||||
#else
|
||||
-extern __inline int is_multicast_mac_addr(const u8 *addr)
|
||||
+__inline int is_multicast_mac_addr(const u8 *addr)
|
||||
{
|
||||
return (addr[0] != 0xff) && (0x01 & addr[0]);
|
||||
}
|
||||
|
||||
-extern __inline int is_broadcast_mac_addr(const u8 *addr)
|
||||
+__inline int is_broadcast_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
|
||||
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
|
||||
}
|
||||
|
||||
-extern __inline int is_zero_mac_addr(const u8 *addr)
|
||||
+__inline int is_zero_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \
|
||||
(addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
|
||||
--- a/os_dep/linux/ioctl_cfg80211.c
|
||||
+++ b/os_dep/linux/ioctl_cfg80211.c
|
||||
@@ -417,7 +417,7 @@ u8 rtw_cfg80211_ch_switch_notify(_adapte
|
||||
if (ret != _SUCCESS)
|
||||
goto exit;
|
||||
|
||||
- cfg80211_ch_switch_notify(adapter->pnetdev, &chdef);
|
||||
+ cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0);
|
||||
|
||||
#else
|
||||
int freq = rtw_ch2freq(ch);
|
||||
@@ -1085,7 +1085,7 @@ check_bss:
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
|
||||
- roam_info.bssid = cur_network->network.MacAddress;
|
||||
+ roam_info.links[0].bssid = cur_network->network.MacAddress;
|
||||
roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2;
|
||||
roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2;
|
||||
roam_info.resp_ie = pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6;
|
||||
@@ -1635,8 +1635,8 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev
|
||||
- , u8 key_index
|
||||
+static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
|
||||
+ int link_id, u8 key_index
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
, bool pairwise
|
||||
#endif
|
||||
@@ -1779,8 +1779,8 @@ addkey_end:
|
||||
|
||||
}
|
||||
|
||||
-static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
|
||||
- , u8 keyid
|
||||
+static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev,
|
||||
+ int link_id, u8 keyid
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
, bool pairwise
|
||||
#endif
|
||||
@@ -1944,7 +1944,7 @@ exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
|
||||
+static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, int link_id,
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
u8 key_index, bool pairwise, const u8 *mac_addr)
|
||||
#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */
|
||||
@@ -1965,7 +1965,7 @@ static int cfg80211_rtw_del_key(struct w
|
||||
}
|
||||
|
||||
static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
|
||||
- struct net_device *ndev, u8 key_index
|
||||
+ struct net_device *ndev, int link_id, u8 key_index
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
, bool unicast, bool multicast
|
||||
#endif
|
||||
@@ -2013,7 +2013,7 @@ static int cfg80211_rtw_set_default_key(
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30))
|
||||
int cfg80211_rtw_set_default_mgmt_key(struct wiphy *wiphy,
|
||||
- struct net_device *ndev, u8 key_index)
|
||||
+ struct net_device *ndev, int link_id, u8 key_index)
|
||||
{
|
||||
#define SET_DEF_KEY_PARAM_FMT " key_index=%d"
|
||||
#define SET_DEF_KEY_PARAM_ARG , key_index
|
||||
@@ -4929,7 +4929,7 @@ static int cfg80211_rtw_change_beacon(st
|
||||
return ret;
|
||||
}
|
||||
|
||||
-static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
|
||||
+static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id)
|
||||
{
|
||||
_adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
|
||||
|
||||
@@ -9678,12 +9678,12 @@ void rtw_wdev_unregister(struct wireless
|
||||
|
||||
rtw_cfg80211_indicate_scan_done(adapter, _TRUE);
|
||||
|
||||
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
- if (wdev->current_bss) {
|
||||
- RTW_INFO(FUNC_ADPT_FMT" clear current_bss by cfg80211_disconnected\n", FUNC_ADPT_ARG(adapter));
|
||||
- rtw_cfg80211_indicate_disconnect(adapter, 0, 1);
|
||||
- }
|
||||
- #endif
|
||||
+ // #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
+ // if (wdev->current_bss) {
|
||||
+ // RTW_INFO(FUNC_ADPT_FMT" clear current_bss by cfg80211_disconnected\n", FUNC_ADPT_ARG(adapter));
|
||||
+ // rtw_cfg80211_indicate_disconnect(adapter, 0, 1);
|
||||
+ // }
|
||||
+ // #endif
|
||||
|
||||
if (pwdev_priv->pmon_ndev) {
|
||||
RTW_INFO("%s, unregister monitor interface\n", __func__);
|
||||
--- a/os_dep/linux/os_intfs.c
|
||||
+++ b/os_dep/linux/os_intfs.c
|
||||
@@ -1652,7 +1652,7 @@ int rtw_os_ndev_register(_adapter *adapt
|
||||
u8 rtnl_lock_needed = rtw_rtnl_lock_needed(dvobj);
|
||||
|
||||
#ifdef CONFIG_RTW_NAPI
|
||||
- netif_napi_add(ndev, &adapter->napi, rtw_recv_napi_poll, RTL_NAPI_WEIGHT);
|
||||
+ netif_napi_add(ndev, &adapter->napi, rtw_recv_napi_poll);
|
||||
#endif /* CONFIG_RTW_NAPI */
|
||||
|
||||
#if defined(CONFIG_IOCTL_CFG80211)
|
||||
--- a/os_dep/osdep_service.c
|
||||
+++ b/os_dep/osdep_service.c
|
||||
@@ -2614,15 +2614,15 @@ u64 rtw_division64(u64 x, u64 y)
|
||||
inline u32 rtw_random32(void)
|
||||
{
|
||||
#ifdef PLATFORM_LINUX
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
|
||||
- return prandom_u32();
|
||||
-#elif (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
|
||||
- u32 random_int;
|
||||
- get_random_bytes(&random_int , 4);
|
||||
- return random_int;
|
||||
-#else
|
||||
- return random32();
|
||||
-#endif
|
||||
+// #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
|
||||
+// return prandom_u32();
|
||||
+// #elif (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
|
||||
+// u32 random_int;
|
||||
+// get_random_bytes(&random_int , 4);
|
||||
+// return random_int;
|
||||
+// #else
|
||||
+ return get_random_u32();
|
||||
+// #endif
|
||||
#elif defined(PLATFORM_WINDOWS)
|
||||
#error "to be implemented\n"
|
||||
#elif defined(PLATFORM_FREEBSD)
|
||||
@ -1,24 +0,0 @@
|
||||
--- a/include/ieee80211.h
|
||||
+++ b/include/ieee80211.h
|
||||
@@ -1529,18 +1529,18 @@
|
||||
(((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \
|
||||
(((Addr[5]) & 0xff) == 0xff))
|
||||
#else
|
||||
-extern __inline int is_multicast_mac_addr(const u8 *addr)
|
||||
+__inline static int is_multicast_mac_addr(const u8 *addr)
|
||||
{
|
||||
return (addr[0] != 0xff) && (0x01 & addr[0]);
|
||||
}
|
||||
|
||||
-extern __inline int is_broadcast_mac_addr(const u8 *addr)
|
||||
+__inline static int is_broadcast_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
|
||||
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
|
||||
}
|
||||
|
||||
-extern __inline int is_zero_mac_addr(const u8 *addr)
|
||||
+__inline static int is_zero_mac_addr(const u8 *addr)
|
||||
{
|
||||
return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \
|
||||
(addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
|
||||
Loading…
Reference in New Issue
Block a user