Merge pull request #125 from Guiiix/v5.3.9

Modified kernel version checks for Centos 7.9
This commit is contained in:
Christian Bremvåg 2021-05-04 13:31:34 +02:00 committed by GitHub
commit 9679ca48f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 21 deletions

View File

@ -10,6 +10,11 @@ EXTRA_CFLAGS += -Wno-unused
EXTRA_CFLAGS += -Wno-vla EXTRA_CFLAGS += -Wno-vla
EXTRA_CFLAGS += -Wno-date-time EXTRA_CFLAGS += -Wno-date-time
REDHAT_VER := $(shell cut -f4 -d" " /etc/redhat-release |cut -d"." -f1,2 )
ifeq ($(REDHAT_VER), 7.9)
EXTRA_CFLAGS += -DRHEL79
endif
GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc ) GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
ifeq ($(GCC_VER_49),1) ifeq ($(GCC_VER_49),1)
EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later

View File

@ -1,3 +1,6 @@
Like https://github.com/cccooo/rtl8812au-centos-7.6, forked from aircrack-ng/rtl8188eus and modified for CentOS 7.9
as CentOS Kernel 3.10 contains many code from 4.x
## rtl8188eus v5.3.9 ## rtl8188eus v5.3.9
# Realtek rtl8188eus & rtl8188eu & rtl8188etv WiFi drivers # Realtek rtl8188eus & rtl8188eu & rtl8188etv WiFi drivers

View File

