qcacmn: Set hw mode Id to FW

Firmware needs HW MODE ID not list index.
Use HW mode ID to set HW MODE WMI command.

Change-Id: I12f9d83daee1c99706c345d85f03781257b492bf
CRs-Fixed: 2256175
This commit is contained in:
Liangwei Dong 2018-05-21 05:39:04 -04:00 • committed by nshrivas
commit 9ace8a9dd9
5 changed files with 120 additions and 25 deletions

View file

@ -712,6 +712,8 @@ enum QDF_OPMODE policy_mgr_get_qdf_mode_from_pm(
* @mac0_bw: MAC0 bandwidth configuration
* @mac1_ss: MAC1 spatial stream configuration
* @mac1_bw: MAC1 bandwidth configuration
* @mac0_band_cap: mac0 band capability requirement
* (0: Don't care, 1: 2.4G, 2: 5G)
* @dbs: HW DBS capability
* @dfs: HW Agile DFS capability
* @sbs: HW SBS capability
@ -724,18 +726,33 @@ enum QDF_OPMODE policy_mgr_get_qdf_mode_from_pm(
* e.g.: To configure 2x2_80
* mac0_ss = HW_MODE_SS_2x2, mac0_bw = HW_MODE_80_MHZ
* mac1_ss = HW_MODE_SS_0x0, mac1_bw = HW_MODE_BW_NONE
* mac0_band_cap = HW_MODE_MAC_BAND_NONE,
* dbs = HW_MODE_DBS_NONE, dfs = HW_MODE_AGILE_DFS_NONE,
* sbs = HW_MODE_SBS_NONE
* e.g.: To configure 1x1_80_1x1_40 (DBS)
* mac0_ss = HW_MODE_SS_1x1, mac0_bw = HW_MODE_80_MHZ
* mac1_ss = HW_MODE_SS_1x1, mac1_bw = HW_MODE_40_MHZ
* mac0_band_cap = HW_MODE_MAC_BAND_NONE,
* dbs = HW_MODE_DBS, dfs = HW_MODE_AGILE_DFS_NONE,
* sbs = HW_MODE_SBS_NONE
* e.g.: To configure 1x1_80_1x1_40 (Agile DFS)
* mac0_ss = HW_MODE_SS_1x1, mac0_bw = HW_MODE_80_MHZ
* mac1_ss = HW_MODE_SS_1x1, mac1_bw = HW_MODE_40_MHZ
* mac0_band_cap = HW_MODE_MAC_BAND_NONE,
* dbs = HW_MODE_DBS, dfs = HW_MODE_AGILE_DFS,
* sbs = HW_MODE_SBS_NONE
* e.g.: To configure 2x2_5g_80+1x1_2g_40
* mac0_ss = HW_MODE_SS_2x2, mac0_bw = HW_MODE_80_MHZ
* mac1_ss = HW_MODE_SS_1x1, mac1_bw = HW_MODE_40_MHZ
* mac0_band_cap = HW_MODE_MAC_BAND_5G
* dbs = HW_MODE_DBS, dfs = HW_MODE_AGILE_DFS_NONE,
* sbs = HW_MODE_SBS_NONE
* e.g.: To configure 2x2_2g_40+1x1_5g_40
* mac0_ss = HW_MODE_SS_2x2, mac0_bw = HW_MODE_40_MHZ
* mac1_ss = HW_MODE_SS_1x1, mac1_bw = HW_MODE_40_MHZ
* mac0_band_cap = HW_MODE_MAC_BAND_2G
* dbs = HW_MODE_DBS, dfs = HW_MODE_AGILE_DFS_NONE,
* sbs = HW_MODE_SBS_NONE
*
* Return: Success if the message made it down to the next layer
*/
@ -745,6 +762,7 @@ QDF_STATUS policy_mgr_pdev_set_hw_mode(struct wlan_objmgr_psoc *psoc,
enum hw_mode_bandwidth mac0_bw,
enum hw_mode_ss_config mac1_ss,
enum hw_mode_bandwidth mac1_bw,
enum hw_mode_mac_band_cap mac0_band_cap,
enum hw_mode_dbs_capab dbs,
enum hw_mode_agile_dfs_capab dfs,
enum hw_mode_sbs_capab sbs,
@ -2463,4 +2481,18 @@ bool policy_mgr_is_sap_restart_required_after_sta_disconnect(
*/
bool policy_mgr_is_sta_sap_scc(struct wlan_objmgr_psoc *psoc, uint8_t sap_ch);
/**
* policy_mgr_get_hw_mode_from_idx() - Get HW mode based on index
* @psoc: psoc object
* @idx: HW mode id
* @hw_mode: HW mode params
*
* Fetches the HW mode parameters
*
* Return: Success if hw mode is obtained and the hw mode params
*/
QDF_STATUS policy_mgr_get_hw_mode_from_idx(
struct wlan_objmgr_psoc *psoc,
uint32_t idx,
struct policy_mgr_hw_mode_params *hw_mode);
#endif /* __WLAN_POLICY_MGR_API_H */

View file

@ -114,6 +114,26 @@ enum hw_mode_sbs_capab {
HW_MODE_SBS,
};
/**
* enum hw_mode_mac_band_cap - mac band capability
* @HW_MODE_MAC_BAND_NONE: No band requirement.
* @HW_MODE_MAC_BAND_2G: 2G band supported.
* @HW_MODE_MAC_BAND_5G: 5G band supported.
*
* To add HW_MODE_MAC_BAND_NONE value to help to
* match the HW DBS mode in hw mode list.
* Other enum values should match with WMI header:
* typedef enum {
* WLAN_2G_CAPABILITY = 0x1,
* WLAN_5G_CAPABILITY = 0x2,
* } WLAN_BAND_CAPABILITY;
*/
enum hw_mode_mac_band_cap {
HW_MODE_MAC_BAND_NONE = 0,
HW_MODE_MAC_BAND_2G = WLAN_2G_CAPABILITY,
HW_MODE_MAC_BAND_5G = WLAN_5G_CAPABILITY,
};
/**
* enum policy_mgr_pcl_group_id - Identifies the pcl groups to be used
* @POLICY_MGR_PCL_GROUP_ID1_ID2: Use weights of group1 and group2

View file

@ -99,6 +99,7 @@ QDF_STATUS policy_mgr_pdev_set_hw_mode(struct wlan_objmgr_psoc *psoc,
enum hw_mode_bandwidth mac0_bw,
enum hw_mode_ss_config mac1_ss,
enum hw_mode_bandwidth mac1_bw,
enum hw_mode_mac_band_cap mac0_band_cap,
enum hw_mode_dbs_capab dbs,
enum hw_mode_agile_dfs_capab dfs,
enum hw_mode_sbs_capab sbs,
@ -130,7 +131,8 @@ QDF_STATUS policy_mgr_pdev_set_hw_mode(struct wlan_objmgr_psoc *psoc,
}
hw_mode_index = policy_mgr_get_hw_mode_idx_from_dbs_hw_list(psoc,
mac0_ss, mac0_bw, mac1_ss, mac1_bw, dbs, dfs, sbs);
mac0_ss, mac0_bw, mac1_ss, mac1_bw, mac0_band_cap,
dbs, dfs, sbs);
if (hw_mode_index < 0) {
policy_mgr_err("Invalid HW mode index obtained");
return QDF_STATUS_E_FAILURE;
@ -657,6 +659,7 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc,
HW_MODE_80_MHZ,
nss_dbs.mac1_ss,
HW_MODE_40_MHZ,
HW_MODE_MAC_BAND_NONE,
HW_MODE_DBS,
HW_MODE_AGILE_DFS_NONE,
HW_MODE_SBS_NONE,
@ -670,6 +673,7 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc,
HW_MODE_SS_2x2,
HW_MODE_80_MHZ,
HW_MODE_SS_0x0, HW_MODE_BW_NONE,
HW_MODE_MAC_BAND_NONE,
HW_MODE_DBS_NONE,
HW_MODE_AGILE_DFS_NONE,
HW_MODE_SBS_NONE,
@ -680,6 +684,7 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc,
HW_MODE_SS_2x2,
HW_MODE_80_MHZ,
HW_MODE_SS_0x0, HW_MODE_BW_NONE,
HW_MODE_MAC_BAND_NONE,
HW_MODE_DBS_NONE,
HW_MODE_AGILE_DFS_NONE,
HW_MODE_SBS_NONE,
@ -690,6 +695,7 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc,
HW_MODE_SS_2x2,
HW_MODE_80_MHZ,
HW_MODE_SS_2x2, HW_MODE_80_MHZ,
HW_MODE_MAC_BAND_NONE,
HW_MODE_DBS,
HW_MODE_AGILE_DFS_NONE,
HW_MODE_SBS_NONE,
@ -704,6 +710,7 @@ QDF_STATUS policy_mgr_next_actions(struct wlan_objmgr_psoc *psoc,
HW_MODE_SS_1x1,
HW_MODE_80_MHZ,
HW_MODE_SS_1x1, HW_MODE_80_MHZ,
HW_MODE_MAC_BAND_NONE,
HW_MODE_DBS,
HW_MODE_AGILE_DFS_NONE,
HW_MODE_SBS,
@ -1541,9 +1548,10 @@ enum policy_mgr_hw_mode_change policy_mgr_get_hw_mode_change_from_hw_mode_index(
struct wlan_objmgr_psoc *psoc, uint32_t hw_mode_index)
{
struct policy_mgr_psoc_priv_obj *pm_ctx;
uint32_t param = 0;
struct policy_mgr_hw_mode_params hw_mode;
enum policy_mgr_hw_mode_change value
= POLICY_MGR_HW_MODE_NOT_IN_PROGRESS;
QDF_STATUS status;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
@ -1551,16 +1559,20 @@ enum policy_mgr_hw_mode_change policy_mgr_get_hw_mode_change_from_hw_mode_index(
return value;
}
policy_mgr_info("HW param: %x", param);
param = pm_ctx->hw_mode.hw_mode_list[hw_mode_index];
if (POLICY_MGR_HW_MODE_DBS_MODE_GET(param)) {
status = policy_mgr_get_hw_mode_from_idx(psoc, hw_mode_index, &hw_mode);
if (status != QDF_STATUS_SUCCESS) {
policy_mgr_err("Failed to get HW mode index");
return value;
}
if (hw_mode.dbs_cap) {
policy_mgr_info("DBS is requested with HW (%d)",
hw_mode_index);
value = POLICY_MGR_DBS_IN_PROGRESS;
goto ret_value;
}
if (POLICY_MGR_HW_MODE_SBS_MODE_GET(param)) {
if (hw_mode.sbs_cap) {
policy_mgr_info("SBS is requested with HW (%d)",
hw_mode_index);
value = POLICY_MGR_SBS_IN_PROGRESS;

View file

@ -300,11 +300,18 @@ void policy_mgr_get_tx_rx_ss_from_config(enum hw_mode_ss_config mac_ss,
* @mac1_tx_ss: Number of tx spatial streams of MAC1
* @mac1_rx_ss: Number of rx spatial streams of MAC1
* @mac1_bw: Bandwidth of MAC1 of type 'hw_mode_bandwidth'
* @mac0_band_cap: mac0 band capability requirement
* (0: Don't care, 1: 2.4G, 2: 5G)
* @dbs: DBS capability of type 'hw_mode_dbs_capab'
* @dfs: Agile DFS capability of type 'hw_mode_agile_dfs_capab'
* @sbs: SBS capability of type 'hw_mode_sbs_capab'
*
* Fetches the HW mode index corresponding to the HW mode provided
* Fetches the HW mode index corresponding to the HW mode provided.
* In Genoa two DBS HW modes (2x2 5G + 1x1 2G, 2x2 2G + 1x1 5G),
* the "ss" number and "bw" value are not enough to specify the expected
* HW mode. But in both HW mode, the mac0 can support either 5G or 2G.
* So, the Parameter "mac0_band_cap" will specify the expected band support
* requirement on mac 0 to find the expected HW mode.
*
* Return: Positive hw mode index in case a match is found or a negative
* value, otherwise
@ -315,6 +322,7 @@ int8_t policy_mgr_get_matching_hw_mode_index(
enum hw_mode_bandwidth mac0_bw,
uint32_t mac1_tx_ss, uint32_t mac1_rx_ss,
enum hw_mode_bandwidth mac1_bw,
enum hw_mode_mac_band_cap mac0_band_cap,
enum hw_mode_dbs_capab dbs,
enum hw_mode_agile_dfs_capab dfs,
enum hw_mode_sbs_capab sbs)
@ -323,6 +331,7 @@ int8_t policy_mgr_get_matching_hw_mode_index(
uint32_t t_mac0_tx_ss, t_mac0_rx_ss, t_mac0_bw;
uint32_t t_mac1_tx_ss, t_mac1_rx_ss, t_mac1_bw;
uint32_t dbs_mode, agile_dfs_mode, sbs_mode;
uint32_t t_mac0_band_cap;
int8_t found = -EINVAL;
struct policy_mgr_psoc_priv_obj *pm_ctx;
@ -383,8 +392,16 @@ int8_t policy_mgr_get_matching_hw_mode_index(
if (sbs_mode != sbs)
continue;
found = i;
policy_mgr_debug("hw_mode index %d found", i);
t_mac0_band_cap = POLICY_MGR_HW_MODE_MAC0_BAND_GET(
pm_ctx->hw_mode.hw_mode_list[i]);
if (mac0_band_cap && t_mac0_band_cap != mac0_band_cap)
continue;
found = POLICY_MGR_HW_MODE_ID_GET(
pm_ctx->hw_mode.hw_mode_list[i]);
policy_mgr_debug("hw_mode id %d found at %d", found, i);
break;
}
return found;
@ -396,6 +413,8 @@ int8_t policy_mgr_get_matching_hw_mode_index(
* @mac0_bw: MAC0 bandwidth configuration
* @mac1_ss: MAC1 spatial stream configuration
* @mac1_bw: MAC1 bandwidth configuration
* @mac0_band_cap: mac0 band capability requirement
* (0: Don't care, 1: 2.4G, 2: 5G)
* @dbs: HW DBS capability
* @dfs: HW Agile DFS capability
* @sbs: HW SBS capability
@ -403,6 +422,12 @@ int8_t policy_mgr_get_matching_hw_mode_index(
* Get the HW mode index corresponding to the HW modes spatial stream,
* bandwidth, DBS, Agile DFS and SBS capability
*
* In Genoa two DBS HW modes (2x2 5G + 1x1 2G, 2x2 2G + 1x1 5G),
* the "ss" number and "bw" value are not enough to specify the expected
* HW mode. But in both HW mode, the mac0 can support either 5G or 2G.
* So, the Parameter "mac0_band_cap" will specify the expected band support
* requirement on mac 0 to find the expected HW mode.
*
* Return: Index number if a match is found or -negative value if not found
*/
int8_t policy_mgr_get_hw_mode_idx_from_dbs_hw_list(
@ -411,6 +436,7 @@ int8_t policy_mgr_get_hw_mode_idx_from_dbs_hw_list(
enum hw_mode_bandwidth mac0_bw,
enum hw_mode_ss_config mac1_ss,
enum hw_mode_bandwidth mac1_bw,
enum hw_mode_mac_band_cap mac0_band_cap,
enum hw_mode_dbs_capab dbs,
enum hw_mode_agile_dfs_capab dfs,
enum hw_mode_sbs_capab sbs)
@ -421,24 +447,26 @@ int8_t policy_mgr_get_hw_mode_idx_from_dbs_hw_list(
policy_mgr_get_tx_rx_ss_from_config(mac0_ss, &mac0_tx_ss, &mac0_rx_ss);
policy_mgr_get_tx_rx_ss_from_config(mac1_ss, &mac1_tx_ss, &mac1_rx_ss);
policy_mgr_debug("MAC0: TxSS=%d, RxSS=%d, BW=%d",
mac0_tx_ss, mac0_rx_ss, mac0_bw);
policy_mgr_debug("MAC0: TxSS=%d, RxSS=%d, BW=%d band=%d",
mac0_tx_ss, mac0_rx_ss, mac0_bw, mac0_band_cap);
policy_mgr_debug("MAC1: TxSS=%d, RxSS=%d, BW=%d",
mac1_tx_ss, mac1_rx_ss, mac1_bw);
mac1_tx_ss, mac1_rx_ss, mac1_bw);
policy_mgr_debug("DBS=%d, Agile DFS=%d, SBS=%d",
dbs, dfs, sbs);
dbs, dfs, sbs);
return policy_mgr_get_matching_hw_mode_index(psoc, mac0_tx_ss,
mac0_rx_ss,
mac0_bw,
mac1_tx_ss, mac1_rx_ss,
mac1_bw,
mac0_band_cap,
dbs, dfs, sbs);
}
/**
* policy_mgr_get_hw_mode_from_idx() - Get HW mode based on index
* @idx: HW mode index
* @psoc: psoc object
* @idx: HW mode id
* @hw_mode: HW mode params
*
* Fetches the HW mode parameters
@ -452,24 +480,29 @@ QDF_STATUS policy_mgr_get_hw_mode_from_idx(
{
uint32_t param;
struct policy_mgr_psoc_priv_obj *pm_ctx;
uint32_t i, hw_mode_id;
pm_ctx = policy_mgr_get_context(psoc);
if (!pm_ctx) {
policy_mgr_err("Invalid Context");
return QDF_STATUS_E_FAILURE;
}
if (idx > pm_ctx->num_dbs_hw_modes) {
policy_mgr_err("Invalid index");
return QDF_STATUS_E_FAILURE;
}
if (!pm_ctx->num_dbs_hw_modes) {
policy_mgr_err("No dbs hw modes available");
return QDF_STATUS_E_FAILURE;
}
for (i = 0; i < pm_ctx->num_dbs_hw_modes; i++) {
param = pm_ctx->hw_mode.hw_mode_list[i];
hw_mode_id = POLICY_MGR_HW_MODE_ID_GET(param);
if (hw_mode_id == idx)
break;
}
if (i >= pm_ctx->num_dbs_hw_modes) {
policy_mgr_err("hw mode id %d not found", idx);
return QDF_STATUS_E_FAILURE;
}
param = pm_ctx->hw_mode.hw_mode_list[idx];
param = pm_ctx->hw_mode.hw_mode_list[i];
hw_mode->mac0_tx_ss = POLICY_MGR_HW_MODE_MAC0_TX_STREAMS_GET(param);
hw_mode->mac0_rx_ss = POLICY_MGR_HW_MODE_MAC0_RX_STREAMS_GET(param);

View file

@ -342,6 +342,7 @@ int8_t policy_mgr_get_matching_hw_mode_index(
enum hw_mode_bandwidth mac0_bw,
uint32_t mac1_tx_ss, uint32_t mac1_rx_ss,
enum hw_mode_bandwidth mac1_bw,
enum hw_mode_mac_band_cap mac0_band_cap,
enum hw_mode_dbs_capab dbs,
enum hw_mode_agile_dfs_capab dfs,
enum hw_mode_sbs_capab sbs);
@ -351,13 +352,10 @@ int8_t policy_mgr_get_hw_mode_idx_from_dbs_hw_list(
enum hw_mode_bandwidth mac0_bw,
enum hw_mode_ss_config mac1_ss,
enum hw_mode_bandwidth mac1_bw,
enum hw_mode_mac_band_cap mac0_band_cap,
enum hw_mode_dbs_capab dbs,
enum hw_mode_agile_dfs_capab dfs,
enum hw_mode_sbs_capab sbs);
QDF_STATUS policy_mgr_get_hw_mode_from_idx(
struct wlan_objmgr_psoc *psoc,
uint32_t idx,
struct policy_mgr_hw_mode_params *hw_mode);
QDF_STATUS policy_mgr_get_old_and_new_hw_index(
struct wlan_objmgr_psoc *psoc,
uint32_t *old_hw_mode_index,