From ca7d77b4080e6ebdc18eb3f96fa32d930bedcef2 Mon Sep 17 00:00:00 2001 From: Abhijit Pradhan Date: Wed, 12 Jul 2017 12:08:42 +0530 Subject: [PATCH] qcacmn: Fill per psoc regulatory info Move per psoc regulatory info from pdev level function to psoc level function. Change-Id: Id06c6fee110ce929925f568db3a3b507214294d5 CRs-Fixed: 2066122 --- .../inc/service_ready_event_handler.h | 1 + .../src/service_ready_event_handler.c | 2 + target_if/regulatory/inc/target_if_reg.h | 8 ++++ target_if/regulatory/src/target_if_reg.c | 25 ++++++++-- .../lmac_if/inc/wlan_lmac_if_def.h | 7 +-- .../lmac_if/src/wlan_lmac_if.c | 22 +++++++-- umac/regulatory/core/src/reg_services.c | 47 ++++++++++++++----- umac/regulatory/core/src/reg_services.h | 18 +++++++ .../dispatcher/inc/wlan_reg_tgt_api.h | 18 +++++++ .../dispatcher/src/wlan_reg_tgt_api.c | 11 +++++ 10 files changed, 134 insertions(+), 25 deletions(-) diff --git a/target_if/init_deinit/inc/service_ready_event_handler.h b/target_if/init_deinit/inc/service_ready_event_handler.h index 319a109bb538..3ad468f864da 100644 --- a/target_if/init_deinit/inc/service_ready_event_handler.h +++ b/target_if/init_deinit/inc/service_ready_event_handler.h @@ -37,6 +37,7 @@ #include "wlan_objmgr_psoc_obj.h" #include "target_if.h" #include "target_if_scan.h" +#include "target_if_reg.h" /** * init_deinit_service_ready_event_handler() - service ready handler diff --git a/target_if/init_deinit/src/service_ready_event_handler.c b/target_if/init_deinit/src/service_ready_event_handler.c index dabbf6a7e332..402507d72fbc 100644 --- a/target_if/init_deinit/src/service_ready_event_handler.c +++ b/target_if/init_deinit/src/service_ready_event_handler.c @@ -119,6 +119,8 @@ int init_deinit_service_ready_event_handler(ol_scn_t scn_handle, target_if_scan_set_max_active_scans(psoc, WLAN_MAX_ACTIVE_SCANS_ALLOWED); + target_if_reg_set_offloaded_info(psoc); + free_param_and_exit: qdf_mem_free(service_param); diff --git a/target_if/regulatory/inc/target_if_reg.h b/target_if/regulatory/inc/target_if_reg.h index c435bbeb7d89..06f8a03d770b 100644 --- a/target_if/regulatory/inc/target_if_reg.h +++ b/target_if/regulatory/inc/target_if_reg.h @@ -30,3 +30,11 @@ */ QDF_STATUS target_if_register_regulatory_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops); + +/** + * target_if_reg_set_offloaded_info() - populate regulatory offloaded info + * + * @psoc: psoc pointer + * Return: Success or Failure + */ +QDF_STATUS target_if_reg_set_offloaded_info(struct wlan_objmgr_psoc *psoc); diff --git a/target_if/regulatory/src/target_if_reg.c b/target_if/regulatory/src/target_if_reg.c index b15f4a62a588..20b2b946ec6c 100644 --- a/target_if/regulatory/src/target_if_reg.c +++ b/target_if/regulatory/src/target_if_reg.c @@ -98,6 +98,27 @@ target_if_regulatory_get_rx_ops(struct wlan_objmgr_psoc *psoc) return &psoc->soc_cb.rx_ops.reg_rx_ops; } +QDF_STATUS target_if_reg_set_offloaded_info(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_lmac_if_reg_rx_ops *reg_rx_ops; + + reg_rx_ops = target_if_regulatory_get_rx_ops(psoc); + if (!reg_rx_ops) { + target_if_err("reg_rx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + if (reg_rx_ops->reg_set_regdb_offloaded) + reg_rx_ops->reg_set_regdb_offloaded(psoc, + tgt_if_regulatory_is_regdb_offloaded(psoc)); + + if (reg_rx_ops->reg_set_11d_offloaded) + reg_rx_ops->reg_set_11d_offloaded(psoc, + tgt_if_regulatory_is_11d_offloaded(psoc)); + + return QDF_STATUS_SUCCESS; +} + static int tgt_reg_chan_list_update_handler(ol_scn_t handle, uint8_t *event_buf, uint32_t len) @@ -295,10 +316,6 @@ QDF_STATUS target_if_register_regulatory_tx_ops(struct wlan_lmac_if_tx_ops reg_ops->stop_11d_scan = tgt_if_regulatory_stop_11d_scan; - reg_ops->is_11d_offloaded = tgt_if_regulatory_is_11d_offloaded; - - reg_ops->is_regdb_offloaded = tgt_if_regulatory_is_regdb_offloaded; - reg_ops->is_there_serv_ready_extn = tgt_if_regulatory_is_there_serv_ready_extn; 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 c1101edc6e0c..c85c502769d1 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 @@ -562,9 +562,6 @@ struct wlan_lmac_if_reg_tx_ops { struct reg_start_11d_scan_req *reg_start_11d_scan_req); QDF_STATUS (*stop_11d_scan)(struct wlan_objmgr_psoc *psoc, struct reg_stop_11d_scan_req *reg_stop_11d_scan_req); - - bool (*is_11d_offloaded)(struct wlan_objmgr_psoc *psoc); - bool (*is_regdb_offloaded)(struct wlan_objmgr_psoc *psoc); bool (*is_there_serv_ready_extn)(struct wlan_objmgr_psoc *psoc); }; @@ -758,6 +755,10 @@ struct wlan_lmac_if_reg_rx_ops { *reg_info); QDF_STATUS (*reg_11d_new_cc_handler)(struct wlan_objmgr_psoc *psoc, struct reg_11d_new_country *reg_11d_new_cc); + QDF_STATUS (*reg_set_regdb_offloaded)(struct wlan_objmgr_psoc *psoc, + bool val); + QDF_STATUS (*reg_set_11d_offloaded)(struct wlan_objmgr_psoc *psoc, + bool val); }; #ifdef CONVERGED_P2P_ENABLE diff --git a/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c b/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c index 330b6553d68c..2e07c96b8991 100644 --- a/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c +++ b/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c @@ -191,6 +191,22 @@ static void wlan_lmac_if_register_nan_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops) } #endif /* WLAN_FEATURE_NAN_CONVERGENCE */ +static void wlan_lmac_if_umac_reg_rx_ops_register( + struct wlan_lmac_if_rx_ops *rx_ops) +{ + rx_ops->reg_rx_ops.master_list_handler = + tgt_reg_process_master_chan_list; + + rx_ops->reg_rx_ops.reg_11d_new_cc_handler = + tgt_reg_process_11d_new_country; + + rx_ops->reg_rx_ops.reg_set_regdb_offloaded = + tgt_reg_set_regdb_offloaded; + + rx_ops->reg_rx_ops.reg_set_11d_offloaded = + tgt_reg_set_11d_offloaded; +} + #ifdef CONVERGED_P2P_ENABLE static void wlan_lmac_if_umac_rx_ops_register_p2p( struct wlan_lmac_if_rx_ops *rx_ops) @@ -316,11 +332,7 @@ wlan_lmac_if_umac_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) wlan_lmac_if_register_nan_rx_ops(rx_ops); - rx_ops->reg_rx_ops.master_list_handler = - tgt_reg_process_master_chan_list; - - rx_ops->reg_rx_ops.reg_11d_new_cc_handler = - tgt_reg_process_11d_new_country; + wlan_lmac_if_umac_reg_rx_ops_register(rx_ops); /* p2p rx ops */ wlan_lmac_if_umac_rx_ops_register_p2p(rx_ops); diff --git a/umac/regulatory/core/src/reg_services.c b/umac/regulatory/core/src/reg_services.c index b589215972a4..6a91ba4063b8 100644 --- a/umac/regulatory/core/src/reg_services.c +++ b/umac/regulatory/core/src/reg_services.c @@ -1872,7 +1872,6 @@ QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info struct cur_reg_rule *reg_rule_2g, *reg_rule_5g; uint16_t min_bw_2g, max_bw_2g, min_bw_5g, max_bw_5g; struct regulatory_channel *mas_chan_list; - struct wlan_lmac_if_reg_tx_ops *tx_ops; struct wlan_objmgr_psoc *psoc; enum channel_enum chan_enum; wlan_objmgr_ref_dbgid dbg_id; @@ -1890,18 +1889,6 @@ QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info return QDF_STATUS_E_FAILURE; } - tx_ops = reg_get_psoc_tx_ops(psoc); - if (tx_ops->is_regdb_offloaded) - soc_reg->offload_enabled = - tx_ops->is_regdb_offloaded(psoc); - else - soc_reg->offload_enabled = false; - if (tx_ops->is_11d_offloaded) - soc_reg->is_11d_offloaded = - tx_ops->is_11d_offloaded(psoc); - else - soc_reg->is_11d_offloaded = false; - phy_id = regulat_info->phy_id; mas_chan_list = soc_reg->mas_chan_params[phy_id].mas_chan_list; @@ -3015,3 +3002,37 @@ bool reg_11d_enabled_on_host(struct wlan_objmgr_psoc *psoc) return (psoc_priv_obj->enable_11d_supp && !psoc_priv_obj->is_11d_offloaded); } + +QDF_STATUS reg_set_regdb_offloaded(struct wlan_objmgr_psoc *psoc, + bool val) +{ + struct wlan_regulatory_psoc_priv_obj *soc_reg; + + soc_reg = reg_get_psoc_obj(psoc); + + if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) { + reg_err("psoc reg component is NULL"); + return QDF_STATUS_E_FAILURE; + } + + soc_reg->offload_enabled = val; + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc, + bool val) +{ + struct wlan_regulatory_psoc_priv_obj *soc_reg; + + soc_reg = reg_get_psoc_obj(psoc); + + if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) { + reg_err("psoc reg component is NULL"); + return QDF_STATUS_E_FAILURE; + } + + soc_reg->is_11d_offloaded = val; + + return QDF_STATUS_SUCCESS; +} diff --git a/umac/regulatory/core/src/reg_services.h b/umac/regulatory/core/src/reg_services.h index 4c2eb1dcd866..13e85474303e 100644 --- a/umac/regulatory/core/src/reg_services.h +++ b/umac/regulatory/core/src/reg_services.h @@ -356,4 +356,22 @@ QDF_STATUS reg_11d_vdev_delete_update(struct wlan_objmgr_vdev *vdev); * Return: Success or Failure */ QDF_STATUS reg_11d_vdev_created_update(struct wlan_objmgr_vdev *vdev); + +/** + * reg_set_regdb_offloaded() - set/clear regulatory offloaded flag + * + * @psoc: psoc pointer + * Return: Success or Failure + */ +QDF_STATUS reg_set_regdb_offloaded(struct wlan_objmgr_psoc *psoc, + bool val); + +/** + * reg_set_11d_offloaded() - set/clear 11d offloaded flag + * + * @psoc: psoc pointer + * Return: Success or Failure + */ +QDF_STATUS reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc, + bool val); #endif diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_tgt_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_tgt_api.h index 7d19cd0c72b1..2fdac561b27d 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_tgt_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_tgt_api.h @@ -42,4 +42,22 @@ QDF_STATUS tgt_reg_process_master_chan_list(struct cur_regulatory_info */ QDF_STATUS tgt_reg_process_11d_new_country(struct wlan_objmgr_psoc *psoc, struct reg_11d_new_country *reg_11d_new_cc); + +/** + * tgt_reg_set_regdb_offloaded() - set/clear regulatory offloaded flag + * + * @psoc: psoc pointer + * Return: Success or Failure + */ +QDF_STATUS tgt_reg_set_regdb_offloaded(struct wlan_objmgr_psoc *psoc, + bool val); + +/** + * tgt_reg_set_11d_offloaded() - set/clear 11d offloaded flag + * + * @psoc: psoc pointer + * Return: Success or Failure + */ +QDF_STATUS tgt_reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc, + bool val); #endif diff --git a/umac/regulatory/dispatcher/src/wlan_reg_tgt_api.c b/umac/regulatory/dispatcher/src/wlan_reg_tgt_api.c index 5c325e4f7817..30f3940301d9 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_tgt_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_tgt_api.c @@ -45,3 +45,14 @@ QDF_STATUS tgt_reg_process_11d_new_country(struct wlan_objmgr_psoc *psoc, return reg_save_new_11d_country(psoc, reg_11d_new_cc->alpha2); } +QDF_STATUS tgt_reg_set_regdb_offloaded(struct wlan_objmgr_psoc *psoc, + bool val) +{ + return reg_set_regdb_offloaded(psoc, val); +} + +QDF_STATUS tgt_reg_set_11d_offloaded(struct wlan_objmgr_psoc *psoc, + bool val) +{ + return reg_set_11d_offloaded(psoc, val); +}