qcacld-3.0: Add SAP csa reason

Currently, there is no logging for channel switch reason.
Add csa_reason to know the reason for the channel switch.

Change-Id: Iec02d7fa2b1ec51acb97005da220db7de705d7e0
CRs-Fixed: 2483206
This commit is contained in:
Bala Venkatesh
2019-07-03 16:25:16 +05:30
committed by nshrivas
父節點 afbb3458c4
當前提交 8b9bbde04b
共有 11 個文件被更改,包括 135 次插入4 次删除

查看文件

@@ -1223,6 +1223,7 @@ struct policy_mgr_sme_cbacks {
* encryption type. * encryption type.
* @hdd_is_chan_switch_in_progress: Check if in any adater channel switch is in * @hdd_is_chan_switch_in_progress: Check if in any adater channel switch is in
* progress * progress
* @wlan_hdd_set_sap_csa_reason: Set the sap csa reason in cases like NAN.
*/ */
struct policy_mgr_hdd_cbacks { struct policy_mgr_hdd_cbacks {
void (*sap_restart_chan_switch_cb)(struct wlan_objmgr_psoc *psoc, void (*sap_restart_chan_switch_cb)(struct wlan_objmgr_psoc *psoc,
@@ -1239,6 +1240,8 @@ struct policy_mgr_hdd_cbacks {
enum QDF_OPMODE (*hdd_get_device_mode)(uint32_t session_id); enum QDF_OPMODE (*hdd_get_device_mode)(uint32_t session_id);
bool (*hdd_wapi_security_sta_exist)(void); bool (*hdd_wapi_security_sta_exist)(void);
bool (*hdd_is_chan_switch_in_progress)(void); bool (*hdd_is_chan_switch_in_progress)(void);
void (*wlan_hdd_set_sap_csa_reason)(struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id, uint8_t reason);
}; };

查看文件

@@ -34,6 +34,7 @@
#include "qdf_platform.h" #include "qdf_platform.h"
#include "wlan_nan_api.h" #include "wlan_nan_api.h"
#include "nan_ucfg_api.h" #include "nan_ucfg_api.h"
#include "sap_api.h"
enum policy_mgr_conc_next_action (*policy_mgr_get_current_pref_hw_mode_ptr) enum policy_mgr_conc_next_action (*policy_mgr_get_current_pref_hw_mode_ptr)
(struct wlan_objmgr_psoc *psoc); (struct wlan_objmgr_psoc *psoc);
@@ -1555,6 +1556,11 @@ void policy_mgr_nan_sap_post_enable_conc_check(struct wlan_objmgr_psoc *psoc)
policy_mgr_debug("Force SCC for NAN+SAP Ch: %d", policy_mgr_debug("Force SCC for NAN+SAP Ch: %d",
WLAN_REG_IS_5GHZ_CH(sap_ch) ? nan_ch_5g : nan_ch_2g); WLAN_REG_IS_5GHZ_CH(sap_ch) ? nan_ch_5g : nan_ch_2g);
if (pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason)
pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason(psoc,
sap_info->vdev_id,
CSA_REASON_CONCURRENT_NAN_EVENT);
if (WLAN_REG_IS_5GHZ_CH(sap_ch)) { if (WLAN_REG_IS_5GHZ_CH(sap_ch)) {
policy_mgr_change_sap_channel_with_csa(psoc, sap_info->vdev_id, policy_mgr_change_sap_channel_with_csa(psoc, sap_info->vdev_id,
nan_ch_5g, nan_ch_5g,
@@ -1608,6 +1614,11 @@ void policy_mgr_nan_sap_post_disable_conc_check(struct wlan_objmgr_psoc *psoc)
policy_mgr_err("wait for event failed, still continue with channel switch"); policy_mgr_err("wait for event failed, still continue with channel switch");
} }
if (pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason)
pm_ctx->hdd_cbacks.wlan_hdd_set_sap_csa_reason(psoc,
sap_info->vdev_id,
CSA_REASON_CONCURRENT_NAN_EVENT);
policy_mgr_change_sap_channel_with_csa(psoc, sap_info->vdev_id, policy_mgr_change_sap_channel_with_csa(psoc, sap_info->vdev_id,
sap_ch, sap_ch,
policy_mgr_get_ch_width( policy_mgr_get_ch_width(

查看文件

@@ -9960,6 +9960,8 @@ static int hdd_update_acs_channel(struct hdd_adapter *adapter, uint8_t reason,
sap_config->acs_cfg.ch_width = channel_list->chan_width; sap_config->acs_cfg.ch_width = channel_list->chan_width;
hdd_ap_ctx->sap_config.ch_width_orig = hdd_ap_ctx->sap_config.ch_width_orig =
channel_list->chan_width; channel_list->chan_width;
wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc, adapter->vdev_id,
CSA_REASON_LTE_COEX);
hdd_switch_sap_channel(adapter, sap_config->acs_cfg.pri_ch, hdd_switch_sap_channel(adapter, sap_config->acs_cfg.pri_ch,
true); true);
break; break;
@@ -16252,6 +16254,9 @@ bool wlan_hdd_handle_sap_sta_dfs_conc(struct hdd_adapter *adapter,
hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter); hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter);
qdf_event_reset(&hostapd_state->qdf_event); qdf_event_reset(&hostapd_state->qdf_event);
wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc, ap_adapter->vdev_id,
CSA_REASON_STA_CONNECT_DFS_TO_NON_DFS);
status = wlansap_set_channel_change_with_csa( status = wlansap_set_channel_change_with_csa(
WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter), channel, WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter), channel,
hdd_ap_ctx->sap_config.ch_width_orig, false); hdd_ap_ctx->sap_config.ch_width_orig, false);
@@ -21106,6 +21111,8 @@ static int __wlan_hdd_cfg80211_channel_switch(struct wiphy *wiphy,
if ((QDF_P2P_GO_MODE != adapter->device_mode) && if ((QDF_P2P_GO_MODE != adapter->device_mode) &&
(QDF_SAP_MODE != adapter->device_mode)) (QDF_SAP_MODE != adapter->device_mode))
return -ENOTSUPP; return -ENOTSUPP;
wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc, adapter->vdev_id,
CSA_REASON_USER_INITIATED);
freq = csa_params->chandef.chan->center_freq; freq = csa_params->chandef.chan->center_freq;
channel = cds_freq_to_chan(freq); channel = cds_freq_to_chan(freq);

查看文件

@@ -1140,6 +1140,9 @@ static void __wlan_hdd_sap_pre_cac_success(struct hdd_adapter *adapter)
* switch to the pre CAC DFS channel, there is no CAC again. * switch to the pre CAC DFS channel, there is no CAC again.
*/ */
wlan_hdd_set_pre_cac_complete_status(ap_adapter, true); wlan_hdd_set_pre_cac_complete_status(ap_adapter, true);
wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc, ap_adapter->vdev_id,
CSA_REASON_PRE_CAC_SUCCESS);
i = hdd_softap_set_channel_change(ap_adapter->dev, i = hdd_softap_set_channel_change(ap_adapter->dev,
ap_adapter->pre_cac_chan, ap_adapter->pre_cac_chan,
CH_WIDTH_MAX, false); CH_WIDTH_MAX, false);
@@ -2591,6 +2594,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
case eSAP_ECSA_CHANGE_CHAN_IND: case eSAP_ECSA_CHANGE_CHAN_IND:
hdd_debug("Channel change indication from peer for channel %d", hdd_debug("Channel change indication from peer for channel %d",
sap_event->sapevt.sap_chan_cng_ind.new_chan); sap_event->sapevt.sap_chan_cng_ind.new_chan);
wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc, adapter->vdev_id,
CSA_REASON_PEER_ACTION_FRAME);
if (hdd_softap_set_channel_change(dev, if (hdd_softap_set_channel_change(dev,
sap_event->sapevt.sap_chan_cng_ind.new_chan, sap_event->sapevt.sap_chan_cng_ind.new_chan,
CH_WIDTH_MAX, false)) CH_WIDTH_MAX, false))
@@ -3072,6 +3077,20 @@ void hdd_sap_restart_chan_switch_cb(struct wlan_objmgr_psoc *psoc,
channel_bw, forced); channel_bw, forced);
} }
void wlan_hdd_set_sap_csa_reason(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
uint8_t reason)
{
struct sap_context *sap_ctx;
struct hdd_adapter *ap_adapter = wlan_hdd_get_adapter_from_vdev(
psoc, vdev_id);
if (!ap_adapter) {
hdd_err("ap adapter is NULL");
return;
}
sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(ap_adapter);
sap_ctx->csa_reason = reason;
}
QDF_STATUS wlan_hdd_get_channel_for_sap_restart( QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
struct wlan_objmgr_psoc *psoc, struct wlan_objmgr_psoc *psoc,
uint8_t vdev_id, uint8_t *channel, uint8_t vdev_id, uint8_t *channel,
@@ -3170,6 +3189,8 @@ sap_restart:
hdd_ap_ctx->sap_config.channel, intf_ch); hdd_ap_ctx->sap_config.channel, intf_ch);
ch_params.ch_width = CH_WIDTH_MAX; ch_params.ch_width = CH_WIDTH_MAX;
hdd_ap_ctx->bss_stop_reason = BSS_STOP_DUE_TO_MCC_SCC_SWITCH; hdd_ap_ctx->bss_stop_reason = BSS_STOP_DUE_TO_MCC_SCC_SWITCH;
hdd_ap_ctx->sap_context->csa_reason =
CSA_REASON_CONCURRENT_STA_CHANGED_CHANNEL;
wlan_reg_set_channel_params(hdd_ctx->pdev, wlan_reg_set_channel_params(hdd_ctx->pdev,
intf_ch, intf_ch,

查看文件

@@ -89,6 +89,20 @@ QDF_STATUS wlan_hdd_get_channel_for_sap_restart(
uint8_t *sec_ch); uint8_t *sec_ch);
#endif #endif
/**
* wlan_hdd_set_sap_csa_reason() - Function to set
* sap csa reason
* @psoc: PSOC object information
* @vdev_id: vdev id
* @reason: reason to be updated
*
* This function sets the reason for SAP channel switch
*
* Return: None
*
*/
void wlan_hdd_set_sap_csa_reason(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
uint8_t reason);
eCsrEncryptionType eCsrEncryptionType
hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]); hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]);

