qcacmn: Add dcs component

Add dcs component to implement interference detection algorithm
and dynamic channel selection frequency control.

Change-Id: Ia201d77e77feb9de3aff03d6e389d4891dde118e
CRs-Fixed: 2594837
This commit is contained in:
hqu
2019-09-20 21:06:47 +08:00
committed by nshrivas
父節點 b478db24df
當前提交 fed4bfb049
共有 27 個文件被更改,包括 2693 次插入2 次删除

查看文件

@@ -0,0 +1,309 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file contains centralized definitions of DCS component
*/
#ifndef __CONFIG_DCS_H
#define __CONFIG_DCS_H
#include "cfg_define.h"
/*
* <ini>
* gEnableDcs - Enable/Disable DCS
* @Min: 0
* @Max: 3
* @Default: 0
*
* This ini is used to enable/disable DCS. Configurations are as follows:
* 0 - Disable DCS.
* 1 - Enable DCS for CW interference mitigation(CW_IM).
* 2 - Enable DCS for WLAN interference mitigation(WLAN_IM).
* 3 - Enable both DCS for CW_IM and DCS for WLAN_IM.
*
* Related: None
*
* Supported Feature: DCS
*
* Usage: External
*
* </ini>
*/
#define CFG_DCS_ENABLE CFG_INI_UINT(\
"gEnableDcs",\
0, 3, 0,\
CFG_VALUE_OR_DEFAULT, "Enable DCS")
/*
* <ini>
* dcs_debug - Configure dcs debug trace level for debug purpose
* @Min: 0
* @Max: 2
* @Default: 0
*
* This ini is used to configure dcs debug trace level for debug purpose
*
*
* Related: None
*
* Usage: External
*
* </ini>
*/
#define CFG_DCS_DEBUG CFG_INI_UINT(\
"dcs_debug",\
0, 2, 0,\
CFG_VALUE_OR_DEFAULT,\
"dcs debug trace level")
/*
* <ini>
* dcs_coch_intfr_threshold - Configure co-channel interference threshold
* @Min: 0
* @Max: 0xFFFFFFFF
* @Default: 30
*
* This ini is used to configure co-channel interference threshold
*
*
* Related: None
*
* Usage: External
*
* </ini>
*/
#define CFG_DCS_COCH_INTFR_THRESHOLD CFG_INI_UINT(\
"dcs_coch_intfr_threshold",\
0, 0xFFFFFFFF, 30,\
CFG_VALUE_OR_DEFAULT,\
"dcs co-channel interference threshold level")
/*
* <ini>
* dcs_tx_err_threshold - Configure transmission failure rate threshold
* @Min: 0
* @Max: 0xFFFFFFFF
* @Default: 30
*
* This ini is used to configure transmission failure rate threshold
*
*
* Related: None
*
* Usage: External
*
* </ini>
*/
#define CFG_DCS_TX_ERR_THRESHOLD CFG_INI_UINT(\
"dcs_tx_err_threshold",\
0, 0xFFFFFFFF, 30,\
CFG_VALUE_OR_DEFAULT,\
"dcs transmission failure rate threshold")
/*
* <ini>
* dcs_phy_err_penalty - Configure channel time wasted due to each Phy
* error(phy error penalty)
* @Min: 0
* @Max: 0xFFFFFFFF
* @Default: 500
*
* This ini is used to configure phy error penalty
*
*
* Related: None
*
* Usage: External
*
* </ini>
*/
#define CFG_DCS_PHY_ERR_PENALTY CFG_INI_UINT(\
"dcs_phy_err_penalty",\
0, 0xFFFFFFFF, 500,\
CFG_VALUE_OR_DEFAULT,\
"dcs phy error penalty")
/*
* <ini>
* dcs_phy_err_threshold - Configure phy err threshold
* @Min: 0
* @Max: 0xFFFFFFFF
* @Default: 300
*
* This ini is used to configure phy error threshold
*
*
* Related: None
*
* Usage: External
*
* </ini>
*/
#define CFG_DCS_PHY_ERR_THRESHOLD CFG_INI_UINT(\
"dcs_phy_err_threshold",\
0, 0xFFFFFFFF, 300,\
CFG_VALUE_OR_DEFAULT,\
"dcs phy error threshold")
/*
* <ini>
* dcs_user_max_cu - Configure tx channel utilization due to AP's tx and rx
* @Min: 0
* @Max: 0xFFFFFFFF
* @Default: 50
*
* This ini is used to configure tx channel utilization due to AP's tx and rx
*
*
* Related: None
*
* Usage: External
*
* </ini>
*/
#define CFG_DCS_USER_MAX_CU CFG_INI_UINT(\
"user_max_cu",\
0, 0xFFFFFFFF, 50,\
CFG_VALUE_OR_DEFAULT,\
"dcs tx channel utilization")
/*
* <ini>
* dcs_radar_err_threshold - Configure radar error threshold
* @Min: 0
* @Max: 0xFFFFFFFF
* @Default: 1000
*
* This ini is used to configure radar error threshold
*
*
* Related: None
*
* Usage: External
*
* </ini>
*/
#define CFG_DCS_RADAR_ERR_THRESHOLD CFG_INI_UINT(\
"dcs_radar_err_threshold",\
0, 0xFFFFFFFF, 1000,\
CFG_VALUE_OR_DEFAULT,\
"dcs radar error threshold")
/*
* <ini>
* dcs_intfr_detection_threshold - Configure interference detection threshold
* @Min: 0
* @Max: 0xFFFFFFFF
* @Default: 6
*
* This ini is used to configure interference detection threshold
*
*
* Related: None
*
* Usage: External
*
* </ini>
*/
#define CFG_DCS_INTFR_DETECTION_THRESHOLD CFG_INI_UINT(\
"dcs_intfr_detection_threshold",\
0, 0xFFFFFFFF, 6,\
CFG_VALUE_OR_DEFAULT,\
"dcs interference detection threshold")
/*
* <ini>
* dcs_intfr_detection_window - Configure interference sampling window
* @Min: 0
* @Max: 0xFFFFFFFF
* @Default: 10
*
* This ini is used to configure interference sampling window
*
*
* Related: None
*
* Usage: External
*
* </ini>
*/
#define CFG_DCS_INTFR_DETECTION_WINDOW CFG_INI_UINT(\
"dcs_intfr_detection_window",\
0, 0xFFFFFFFF, 10,\
CFG_VALUE_OR_DEFAULT,\
"dcs interference sampling window")
/*
* <ini>
* dcs_disable_threshold_per_5mins - In five minutes, if dcs happen
* more than threshold, then disable dcs for some time
* @Min: 0
* @Max: 10
* @Default: 3
*
* This ini is used to dcs happen times threshold in five minutes
*
*
* Related: None
*
* Usage: External
*
* </ini>
*/
#define CFG_DCS_DISABLE_THRESHOLD_PER_5MINS CFG_INI_UINT(\
"dcs_disable_thresh_per_5mins",\
0, 10, 3,\
CFG_VALUE_OR_DEFAULT,\
"dcs happen times threshold in five minutes")
/*
* <ini>
* dcs_restart_delay - When dcs happen more than threshold in five minutes,
* then start to disable dcs for some minutes, then enable dcs again.
* @Min: 0
* @Max: 0xFFFFFFFF
* @Default: 30
*
* This ini is used to configure dcs disable time length in minute unit
*
*
* Related: None
*
* Usage: External
*
* </ini>
*/
#define CFG_DCS_RESTART_DELAY CFG_INI_UINT(\
"dcs_restart_delay",\
0, 0xFFFFFFFF, 30,\
CFG_VALUE_OR_DEFAULT, "dcs restart delay")
#define CFG_DCS_ALL \
CFG(CFG_DCS_ENABLE) \
CFG(CFG_DCS_DEBUG) \
CFG(CFG_DCS_COCH_INTFR_THRESHOLD) \
CFG(CFG_DCS_TX_ERR_THRESHOLD) \
CFG(CFG_DCS_PHY_ERR_PENALTY) \
CFG(CFG_DCS_PHY_ERR_THRESHOLD) \
CFG(CFG_DCS_USER_MAX_CU) \
CFG(CFG_DCS_RADAR_ERR_THRESHOLD) \
CFG(CFG_DCS_INTFR_DETECTION_THRESHOLD) \
CFG(CFG_DCS_INTFR_DETECTION_WINDOW) \
CFG(CFG_DCS_DISABLE_THRESHOLD_PER_5MINS) \
CFG(CFG_DCS_RESTART_DELAY)
#endif /* __CONFIG_DCS_H */