@ -27,7 +27,7 @@
#define DBG_RTW_CFG80211_MESH_CONF 0 #define DBG_RTW_CFG80211_MESH_CONF 0
#endif #endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0) || defined(RHEL79))
#define STATION_INFO_INACTIVE_TIME BIT(NL80211_STA_INFO_INACTIVE_TIME) #define STATION_INFO_INACTIVE_TIME BIT(NL80211_STA_INFO_INACTIVE_TIME)
#define STATION_INFO_LLID BIT(NL80211_STA_INFO_LLID) #define STATION_INFO_LLID BIT(NL80211_STA_INFO_LLID)
#define STATION_INFO_PLID BIT(NL80211_STA_INFO_PLID) #define STATION_INFO_PLID BIT(NL80211_STA_INFO_PLID)
@ -289,7 +289,7 @@ static const char *nl80211_chan_width_str(enum nl80211_chan_width cwidth)
return "80+80"; return "80+80";
case NL80211_CHAN_WIDTH_160: case NL80211_CHAN_WIDTH_160:
return "160"; return "160";
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) || defined(RHEL79))
case NL80211_CHAN_WIDTH_5: case NL80211_CHAN_WIDTH_5:
return "5"; return "5";
case NL80211_CHAN_WIDTH_10: case NL80211_CHAN_WIDTH_10:
@ -390,7 +390,7 @@ static void rtw_get_chbw_from_cfg80211_chan_def(struct cfg80211_chan_def *chdef,
*ch = chan->hw_value; *ch = chan->hw_value;
break; break;
case NL80211_CHAN_WIDTH_80P80: case NL80211_CHAN_WIDTH_80P80:
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) || defined(RHEL79))
case NL80211_CHAN_WIDTH_5: case NL80211_CHAN_WIDTH_5:
case NL80211_CHAN_WIDTH_10: case NL80211_CHAN_WIDTH_10:
#endif #endif
@ -944,7 +944,7 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter)
struct wlan_network *cur_network = &(pmlmepriv->cur_network); struct wlan_network *cur_network = &(pmlmepriv->cur_network);
struct wireless_dev *pwdev = padapter->rtw_wdev; struct wireless_dev *pwdev = padapter->rtw_wdev;
struct cfg80211_bss *bss = NULL; struct cfg80211_bss *bss = NULL;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) || defined(RHEL79))
struct wiphy *wiphy = pwdev->wiphy; struct wiphy *wiphy = pwdev->wiphy;
int freq = 2412; int freq = 2412;
struct ieee80211_channel *notify_channel; struct ieee80211_channel *notify_channel;
@ -1002,7 +1002,7 @@ void rtw_cfg80211_ibss_indicate_connect(_adapter *padapter)
RTW_PRINT(FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter)); RTW_PRINT(FUNC_ADPT_FMT" BSS not found !!\n", FUNC_ADPT_ARG(padapter));
} }
/* notify cfg80211 that device joined an IBSS */ /* notify cfg80211 that device joined an IBSS */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0) || defined(RHEL79))
notify_channel = ieee80211_get_channel(wiphy, freq); notify_channel = ieee80211_get_channel(wiphy, freq);
cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, notify_channel, GFP_ATOMIC); cfg80211_ibss_joined(padapter->pnetdev, cur_network->network.MacAddress, notify_channel, GFP_ATOMIC);
#else #else
@ -1090,7 +1090,7 @@ check_bss:
struct ieee80211_channel *notify_channel; struct ieee80211_channel *notify_channel;
u32 freq; u32 freq;
u16 channel = cur_network->network.Configuration.DSConfig; u16 channel = cur_network->network.Configuration.DSConfig;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || defined(RHEL79))
struct cfg80211_roam_info roam_info; struct cfg80211_roam_info roam_info;
#endif #endif
@ -1098,7 +1098,7 @@ check_bss:
notify_channel = ieee80211_get_channel(wiphy, freq); notify_channel = ieee80211_get_channel(wiphy, freq);
#endif #endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || defined(RHEL79))
roam_info.bssid = cur_network->network.MacAddress; roam_info.bssid = cur_network->network.MacAddress;
roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2; 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.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2;
@ -1126,7 +1126,7 @@ check_bss:
rtw_ft_set_status(padapter, RTW_FT_ASSOCIATED_STA); rtw_ft_set_status(padapter, RTW_FT_ASSOCIATED_STA);
#endif #endif
} else { } else {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) #if !defined(RHEL79) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE))
RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state); RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state);
#endif #endif
@ -1137,7 +1137,7 @@ check_bss:
, pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6 , pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6
, pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6 , pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6
, WLAN_STATUS_SUCCESS, GFP_ATOMIC); , WLAN_STATUS_SUCCESS, GFP_ATOMIC);
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) #if defined(RHEL79) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE))
RTW_INFO("pwdev->sme_state(a)=%d\n", pwdev->sme_state); RTW_INFO("pwdev->sme_state(a)=%d\n", pwdev->sme_state);
#endif #endif
} }
@ -1193,7 +1193,7 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally
_enter_critical_bh(&pwdev_priv->connect_req_lock, &irqL); _enter_critical_bh(&pwdev_priv->connect_req_lock, &irqL);
if (padapter->ndev_unregistering || !rtw_wdev_not_indic_disco(pwdev_priv)) { if (padapter->ndev_unregistering || !rtw_wdev_not_indic_disco(pwdev_priv)) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE) #if (!defined(RHEL79) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE)))
RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state); RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state);
if (pwdev->sme_state == CFG80211_SME_CONNECTING) { if (pwdev->sme_state == CFG80211_SME_CONNECTING) {
@ -2448,7 +2448,7 @@ void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted)
struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter); struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter);
_irqL irqL; _irqL irqL;
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE) #if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE || defined(RHEL79))
struct cfg80211_scan_info info; struct cfg80211_scan_info info;
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
@ -2465,7 +2465,7 @@ void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted)
if (pwdev_priv->scan_request->wiphy != pwdev_priv->rtw_wdev->wiphy) if (pwdev_priv->scan_request->wiphy != pwdev_priv->rtw_wdev->wiphy)
RTW_INFO("error wiphy compare\n"); RTW_INFO("error wiphy compare\n");
else else
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE) #if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE || defined(RHEL79))
cfg80211_scan_done(pwdev_priv->scan_request, &info); cfg80211_scan_done(pwdev_priv->scan_request, &info);
#else #else
cfg80211_scan_done(pwdev_priv->scan_request, aborted); cfg80211_scan_done(pwdev_priv->scan_request, aborted);
@ -3055,7 +3055,7 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy
check_need_indicate_scan_done: check_need_indicate_scan_done:
if (_TRUE == need_indicate_scan_done) { if (_TRUE == need_indicate_scan_done) {
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE) #if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE || defined(RHEL79))
struct cfg80211_scan_info info; struct cfg80211_scan_info info;
memset(&info, 0, sizeof(info)); memset(&info, 0, sizeof(info));
@ -3063,7 +3063,7 @@ check_need_indicate_scan_done:
#endif #endif
_rtw_cfg80211_surveydone_event_callback(padapter, request); _rtw_cfg80211_surveydone_event_callback(padapter, request);
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE) #if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE || defined(RHEL79))
cfg80211_scan_done(request, &info); cfg80211_scan_done(request, &info);
#else #else
cfg80211_scan_done(request, 0); cfg80211_scan_done(request, 0);
@ -9146,7 +9146,8 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy)
#endif #endif
#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) && \ #if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) && \
LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) && \
!defined(RHEL79))
wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
#ifdef CONFIG_PNO_SUPPORT #ifdef CONFIG_PNO_SUPPORT
wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT; wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT;
@ -9157,7 +9158,7 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy)
#endif #endif
#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) #if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) && !defined(RHEL79))
wiphy->wowlan = wowlan_stub; wiphy->wowlan = wowlan_stub;
#else #else
wiphy->wowlan = &wowlan_stub; wiphy->wowlan = &wowlan_stub;

