瀏覽代碼

qcacld-3.0: Check FW support for FW mem dump

Currently HDD sends a FW memory dump request to firmware without
checking support for this feature. This can lead to a crash as firmware
doesn't send the command response if feature is not supported.
Add a check in HDD so that the request is only sent when FW memory dump
capability is advertised by the firmware.

Change-Id: I73b980f50910e13aa5f2d2434f07b6f985dd5010
CRs-fixed: 1090806
Manjeet Singh 8 年之前
父節點
當前提交
70d3d931d9

+ 1 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -1863,6 +1863,7 @@ struct hdd_context {
 	struct hdd_nud_stats_context nud_stats_context;
 	eCsrBand curr_band;
 	uint8_t active_ac;
+	bool fw_mem_dump_enabled;
 };
 
 /**

+ 3 - 0
core/hdd/src/wlan_hdd_main.c

@@ -1748,6 +1748,9 @@ void hdd_update_tgt_cfg(void *context, void *param)
 	 * Update txBFCsnValue and NumSoundingDim values to vhtcap in wiphy
 	 */
 	hdd_update_wiphy_vhtcap(hdd_ctx);
+
+	hdd_ctx->fw_mem_dump_enabled = cfg->fw_mem_dump_enabled;
+
 	/*
 	 * If BPF is enabled, maxWowFilters set to WMA_STA_WOW_DEFAULT_PTRN_MAX
 	 * because we need atleast WMA_STA_WOW_DEFAULT_PTRN_MAX free slots to

+ 8 - 1
core/hdd/src/wlan_hdd_memdump.c

@@ -209,12 +209,19 @@ static int __wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy,
 	if (status)
 		return status;
 
+	if (!hdd_ctx->fw_mem_dump_enabled) {
+		hdd_notice("FW memory dump not supported by this FW");
+		return -ENOTSUPP;
+	}
 	qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 	if (!qdf_ctx) {
 		hdd_err("QDF context is NULL");
 		return -EINVAL;
 	}
-
+	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
+		hdd_err("memdump not supported in FTM mode");
+		return -EINVAL;
+	}
 	if (hdd_ctx->memdump_in_progress) {
 		hdd_err("Already a memdump req in progress.");
 		return -EBUSY;

+ 2 - 0
core/wma/inc/wma.h

@@ -1380,6 +1380,7 @@ struct hw_mode_idx_to_mac_cap_idx {
  * @saved_chan: saved channel list sent as part of WMI_SCAN_CHAN_LIST_CMDID
  * @dfs_cac_offload: dfs and cac timer offload
  * @ito_repeat_count: Indicates ito repeated count
+ * @fw_mem_dump_enabled: Fw memory dump support
  */
 typedef struct {
 	void *wmi_handle;
@@ -1573,6 +1574,7 @@ typedef struct {
 	bool tx_bfee_8ss_enabled;
 	bool in_imps;
 	uint8_t  ito_repeat_count;
+	bool fw_mem_dump_enabled;
 } t_wma_handle, *tp_wma_handle;
 
 /**

+ 2 - 0
core/wma/inc/wma_tgt_cfg.h

@@ -155,6 +155,7 @@ struct wma_dfs_radar_ind {
  * @he_cap: HE capability received from FW
  * @dfs_cac_offload: dfs and cac timer offloaded
  * @tx_bfee_8ss_enabled: Tx Beamformee support for 8x8
+ * @fw_mem_dump_enabled: Fw memory dump support
  */
 struct wma_tgt_cfg {
 	uint32_t target_fw_version;
@@ -189,5 +190,6 @@ struct wma_tgt_cfg {
 #endif
 	bool dfs_cac_offload;
 	bool tx_bfee_8ss_enabled;
+	bool fw_mem_dump_enabled;
 };
 #endif /* WMA_TGT_CFG_H */

+ 7 - 0
core/wma/src/wma_main.c

@@ -4671,6 +4671,7 @@ static void wma_update_hdd_cfg(tp_wma_handle wma_handle)
 			      - WMI_TLV_HEADROOM;
 	wma_setup_egap_support(&tgt_cfg, wma_handle);
 	tgt_cfg.tx_bfee_8ss_enabled = wma_handle->tx_bfee_8ss_enabled;
+	tgt_cfg.fw_mem_dump_enabled = wma_handle->fw_mem_dump_enabled;
 	wma_update_hdd_cfg_ndp(wma_handle, &tgt_cfg);
 	wma_handle->tgt_cfg_update_cb(hdd_ctx, &tgt_cfg);
 }
@@ -5026,6 +5027,12 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
 #endif /* WLAN_FEATURE_GTK_OFFLOAD */
 
 #ifndef CONVERGED_P2P_ENABLE
+	if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap,
+				   WMI_SERVICE_FW_MEM_DUMP_SUPPORT))
+		wma_handle->fw_mem_dump_enabled = true;
+	else
+		wma_handle->fw_mem_dump_enabled = false;
+
 	status = wmi_unified_register_event_handler(wma_handle->wmi_handle,
 						    WMI_P2P_NOA_EVENTID,
 						    wma_p2p_noa_event_handler,