查看文件

@@ -0,0 +1,91 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wlan_dcs_init_deinit_api.h
*
* This header file provide declaration to public APIs exposed for other UMAC
* components to init/deinit, (de)register to required WMI events on
* soc enable/disable
*/
#ifndef __WLAN_DCS_INIT_DEINIT_API_H__
#define __WLAN_DCS_INIT_DEINIT_API_H__
#ifdef DCS_INTERFERENCE_DETECTION
#include <qdf_types.h>
#include <qdf_status.h>
#include <wlan_objmgr_cmn.h>
/**
* wlan_dcs_init(): API to init dcs component
*
* This API is invoked from dispatcher init during all component init.
* This API will register all required handlers for pdev object
* create/delete notification.
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS wlan_dcs_init(void);
/**
* wlan_dcs_deinit(): API to deinit dcs component
*
* This API is invoked from dispatcher deinit during all component deinit.
* This API will unregister all required handlers for pdev object
* create/delete notification.
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS wlan_dcs_deinit(void);
/**
* wlan_dcs_enable(): API to enable dcs component
* @psoc: pointer to psoc
*
* This API is invoked from dispatcher psoc enable.
* This API will register dcs WMI event handlers.
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS wlan_dcs_enable(struct wlan_objmgr_psoc *psoc);
/**
* wlan_dcs_disable(): API to disable dcs component
* @psoc: pointer to psoc
*
* This API is invoked from dispatcher psoc disable.
* This API will unregister dcs WMI event handlers.
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS wlan_dcs_disable(struct wlan_objmgr_psoc *psoc);
/**
* wlan_dcs_psoc_open() - Dcs psoc open handler
* @psoc: pointer to psoc object
*
* API to execute operations on psoc open
*
* Return: QDF_STATUS_SUCCESS upon successful registration,
* QDF_STATUS_E_FAILURE upon failure
*/
QDF_STATUS wlan_dcs_psoc_open(struct wlan_objmgr_psoc *psoc);
#endif /* DCS_INTERFERENCE_DETECTION */
#endif /* __WLAN_DCS_INIT_DEINIT_API_H__ */

