diff --git a/include/osdep_intf.h b/include/osdep_intf.h index 8b8679f..3c927a1 100644 --- a/include/osdep_intf.h +++ b/include/osdep_intf.h @@ -124,8 +124,10 @@ void rtw_os_ndevs_deinit(struct dvobj_priv *dvobj); u16 rtw_recv_select_queue(struct sk_buff *skb); #endif //LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35) +#if (LINUX_VERSION_CODEn_channels = n_channels; spt_band->n_bitrates = n_bitrates; - if(band == IEEE80211_BAND_2GHZ) + if(band == NL80211_BAND_2GHZ) { rtw_2g_channels_init(spt_band->channels); rtw_2g_rates_init(spt_band->bitrates); } - else if(band == IEEE80211_BAND_5GHZ) + else if(band == NL80211_BAND_5GHZ) { rtw_5g_channels_init(spt_band->channels); rtw_5g_rates_init(spt_band->bitrates); @@ -285,13 +285,13 @@ void rtw_spt_band_free(struct ieee80211_supported_band *spt_band) if(!spt_band) return; - if(spt_band->band == IEEE80211_BAND_2GHZ) + if(spt_band->band == NL80211_BAND_2GHZ) { size = sizeof(struct ieee80211_supported_band) + sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM + sizeof(struct ieee80211_rate)*RTW_G_RATES_NUM; } - else if(spt_band->band == IEEE80211_BAND_5GHZ) + else if(spt_band->band == NL80211_BAND_5GHZ) { size = sizeof(struct ieee80211_supported_band) + sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM @@ -810,6 +810,19 @@ check_bss: #endif DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter)); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) + { + struct cfg80211_roam_info roam_info = { + .channel = notify_channel, + .bssid = cur_network->network.MacAddress, + .req_ie = pmlmepriv->assoc_req+sizeof(struct rtw_ieee80211_hdr_3addr)+2, + .req_ie_len = pmlmepriv->assoc_req_len-sizeof(struct rtw_ieee80211_hdr_3addr)-2, + .resp_ie = pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6, + .resp_ie_len = pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6, + }; + cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC); + } + #else cfg80211_roamed(padapter->pnetdev #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE) , notify_channel @@ -820,6 +833,7 @@ check_bss: , pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6 , pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6 , GFP_ATOMIC); + #endif } else { @@ -1901,10 +1915,17 @@ enum nl80211_iftype { NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1 }; */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) +static int cfg80211_rtw_change_iface(struct wiphy *wiphy, + struct net_device *ndev, + enum nl80211_iftype type, + struct vif_params *params) +#else static int cfg80211_rtw_change_iface(struct wiphy *wiphy, struct net_device *ndev, enum nl80211_iftype type, u32 *flags, struct vif_params *params) +#endif { enum nl80211_iftype old_type; NDIS_802_11_NETWORK_INFRASTRUCTURE networkType; @@ -4027,6 +4048,7 @@ static int unsigned char name_assign_type, #endif enum nl80211_iftype type, u32 *flags, struct vif_params *params) + #endif { int ret = 0; struct net_device* ndev = NULL; @@ -6374,7 +6396,7 @@ static void rtw_cfg80211_init_ht_capab(_adapter *padapter, struct ieee80211_sta_ ht_cap->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; /* - *hw->wiphy->bands[IEEE80211_BAND_2GHZ] + *hw->wiphy->bands[NL80211_BAND_2GHZ] *base on ant_num *rx_mask: RX mask *if rx_ant =1 rx_mask[0]=0xff;==>MCS0-MCS7 @@ -6532,7 +6554,11 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy) #endif #if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; +#else // kernel >= 4.12 + wiphy->max_sched_scan_reqs = 1; +#endif #ifdef CONFIG_PNO_SUPPORT wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT; #endif diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 8bf1741..acf594f 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -978,7 +978,6 @@ u16 rtw_recv_select_queue(struct sk_buff *skb) return rtw_1d_to_queue[priority]; } - #endif static int rtw_ndev_notifier_call(struct notifier_block * nb, unsigned long state, void *ptr) { @@ -1031,7 +1030,7 @@ void rtw_ndev_notifier_unregister(void) { unregister_netdevice_notifier(&rtw_ndev_notifier); } - +#endif int rtw_ndev_init(struct net_device *dev) { @@ -1071,9 +1070,15 @@ static const struct net_device_ops rtw_netdev_ops = { }; #endif +static const struct device_type wlan_type = { + .name = "wlan", +}; + int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) { - _adapter *padapter = rtw_netdev_priv(pnetdev); + _adapter *padapter; + pnetdev->dev.type = &wlan_type; + padapter = rtw_netdev_priv(pnetdev); #ifdef CONFIG_EASY_REPLACEMENT struct net_device *TargetNetdev = NULL; diff --git a/os_dep/linux/rtw_android.c b/os_dep/linux/rtw_android.c index abf03b7..3225b81 100644 --- a/os_dep/linux/rtw_android.c +++ b/os_dep/linux/rtw_android.c @@ -351,8 +351,12 @@ int rtw_android_cmdstr_to_num(char *cmdstr) { int cmd_num; for(cmd_num=0 ; cmd_num= KERNEL_VERSION(4, 0, 0)) + if(!strncasecmp(cmdstr , android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num])) ) +#else + if(0 == strnicmp(cmdstr , android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num])) ) +#endif + break; return cmd_num; } diff --git a/os_dep/linux/usb_intf.c b/os_dep/linux/usb_intf.c index 622f5c3..9897757 100644 --- a/os_dep/linux/usb_intf.c +++ b/os_dep/linux/usb_intf.c @@ -1657,15 +1657,18 @@ static int __init rtw_drv_entry(void) usb_drv.drv_registered = _TRUE; rtw_suspend_lock_init(); rtw_drv_proc_init(); +#if (LINUX_VERSION_CODEbands[IEEE80211_BAND_2GHZ]) + if (!wiphy->bands[NL80211_BAND_2GHZ]) return; - sband = wiphy->bands[IEEE80211_BAND_2GHZ]; + sband = wiphy->bands[NL80211_BAND_2GHZ]; /* * If no country IE has been received always enable active scan @@ -264,10 +264,10 @@ static void _rtw_reg_apply_radar_flags(struct wiphy *wiphy) struct ieee80211_channel *ch; unsigned int i; - if (!wiphy->bands[IEEE80211_BAND_5GHZ]) + if (!wiphy->bands[NL80211_BAND_5GHZ]) return; - sband = wiphy->bands[IEEE80211_BAND_5GHZ]; + sband = wiphy->bands[NL80211_BAND_5GHZ]; for (i = 0; i < sband->n_channels; i++) { ch = &sband->channels[i];