From 3519b96e2479f191c1478aef1773741a3feeb0ed Mon Sep 17 00:00:00 2001 From: Shashikala Prabhu Date: Wed, 2 Aug 2017 11:12:33 +0530 Subject: [PATCH] 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 --- target_if/regulatory/src/target_if_reg.c | 2 ++ .../lmac_if/inc/wlan_lmac_if_def.h | 1 + umac/regulatory/core/src/reg_services.c | 36 ++++++++++++++----- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/target_if/regulatory/src/target_if_reg.c b/target_if/regulatory/src/target_if_reg.c index 192e58fdee02..af8b78336c70 100644 --- a/target_if/regulatory/src/target_if_reg.c +++ b/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; diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h index e6c3d0e72dd6..1eecdb103df9 100644 --- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h +++ b/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); }; /** diff --git a/umac/regulatory/core/src/reg_services.c b/umac/regulatory/core/src/reg_services.c index 5ab1c465bac3..cd5c9a57af2a 100644 --- a/umac/regulatory/core/src/reg_services.c +++ b/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);