Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/wifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ typedef enum _HT_CAP_AMPDU_DENSITY {
* According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
*/
#define IEEE80211_MIN_AMPDU_BUF 0x8
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
#define IEEE80211_MAX_AMPDU_BUF_HT 0x40
#define IEEE80211_MAX_AMPDU_BUF 0x100
#else
Expand Down
120 changes: 63 additions & 57 deletions os_dep/linux/ioctl_cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -883,11 +883,12 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net
}
}
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
cfg80211_put_bss(wiphy, bss);
#else
cfg80211_put_bss(bss);
cfg80211_put_bss(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0))
wiphy,
#endif
bss
);

exit:
if (pbuf)
Expand Down Expand Up @@ -917,18 +918,21 @@ int rtw_cfg80211_check_bss(_adapter *padapter)
bss = cfg80211_get_bss(padapter->rtw_wdev->wiphy, notify_channel,
pnetwork->MacAddress, pnetwork->Ssid.Ssid,
pnetwork->Ssid.SsidLength,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
pnetwork->InfrastructureMode == Ndis802_11Infrastructure?IEEE80211_BSS_TYPE_ESS:IEEE80211_BSS_TYPE_IBSS,
IEEE80211_PRIVACY(pnetwork->Privacy));
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
pnetwork->InfrastructureMode == Ndis802_11Infrastructure ? IEEE80211_BSS_TYPE_ESS : IEEE80211_BSS_TYPE_IBSS,
IEEE80211_PRIVACY(pnetwork->Privacy)
#else
pnetwork->InfrastructureMode == Ndis802_11Infrastructure?WLAN_CAPABILITY_ESS:WLAN_CAPABILITY_IBSS, pnetwork->InfrastructureMode == Ndis802_11Infrastructure?WLAN_CAPABILITY_ESS:WLAN_CAPABILITY_IBSS);
pnetwork->InfrastructureMode == Ndis802_11Infrastructure ? WLAN_CAPABILITY_ESS : WLAN_CAPABILITY_IBSS,
pnetwork->InfrastructureMode == Ndis802_11Infrastructure ? WLAN_CAPABILITY_ESS : WLAN_CAPABILITY_IBSS
#endif
);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
cfg80211_put_bss(padapter->rtw_wdev->wiphy, bss);
#else
cfg80211_put_bss(bss);
cfg80211_put_bss(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0))
padapter->rtw_wdev->wiphy,
#endif
bss
);

return bss != NULL;
}
Expand Down Expand Up @@ -1008,7 +1012,7 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter)
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))
struct cfg80211_roam_info roam_info ={};
#endif

Expand Down Expand Up @@ -1071,42 +1075,42 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter)
_enter_critical_bh(&pwdev_priv->connect_req_lock, &irqL);

if (rtw_to_roam(padapter) > 0) {
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE)
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || defined(COMPAT_KERNEL_RELEASE)
struct wiphy *wiphy = pwdev->wiphy;
struct ieee80211_channel *notify_channel;
u32 freq;
u16 channel = cur_network->network.Configuration.DSConfig;

freq = rtw_ch2freq(channel);
notify_channel = ieee80211_get_channel(wiphy, freq);
#endif
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0))
roam_info.channel = notify_channel;
roam_info.bssid = cur_network->network.MacAddress;
#else
#else
roam_info.links[0].channel = notify_channel;
roam_info.links[0].bssid = cur_network->network.MacAddress;
#endif
#endif
roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2;
roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2;
roam_info.resp_ie = pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6;
roam_info.resp_ie_len = pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6;

cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC);
#else
#else
cfg80211_roamed(padapter->pnetdev
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE)
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || defined(COMPAT_KERNEL_RELEASE)
, notify_channel
#endif
#endif
, cur_network->network.MacAddress
, pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2
, pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2
, pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6
, pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6
, GFP_ATOMIC);
#endif /*LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)*/
#endif /*LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)*/

RTW_INFO(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter));

Expand All @@ -1115,9 +1119,9 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter)
rtw_ft_set_status(padapter, RTW_FT_ASSOCIATED_STA);
#endif
} else {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE)
RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state);
#endif
#endif

