Browse Source

qcacmn: Fix wmi extended service ready handling APIs

Add hw_mode_id. HW mode is received in extended service ready.
This will be used to determine FW capability to support multiple radio.
This is used on host to create multiple instantces of pdev on host.
Change mac_phy_cap extract API to get mac_phy_cap based on hw_mode_id
and phy_id

Change-Id: I9a6abdac8799d167828f13bef61b1a1d8c3e9769
CRs-Fixed: 1113888
Kiran Venkatappa 8 years ago
parent
commit
df17b072b6

+ 3 - 1
wmi/inc/wmi_unified_api.h

@@ -1354,7 +1354,9 @@ QDF_STATUS wmi_extract_hw_mode_cap_service_ready_ext(
 			struct wmi_host_hw_mode_caps *param);
 QDF_STATUS wmi_extract_mac_phy_cap_service_ready_ext(
 			void *wmi_hdl,
-			uint8_t *evt_buf, uint8_t hw_mode_idx,
+			uint8_t *evt_buf,
+			uint8_t hw_mode_id,
+			uint8_t phy_id,
 			struct wmi_host_mac_phy_caps *param);
 QDF_STATUS wmi_extract_reg_cap_service_ready_ext(
 			void *wmi_hdl,

+ 33 - 10
wmi/inc/wmi_unified_param.h

@@ -6954,6 +6954,30 @@ struct wmi_host_ppe_threshold {
 	uint32_t ppet16_ppet8_ru3_ru0[WMI_HOST_MAX_NUM_SS];
 };
 
+/*
+ * HW mode config type replicated from FW header
+ * @WMI_HOST_HW_MODE_SINGLE: Only one PHY is active.
+ * @WMI_HOST_HW_MODE_DBS: Both PHYs are active in different bands,
+ *                        one in 2G and another in 5G.
+ * @WMI_HOST_HW_MODE_SBS_PASSIVE: Both PHYs are in passive mode (only rx) in
+ *                        same band; no tx allowed.
+ * @WMI_HOST_HW_MODE_SBS: Both PHYs are active in the same band.
+ *                        Support for both PHYs within one band is planned
+ *                        for 5G only(as indicated in WMI_MAC_PHY_CAPABILITIES),
+ *                        but could be extended to other bands in the future.
+ *                        The separation of the band between the two PHYs needs
+ *                        to be communicated separately.
+ * @WMI_HOST_HW_MODE_DBS_SBS: 3 PHYs, with 2 on the same band doing SBS
+ *                           as in WMI_HW_MODE_SBS, and 3rd on the other band
+ */
+enum wmi_host_hw_mode_config_type {
+	WMI_HOST_HW_MODE_SINGLE       = 0,
+	WMI_HOST_HW_MODE_DBS          = 1,
+	WMI_HOST_HW_MODE_SBS_PASSIVE  = 2,
+	WMI_HOST_HW_MODE_SBS          = 3,
+	WMI_HOST_HW_MODE_DBS_SBS      = 4,
+};
+
 /**
  * struct wmi_host_service_ext_param - EXT service base params in event
  * @default_conc_scan_config_bits: Default concurrenct scan config
@@ -6982,10 +7006,12 @@ struct wmi_host_service_ext_param {
  * @hw_mode_id: identify a particular set of HW characteristics,
  *              as specified by the subsequent fields
  * @phy_id_map: BIT0 represents phy_id 0, BIT1 represent phy_id 1 and so on
+ * @hw_mode_config_type: HW mode config type
  */
 struct wmi_host_hw_mode_caps {
 	uint32_t hw_mode_id;
 	uint32_t phy_id_map;
+	uint32_t hw_mode_config_type;
 };
 
 /**
@@ -6999,7 +7025,7 @@ struct wmi_host_hw_mode_caps {
  *        by hw_mode_id.
  * @pdev_id: pdev_id starts with 1. pdev_id 1 => phy_id 0, pdev_id 2 => phy_id 1
  * @phy_id: Starts with 0
- * @union of supported modulations
+ * @bitmap of supported modulations
  * @supported_bands: supported bands, enum WLAN_BAND_CAPABILITY
  * @ampdu_density: ampdu density 0 for no restriction, 1 for 1/4 us,
  *        2 for 1/2 us, 3 for 1 us,4 for 2 us, 5 for 4 us,
@@ -7037,15 +7063,12 @@ struct wmi_host_mac_phy_caps {
 	uint32_t hw_mode_id;
 	uint32_t pdev_id;
 	uint32_t phy_id;
-	union {
-		uint32_t supports_11b:1,
-			 supports_11g:1,
-			 supports_11a:1,
-			 supports_11n:1,
-			 supports_11ac:1,
-			 supports_11ax:1;
-		uint32_t supported_flags;
-	};
+	uint32_t supports_11b:1,
+		 supports_11g:1,
+		 supports_11a:1,
+		 supports_11n:1,
+		 supports_11ac:1,
+		 supports_11ax:1;
 	uint32_t supported_bands;
 	uint32_t ampdu_density;
 	uint32_t max_bw_supported_2G;

+ 3 - 1
wmi/inc/wmi_unified_priv.h

@@ -1203,7 +1203,9 @@ QDF_STATUS (*extract_hw_mode_cap_service_ready_ext)(
 
 QDF_STATUS (*extract_mac_phy_cap_service_ready_ext)(
 			wmi_unified_t wmi_handle,
-			uint8_t *evt_buf, uint8_t hw_mode_idx,
+			uint8_t *evt_buf,
+			uint8_t hw_mode_id,
+			uint8_t phy_id,
 			struct wmi_host_mac_phy_caps *param);
 
 QDF_STATUS (*extract_reg_cap_service_ready_ext)(

+ 7 - 4
wmi/src/wmi_unified_api.c

@@ -6514,14 +6514,17 @@ QDF_STATUS wmi_extract_hw_mode_cap_service_ready_ext(
  *       extract MAC phy cap from service ready event
  * @wmi_handle: wmi handle
  * @param evt_buf: pointer to event buffer
- * @param param: Pointer to hold evt buf
- * @param hw_mode_idx: hw mode idx should be less than num_mode
+ * @param hw_mode_id: hw mode id of hw_mode_caps
+ * @param phy_id: phy_id within hw_mode_cap
+ * @param param: pointer to mac phy caps structure to hold the values from event
  *
  * Return: QDF_STATUS_SUCCESS for success or error code
  */
 QDF_STATUS wmi_extract_mac_phy_cap_service_ready_ext(
 			void *wmi_hdl,
-			uint8_t *evt_buf, uint8_t hw_mode_idx,
+			uint8_t *evt_buf,
+			uint8_t hw_mode_id,
+			uint8_t phy_id,
 			struct wmi_host_mac_phy_caps *param)
 {
 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
@@ -6529,7 +6532,7 @@ QDF_STATUS wmi_extract_mac_phy_cap_service_ready_ext(
 	if (wmi_handle->ops->extract_mac_phy_cap_service_ready_ext)
 		return wmi_handle->ops->extract_mac_phy_cap_service_ready_ext(
 				wmi_handle,
-				evt_buf, hw_mode_idx, param);
+				evt_buf, hw_mode_id, phy_id, param);
 
 	return QDF_STATUS_E_FAILURE;
 }

+ 37 - 10
wmi/src/wmi_unified_tlv.c

@@ -12861,6 +12861,9 @@ static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv(
 	param->hw_mode_id = param_buf->hw_mode_caps[hw_mode_idx].hw_mode_id;
 	param->phy_id_map = param_buf->hw_mode_caps[hw_mode_idx].phy_id_map;
 
+	param->hw_mode_config_type =
+		param_buf->hw_mode_caps[hw_mode_idx].hw_mode_config_type;
+
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -12871,37 +12874,61 @@ static QDF_STATUS extract_hw_mode_cap_service_ready_ext_tlv(
  * @param evt_buf: pointer to event buffer
  * @param param: Pointer to hold evt buf
  * @param hw_mode_idx: hw mode idx should be less than num_mode
+ * @param phy_id: phy id within hw_mode
  *
  * Return: QDF_STATUS_SUCCESS for success or error code
  */
 static QDF_STATUS extract_mac_phy_cap_service_ready_ext_tlv(
 			wmi_unified_t wmi_handle,
-			uint8_t *event, uint8_t hw_mode_idx,
+			uint8_t *event, uint8_t hw_mode_id, uint8_t phy_id,
 			struct wmi_host_mac_phy_caps *param)
 {
 	WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *param_buf;
-	WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps;
 	WMI_MAC_PHY_CAPABILITIES *mac_phy_caps;
+	WMI_SOC_MAC_PHY_HW_MODE_CAPS *hw_caps;
+	uint32_t phy_map;
+	uint8_t hw_idx, phy_idx = 0;
 
 	param_buf = (WMI_SERVICE_READY_EXT_EVENTID_param_tlvs *) event;
 	if (!param_buf)
 		return -EINVAL;
 
 	hw_caps = param_buf->soc_hw_mode_caps;
-	if (hw_mode_idx >= hw_caps->num_hw_modes)
+	for (hw_idx = 0; hw_idx < hw_caps->num_hw_modes; hw_idx++) {
+		if (hw_mode_id == param_buf->hw_mode_caps[hw_idx].hw_mode_id)
+			break;
+
+		phy_map = param_buf->hw_mode_caps[hw_idx].phy_id_map;
+		while (phy_map) {
+			phy_map >>= 1;
+			phy_idx++;
+		}
+	}
+
+	if (hw_idx == hw_caps->num_hw_modes)
+		return -EINVAL;
+
+	phy_idx += phy_id;
+	if (phy_idx >= param_buf->num_mac_phy_caps)
 		return -EINVAL;
 
-	mac_phy_caps = &param_buf->mac_phy_caps[hw_mode_idx];
+	mac_phy_caps = &param_buf->mac_phy_caps[phy_idx];
 
 	param->hw_mode_id = mac_phy_caps->hw_mode_id;
 	param->pdev_id = mac_phy_caps->pdev_id;
 	param->phy_id = mac_phy_caps->phy_id;
-	param->supports_11b = mac_phy_caps->supports_11b;
-	param->supports_11g = mac_phy_caps->supports_11g;
-	param->supports_11a = mac_phy_caps->supports_11a;
-	param->supports_11n = mac_phy_caps->supports_11n;
-	param->supports_11ac = mac_phy_caps->supports_11ac;
-	param->supports_11ax = mac_phy_caps->supports_11ax;
+	param->supports_11b =
+			WMI_SUPPORT_11B_GET(mac_phy_caps->supported_flags);
+	param->supports_11g =
+			WMI_SUPPORT_11G_GET(mac_phy_caps->supported_flags);
+	param->supports_11a =
+			WMI_SUPPORT_11A_GET(mac_phy_caps->supported_flags);
+	param->supports_11n =
+			WMI_SUPPORT_11N_GET(mac_phy_caps->supported_flags);
+	param->supports_11ac =
+			WMI_SUPPORT_11AC_GET(mac_phy_caps->supported_flags);
+	param->supports_11ax =
+			WMI_SUPPORT_11AX_GET(mac_phy_caps->supported_flags);
 
 	param->supported_bands = mac_phy_caps->supported_bands;
 	param->ampdu_density = mac_phy_caps->ampdu_density;