From 752175b1bec2269299e4d2f620416a40b96fd6c3 Mon Sep 17 00:00:00 2001 From: Rin Cat Date: Tue, 21 Jul 2020 19:33:09 -0400 Subject: [PATCH] Linux 5.8 compat: management frame registration --- os_dep/linux/ioctl_cfg80211.c | 25 +++++++++++++++++++++++++ os_dep/linux/ioctl_cfg80211.h | 3 +++ 2 files changed, 28 insertions(+) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index b083c52..aaffa23 100755 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -7478,6 +7478,7 @@ exit: return ret; } +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)) static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) struct wireless_dev *wdev, @@ -7485,6 +7486,11 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, struct net_device *ndev, #endif u16 frame_type, bool reg) +#else +static void cfg80211_rtw_update_mgmt_frame_register(struct wiphy *wiphy, + struct wireless_dev *wdev, + struct mgmt_frame_regs *upd) +#endif { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) struct net_device *ndev = wdev_to_ndev(wdev); @@ -7500,10 +7506,22 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, pwdev_priv = adapter_wdev_data(adapter); #ifdef CONFIG_DEBUG_CFG80211 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)) RTW_INFO(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter), frame_type, reg); +#else + RTW_INFO(FUNC_ADPT_FMT" new_reg:%x, old_reg:%x\n", FUNC_ADPT_ARG(adapter), + pwdev_priv->mgmt_mask, upd->interface_stypes); +#endif #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + u32 rtw_mask = BIT(IEEE80211_STYPE_AUTH >> 4); + if ((upd->interface_stypes & rtw_mask) + == (pwdev_priv->mgmt_mask & rtw_mask)) + return; + pwdev_priv->mgmt_mask = upd->interface_stypes; +#else switch (frame_type) { case IEEE80211_STYPE_AUTH: /* 0x00B0 */ if (reg > 0) @@ -7528,6 +7546,7 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, default: break; } +#endif exit: return; @@ -9921,6 +9940,12 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .action = cfg80211_rtw_mgmt_tx, #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + .update_mgmt_frame_registrations = cfg80211_rtw_update_mgmt_frame_register, +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) + .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register, +#endif + #if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)) .tdls_mgmt = cfg80211_rtw_tdls_mgmt, .tdls_oper = cfg80211_rtw_tdls_oper, diff --git a/os_dep/linux/ioctl_cfg80211.h b/os_dep/linux/ioctl_cfg80211.h index 6775480..136586b 100644 --- a/os_dep/linux/ioctl_cfg80211.h +++ b/os_dep/linux/ioctl_cfg80211.h @@ -175,6 +175,9 @@ struct rtw_wdev_priv { u16 mgmt_tx_cookie; _mutex roch_mutex; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)) + u32 mgmt_mask; +#endif #ifdef CONFIG_CONCURRENT_MODE ATOMIC_T switch_ch_to;