Commit 3717f91a authored by Tova Mussai's avatar Tova Mussai Committed by Luca Coelho

iwlwifi: mvm: create function to convert nl80211 band to phy band

Create the function and use it.
Signed-off-by: default avatarTova Mussai <tova.mussai@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 6abe1e2e
...@@ -3636,8 +3636,7 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm, ...@@ -3636,8 +3636,7 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm,
/* Set the channel info data */ /* Set the channel info data */
iwl_mvm_set_chan_info(mvm, &aux_roc_req.channel_info, channel->hw_value, iwl_mvm_set_chan_info(mvm, &aux_roc_req.channel_info, channel->hw_value,
(channel->band == NL80211_BAND_2GHZ) ? iwl_mvm_phy_band_from_nl80211(channel->band),
PHY_BAND_24 : PHY_BAND_5,
PHY_VHT_CHANNEL_MODE20, PHY_VHT_CHANNEL_MODE20,
0); 0);
......
...@@ -2077,6 +2077,19 @@ void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw, ...@@ -2077,6 +2077,19 @@ void iwl_mvm_sta_add_debugfs(struct ieee80211_hw *hw,
struct dentry *dir); struct dentry *dir);
#endif #endif
static inline u8 iwl_mvm_phy_band_from_nl80211(enum nl80211_band band)
{
switch (band) {
case NL80211_BAND_2GHZ:
return PHY_BAND_24;
case NL80211_BAND_5GHZ:
return PHY_BAND_5;
default:
WARN_ONCE(1, "Unsupported band (%u)\n", band);
return PHY_BAND_5;
}
}
/* Channel info utils */ /* Channel info utils */
static inline bool iwl_mvm_has_ultra_hb_channel(struct iwl_mvm *mvm) static inline bool iwl_mvm_has_ultra_hb_channel(struct iwl_mvm *mvm)
{ {
...@@ -2125,11 +2138,12 @@ iwl_mvm_set_chan_info_chandef(struct iwl_mvm *mvm, ...@@ -2125,11 +2138,12 @@ iwl_mvm_set_chan_info_chandef(struct iwl_mvm *mvm,
struct iwl_fw_channel_info *ci, struct iwl_fw_channel_info *ci,
struct cfg80211_chan_def *chandef) struct cfg80211_chan_def *chandef)
{ {
enum nl80211_band band = chandef->chan->band;
iwl_mvm_set_chan_info(mvm, ci, chandef->chan->hw_value, iwl_mvm_set_chan_info(mvm, ci, chandef->chan->hw_value,
(chandef->chan->band == NL80211_BAND_2GHZ ? iwl_mvm_phy_band_from_nl80211(band),
PHY_BAND_24 : PHY_BAND_5), iwl_mvm_get_channel_width(chandef),
iwl_mvm_get_channel_width(chandef), iwl_mvm_get_ctrl_pos(chandef));
iwl_mvm_get_ctrl_pos(chandef));
} }
#endif /* __IWL_MVM_H__ */ #endif /* __IWL_MVM_H__ */
...@@ -79,9 +79,6 @@ ...@@ -79,9 +79,6 @@
#define IWL_SCAN_NUM_OF_FRAGS 3 #define IWL_SCAN_NUM_OF_FRAGS 3
#define IWL_SCAN_LAST_2_4_CHN 14 #define IWL_SCAN_LAST_2_4_CHN 14
#define IWL_SCAN_BAND_5_2 0
#define IWL_SCAN_BAND_2_4 1
/* adaptive dwell max budget time [TU] for full scan */ /* adaptive dwell max budget time [TU] for full scan */
#define IWL_SCAN_ADWELL_MAX_BUDGET_FULL_SCAN 300 #define IWL_SCAN_ADWELL_MAX_BUDGET_FULL_SCAN 300
/* adaptive dwell max budget time [TU] for directed scan */ /* adaptive dwell max budget time [TU] for directed scan */
...@@ -196,14 +193,6 @@ static inline __le16 iwl_mvm_scan_rx_chain(struct iwl_mvm *mvm) ...@@ -196,14 +193,6 @@ static inline __le16 iwl_mvm_scan_rx_chain(struct iwl_mvm *mvm)
return cpu_to_le16(rx_chain); return cpu_to_le16(rx_chain);
} }
static __le32 iwl_mvm_scan_rxon_flags(enum nl80211_band band)
{
if (band == NL80211_BAND_2GHZ)
return cpu_to_le32(PHY_BAND_24);
else
return cpu_to_le32(PHY_BAND_5);
}
static inline __le32 static inline __le32
iwl_mvm_scan_rate_n_flags(struct iwl_mvm *mvm, enum nl80211_band band, iwl_mvm_scan_rate_n_flags(struct iwl_mvm *mvm, enum nl80211_band band,
bool no_cck) bool no_cck)
...@@ -981,6 +970,7 @@ static int iwl_mvm_scan_lmac(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -981,6 +970,7 @@ static int iwl_mvm_scan_lmac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
mvm->fw->ucode_capa.n_scan_channels); mvm->fw->ucode_capa.n_scan_channels);
u32 ssid_bitmap = 0; u32 ssid_bitmap = 0;
int i; int i;
u8 band;
lockdep_assert_held(&mvm->mutex); lockdep_assert_held(&mvm->mutex);
...@@ -1000,7 +990,8 @@ static int iwl_mvm_scan_lmac(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -1000,7 +990,8 @@ static int iwl_mvm_scan_lmac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
cmd->scan_flags = cpu_to_le32(iwl_mvm_scan_lmac_flags(mvm, params, cmd->scan_flags = cpu_to_le32(iwl_mvm_scan_lmac_flags(mvm, params,
vif)); vif));
cmd->flags = iwl_mvm_scan_rxon_flags(params->channels[0]->band); band = iwl_mvm_phy_band_from_nl80211(params->channels[0]->band);
cmd->flags = cpu_to_le32(band);
cmd->filter_flags = cpu_to_le32(MAC_FILTER_ACCEPT_GRP | cmd->filter_flags = cpu_to_le32(MAC_FILTER_ACCEPT_GRP |
MAC_FILTER_IN_BEACON); MAC_FILTER_IN_BEACON);
iwl_mvm_scan_fill_tx_cmd(mvm, cmd->tx_cmd, params->no_cck); iwl_mvm_scan_fill_tx_cmd(mvm, cmd->tx_cmd, params->no_cck);
...@@ -1402,9 +1393,10 @@ iwl_mvm_umac_scan_cfg_channels(struct iwl_mvm *mvm, ...@@ -1402,9 +1393,10 @@ iwl_mvm_umac_scan_cfg_channels(struct iwl_mvm *mvm,
channel_cfg[i].flags = cpu_to_le32(ssid_bitmap); channel_cfg[i].flags = cpu_to_le32(ssid_bitmap);
channel_cfg[i].v1.channel_num = channels[i]->hw_value; channel_cfg[i].v1.channel_num = channels[i]->hw_value;
if (iwl_mvm_is_scan_ext_chan_supported(mvm)) { if (iwl_mvm_is_scan_ext_chan_supported(mvm)) {
enum nl80211_band band = channels[i]->band;
channel_cfg[i].v2.band = channel_cfg[i].v2.band =
channels[i]->hw_value <= IWL_SCAN_LAST_2_4_CHN ? iwl_mvm_phy_band_from_nl80211(band);
IWL_SCAN_BAND_2_4 : IWL_SCAN_BAND_5_2;
channel_cfg[i].v2.iter_count = 1; channel_cfg[i].v2.iter_count = 1;
channel_cfg[i].v2.iter_interval = 0; channel_cfg[i].v2.iter_interval = 0;
} else { } else {
......
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