qcacld-3.0: Move pre_cac start code to pre_cac component

Move pre_cac start code flow from hdd to pre_cac component.

Change-Id: Ia3bd7521bff9571dee18dbc20b28d08b76128944
CRs-Fixed: 3199948
This commit is contained in:
Dundi Raviteja
2022-05-22 13:15:45 +05:30
committed by Madan Koyyalamudi
parent 2de118fa97
commit 71fc4f3fd4
17 changed files with 588 additions and 82 deletions

View File

@@ -3508,6 +3508,19 @@ QDF_STATUS
wlan_mlme_update_ratemask_params(struct wlan_objmgr_vdev *vdev, wlan_mlme_update_ratemask_params(struct wlan_objmgr_vdev *vdev,
uint8_t num_ratemask, uint8_t num_ratemask,
struct config_ratemask_params *rate_params); struct config_ratemask_params *rate_params);
/**
* wlan_mlme_is_channel_valid() - validate channel frequency
* @psoc: psoc object manager
* @chan_freq: channel frequency
*
* This function validates channel frequency present in valid channel
* list or not.
*
* Return: true or false
*/
bool wlan_mlme_is_channel_valid(struct wlan_objmgr_psoc *psoc,
uint32_t chan_freq);
#ifdef WLAN_FEATURE_MCC_QUOTA #ifdef WLAN_FEATURE_MCC_QUOTA
/** /**
* wlan_mlme_set_user_mcc_quota() - set the user mcc quota in mlme * wlan_mlme_set_user_mcc_quota() - set the user mcc quota in mlme

View File

@@ -5519,6 +5519,19 @@ wlan_mlme_update_ratemask_params(struct wlan_objmgr_vdev *vdev,
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
bool wlan_mlme_is_channel_valid(struct wlan_objmgr_psoc *psoc,
uint32_t chan_freq)
{
struct wlan_mlme_psoc_ext_obj *mlme_obj;
mlme_obj = mlme_get_psoc_ext_obj(psoc);
if (!mlme_obj)
return false;
return wlan_roam_is_channel_valid(&mlme_obj->cfg.reg,
chan_freq);
}
#ifdef WLAN_FEATURE_MCC_QUOTA #ifdef WLAN_FEATURE_MCC_QUOTA
#define WLAN_MCC_MIN_QUOTA 10 /* in %age */ #define WLAN_MCC_MIN_QUOTA 10 /* in %age */
#define WLAN_MCC_MAX_QUOTA 90 /* in %age */ #define WLAN_MCC_MAX_QUOTA 90 /* in %age */

View File

@@ -22,9 +22,138 @@
#include "wlan_pre_cac_main.h" #include "wlan_pre_cac_main.h"
#include "wlan_objmgr_global_obj.h" #include "wlan_objmgr_global_obj.h"
#include "wlan_policy_mgr_api.h"
#include "wlan_reg_services_api.h"
#include "wlan_mlme_api.h"
struct pre_cac_ops *glbl_pre_cac_ops; struct pre_cac_ops *glbl_pre_cac_ops;
static void pre_cac_get_vdev_id_handler(struct wlan_objmgr_psoc *psoc,
void *obj, void *args)
{
struct wlan_objmgr_vdev *vdev = (struct wlan_objmgr_vdev *)obj;
struct pre_cac_vdev_priv *vdev_priv;
uint8_t *vdev_id = (uint8_t *)args;
vdev_priv = pre_cac_vdev_get_priv(vdev);
if (!vdev_priv)
return;
if (vdev_priv->is_pre_cac_on)
*vdev_id = vdev->vdev_objmgr.vdev_id;
}
void pre_cac_get_vdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t *vdev_id)
{
wlan_objmgr_iterate_obj_list(psoc, WLAN_VDEV_OP,
pre_cac_get_vdev_id_handler,
vdev_id, true, WLAN_PRE_CAC_ID);
}
int pre_cac_validate_and_get_freq(struct wlan_objmgr_pdev *pdev,
uint32_t chan_freq,
uint32_t *pre_cac_chan_freq)
{
struct wlan_objmgr_psoc *psoc = wlan_pdev_get_psoc(pdev);
uint32_t len = CFG_VALID_CHANNEL_LIST_LEN;
uint8_t pcl_weights[NUM_CHANNELS] = {0};
uint32_t freq_list[NUM_CHANNELS] = {0};
uint32_t weight_len = 0;
QDF_STATUS status;
uint32_t i;
if (pre_cac_is_active(psoc)) {
pre_cac_err("pre cac is already in progress");
return -EINVAL;
}
if (!chan_freq) {
/* Channel is not obtained from PCL because PCL may not have
* the entire channel list. For example: if SAP is up on
* channel 6 and PCL is queried for the next SAP interface,
* if SCC is preferred, the PCL will contain only the channel
* 6. But, we are in need of a DFS channel. So, going with the
* first channel from the valid channel list.
*/
status = policy_mgr_get_valid_chans(psoc,
freq_list, &len);
if (QDF_IS_STATUS_ERROR(status)) {
pre_cac_err("Failed to get channel list");
return -EINVAL;
}
policy_mgr_update_with_safe_channel_list(psoc,
freq_list, &len,
pcl_weights,
weight_len);
for (i = 0; i < len; i++) {
if (wlan_reg_is_dfs_for_freq(pdev,
freq_list[i])) {
*pre_cac_chan_freq = freq_list[i];
break;
}
}
if (*pre_cac_chan_freq == 0) {
pre_cac_err("unable to find outdoor channel");
return -EINVAL;
}
} else {
/* Only when driver selects a channel, check is done for
* unnsafe and NOL channels. When user provides a fixed channel
* the user is expected to take care of this.
*/
if (!wlan_mlme_is_channel_valid(psoc, chan_freq) ||
!wlan_reg_is_dfs_for_freq(pdev, chan_freq)) {
pre_cac_err("Invalid channel for pre cac:%d",
chan_freq);
return -EINVAL;
}
*pre_cac_chan_freq = chan_freq;
}
pre_cac_debug("selected pre cac channel:%d", *pre_cac_chan_freq);
return 0;
}
QDF_STATUS pre_cac_set_status(struct wlan_objmgr_vdev *vdev, bool status)
{
struct pre_cac_vdev_priv *vdev_priv;
vdev_priv = pre_cac_vdev_get_priv(vdev);
if (!vdev_priv)
return QDF_STATUS_E_INVAL;
vdev_priv->is_pre_cac_on = status;
return QDF_STATUS_SUCCESS;
}
static void pre_cac_is_active_vdev_handler(struct wlan_objmgr_psoc *psoc,
void *obj, void *args)
{
struct wlan_objmgr_vdev *vdev = (struct wlan_objmgr_vdev *)obj;
struct pre_cac_vdev_priv *vdev_priv;
bool *is_pre_cac_on = (bool *)args;
vdev_priv = pre_cac_vdev_get_priv(vdev);
if (!vdev_priv)
return;
*is_pre_cac_on = vdev_priv->is_pre_cac_on;
}
bool pre_cac_is_active(struct wlan_objmgr_psoc *psoc)
{
bool is_pre_cac_on = false;
wlan_objmgr_iterate_obj_list(psoc, WLAN_VDEV_OP,
pre_cac_is_active_vdev_handler,
&is_pre_cac_on, true, WLAN_PRE_CAC_ID);
return is_pre_cac_on;
}
struct pre_cac_vdev_priv * struct pre_cac_vdev_priv *
pre_cac_vdev_get_priv_fl(struct wlan_objmgr_vdev *vdev, pre_cac_vdev_get_priv_fl(struct wlan_objmgr_vdev *vdev,
const char *func, uint32_t line) const char *func, uint32_t line)

