qcacld-3.0: 4.8 Kernel Migration - Remove ieee80211_band
Update references from enum ieee80211_band to nl80211_band, as
ieee80211_band was removed in version 4.7 of the Linux Kernel.
Change-Id: Id42cf6e20c3ebe921546d11fd22c3909aeb84ddd
CRs-Fixed: 1077221
(cherry picked from commit 8e62ee9836406b81fe3e418028cdb2ae8f5ec039)
diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c
index 84b87a3..cd90e9f 100644
--- a/core/hdd/src/wlan_hdd_assoc.c
+++ b/core/hdd/src/wlan_hdd_assoc.c
@@ -3004,10 +3004,10 @@
if (chan_no <= 14)
freq = ieee80211_channel_to_frequency(chan_no,
- IEEE80211_BAND_2GHZ);
+ NL80211_BAND_2GHZ);
else
freq = ieee80211_channel_to_frequency(chan_no,
- IEEE80211_BAND_5GHZ);
+ NL80211_BAND_5GHZ);
chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq);
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index b8ed55b..6da8f45 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -118,7 +118,7 @@
#define IBSS_CFG_PROTECTION_ENABLE_MASK 0x8282
#define HDD2GHZCHAN(freq, chan, flag) { \
- .band = IEEE80211_BAND_2GHZ, \
+ .band = NL80211_BAND_2GHZ, \
.center_freq = (freq), \
.hw_value = (chan), \
.flags = (flag), \
@@ -127,7 +127,7 @@
}
#define HDD5GHZCHAN(freq, chan, flag) { \
- .band = IEEE80211_BAND_5GHZ, \
+ .band = NL80211_BAND_5GHZ, \
.center_freq = (freq), \
.hw_value = (chan), \
.flags = (flag), \
@@ -265,7 +265,7 @@
static struct ieee80211_supported_band wlan_hdd_band_2_4_ghz = {
.channels = NULL,
.n_channels = ARRAY_SIZE(hdd_channels_2_4_ghz),
- .band = IEEE80211_BAND_2GHZ,
+ .band = NL80211_BAND_2GHZ,
.bitrates = g_mode_rates,
.n_bitrates = g_mode_rates_size,
.ht_cap.ht_supported = 1,
@@ -284,7 +284,7 @@
static struct ieee80211_supported_band wlan_hdd_band_5_ghz = {
.channels = NULL,
.n_channels = ARRAY_SIZE(hdd_channels_5_ghz),
- .band = IEEE80211_BAND_5GHZ,
+ .band = NL80211_BAND_5GHZ,
.bitrates = a_mode_rates,
.n_bitrates = a_mode_rates_size,
.ht_cap.ht_supported = 1,
@@ -5265,11 +5265,11 @@
if (pcl[i] <= ARRAY_SIZE(hdd_channels_2_4_ghz))
freq_list[i] =
ieee80211_channel_to_frequency(pcl[i],
- IEEE80211_BAND_2GHZ);
+ NL80211_BAND_2GHZ);
else
freq_list[i] =
ieee80211_channel_to_frequency(pcl[i],
- IEEE80211_BAND_5GHZ);
+ NL80211_BAND_5GHZ);
}
/* send the freq_list back to supplicant */
@@ -8625,7 +8625,7 @@
ENTER();
- for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
+ for (i = 0; i < NUM_NL80211_BANDS; i++) {
if (NULL == wiphy->bands[i])
continue;
@@ -8637,7 +8637,7 @@
cds_get_channel_state(band->channels[j].
hw_value);
- if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) {
+ if (NL80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) {
/* 5G only */
#ifdef WLAN_ENABLE_SOCIAL_CHANNELS_5G_ONLY
/* Enable Social channels for P2P */
@@ -8652,7 +8652,7 @@
band->channels[j].flags |=
IEEE80211_CHAN_DISABLED;
continue;
- } else if (IEEE80211_BAND_5GHZ == i &&
+ } else if (NL80211_BAND_5GHZ == i &&
eCSR_BAND_24 == eBand) {
/* 2G only */
band->channels[j].flags |=
@@ -8812,14 +8812,14 @@
* wiphy flags don't get reset because of static memory.
* It's better not to store channel in static memory.
*/
- wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_ghz;
- wiphy->bands[IEEE80211_BAND_2GHZ]->channels =
+ wiphy->bands[NL80211_BAND_2GHZ] = &wlan_hdd_band_2_4_ghz;
+ wiphy->bands[NL80211_BAND_2GHZ]->channels =
qdf_mem_malloc(sizeof(hdd_channels_2_4_ghz));
- if (wiphy->bands[IEEE80211_BAND_2GHZ]->channels == NULL) {
+ if (wiphy->bands[NL80211_BAND_2GHZ]->channels == NULL) {
hdd_err("Not enough memory to allocate channels");
return -ENOMEM;
}
- qdf_mem_copy(wiphy->bands[IEEE80211_BAND_2GHZ]->channels,
+ qdf_mem_copy(wiphy->bands[NL80211_BAND_2GHZ]->channels,
&hdd_channels_2_4_ghz[0],
sizeof(hdd_channels_2_4_ghz));
if ((hdd_is_5g_supported(pHddCtx)) &&
@@ -8827,22 +8827,22 @@
(eHDD_DOT11_MODE_11g != pCfg->dot11Mode) &&
(eHDD_DOT11_MODE_11b_ONLY != pCfg->dot11Mode) &&
(eHDD_DOT11_MODE_11g_ONLY != pCfg->dot11Mode))) {
- wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_ghz;
- wiphy->bands[IEEE80211_BAND_5GHZ]->channels =
+ wiphy->bands[NL80211_BAND_5GHZ] = &wlan_hdd_band_5_ghz;
+ wiphy->bands[NL80211_BAND_5GHZ]->channels =
qdf_mem_malloc(sizeof(hdd_channels_5_ghz));
- if (wiphy->bands[IEEE80211_BAND_5GHZ]->channels == NULL) {
+ if (wiphy->bands[NL80211_BAND_5GHZ]->channels == NULL) {
hdd_err("Not enough memory to allocate channels");
qdf_mem_free(wiphy->
- bands[IEEE80211_BAND_2GHZ]->channels);
- wiphy->bands[IEEE80211_BAND_2GHZ]->channels = NULL;
+ bands[NL80211_BAND_2GHZ]->channels);
+ wiphy->bands[NL80211_BAND_2GHZ]->channels = NULL;
return -ENOMEM;
}
- qdf_mem_copy(wiphy->bands[IEEE80211_BAND_5GHZ]->channels,
+ qdf_mem_copy(wiphy->bands[NL80211_BAND_5GHZ]->channels,
&hdd_channels_5_ghz[0],
sizeof(hdd_channels_5_ghz));
}
- for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
+ for (i = 0; i < NUM_NL80211_BANDS; i++) {
if (NULL == wiphy->bands[i])
continue;
@@ -8850,7 +8850,7 @@
for (j = 0; j < wiphy->bands[i]->n_channels; j++) {
struct ieee80211_supported_band *band = wiphy->bands[i];
- if (IEEE80211_BAND_2GHZ == i &&
+ if (NL80211_BAND_2GHZ == i &&
eCSR_BAND_5G == pCfg->nBandCapability) {
/* 5G only */
#ifdef WLAN_ENABLE_SOCIAL_CHANNELS_5G_ONLY
@@ -8864,7 +8864,7 @@
band->channels[j].flags |=
IEEE80211_CHAN_DISABLED;
continue;
- } else if (IEEE80211_BAND_5GHZ == i &&
+ } else if (NL80211_BAND_5GHZ == i &&
eCSR_BAND_24 == pCfg->nBandCapability) {
/* 2G only */
band->channels[j].flags |=
@@ -8921,7 +8921,7 @@
{
int i;
- for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
+ for (i = 0; i < NUM_NL80211_BANDS; i++) {
if (NULL != wiphy->bands[i] &&
(NULL != wiphy->bands[i]->channels)) {
qdf_mem_free(wiphy->bands[i]->channels);
@@ -10698,15 +10698,15 @@
}
if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_ghz) &&
- (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) {
+ (wiphy->bands[NL80211_BAND_2GHZ] != NULL)) {
freq =
ieee80211_channel_to_frequency(chan_no,
- IEEE80211_BAND_2GHZ);
+ NL80211_BAND_2GHZ);
} else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_ghz))
- && (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) {
+ && (wiphy->bands[NL80211_BAND_5GHZ] != NULL)) {
freq =
ieee80211_channel_to_frequency(chan_no,
- IEEE80211_BAND_5GHZ);
+ NL80211_BAND_5GHZ);
} else {
hdd_err("Invalid chan_no %d", chan_no);
kfree(mgmt);
diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h
index 602bef0..5cdaad8 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.h
+++ b/core/hdd/src/wlan_hdd_cfg80211.h
@@ -3224,4 +3224,13 @@
#endif
struct cfg80211_bss *wlan_hdd_cfg80211_inform_bss_frame(hdd_adapter_t *pAdapter,
tSirBssDescription *bss_desc);
+
+/*
+ * As of 4.7, ieee80211_band is removed; add shims so we can reference
+ * nl80211_band instead
+ */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0))
+#define NUM_NL80211_BANDS ((enum nl80211_band)IEEE80211_NUM_BANDS)
+#endif
+
#endif
diff --git a/core/hdd/src/wlan_hdd_ext_scan.c b/core/hdd/src/wlan_hdd_ext_scan.c
index d0a968d..558b15f 100644
--- a/core/hdd/src/wlan_hdd_ext_scan.c
+++ b/core/hdd/src/wlan_hdd_ext_scan.c
@@ -2455,7 +2455,7 @@
int i, j, k;
for (i = 0; i < *num_channels; i++)
- for (j = 0; j < IEEE80211_NUM_BANDS; j++) {
+ for (j = 0; j < NUM_NL80211_BANDS; j++) {
if (wiphy->bands[j] == NULL)
continue;
for (k = 0; k < wiphy->bands[j]->n_channels; k++) {
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 1cc03ca2..eaa8287 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -998,7 +998,7 @@
struct hdd_config *pconfig = hdd_ctx->config;
struct wiphy *wiphy = hdd_ctx->wiphy;
struct ieee80211_supported_band *band_5g =
- wiphy->bands[IEEE80211_BAND_5GHZ];
+ wiphy->bands[NL80211_BAND_5GHZ];
uint32_t temp = 0;
if (!band_5g) {
@@ -3992,10 +3992,10 @@
if (chan_no <= 14)
freq = ieee80211_channel_to_frequency(chan_no,
- IEEE80211_BAND_2GHZ);
+ NL80211_BAND_2GHZ);
else
freq = ieee80211_channel_to_frequency(chan_no,
- IEEE80211_BAND_5GHZ);
+ NL80211_BAND_5GHZ);
chan = ieee80211_get_channel(padapter->wdev.wiphy, freq);
bss = hdd_cfg80211_get_bss(padapter->wdev.wiphy, chan, bssid,
diff --git a/core/hdd/src/wlan_hdd_ocb.c b/core/hdd/src/wlan_hdd_ocb.c
index f86a6f1..78d25b3 100644
--- a/core/hdd/src/wlan_hdd_ocb.c
+++ b/core/hdd/src/wlan_hdd_ocb.c
@@ -145,7 +145,7 @@
struct ieee80211_supported_band *current_band;
struct ieee80211_channel *current_channel;
- for (band_idx = 0; band_idx < IEEE80211_NUM_BANDS; band_idx++) {
+ for (band_idx = 0; band_idx < NUM_NL80211_BANDS; band_idx++) {
current_band = wiphy->bands[band_idx];
if (!current_band)
continue;
diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c
index f74f142..486bc6e 100644
--- a/core/hdd/src/wlan_hdd_p2p.c
+++ b/core/hdd/src/wlan_hdd_p2p.c
@@ -2309,10 +2309,10 @@
/* Indicate an action frame. */
if (rxChan <= MAX_NO_OF_2_4_CHANNELS)
freq = ieee80211_channel_to_frequency(rxChan,
- IEEE80211_BAND_2GHZ);
+ NL80211_BAND_2GHZ);
else
freq = ieee80211_channel_to_frequency(rxChan,
- IEEE80211_BAND_5GHZ);
+ NL80211_BAND_5GHZ);
cfgState = WLAN_HDD_GET_CFG_STATE_PTR(pAdapter);
diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c
index 2c23746..b64a4ac 100644
--- a/core/hdd/src/wlan_hdd_regulatory.c
+++ b/core/hdd/src/wlan_hdd_regulatory.c
@@ -386,7 +386,7 @@
band_capability = hdd_ctx->config->nBandCapability;
hdd_ctx->isVHT80Allowed = 0;
- for (band_num = 0; band_num < IEEE80211_NUM_BANDS; band_num++) {
+ for (band_num = 0; band_num < NUM_NL80211_BANDS; band_num++) {
if (wiphy->bands[band_num] == NULL)
continue;
@@ -570,7 +570,7 @@
bool *reset)
{
struct ieee80211_supported_band *sband;
- enum ieee80211_band band;
+ enum nl80211_band band;
struct ieee80211_channel *chan;
int i;
@@ -578,7 +578,7 @@
(country_alpha2[1] == '0') &&
(wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY)) {
- for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+ for (band = 0; band < NUM_NL80211_BANDS; band++) {
sband = wiphy->bands[band];
if (!sband)
continue;
diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c
index a52f9ae..729f051 100644
--- a/core/hdd/src/wlan_hdd_scan.c
+++ b/core/hdd/src/wlan_hdd_scan.c
@@ -1798,7 +1798,7 @@
* Return: o for failure, rate bitmap for success
*/
static uint32_t wlan_hdd_get_rates(struct wiphy *wiphy,
- enum ieee80211_band band,
+ enum nl80211_band band,
const u8 *rates, unsigned int rate_count)
{
uint32_t j, count, rate_bitmap = 0;
@@ -1885,7 +1885,7 @@
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SCAN_MAX + 1];
struct cfg80211_scan_request *request = NULL;
struct nlattr *attr;
- enum ieee80211_band band;
+ enum nl80211_band band;
uint8_t n_channels = 0, n_ssid = 0, ie_len = 0;
uint32_t tmp, count, j;
unsigned int len;
@@ -1910,7 +1910,7 @@
tb[QCA_WLAN_VENDOR_ATTR_SCAN_FREQUENCIES], tmp)
n_channels++;
} else {
- for (band = 0; band < IEEE80211_NUM_BANDS; band++)
+ for (band = 0; band < NUM_NL80211_BANDS; band++)
if (wiphy->bands[band])
n_channels += wiphy->bands[band]->n_channels;
}
@@ -1965,7 +1965,7 @@
count++;
}
} else {
- for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+ for (band = 0; band < NUM_NL80211_BANDS; band++) {
if (!wiphy->bands[band])
continue;
for (j = 0; j < wiphy->bands[band]->n_channels;
@@ -2001,7 +2001,7 @@
request->ie_len);
}
- for (count = 0; count < IEEE80211_NUM_BANDS; count++)
+ for (count = 0; count < NUM_NL80211_BANDS; count++)
if (wiphy->bands[count])
request->rates[count] =
(1 << wiphy->bands[count]->n_bitrates) - 1;
diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c
index 9061136..d03a97c 100644
--- a/core/hdd/src/wlan_hdd_stats.c
+++ b/core/hdd/src/wlan_hdd_stats.c
@@ -2355,7 +2355,7 @@
sme_get_operation_channel(halHandle, &channel, pAdapter->sessionId);
hdd_wlan_get_freq(channel, &freq);
- for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
+ for (i = 0; i < NUM_NL80211_BANDS; i++) {
if (NULL == wiphy->bands[i])
continue;
diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c
index 2761f9e..9beba4f 100644
--- a/core/hdd/src/wlan_hdd_wext.c
+++ b/core/hdd/src/wlan_hdd_wext.c
@@ -5086,10 +5086,10 @@
return -EIO;
}
if (phddctx->config->nChannelBondingMode5GHz)
- phddctx->wiphy->bands[IEEE80211_BAND_5GHZ]->ht_cap.cap
+ phddctx->wiphy->bands[NL80211_BAND_5GHZ]->ht_cap.cap
|= IEEE80211_HT_CAP_SUP_WIDTH_20_40;
else
- phddctx->wiphy->bands[IEEE80211_BAND_5GHZ]->ht_cap.cap
+ phddctx->wiphy->bands[NL80211_BAND_5GHZ]->ht_cap.cap
&= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
hdd_warn("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u",