diff --git a/debian/patches/add-linux-6.1-support.patch b/debian/patches/add-linux-6.1-support.patch new file mode 100644 index 0000000..4688d14 --- /dev/null +++ b/debian/patches/add-linux-6.1-support.patch @@ -0,0 +1,112 @@ +From: Sophie Brun +Date: Tue, 21 Feb 2023 14:49:29 +0100 +Subject: Add Linux 6.1 build support + +Origin: https://github.com/aircrack-ng/rtl8188eus/pull/226 +--- + dkms.conf | 1 - + os_dep/linux/ioctl_cfg80211.c | 21 +++++++++++++++++++-- + os_dep/linux/os_intfs.c | 4 ++++ + os_dep/osdep_service.c | 4 +++- + 4 files changed, 26 insertions(+), 4 deletions(-) + +diff --git a/dkms.conf b/dkms.conf +index 2c60a99..d1d1dc8 100644 +--- a/dkms.conf ++++ b/dkms.conf +@@ -7,4 +7,3 @@ PROCS_NUM=`nproc` + DEST_MODULE_LOCATION[0]="/updates" + MAKE="'make' -j$PROCS_NUM KVER=${kernelver} KSRC=/lib/modules/${kernelver}/build" + AUTOINSTALL="yes" +-REMAKE_INITRD=no +diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c +index b68e5eb..b799e58 100644 +--- a/os_dep/linux/ioctl_cfg80211.c ++++ b/os_dep/linux/ioctl_cfg80211.c +@@ -1660,6 +1660,9 @@ exit: + } + + static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) ++ , int link_id ++#endif + , u8 key_index + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) + , bool pairwise +@@ -1804,6 +1807,9 @@ addkey_end: + } + + static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) ++ , int link_id ++#endif + , u8 keyid + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) + , bool pairwise +@@ -1969,6 +1975,9 @@ exit: + } + + static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) ++ int link_id, ++#endif + #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)) */ +@@ -1989,7 +1998,11 @@ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, + } + + static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, +- struct net_device *ndev, u8 key_index ++ struct net_device *ndev, ++ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) ++ int link_id, ++ #endif ++ u8 key_index + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE) + , bool unicast, bool multicast + #endif +@@ -2037,7 +2050,11 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, + + #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, ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) ++ int link_id, ++#endif ++ u8 key_index) + { + #define SET_DEF_KEY_PARAM_FMT " key_index=%d" + #define SET_DEF_KEY_PARAM_ARG , key_index +diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c +index f006fc8..1d28862 100644 +--- a/os_dep/linux/os_intfs.c ++++ b/os_dep/linux/os_intfs.c +@@ -1618,7 +1618,11 @@ int rtw_os_ndev_register(_adapter *adapter, const char *name) + u8 rtnl_lock_needed = rtw_rtnl_lock_needed(dvobj); + + #ifdef CONFIG_RTW_NAPI ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) ++ netif_napi_add_weight(ndev, &adapter->napi, rtw_recv_napi_poll, RTL_NAPI_WEIGHT); ++#else + netif_napi_add(ndev, &adapter->napi, rtw_recv_napi_poll, RTL_NAPI_WEIGHT); ++#endif + #endif /* CONFIG_RTW_NAPI */ + + #if defined(CONFIG_IOCTL_CFG80211) +diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c +index 7367bca..5480971 100644 +--- a/os_dep/osdep_service.c ++++ b/os_dep/osdep_service.c +@@ -2574,7 +2574,9 @@ u64 rtw_division64(u64 x, u64 y) + inline u32 rtw_random32(void) + { + #ifdef PLATFORM_LINUX +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) ++ return get_random_u32(); ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) + return prandom_u32(); + #elif (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18)) + u32 random_int; diff --git a/debian/patches/series b/debian/patches/series index 6e3040b..8ad5957 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ add-support-kernel-5.17.patch +add-linux-6.1-support.patch