if (check_fwstate(pmlmepriv, WIFI_MONITOR_STATE) != _TRUE)
rtw_cfg80211_connect_result(pwdev, cur_network->network.MacAddress
Expand All @@ -1126,9 +1130,9 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter)
, pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6
, pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6
, WLAN_STATUS_SUCCESS, GFP_ATOMIC);
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE)
RTW_INFO("pwdev->sme_state(a)=%d\n", pwdev->sme_state);
#endif
#endif
}

rtw_wdev_free_connect_req(pwdev_priv);
Expand Down Expand Up @@ -1166,11 +1170,11 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally
if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) {
rtw_p2p_set_state(pwdinfo, rtw_p2p_pre_state(pwdinfo));

#if RTW_P2P_GROUP_INTERFACE
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
#if RTW_P2P_GROUP_INTERFACE
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
if (pwdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
#endif
#endif
#endif
#endif
rtw_p2p_set_role(pwdinfo, P2P_ROLE_DEVICE);

RTW_INFO("%s, role=%d, p2p_state=%d, pre_p2p_state=%d\n", __func__, rtw_p2p_role(pwdinfo), rtw_p2p_state(pwdinfo), rtw_p2p_pre_state(pwdinfo));
Expand All @@ -1181,7 +1185,7 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally
_enter_critical_bh(&pwdev_priv->connect_req_lock, &irqL);

if (padapter->ndev_unregistering || !rtw_wdev_not_indic_disco(pwdev_priv)) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0) || defined(COMPAT_KERNEL_RELEASE)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE)
RTW_INFO("pwdev->sme_state(b)=%d\n", pwdev->sme_state);

if (pwdev->sme_state == CFG80211_SME_CONNECTING) {
Expand All @@ -1194,7 +1198,7 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally
}

RTW_INFO("pwdev->sme_state(a)=%d\n", pwdev->sme_state);
#else
#else
if (pwdev_priv->connect_req) {
RTW_INFO(FUNC_ADPT_FMT" call cfg80211_connect_result\n", FUNC_ADPT_ARG(padapter));
rtw_cfg80211_connect_result(pwdev, NULL, NULL, 0, NULL, 0,
Expand All @@ -1203,7 +1207,7 @@ void rtw_cfg80211_indicate_disconnect(_adapter *padapter, u16 reason, u8 locally
RTW_INFO(FUNC_ADPT_FMT" call cfg80211_disconnected\n", FUNC_ADPT_ARG(padapter));
rtw_cfg80211_disconnected(pwdev, reason, NULL, 0, locally_generated, GFP_ATOMIC);
}
#endif
#endif
}

rtw_wdev_free_connect_req(pwdev_priv);
Expand Down Expand Up @@ -2464,7 +2468,7 @@ void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted)
struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter);
_irqL irqL;

#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
struct cfg80211_scan_info info;

memset(&info, 0, sizeof(info));
Expand All @@ -2481,7 +2485,7 @@ void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted)
if (pwdev_priv->scan_request->wiphy != pwdev_priv->rtw_wdev->wiphy)
RTW_INFO("error wiphy compare\n");
else
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
cfg80211_scan_done(pwdev_priv->scan_request, &info);
#else
cfg80211_scan_done(pwdev_priv->scan_request, aborted);
Expand Down Expand Up @@ -2537,22 +2541,24 @@ void rtw_cfg80211_unlink_bss(_adapter *padapter, struct wlan_network *pnetwork)
bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/,
select_network.MacAddress, select_network.Ssid.Ssid,
select_network.Ssid.SsidLength,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0)
select_network.InfrastructureMode == Ndis802_11Infrastructure?IEEE80211_BSS_TYPE_ESS:IEEE80211_BSS_TYPE_IBSS,
IEEE80211_PRIVACY(select_network.Privacy));
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
select_network.InfrastructureMode == Ndis802_11Infrastructure ? IEEE80211_BSS_TYPE_ESS : IEEE80211_BSS_TYPE_IBSS,
IEEE80211_PRIVACY(select_network.Privacy)
#else
select_network.InfrastructureMode == Ndis802_11Infrastructure?WLAN_CAPABILITY_ESS:WLAN_CAPABILITY_IBSS,
select_network.InfrastructureMode == Ndis802_11Infrastructure?WLAN_CAPABILITY_ESS:WLAN_CAPABILITY_IBSS);
select_network.InfrastructureMode == Ndis802_11Infrastructure ? WLAN_CAPABILITY_ESS:WLAN_CAPABILITY_IBSS,
select_network.InfrastructureMode == Ndis802_11Infrastructure ? WLAN_CAPABILITY_ESS:WLAN_CAPABILITY_IBSS
#endif
);

