Skip to content

Instantly share code, notes, and snippets.

Created January 8, 2017 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/04db02a9ec14efac3a0ffb6208b2a6e9 to your computer and use it in GitHub Desktop.
Save anonymous/04db02a9ec14efac3a0ffb6208b2a6e9 to your computer and use it in GitHub Desktop.
stdin
diff --git a/fwcmd.c b/fwcmd.c
index be9c155..1680cfc 100644
--- a/fwcmd.c
+++ b/fwcmd.c
@@ -786,9 +786,9 @@ static int mwl_fwcmd_set_country_code(struct mwl_priv *priv,
bool enable = false;
if (b_inf->ie_country_ptr) {
- if (bss_conf->chandef.chan->band == NL80211_BAND_2GHZ)
+ if (bss_conf->chandef.chan->band == IEEE80211_BAND_2GHZ)
a_band = false;
- else if (bss_conf->chandef.chan->band == NL80211_BAND_5GHZ)
+ else if (bss_conf->chandef.chan->band == IEEE80211_BAND_5GHZ)
a_band = true;
else
return -EINVAL;
@@ -1203,9 +1203,9 @@ int mwl_fwcmd_max_tx_power(struct ieee80211_hw *hw,
break;
}
- if (channel->band == NL80211_BAND_2GHZ)
+ if (channel->band == IEEE80211_BAND_2GHZ)
band = FREQ_BAND_2DOT4GHZ;
- else if (channel->band == NL80211_BAND_5GHZ)
+ else if (channel->band == IEEE80211_BAND_5GHZ)
band = FREQ_BAND_5GHZ;
switch (conf->chandef.width) {
@@ -1292,9 +1292,9 @@ int mwl_fwcmd_tx_power(struct ieee80211_hw *hw,
break;
}
- if (channel->band == NL80211_BAND_2GHZ)
+ if (channel->band == IEEE80211_BAND_2GHZ)
band = FREQ_BAND_2DOT4GHZ;
- else if (channel->band == NL80211_BAND_5GHZ)
+ else if (channel->band == IEEE80211_BAND_5GHZ)
band = FREQ_BAND_5GHZ;
switch (conf->chandef.width) {
@@ -1482,9 +1482,9 @@ int mwl_fwcmd_set_rf_channel(struct ieee80211_hw *hw,
pcmd->action = cpu_to_le16(WL_SET);
pcmd->curr_chnl = channel->hw_value;
- if (channel->band == NL80211_BAND_2GHZ) {
+ if (channel->band == IEEE80211_BAND_2GHZ) {
freq_band = FREQ_BAND_2DOT4GHZ;
- } else if (channel->band == NL80211_BAND_5GHZ) {
+ } else if (channel->band == IEEE80211_BAND_5GHZ) {
freq_band = FREQ_BAND_5GHZ;
} else {
mutex_unlock(&priv->fwcmd_mutex);
@@ -2058,10 +2058,10 @@ int mwl_fwcmd_set_new_stn_add(struct ieee80211_hw *hw,
}
ether_addr_copy(pcmd->mac_addr, sta->addr);
- if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ)
- rates = sta->supp_rates[NL80211_BAND_2GHZ];
+ if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
+ rates = sta->supp_rates[IEEE80211_BAND_2GHZ];
else
- rates = sta->supp_rates[NL80211_BAND_5GHZ] << 5;
+ rates = sta->supp_rates[IEEE80211_BAND_5GHZ] << 5;
pcmd->peer_info.legacy_rate_bitmap = cpu_to_le32(rates);
if (sta->ht_cap.ht_supported) {
@@ -2229,9 +2229,9 @@ int mwl_fwcmd_set_switch_channel(struct mwl_priv *priv,
if (priv->csa_active)
return 0;
- if (channel->band == NL80211_BAND_2GHZ)
+ if (channel->band == IEEE80211_BAND_2GHZ)
freq_band = FREQ_BAND_2DOT4GHZ;
- else if (channel->band == NL80211_BAND_5GHZ)
+ else if (channel->band == IEEE80211_BAND_5GHZ)
freq_band = FREQ_BAND_5GHZ;
else
return -EINVAL;
diff --git a/mac80211.c b/mac80211.c
index d1fc4f1..416d589 100644
--- a/mac80211.c
+++ b/mac80211.c
@@ -254,12 +254,12 @@ static int mwl_mac80211_config(struct ieee80211_hw *hw,
if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
int rate = 0;
- if (conf->chandef.chan->band == NL80211_BAND_2GHZ) {
+ if (conf->chandef.chan->band == IEEE80211_BAND_2GHZ) {
mwl_fwcmd_set_apmode(hw, AP_MODE_2_4GHZ_11AC_MIXED);
mwl_fwcmd_set_linkadapt_cs_mode(hw,
LINK_CS_STATE_CONSERV);
rate = mwl_rates_24[0].hw_value;
- } else if (conf->chandef.chan->band == NL80211_BAND_5GHZ) {
+ } else if (conf->chandef.chan->band == IEEE80211_BAND_5GHZ) {
mwl_fwcmd_set_apmode(hw, AP_MODE_11AC);
mwl_fwcmd_set_linkadapt_cs_mode(hw,
LINK_CS_STATE_AUTO);
@@ -327,7 +327,7 @@ static void mwl_mac80211_bss_info_changed_ap(struct ieee80211_hw *hw,
if (idx)
idx--;
- if (hw->conf.chandef.chan->band == NL80211_BAND_2GHZ)
+ if (hw->conf.chandef.chan->band == IEEE80211_BAND_2GHZ)
rate = mwl_rates_24[idx].hw_value;
else
rate = mwl_rates_50[idx].hw_value;
@@ -587,15 +587,13 @@ static int mwl_mac80211_get_survey(struct ieee80211_hw *hw,
static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
- struct ieee80211_ampdu_params *params)
+ enum ieee80211_ampdu_mlme_action action,
+ struct ieee80211_sta *sta,
+ u16 tid, u16 *ssn, u8 buf_size)
{
int rc = 0;
struct mwl_priv *priv = hw->priv;
struct mwl_ampdu_stream *stream;
- enum ieee80211_ampdu_mlme_action action = params->action;
- struct ieee80211_sta *sta = params->sta;
- u16 tid = params->tid;
- u8 buf_size = params->buf_size;
u8 *addr = sta->addr, idx;
struct mwl_sta *sta_info;
@@ -635,7 +633,7 @@ static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
break;
}
stream->state = AMPDU_STREAM_IN_PROGRESS;
- params->ssn = 0;
+ *ssn = 0;
ieee80211_start_tx_ba_cb_irqsafe(vif, addr, tid);
break;
case IEEE80211_AMPDU_TX_STOP_CONT:
@@ -649,7 +647,6 @@ static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
spin_unlock_bh(&priv->stream_lock);
mwl_fwcmd_destroy_ba(hw, idx);
spin_lock_bh(&priv->stream_lock);
- sta_info->is_amsdu_allowed = false;
}
mwl_fwcmd_remove_stream(hw, stream);
@@ -672,7 +669,6 @@ static int mwl_mac80211_ampdu_action(struct ieee80211_hw *hw,
if (!rc) {
stream->state = AMPDU_STREAM_ACTIVE;
sta_info->check_ba_failed[tid] = 0;
- sta_info->is_amsdu_allowed = params->amsdu;
} else {
idx = stream->idx;
spin_unlock_bh(&priv->stream_lock);
diff --git a/main.c b/main.c
index b95919f..fd84fdc 100644
--- a/main.c
+++ b/main.c
@@ -67,20 +67,20 @@ static struct mwl_chip_info mwl_chip_tbl[] = {
};
static const struct ieee80211_channel mwl_channels_24[] = {
- { .band = NL80211_BAND_2GHZ, .center_freq = 2412, .hw_value = 1, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2417, .hw_value = 2, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2422, .hw_value = 3, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2427, .hw_value = 4, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2432, .hw_value = 5, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2437, .hw_value = 6, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2442, .hw_value = 7, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2447, .hw_value = 8, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2452, .hw_value = 9, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2457, .hw_value = 10, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2462, .hw_value = 11, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2467, .hw_value = 12, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2472, .hw_value = 13, },
- { .band = NL80211_BAND_2GHZ, .center_freq = 2484, .hw_value = 14, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2412, .hw_value = 1, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2417, .hw_value = 2, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2422, .hw_value = 3, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2427, .hw_value = 4, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2432, .hw_value = 5, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2437, .hw_value = 6, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2442, .hw_value = 7, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2447, .hw_value = 8, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2452, .hw_value = 9, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2457, .hw_value = 10, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2462, .hw_value = 11, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2467, .hw_value = 12, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2472, .hw_value = 13, },
+ { .band = IEEE80211_BAND_2GHZ, .center_freq = 2484, .hw_value = 14, },
};
static const struct ieee80211_rate mwl_rates_24[] = {
@@ -100,30 +100,30 @@ static const struct ieee80211_rate mwl_rates_24[] = {
};
static const struct ieee80211_channel mwl_channels_50[] = {
- { .band = NL80211_BAND_5GHZ, .center_freq = 5180, .hw_value = 36, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5200, .hw_value = 40, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5220, .hw_value = 44, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5240, .hw_value = 48, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5260, .hw_value = 52, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5280, .hw_value = 56, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5300, .hw_value = 60, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5320, .hw_value = 64, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5500, .hw_value = 100, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5520, .hw_value = 104, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5540, .hw_value = 108, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5560, .hw_value = 112, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5580, .hw_value = 116, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5600, .hw_value = 120, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5620, .hw_value = 124, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5640, .hw_value = 128, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5660, .hw_value = 132, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5680, .hw_value = 136, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5700, .hw_value = 140, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5720, .hw_value = 144, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5745, .hw_value = 149, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5765, .hw_value = 153, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5785, .hw_value = 157, },
- { .band = NL80211_BAND_5GHZ, .center_freq = 5805, .hw_value = 161, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5180, .hw_value = 36, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5200, .hw_value = 40, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5220, .hw_value = 44, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5240, .hw_value = 48, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5260, .hw_value = 52, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5280, .hw_value = 56, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5300, .hw_value = 60, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5320, .hw_value = 64, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5500, .hw_value = 100, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5520, .hw_value = 104, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5540, .hw_value = 108, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5560, .hw_value = 112, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5580, .hw_value = 116, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5600, .hw_value = 120, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5620, .hw_value = 124, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5640, .hw_value = 128, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5660, .hw_value = 132, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5680, .hw_value = 136, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5700, .hw_value = 140, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5720, .hw_value = 144, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5745, .hw_value = 149, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5765, .hw_value = 153, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5785, .hw_value = 157, },
+ { .band = IEEE80211_BAND_5GHZ, .center_freq = 5805, .hw_value = 161, },
};
static const struct ieee80211_rate mwl_rates_50[] = {
@@ -442,8 +442,7 @@ static void mwl_set_ht_caps(struct mwl_priv *priv,
band->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
band->ht_cap.cap |= IEEE80211_HT_CAP_DSSSCCK40;
- ieee80211_hw_set(hw, AMPDU_AGGREGATION);
- ieee80211_hw_set(hw, SUPPORTS_AMSDU_IN_AMPDU);
+ hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
band->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
band->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_4;
@@ -522,7 +521,7 @@ static void mwl_set_caps(struct mwl_priv *priv)
BUILD_BUG_ON(sizeof(priv->rates_24) != sizeof(mwl_rates_24));
memcpy(priv->rates_24, mwl_rates_24, sizeof(mwl_rates_24));
- priv->band_24.band = NL80211_BAND_2GHZ;
+ priv->band_24.band = IEEE80211_BAND_2GHZ;
priv->band_24.channels = priv->channels_24;
priv->band_24.n_channels = ARRAY_SIZE(mwl_channels_24);
priv->band_24.bitrates = priv->rates_24;
@@ -531,7 +530,7 @@ static void mwl_set_caps(struct mwl_priv *priv)
mwl_set_ht_caps(priv, &priv->band_24);
mwl_set_vht_caps(priv, &priv->band_24);
- hw->wiphy->bands[NL80211_BAND_2GHZ] = &priv->band_24;
+ hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band_24;
}
/* set up band information for 5G */
@@ -544,7 +543,7 @@ static void mwl_set_caps(struct mwl_priv *priv)
BUILD_BUG_ON(sizeof(priv->rates_50) != sizeof(mwl_rates_50));
memcpy(priv->rates_50, mwl_rates_50, sizeof(mwl_rates_50));
- priv->band_50.band = NL80211_BAND_5GHZ;
+ priv->band_50.band = IEEE80211_BAND_5GHZ;
priv->band_50.channels = priv->channels_50;
priv->band_50.n_channels = ARRAY_SIZE(mwl_channels_50);
priv->band_50.bitrates = priv->rates_50;
@@ -553,7 +552,7 @@ static void mwl_set_caps(struct mwl_priv *priv)
mwl_set_ht_caps(priv, &priv->band_50);
mwl_set_vht_caps(priv, &priv->band_50);
- hw->wiphy->bands[NL80211_BAND_5GHZ] = &priv->band_50;
+ hw->wiphy->bands[IEEE80211_BAND_5GHZ] = &priv->band_50;
}
}
@@ -651,16 +650,16 @@ static int mwl_wl_init(struct mwl_priv *priv)
hw->queues = SYSADPT_TX_WMM_QUEUES;
/* Set rssi values to dBm */
- ieee80211_hw_set(hw, SIGNAL_DBM);
- ieee80211_hw_set(hw, HAS_RATE_CONTROL);
+ hw->flags |= IEEE80211_HW_SIGNAL_DBM;
+ hw->flags |= IEEE80211_HW_HAS_RATE_CONTROL;
/* Ask mac80211 not to trigger PS mode
* based on PM bit of incoming frames.
*/
- ieee80211_hw_set(hw, AP_LINK_PS);
+ hw->flags |= IEEE80211_HW_AP_LINK_PS;
- ieee80211_hw_set(hw, SUPPORTS_PER_STA_GTK);
- ieee80211_hw_set(hw, MFP_CAPABLE);
+ hw->flags |= IEEE80211_HW_SUPPORTS_PER_STA_GTK;
+ hw->flags |= IEEE80211_HW_MFP_CAPABLE;
hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
diff --git a/rx.c b/rx.c
index ab4a09e..d9f5474 100644
--- a/rx.c
+++ b/rx.c
@@ -246,7 +246,7 @@ static inline void mwl_rx_prepare_status(struct mwl_rx_desc *pdesc,
status->rate_idx = rt;
if (pdesc->channel > BAND_24_CHANNEL_NUM) {
- status->band = NL80211_BAND_5GHZ;
+ status->band = IEEE80211_BAND_5GHZ;
if ((!(status->flag & RX_FLAG_HT)) &&
(!(status->flag & RX_FLAG_VHT))) {
status->rate_idx -= 5;
@@ -254,7 +254,7 @@ static inline void mwl_rx_prepare_status(struct mwl_rx_desc *pdesc,
status->rate_idx = BAND_50_RATE_NUM - 1;
}
} else {
- status->band = NL80211_BAND_2GHZ;
+ status->band = IEEE80211_BAND_2GHZ;
if ((!(status->flag & RX_FLAG_HT)) &&
(!(status->flag & RX_FLAG_VHT))) {
if (status->rate_idx >= BAND_24_RATE_NUM)
diff --git a/tx.c b/tx.c
index 2cfcd30..7d4d5d4 100644
--- a/tx.c
+++ b/tx.c
@@ -843,7 +843,7 @@ void mwl_tx_xmit(struct ieee80211_hw *hw,
len = *pos++;
while (len) {
if (hw->conf.chandef.chan->band
- == NL80211_BAND_2GHZ) {
+ == IEEE80211_BAND_2GHZ) {
if ((*pos == 2) ||
(*pos == 4) ||
(*pos == 11) ||
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment