From bc3efea88525aca39499ba67d5f88a5dd229487e Mon Sep 17 00:00:00 2001 From: "Baila, Shashikala Prabhu" Date: Tue, 23 May 2017 11:54:45 +0530 Subject: [PATCH] qcacmn: Add API to get 2GHz/5GHz freq range and wireless modes Offload layer uses low and high 2GHz/5GHz freq ranges and chip supported wireless modes to populate umac ic channel list. Change-Id: I899edd83548d68e67659b3a9273ddaaaf740540b CRs-Fixed: 2047212 --- target_if/core/src/target_if_main.c | 6 +-- target_if/regulatory/src/target_if_reg.c | 3 ++ .../lmac_if/inc/wlan_lmac_if_def.h | 2 + umac/regulatory/core/src/reg_db_parser.c | 6 +++ umac/regulatory/core/src/reg_priv.h | 1 + umac/regulatory/core/src/reg_services.c | 16 ++++---- .../dispatcher/inc/wlan_reg_services_api.h | 25 +++++++++++ .../dispatcher/src/wlan_reg_services_api.c | 41 +++++++++++++++++++ 8 files changed, 88 insertions(+), 12 deletions(-) diff --git a/target_if/core/src/target_if_main.c b/target_if/core/src/target_if_main.c index 30a15b29ec77..4f74ad29245e 100644 --- a/target_if/core/src/target_if_main.c +++ b/target_if/core/src/target_if_main.c @@ -211,6 +211,9 @@ static void target_if_sptrl_tx_ops_register( static QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) { + /* call regulatory callback to register tx ops */ + target_if_register_regulatory_tx_ops(tx_ops); + /* call umac callback to register legacy tx ops */ wlan_lmac_if_umac_tx_ops_register(tx_ops); @@ -227,9 +230,6 @@ QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) target_if_dfs_tx_ops_register(tx_ops); - /* call regulatory callback to register tx ops */ - target_if_register_regulatory_tx_ops(tx_ops); - target_if_son_tx_ops_register(tx_ops); target_if_tdls_tx_ops_register(tx_ops); diff --git a/target_if/regulatory/src/target_if_reg.c b/target_if/regulatory/src/target_if_reg.c index 180e8858efcb..e44a6d857074 100644 --- a/target_if/regulatory/src/target_if_reg.c +++ b/target_if/regulatory/src/target_if_reg.c @@ -148,6 +148,9 @@ QDF_STATUS target_if_register_regulatory_tx_ops(struct wlan_lmac_if_tx_ops tgt_if_regulatory_unregister_master_list_handler; reg_ops->set_country_code = tgt_if_regulatory_set_country_code; + + reg_ops->fill_umac_legacy_chanlist = NULL; + return QDF_STATUS_SUCCESS; } 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 3bf877809498..c48ffa876d62 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 @@ -544,6 +544,8 @@ struct wlan_lmac_if_reg_tx_ops { void *arg); QDF_STATUS (*set_country_code)(struct wlan_objmgr_psoc *psoc, void *arg); + QDF_STATUS (*fill_umac_legacy_chanlist)(struct wlan_objmgr_pdev *pdev, + struct regulatory_channel *cur_chan_list); }; /** diff --git a/umac/regulatory/core/src/reg_db_parser.c b/umac/regulatory/core/src/reg_db_parser.c index 2644056c6c4a..7bae7a933525 100644 --- a/umac/regulatory/core/src/reg_db_parser.c +++ b/umac/regulatory/core/src/reg_db_parser.c @@ -212,6 +212,9 @@ static inline QDF_STATUS reg_get_reginfo_form_country_code_and_regdmn_pair( g_all_countries[country_index].alpha2_11d, sizeof(g_all_countries[country_index].alpha2_11d)); + reg_info->ctry_code = + g_all_countries[country_index].country_code; + reg_info->reg_dmn_pair = 0; reg_info->dfs_region = regdomains_5g[dmn_id_5g].dfs_region; reg_info->phybitmap = g_all_countries[country_index].phymode_bitmap; @@ -276,6 +279,9 @@ static inline QDF_STATUS reg_get_reginfo_form_regdmn_pair( qdf_mem_zero(reg_info->alpha2, sizeof(reg_info->alpha2)); + reg_info->reg_dmn_pair = + g_reg_dmn_pairs[regdmn_pair].reg_dmn_pair_id; + reg_info->ctry_code = 0; reg_info->dfs_region = regdomains_5g[dmn_id_5g].dfs_region; reg_info->phybitmap = 0; diff --git a/umac/regulatory/core/src/reg_priv.h b/umac/regulatory/core/src/reg_priv.h index ae83a0206163..762e23fb31d9 100644 --- a/umac/regulatory/core/src/reg_priv.h +++ b/umac/regulatory/core/src/reg_priv.h @@ -84,6 +84,7 @@ struct wlan_regulatory_pdev_priv_obj { bool set_fcc_channel; enum band_info band_capability; bool indoor_chan_enabled; + uint32_t wireless_modes; }; #endif diff --git a/umac/regulatory/core/src/reg_services.c b/umac/regulatory/core/src/reg_services.c index 18c9e1a101b1..ec02bd151318 100644 --- a/umac/regulatory/core/src/reg_services.c +++ b/umac/regulatory/core/src/reg_services.c @@ -1716,6 +1716,7 @@ static void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc, struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj; struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; enum direction *dir = arg; + struct wlan_lmac_if_reg_tx_ops *reg_tx_ops; wlan_psoc_obj_lock(psoc); psoc_priv_obj = (struct wlan_regulatory_psoc_priv_obj *) @@ -1740,6 +1741,11 @@ static void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc, compute_pdev_current_chan_list(pdev_priv_obj); + reg_tx_ops = reg_get_psoc_tx_ops(psoc); + if(reg_tx_ops->fill_umac_legacy_chanlist) + reg_tx_ops->fill_umac_legacy_chanlist(pdev, + pdev_priv_obj->cur_chan_list); + if (*dir == NORTHBOUND) send_scheduler_msg_nb(psoc, pdev); else @@ -2171,6 +2177,7 @@ QDF_STATUS wlan_regulatory_pdev_obj_created_notification( pdev_priv_obj->range_2g_high = range_2g_high; pdev_priv_obj->range_5g_low = range_5g_low; pdev_priv_obj->range_5g_high = range_5g_high; + pdev_priv_obj->wireless_modes = reg_cap_ptr->wireless_modes; init_pdev_chan_list(psoc_priv_obj, pdev_priv_obj); @@ -2669,15 +2676,6 @@ QDF_STATUS reg_program_chan_list(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_FAILURE; } - if (rd->flags == CC_IS_SET || - rd->flags == ALPHA_IS_SET) { - soc_reg->ctry_code = - g_all_countries[country_index].country_code; - } - - if (rd->flags == REGDMN_IS_SET) - soc_reg->reg_dmn_pair = rd->cc.regdmn_id; - reg_info->offload_enabled = false; reg_process_master_chan_list(reg_info); diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index 32bb754203ac..851d00cba9c1 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -360,4 +360,29 @@ void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc, void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc, reg_chan_change_callback cbk); +/** + * wlan_reg_get_chip_mode() - get supported chip mode + * @pdev: pdev pointer + * @chip_mode: chip mode + * + * Return: QDF STATUS + */ +QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev, + uint32_t *chip_mode); + +/** + * wlan_reg_get_freq_range() - Get 2GHz and 5GHz frequency range + * @pdev: pdev pointer + * @low_2g: low 2GHz frequency range + * @high_2g: high 2GHz frequency range + * @low_5g: low 5GHz frequency range + * @high_5g: high 5GHz frequency range + * + * Return: QDF status + */ +QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev, + uint32_t *low_2g, + uint32_t *high_2g, + uint32_t *low_5g, + uint32_t *high_5g); #endif diff --git a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c index 2e685a8e9e70..810b8fad569b 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_services_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_services_api.c @@ -409,3 +409,44 @@ void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc, } +QDF_STATUS wlan_reg_get_chip_mode(struct wlan_objmgr_pdev *pdev, + uint32_t *chip_mode) +{ + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; + + pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev, + WLAN_UMAC_COMP_REGULATORY); + + if (NULL == pdev_priv_obj) { + reg_err("reg pdev private obj is NULL"); + return QDF_STATUS_E_FAULT; + } + + *chip_mode = pdev_priv_obj->wireless_modes; + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_reg_get_freq_range(struct wlan_objmgr_pdev *pdev, + uint32_t *low_2g, + uint32_t *high_2g, + uint32_t *low_5g, + uint32_t *high_5g) +{ + struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; + + pdev_priv_obj = wlan_objmgr_pdev_get_comp_private_obj(pdev, + WLAN_UMAC_COMP_REGULATORY); + + if (NULL == pdev_priv_obj) { + reg_err("reg pdev private obj is NULL"); + return QDF_STATUS_E_FAULT; + } + + *low_2g = pdev_priv_obj->range_2g_low; + *high_2g = pdev_priv_obj->range_2g_high; + *low_5g = pdev_priv_obj->range_5g_low; + *high_5g = pdev_priv_obj->range_5g_high; + + return QDF_STATUS_SUCCESS; +}