View File

@@ -181,4 +181,48 @@ void pre_cac_deinit(void);
* Return: None * Return: None
*/ */
void pre_cac_set_osif_cb(struct pre_cac_ops *osif_pre_cac_ops); void pre_cac_set_osif_cb(struct pre_cac_ops *osif_pre_cac_ops);
/**
* pre_cac_is_active(): status of pre_cac
* @psoc: psoc pointer
*
* Return: status of pre_cac
*/
bool pre_cac_is_active(struct wlan_objmgr_psoc *psoc);
/**
* pre_cac_validate_and_get_freq() - Validate and get pre cac frequency
* @pdev: pdev object manager
* @chan_freq: Channel frequency requested by userspace
* @pre_cac_chan_freq: Pointer to the pre CAC channel frequency storage
*
* Validates the channel provided by userspace. If user provided channel 0,
* a valid outdoor channel must be selected from the regulatory channel.
*
* Return: Zero on success and non zero value on error
*/
int pre_cac_validate_and_get_freq(struct wlan_objmgr_pdev *pdev,
uint32_t chan_freq,
uint32_t *pre_cac_chan_freq);
/**
* pre_cac_set_status() - Set pre cac status
* @vdev: vdev object manager
* @status: status of pre_cac
*
* Sets pre_cac status
*
* Return: QDF_STATUS
*/
QDF_STATUS pre_cac_set_status(struct wlan_objmgr_vdev *vdev, bool status);
/**
* pre_cac_get_vdev_id() - Get pre cac vdev id
* @psoc: psoc object manager
* @vdev_id: pointer to the pre cac vdev id
*
* Return: None
*/
void pre_cac_get_vdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t *vdev_id);
#endif /* end of _WLAN_PRE_CAC_MAIN_H_ */ #endif /* end of _WLAN_PRE_CAC_MAIN_H_ */

View File

@@ -21,4 +21,35 @@
#ifndef _WLAN_PRE_CAC_API_H_ #ifndef _WLAN_PRE_CAC_API_H_
#define _WLAN_PRE_CAC_API_H_ #define _WLAN_PRE_CAC_API_H_
#ifdef PRE_CAC_SUPPORT
/**
* wlan_pre_cac_get_status(): status of pre_cac
* @psoc: psoc object manager
*
* Return: status of pre_cac
*/
bool wlan_pre_cac_get_status(struct wlan_objmgr_psoc *psoc);
/**
* wlan_pre_cac_set_status() - Set pre cac status
* @vdev: vdev object manager
* @status: status of pre_cac
*
* Sets pre_cac status
*
* Return: QDF_STATUS
*/
QDF_STATUS wlan_pre_cac_set_status(struct wlan_objmgr_vdev *vdev, bool status);
#else
static inline bool wlan_pre_cac_get_status(struct wlan_objmgr_psoc *psoc)
{
return false;
}
static inline QDF_STATUS
wlan_pre_cac_set_status(struct wlan_objmgr_vdev *vdev, bool status)
{
return false;
}
#endif /* PRE_CAC_SUPPORT */
#endif /* _WLAN_PRE_CAC_API_H_ */ #endif /* _WLAN_PRE_CAC_API_H_ */

