Commit 5edc565d authored by Meenakshi Venkataraman's avatar Meenakshi Venkataraman Committed by Wey-Yi Guy

iwlwifi: move iwl_is_ht40_tx_allowed out of iwl-core.c

This is really something determined by
station parameters, so move it to
iwl-agn-sta.c.
Signed-off-by: default avatarMeenakshi Venkataraman <meenakshi.venkataraman@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
parent a297d95d
...@@ -170,6 +170,50 @@ int iwl_send_add_sta(struct iwl_priv *priv, ...@@ -170,6 +170,50 @@ int iwl_send_add_sta(struct iwl_priv *priv,
return cmd.handler_status; return cmd.handler_status;
} }
static bool iwl_is_channel_extension(struct iwl_priv *priv,
enum ieee80211_band band,
u16 channel, u8 extension_chan_offset)
{
const struct iwl_channel_info *ch_info;
ch_info = iwl_get_channel_info(priv, band, channel);
if (!is_channel_valid(ch_info))
return false;
if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE)
return !(ch_info->ht40_extension_channel &
IEEE80211_CHAN_NO_HT40PLUS);
else if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_BELOW)
return !(ch_info->ht40_extension_channel &
IEEE80211_CHAN_NO_HT40MINUS);
return false;
}
bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
struct iwl_rxon_context *ctx,
struct ieee80211_sta_ht_cap *ht_cap)
{
if (!ctx->ht.enabled || !ctx->ht.is_40mhz)
return false;
/*
* We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40
* the bit will not set if it is pure 40MHz case
*/
if (ht_cap && !ht_cap->ht_supported)
return false;
#ifdef CONFIG_IWLWIFI_DEBUGFS
if (priv->disable_ht40)
return false;
#endif
return iwl_is_channel_extension(priv, priv->band,
le16_to_cpu(ctx->staging.channel),
ctx->ht.extension_chan_offset);
}
static void iwl_sta_calc_ht_flags(struct iwl_priv *priv, static void iwl_sta_calc_ht_flags(struct iwl_priv *priv,
struct ieee80211_sta *sta, struct ieee80211_sta *sta,
struct iwl_rxon_context *ctx, struct iwl_rxon_context *ctx,
......
...@@ -261,6 +261,9 @@ int iwl_add_sta_callback(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb, ...@@ -261,6 +261,9 @@ int iwl_add_sta_callback(struct iwl_priv *priv, struct iwl_rx_cmd_buffer *rxb,
int iwl_sta_update_ht(struct iwl_priv *priv, struct iwl_rxon_context *ctx, int iwl_sta_update_ht(struct iwl_priv *priv, struct iwl_rxon_context *ctx,
struct ieee80211_sta *sta); struct ieee80211_sta *sta);
bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
struct iwl_rxon_context *ctx,
struct ieee80211_sta_ht_cap *ht_cap);
static inline int iwl_sta_id(struct ieee80211_sta *sta) static inline int iwl_sta_id(struct ieee80211_sta *sta)
{ {
......
...@@ -43,50 +43,6 @@ ...@@ -43,50 +43,6 @@
const u8 iwl_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; const u8 iwl_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
static bool iwl_is_channel_extension(struct iwl_priv *priv,
enum ieee80211_band band,
u16 channel, u8 extension_chan_offset)
{
const struct iwl_channel_info *ch_info;
ch_info = iwl_get_channel_info(priv, band, channel);
if (!is_channel_valid(ch_info))
return false;
if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE)
return !(ch_info->ht40_extension_channel &
IEEE80211_CHAN_NO_HT40PLUS);
else if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_BELOW)
return !(ch_info->ht40_extension_channel &
IEEE80211_CHAN_NO_HT40MINUS);
return false;
}
bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
struct iwl_rxon_context *ctx,
struct ieee80211_sta_ht_cap *ht_cap)
{
if (!ctx->ht.enabled || !ctx->ht.is_40mhz)
return false;
/*
* We do not check for IEEE80211_HT_CAP_SUP_WIDTH_20_40
* the bit will not set if it is pure 40MHz case
*/
if (ht_cap && !ht_cap->ht_supported)
return false;
#ifdef CONFIG_IWLWIFI_DEBUGFS
if (priv->disable_ht40)
return false;
#endif
return iwl_is_channel_extension(priv, priv->band,
le16_to_cpu(ctx->staging.channel),
ctx->ht.extension_chan_offset);
}
static void _iwl_set_rxon_ht(struct iwl_priv *priv, static void _iwl_set_rxon_ht(struct iwl_priv *priv,
struct iwl_ht_config *ht_conf, struct iwl_ht_config *ht_conf,
struct iwl_rxon_context *ctx) struct iwl_rxon_context *ctx)
......
...@@ -85,9 +85,6 @@ void iwl_set_flags_for_band(struct iwl_priv *priv, ...@@ -85,9 +85,6 @@ void iwl_set_flags_for_band(struct iwl_priv *priv,
enum ieee80211_band band, enum ieee80211_band band,
struct ieee80211_vif *vif); struct ieee80211_vif *vif);
void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf);
bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
struct iwl_rxon_context *ctx,
struct ieee80211_sta_ht_cap *ht_cap);
void iwl_connection_init_rx_config(struct iwl_priv *priv, void iwl_connection_init_rx_config(struct iwl_priv *priv,
struct iwl_rxon_context *ctx); struct iwl_rxon_context *ctx);
void iwl_set_rate(struct iwl_priv *priv); void iwl_set_rate(struct iwl_priv *priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment