Merge branch 'master' into v4.4.1

This commit is contained in:
Carlos Garcés 2017-05-27 15:57:17 +02:00 committed by GitHub
commit aa5570d0d1
6 changed files with 63 additions and 21 deletions

View File

@ -124,8 +124,10 @@ void rtw_os_ndevs_deinit(struct dvobj_priv *dvobj);
u16 rtw_recv_select_queue(struct sk_buff *skb); u16 rtw_recv_select_queue(struct sk_buff *skb);
#endif //LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35) #endif //LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)
#if (LINUX_VERSION_CODE<KERNEL_VERSION(3, 11, 0))
int rtw_ndev_notifier_register(void); int rtw_ndev_notifier_register(void);
void rtw_ndev_notifier_unregister(void); void rtw_ndev_notifier_unregister(void);
#endif
#include "../os_dep/linux/rtw_proc.h" #include "../os_dep/linux/rtw_proc.h"

View File

@ -99,7 +99,7 @@ static const u32 rtw_cipher_suites[] = {
} }
#define CHAN2G(_channel, _freq, _flags) { \ #define CHAN2G(_channel, _freq, _flags) { \
.band = IEEE80211_BAND_2GHZ, \ .band = NL80211_BAND_2GHZ, \
.center_freq = (_freq), \ .center_freq = (_freq), \
.hw_value = (_channel), \ .hw_value = (_channel), \
.flags = (_flags), \ .flags = (_flags), \
@ -108,7 +108,7 @@ static const u32 rtw_cipher_suites[] = {
} }
#define CHAN5G(_channel, _flags) { \ #define CHAN5G(_channel, _flags) { \
.band = IEEE80211_BAND_5GHZ, \ .band = NL80211_BAND_5GHZ, \
.center_freq = 5000 + (5 * (_channel)), \ .center_freq = 5000 + (5 * (_channel)), \
.hw_value = (_channel), \ .hw_value = (_channel), \
.flags = (_flags), \ .flags = (_flags), \
@ -225,18 +225,18 @@ void rtw_5g_rates_init(struct ieee80211_rate *rates)
} }
struct ieee80211_supported_band *rtw_spt_band_alloc( struct ieee80211_supported_band *rtw_spt_band_alloc(
enum ieee80211_band band enum nl80211_band band
) )
{ {
struct ieee80211_supported_band *spt_band = NULL; struct ieee80211_supported_band *spt_band = NULL;
int n_channels, n_bitrates; int n_channels, n_bitrates;
if(band == IEEE80211_BAND_2GHZ) if(band == NL80211_BAND_2GHZ)
{ {
n_channels = RTW_2G_CHANNELS_NUM; n_channels = RTW_2G_CHANNELS_NUM;
n_bitrates = RTW_G_RATES_NUM; n_bitrates = RTW_G_RATES_NUM;
} }
else if(band == IEEE80211_BAND_5GHZ) else if(band == NL80211_BAND_5GHZ)
{ {
n_channels = RTW_5G_CHANNELS_NUM; n_channels = RTW_5G_CHANNELS_NUM;
n_bitrates = RTW_A_RATES_NUM; n_bitrates = RTW_A_RATES_NUM;
@ -260,12 +260,12 @@ struct ieee80211_supported_band *rtw_spt_band_alloc(
spt_band->n_channels = n_channels; spt_band->n_channels = n_channels;
spt_band->n_bitrates = n_bitrates; 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_channels_init(spt_band->channels);
rtw_2g_rates_init(spt_band->bitrates); 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_channels_init(spt_band->channels);
rtw_5g_rates_init(spt_band->bitrates); 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) if(!spt_band)
return; return;
if(spt_band->band == IEEE80211_BAND_2GHZ) if(spt_band->band == NL80211_BAND_2GHZ)
{ {
size = sizeof(struct ieee80211_supported_band) size = sizeof(struct ieee80211_supported_band)
+ sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM + sizeof(struct ieee80211_channel)*RTW_2G_CHANNELS_NUM
+ sizeof(struct ieee80211_rate)*RTW_G_RATES_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) size = sizeof(struct ieee80211_supported_band)
+ sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM + sizeof(struct ieee80211_channel)*RTW_5G_CHANNELS_NUM
@ -810,6 +810,19 @@ check_bss:
#endif #endif
DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter)); 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 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 , notify_channel
@ -820,6 +833,7 @@ check_bss:
, pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6 , pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6
, pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6 , pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6
, GFP_ATOMIC); , GFP_ATOMIC);
#endif
} }
else else
{ {
@ -1901,10 +1915,17 @@ enum nl80211_iftype {
NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1 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, static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
struct net_device *ndev, struct net_device *ndev,
enum nl80211_iftype type, u32 *flags, enum nl80211_iftype type, u32 *flags,
struct vif_params *params) struct vif_params *params)
#endif
{ {
enum nl80211_iftype old_type; enum nl80211_iftype old_type;
NDIS_802_11_NETWORK_INFRASTRUCTURE networkType; NDIS_802_11_NETWORK_INFRASTRUCTURE networkType;
@ -4027,6 +4048,7 @@ static int
unsigned char name_assign_type, unsigned char name_assign_type,
#endif #endif
enum nl80211_iftype type, u32 *flags, struct vif_params *params) enum nl80211_iftype type, u32 *flags, struct vif_params *params)
#endif
{ {
int ret = 0; int ret = 0;
struct net_device* ndev = NULL; 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; 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 *base on ant_num
*rx_mask: RX mask *rx_mask: RX mask
*if rx_ant =1 rx_mask[0]=0xff;==>MCS0-MCS7 *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 #endif
#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) #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; wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
#else // kernel >= 4.12
wiphy->max_sched_scan_reqs = 1;
#endif
#ifdef CONFIG_PNO_SUPPORT #ifdef CONFIG_PNO_SUPPORT
wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT; wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT;
#endif #endif

View File

@ -978,7 +978,6 @@ u16 rtw_recv_select_queue(struct sk_buff *skb)
return rtw_1d_to_queue[priority]; return rtw_1d_to_queue[priority];
} }
#endif #endif
static int rtw_ndev_notifier_call(struct notifier_block * nb, unsigned long state, void *ptr) 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); unregister_netdevice_notifier(&rtw_ndev_notifier);
} }
#endif
int rtw_ndev_init(struct net_device *dev) int rtw_ndev_init(struct net_device *dev)
{ {
@ -1071,9 +1070,15 @@ static const struct net_device_ops rtw_netdev_ops = {
}; };
#endif #endif
static const struct device_type wlan_type = {
.name = "wlan",
};
int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) 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 #ifdef CONFIG_EASY_REPLACEMENT
struct net_device *TargetNetdev = NULL; struct net_device *TargetNetdev = NULL;

View File

@ -351,8 +351,12 @@ int rtw_android_cmdstr_to_num(char *cmdstr)
{ {
int cmd_num; int cmd_num;
for(cmd_num=0 ; cmd_num<ANDROID_WIFI_CMD_MAX; cmd_num++) for(cmd_num=0 ; cmd_num<ANDROID_WIFI_CMD_MAX; cmd_num++)
if(0 == strnicmp(cmdstr , android_wifi_cmd_str[cmd_num], strlen(android_wifi_cmd_str[cmd_num])) ) #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
break; 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; return cmd_num;
} }

View File

@ -1657,15 +1657,18 @@ static int __init rtw_drv_entry(void)
usb_drv.drv_registered = _TRUE; usb_drv.drv_registered = _TRUE;
rtw_suspend_lock_init(); rtw_suspend_lock_init();
rtw_drv_proc_init(); rtw_drv_proc_init();
#if (LINUX_VERSION_CODE<KERNEL_VERSION(3, 11, 0))
rtw_ndev_notifier_register(); rtw_ndev_notifier_register();
#endif
ret = usb_register(&usb_drv.usbdrv); ret = usb_register(&usb_drv.usbdrv);
if (ret != 0) { if (ret != 0) {
usb_drv.drv_registered = _FALSE; usb_drv.drv_registered = _FALSE;
rtw_suspend_lock_uninit(); rtw_suspend_lock_uninit();
rtw_drv_proc_deinit(); rtw_drv_proc_deinit();
#if (LINUX_VERSION_CODE<KERNEL_VERSION(3, 11, 0))
rtw_ndev_notifier_unregister(); rtw_ndev_notifier_unregister();
#endif
goto exit; goto exit;
} }
@ -1686,7 +1689,9 @@ static void __exit rtw_drv_halt(void)
rtw_suspend_lock_uninit(); rtw_suspend_lock_uninit();
rtw_drv_proc_deinit(); rtw_drv_proc_deinit();
#if (LINUX_VERSION_CODE<KERNEL_VERSION(3, 11, 0))
rtw_ndev_notifier_unregister(); rtw_ndev_notifier_unregister();
#endif
DBG_871X_LEVEL(_drv_always_, "module exit success\n"); DBG_871X_LEVEL(_drv_always_, "module exit success\n");

View File

@ -149,7 +149,7 @@ static bool _rtw_is_radar_freq(u16 center_freq)
static void _rtw_reg_apply_beaconing_flags(struct wiphy *wiphy, static void _rtw_reg_apply_beaconing_flags(struct wiphy *wiphy,
enum nl80211_reg_initiator initiator) enum nl80211_reg_initiator initiator)
{ {
enum ieee80211_band band; enum nl80211_band band;
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
const struct ieee80211_reg_rule *reg_rule; const struct ieee80211_reg_rule *reg_rule;
struct ieee80211_channel *ch; struct ieee80211_channel *ch;
@ -211,9 +211,9 @@ static void _rtw_reg_apply_active_scan_flags(struct wiphy *wiphy,
u32 bandwidth = 0; u32 bandwidth = 0;
int r; int r;
if (!wiphy->bands[IEEE80211_BAND_2GHZ]) if (!wiphy->bands[NL80211_BAND_2GHZ])
return; return;
sband = wiphy->bands[IEEE80211_BAND_2GHZ]; sband = wiphy->bands[NL80211_BAND_2GHZ];
/* /*
* If no country IE has been received always enable active scan * 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; struct ieee80211_channel *ch;
unsigned int i; unsigned int i;
if (!wiphy->bands[IEEE80211_BAND_5GHZ]) if (!wiphy->bands[NL80211_BAND_5GHZ])
return; return;
sband = wiphy->bands[IEEE80211_BAND_5GHZ]; sband = wiphy->bands[NL80211_BAND_5GHZ];
for (i = 0; i < sband->n_channels; i++) { for (i = 0; i < sband->n_channels; i++) {
ch = &sband->channels[i]; ch = &sband->channels[i];