Jelajahi Sumber

qcacmn: Fixed regdb kernel panic

Analysis:
Seen kernel panic when setting the NULL country code in FW.

Solution:
Send an indication to Offload layer if Firmware fails to set
the country code.

Change-Id: Ic01ee170cfca31d840236625c1d1497426eafc68
CRs-Fixed: 2083318
Shashikala Prabhu 7 tahun lalu
induk
melakukan
3519b96e24

+ 2 - 0
target_if/regulatory/src/target_if_reg.c

@@ -320,6 +320,8 @@ QDF_STATUS target_if_register_regulatory_tx_ops(struct wlan_lmac_if_tx_ops
 
 	reg_ops->fill_umac_legacy_chanlist = NULL;
 
+	reg_ops->set_country_failed = NULL;
+
 	reg_ops->register_11d_new_cc_handler =
 		tgt_if_regulatory_register_11d_new_cc_handler;
 

+ 1 - 0
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -421,6 +421,7 @@ struct wlan_lmac_if_reg_tx_ops {
 	QDF_STATUS (*set_user_country_code)(struct wlan_objmgr_psoc *psoc,
 					    uint8_t pdev_id,
 					    struct cc_regdmn_s *rd);
+	QDF_STATUS (*set_country_failed)(struct wlan_objmgr_pdev *pdev);
 };
 
 /**

+ 28 - 8
umac/regulatory/core/src/reg_services.c

@@ -2431,6 +2431,7 @@ QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info
 	enum direction dir;
 	uint8_t phy_id;
 	struct wlan_objmgr_pdev *pdev;
+	struct wlan_lmac_if_reg_tx_ops *tx_ops;
 
 	reg_debug("process reg master chan list");
 
@@ -2443,6 +2444,33 @@ QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info
 	}
 
 	phy_id = regulat_info->phy_id;
+
+	if (soc_reg->offload_enabled) {
+		dbg_id = WLAN_REGULATORY_NB_ID;
+		dir = NORTHBOUND;
+	} else {
+		dbg_id = WLAN_REGULATORY_SB_ID;
+		dir = SOUTHBOUND;
+	}
+
+	if (regulat_info->status_code != REG_SET_CC_STATUS_PASS) {
+		reg_err("Setting country code failed, status code is %d",
+				regulat_info->status_code);
+
+		pdev = wlan_objmgr_get_pdev_by_id(psoc, phy_id, dbg_id);
+		if (!pdev) {
+			reg_err("pdev is NULL");
+			return QDF_STATUS_E_FAILURE;
+		}
+		wlan_objmgr_pdev_release_ref(pdev, dbg_id);
+
+		tx_ops = reg_get_psoc_tx_ops(psoc);
+		if (tx_ops->set_country_failed)
+			tx_ops->set_country_failed(pdev);
+
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	mas_chan_list = soc_reg->mas_chan_params[phy_id].mas_chan_list;
 
 	reg_init_channel_map(regulat_info->dfs_region);
@@ -2524,14 +2552,6 @@ QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info
 			     REG_ALPHA2_LEN + 1);
 	}
 
-	if (soc_reg->offload_enabled) {
-		dbg_id = WLAN_REGULATORY_NB_ID;
-		dir = NORTHBOUND;
-	} else {
-		dbg_id = WLAN_REGULATORY_SB_ID;
-		dir = SOUTHBOUND;
-	}
-
 	pdev = wlan_objmgr_get_pdev_by_id(psoc, phy_id, dbg_id);
 	if (pdev != NULL) {
 		reg_propagate_mas_chan_list_to_pdev(psoc, pdev, &dir);