查看文件

@@ -0,0 +1,86 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: contains dcs structure definations
*/
#ifndef _WLAN_DCS_PUBLIC_STRUCTS_H_
#define _WLAN_DCS_PUBLIC_STRUCTS_H_
/**
* struct wlan_host_dcs_interference_param - dcs interference parameters
* @interference_type: type of DCS interference
* @uint32_t pdev_id: pdev id
*/
struct wlan_host_dcs_interference_param {
uint32_t interference_type;
uint32_t pdev_id;
};
/**
* struct wlan_host_dcs_mib_stats - WLAN IM stats from target to host
* @listen_time:
* @reg_tx_frame_cnt:
* @reg_rx_frame_cnt:
* @reg_rxclr_cnt:
* @reg_cycle_cnt: delta cycle count
* @reg_rxclr_ext_cnt:
* @reg_ofdm_phyerr_cnt:
* @reg_cck_phyerr_cnt: CCK err count since last reset, read from register
*/
struct wlan_host_dcs_mib_stats {
int32_t listen_time;
uint32_t reg_tx_frame_cnt;
uint32_t reg_rx_frame_cnt;
uint32_t reg_rxclr_cnt;
uint32_t reg_cycle_cnt;
uint32_t reg_rxclr_ext_cnt;
uint32_t reg_ofdm_phyerr_cnt;
uint32_t reg_cck_phyerr_cnt;
};
/**
* struct wlan_host_dcs_im_tgt_stats - DCS IM target stats
* @reg_tsf32: current running TSF from the TSF-1
* @last_ack_rssi: known last frame rssi, in case of multiple stations, if
* and at different ranges, this would not gaurantee that
* this is the least rssi.
* @tx_waste_time: sum of all the failed durations in the last
* one second interval.
* @rx_time: count how many times the hal_rxerr_phy is marked, in this
* time period
* @phyerr_cnt:
* @mib_stats: collected mib stats as explained in mib structure
* @chan_nf: Channel noise floor (units are in dBm)
* @my_bss_rx_cycle_count: BSS rx cycle count
* @reg_rxclr_ext40_cnt: extension channel 40Mhz rxclear count
* @reg_rxclr_ext80_cnt: extension channel 80Mhz rxclear count
*/
struct wlan_host_dcs_im_tgt_stats {
uint32_t reg_tsf32;
uint32_t last_ack_rssi;
uint32_t tx_waste_time;
uint32_t rx_time;
uint32_t phyerr_cnt;
struct wlan_host_dcs_mib_stats mib_stats;
uint32_t chan_nf;
uint32_t my_bss_rx_cycle_count;
uint32_t reg_rxclr_ext40_cnt;
uint32_t reg_rxclr_ext80_cnt;
};
#endif

