Linux 5.8 compat: management frame registration

This commit is contained in:
Rin Cat 2020-08-02 05:31:22 -04:00
parent 179b836abd
commit 1bb0fe8f64
No known key found for this signature in database
GPG Key ID: 7E93675C2BDBB222
2 changed files with 28 additions and 1 deletions

View File

@ -7767,6 +7767,7 @@ exit:
return ret; return ret;
} }
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0))
static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy, static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
struct wireless_dev *wdev, struct wireless_dev *wdev,
@ -7774,6 +7775,11 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
struct net_device *ndev, struct net_device *ndev,
#endif #endif
u16 frame_type, bool reg) 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)) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
struct net_device *ndev = wdev_to_ndev(wdev); 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); pwdev_priv = adapter_wdev_data(adapter);
#ifdef CONFIG_DEBUG_CFG80211 #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), RTW_INFO(FUNC_ADPT_FMT" frame_type:%x, reg:%d\n", FUNC_ADPT_ARG(adapter),
frame_type, reg); 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 #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) { switch (frame_type) {
case IEEE80211_STYPE_AUTH: /* 0x00B0 */ case IEEE80211_STYPE_AUTH: /* 0x00B0 */
if (reg > 0) if (reg > 0)
@ -7817,6 +7835,7 @@ static void cfg80211_rtw_mgmt_frame_register(struct wiphy *wiphy,
default: default:
break; break;
} }
#endif
exit: exit:
return; 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) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
.mgmt_tx = cfg80211_rtw_mgmt_tx, .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)) #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) && LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35))
.action = cfg80211_rtw_mgmt_tx, .action = cfg80211_rtw_mgmt_tx,
#endif #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)) #if defined(CONFIG_TDLS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
.tdls_mgmt = cfg80211_rtw_tdls_mgmt, .tdls_mgmt = cfg80211_rtw_tdls_mgmt,
.tdls_oper = cfg80211_rtw_tdls_oper, .tdls_oper = cfg80211_rtw_tdls_oper,

View File

@ -175,6 +175,9 @@ struct rtw_wdev_priv {
u16 mgmt_tx_cookie; u16 mgmt_tx_cookie;
_mutex roch_mutex; _mutex roch_mutex;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
u32 mgmt_mask;
#endif
#ifdef CONFIG_CONCURRENT_MODE #ifdef CONFIG_CONCURRENT_MODE
ATOMIC_T switch_ch_to; ATOMIC_T switch_ch_to;