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
diff --git a/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h b/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h
index e48ff10..2fa1cd6 100644
--- a/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h
+++ b/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h
@@ -712,6 +712,8 @@
* @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 @@
* 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 @@
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_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 */
diff --git a/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h b/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h
index 8706c61..6b46aab 100644
--- a/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h
+++ b/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h
@@ -115,6 +115,26 @@
};
/**
+ * 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
* @POLICY_MGR_PCL_GROUP_ID2_ID3: Use weights of group2 and group3
diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c
index 1bd5c4d..603382b 100644
--- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c
+++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c
@@ -99,6 +99,7 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c
index a2b754e..b766441 100644
--- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c
+++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c
@@ -300,11 +300,18 @@
* @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 @@
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 @@
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 @@
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 @@
* @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 @@
* 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 @@
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 @@
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 @@
{
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);
diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h
index 32d2cbf..0d7655e 100644
--- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h
+++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h
@@ -342,6 +342,7 @@
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 @@
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,