1818#include <hal_data.h>
1919
2020#ifdef CONFIG_IOCTL_CFG80211
21+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION (7 , 1 , 0 ))
22+ #define RTW_WDEV_ARG struct wireless_dev *wdev
23+ #define RTW_WDEV_GET struct net_device *ndev = wdev->netdev
24+ #else
25+ #define RTW_WDEV_ARG struct net_device *ndev
26+ #define RTW_WDEV_GET
27+ #endif
2128
2229#ifndef DBG_RTW_CFG80211_STA_PARAM
2330#define DBG_RTW_CFG80211_STA_PARAM 0
@@ -1700,7 +1707,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
17001707 return ret ;
17011708}
17021709
1703- static int cfg80211_rtw_add_key (struct wiphy * wiphy , struct net_device * ndev
1710+ static int cfg80211_rtw_add_key (struct wiphy * wiphy , RTW_WDEV_ARG
17041711#if (LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 1 , 0 ))
17051712 ,int link_id
17061713#endif
@@ -1710,6 +1717,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev
17101717#endif
17111718 , const u8 * mac_addr , struct key_params * params )
17121719{
1720+ RTW_WDEV_GET ;
17131721 char * alg_name ;
17141722 u32 param_len ;
17151723 struct ieee_param * param = NULL ;
@@ -1847,7 +1855,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev
18471855
18481856}
18491857
1850- static int cfg80211_rtw_get_key (struct wiphy * wiphy , struct net_device * ndev
1858+ static int cfg80211_rtw_get_key (struct wiphy * wiphy , RTW_WDEV_ARG
18511859#if (LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 1 , 0 ))
18521860 ,int link_id
18531861#endif
@@ -1858,6 +1866,7 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
18581866 , const u8 * mac_addr , void * cookie
18591867 , void (* callback )(void * cookie , struct key_params * ))
18601868{
1869+ RTW_WDEV_GET ;
18611870#define GET_KEY_PARAM_FMT_S " keyid=%d"
18621871#define GET_KEY_PARAM_ARG_S , keyid
18631872#if (LINUX_VERSION_CODE >= KERNEL_VERSION (2 , 6 , 37 )) || defined(COMPAT_KERNEL_RELEASE )
@@ -2015,7 +2024,7 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
20152024 return ret ;
20162025}
20172026
2018- static int cfg80211_rtw_del_key (struct wiphy * wiphy , struct net_device * ndev ,
2027+ static int cfg80211_rtw_del_key (struct wiphy * wiphy , RTW_WDEV_ARG ,
20192028#if (LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 1 , 0 ))
20202029 int link_id ,
20212030#endif
@@ -2025,6 +2034,7 @@ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
20252034 u8 key_index , const u8 * mac_addr )
20262035#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */
20272036{
2037+ RTW_WDEV_GET ;
20282038 _adapter * padapter = (_adapter * )rtw_netdev_priv (ndev );
20292039 struct security_priv * psecuritypriv = & padapter -> securitypriv ;
20302040
@@ -2091,12 +2101,13 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
20912101
20922102#if (LINUX_VERSION_CODE >= KERNEL_VERSION (2 , 6 , 30 ))
20932103int cfg80211_rtw_set_default_mgmt_key (struct wiphy * wiphy ,
2094- struct net_device * ndev ,
2104+ RTW_WDEV_ARG ,
20952105#if (LINUX_VERSION_CODE >= KERNEL_VERSION (6 , 1 , 0 ))
20962106 int link_id ,
20972107#endif
20982108 u8 key_index )
20992109{
2110+ RTW_WDEV_GET ;
21002111#define SET_DEF_KEY_PARAM_FMT " key_index=%d"
21012112#define SET_DEF_KEY_PARAM_ARG , key_index
21022113
@@ -2241,14 +2252,15 @@ static void rtw_cfg80211_fill_mesh_only_sta_info(struct mesh_plink_ent *plink, s
22412252#endif /* CONFIG_RTW_MESH */
22422253
22432254static int cfg80211_rtw_get_station (struct wiphy * wiphy ,
2244- struct net_device * ndev ,
2255+ RTW_WDEV_ARG ,
22452256#if (LINUX_VERSION_CODE < KERNEL_VERSION (3 , 16 , 0 ))
22462257 u8 * mac ,
22472258#else
22482259 const u8 * mac ,
22492260#endif
22502261 struct station_info * sinfo )
22512262{
2263+ RTW_WDEV_GET ;
22522264 int ret = 0 ;
22532265 _adapter * padapter = (_adapter * )rtw_netdev_priv (ndev );
22542266 struct mlme_priv * pmlmepriv = & padapter -> mlmepriv ;
@@ -4401,7 +4413,11 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f
44014413 sinfo .filled = STATION_INFO_ASSOC_REQ_IES ;
44024414 sinfo .assoc_req_ies = pmgmt_frame + WLAN_HDR_A3_LEN + ie_offset ;
44034415 sinfo .assoc_req_ies_len = frame_len - WLAN_HDR_A3_LEN - ie_offset ;
4416+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION (7 , 1 , 0 ))
4417+ cfg80211_new_sta (padapter -> rtw_wdev , get_addr2_ptr (pmgmt_frame ), & sinfo , GFP_ATOMIC );
4418+ #else
44044419 cfg80211_new_sta (ndev , get_addr2_ptr (pmgmt_frame ), & sinfo , GFP_ATOMIC );
4420+ #endif
44054421 }
44064422#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
44074423 channel = pmlmeext -> cur_channel ;
@@ -4447,7 +4463,11 @@ void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, const u8 *da, unsign
44474463 RTW_INFO (FUNC_ADPT_FMT "\n" , FUNC_ADPT_ARG (padapter ));
44484464
44494465#if defined(RTW_USE_CFG80211_STA_EVENT ) || defined(COMPAT_KERNEL_RELEASE )
4466+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION (7 , 1 , 0 ))
4467+ cfg80211_del_sta (padapter -> rtw_wdev , da , GFP_ATOMIC );
4468+ #else
44504469 cfg80211_del_sta (ndev , da , GFP_ATOMIC );
4470+ #endif
44514471#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
44524472 channel = pmlmeext -> cur_channel ;
44534473 freq = rtw_ch2freq (channel );
@@ -5368,14 +5388,15 @@ void dump_station_parameters(void *sel, struct wiphy *wiphy, const struct statio
53685388#endif /* DBG_RTW_CFG80211_STA_PARAM */
53695389}
53705390
5371- static int cfg80211_rtw_add_station (struct wiphy * wiphy , struct net_device * ndev ,
5391+ static int cfg80211_rtw_add_station (struct wiphy * wiphy , RTW_WDEV_ARG ,
53725392#if (LINUX_VERSION_CODE < KERNEL_VERSION (3 , 16 , 0 ))
53735393 u8 * mac ,
53745394#else
53755395 const u8 * mac ,
53765396#endif
53775397 struct station_parameters * params )
53785398{
5399+ RTW_WDEV_GET ;
53795400 int ret = 0 ;
53805401 _adapter * padapter = (_adapter * )rtw_netdev_priv (ndev );
53815402#if defined(CONFIG_TDLS ) || defined(CONFIG_RTW_MESH )
@@ -5536,7 +5557,7 @@ static int cfg80211_rtw_add_station(struct wiphy *wiphy, struct net_device *ndev
55365557 return ret ;
55375558}
55385559
5539- static int cfg80211_rtw_del_station (struct wiphy * wiphy , struct net_device * ndev ,
5560+ static int cfg80211_rtw_del_station (struct wiphy * wiphy , RTW_WDEV_ARG ,
55405561#if (LINUX_VERSION_CODE < KERNEL_VERSION (3 , 16 , 0 ))
55415562 u8 * mac
55425563#elif (LINUX_VERSION_CODE < KERNEL_VERSION (3 , 19 , 0 ))
@@ -5546,6 +5567,7 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev
55465567#endif
55475568)
55485569{
5570+ RTW_WDEV_GET ;
55495571 int ret = 0 ;
55505572 _irqL irqL ;
55515573 _list * phead , * plist ;
@@ -5642,14 +5664,15 @@ static int cfg80211_rtw_del_station(struct wiphy *wiphy, struct net_device *ndev
56425664
56435665}
56445666
5645- static int cfg80211_rtw_change_station (struct wiphy * wiphy , struct net_device * ndev ,
5667+ static int cfg80211_rtw_change_station (struct wiphy * wiphy , RTW_WDEV_ARG ,
56465668#if (LINUX_VERSION_CODE < KERNEL_VERSION (3 , 16 , 0 ))
56475669 u8 * mac ,
56485670#else
56495671 const u8 * mac ,
56505672#endif
56515673 struct station_parameters * params )
56525674{
5675+ RTW_WDEV_GET ;
56535676#ifdef CONFIG_RTW_MESH
56545677 _adapter * adapter = (_adapter * )rtw_netdev_priv (ndev );
56555678 struct sta_priv * stapriv = & adapter -> stapriv ;
@@ -5796,9 +5819,10 @@ struct sta_info *rtw_sta_info_get_by_idx(struct sta_priv *pstapriv, const int id
57965819 return psta ;
57975820}
57985821
5799- static int cfg80211_rtw_dump_station (struct wiphy * wiphy , struct net_device * ndev ,
5822+ static int cfg80211_rtw_dump_station (struct wiphy * wiphy , RTW_WDEV_ARG ,
58005823 int idx , u8 * mac , struct station_info * sinfo )
58015824{
5825+ RTW_WDEV_GET ;
58025826#define DBG_DUMP_STATION 0
58035827
58045828 int ret = 0 ;
0 commit comments