View File

@ -362,7 +362,7 @@ void rtw_cfg80211_deinit_rfkill(struct wiphy *wiphy);
#define rtw_cfg80211_connect_result(wdev, bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, gfp) cfg80211_connect_result(wdev_to_ndev(wdev), bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, gfp) #define rtw_cfg80211_connect_result(wdev, bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, gfp) cfg80211_connect_result(wdev_to_ndev(wdev), bssid, req_ie, req_ie_len, resp_ie, resp_ie_len, status, gfp)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)) #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) && !defined(RHEL79))
#define rtw_cfg80211_disconnected(wdev, reason, ie, ie_len, locally_generated, gfp) cfg80211_disconnected(wdev_to_ndev(wdev), reason, ie, ie_len, gfp) #define rtw_cfg80211_disconnected(wdev, reason, ie, ie_len, locally_generated, gfp) cfg80211_disconnected(wdev_to_ndev(wdev), reason, ie, ie_len, gfp)
#else #else
#define rtw_cfg80211_disconnected(wdev, reason, ie, ie_len, locally_generated, gfp) cfg80211_disconnected(wdev_to_ndev(wdev), reason, ie, ie_len, locally_generated, gfp) #define rtw_cfg80211_disconnected(wdev, reason, ie, ie_len, locally_generated, gfp) cfg80211_disconnected(wdev_to_ndev(wdev), reason, ie, ie_len, locally_generated, gfp)
@ -384,7 +384,7 @@ void rtw_cfg80211_deinit_rfkill(struct wiphy *wiphy);
u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 ht); u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 ht);
#endif #endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) && !defined(RHEL79) )
#define NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ #define NL80211_BAND_2GHZ IEEE80211_BAND_2GHZ
#define NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ #define NL80211_BAND_5GHZ IEEE80211_BAND_5GHZ
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))

View File

@ -294,7 +294,7 @@ void rtw_regd_apply_flags(struct wiphy *wiphy)
&& rtw_odm_dfs_domain_unknown(padapter) && rtw_odm_dfs_domain_unknown(padapter)
#endif #endif
) { ) {
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(RHEL79))
ch->flags = (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN); ch->flags = (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN);
#else #else
ch->flags = IEEE80211_CHAN_NO_IR; ch->flags = IEEE80211_CHAN_NO_IR;
@ -309,7 +309,7 @@ void rtw_regd_apply_flags(struct wiphy *wiphy)
#endif #endif
) { ) {
ch->flags |= IEEE80211_CHAN_RADAR; ch->flags |= IEEE80211_CHAN_RADAR;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(RHEL79))
ch->flags |= (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN); ch->flags |= (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_PASSIVE_SCAN);
#else #else
ch->flags |= IEEE80211_CHAN_NO_IR; ch->flags |= IEEE80211_CHAN_NO_IR;
@ -374,7 +374,7 @@ static void _rtw_regd_init_wiphy(struct rtw_regulatory *reg, struct wiphy *wiphy
wiphy->reg_notifier = rtw_reg_notifier; wiphy->reg_notifier = rtw_reg_notifier;
#endif #endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)) #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0) && !defined(RHEL79))
wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY; wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY;
wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS; wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS;