mirror of
https://github.com/Mange/rtl8192eu-linux-driver
synced 2024-11-22 13:35:00 +00:00
Merge pull request #14 from CGarces/master
Add kernel-4.7 and 4.8 compatibility
This commit is contained in:
commit
f016814f0f
@ -74,7 +74,7 @@ static const u32 rtw_cipher_suites[] = {
|
||||
}
|
||||
|
||||
#define CHAN2G(_channel, _freq, _flags) { \
|
||||
.band = IEEE80211_BAND_2GHZ, \
|
||||
.band = NL80211_BAND_2GHZ, \
|
||||
.center_freq = (_freq), \
|
||||
.hw_value = (_channel), \
|
||||
.flags = (_flags), \
|
||||
@ -83,7 +83,7 @@ static const u32 rtw_cipher_suites[] = {
|
||||
}
|
||||
|
||||
#define CHAN5G(_channel, _flags) { \
|
||||
.band = IEEE80211_BAND_5GHZ, \
|
||||
.band = NL80211_BAND_5GHZ, \
|
||||
.center_freq = 5000 + (5 * (_channel)), \
|
||||
.hw_value = (_channel), \
|
||||
.flags = (_flags), \
|
||||
@ -200,18 +200,18 @@ void rtw_5g_rates_init(struct ieee80211_rate *rates)
|
||||
}
|
||||
|
||||
struct ieee80211_supported_band *rtw_spt_band_alloc(
|
||||
enum ieee80211_band band
|
||||
enum nl80211_band band
|
||||
)
|
||||
{
|
||||
struct ieee80211_supported_band *spt_band = NULL;
|
||||
int n_channels, n_bitrates;
|
||||
|
||||
if(band == IEEE80211_BAND_2GHZ)
|
||||
if(band == NL80211_BAND_2GHZ)
|
||||
{
|
||||
n_channels = RTW_2G_CHANNELS_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_bitrates = RTW_A_RATES_NUM;
|
||||
@ -235,12 +235,12 @@ struct ieee80211_supported_band *rtw_spt_band_alloc(
|
||||
spt_band->n_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);
|
||||
@ -260,13 +260,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
|
||||
@ -335,12 +335,12 @@ static int rtw_ieee80211_channel_to_frequency(int chan, int band)
|
||||
/* see 802.11 17.3.8.3.2 and Annex J
|
||||
* there are overlapping channel numbers in 5GHz and 2GHz bands */
|
||||
|
||||
if (band == IEEE80211_BAND_5GHZ) {
|
||||
if (band == NL80211_BAND_5GHZ) {
|
||||
if (chan >= 182 && chan <= 196)
|
||||
return 4000 + chan * 5;
|
||||
else
|
||||
return 5000 + chan * 5;
|
||||
} else { /* IEEE80211_BAND_2GHZ */
|
||||
} else { /* NL80211_BAND_2GHZ */
|
||||
if (chan == 14)
|
||||
return 2484;
|
||||
else if (chan < 14)
|
||||
@ -441,9 +441,9 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net
|
||||
DBG_871X("%s, got sr, but ssid mismatch, to remove this bss\n", __func__);
|
||||
|
||||
if (pselect_network->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL)
|
||||
freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_2GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, NL80211_BAND_2GHZ);
|
||||
else
|
||||
freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, IEEE80211_BAND_5GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(pselect_network->Configuration.DSConfig, NL80211_BAND_5GHZ);
|
||||
|
||||
notify_channel = ieee80211_get_channel(wiphy, freq);
|
||||
pselect_bss = cfg80211_get_bss(wiphy, NULL/*notify_channel*/,
|
||||
@ -475,9 +475,9 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(_adapter *padapter, struct wlan_net
|
||||
|
||||
channel = pnetwork->network.Configuration.DSConfig;
|
||||
if (channel <= RTW_CH_MAX_2G_CHANNEL)
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ);
|
||||
else
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ);
|
||||
|
||||
notify_channel = ieee80211_get_channel(wiphy, freq);
|
||||
|
||||
@ -617,9 +617,9 @@ int rtw_cfg80211_check_bss(_adapter *padapter)
|
||||
return _FALSE;
|
||||
|
||||
if (pnetwork->Configuration.DSConfig <= RTW_CH_MAX_2G_CHANNEL)
|
||||
freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_2GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, NL80211_BAND_2GHZ);
|
||||
else
|
||||
freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, IEEE80211_BAND_5GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(pnetwork->Configuration.DSConfig, NL80211_BAND_5GHZ);
|
||||
|
||||
notify_channel = ieee80211_get_channel(padapter->rtw_wdev->wiphy, freq);
|
||||
bss = cfg80211_get_bss(padapter->rtw_wdev->wiphy, notify_channel,
|
||||
@ -771,9 +771,9 @@ check_bss:
|
||||
u16 channel = cur_network->network.Configuration.DSConfig;
|
||||
|
||||
if (channel <= RTW_CH_MAX_2G_CHANNEL)
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ);
|
||||
else
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ);
|
||||
|
||||
notify_channel = ieee80211_get_channel(wiphy, freq);
|
||||
#endif
|
||||
@ -1891,7 +1891,14 @@ void rtw_cfg80211_indicate_scan_done(_adapter *adapter, bool aborted)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)
|
||||
struct cfg80211_scan_info info = {
|
||||
.aborted = aborted
|
||||
};
|
||||
cfg80211_scan_done(pwdev_priv->scan_request, &info);
|
||||
#else
|
||||
cfg80211_scan_done(pwdev_priv->scan_request, aborted);
|
||||
#endif
|
||||
}
|
||||
|
||||
pwdev_priv->scan_request = NULL;
|
||||
@ -3400,9 +3407,9 @@ void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint f
|
||||
#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
|
||||
channel = pmlmeext->cur_channel;
|
||||
if (channel <= RTW_CH_MAX_2G_CHANNEL)
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ);
|
||||
else
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ);
|
||||
|
||||
#ifdef COMPAT_KERNEL_RELEASE
|
||||
rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
|
||||
@ -3445,9 +3452,9 @@ void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, unsigned char *da, u
|
||||
#else /* defined(RTW_USE_CFG80211_STA_EVENT) */
|
||||
channel = pmlmeext->cur_channel;
|
||||
if (channel <= RTW_CH_MAX_2G_CHANNEL)
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ);
|
||||
else
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ);
|
||||
|
||||
pmgmt_frame = mgmt_buf;
|
||||
pwlanhdr = (struct rtw_ieee80211_hdr *)pmgmt_frame;
|
||||
@ -4257,9 +4264,9 @@ void rtw_cfg80211_rx_action_p2p(_adapter *padapter, u8 *pmgmt_frame, uint frame_
|
||||
|
||||
indicate:
|
||||
if (channel <= RTW_CH_MAX_2G_CHANNEL)
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ);
|
||||
else
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
|
||||
@ -4297,9 +4304,9 @@ void rtw_cfg80211_rx_p2p_action_public(_adapter *padapter, u8 *pmgmt_frame, uint
|
||||
|
||||
indicate:
|
||||
if (channel <= RTW_CH_MAX_2G_CHANNEL)
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ);
|
||||
else
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
rtw_cfg80211_rx_mgmt(padapter, freq, 0, pmgmt_frame, frame_len, GFP_ATOMIC);
|
||||
@ -4327,9 +4334,9 @@ void rtw_cfg80211_rx_action(_adapter *adapter, u8 *frame, uint frame_len, const
|
||||
DBG_871X("RTW_Rx:category(%u), action(%u)\n", category, action);
|
||||
|
||||
if (channel <= RTW_CH_MAX_2G_CHANNEL)
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_2GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_2GHZ);
|
||||
else
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, IEEE80211_BAND_5GHZ);
|
||||
freq = rtw_ieee80211_channel_to_frequency(channel, NL80211_BAND_5GHZ);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE)
|
||||
rtw_cfg80211_rx_mgmt(adapter, freq, 0, frame, frame_len, GFP_ATOMIC);
|
||||
@ -5718,7 +5725,7 @@ int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len,
|
||||
|
||||
}
|
||||
|
||||
static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum ieee80211_band band, u8 rf_type)
|
||||
static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum nl80211_band band, u8 rf_type)
|
||||
{
|
||||
|
||||
#define MAX_BIT_RATE_40MHZ_MCS15 300 /* Mbps */
|
||||
@ -5742,7 +5749,7 @@ static void rtw_cfg80211_init_ht_capab(struct ieee80211_sta_ht_cap *ht_cap, enum
|
||||
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
|
||||
@ -5787,16 +5794,16 @@ void rtw_cfg80211_init_wiphy(_adapter *padapter)
|
||||
|
||||
/* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */
|
||||
{
|
||||
bands = wiphy->bands[IEEE80211_BAND_2GHZ];
|
||||
bands = wiphy->bands[NL80211_BAND_2GHZ];
|
||||
if(bands)
|
||||
rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_2GHZ, rf_type);
|
||||
rtw_cfg80211_init_ht_capab(&bands->ht_cap, NL80211_BAND_2GHZ, rf_type);
|
||||
}
|
||||
|
||||
/* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */
|
||||
{
|
||||
bands = wiphy->bands[IEEE80211_BAND_5GHZ];
|
||||
bands = wiphy->bands[NL80211_BAND_5GHZ];
|
||||
if(bands)
|
||||
rtw_cfg80211_init_ht_capab(&bands->ht_cap, IEEE80211_BAND_5GHZ, rf_type);
|
||||
rtw_cfg80211_init_ht_capab(&bands->ht_cap, NL80211_BAND_5GHZ, rf_type);
|
||||
}
|
||||
|
||||
/* init regulary domain */
|
||||
@ -5874,9 +5881,9 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *padapter, struct wiphy *wiphy)
|
||||
wiphy->n_cipher_suites = ARRAY_SIZE(rtw_cipher_suites);
|
||||
|
||||
/* if (padapter->registrypriv.wireless_mode & WIRELESS_11G) */
|
||||
wiphy->bands[IEEE80211_BAND_2GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_2GHZ);
|
||||
wiphy->bands[NL80211_BAND_2GHZ] = rtw_spt_band_alloc(NL80211_BAND_2GHZ);
|
||||
/* if (padapter->registrypriv.wireless_mode & WIRELESS_11A) */
|
||||
wiphy->bands[IEEE80211_BAND_5GHZ] = rtw_spt_band_alloc(IEEE80211_BAND_5GHZ);
|
||||
wiphy->bands[NL80211_BAND_5GHZ] = rtw_spt_band_alloc(NL80211_BAND_5GHZ);
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38) && LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0))
|
||||
wiphy->flags |= WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS;
|
||||
@ -6071,8 +6078,8 @@ void rtw_wdev_free(struct wireless_dev *wdev)
|
||||
if (!wdev)
|
||||
return;
|
||||
|
||||
rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_2GHZ]);
|
||||
rtw_spt_band_free(wdev->wiphy->bands[IEEE80211_BAND_5GHZ]);
|
||||
rtw_spt_band_free(wdev->wiphy->bands[NL80211_BAND_2GHZ]);
|
||||
rtw_spt_band_free(wdev->wiphy->bands[NL80211_BAND_5GHZ]);
|
||||
|
||||
wiphy_free(wdev->wiphy);
|
||||
|
||||
|
@ -143,7 +143,7 @@ static bool _rtw_is_radar_freq(u16 center_freq)
|
||||
static void _rtw_reg_apply_beaconing_flags(struct wiphy *wiphy,
|
||||
enum nl80211_reg_initiator initiator)
|
||||
{
|
||||
enum ieee80211_band band;
|
||||
enum nl80211_band band;
|
||||
struct ieee80211_supported_band *sband;
|
||||
const struct ieee80211_reg_rule *reg_rule;
|
||||
struct ieee80211_channel *ch;
|
||||
@ -205,9 +205,9 @@ static void _rtw_reg_apply_active_scan_flags(struct wiphy *wiphy,
|
||||
u32 bandwidth = 0;
|
||||
int r;
|
||||
|
||||
if (!wiphy->bands[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
|
||||
@ -258,10 +258,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];
|
||||
@ -298,12 +298,12 @@ static int rtw_ieee80211_channel_to_frequency(int chan, int band)
|
||||
/* see 802.11 17.3.8.3.2 and Annex J
|
||||
* there are overlapping channel numbers in 5GHz and 2GHz bands */
|
||||
|
||||
if (band == IEEE80211_BAND_5GHZ) {
|
||||
if (band == NL80211_BAND_5GHZ) {
|
||||
if (chan >= 182 && chan <= 196)
|
||||
return 4000 + chan * 5;
|
||||
else
|
||||
return 5000 + chan * 5;
|
||||
} else { /* IEEE80211_BAND_2GHZ */
|
||||
} else { /* NL80211_BAND_2GHZ */
|
||||
if (chan == 14)
|
||||
return 2484;
|
||||
else if (chan < 14)
|
||||
@ -348,11 +348,11 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy)
|
||||
if (channel <= 14)
|
||||
freq =
|
||||
rtw_ieee80211_channel_to_frequency(channel,
|
||||
IEEE80211_BAND_2GHZ);
|
||||
NL80211_BAND_2GHZ);
|
||||
else
|
||||
freq =
|
||||
rtw_ieee80211_channel_to_frequency(channel,
|
||||
IEEE80211_BAND_5GHZ);
|
||||
NL80211_BAND_5GHZ);
|
||||
|
||||
ch = ieee80211_get_channel(wiphy, freq);
|
||||
if (ch) {
|
||||
@ -393,11 +393,11 @@ static void _rtw_reg_apply_flags(struct wiphy *wiphy)
|
||||
if (channel <= 14)
|
||||
freq =
|
||||
rtw_ieee80211_channel_to_frequency(channel,
|
||||
IEEE80211_BAND_2GHZ);
|
||||
NL80211_BAND_2GHZ);
|
||||
else
|
||||
freq =
|
||||
rtw_ieee80211_channel_to_frequency(channel,
|
||||
IEEE80211_BAND_5GHZ);
|
||||
NL80211_BAND_5GHZ);
|
||||
|
||||
ch = ieee80211_get_channel(wiphy, freq);
|
||||
if (ch) {
|
||||
@ -544,4 +544,4 @@ int rtw_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
|
||||
|
||||
return _rtw_reg_notifier_apply(wiphy, request, reg);
|
||||
}
|
||||
#endif //CONFIG_IOCTL_CFG80211
|
||||
#endif //CONFIG_IOCTL_CFG80211
|
||||
|
Loading…
Reference in New Issue
Block a user