From 1bb0fe8f64d8e90e0c6fd04f5e2abb7a081a8682 Mon Sep 17 00:00:00 2001 From: Rin Cat Date: Sun, 2 Aug 2020 05:31:22 -0400 Subject: [PATCH] Linux 5.8 compat: management frame registration --- os_dep/linux/ioctl_cfg80211.c | 26 +++++++++++++++++++++++++- os_dep/linux/ioctl_cfg80211.h | 3 +++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index d843399..969ca8b 100755 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -7767,6 +7767,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, @@ -7774,6 +7775,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); @@ -7789,10 +7795,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) @@ -7817,6 +7835,7 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, default: break; } +#endif exit: return; @@ -10200,11 +10219,16 @@ static struct cfg80211_ops rtw_cfg80211_ops = { #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE) .mgmt_tx = cfg80211_rtw_mgmt_tx, - .mgmt_frame_register = cfg80211_rtw_mgmt_frame_register, #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) && LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35)) .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 8a1d542..9ab050c 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;