From 661654d37653d857d3ef631c9ad43c7b68d24de5 Mon Sep 17 00:00:00 2001 From: Vignesh U Date: Wed, 18 Apr 2018 13:36:27 +0530 Subject: [PATCH] qcacmn: Send radar found command to FW In FCC domain, process the radar pulses and send the summary of radar found information to FW. Change-Id: Ib30f57927a9718315fd90f5c44d47dae38bf36f0 CRs-Fixed: 2211883 --- umac/dfs/core/src/dfs.h | 42 ++++++ umac/dfs/core/src/dfs_partial_offload_radar.h | 87 ++++++++++++ .../core/src/dfs_process_radar_found_ind.h | 12 ++ .../src/filtering/dfs_partial_offload_radar.c | 124 ++++++++++++++++++ .../src/filtering/dfs_process_radarevent.c | 109 ++++++++++++--- umac/dfs/core/src/misc/dfs.c | 6 +- umac/dfs/core/src/misc/dfs_filter_init.c | 3 + .../dispatcher/inc/wlan_dfs_public_struct.h | 18 +++ umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h | 14 ++ umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h | 46 +++++++ umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c | 40 ++++++ umac/dfs/dispatcher/src/wlan_dfs_ucfg_api.c | 47 ++++++- 12 files changed, 526 insertions(+), 22 deletions(-) diff --git a/umac/dfs/core/src/dfs.h b/umac/dfs/core/src/dfs.h index 86e4573e56..1f7d294b52 100644 --- a/umac/dfs/core/src/dfs.h +++ b/umac/dfs/core/src/dfs.h @@ -353,6 +353,13 @@ WLAN_DFSNOL_UNLOCK(dfs); \ } while (0) +/* Host sends the average parameters of the radar pulses and starts the status + * wait timer with this timeout. + */ +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +#define HOST_DFS_STATUS_WAIT_TIMER_MS 100 +#endif + /** * struct dfs_pulseparams - DFS pulse param structure. * @p_time: Time for start of pulse in usecs. @@ -921,6 +928,26 @@ struct dfs_event_log { * @dfs_use_nol_subchannel_marking: Use subchannel marking logic to add only * radar affected subchannel instead of all * bonding channels. + * @dfs_host_wait_timer: The timer that is started from host after + * sending the average radar parameters. + * Before this timeout host expects its dfs + * status from fw. + * @dfs_average_pri: Average pri value of the received radar + * pulses. + * @dfs_average_duration: Average duration of the received radar + * pulses. + * @dfs_average_sidx: Average sidx of the received radar pulses. + * @dfs_is_host_wait_running: Indicates if host dfs status wait timer is + * running. + * @dfs_average_params_sent: Indicates if host has sent the average + * radar parameters. + * @dfs_no_res_from_fw: Indicates no response from fw. + * @dfs_spoof_check_failed: Indicates if the spoof check has failed. + * @dfs_spoof_test_done: Indicates if the sppof test is done. + * @dfs_seg_id: Segment ID of the radar hit channel. + * @dfs_false_radar_found: Indicates if false radar is found. + * @dfs_status_timeout_override: Used to change the timeout value of + * dfs_host_wait_timer. */ struct wlan_dfs { uint32_t dfs_debug_mask; @@ -1020,6 +1047,21 @@ struct wlan_dfs { qdf_spinlock_t dfs_nol_lock; uint16_t tx_leakage_threshold; bool dfs_use_nol_subchannel_marking; +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) + os_timer_t dfs_host_wait_timer; + uint32_t dfs_average_pri; + uint32_t dfs_average_duration; + uint32_t dfs_average_sidx; + uint8_t dfs_is_host_wait_running:1, + dfs_average_params_sent:1, + dfs_no_res_from_fw:1, + dfs_spoof_check_failed:1, + dfs_spoof_test_done:1; + uint8_t dfs_seg_id; + int dfs_false_radar_found; + struct dfs_channel dfs_radar_found_chan; + int dfs_status_timeout_override; +#endif }; /** diff --git a/umac/dfs/core/src/dfs_partial_offload_radar.h b/umac/dfs/core/src/dfs_partial_offload_radar.h index 7cc408ca54..6a03a28093 100644 --- a/umac/dfs/core/src/dfs_partial_offload_radar.h +++ b/umac/dfs/core/src/dfs_partial_offload_radar.h @@ -36,4 +36,91 @@ static void dfs_get_po_radars(struct wlan_dfs *dfs) { } #endif + +/** + * dfs_send_avg_params_to_fw - send avg radar parameters to FW. + * @dfs: Pointer to wlan_dfs structure. + * @params: Pointer to dfs_radar_found_params. + * + * Return: None + */ +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +void dfs_send_avg_params_to_fw(struct wlan_dfs *dfs, + struct dfs_radar_found_params *params); +#else +static inline +void dfs_send_avg_params_to_fw(struct wlan_dfs *dfs, + struct dfs_radar_found_params *params) +{ +} +#endif + +/** + * dfs_host_wait_timer_init() - Initialize dfs host status wait timer. + * @dfs: Pointer to wlan_dfs structure. + */ +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +void dfs_host_wait_timer_init(struct wlan_dfs *dfs); +#else +static inline void dfs_host_wait_timer_init(struct wlan_dfs *dfs) +{ +} +#endif + +/** + * dfs_set_override_status_timeout() - Change the dfs host status timeout. + * @dfs: Pointer to wlan_dfs structure. + * @status_timeout: timeout value. + * + * Return: QDF_STATUS + */ +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +QDF_STATUS dfs_set_override_status_timeout(struct wlan_dfs *dfs, + int status_timeout); +#else +static inline QDF_STATUS dfs_set_override_status_timeout(struct wlan_dfs *dfs, + int status_timeout) +{ + return QDF_STATUS_SUCCESS; +} +#endif + +/** + * dfs_get_override_status_timeout() - Get the dfs host status timeout value. + * @dfs: Pointer to wlan_dfs structure. + * @status_timeout: Pointer to timeout value. + * + * Return: QDF_STATUS + */ +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +QDF_STATUS dfs_get_override_status_timeout(struct wlan_dfs *dfs, + int *status_timeout); +#else +static inline +QDF_STATUS dfs_get_override_status_timeout(struct wlan_dfs *dfs, + int *status_timeout) +{ + return QDF_STATUS_SUCCESS; +} +#endif + +/** + * dfs_radarfound_action_fcc() - The dfs action on radar detection by host for + * FCC domain. + * @dfs: Pointer to wlan_dfs structure. + * @seg_id: segment id. + * @false_radar_found: Indicates if false radar is found. + * + * Return: None + */ +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +void dfs_radarfound_action_fcc(struct wlan_dfs *dfs, uint8_t seg_id, + int false_radar_found); +#else +static inline void dfs_radarfound_action_fcc(struct wlan_dfs *dfs, + uint8_t seg_id, + int false_radar_found) +{ +} +#endif #endif /* _DFS_PARTIAL_OFFLOAD_RADAR_H_ */ diff --git a/umac/dfs/core/src/dfs_process_radar_found_ind.h b/umac/dfs/core/src/dfs_process_radar_found_ind.h index 68a6e4c87b..b2346fee94 100644 --- a/umac/dfs/core/src/dfs_process_radar_found_ind.h +++ b/umac/dfs/core/src/dfs_process_radar_found_ind.h @@ -120,3 +120,15 @@ void dfs_process_radar_found_indication(struct wlan_dfs *dfs, */ QDF_STATUS dfs_process_radar_ind(struct wlan_dfs *dfs, struct radar_found_info *radar_found); + +/** + * dfs_radarfound_action_generic() - The dfs action on radar detection by host + * for domains other than FCC. + * @dfs: Pointer to wlan_dfs structure. + * @seg_id: segment id. + * @false_radar_found: Indicates detection of false radar. + * + * Return: None + */ +void dfs_radarfound_action_generic(struct wlan_dfs *dfs, + uint8_t seg_id, int false_radar_found); diff --git a/umac/dfs/core/src/filtering/dfs_partial_offload_radar.c b/umac/dfs/core/src/filtering/dfs_partial_offload_radar.c index ece6f510ce..37696181e0 100644 --- a/umac/dfs/core/src/filtering/dfs_partial_offload_radar.c +++ b/umac/dfs/core/src/filtering/dfs_partial_offload_radar.c @@ -26,6 +26,9 @@ #include "wlan_dfs_lmac_api.h" #include "../dfs_internal.h" #include "../dfs_partial_offload_radar.h" +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +#include "../dfs_process_radar_found_ind.h" +#endif /** * struct dfs_pulse dfs_fcc_radars - FCC radar table for Offload chipsets. @@ -425,3 +428,124 @@ void dfs_get_po_radars(struct wlan_dfs *dfs) dfs_init_radar_filters(dfs, &rinfo); } + +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +void dfs_send_avg_params_to_fw(struct wlan_dfs *dfs, + struct dfs_radar_found_params *params) +{ + tgt_dfs_send_avg_params_to_fw(dfs->dfs_pdev_obj, params); +} + +/** + * dfs_no_res_from_fw_task() - The timer function that is called if there is no + * response from fw after sending the average radar pulse parameters. + */ +static os_timer_func(dfs_no_res_from_fw_task) +{ + struct wlan_dfs *dfs = NULL; + + OS_GET_TIMER_ARG(dfs, struct wlan_dfs *); + + if (!dfs) { + dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL"); + return; + } + + dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "Host wait timer expired"); + + dfs->dfs_is_host_wait_running = 0; + dfs->dfs_no_res_from_fw = 1; + dfs_radarfound_action_generic(dfs, dfs->dfs_seg_id, + dfs->dfs_false_radar_found); + dfs->dfs_seg_id = 0; + dfs->dfs_false_radar_found = 0; +} + +void dfs_host_wait_timer_init(struct wlan_dfs *dfs) +{ + qdf_timer_init(NULL, + &(dfs->dfs_host_wait_timer), + dfs_no_res_from_fw_task, + (void *)(dfs), + QDF_TIMER_TYPE_WAKE_APPS); + dfs->dfs_status_timeout_override = -1; +} + +QDF_STATUS dfs_set_override_status_timeout(struct wlan_dfs *dfs, + int status_timeout) +{ + if (!dfs) { + dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL"); + return QDF_STATUS_E_FAILURE; + } + + dfs->dfs_status_timeout_override = status_timeout; + + dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, + "Host wait status timeout is now %s : %d", + (status_timeout == -1) ? "default" : "overridden", + status_timeout); + + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS dfs_get_override_status_timeout(struct wlan_dfs *dfs, + int *status_timeout) +{ + if (!dfs) { + dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL"); + return QDF_STATUS_E_FAILURE; + } + + *status_timeout = dfs->dfs_status_timeout_override; + + return QDF_STATUS_SUCCESS; +} + +/** + * dfs_extract_radar_found_params() - Copy the contents of average radar + * parameters to dfs_radar_found_params parameter structure. + * + * @dfs: Pointer to wlan_dfs structure which contains the average radar + * parameters. + * @params: Pointer to dfs_radar_found_params structure. + */ +static +void dfs_extract_radar_found_params(struct wlan_dfs *dfs, + struct dfs_radar_found_params *params) +{ + qdf_mem_zero(params, sizeof(*params)); + params->pri_min = dfs->dfs_average_pri; + params->pri_max = dfs->dfs_average_pri; + params->duration_min = dfs->dfs_average_duration; + params->duration_max = dfs->dfs_average_duration; + params->sidx_min = dfs->dfs_average_sidx; + params->sidx_max = dfs->dfs_average_sidx; + + /* Bangradar will not populate any of these average + * parameters as pulse is not received. If these variables + * are not resetted here, these go as radar_found params + * for bangradar if bangradar is issued after real radar. + */ + dfs->dfs_average_sidx = 0; + dfs->dfs_average_duration = 0; + dfs->dfs_average_pri = 0; +} + +void dfs_radarfound_action_fcc(struct wlan_dfs *dfs, uint8_t seg_id, + int false_radar_found) +{ + struct dfs_radar_found_params params; + + qdf_mem_copy(&dfs->dfs_radar_found_chan, dfs->dfs_curchan, + sizeof(dfs->dfs_radar_found_chan)); + dfs_extract_radar_found_params(dfs, ¶ms); + dfs_send_avg_params_to_fw(dfs, ¶ms); + dfs->dfs_is_host_wait_running = 1; + dfs->dfs_seg_id = seg_id; + dfs->dfs_false_radar_found = false_radar_found; + qdf_timer_mod(&dfs->dfs_host_wait_timer, + (dfs->dfs_status_timeout_override == + -1) ? HOST_DFS_STATUS_WAIT_TIMER_MS : + dfs->dfs_status_timeout_override); +} diff --git a/umac/dfs/core/src/filtering/dfs_process_radarevent.c b/umac/dfs/core/src/filtering/dfs_process_radarevent.c index c8d54b440b..ff6223d2e7 100644 --- a/umac/dfs/core/src/filtering/dfs_process_radarevent.c +++ b/umac/dfs/core/src/filtering/dfs_process_radarevent.c @@ -26,6 +26,9 @@ #include "../dfs_channel.h" #include "../dfs_internal.h" #include "../dfs_process_radar_found_ind.h" +#include "wlan_dfs_utils_api.h" +#include "wlan_dfs_lmac_api.h" +#include "../dfs_partial_offload_radar.h" #define FREQ_5500_MHZ 5500 #define FREQ_5500_MHZ 5500 @@ -440,6 +443,53 @@ void __dfs_process_radarevent(struct wlan_dfs *dfs, return; } +/** + * dfs_cal_average_radar_parameters() - Calculate the average radar parameters. + * @dfs: Pointer to wlan_dfs structure. + */ +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +static void dfs_cal_average_radar_parameters(struct wlan_dfs *dfs) +{ + int i, count = 0; + u_int32_t total_pri = 0; + u_int32_t total_duration = 0; + u_int32_t total_sidx = 0; + + /* Calculating average PRI, Duration, SIDX from + * the 2nd pulse, ignoring the 1st pulse (radar_log[0]). + * This is because for the first pulse, the diff_ts will be + * (0 - current_ts) which will be a huge value. + * Average PRI computation will be wrong. FW returns a + * failure test result as PRI does not match their expected + * value. + */ + + for (i = 1; (i < DFS_EVENT_LOG_SIZE) && (i < dfs->dfs_event_log_count); + i++) { + total_pri += dfs->radar_log[i].diff_ts; + total_duration += dfs->radar_log[i].dur; + total_sidx += dfs->radar_log[i].sidx; + count++; + } + + if (count > 0) { + dfs->dfs_average_pri = total_pri / count; + dfs->dfs_average_duration = total_duration / count; + dfs->dfs_average_sidx = total_sidx / count; + + dfs_info(dfs, WLAN_DEBUG_DFS2, + "Avg.PRI =%u, Avg.duration =%u Avg.sidx =%u", + dfs->dfs_average_pri, + dfs->dfs_average_duration, + dfs->dfs_average_sidx); + } +} +#else +static void dfs_cal_average_radar_parameters(struct wlan_dfs *dfs) +{ +} +#endif + /** * dfs_radarfound_reset_vars() - Reset dfs variables after radar found * @dfs: Pointer to wlan_dfs structure. @@ -473,8 +523,10 @@ static inline void dfs_radarfound_reset_vars( * filter match. This can be used to collect information * on false radar detection. */ - if (dfs->dfs_event_log_on) + if (dfs->dfs_event_log_on) { + dfs_cal_average_radar_parameters(dfs); dfs_print_radar_events(dfs); + } dfs_reset_radarq(dfs); dfs_reset_alldelaylines(dfs); @@ -1196,6 +1248,30 @@ static inline void dfs_false_radarfound_reset_vars( dfs->dfs_phyerr_w53_counter = 0; } +void dfs_radarfound_action_generic(struct wlan_dfs *dfs, + uint8_t seg_id, int false_radar_found) +{ + struct radar_found_info *radar_found; + + radar_found = qdf_mem_malloc(sizeof(*radar_found)); + if (!radar_found) { + dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, + "radar_found allocation failed"); + return; + } + + qdf_mem_zero(radar_found, sizeof(*radar_found)); + radar_found->segment_id = seg_id; + radar_found->pdev_id = + wlan_objmgr_pdev_get_pdev_id(dfs->dfs_pdev_obj); + + dfs_process_radar_ind(dfs, radar_found); + qdf_mem_free(radar_found); + + if (false_radar_found) + dfs_false_radarfound_reset_vars(dfs); +} + void dfs_process_radarevent( struct wlan_dfs *dfs, struct dfs_channel *chan) @@ -1222,26 +1298,21 @@ void dfs_process_radarevent( dfsfound: if (retval) { - struct radar_found_info *radar_found; - dfs_radarfound_reset_vars(dfs, rs, chan, seg_id); - - radar_found = qdf_mem_malloc(sizeof(*radar_found)); - if (!radar_found) { - dfs_alert(dfs, WLAN_DEBUG_DFS_ALWAYS, - "radar_found allocation failed"); - return; + /* If Host DFS confirmation is supported, save the curchan as + * radar found chan, send radar found indication along with + * average radar parameters to FW and start the host status + * wait timer. + */ + if (utils_get_dfsdomain(dfs->dfs_pdev_obj) == DFS_FCC_DOMAIN && + lmac_is_host_dfs_check_support_enabled( + dfs->dfs_pdev_obj)) { + dfs_radarfound_action_fcc(dfs, seg_id, + false_radar_found); + } else { + dfs_radarfound_action_generic(dfs, seg_id, + false_radar_found); } - - qdf_mem_zero(radar_found, sizeof(*radar_found)); - radar_found->segment_id = seg_id; - radar_found->pdev_id = - wlan_objmgr_pdev_get_pdev_id(dfs->dfs_pdev_obj); - - dfs_process_radar_ind(dfs, radar_found); - qdf_mem_free(radar_found); } - if (false_radar_found) - dfs_false_radarfound_reset_vars(dfs); } diff --git a/umac/dfs/core/src/misc/dfs.c b/umac/dfs/core/src/misc/dfs.c index 9ef6bc5038..a540abe9dd 100644 --- a/umac/dfs/core/src/misc/dfs.c +++ b/umac/dfs/core/src/misc/dfs.c @@ -29,7 +29,7 @@ #include "../dfs_internal.h" #include "../dfs_filter_init.h" #include "../dfs_full_offload.h" - +#include "wlan_dfs_utils_api.h" /** * dfs_testtimer_task() - Sends CSA in the current channel. @@ -290,6 +290,10 @@ int dfs_control(struct wlan_dfs *dfs, if (dfs->dfs_debug_mask & WLAN_DEBUG_DFS3) { /* Enable debug Radar Event */ dfs->dfs_event_log_on = 1; + } else if ((utils_get_dfsdomain(dfs->dfs_pdev_obj) == + DFS_FCC_DOMAIN) && + lmac_is_host_dfs_check_support_enabled(dfs->dfs_pdev_obj)) { + dfs->dfs_event_log_on = 1; } else { dfs->dfs_event_log_on = 0; } diff --git a/umac/dfs/core/src/misc/dfs_filter_init.c b/umac/dfs/core/src/misc/dfs_filter_init.c index e03f6ad119..ca40314949 100644 --- a/umac/dfs/core/src/misc/dfs_filter_init.c +++ b/umac/dfs/core/src/misc/dfs_filter_init.c @@ -28,6 +28,7 @@ #include "wlan_dfs_tgt_api.h" #include "../dfs_internal.h" #include "../dfs_filter_init.h" +#include "../dfs_partial_offload_radar.h" /* * Channel switch announcement (CSA) @@ -103,6 +104,8 @@ int dfs_main_attach(struct wlan_dfs *dfs) /*Verify : Passing NULL to qdf_timer_init().*/ dfs_main_task_timer_init(dfs); + dfs_host_wait_timer_init(dfs); + WLAN_DFSQ_LOCK_CREATE(dfs); STAILQ_INIT(&dfs->dfs_radarq); WLAN_ARQ_LOCK_CREATE(dfs); diff --git a/umac/dfs/dispatcher/inc/wlan_dfs_public_struct.h b/umac/dfs/dispatcher/inc/wlan_dfs_public_struct.h index b8aad06ae4..b4035331e9 100644 --- a/umac/dfs/dispatcher/inc/wlan_dfs_public_struct.h +++ b/umac/dfs/dispatcher/inc/wlan_dfs_public_struct.h @@ -100,4 +100,22 @@ struct radar_event_info { struct dfs_user_config { bool dfs_is_phyerr_filter_offload; }; + +/** + * struct dfs_radar_found_params - radar found parameters. + * @pri_min: Minimum PRI of detected radar pulse. + * @pri_max: Max PRI of detected radar pulse. + * @duration_min: Min duration of detected pulse in us. + * @duration_max: Max duration of detected pulse in us. + * @sidx_min: Min softare index of detected radar pulse. + * @sidx_max: Max software index of detected radar pulse. + */ +struct dfs_radar_found_params { + u_int32_t pri_min; + u_int32_t pri_max; + u_int32_t duration_min; + u_int32_t duration_max; + u_int32_t sidx_min; + u_int32_t sidx_max; +}; #endif diff --git a/umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h b/umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h index e5d6f4a160..80bcca4448 100644 --- a/umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h +++ b/umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h @@ -284,4 +284,18 @@ QDF_STATUS tgt_dfs_process_emulate_bang_radar_cmd(struct wlan_objmgr_pdev *pdev, */ QDF_STATUS tgt_dfs_set_phyerr_filter_offload(struct wlan_objmgr_pdev *pdev); #endif + +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +/** + * tgt_dfs_send_avg_params_to_fw() - send average radar parameters to fw. + * @pdev: Pointer to DFS pdev object. + * @params: Pointer to dfs radar average parameters. + * + * Return: QDF_STATUS + */ +QDF_STATUS +tgt_dfs_send_avg_params_to_fw(struct wlan_objmgr_pdev *pdev, + struct dfs_radar_found_params *params); +#endif + #endif /* _WLAN_DFS_TGT_API_H_ */ diff --git a/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h b/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h index cd41d357fe..cf85d5aa8c 100644 --- a/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h +++ b/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h @@ -243,4 +243,50 @@ QDF_STATUS ucfg_dfs_get_precac_enable(struct wlan_objmgr_pdev *pdev, int *buff); QDF_STATUS ucfg_dfs_update_config(struct wlan_objmgr_psoc *psoc, struct dfs_user_config *req); #endif + +/** + * ucfg_dfs_set_override_status_timeout() - override the value of host dfs + * status wait timeout. + * @pdev: Pointer to DFS pdev object. + * @status_timeout: timeout value. + * + * Wrapper function for dfs_set_override_status_timeout(). + * This function called from outside of dfs component. + * + * Return: QDF_STATUS + */ +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +QDF_STATUS ucfg_dfs_set_override_status_timeout(struct wlan_objmgr_pdev *pdev, + int status_timeout); +#else +static inline +QDF_STATUS ucfg_dfs_set_override_status_timeout(struct wlan_objmgr_pdev *pdev, + int status_timeout) +{ + return QDF_STATUS_SUCCESS; +} +#endif + +/** + * ucfg_dfs_get_override_status_timeout() - Get the value of host dfs status + * wait timeout. + * @pdev: Pointer to DFS pdev object. + * @status_timeout: Pointer to save the timeout value. + * + * Wrapper function for dfs_get_override_status_timeout(). + * This function called from outside of dfs component. + * + * Return: QDF_STATUS + */ +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +QDF_STATUS ucfg_dfs_get_override_status_timeout(struct wlan_objmgr_pdev *pdev, + int *status_timeout); +#else +static inline +QDF_STATUS ucfg_dfs_get_override_status_timeout(struct wlan_objmgr_pdev *pdev, + int *status_timeout) +{ + return QDF_STATUS_SUCCESS; +} +#endif #endif /* _WLAN_DFS_UCFG_API_H_ */ diff --git a/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c b/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c index c09cfb50c8..5614541634 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c @@ -446,3 +446,43 @@ QDF_STATUS tgt_dfs_set_phyerr_filter_offload(struct wlan_objmgr_pdev *pdev) } qdf_export_symbol(tgt_dfs_set_phyerr_filter_offload); #endif + +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +QDF_STATUS +tgt_dfs_send_avg_params_to_fw(struct wlan_objmgr_pdev *pdev, + struct dfs_radar_found_params *params) +{ + struct wlan_objmgr_psoc *psoc; + struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; + struct wlan_dfs *dfs; + QDF_STATUS status = QDF_STATUS_E_FAILURE; + + dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev); + if (!dfs) { + dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL"); + return status; + } + + psoc = wlan_pdev_get_psoc(pdev); + if (!psoc) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "psoc is null"); + return status; + } + + dfs_tx_ops = wlan_psoc_get_dfs_txops(psoc); + if (dfs_tx_ops && dfs_tx_ops->dfs_send_avg_radar_params_to_fw) + status = dfs_tx_ops->dfs_send_avg_radar_params_to_fw(pdev, + params); + + if (QDF_IS_STATUS_SUCCESS(status)) { + dfs->dfs_average_params_sent = 1; + dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, + "Average radar parameters sent %d", + dfs->dfs_average_params_sent); + } + + return status; +} + +qdf_export_symbol(tgt_dfs_send_avg_params_to_fw); +#endif diff --git a/umac/dfs/dispatcher/src/wlan_dfs_ucfg_api.c b/umac/dfs/dispatcher/src/wlan_dfs_ucfg_api.c index f893033470..6e4ac9bf7f 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_ucfg_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_ucfg_api.c @@ -25,6 +25,7 @@ #include "wlan_dfs_ucfg_api.h" #include "../../core/src/dfs.h" #include "../../core/src/dfs_zero_cac.h" +#include "../../core/src/dfs_partial_offload_radar.h" #include QDF_STATUS ucfg_dfs_is_ap_cac_timer_running(struct wlan_objmgr_pdev *pdev, @@ -125,8 +126,10 @@ QDF_STATUS ucfg_dfs_set_precac_enable(struct wlan_objmgr_pdev *pdev, struct wlan_dfs *dfs; dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev); - if (!dfs) + if (!dfs) { + dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "null dfs"); return QDF_STATUS_E_FAILURE; + } dfs_set_precac_enable(dfs, value); @@ -140,8 +143,10 @@ QDF_STATUS ucfg_dfs_get_precac_enable(struct wlan_objmgr_pdev *pdev, struct wlan_dfs *dfs; dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev); - if (!dfs) + if (!dfs) { + dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "null dfs"); return QDF_STATUS_E_FAILURE; + } *buff = dfs_get_precac_enable(dfs); @@ -176,3 +181,41 @@ QDF_STATUS ucfg_dfs_update_config(struct wlan_objmgr_psoc *psoc, } qdf_export_symbol(ucfg_dfs_update_config); #endif + +#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) +QDF_STATUS ucfg_dfs_set_override_status_timeout(struct wlan_objmgr_pdev *pdev, + int status_timeout) +{ + struct wlan_dfs *dfs; + + dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev); + if (!dfs) { + dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "null dfs"); + return QDF_STATUS_E_FAILURE; + } + + dfs_set_override_status_timeout(dfs, status_timeout); + + return QDF_STATUS_SUCCESS; +} + +qdf_export_symbol(ucfg_dfs_set_override_status_timeout); + +QDF_STATUS ucfg_dfs_get_override_status_timeout(struct wlan_objmgr_pdev *pdev, + int *status_timeout) +{ + struct wlan_dfs *dfs; + + dfs = global_dfs_to_mlme.pdev_get_comp_private_obj(pdev); + if (!dfs) { + dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "null dfs"); + return QDF_STATUS_E_FAILURE; + } + + dfs_get_override_status_timeout(dfs, status_timeout); + + return QDF_STATUS_SUCCESS; +} + +qdf_export_symbol(ucfg_dfs_get_override_status_timeout); +#endif