查看文件

@@ -466,6 +466,9 @@ static __iw_softap_setparam(struct net_device *dev,
case QCSAP_PARAM_SET_CHANNEL_CHANGE: case QCSAP_PARAM_SET_CHANNEL_CHANGE:
if ((QDF_SAP_MODE == adapter->device_mode) || if ((QDF_SAP_MODE == adapter->device_mode) ||
(QDF_P2P_GO_MODE == adapter->device_mode)) { (QDF_P2P_GO_MODE == adapter->device_mode)) {
wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc,
adapter->vdev_id,
CSA_REASON_USER_INITIATED);
hdd_debug("SET Channel Change to new channel= %d", hdd_debug("SET Channel Change to new channel= %d",
set_value); set_value);
ret = hdd_softap_set_channel_change(dev, set_value, ret = hdd_softap_set_channel_change(dev, set_value,

查看文件

@@ -7015,6 +7015,8 @@ static int drv_cmd_set_channel_switch(struct hdd_adapter *adapter,
hdd_debug("CH:%d BW:%d", chan_number, chan_bw); hdd_debug("CH:%d BW:%d", chan_number, chan_bw);
wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc, adapter->vdev_id,
CSA_REASON_USER_INITIATED);
status = hdd_softap_set_channel_change(dev, chan_number, width, true); status = hdd_softap_set_channel_change(dev, chan_number, width, true);
if (status) { if (status) {
hdd_err("Set channel change fail"); hdd_err("Set channel change fail");

查看文件

@@ -2735,6 +2735,8 @@ static void hdd_register_policy_manager_callback(
hdd_wapi_security_sta_exist; hdd_wapi_security_sta_exist;
hdd_cbacks.hdd_is_chan_switch_in_progress = hdd_cbacks.hdd_is_chan_switch_in_progress =
hdd_is_chan_switch_in_progress; hdd_is_chan_switch_in_progress;
hdd_cbacks.wlan_hdd_set_sap_csa_reason =
wlan_hdd_set_sap_csa_reason;
if (QDF_STATUS_SUCCESS != if (QDF_STATUS_SUCCESS !=
policy_mgr_register_hdd_cb(psoc, &hdd_cbacks)) { policy_mgr_register_hdd_cb(psoc, &hdd_cbacks)) {
@@ -8840,9 +8842,13 @@ void hdd_unsafe_channel_restart_sap(struct hdd_context *hdd_ctxt)
hdd_ctxt->acs_policy.acs_channel = AUTO_CHANNEL_SELECT; hdd_ctxt->acs_policy.acs_channel = AUTO_CHANNEL_SELECT;
ucfg_mlme_get_sap_internal_restart(hdd_ctxt->psoc, ucfg_mlme_get_sap_internal_restart(hdd_ctxt->psoc,
&value); &value);
if (value) if (value) {
wlan_hdd_set_sap_csa_reason(hdd_ctxt->psoc,
adapter->vdev_id,
CSA_REASON_UNSAFE_CHANNEL);
hdd_switch_sap_channel(adapter, restart_chan, hdd_switch_sap_channel(adapter, restart_chan,
true); true);
}
else { else {
hdd_debug("sending coex indication"); hdd_debug("sending coex indication");
wlan_hdd_send_svc_nlink_msg( wlan_hdd_send_svc_nlink_msg(
@@ -8912,6 +8918,8 @@ static void hdd_lte_coex_restart_sap(struct hdd_adapter *adapter,
wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index, wlan_hdd_send_svc_nlink_msg(hdd_ctx->radio_index,
WLAN_SVC_LTE_COEX_IND, NULL, 0); WLAN_SVC_LTE_COEX_IND, NULL, 0);
wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc, adapter->vdev_id,
CSA_REASON_LTE_COEX);
hdd_switch_sap_channel(adapter, restart_chan, true); hdd_switch_sap_channel(adapter, restart_chan, true);
} }
@@ -15078,7 +15086,8 @@ void hdd_check_and_restart_sap_with_non_dfs_acs(void)
if (!restart_chan || if (!restart_chan ||
wlan_reg_is_dfs_ch(hdd_ctx->pdev, restart_chan)) wlan_reg_is_dfs_ch(hdd_ctx->pdev, restart_chan))
restart_chan = SAP_DEFAULT_5GHZ_CHANNEL; restart_chan = SAP_DEFAULT_5GHZ_CHANNEL;
wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc, ap_adapter->vdev_id,
CSA_REASON_STA_CONNECT_DFS_TO_NON_DFS);
hdd_switch_sap_channel(ap_adapter, restart_chan, true); hdd_switch_sap_channel(ap_adapter, restart_chan, true);
} }
} }

查看文件

@@ -466,6 +466,31 @@ enum sap_acs_dfs_mode {
ACS_DFS_MODE_DEPRIORITIZE ACS_DFS_MODE_DEPRIORITIZE
}; };
/**
* enum sap_csa_reason_code - SAP channel switch reason code
* @CSA_REASON_UNKNOWN: Unknown reason
* @CSA_REASON_STA_CONNECT_DFS_TO_NON_DFS: STA connection from DFS to NON DFS.
* @CSA_REASON_USER_INITIATED: User initiated form north bound.
* @CSA_REASON_PEER_ACTION_FRAME: Action frame received on sta iface.
* @CSA_REASON_PRE_CAC_SUCCESS: Pre CAC success.
* @CSA_REASON_CONCURRENT_STA_CHANGED_CHANNEL: concurrent sta changed channel.
* @CSA_REASON_UNSAFE_CHANNEL: Unsafe channel.
* @CSA_REASON_LTE_COEX: LTE coex.
* @CSA_REASON_CONCURRENT_NAN_EVENT: NAN concurrency.
*
*/
enum sap_csa_reason_code {
CSA_REASON_UNKNOWN,
CSA_REASON_STA_CONNECT_DFS_TO_NON_DFS,
CSA_REASON_USER_INITIATED,
CSA_REASON_PEER_ACTION_FRAME,
CSA_REASON_PRE_CAC_SUCCESS,
CSA_REASON_CONCURRENT_STA_CHANGED_CHANNEL,
CSA_REASON_UNSAFE_CHANNEL,
CSA_REASON_LTE_COEX,
CSA_REASON_CONCURRENT_NAN_EVENT
};
struct sap_config { struct sap_config {
tSap_SSIDInfo_t SSIDinfo; tSap_SSIDInfo_t SSIDinfo;
eCsrPhyMode SapHw_mode; /* Wireless Mode */ eCsrPhyMode SapHw_mode; /* Wireless Mode */

查看文件

@@ -146,6 +146,7 @@ struct sap_context {
* track of state machine * track of state machine
*/ */
enum sap_fsm_state fsm_state; enum sap_fsm_state fsm_state;
enum sap_csa_reason_code csa_reason;
/* Actual storage for AP and self (STA) SSID */ /* Actual storage for AP and self (STA) SSID */
tCsrSSIDInfo SSIDList[2]; tCsrSSIDInfo SSIDList[2];

查看文件

@@ -335,6 +335,7 @@ QDF_STATUS sap_init_ctx(struct sap_context *sap_ctx,
sap_ctx->SSIDList[0].ssidHidden; sap_ctx->SSIDList[0].ssidHidden;
sap_ctx->csr_roamProfile.BSSIDs.numOfBSSIDs = 1; /* This is true for now. */ sap_ctx->csr_roamProfile.BSSIDs.numOfBSSIDs = 1; /* This is true for now. */
sap_ctx->csa_reason = CSA_REASON_UNKNOWN;
sap_ctx->csr_roamProfile.BSSIDs.bssid = &sap_ctx->bssid; sap_ctx->csr_roamProfile.BSSIDs.bssid = &sap_ctx->bssid;
sap_ctx->csr_roamProfile.csrPersona = mode; sap_ctx->csr_roamProfile.csrPersona = mode;
qdf_mem_copy(sap_ctx->self_mac_addr, addr, QDF_MAC_ADDR_SIZE); qdf_mem_copy(sap_ctx->self_mac_addr, addr, QDF_MAC_ADDR_SIZE);
@@ -1328,6 +1329,38 @@ static inline void sap_start_csa_restart(struct mac_context *mac,
sme_csa_restart(mac, sap_ctx->sessionId); sme_csa_restart(mac, sap_ctx->sessionId);
} }
/**
* sap_get_csa_reason_str() - Get csa reason in string
* @reason: sap reason enum value
*
* Return: string reason
*/
static char *sap_get_csa_reason_str(enum sap_csa_reason_code reason)
{
switch (reason) {
case CSA_REASON_UNKNOWN:
return "UNKNOWN";
case CSA_REASON_STA_CONNECT_DFS_TO_NON_DFS:
return "STA_CONNECT_DFS_TO_NON_DFS";
case CSA_REASON_USER_INITIATED:
return "USER_INITIATED";
case CSA_REASON_PEER_ACTION_FRAME:
return "PEER_ACTION_FRAME";
case CSA_REASON_PRE_CAC_SUCCESS:
return "PRE_CAC_SUCCESS";
case CSA_REASON_CONCURRENT_STA_CHANGED_CHANNEL:
return "CONCURRENT_STA_CHANGED_CHANNEL";
case CSA_REASON_UNSAFE_CHANNEL:
return "UNSAFE_CHANNEL";
case CSA_REASON_LTE_COEX:
return "LTE_COEX";
case CSA_REASON_CONCURRENT_NAN_EVENT:
return "CONCURRENT_NAN_EVENT";
default:
return "UNKNOWN";
}
}
/** /**
* wlansap_set_channel_change_with_csa() - Set channel change with CSA * wlansap_set_channel_change_with_csa() - Set channel change with CSA
* @sap_ctx: Pointer to SAP context * @sap_ctx: Pointer to SAP context
@@ -1373,10 +1406,12 @@ QDF_STATUS wlansap_set_channel_change_with_csa(struct sap_context *sap_ctx,
return QDF_STATUS_E_FAULT; return QDF_STATUS_E_FAULT;
} }
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO, QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
"%s: sap chan:%d target:%d conn on 5GHz:%d", "%s: sap chan:%d target:%d conn on 5GHz:%d, csa_reason:%s(%d)",
__func__, sap_ctx->channel, targetChannel, __func__, sap_ctx->channel, targetChannel,
policy_mgr_is_any_mode_active_on_band_along_with_session( policy_mgr_is_any_mode_active_on_band_along_with_session(
mac->psoc, sap_ctx->sessionId, POLICY_MGR_BAND_5)); mac->psoc, sap_ctx->sessionId, POLICY_MGR_BAND_5),
sap_get_csa_reason_str(sap_ctx->csa_reason),
sap_ctx->csa_reason);
sta_sap_scc_on_dfs_chan = sta_sap_scc_on_dfs_chan =
policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(mac->psoc); policy_mgr_is_sta_sap_scc_allowed_on_dfs_chan(mac->psoc);