View File

@@ -25,6 +25,7 @@
#include <qdf_status.h> #include <qdf_status.h>
#include <qdf_types.h> #include <qdf_types.h>
#include "wlan_pre_cac_public_struct.h" #include "wlan_pre_cac_public_struct.h"
#include "wlan_objmgr_psoc_obj.h"
#ifdef PRE_CAC_SUPPORT #ifdef PRE_CAC_SUPPORT
/** /**
@@ -54,6 +55,57 @@ void ucfg_pre_cac_deinit(void);
* Return: None * Return: None
*/ */
void ucfg_pre_cac_set_osif_cb(struct pre_cac_ops *pre_cac_ops); void ucfg_pre_cac_set_osif_cb(struct pre_cac_ops *pre_cac_ops);
/**
* ucfg_pre_cac_is_active(): status of pre_cac
* @psoc: psoc object manager
*
* Return: status of pre_cac
*/
bool ucfg_pre_cac_is_active(struct wlan_objmgr_psoc *psoc);
/**
* ucfg_pre_cac_validate_and_get_freq() - Validate and get pre cac frequency
* @pdev: pdev object manager
* @chan_freq: Channel frequency requested by userspace
* @pre_cac_chan_freq: Pointer to the pre CAC channel frequency storage
*
* Validates the channel provided by userspace. If user provided channel 0,
* a valid outdoor channel must be selected from the regulatory channel.
*
* Return: Zero on success and non zero value on error
*/
int ucfg_pre_cac_validate_and_get_freq(struct wlan_objmgr_pdev *pdev,
uint32_t chan_freq,
uint32_t *pre_cac_chan_freq);
#if defined(FEATURE_SAP_COND_CHAN_SWITCH)
/**
* ucfg_pre_cac_set_status() - Set pre cac status
* @vdev: vdev object manager
* @status: status of pre_cac
*
* Sets pre_cac status
*
* Return: Zero on success and non zero value on error
*/
QDF_STATUS ucfg_pre_cac_set_status(struct wlan_objmgr_vdev *vdev, bool status);
#else
static inline QDF_STATUS
ucfg_pre_cac_set_status(struct wlan_objmgr_vdev *vdev, bool status)
{
}
#endif
/**
* ucfg_pre_cac_get_vdev_id() - Get pre cac vdev id
* @psoc: psoc object manager
* @vdev_id: pre cac vdev id
*
* Return: None
*/
void ucfg_pre_cac_get_vdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t *vdev_id);
#else #else
static inline static inline
QDF_STATUS ucfg_pre_cac_init(void) QDF_STATUS ucfg_pre_cac_init(void)
@@ -70,6 +122,31 @@ static inline void
ucfg_pre_cac_set_osif_cb(struct pre_cac_ops *pre_cac_ops) ucfg_pre_cac_set_osif_cb(struct pre_cac_ops *pre_cac_ops)
{ {
} }
static inline bool
ucfg_pre_cac_is_active(struct wlan_objmgr_psoc *psoc)
{
return false;
}
static inline int
ucfg_pre_cac_validate_and_get_freq(struct wlan_objmgr_pdev *pdev,
uint32_t chan_freq,
uint32_t *pre_cac_chan_freq)
{
return 0;
}
static inline QDF_STATUS
ucfg_pre_cac_set_status(struct wlan_objmgr_vdev *vdev, bool status)
{
return QDF_STATUS_SUCCESS;
}
static inline void
ucfg_pre_cac_get_vdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t *vdev_id)
{
}
#endif /* PRE_CAC_SUPPORT */ #endif /* PRE_CAC_SUPPORT */
#endif /* _WLAN_PRE_CAC_UCFG_API_H_ */ #endif /* _WLAN_PRE_CAC_UCFG_API_H_ */

View File

@@ -17,3 +17,16 @@
/** /**
* DOC: Public API implementation of pre cac called from SAP module * DOC: Public API implementation of pre cac called from SAP module
*/ */
#include "../../core/src/wlan_pre_cac_main.h"
#include "wlan_pre_cac_api.h"
bool wlan_pre_cac_get_status(struct wlan_objmgr_psoc *psoc)
{
return pre_cac_is_active(psoc);
}
QDF_STATUS wlan_pre_cac_set_status(struct wlan_objmgr_vdev *vdev, bool status)
{
return pre_cac_set_status(vdev, status);
}

View File