查看文件

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: wlan_dcs_tgt_api.h
*
* This header file provide with API declarations to interface with Southbound
*/
#ifndef __WLAN_DCS_TGT_API_H__
#define __WLAN_DCS_TGT_API_H__
#include <wlan_objmgr_cmn.h>
#include <wlan_dcs_public_structs.h>
/**
* struct dcs_stats_event - define dcs stats event
* @wlan_stat: wlan interference target statistics
* @dcs_param: dcs event param
*/
struct dcs_stats_event {
struct wlan_host_dcs_im_tgt_stats wlan_stat;
struct wlan_host_dcs_interference_param dcs_param;
};
/**
* tgt_dcs_process_event(): dcs FW event process
* @psoc: pointer to psoc object
* @event: pointer to dcs stats event
*
* This function gets called to process dcs FW event
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_dcs_process_event(struct wlan_objmgr_psoc *psoc,
struct dcs_stats_event *event);
#endif /* __WLAN_DCS_TGT_API_H__ */

查看文件

@@ -0,0 +1,120 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
* DOC: This file has the dcs dispatcher API which is exposed to outside of dcs
* component.
*/
#ifndef _WLAN_DCS_UCFG_API_H_
#define _WLAN_DCS_UCFG_API_H_
#include <qdf_status.h>
#include <wlan_objmgr_pdev_obj.h>
/**
* @brief List of DCS capabilities that can be set or unset
* dynamically
* @see UMAC auto channel selection document for details on each feature
*
*/
#define CAP_DCS_CWIM 0x1
#define CAP_DCS_WLANIM 0x2
#define CAP_DCS_MASK (CAP_DCS_CWIM | CAP_DCS_WLANIM)
/**
* typedef dcs_callback() - DCS callback
* @psoc: Pointer to psoc
* @pdev_id: pdev id
* @interference_type: interference type
* @arg: list of arguments
*/
typedef void (*dcs_callback)(
struct wlan_objmgr_psoc *psoc,
uint8_t pdev_id,
uint8_t interference_type,
void *arg);
/**
* ucfg_dcs_register_cb() - API to register dcs callback
* @psoc: pointer to psoc object
* @cbk: dcs callback to be registered
* @arg: argument
*
* This function gets called to register dcs callback function
*
* Return: None
*/
void ucfg_dcs_register_cb(
struct wlan_objmgr_psoc *psoc,
dcs_callback cbk,
void *arg);
/**
* ucfg_wlan_dcs_cmd(): API to send dcs command
* @psoc: pointer to psoc object
* @pdev_id: pdev_id
* @is_target_pdev_id: pdev_id is target id or not
*
* This function gets called to send dcs command
*
* Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
*/
QDF_STATUS
ucfg_wlan_dcs_cmd(struct wlan_objmgr_psoc *psoc,
uint32_t pdev_id,
bool is_target_pdev_id);
/**
* ucfg_config_dcs_enable() - API to config dcs enable
* @psoc: pointer to psoc object
* @pdev_id: pdev id
* @interference_type: CAP_DCS_CWIM, CAP_DCS_WLANIM, CAP_DCS_MASK
*
* This function gets called to config dcs enable
*
* Return: None
*/
void ucfg_config_dcs_enable(struct wlan_objmgr_psoc *psoc,
uint32_t pdev_id,
uint8_t interference_type);
/**
* ucfg_config_dcs_disable() - API to config dcs disable
* @psoc: pointer to psoc object
* @pdev_id: pdev id
* @interference_type: CAP_DCS_CWIM, CAP_DCS_WLANIM, CAP_DCS_MASK
*
* This function gets called to config dcs disable
*
* Return: None
*/
void ucfg_config_dcs_disable(struct wlan_objmgr_psoc *psoc,
uint32_t pdev_id,
uint8_t interference_type);
/**
* ucfg_get_dcs_enable() - API to get dcs enable
* @psoc: pointer to psoc object
* @pdev_id: pdev id
*
* This function gets called to get current host
* config dcs enable/disable status
*
* Return: WLANIM/CWIM enable status
*/
uint8_t ucfg_get_dcs_enable(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id);
#endif /* _WLAN_DCS_UCFG_API_H_ */