From 9527222a9f589b585045ef5603955ac9b6af5320 Mon Sep 17 00:00:00 2001 From: "misha.gps" Date: Sat, 20 May 2023 14:38:21 +0300 Subject: [PATCH] added support of new kernel for rhel8.8 --- Makefile | 8 ++++++++ os_dep/linux/ioctl_cfg80211.c | 24 ++++++++++++------------ os_dep/linux/os_intfs.c | 6 +++--- os_dep/osdep_service.c | 2 +- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index d255750..d8cd530 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,14 @@ CONFIG_AUTOCFG_CP = n RHEL_VER := $(shell echo `grep '^ID_LIKE' /etc/os-release |grep -qi 'fedora' && grep '^VERSION_ID' /etc/os-release | cut -f2 -d= | cut -c2`) ifeq (${RHEL_VER},8) EXTRA_CFLAGS += -DRHEL8 +ifdef KVER +RHEL_SVER := $(shell echo $(KVER) |sed -e 's/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-\([0-9][0-9]*\).*/\1/') +else +RHEL_SVER := $(shell uname -r |sed -e 's/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*-\([0-9][0-9]*\).*/\1/') +endif +ifeq ($(shell test $(RHEL_SVER) -ge 477; echo $$?),0) +EXTRA_CFLAGS += -DRHEL88 +endif endif ########################## WIFI IC ############################ diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index f5a6b63..b15f1e8 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -464,7 +464,7 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, * called by others with block-tx. */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(RHEL88)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0, 0, false, 0); #else @@ -483,7 +483,7 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, if (!rtw_cfg80211_allow_ch_switch_notify(adapter)) goto exit; -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(RHEL88)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0, 0); #else @@ -506,7 +506,7 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, } ctype = rtw_chbw_to_nl80211_channel_type(ch, bw, offset, ht); -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(RHEL88)) cfg80211_ch_switch_notify(adapter->pnetdev, freq, ctype, 0); #else cfg80211_ch_switch_notify(adapter->pnetdev, freq, ctype); @@ -1159,7 +1159,7 @@ check_bss: #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) || defined(RHEL88)) roam_info.links[0].bssid = cur_network->network.MacAddress; #else roam_info.bssid = cur_network->network.MacAddress; @@ -1923,7 +1923,7 @@ exit: } static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(RHEL88)) , int link_id #endif , u8 key_index @@ -2088,7 +2088,7 @@ addkey_end: } static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(RHEL88)) , int link_id #endif , u8 keyid @@ -2279,7 +2279,7 @@ exit: } static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(RHEL88)) int link_id, #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) @@ -2303,7 +2303,7 @@ 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, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(RHEL88)) int link_id, #endif u8 key_index @@ -2355,7 +2355,7 @@ 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, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(RHEL88)) int link_id, #endif u8 key_index) @@ -5418,7 +5418,7 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd return ret; } -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(RHEL88)) static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id) #else @@ -6803,7 +6803,7 @@ exit: #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) static int cfg80211_rtw_get_channel(struct wiphy *wiphy, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(RHEL88)) struct wireless_dev *wdev, unsigned int link_id, #else struct wireless_dev *wdev, @@ -10742,7 +10742,7 @@ void rtw_wdev_unregister(struct wireless_dev *wdev) rtw_cfg80211_indicate_scan_done(adapter, _TRUE); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE) - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(RHEL88)) if (wdev->links[0].client.current_bss) { #else if (wdev->current_bss) { diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 6e9479e..7baa1d6 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -1634,7 +1634,7 @@ 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)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) || defined(RHEL8)) 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 */ @@ -2154,7 +2154,7 @@ 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)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(RHEL88)) 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); @@ -2178,7 +2178,7 @@ 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)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) || defined(RHEL8)) eth_hw_addr_set(ndev, adapter_mac_addr(adapter)); #else _rtw_memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN); diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index 3b927f4..1e78cbb 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -2914,7 +2914,7 @@ u64 rtw_division64(u64 x, u64 y) inline u32 rtw_random32(void) { #ifdef PLATFORM_LINUX -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(RHEL88)) return get_random_u32(); #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) return prandom_u32();