@@ -21,6 +21,30 @@
#include "../../core/src/wlan_pre_cac_main.h" #include "../../core/src/wlan_pre_cac_main.h"
#include "wlan_pre_cac_ucfg_api.h" #include "wlan_pre_cac_ucfg_api.h"
void ucfg_pre_cac_get_vdev_id(struct wlan_objmgr_psoc *psoc,
uint8_t *vdev_id)
{
pre_cac_get_vdev_id(psoc, vdev_id);
}
int ucfg_pre_cac_validate_and_get_freq(struct wlan_objmgr_pdev *pdev,
uint32_t chan_freq,
uint32_t *pre_cac_chan_freq)
{
return pre_cac_validate_and_get_freq(pdev, chan_freq,
pre_cac_chan_freq);
}
QDF_STATUS ucfg_pre_cac_set_status(struct wlan_objmgr_vdev *vdev, bool status)
{
return pre_cac_set_status(vdev, status);
}
bool ucfg_pre_cac_is_active(struct wlan_objmgr_psoc *psoc)
{
return pre_cac_is_active(psoc);
}
void ucfg_pre_cac_set_osif_cb(struct pre_cac_ops *osif_pre_cac_ops) void ucfg_pre_cac_set_osif_cb(struct pre_cac_ops *osif_pre_cac_ops)
{ {
pre_cac_set_osif_cb(osif_pre_cac_ops); pre_cac_set_osif_cb(osif_pre_cac_ops);

View File

@@ -111,6 +111,7 @@
#include "wlan_hdd_wds.h" #include "wlan_hdd_wds.h"
#include "wlan_hdd_pre_cac.h" #include "wlan_hdd_pre_cac.h"
#include "wlan_osif_features.h" #include "wlan_osif_features.h"
#include "wlan_pre_cac_ucfg_api.h"
#define ACS_SCAN_EXPIRY_TIMEOUT_S 4 #define ACS_SCAN_EXPIRY_TIMEOUT_S 4
@@ -6625,8 +6626,17 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
mutex_unlock(&hdd_ctx->sap_lock); mutex_unlock(&hdd_ctx->sap_lock);
mac_handle = hdd_ctx->mac_handle; mac_handle = hdd_ctx->mac_handle;
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
if (wlan_sap_is_pre_cac_active(mac_handle)) if (wlan_sap_is_pre_cac_active(mac_handle))
hdd_clean_up_pre_cac_interface(hdd_ctx); hdd_clean_up_pre_cac_interface(hdd_ctx);
#else
if (ucfg_pre_cac_is_active(hdd_ctx->psoc))
hdd_clean_up_pre_cac_interface(hdd_ctx);
#endif
if (status != QDF_STATUS_SUCCESS) { if (status != QDF_STATUS_SUCCESS) {
hdd_err("Stopping the BSS"); hdd_err("Stopping the BSS");

View File

@@ -8313,16 +8313,35 @@ QDF_STATUS hdd_stop_adapter_ext(struct hdd_context *hdd_ctx,
* pre-cac adapter * pre-cac adapter
*/ */
sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter); sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter);
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
if (!wlan_sap_is_pre_cac_context(sap_ctx) && if (!wlan_sap_is_pre_cac_context(sap_ctx) &&
(hdd_ctx->sap_pre_cac_work.fn)) (hdd_ctx->sap_pre_cac_work.fn))
cds_flush_work(&hdd_ctx->sap_pre_cac_work); cds_flush_work(&hdd_ctx->sap_pre_cac_work);
#else
if (!ucfg_pre_cac_is_active(hdd_ctx->psoc) &&
hdd_ctx->sap_pre_cac_work.fn)
cds_flush_work(&hdd_ctx->sap_pre_cac_work);
#endif
hdd_close_pre_cac_adapter(hdd_ctx); hdd_close_pre_cac_adapter(hdd_ctx);
} else { } else {
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
if (wlan_sap_set_pre_cac_status( if (wlan_sap_set_pre_cac_status(
WLAN_HDD_GET_SAP_CTX_PTR(adapter), false)) WLAN_HDD_GET_SAP_CTX_PTR(adapter), false))
hdd_err("Failed to set is_pre_cac_on to false"); hdd_err("Failed to set is_pre_cac_on to false");
#else
if (ucfg_pre_cac_set_status(adapter->vdev, false))
hdd_err("Failed to set is_pre_cac_on to false");
#endif
} }
/* fallthrough */ /* fallthrough */

View File

@@ -55,6 +55,7 @@
#include "wlan_pkt_capture_ucfg_api.h" #include "wlan_pkt_capture_ucfg_api.h"
#include "wlan_hdd_object_manager.h" #include "wlan_hdd_object_manager.h"
#include "wlan_hdd_pre_cac.h" #include "wlan_hdd_pre_cac.h"
#include "wlan_pre_cac_ucfg_api.h"
/* Ms to Time Unit Micro Sec */ /* Ms to Time Unit Micro Sec */
#define MS_TO_TU_MUS(x) ((x) * 1024) #define MS_TO_TU_MUS(x) ((x) * 1024)
@@ -944,8 +945,17 @@ int __wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
if (errno) if (errno)
return errno; return errno;
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
if (adapter->device_mode == QDF_SAP_MODE && if (adapter->device_mode == QDF_SAP_MODE &&
wlan_sap_is_pre_cac_active(hdd_ctx->mac_handle)) { wlan_sap_is_pre_cac_active(hdd_ctx->mac_handle)) {
#else
if (adapter->device_mode == QDF_SAP_MODE &&
ucfg_pre_cac_is_active(hdd_ctx->psoc)) {
#endif
hdd_clean_up_interface(hdd_ctx, adapter); hdd_clean_up_interface(hdd_ctx, adapter);
hdd_clean_up_pre_cac_interface(hdd_ctx); hdd_clean_up_pre_cac_interface(hdd_ctx);
} else if (wlan_hdd_is_session_type_monitor( } else if (wlan_hdd_is_session_type_monitor(

View File

@@ -20,6 +20,7 @@
#include "wlan_hdd_pre_cac.h" #include "wlan_hdd_pre_cac.h"
#include <qdf_types.h> #include <qdf_types.h>
#include "osif_pre_cac.h" #include "osif_pre_cac.h"
#include "wlan_pre_cac_ucfg_api.h"
void hdd_send_conditional_chan_switch_status(struct hdd_context *hdd_ctx, void hdd_send_conditional_chan_switch_status(struct hdd_context *hdd_ctx,
struct wireless_dev *wdev, struct wireless_dev *wdev,
@@ -220,6 +221,11 @@ void hdd_close_pre_cac_adapter(struct hdd_context *hdd_ctx)
void hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx) void hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx)
{ {
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
uint8_t vdev_id; uint8_t vdev_id;
QDF_STATUS status; QDF_STATUS status;
struct hdd_adapter *precac_adapter; struct hdd_adapter *precac_adapter;
@@ -240,28 +246,7 @@ void hdd_clean_up_pre_cac_interface(struct hdd_context *hdd_ctx)
wlan_hdd_sap_pre_cac_failure, wlan_hdd_sap_pre_cac_failure,
(void *)precac_adapter); (void *)precac_adapter);
qdf_sched_work(0, &hdd_ctx->sap_pre_cac_work); qdf_sched_work(0, &hdd_ctx->sap_pre_cac_work);
} #endif
/**
* wlan_hdd_set_pre_cac_status() - Set the pre cac status
* @pre_cac_adapter: AP adapter used for pre cac
* @status: Status (true or false)
*
* Sets the status of pre cac i.e., whether the pre cac is active or not
*
* Return: Zero on success, non-zero on failure
*/
static int wlan_hdd_set_pre_cac_status(struct hdd_adapter *pre_cac_adapter,
bool status)
{
QDF_STATUS ret;
ret = wlan_sap_set_pre_cac_status(
WLAN_HDD_GET_SAP_CTX_PTR(pre_cac_adapter), status);
if (QDF_IS_STATUS_ERROR(ret))
return -EINVAL;
return 0;
} }
/** /**
@@ -290,6 +275,73 @@ wlan_hdd_set_chan_freq_before_pre_cac(struct hdd_adapter *ap_adapter,
return 0; return 0;
} }
static int wlan_set_def_pre_cac_chan(struct hdd_context *hdd_ctx,
uint32_t pre_cac_ch_freq,
struct cfg80211_chan_def *chandef,
enum nl80211_channel_type *chantype,
enum phy_ch_width *ch_width)
{
enum nl80211_channel_type channel_type;
struct ieee80211_channel *ieee_chan;
struct ch_params ch_params = {0};
ieee_chan = ieee80211_get_channel(hdd_ctx->wiphy,
pre_cac_ch_freq);
if (!ieee_chan) {
hdd_err("channel converion failed %d", pre_cac_ch_freq);
return -EINVAL;
}
ch_params.ch_width = *ch_width;
wlan_reg_set_channel_params_for_freq(hdd_ctx->pdev,
pre_cac_ch_freq, 0,
&ch_params);
switch (ch_params.sec_ch_offset) {
case HIGH_PRIMARY_CH:
channel_type = NL80211_CHAN_HT40MINUS;
break;
case LOW_PRIMARY_CH:
channel_type = NL80211_CHAN_HT40PLUS;
break;
default:
channel_type = NL80211_CHAN_HT20;
break;
}
cfg80211_chandef_create(chandef, ieee_chan, channel_type);
switch (ch_params.ch_width) {
case CH_WIDTH_80MHZ:
chandef->width = NL80211_CHAN_WIDTH_80;
break;
case CH_WIDTH_80P80MHZ:
chandef->width = NL80211_CHAN_WIDTH_80P80;
if (ch_params.mhz_freq_seg1)
chandef->center_freq2 = ch_params.mhz_freq_seg1;
break;
case CH_WIDTH_160MHZ:
chandef->width = NL80211_CHAN_WIDTH_160;
break;
default:
break;
}
if (ch_params.ch_width == CH_WIDTH_80MHZ ||
ch_params.ch_width == CH_WIDTH_80P80MHZ ||
ch_params.ch_width == CH_WIDTH_160MHZ) {
if (ch_params.mhz_freq_seg0)
chandef->center_freq1 = ch_params.mhz_freq_seg0;
}
*chantype = channel_type;
*ch_width = ch_params.ch_width;
hdd_debug("pre cac ch def: chan:%d width:%d freq1:%d freq2:%d",
chandef->chan->center_freq, chandef->width,
chandef->center_freq1, chandef->center_freq2);
return 0;
}
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
/** /**
* wlan_hdd_validate_and_get_pre_cac_ch() - Validate and get pre cac channel * wlan_hdd_validate_and_get_pre_cac_ch() - Validate and get pre cac channel
* @hdd_ctx: HDD context * @hdd_ctx: HDD context
@@ -361,67 +413,28 @@ static int wlan_hdd_validate_and_get_pre_cac_ch(struct hdd_context *hdd_ctx,
return 0; return 0;
} }
static int wlan_set_def_pre_cac_chan(struct hdd_context *hdd_ctx, /**
uint32_t pre_cac_ch_freq, * wlan_hdd_set_pre_cac_status() - Set the pre cac status
struct cfg80211_chan_def *chandef, * @pre_cac_adapter: AP adapter used for pre cac
enum nl80211_channel_type *chantype, * @status: Status (true or false)
enum phy_ch_width *ch_width) *
* Sets the status of pre cac i.e., whether the pre cac is active or not
*
* Return: Zero on success, non-zero on failure
*/
static int wlan_hdd_set_pre_cac_status(struct hdd_adapter *pre_cac_adapter,
bool status)
{ {
enum nl80211_channel_type channel_type; QDF_STATUS ret;
struct ieee80211_channel *ieee_chan;
struct ch_params ch_params = {0};
ieee_chan = ieee80211_get_channel(hdd_ctx->wiphy, ret = wlan_sap_set_pre_cac_status(
pre_cac_ch_freq); WLAN_HDD_GET_SAP_CTX_PTR(pre_cac_adapter), status);
if (!ieee_chan) { if (QDF_IS_STATUS_ERROR(ret))
hdd_err("channel converion failed %d", pre_cac_ch_freq);
return -EINVAL; return -EINVAL;
}
ch_params.ch_width = *ch_width;
wlan_reg_set_channel_params_for_freq(hdd_ctx->pdev,
pre_cac_ch_freq, 0,
&ch_params);
switch (ch_params.sec_ch_offset) {
case HIGH_PRIMARY_CH:
channel_type = NL80211_CHAN_HT40MINUS;
break;
case LOW_PRIMARY_CH:
channel_type = NL80211_CHAN_HT40PLUS;
break;
default:
channel_type = NL80211_CHAN_HT20;
break;
}
cfg80211_chandef_create(chandef, ieee_chan, channel_type);
switch (ch_params.ch_width) {
case CH_WIDTH_80MHZ:
chandef->width = NL80211_CHAN_WIDTH_80;
break;
case CH_WIDTH_80P80MHZ:
chandef->width = NL80211_CHAN_WIDTH_80P80;
if (ch_params.mhz_freq_seg1)
chandef->center_freq2 = ch_params.mhz_freq_seg1;
break;
case CH_WIDTH_160MHZ:
chandef->width = NL80211_CHAN_WIDTH_160;
break;
default:
break;
}
if (ch_params.ch_width == CH_WIDTH_80MHZ ||
ch_params.ch_width == CH_WIDTH_80P80MHZ ||
ch_params.ch_width == CH_WIDTH_160MHZ) {
if (ch_params.mhz_freq_seg0)
chandef->center_freq1 = ch_params.mhz_freq_seg0;
}
*chantype = channel_type;
*ch_width = ch_params.ch_width;
hdd_debug("pre cac ch def: chan:%d width:%d freq1:%d freq2:%d",
chandef->chan->center_freq, chandef->width,
chandef->center_freq1, chandef->center_freq2);
return 0; return 0;
} }
#endif
/** /**
* __wlan_hdd_request_pre_cac() - Start pre CAC in the driver * __wlan_hdd_request_pre_cac() - Start pre CAC in the driver
@@ -449,7 +462,13 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
struct cfg80211_chan_def chandef; struct cfg80211_chan_def chandef;
enum nl80211_channel_type channel_type; enum nl80211_channel_type channel_type;
mac_handle_t mac_handle; mac_handle_t mac_handle;
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
bool val; bool val;
#endif
enum phy_ch_width cac_ch_width; enum phy_ch_width cac_ch_width;
struct hdd_adapter_create_param params = {0}; struct hdd_adapter_create_param params = {0};
qdf_freq_t freq; qdf_freq_t freq;
@@ -461,6 +480,11 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
pre_cac_adapter = hdd_get_adapter_by_iface_name(hdd_ctx, pre_cac_adapter = hdd_get_adapter_by_iface_name(hdd_ctx,
SAP_PRE_CAC_IFNAME); SAP_PRE_CAC_IFNAME);
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
if (pre_cac_adapter) { if (pre_cac_adapter) {
/* Flush existing pre_cac work */ /* Flush existing pre_cac work */
if (hdd_ctx->sap_pre_cac_work.fn) if (hdd_ctx->sap_pre_cac_work.fn)
@@ -471,6 +495,13 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
return -EINVAL; return -EINVAL;
} }
} }
#else
if (!pre_cac_adapter &&
(policy_mgr_get_connection_count(hdd_ctx->psoc) > 1)) {
hdd_err("pre cac not allowed in concurrency");
return -EINVAL;
}
#endif
ap_adapter = hdd_get_adapter(hdd_ctx, QDF_SAP_MODE); ap_adapter = hdd_get_adapter(hdd_ctx, QDF_SAP_MODE);
if (!ap_adapter) { if (!ap_adapter) {
@@ -484,11 +515,17 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
} }
mac_handle = hdd_ctx->mac_handle; mac_handle = hdd_ctx->mac_handle;
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
val = wlan_sap_is_pre_cac_active(mac_handle); val = wlan_sap_is_pre_cac_active(mac_handle);
if (val) { if (val) {
hdd_err("pre cac is already in progress"); hdd_err("pre cac is already in progress");
return -EINVAL; return -EINVAL;
} }
#endif
hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter); hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter);
if (!hdd_ap_ctx) { if (!hdd_ap_ctx) {
@@ -511,8 +548,17 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
hdd_debug("channel: %d", chan_freq); hdd_debug("channel: %d", chan_freq);
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
ret = wlan_hdd_validate_and_get_pre_cac_ch( ret = wlan_hdd_validate_and_get_pre_cac_ch(
hdd_ctx, ap_adapter, chan_freq, &pre_cac_chan_freq); hdd_ctx, ap_adapter, chan_freq, &pre_cac_chan_freq);
#else
ret = ucfg_pre_cac_validate_and_get_freq(hdd_ctx->pdev, chan_freq,
&pre_cac_chan_freq);
#endif
if (ret != 0) { if (ret != 0) {
hdd_err("can't validate pre-cac channel"); hdd_err("can't validate pre-cac channel");
goto release_intf_addr_and_return_failure; goto release_intf_addr_and_return_failure;
@@ -654,7 +700,15 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
* anywhere, since after the pre cac success/failure, the pre cac * anywhere, since after the pre cac success/failure, the pre cac
* adapter itself would be removed. * adapter itself would be removed.
*/ */
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
ret = wlan_hdd_set_pre_cac_status(pre_cac_adapter, true); ret = wlan_hdd_set_pre_cac_status(pre_cac_adapter, true);
#else
ret = ucfg_pre_cac_set_status(pre_cac_adapter->vdev, true);
#endif
if (ret != 0) { if (ret != 0) {
hdd_err("failed to set pre cac status"); hdd_err("failed to set pre cac status");
goto stop_close_pre_cac_adapter; goto stop_close_pre_cac_adapter;

View File

@@ -856,6 +856,11 @@ QDF_STATUS wlan_sap_update_next_channel(struct sap_context *sap_ctx,
enum phy_ch_width chan_bw); enum phy_ch_width chan_bw);
#if defined(FEATURE_SAP_COND_CHAN_SWITCH) && defined(PRE_CAC_SUPPORT) #if defined(FEATURE_SAP_COND_CHAN_SWITCH) && defined(PRE_CAC_SUPPORT)
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
/** /**
* wlan_sap_set_pre_cac_status() - Set the pre cac status * wlan_sap_set_pre_cac_status() - Set the pre cac status
* @sap_ctx: SAP context * @sap_ctx: SAP context
@@ -867,6 +872,7 @@ QDF_STATUS wlan_sap_update_next_channel(struct sap_context *sap_ctx,
*/ */
QDF_STATUS wlan_sap_set_pre_cac_status(struct sap_context *sap_ctx, QDF_STATUS wlan_sap_set_pre_cac_status(struct sap_context *sap_ctx,
bool status); bool status);
#endif
/** /**
* wlan_sap_set_chan_freq_before_pre_cac() - Save the channel before pre cac * wlan_sap_set_chan_freq_before_pre_cac() - Save the channel before pre cac
@@ -881,11 +887,17 @@ QDF_STATUS
wlan_sap_set_chan_freq_before_pre_cac(struct sap_context *sap_ctx, wlan_sap_set_chan_freq_before_pre_cac(struct sap_context *sap_ctx,
qdf_freq_t freq_before_pre_cac); qdf_freq_t freq_before_pre_cac);
#else #else
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
static inline QDF_STATUS static inline QDF_STATUS
wlan_sap_set_pre_cac_status(struct sap_context *sap_ctx, bool status) wlan_sap_set_pre_cac_status(struct sap_context *sap_ctx, bool status)
{ {
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
#endif
static inline QDF_STATUS static inline QDF_STATUS
wlan_sap_set_chan_freq_before_pre_cac(struct sap_context *sap_ctx, wlan_sap_set_chan_freq_before_pre_cac(struct sap_context *sap_ctx,
@@ -908,6 +920,11 @@ wlan_sap_set_chan_freq_before_pre_cac(struct sap_context *sap_ctx,
QDF_STATUS wlan_sap_set_pre_cac_complete_status(struct sap_context *sap_ctx, QDF_STATUS wlan_sap_set_pre_cac_complete_status(struct sap_context *sap_ctx,
bool status); bool status);
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
/** /**
* wlan_sap_is_pre_cac_context() - checks if @context is for a pre-cac adapter * wlan_sap_is_pre_cac_context() - checks if @context is for a pre-cac adapter
* @context: the SAP context to check * @context: the SAP context to check
@@ -918,6 +935,7 @@ bool wlan_sap_is_pre_cac_context(struct sap_context *context);
bool wlan_sap_is_pre_cac_active(mac_handle_t handle); bool wlan_sap_is_pre_cac_active(mac_handle_t handle);
QDF_STATUS wlan_sap_get_pre_cac_vdev_id(mac_handle_t handle, uint8_t *vdev_id); QDF_STATUS wlan_sap_get_pre_cac_vdev_id(mac_handle_t handle, uint8_t *vdev_id);
#endif /* PRE_CAC_COMP */
#else #else
static inline QDF_STATUS static inline QDF_STATUS
wlan_sap_set_pre_cac_complete_status(struct sap_context *sap_ctx, wlan_sap_set_pre_cac_complete_status(struct sap_context *sap_ctx,
@@ -926,6 +944,11 @@ wlan_sap_set_pre_cac_complete_status(struct sap_context *sap_ctx,
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
static inline bool static inline bool
wlan_sap_is_pre_cac_context(struct sap_context *context) wlan_sap_is_pre_cac_context(struct sap_context *context)
{ {
@@ -937,6 +960,7 @@ static inline bool wlan_sap_is_pre_cac_active(mac_handle_t handle)
return false; return false;
} }
#endif #endif
#endif
#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
/** /**

View File

@@ -52,6 +52,7 @@
#include "wlan_reg_services_api.h" #include "wlan_reg_services_api.h"
#include <wlan_scan_api.h> #include <wlan_scan_api.h>
#include <wlan_scan_utils_api.h> #include <wlan_scan_utils_api.h>
#include "wlan_pre_cac_api.h"
/* IF MGR API header file */ /* IF MGR API header file */
#include "wlan_if_mgr_ucfg_api.h" #include "wlan_if_mgr_ucfg_api.h"
@@ -1123,12 +1124,21 @@ QDF_STATUS wlansap_roam_callback(void *ctx,
sap_ctx->chan_freq); sap_ctx->chan_freq);
goto EXIT; goto EXIT;
} }
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
if (sap_ctx->is_pre_cac_on) { if (sap_ctx->is_pre_cac_on) {
wlan_sap_pre_cac_radar_ind(sap_ctx, mac_ctx); wlan_sap_pre_cac_radar_ind(sap_ctx, mac_ctx);
break; break;
} }
#else
if (wlan_pre_cac_get_status(mac_ctx->psoc)) {
wlan_sap_pre_cac_radar_ind(sap_ctx, mac_ctx);
break;
}
#endif
sap_debug("sapdfs: Indicate eSAP_DFS_RADAR_DETECT to HDD"); sap_debug("sapdfs: Indicate eSAP_DFS_RADAR_DETECT to HDD");
sap_signal_hdd_event(sap_ctx, NULL, eSAP_DFS_RADAR_DETECT, sap_signal_hdd_event(sap_ctx, NULL, eSAP_DFS_RADAR_DETECT,
(void *) eSAP_STATUS_SUCCESS); (void *) eSAP_STATUS_SUCCESS);

View File

@@ -60,6 +60,7 @@
#include "cfg_ucfg_api.h" #include "cfg_ucfg_api.h"
#include "wlan_mlme_vdev_mgr_interface.h" #include "wlan_mlme_vdev_mgr_interface.h"
#include "wlan_vdev_mgr_utils_api.h" #include "wlan_vdev_mgr_utils_api.h"
#include "wlan_pre_cac_api.h"
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
* Preprocessor Definitions and Constants * Preprocessor Definitions and Constants
@@ -1475,7 +1476,15 @@ QDF_STATUS sap_set_session_param(mac_handle_t mac_handle,
int i; int i;
sapctx->sessionId = session_id; sapctx->sessionId = session_id;
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
sapctx->is_pre_cac_on = false; sapctx->is_pre_cac_on = false;
#else
wlan_pre_cac_set_status(sapctx->vdev, false);
#endif
sapctx->pre_cac_complete = false; sapctx->pre_cac_complete = false;
sapctx->freq_before_pre_cac = 0; sapctx->freq_before_pre_cac = 0;
@@ -2762,7 +2771,15 @@ QDF_STATUS sap_cac_end_notify(mac_handle_t mac_handle,
* temporary interface created for pre cac and switch * temporary interface created for pre cac and switch
* the original SAP to the pre CAC channel. * the original SAP to the pre CAC channel.
*/ */
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
if (sap_context->is_pre_cac_on) { if (sap_context->is_pre_cac_on) {
#else
if (wlan_pre_cac_get_status(mac->psoc)) {
#endif
qdf_status = wlansap_update_pre_cac_end( qdf_status = wlansap_update_pre_cac_end(
sap_context, mac, intf); sap_context, mac, intf);
if (QDF_IS_STATUS_ERROR(qdf_status)) if (QDF_IS_STATUS_ERROR(qdf_status))

View File

@@ -217,7 +217,13 @@ struct sap_context {
eSapHddEvent sap_state; eSapHddEvent sap_state;
eSapStatus sap_status; eSapStatus sap_status;
uint32_t roc_ind_scan_id; uint32_t roc_ind_scan_id;
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
bool is_pre_cac_on; bool is_pre_cac_on;
#endif
bool pre_cac_complete; bool pre_cac_complete;
bool vendor_acs_dfs_lte_enabled; bool vendor_acs_dfs_lte_enabled;
uint8_t dfs_vendor_channel; uint8_t dfs_vendor_channel;

View File

@@ -1660,6 +1660,11 @@ QDF_STATUS wlan_sap_update_next_channel(struct sap_context *sap_ctx,
} }
#if defined(FEATURE_SAP_COND_CHAN_SWITCH) && defined(PRE_CAC_SUPPORT) #if defined(FEATURE_SAP_COND_CHAN_SWITCH) && defined(PRE_CAC_SUPPORT)
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
QDF_STATUS wlan_sap_set_pre_cac_status(struct sap_context *sap_ctx, QDF_STATUS wlan_sap_set_pre_cac_status(struct sap_context *sap_ctx,
bool status) bool status)
{ {
@@ -1673,6 +1678,7 @@ QDF_STATUS wlan_sap_set_pre_cac_status(struct sap_context *sap_ctx,
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
#endif
QDF_STATUS QDF_STATUS
wlan_sap_set_chan_freq_before_pre_cac(struct sap_context *sap_ctx, wlan_sap_set_chan_freq_before_pre_cac(struct sap_context *sap_ctx,
@@ -1705,6 +1711,11 @@ QDF_STATUS wlan_sap_set_pre_cac_complete_status(struct sap_context *sap_ctx,
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
/*
* Code under PRE_CAC_COMP will be cleaned up
* once pre cac component is done
*/
#ifndef PRE_CAC_COMP
bool wlan_sap_is_pre_cac_context(struct sap_context *context) bool wlan_sap_is_pre_cac_context(struct sap_context *context)
{ {
return context && context->is_pre_cac_on; return context && context->is_pre_cac_on;
@@ -1769,7 +1780,8 @@ QDF_STATUS wlan_sap_get_pre_cac_vdev_id(mac_handle_t handle, uint8_t *vdev_id)
} }
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
#endif #endif /* PRE_CAC_COMP */
#endif /* PRE_CAC_SUPPORT */
void wlansap_get_sec_channel(uint8_t sec_ch_offset, void wlansap_get_sec_channel(uint8_t sec_ch_offset,
uint32_t op_chan_freq, uint32_t op_chan_freq,