if (bss) {
cfg80211_unlink_bss(wiphy, bss);
RTW_INFO("%s(): cfg80211_unlink %s!!\n", __func__, select_network.Ssid.Ssid);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
cfg80211_put_bss(padapter->rtw_wdev->wiphy, bss);
#else
cfg80211_put_bss(bss);
cfg80211_put_bss(
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0))
padapter->rtw_wdev->wiphy,
#endif
bss
);
}
return;
}
Expand Down Expand Up @@ -3182,15 +3188,15 @@ static int cfg80211_rtw_scan(struct wiphy *wiphy

check_need_indicate_scan_done:
if (_TRUE == need_indicate_scan_done) {
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
struct cfg80211_scan_info info;

memset(&info, 0, sizeof(info));
info.aborted = 0;
#endif

_rtw_cfg80211_surveydone_event_callback(padapter, request);
#if (KERNEL_VERSION(4, 7, 0) <= LINUX_VERSION_CODE)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
cfg80211_scan_done(request, &info);
#else
cfg80211_scan_done(request, 0);
Expand Down Expand Up @@ -4985,12 +4991,12 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd
return ret;
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 2)
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
#else
static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id)
static int cfg80211_rtw_stop_ap(
struct wiphy *wiphy, struct net_device *ndev
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2))
, unsigned int link_id
#endif
{
) {
_adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);

RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev));
Expand Down Expand Up @@ -8602,9 +8608,9 @@ static int cfg80211_rtw_sched_scan_start(struct wiphy *wiphy,
RTW_INFO("%s: invalid cfg80211_requests parameters.\n", __func__);
return -EINVAL;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
interval = request->scan_plans->interval;
#else
interval = request->interval;
Expand All @@ -8625,7 +8631,7 @@ static int cfg80211_rtw_sched_scan_start(struct wiphy *wiphy,
n_ssids = request->n_ssids;
ssids = request->ssids;
#endif
ret = rtw_android_cfg80211_pno_setup(dev, ssids,
ret = rtw_android_cfg80211_pno_setup(dev, ssids,
n_ssids, interval);
if (ret < 0) {
RTW_INFO("%s ret: %d\n", __func__, ret);
Expand Down Expand Up @@ -9376,7 +9382,7 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy)
wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
#ifdef CONFIG_PNO_SUPPORT
wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
wiphy->max_match_sets = MAX_PNO_LIST_COUNT;
#endif
#endif
Expand Down Expand Up @@ -9904,7 +9910,7 @@ void rtw_wdev_unregister(struct wireless_dev *wdev)
rtw_cfg80211_indicate_scan_done(adapter, _TRUE);

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE)
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 2)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 2))
if (wdev->current_bss) {
#else
if (wdev->connected) {
Expand Down
2 changes: 1 addition & 1 deletion os_dep/linux/ioctl_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -9787,7 +9787,7 @@ static int rtw_mp_efuse_set(struct net_device *dev,
/* set mac addr*/
rtw_macaddr_cfg(adapter_mac_addr(padapter), get_hal_mac_addr(padapter));

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0))
_rtw_memcpy(padapter->pnetdev->dev_addr, get_hal_mac_addr(padapter), ETH_ALEN); /* set mac addr to net_device */
#else
eth_hw_addr_set(padapter->pnetdev, get_hal_mac_addr(padapter));
Expand Down
8 changes: 4 additions & 4 deletions os_dep/linux/mlme_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,11 @@ int hostapd_mode_init(_adapter *padapter)
mac[4] = 0x11;
mac[5] = 0x12;

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0))
_rtw_memcpy(pnetdev->dev_addr, mac, ETH_ALEN);
#else
eth_hw_addr_set(pnetdev, mac);
#endif
#else
eth_hw_addr_set(pnetdev, mac);
#endif


rtw_netif_carrier_off(pnetdev);
Expand Down
Loading