qcacld-3.0: TDLS: remove legacy interfaces

Clear up the legacy tdls interfaces which handle
connect/disconnect notifications, scan and p2p
roc events.

Change-Id: Ia860904685fc4783453491effa4518777c7406d0
CRs-Fixed: 2105075
This commit is contained in:
Frank Liu
2017-09-06 20:56:31 +08:00
committed by snandini
parent 1a912b2f05
commit 2ef4ab2f99
10 changed files with 1 additions and 995 deletions

View File

@@ -1638,7 +1638,6 @@ struct hdd_context {
uint16_t max_num_tdls_sta;
/* TDLS peer connected count */
uint16_t connected_peer_count;
tdls_scan_context_t tdls_scan_ctxt;
/* Lock to avoid race condition during TDLS operations */
qdf_spinlock_t tdls_ct_spinlock;
/* linear mac address table for counting the packets */
@@ -1832,8 +1831,6 @@ struct hdd_context {
struct mutex chan_info_lock;
/* bit map to set/reset TDLS by different sources */
unsigned long tdls_source_bitmap;
/* tdls source timer to enable/disable TDLS on p2p listen */
qdf_mc_timer_t tdls_source_timer;
bool tdls_umac_comp_active;
bool tdls_nap_active;
uint8_t beacon_probe_rsp_cnt_per_scan;

View File

@@ -144,28 +144,6 @@ typedef struct {
int32_t rssi_delta;
} tdls_config_params_t;
/**
* struct tdls_scan_context_t - tdls scan context
*
* @wiphy: pointer to wiphy structure
* @dev: pointer to netdev
* @scan_request: scan request
* @magic: magic
* @attempt: attempt
* @reject: reject
* @source: scan request source(NL/Vendor scan)
* @tdls_scan_work: delayed tdls scan work
*/
typedef struct {
struct wiphy *wiphy;
struct cfg80211_scan_request *scan_request;
uint32_t magic;
int attempt;
int reject;
uint8_t source;
struct delayed_work tdls_scan_work;
} tdls_scan_context_t;
/**
* enum tdls_spatial_streams - TDLS spatial streams
* @TDLS_NSS_1x1_MODE: TDLS tx/rx spatial streams = 1
@@ -573,10 +551,6 @@ uint16_t wlan_hdd_tdls_connected_peers(struct hdd_adapter *pAdapter);
int wlan_hdd_tdls_get_all_peers(struct hdd_adapter *pAdapter, char *buf,
int buflen);
void wlan_hdd_tdls_connection_callback(struct hdd_adapter *pAdapter);
void wlan_hdd_tdls_disconnection_callback(struct hdd_adapter *pAdapter);
void wlan_hdd_tdls_mgmt_completion_callback(struct hdd_adapter *pAdapter,
uint32_t statusCode);
@@ -587,17 +561,6 @@ void wlan_hdd_tdls_decrement_peer_count(struct hdd_adapter *pAdapter);
hddTdlsPeer_t *wlan_hdd_tdls_is_progress(struct hdd_context *hdd_ctx,
const uint8_t *mac, uint8_t skip_self);
int wlan_hdd_tdls_copy_scan_context(struct hdd_context *hdd_ctx,
struct wiphy *wiphy,
struct cfg80211_scan_request *request);
int wlan_hdd_tdls_scan_callback(struct hdd_adapter *pAdapter,
struct wiphy *wiphy,
struct cfg80211_scan_request *request,
uint8_t source);
void wlan_hdd_tdls_scan_done_callback(struct hdd_adapter *pAdapter);
void wlan_hdd_tdls_timer_restart(struct hdd_adapter *pAdapter,
qdf_mc_timer_t *timer,
uint32_t expirationTime);
@@ -637,9 +600,6 @@ void wlan_hdd_tdls_get_wifi_hal_state(hddTdlsPeer_t *curr_peer,
uint32_t *state, int32_t *reason);
int wlan_hdd_set_callback(hddTdlsPeer_t *curr_peer,
cfg80211_exttdls_callback callback);
void wlan_hdd_update_tdls_info(struct hdd_adapter *adapter,
bool tdls_prohibited,
bool tdls_chan_swit_prohibited);
int wlan_hdd_tdls_add_station(struct wiphy *wiphy,
struct net_device *dev, const uint8_t *mac,
@@ -707,9 +667,6 @@ int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy,
#endif
#endif
void
wlan_hdd_tdls_disable_offchan_and_teardown_links(struct hdd_context *hddctx);
hddTdlsPeer_t *
wlan_hdd_tdls_find_first_connected_peer(struct hdd_adapter *adapter);
int hdd_set_tdls_offchannel(struct hdd_context *hdd_ctx, int offchannel);
@@ -722,52 +679,6 @@ void hdd_tdls_context_destroy(struct hdd_context *hdd_ctx);
int wlan_hdd_tdls_antenna_switch(struct hdd_context *hdd_ctx,
struct hdd_adapter *adapter,
uint32_t mode);
/**
* wlan_hdd_tdls_notify_connect() - Update tdls state for every
* connect event.
* @adapter: hdd adapter
* @csr_roam_info: csr information
*
* After every connect event in the system, check whether TDLS
* can be enabled in the system. If TDLS can be enabled, update the
* TDLS state as needed.
*
* Return: None
*/
void wlan_hdd_tdls_notify_connect(struct hdd_adapter *adapter,
tCsrRoamInfo *csr_roam_info);
/**
* wlan_hdd_tdls_notify_disconnect() - Update tdls state for every
* disconnect event.
* @adapter: hdd adapter
* @lfr_roam: roaming case
*
* After every disconnect event in the system, check whether TDLS
* can be disabled/enabled in the system and update the
* TDLS state as needed.
*
* Return: None
*/
void wlan_hdd_tdls_notify_disconnect(struct hdd_adapter *adapter,
bool lfr_roam);
void wlan_hdd_change_tdls_mode(void *hdd_ctx);
/**
* hdd_tdls_notify_p2p_roc() - Notify p2p roc event to TDLS
* @hdd_ctx: ptr to hdd context.
* @event: P2P roc event that affect TDLS
*
* P2P roc events notified to TDLS to avoid overlap between P2P listen
* and TDLS operation.
* Based on P2P remain on channel event, TDLS mode will be
* updated and TDLS source timer started with timer period
* equivalent to P2P ROC interval to revert the TDLS mode.
*
* Return: None
*/
void hdd_tdls_notify_p2p_roc(struct hdd_context *hdd_ctx,
enum tdls_concerned_external_events event);
/**
* wlan_hdd_cfg80211_configure_tdls_mode() - configure tdls mode
@@ -794,19 +705,9 @@ QDF_STATUS hdd_tdls_deregister_tdl_peer(void *userdata,
static inline void hdd_update_tdls_ct_and_teardown_links(struct hdd_context *hdd_ctx)
{
}
static inline void
wlan_hdd_tdls_disable_offchan_and_teardown_links(struct hdd_context *hddctx)
{
}
static inline void wlan_hdd_tdls_exit(struct hdd_adapter *adapter)
{
}
static inline void hdd_tdls_context_init(struct hdd_context *hdd_ctx, bool ssr)
{
}
static inline void hdd_tdls_context_destroy(struct hdd_context *hdd_ctx)
{
}
static inline int wlan_hdd_tdls_antenna_switch(struct hdd_context *hdd_ctx,
struct hdd_adapter *adapter,
@@ -819,10 +720,6 @@ static inline void wlan_hdd_update_tdls_info(struct hdd_adapter *adapter,
bool tdls_chan_swit_prohibited)
{
}
static inline void wlan_hdd_tdls_notify_connect(struct hdd_adapter *adapter,
tCsrRoamInfo *csr_roam_info)
{
}
static inline void wlan_hdd_tdls_notify_disconnect(struct hdd_adapter *adapter,
bool lfr_roam)
{

View File

@@ -1251,7 +1251,6 @@ static void hdd_send_association_event(struct net_device *dev,
/* Update tdls module about the disconnection event */
hdd_notify_sta_disconnect(pAdapter->sessionId,
true, pAdapter->hdd_vdev);
wlan_hdd_tdls_notify_disconnect(pAdapter, true);
}
#endif
if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) {
@@ -1347,9 +1346,6 @@ static void hdd_send_association_event(struct net_device *dev,
pCsrRoamInfo->tdls_prohibited,
pAdapter->hdd_vdev);
wlan_hdd_tdls_notify_connect(pAdapter, pCsrRoamInfo);
#ifdef MSM_PLATFORM
#if defined(CONFIG_ICNSS) || defined(CONFIG_CNSS)
/* start timer in sta/p2p_cli */
@@ -1420,7 +1416,6 @@ static void hdd_send_association_event(struct net_device *dev,
hdd_notify_sta_disconnect(pAdapter->sessionId,
false,
pAdapter->hdd_vdev);
wlan_hdd_tdls_notify_disconnect(pAdapter, false);
#ifdef MSM_PLATFORM
/* stop timer in sta/p2p_cli */
@@ -1772,11 +1767,6 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *pAdapter,
hdd_conn_set_connection_state(pAdapter, eConnectionState_NotConnected);
pmo_ucfg_flush_gtk_offload_req(pAdapter->hdd_vdev);
#ifdef FEATURE_WLAN_TDLS
if (eCSR_ROAM_IBSS_LEAVE != roamStatus)
wlan_hdd_tdls_disconnection_callback(pAdapter);
#endif
if ((QDF_STA_MODE == pAdapter->device_mode) ||
(QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) {
sme_ps_disable_auto_ps_timer(WLAN_HDD_GET_HAL_CTX
@@ -3072,10 +3062,6 @@ static QDF_STATUS hdd_association_completion_handler(struct hdd_adapter *pAdapte
WLAN_CONTROL_PATH);
}
#ifdef FEATURE_WLAN_TDLS
wlan_hdd_tdls_connection_callback(pAdapter);
#endif
if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
hdd_err("STA register with TL failed status: %d [%08X]",
qdf_status, qdf_status);

View File

@@ -15501,7 +15501,6 @@ static int wlan_hdd_cfg80211_connect_start(struct hdd_adapter *pAdapter,
}
hdd_notify_teardown_tdls_links(pAdapter->hdd_vdev);
wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_ctx);
pRoamProfile = &pWextState->roamProfile;
qdf_mem_zero(&hdd_sta_ctx->conn_info.conn_flag,

View File

@@ -7437,8 +7437,6 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *pHostapdAdapter,
hdd_notify_teardown_tdls_links(pHostapdAdapter->hdd_vdev);
wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_ctx);
if (policy_mgr_is_hw_mode_change_in_progress(hdd_ctx->hdd_psoc)) {
status = policy_mgr_wait_for_connection_update(
hdd_ctx->hdd_psoc);

View File

@@ -5979,8 +5979,6 @@ static void hdd_wlan_exit(struct hdd_context *hdd_ctx)
hdd_unregister_notifiers(hdd_ctx);
qdf_mc_timer_destroy(&hdd_ctx->tdls_source_timer);
hdd_bus_bandwidth_destroy(hdd_ctx);
#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
@@ -9805,11 +9803,6 @@ int hdd_wlan_startup(struct device *dev)
qdf_spinlock_create(&hdd_ctx->acs_skip_lock);
#endif
qdf_mc_timer_init(&hdd_ctx->tdls_source_timer,
QDF_TIMER_TYPE_SW,
wlan_hdd_change_tdls_mode,
hdd_ctx);
hdd_bus_bandwidth_init(hdd_ctx);
hdd_lpass_notify_start(hdd_ctx);

View File

@@ -580,7 +580,6 @@ static void wlan_hdd_remain_on_chan_timeout(void *data)
wlansap_cancel_remain_on_channel(sap_ctx, roc_scan_id);
}
hdd_tdls_notify_p2p_roc(hdd_ctx, P2P_ROC_END);
qdf_runtime_pm_allow_suspend(&hdd_ctx->runtime_context.roc);
hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_ROC);
}
@@ -742,7 +741,7 @@ static int wlan_hdd_execute_remain_on_channel(struct hdd_adapter *pAdapter,
}
}
hdd_tdls_notify_p2p_roc(hdd_ctx, P2P_ROC_START);
return 0;
}

