提交 8865bee4 编写于 作者: M Michal Kazior 提交者: Kalle Valo

ath10k: detect the number of spatial streams supported by hw

Until now ath10k assumed 3 spatial streams.
However some devices support only 2 spatial
streams.

This patch improves performance on devices that
don't support 3 spatial streams.
Signed-off-by: NMichal Kazior <michal.kazior@tieto.com>
Signed-off-by: NKalle Valo <kvalo@qca.qualcomm.com>
上级 ba0ccd7a
...@@ -285,6 +285,7 @@ struct ath10k { ...@@ -285,6 +285,7 @@ struct ath10k {
u32 hw_max_tx_power; u32 hw_max_tx_power;
u32 ht_cap_info; u32 ht_cap_info;
u32 vht_cap_info; u32 vht_cap_info;
u32 num_rf_chains;
struct targetdef *targetdef; struct targetdef *targetdef;
struct hostdef *hostdef; struct hostdef *hostdef;
......
...@@ -3093,19 +3093,18 @@ static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar) ...@@ -3093,19 +3093,18 @@ static struct ieee80211_sta_vht_cap ath10k_create_vht_cap(struct ath10k *ar)
{ {
struct ieee80211_sta_vht_cap vht_cap = {0}; struct ieee80211_sta_vht_cap vht_cap = {0};
u16 mcs_map; u16 mcs_map;
int i;
vht_cap.vht_supported = 1; vht_cap.vht_supported = 1;
vht_cap.cap = ar->vht_cap_info; vht_cap.cap = ar->vht_cap_info;
/* FIXME: check dynamically how many streams board supports */ mcs_map = 0;
mcs_map = IEEE80211_VHT_MCS_SUPPORT_0_9 << 0 | for (i = 0; i < 8; i++) {
IEEE80211_VHT_MCS_SUPPORT_0_9 << 2 | if (i < ar->num_rf_chains)
IEEE80211_VHT_MCS_SUPPORT_0_9 << 4 | mcs_map |= IEEE80211_VHT_MCS_SUPPORT_0_9 << (i*2);
IEEE80211_VHT_MCS_NOT_SUPPORTED << 6 | else
IEEE80211_VHT_MCS_NOT_SUPPORTED << 8 | mcs_map |= IEEE80211_VHT_MCS_NOT_SUPPORTED << (i*2);
IEEE80211_VHT_MCS_NOT_SUPPORTED << 10 | }
IEEE80211_VHT_MCS_NOT_SUPPORTED << 12 |
IEEE80211_VHT_MCS_NOT_SUPPORTED << 14;
vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map); vht_cap.vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map);
vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map); vht_cap.vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map);
...@@ -3168,7 +3167,7 @@ static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar) ...@@ -3168,7 +3167,7 @@ static struct ieee80211_sta_ht_cap ath10k_get_ht_cap(struct ath10k *ar)
if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK) if (ar->vht_cap_info & WMI_VHT_CAP_MAX_MPDU_LEN_MASK)
ht_cap.cap |= IEEE80211_HT_CAP_MAX_AMSDU; ht_cap.cap |= IEEE80211_HT_CAP_MAX_AMSDU;
for (i = 0; i < WMI_MAX_SPATIAL_STREAM; i++) for (i = 0; i < ar->num_rf_chains; i++)
ht_cap.mcs.rx_mask[i] = 0xFF; ht_cap.mcs.rx_mask[i] = 0xFF;
ht_cap.mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED; ht_cap.mcs.tx_params |= IEEE80211_HT_MCS_TX_DEFINED;
......
...@@ -868,6 +868,13 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar, ...@@ -868,6 +868,13 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar,
(__le32_to_cpu(ev->sw_version_1) & 0xffff0000) >> 16; (__le32_to_cpu(ev->sw_version_1) & 0xffff0000) >> 16;
ar->fw_version_build = (__le32_to_cpu(ev->sw_version_1) & 0x0000ffff); ar->fw_version_build = (__le32_to_cpu(ev->sw_version_1) & 0x0000ffff);
ar->phy_capability = __le32_to_cpu(ev->phy_capability); ar->phy_capability = __le32_to_cpu(ev->phy_capability);
ar->num_rf_chains = __le32_to_cpu(ev->num_rf_chains);
if (ar->num_rf_chains > WMI_MAX_SPATIAL_STREAM) {
ath10k_warn("hardware advertises support for more spatial streams than it should (%d > %d)\n",
ar->num_rf_chains, WMI_MAX_SPATIAL_STREAM);
ar->num_rf_chains = WMI_MAX_SPATIAL_STREAM;
}
ar->ath_common.regulatory.current_rd = ar->ath_common.regulatory.current_rd =
__le32_to_cpu(ev->hal_reg_capabilities.eeprom_rd); __le32_to_cpu(ev->hal_reg_capabilities.eeprom_rd);
...@@ -892,7 +899,7 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar, ...@@ -892,7 +899,7 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar,
} }
ath10k_dbg(ATH10K_DBG_WMI, ath10k_dbg(ATH10K_DBG_WMI,
"wmi event service ready sw_ver 0x%08x sw_ver1 0x%08x abi_ver %u phy_cap 0x%08x ht_cap 0x%08x vht_cap 0x%08x vht_supp_msc 0x%08x sys_cap_info 0x%08x mem_reqs %u\n", "wmi event service ready sw_ver 0x%08x sw_ver1 0x%08x abi_ver %u phy_cap 0x%08x ht_cap 0x%08x vht_cap 0x%08x vht_supp_msc 0x%08x sys_cap_info 0x%08x mem_reqs %u num_rf_chains %u\n",
__le32_to_cpu(ev->sw_version), __le32_to_cpu(ev->sw_version),
__le32_to_cpu(ev->sw_version_1), __le32_to_cpu(ev->sw_version_1),
__le32_to_cpu(ev->abi_version), __le32_to_cpu(ev->abi_version),
...@@ -901,7 +908,8 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar, ...@@ -901,7 +908,8 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar,
__le32_to_cpu(ev->vht_cap_info), __le32_to_cpu(ev->vht_cap_info),
__le32_to_cpu(ev->vht_supp_mcs), __le32_to_cpu(ev->vht_supp_mcs),
__le32_to_cpu(ev->sys_cap_info), __le32_to_cpu(ev->sys_cap_info),
__le32_to_cpu(ev->num_mem_reqs)); __le32_to_cpu(ev->num_mem_reqs),
__le32_to_cpu(ev->num_rf_chains));
complete(&ar->wmi.service_ready); complete(&ar->wmi.service_ready);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册