Linux 5.8 compat: management frame registration

This commit is contained in:
Rin Cat 2020-07-21 19:33:09 -04:00
parent afa0b2a3dc
commit 752175b1be
No known key found for this signature in database
GPG Key ID: 7E93675C2BDBB222
2 changed files with 28 additions and 0 deletions

View File

@ -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,

View File

@ -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;