View File

@@ -1283,7 +1283,6 @@ QDF_STATUS hdd_wlan_shutdown(void)
}
hdd_ipa_uc_ssr_deinit();
qdf_mc_timer_stop(&hdd_ctx->tdls_source_timer);
hdd_bus_bandwidth_destroy(hdd_ctx);

View File

@@ -531,26 +531,6 @@ static int __wlan_hdd_cfg80211_scan(struct wiphy *wiphy,
return 0;
}
}
#ifdef FEATURE_WLAN_TDLS
/* if tdls disagree scan right now, return immediately.
* tdls will schedule the scan when scan is allowed.
* (return SUCCESS)
* or will reject the scan if any TDLS is in progress.
* (return -EBUSY)
*/
status = wlan_hdd_tdls_scan_callback(pAdapter, wiphy,
request, source);
if (status <= 0) {
if (!status)
hdd_err("TDLS in progress.scan rejected %d",
status);
else
hdd_warn("TDLS teardown is ongoing %d",
status);
hdd_wlan_block_scan_by_tdls_event();
return status;
}
#endif
/* Check if scan is allowed at this point of time */
if (hdd_is_connection_in_progress(&curr_session_id, &curr_reason)) {

View File

@@ -51,8 +51,6 @@
#include <qca_vendor.h>
#include "wlan_hdd_ipa.h"
static int32_t wlan_hdd_tdls_peer_reset_discovery_processed(tdlsCtx_t *
pHddTdlsCtx);
static void wlan_hdd_tdls_timers_destroy(tdlsCtx_t *pHddTdlsCtx);
/**
@@ -206,105 +204,6 @@ static u8 wlan_hdd_tdls_hash_key(const u8 *mac)
return key;
}
/**
* wlan_hdd_tdls_disable_offchan_and_teardown_links - Disable offchannel
* and teardown TDLS links
* @hddCtx : pointer to hdd context
*
* Return: None
*/
void wlan_hdd_tdls_disable_offchan_and_teardown_links(struct hdd_context *hddctx)
{
u16 connected_tdls_peers = 0;
u8 staidx;
hddTdlsPeer_t *curr_peer = NULL;
struct hdd_adapter *adapter = NULL;
if (hddctx->tdls_umac_comp_active)
return;
if (eTDLS_SUPPORT_NOT_ENABLED == hddctx->tdls_mode) {
hdd_debug("TDLS mode is disabled OR not enabled in FW");
return;
}
adapter = hdd_get_adapter(hddctx, QDF_STA_MODE);
if (adapter == NULL) {
hdd_debug("Station Adapter Not Found");
return;
}
connected_tdls_peers = wlan_hdd_tdls_connected_peers(adapter);
if (!connected_tdls_peers) {
hdd_debug("No TDLS connected peers to delete");
return;
}
/* TDLS is not supported in case of concurrency.
* Disable TDLS Offchannel in FW to avoid more
* than two concurrent channels and generate TDLS
* teardown indication to supplicant.
* Below function Finds the first connected peer and
* disables TDLS offchannel for that peer.
* FW enables TDLS offchannel only when there is
* one TDLS peer. When there are more than one TDLS peer,
* there will not be TDLS offchannel in FW.
* So to avoid sending multiple request to FW, for now,
* just invoke offchannel mode functions only once
*/
hdd_set_tdls_offchannel(hddctx, hddctx->config->fTDLSPrefOffChanNum);
hdd_set_tdls_secoffchanneloffset(hddctx,
TDLS_SEC_OFFCHAN_OFFSET_40PLUS);
hdd_set_tdls_offchannelmode(adapter, DISABLE_CHANSWITCH);
/* Send Msg to PE for deleting all the TDLS peers */
sme_delete_all_tdls_peers(hddctx->hHal, adapter->sessionId);
for (staidx = 0; staidx < hddctx->max_num_tdls_sta;
staidx++) {
if (!hddctx->tdlsConnInfo[staidx].staId)
continue;
mutex_lock(&hddctx->tdls_lock);
curr_peer = wlan_hdd_tdls_find_all_peer(hddctx,
hddctx->tdlsConnInfo[staidx].peerMac.bytes);
if (!curr_peer) {
mutex_unlock(&hddctx->tdls_lock);
continue;
}
hdd_debug("indicate TDLS teardown (staId %d)",
curr_peer->staId);
/* Indicate teardown to supplicant */
wlan_hdd_tdls_indicate_teardown(
curr_peer->pHddTdlsCtx->pAdapter,
curr_peer,
eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
/*
* Del Sta happened already as part of sme_delete_all_tdls_peers
* Hence clear hdd data structure.
*/
wlan_hdd_tdls_reset_peer(adapter, curr_peer->peerMac);
hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_CONCURRENCY,
curr_peer->peerMac);
mutex_unlock(&hddctx->tdls_lock);
hdd_roam_deregister_tdlssta(adapter,
hddctx->tdlsConnInfo[staidx].staId);
wlan_hdd_tdls_decrement_peer_count(adapter);
hddctx->tdlsConnInfo[staidx].staId =
OL_TXRX_INVALID_TDLS_PEER_ID;
hddctx->tdlsConnInfo[staidx].sessionId = 255;
qdf_mem_zero(&hddctx->tdlsConnInfo[staidx].peerMac,
sizeof(struct qdf_mac_addr));
}
}
/**
* wlan_hdd_tdls_discovery_sent_cnt() - get value of discovery counter sent
* @hdd_ctx: HDD context
@@ -375,26 +274,6 @@ wlan_hdd_tdls_check_power_save_prohibited(struct hdd_adapter *pAdapter)
pAdapter->sessionId, 1);
}
/**
* wlan_hdd_tdls_free_scan_request() - free tdls scan request
* @tdls_scan_ctx: tdls scan context
*
* Return: None
*/
static void wlan_hdd_tdls_free_scan_request(tdls_scan_context_t *tdls_scan_ctx)
{
if (NULL == tdls_scan_ctx) {
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
FL("tdls_scan_ctx is NULL"));
return;
}
tdls_scan_ctx->attempt = 0;
tdls_scan_ctx->reject = 0;
tdls_scan_ctx->magic = 0;
tdls_scan_ctx->scan_request = NULL;
}
/**
* wlan_hdd_tdls_discovery_timeout_peer_cb() - tdls discovery timeout callback
* @userData: tdls context
@@ -481,32 +360,6 @@ static void wlan_hdd_tdls_free_list(tdlsCtx_t *pHddTdlsCtx)
}
}
/**
* wlan_hdd_tdls_schedule_scan() - schedule scan for tdls
* @work: work_struct used to find tdls scan context
*
* Return: None
*/
static void wlan_hdd_tdls_schedule_scan(struct work_struct *work)
{
tdls_scan_context_t *scan_ctx =
container_of(work, tdls_scan_context_t, tdls_scan_work.work);
if (NULL == scan_ctx) {
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
FL("scan_ctx is NULL"));
return;
}
if (unlikely(TDLS_CTX_MAGIC != scan_ctx->magic))
return;
scan_ctx->attempt++;
wlan_hdd_cfg80211_tdls_scan(scan_ctx->wiphy,
scan_ctx->scan_request, scan_ctx->source);
}
/**
* dump_tdls_state_param_setting() - print tdls state & parameters to send to fw
* @info: tdls setting to be sent to fw
@@ -612,11 +465,6 @@ void hdd_tdls_context_init(struct hdd_context *hdd_ctx, bool ssr)
hdd_ctx->connected_peer_count = 0;
hdd_ctx->tdls_nss_switch_in_progress = false;
hdd_ctx->tdls_teardown_peers_cnt = 0;
hdd_ctx->tdls_scan_ctxt.magic = 0;
hdd_ctx->tdls_scan_ctxt.attempt = 0;
hdd_ctx->tdls_scan_ctxt.reject = 0;
hdd_ctx->tdls_scan_ctxt.source = 0;
hdd_ctx->tdls_scan_ctxt.scan_request = NULL;
hdd_ctx->set_state_info.set_state_cnt = 0;
hdd_ctx->set_state_info.vdev_id = 0;
hdd_ctx->tdls_nss_teardown_complete = false;
@@ -775,9 +623,6 @@ int wlan_hdd_tdls_init(struct hdd_adapter *pAdapter)
pHddTdlsCtx->threshold_config.rssi_delta =
hdd_ctx->config->fTDLSRSSIDelta;
INIT_DELAYED_WORK(&hdd_ctx->tdls_scan_ctxt.tdls_scan_work,
wlan_hdd_tdls_schedule_scan);
mutex_unlock(&hdd_ctx->tdls_lock);
if (hdd_ctx->config->fEnableTDLSOffChannel)
@@ -814,8 +659,6 @@ void wlan_hdd_tdls_exit(struct hdd_adapter *pAdapter)
return;
}
cds_flush_delayed_work(&hdd_ctx->tdls_scan_ctxt.tdls_scan_work);
mutex_lock(&hdd_ctx->tdls_lock);
pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
@@ -839,8 +682,6 @@ void wlan_hdd_tdls_exit(struct hdd_adapter *pAdapter)
wlan_hdd_tdls_timers_destroy(pHddTdlsCtx);
wlan_hdd_tdls_free_list(pHddTdlsCtx);
wlan_hdd_tdls_free_scan_request(&hdd_ctx->tdls_scan_ctxt);
pHddTdlsCtx->magic = 0;
pHddTdlsCtx->pAdapter = NULL;
pAdapter->sessionCtx.station.pHddTdlsCtx = NULL;
@@ -1718,266 +1559,6 @@ int wlan_hdd_tdls_set_params(struct net_device *dev,
return 0;
}
/**
* wlan_hdd_tdls_get_adapter() - check system state and return hdd adapter
* @hdd_ctx: hdd context
*
* If TDLS possible, return the corresponding hdd adapter
* to enable TDLS in the system.
*
* Return: hdd adapter pointer or NULL.
*/
static struct hdd_adapter *
wlan_hdd_tdls_get_adapter(struct hdd_context *hdd_ctx)
{
if (policy_mgr_get_connection_count(hdd_ctx->hdd_psoc) > 1)
return NULL;
if (policy_mgr_mode_specific_connection_count(hdd_ctx->hdd_psoc,
QDF_STA_MODE, NULL) == 1)
return hdd_get_adapter(hdd_ctx,
QDF_STA_MODE);
if (policy_mgr_mode_specific_connection_count(hdd_ctx->hdd_psoc,
QDF_P2P_CLIENT_MODE, NULL) == 1)
return hdd_get_adapter(hdd_ctx,
QDF_P2P_CLIENT_MODE);
return NULL;
}
/**
* wlan_hdd_update_tdls_info - update tdls status info
* @adapter: ptr to device adapter.
* @tdls_prohibited: indicates whether tdls is prohibited.
* @tdls_chan_swit_prohibited: indicates whether tdls channel switch
* is prohibited.
*
* Normally an AP does not influence TDLS connection between STAs
* associated to it. But AP may set bits for TDLS Prohibited or
* TDLS Channel Switch Prohibited in Extended Capability IE in
* Assoc/Re-assoc response to STA. So after STA is connected to
* an AP, call this function to update TDLS status as per those
* bits set in Ext Cap IE in received Assoc/Re-assoc response
* from AP.
*
* Return: None.
*/
void wlan_hdd_update_tdls_info(struct hdd_adapter *adapter,
bool tdls_prohibited,
bool tdls_chan_swit_prohibited)
{
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
tdlsCtx_t *hdd_tdls_ctx;
tdlsInfo_t *tdls_param;
QDF_STATUS qdf_ret_status = QDF_STATUS_E_FAILURE;
/* If TDLS support is disabled then no need to update target */
if (false == hdd_ctx->config->fEnableTDLSSupport) {
hdd_err("TDLS not enabled");
return;
}
hdd_debug("tdls_prohibited: %d, tdls_chan_swit_prohibited: %d",
tdls_prohibited, tdls_chan_swit_prohibited);
mutex_lock(&hdd_ctx->tdls_lock);
hdd_tdls_ctx = WLAN_HDD_GET_TDLS_CTX_PTR(adapter);
if (!hdd_tdls_ctx) {
mutex_unlock(&hdd_ctx->tdls_lock);
/* may be TDLS is not applicable for this adapter */
hdd_err("HDD TDLS context is null");
return;
}
if (hdd_ctx->set_state_info.set_state_cnt == 0 &&
tdls_prohibited) {
mutex_unlock(&hdd_ctx->tdls_lock);
return;
}
/* If AP or caller indicated TDLS Prohibited then disable tdls mode */
if (tdls_prohibited) {
hdd_ctx->tdls_mode = eTDLS_SUPPORT_NOT_ENABLED;
} else {
if (false == hdd_ctx->config->fEnableTDLSImplicitTrigger)
hdd_ctx->tdls_mode = eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY;
else if (true == hdd_ctx->config->fTDLSExternalControl)
hdd_ctx->tdls_mode = eTDLS_SUPPORT_EXTERNAL_CONTROL;
else
hdd_ctx->tdls_mode = eTDLS_SUPPORT_ENABLED;
}
tdls_param = qdf_mem_malloc(sizeof(*tdls_param));
if (!tdls_param) {
mutex_unlock(&hdd_ctx->tdls_lock);
hdd_err("memory allocation failed for tdlsParams");
return;
}
tdls_param->notification_interval_ms =
hdd_tdls_ctx->threshold_config.tx_period_t;
tdls_param->tx_discovery_threshold =
hdd_tdls_ctx->threshold_config.tx_packet_n;
tdls_param->tx_teardown_threshold =
hdd_tdls_ctx->threshold_config.idle_packet_n;
tdls_param->rssi_teardown_threshold =
hdd_tdls_ctx->threshold_config.rssi_teardown_threshold;
tdls_param->rssi_delta = hdd_tdls_ctx->threshold_config.rssi_delta;
mutex_unlock(&hdd_ctx->tdls_lock);
/* If any concurrency detected, teardown all TDLS links and disable
* the tdls support
*/
hdd_debug("Concurrency check in TDLS! set state cnt %d tdls_prohibited %d",
hdd_ctx->set_state_info.set_state_cnt, tdls_prohibited);
if (hdd_ctx->set_state_info.set_state_cnt == 1 &&
!tdls_prohibited) {
hdd_warn("Concurrency not allowed in TDLS! set state cnt %d",
hdd_ctx->set_state_info.set_state_cnt);
wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_ctx);
tdls_prohibited = true;
hdd_ctx->tdls_mode = eTDLS_SUPPORT_NOT_ENABLED;
tdls_param->vdev_id = hdd_ctx->set_state_info.vdev_id;
} else {
tdls_param->vdev_id = adapter->sessionId;
}
tdls_param->tdls_state = hdd_ctx->tdls_mode;
tdls_param->tdls_options = 0;
/* Do not enable TDLS offchannel,
* if AP prohibited TDLS channel switch
*/
if ((hdd_ctx->config->fEnableTDLSOffChannel) &&
(!tdls_chan_swit_prohibited)) {
tdls_param->tdls_options |= ENA_TDLS_OFFCHAN;
}
if (hdd_ctx->config->fEnableTDLSBufferSta)
tdls_param->tdls_options |= ENA_TDLS_BUFFER_STA;
if (hdd_ctx->config->fEnableTDLSSleepSta)
tdls_param->tdls_options |= ENA_TDLS_SLEEP_STA;
tdls_param->peer_traffic_ind_window =
hdd_ctx->config->fTDLSPuapsdPTIWindow;
tdls_param->peer_traffic_response_timeout =
hdd_ctx->config->fTDLSPuapsdPTRTimeout;
tdls_param->puapsd_mask =
hdd_ctx->config->fTDLSUapsdMask;
tdls_param->puapsd_inactivity_time =
hdd_ctx->config->fTDLSPuapsdInactivityTimer;
tdls_param->puapsd_rx_frame_threshold =
hdd_ctx->config->fTDLSRxFrameThreshold;
tdls_param->teardown_notification_ms =
hdd_ctx->config->tdls_idle_timeout;
tdls_param->tdls_peer_kickout_threshold =
hdd_ctx->config->tdls_peer_kickout_threshold;
dump_tdls_state_param_setting(tdls_param);
qdf_ret_status = sme_update_fw_tdls_state(hdd_ctx->hHal,
tdls_param,
true);
if (QDF_STATUS_SUCCESS != qdf_ret_status) {
qdf_mem_free(tdls_param);
return;
}
mutex_lock(&hdd_ctx->tdls_lock);
if (!tdls_prohibited) {
hdd_ctx->set_state_info.set_state_cnt++;
hdd_ctx->set_state_info.vdev_id = adapter->sessionId;
} else {
hdd_ctx->set_state_info.set_state_cnt--;
}
hdd_debug("TDLS Set state cnt %d",
hdd_ctx->set_state_info.set_state_cnt);
mutex_unlock(&hdd_ctx->tdls_lock);
}
/**
* wlan_hdd_tdls_notify_connect() - Update tdls state for every
* connect event.
* @adapter: hdd adapter
* @csr_roam_info: csr information
*
* After every connect event in the system, check whether TDLS
* can be enabled in the system. If TDLS can be enabled, update the
* TDLS state as needed.
*
* Return: None
*/
void wlan_hdd_tdls_notify_connect(struct hdd_adapter *adapter,
tCsrRoamInfo *csr_roam_info)
{
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
hdd_debug("Check and update TDLS state");
if (!hdd_ctx)
return;
if (hdd_ctx->tdls_umac_comp_active)
return;
/* Association event */
if (adapter->device_mode == QDF_STA_MODE ||
adapter->device_mode == QDF_P2P_CLIENT_MODE) {
wlan_hdd_update_tdls_info(adapter,
csr_roam_info->tdls_prohibited,
csr_roam_info->tdls_chan_swit_prohibited);
}
}
/**
* wlan_hdd_tdls_notify_disconnect() - Update tdls state for every
* disconnect event.
* @adapter: hdd adapter
* @lfr_roam: roaming case
*
* After every disconnect event in the system, check whether TDLS
* can be disabled/enabled in the system and update the
* TDLS state as needed.
*
* Return: None
*/
void wlan_hdd_tdls_notify_disconnect(struct hdd_adapter *adapter, bool lfr_roam)
{
struct hdd_adapter *temp_adapter;
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
hdd_debug("Check and update TDLS state");
if (!hdd_ctx)
return;
if (hdd_ctx->tdls_umac_comp_active)
return;
/* Disassociation event */
if (adapter->device_mode == QDF_STA_MODE ||
adapter->device_mode == QDF_P2P_CLIENT_MODE) {
wlan_hdd_update_tdls_info(adapter, true, true);
}
/* Check TDLS could be enabled in the system
* after this disassoc event.
*/
if (!lfr_roam) {
temp_adapter = wlan_hdd_tdls_get_adapter(
hdd_ctx);
if (NULL != temp_adapter)
wlan_hdd_update_tdls_info(temp_adapter,
false,
false);
}
}
/**
* wlan_hdd_tdls_set_sta_id() - set station ID on a tdls peer
* @pAdapter: HDD adapter
@@ -2237,37 +1818,6 @@ ret_status:
return status;
}
/**
* wlan_hdd_tdls_peer_reset_discovery_processed() - reset discovery status
* @pHddTdlsCtx: TDLS context
*
* This function resets discovery processing bit for all TDLS peers
*
* Caller has to take the lock before calling this function
*
* Return: 0
*/
static int32_t wlan_hdd_tdls_peer_reset_discovery_processed(tdlsCtx_t *
pHddTdlsCtx)
{
int i;
struct list_head *head;
hddTdlsPeer_t *tmp;
struct list_head *pos, *q;
pHddTdlsCtx->discovery_peer_cnt = 0;
for (i = 0; i < TDLS_PEER_LIST_SIZE; i++) {
head = &pHddTdlsCtx->peer_list[i];
list_for_each_safe(pos, q, head) {
tmp = list_entry(pos, hddTdlsPeer_t, node);
tmp->discovery_processed = 0;
}
}
return 0;
}
/**
* wlan_hdd_tdls_connected_peers() - Find the number of connected TDLS peers
* @pAdapter: HDD adapter
@@ -2372,85 +1922,6 @@ int wlan_hdd_tdls_get_all_peers(struct hdd_adapter *pAdapter,
return init_len - buflen;
}
/**
* wlan_hdd_tdls_connection_callback() - callback after tdls connection
* @pAdapter: HDD adapter
*
* Return: Void
*/
void wlan_hdd_tdls_connection_callback(struct hdd_adapter *pAdapter)
{
tdlsCtx_t *pHddTdlsCtx;
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
uint32_t tx_period_t;
if (NULL == hdd_ctx) {
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
FL("hdd_ctx points to NULL"));
return;
}
mutex_lock(&hdd_ctx->tdls_lock);
pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
if (NULL == pHddTdlsCtx) {
mutex_unlock(&hdd_ctx->tdls_lock);
QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,
FL("pHddTdlsCtx points to NULL"));
return;
}
tx_period_t = pHddTdlsCtx->threshold_config.tx_period_t;
hdd_debug("update %d", pHddTdlsCtx->threshold_config.tx_period_t);
if (eTDLS_SUPPORT_ENABLED == hdd_ctx->tdls_mode ||
eTDLS_SUPPORT_EXTERNAL_CONTROL == hdd_ctx->tdls_mode) {
wlan_hdd_tdls_peer_reset_discovery_processed(pHddTdlsCtx);
pHddTdlsCtx->discovery_sent_cnt = 0;
wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter);
}
mutex_unlock(&hdd_ctx->tdls_lock);
}
/**
* wlan_hdd_tdls_disconnection_callback() - callback after tdls disconnection
* @pAdapter: HDD adapter
*
* Return: Void
*/
void wlan_hdd_tdls_disconnection_callback(struct hdd_adapter *pAdapter)
{
tdlsCtx_t *pHddTdlsCtx;
struct hdd_context *hdd_ctx;
ENTER();
hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
if (!hdd_ctx)
return;
mutex_lock(&hdd_ctx->tdls_lock);
pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
if (NULL == pHddTdlsCtx) {
mutex_unlock(&hdd_ctx->tdls_lock);
hdd_debug("pHddTdlsCtx is NULL");
return;
}
pHddTdlsCtx->discovery_sent_cnt = 0;
wlan_hdd_tdls_check_power_save_prohibited(pHddTdlsCtx->pAdapter);
wlan_hdd_tdls_timers_stop(pHddTdlsCtx);
pHddTdlsCtx->curr_candidate = NULL;
mutex_unlock(&hdd_ctx->tdls_lock);
}
/**
* wlan_hdd_tdls_mgmt_completion_callback() - callback for TDLS management
* TX completion
@@ -2610,287 +2081,6 @@ hddTdlsPeer_t *wlan_hdd_tdls_is_progress(struct hdd_context *hdd_ctx,
return NULL;
}
/**
* wlan_hdd_tdls_copy_scan_context() - Copy TDLS scan context
* @hdd_ctx: HDD context
* @wiphy: wiphy pointer
* @dev: net device
* request: source scan context
*
* Copy the source scan context into the HDD context's TDLS scan context
*
* Return: 0 for success; negative errno otherwise
*/
int wlan_hdd_tdls_copy_scan_context(struct hdd_context *hdd_ctx,
struct wiphy *wiphy,
struct cfg80211_scan_request *request)
{
tdls_scan_context_t *scan_ctx;
ENTER();
if (0 != (wlan_hdd_validate_context(hdd_ctx)))
return -EINVAL;
scan_ctx = &hdd_ctx->tdls_scan_ctxt;
scan_ctx->wiphy = wiphy;
scan_ctx->scan_request = request;
EXIT();
return 0;
}
/**
* wlan_hdd_tdls_scan_init_work() - schedule tdls scan work
* @hdd_ctx: HDD context
* @wiphy: wiphy pointer
* @dev: net device
* @request: scan request
* @delay: delay value to pass to the work scheduling
* @source: scan request source(NL/Vendor scan)
*
* Return: Void
*/
static void wlan_hdd_tdls_scan_init_work(struct hdd_context *hdd_ctx,
struct wiphy *wiphy,
struct cfg80211_scan_request *request,
unsigned long delay, uint8_t source)
{
if (TDLS_CTX_MAGIC != hdd_ctx->tdls_scan_ctxt.magic) {
wlan_hdd_tdls_copy_scan_context(hdd_ctx, wiphy, request);
hdd_ctx->tdls_scan_ctxt.attempt = 0;
hdd_ctx->tdls_scan_ctxt.magic = TDLS_CTX_MAGIC;
hdd_ctx->tdls_scan_ctxt.source = source;
}
schedule_delayed_work(&hdd_ctx->tdls_scan_ctxt.tdls_scan_work, delay);
}
/**
* wlan_hdd_tdls_scan_callback() - callback for TDLS scan operation
* @pAdapter: HDD adapter
* @wiphy: wiphy
* @dev: net device
* @request: scan request
*
* Return: negative = caller should stop and return error code immediately
* 0 = caller should stop and return success immediately
* 1 = caller can continue to scan
*/
int wlan_hdd_tdls_scan_callback(struct hdd_adapter *pAdapter,
struct wiphy *wiphy,
struct cfg80211_scan_request *request,
uint8_t source)
{
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
u16 connectedTdlsPeers;
hddTdlsPeer_t *curr_peer;
unsigned long delay;
int ret;
ENTER();
ret = wlan_hdd_validate_context(hdd_ctx);
if (ret)
return ret;
if (hdd_ctx->tdls_umac_comp_active)
return 1;
/* if tdls is not enabled, then continue scan */
if (eTDLS_SUPPORT_NOT_ENABLED == hdd_ctx->tdls_mode)
return 1;
mutex_lock(&hdd_ctx->tdls_lock);
curr_peer = wlan_hdd_tdls_is_progress(hdd_ctx, NULL, 0);
if (NULL != curr_peer) {
if (hdd_ctx->tdls_scan_ctxt.reject++ >= TDLS_MAX_SCAN_REJECT) {
hdd_ctx->tdls_scan_ctxt.reject = 0;
hdd_debug(MAC_ADDRESS_STR
". scan rejected %d. force it to idle",
MAC_ADDR_ARRAY(curr_peer->peerMac),
hdd_ctx->tdls_scan_ctxt.reject);
wlan_hdd_tdls_set_peer_link_status(curr_peer,
eTDLS_LINK_IDLE,
eTDLS_LINK_UNSPECIFIED);
mutex_unlock(&hdd_ctx->tdls_lock);
return 1;
}
mutex_unlock(&hdd_ctx->tdls_lock);
hdd_warn("tdls in progress. scan rejected %d",
hdd_ctx->tdls_scan_ctxt.reject);
return -EBUSY;
}
mutex_unlock(&hdd_ctx->tdls_lock);
/* tdls teardown is ongoing */
if (eTDLS_SUPPORT_DISABLED == hdd_ctx->tdls_mode) {
connectedTdlsPeers = wlan_hdd_tdls_connected_peers(pAdapter);
if (connectedTdlsPeers
&& (hdd_ctx->tdls_scan_ctxt.attempt <
TDLS_MAX_SCAN_SCHEDULE)) {
delay =
(unsigned long)(TDLS_DELAY_SCAN_PER_CONNECTION *
connectedTdlsPeers);
hdd_debug("tdls disabled, but still connected_peers %d attempt %d. schedule scan %lu msec",
connectedTdlsPeers,
hdd_ctx->tdls_scan_ctxt.attempt, delay);
wlan_hdd_tdls_scan_init_work(hdd_ctx, wiphy,
request,
msecs_to_jiffies(delay),
source);
/* scan should not continue */
return 0;
}
/* no connected peer or max retry reached, scan continue */
hdd_debug("tdls disabled. connected_peers %d attempt %d. scan allowed",
connectedTdlsPeers,
hdd_ctx->tdls_scan_ctxt.attempt);
return 1;
}
/* while tdls is up, first time scan */
else if (eTDLS_SUPPORT_ENABLED == hdd_ctx->tdls_mode ||
eTDLS_SUPPORT_EXTERNAL_CONTROL == hdd_ctx->tdls_mode ||
eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == hdd_ctx->tdls_mode) {
/* disable implicit trigger logic & tdls operatoin */
wlan_hdd_tdls_set_mode(hdd_ctx, eTDLS_SUPPORT_DISABLED, false,
HDD_SET_TDLS_MODE_SOURCE_SCAN);
/* indicate the teardown all connected to peer */
connectedTdlsPeers = wlan_hdd_tdls_connected_peers(pAdapter);
if (connectedTdlsPeers) {
uint8_t staIdx;
uint8_t num = 0;
uint8_t i;
bool allPeersBufStas = 1;
hddTdlsPeer_t *curr_peer;
hddTdlsPeer_t *connectedPeerList[HDD_MAX_NUM_TDLS_STA];
/* If TDLSScan is enabled then allow scan and
* maintain tdls link regardless if peer is buffer
* sta capable or not and if device is sleep sta
* capable or not. If peer is not buffer sta
* capable, then Tx would stop when device
* initiates scan and there will be loss of Rx
* packets since peer would not know when device
* moves away from the tdls channel.
*/
if (1 == hdd_ctx->config->enable_tdls_scan) {
hdd_debug("TDLSScan enabled, keep tdls link and allow scan, connectedTdlsPeers: %d",
connectedTdlsPeers);
return 1;
}
mutex_lock(&hdd_ctx->tdls_lock);
for (staIdx = 0; staIdx < hdd_ctx->max_num_tdls_sta;
staIdx++) {
if (hdd_ctx->tdlsConnInfo[staIdx].staId) {
curr_peer =
wlan_hdd_tdls_find_all_peer(hdd_ctx,
hdd_ctx->
tdlsConnInfo
[staIdx].
peerMac.
bytes);
if (curr_peer) {
connectedPeerList[num++] =
curr_peer;
if (!(curr_peer->isBufSta))
allPeersBufStas = 0;
}
}
}
if ((TDLS_MAX_CONNECTED_PEERS_TO_ALLOW_SCAN ==
connectedTdlsPeers) &&
(hdd_ctx->config->fEnableTDLSSleepSta) &&
(allPeersBufStas)) {
mutex_unlock(&hdd_ctx->tdls_lock);
/* All connected peers bufStas and we can be
* sleepSta so allow scan
*/
hdd_debug("All peers (num %d) bufSTAs, we can be sleep sta, so allow scan, tdls mode changed to %d",
connectedTdlsPeers,
hdd_ctx->tdls_mode);
return 1;
}
for (i = 0; i < num; i++) {
hdd_notice("indicate TDLS teadown (staId %d)",
connectedPeerList[i]->staId);
wlan_hdd_tdls_indicate_teardown
(connectedPeerList[i]->pHddTdlsCtx->
pAdapter, connectedPeerList[i],
eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
hdd_send_wlan_tdls_teardown_event
(eTDLS_TEARDOWN_SCAN,
connectedPeerList[i]->peerMac);
}
mutex_unlock(&hdd_ctx->tdls_lock);
/* schedule scan */
delay =
(unsigned long)(TDLS_DELAY_SCAN_PER_CONNECTION *
connectedTdlsPeers);
hdd_debug("tdls enabled (mode %d), connected_peers %d. schedule scan %lu msec",
hdd_ctx->tdls_mode,
wlan_hdd_tdls_connected_peers(pAdapter), delay);
wlan_hdd_tdls_scan_init_work(hdd_ctx, wiphy,
request,
msecs_to_jiffies(delay),
source);
/* scan should not continue */
return 0;
}
/* no connected peer, scan continue */
hdd_debug("tdls_mode %d, and no tdls connection. scan allowed",
hdd_ctx->tdls_mode);
}
EXIT();
return 1;
}
/**
* wlan_hdd_tdls_scan_done_callback() - callback for tdls scan done event
* @pAdapter: HDD adapter
*
* Return: Void
*/
void wlan_hdd_tdls_scan_done_callback(struct hdd_adapter *pAdapter)
{
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
ENTER();
if (0 != (wlan_hdd_validate_context(hdd_ctx)))
return;
if (hdd_ctx->tdls_umac_comp_active)
return;
if (eTDLS_SUPPORT_NOT_ENABLED == hdd_ctx->tdls_mode) {
hdd_info("TDLS mode is disabled OR not enabled");
return;
}
/* free allocated memory at scan time */
wlan_hdd_tdls_free_scan_request(&hdd_ctx->tdls_scan_ctxt);
/* if tdls was enabled before scan, re-enable tdls mode */
if (eTDLS_SUPPORT_ENABLED == hdd_ctx->tdls_mode_last ||
eTDLS_SUPPORT_EXTERNAL_CONTROL == hdd_ctx->tdls_mode_last ||
eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == hdd_ctx->tdls_mode_last) {
hdd_debug("revert tdls mode: %d", hdd_ctx->tdls_mode_last);
wlan_hdd_tdls_set_mode(hdd_ctx, hdd_ctx->tdls_mode_last, false,
HDD_SET_TDLS_MODE_SOURCE_SCAN);
}
EXIT();
}
/**
* wlan_hdd_tdls_timer_restart() - restart TDLS timer
* @pAdapter: HDD adapter
@@ -5643,38 +4833,6 @@ tdls_ant_sw_done:
return 0;
}
/**
* wlan_hdd_change_tdls_mode - Change TDLS mode
* @data: void pointer
*
* Return: None
*/
void wlan_hdd_change_tdls_mode(void *data)
{
struct hdd_context *hdd_ctx = (struct hdd_context *)data;
wlan_hdd_tdls_set_mode(hdd_ctx, hdd_ctx->tdls_mode_last, false,
HDD_SET_TDLS_MODE_SOURCE_P2P);
}
void hdd_tdls_notify_p2p_roc(struct hdd_context *hdd_ctx,
enum tdls_concerned_external_events event)
{
enum tdls_support_mode tdls_mode;
qdf_mc_timer_stop(&hdd_ctx->tdls_source_timer);
if (event == P2P_ROC_START) {
tdls_mode = eTDLS_SUPPORT_DISABLED;
wlan_hdd_tdls_set_mode(hdd_ctx, tdls_mode, false,
HDD_SET_TDLS_MODE_SOURCE_P2P);
wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_ctx);
}
qdf_mc_timer_start(&hdd_ctx->tdls_source_timer,
hdd_ctx->config->tdls_enable_defer_time);
}
bool cds_check_is_tdls_allowed(enum tQDF_ADAPTER_MODE device_mode)
{
bool state = false;