diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 3c0d5a507bbe..75df09768ef2 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -128,7 +128,6 @@ #define WMM_INIT_DONE (3) #define SOFTAP_BSS_STARTED (4) #define DEVICE_IFACE_OPENED (5) -#define TDLS_INIT_DONE (6) #define ACS_PENDING (7) #define SOFTAP_INIT_DONE (8) @@ -726,10 +725,6 @@ struct hdd_station_ctx { /* Handle to the Wireless Extension State */ hdd_wext_state_t WextState; -#ifdef FEATURE_WLAN_TDLS - tdlsCtx_t *pHddTdlsCtx; -#endif - /* Connection information*/ struct hdd_connection_info conn_info; @@ -1157,13 +1152,6 @@ struct hdd_adapter { struct completion rem_on_chan_ready_event; struct completion sta_authorized_event; -#ifdef FEATURE_WLAN_TDLS - struct completion tdls_add_station_comp; - struct completion tdls_del_station_comp; - struct completion tdls_mgmt_comp; - struct completion tdls_link_establish_req_comp; - QDF_STATUS tdlsAddStaStatus; -#endif struct completion ibss_peer_info_comp; @@ -1338,14 +1326,6 @@ struct hdd_adapter { #define WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter) (&(pAdapter)->sessionCtx.ap.HostapdState) #define WLAN_HDD_GET_CFG_STATE_PTR(pAdapter) (&(pAdapter)->cfg80211State) #define WLAN_HDD_GET_SAP_CTX_PTR(pAdapter) (pAdapter->sessionCtx.ap.sapContext) -#ifdef FEATURE_WLAN_TDLS -#define WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter) \ - (((QDF_STA_MODE != pAdapter->device_mode) && \ - (QDF_P2P_CLIENT_MODE != pAdapter->device_mode)) ? 0 : 1) -#define WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter) \ - ((WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter)) ? \ - (tdlsCtx_t *)(pAdapter)->sessionCtx.station.pHddTdlsCtx : NULL) -#endif #ifdef WLAN_FEATURE_NAN_DATAPATH #ifndef WLAN_FEATURE_NAN_CONVERGENCE @@ -1630,32 +1610,6 @@ struct hdd_context { qdf_wake_lock_t rx_wake_lock; qdf_wake_lock_t sap_wake_lock; -#ifdef FEATURE_WLAN_TDLS - enum tdls_support_mode tdls_mode; - enum tdls_support_mode tdls_mode_last; - tdlsConnInfo_t tdlsConnInfo[HDD_MAX_NUM_TDLS_STA]; - /* maximum TDLS station number allowed upon runtime condition */ - uint16_t max_num_tdls_sta; - /* TDLS peer connected count */ - uint16_t connected_peer_count; - /* Lock to avoid race condition during TDLS operations */ - qdf_spinlock_t tdls_ct_spinlock; - /* linear mac address table for counting the packets */ - struct tdls_ct_mac_table ct_peer_mac_table[TDLS_CT_MAC_MAX_TABLE_SIZE]; - /* number of valid mac entry in @ct_peer_mac_table */ - uint8_t valid_mac_entries; - struct mutex tdls_lock; - uint8_t tdls_off_channel; - uint16_t tdls_channel_offset; - int32_t tdls_fw_off_chan_mode; - uint8_t tdls_external_peer_count; - bool tdls_nss_switch_in_progress; - bool tdls_nss_teardown_complete; - enum tdls_nss_transition_type tdls_nss_transition_mode; - int32_t tdls_teardown_peers_cnt; - struct tdls_set_state_info set_state_info; -#endif - void *hdd_ipa; /* Use below lock to protect access to isSchedScanUpdatePending diff --git a/core/hdd/inc/wlan_hdd_tdls.h b/core/hdd/inc/wlan_hdd_tdls.h index 6decb458542d..f7d70c91b42f 100644 --- a/core/hdd/inc/wlan_hdd_tdls.h +++ b/core/hdd/inc/wlan_hdd_tdls.h @@ -34,25 +34,6 @@ struct hdd_context; -/* - * enum tdls_support_mode - TDLS support modes - * @eTDLS_SUPPORT_NOT_ENABLED: TDLS support not enabled - * @eTDLS_SUPPORT_DISABLED: suppress implicit trigger and not respond - * to the peer - * @eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY: suppress implicit trigger, - * but respond to the peer - * @eTDLS_SUPPORT_ENABLED: implicit trigger - * @eTDLS_SUPPORT_EXTERNAL_CONTROL: implicit trigger but only to a - * peer mac configured by user space. - */ -enum tdls_support_mode { - eTDLS_SUPPORT_NOT_ENABLED = 0, - eTDLS_SUPPORT_DISABLED, - eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY, - eTDLS_SUPPORT_ENABLED, - eTDLS_SUPPORT_EXTERNAL_CONTROL, -}; - /** * enum tdls_concerned_external_events - External events that affect TDLS * @P2P_ROC_START: P2P remain on channel starts @@ -65,60 +46,10 @@ enum tdls_concerned_external_events { #ifdef FEATURE_WLAN_TDLS -/* - * Before UpdateTimer expires, we want to timeout discovery response - * should not be more than 2000. - */ -#define TDLS_DISCOVERY_TIMEOUT_BEFORE_UPDATE 1000 - -#define TDLS_CTX_MAGIC 0x54444c53 /* "TDLS" */ - -#define TDLS_MAX_SCAN_SCHEDULE 10 -#define TDLS_MAX_SCAN_REJECT 5 -#define TDLS_DELAY_SCAN_PER_CONNECTION 100 -#define TDLS_MAX_CONNECTED_PEERS_TO_ALLOW_SCAN 1 - -#define TDLS_IS_CONNECTED(peer) \ - ((eTDLS_LINK_CONNECTED == (peer)->link_status) || \ - (eTDLS_LINK_TEARING == (peer)->link_status)) - /* Bit mask flag for tdls_option to FW */ #define ENA_TDLS_OFFCHAN (1 << 0) /* TDLS Off Channel support */ #define ENA_TDLS_BUFFER_STA (1 << 1) /* TDLS Buffer STA support */ #define ENA_TDLS_SLEEP_STA (1 << 2) /* TDLS Sleep STA support */ -#define TDLS_SEC_OFFCHAN_OFFSET_0 0 -#define TDLS_SEC_OFFCHAN_OFFSET_40PLUS 40 -#define TDLS_SEC_OFFCHAN_OFFSET_40MINUS (-40) -#define TDLS_SEC_OFFCHAN_OFFSET_80 80 -#define TDLS_SEC_OFFCHAN_OFFSET_160 160 - -#define TDLS_PEER_LIST_SIZE 256 - -#define TDLS_CT_MAC_AGE_OUT_TIME (30*60*1000) /* Age out time is 30 mins */ - -#define EXTTDLS_EVENT_BUF_SIZE (4096) - -#define TDLS_CT_MAC_MAX_TABLE_SIZE 8 - -/* Define the interval for 5 minutes */ -#define TDLS_ENABLE_CDS_FLUSH_INTERVAL 300000000 - -/** - * enum tdls_disable_source - TDLS disable sources - * @HDD_SET_TDLS_MODE_SOURCE_USER: disable from user - * @HDD_SET_TDLS_MODE_SOURCE_SCAN: disable during scan - * @HDD_SET_TDLS_MODE_SOURCE_OFFCHANNEL: disable during offchannel - * @HDD_SET_TDLS_MODE_SOURCE_BTC: disable during bluetooth - * @HDD_SET_TDLS_MODE_SOURCE_P2P: disable during p2p - */ -enum tdls_disable_source { - HDD_SET_TDLS_MODE_SOURCE_USER = 0, - HDD_SET_TDLS_MODE_SOURCE_SCAN, - HDD_SET_TDLS_MODE_SOURCE_OFFCHANNEL, - HDD_SET_TDLS_MODE_SOURCE_BTC, - HDD_SET_TDLS_MODE_SOURCE_P2P, -}; - /** * struct tdls_config_params_t - tdls config params * @@ -144,310 +75,12 @@ typedef struct { int32_t rssi_delta; } tdls_config_params_t; -/** - * enum tdls_spatial_streams - TDLS spatial streams - * @TDLS_NSS_1x1_MODE: TDLS tx/rx spatial streams = 1 - * @TDLS_NSS_2x2_MODE: TDLS tx/rx spatial streams = 2 - */ -enum tdls_spatial_streams { - TDLS_NSS_1x1_MODE = 0, - TDLS_NSS_2x2_MODE = 0xff, -}; - -/** - * enum tdls_nss_transition_type - TDLS NSS transition states - * @TDLS_NSS_TRANSITION_UNKNOWN: default state - * @TDLS_NSS_TRANSITION_2x2_to_1x1: transition from 2x2 to 1x1 stream - * @TDLS_NSS_TRANSITION_1x1_to_2x2: transition from 1x1 to 2x2 stream - */ -enum tdls_nss_transition_type { - TDLS_NSS_TRANSITION_UNKNOWN = 0, - TDLS_NSS_TRANSITION_2x2_to_1x1, - TDLS_NSS_TRANSITION_1x1_to_2x2, -}; - -/** - * enum tdls_cap_type - tdls capability type - * - * @eTDLS_CAP_NOT_SUPPORTED: tdls not supported - * @eTDLS_CAP_UNKNOWN: unknown capability - * @eTDLS_CAP_SUPPORTED: tdls capability supported - */ -enum tdls_cap_type { - eTDLS_CAP_NOT_SUPPORTED = -1, - eTDLS_CAP_UNKNOWN = 0, - eTDLS_CAP_SUPPORTED = 1, -}; - -/** - * enum tdls_link_status - tdls link status - * - * @eTDLS_LINK_IDLE: tdls link idle - * @eTDLS_LINK_DISCOVERING: tdls link discovering - * @eTDLS_LINK_DISCOVERED: tdls link discovered - * @eTDLS_LINK_CONNECTING: tdls link connecting - * @eTDLS_LINK_CONNECTED: tdls link connected - * @eTDLS_LINK_TEARING: tdls link tearing - */ -enum tdls_link_status { - eTDLS_LINK_IDLE = 0, - eTDLS_LINK_DISCOVERING, - eTDLS_LINK_DISCOVERED, - eTDLS_LINK_CONNECTING, - eTDLS_LINK_CONNECTED, - eTDLS_LINK_TEARING, -}; - -/** - * enum tdls_teardown_reason - Reason for TDLS teardown - * @eTDLS_TEARDOWN_EXT_CTRL: Reason ext ctrl. - * @eTDLS_TEARDOWN_CONCURRENCY: Reason concurrency. - * @eTDLS_TEARDOWN_RSSI_THRESHOLD: Reason rssi threshold. - * @eTDLS_TEARDOWN_TXRX_THRESHOLD: Reason txrx threshold. - * @eTDLS_TEARDOWN_BTCOEX: Reason BTCOEX. - * @eTDLS_TEARDOWN_SCAN: Reason scan. - * @eTDLS_TEARDOWN_BSS_DISCONNECT: Reason bss disconnected. - * @eTDLS_TEARDOWN_ANTENNA_SWITCH: Disconnected due to antenna switch - * - * Reason to indicate in diag event of tdls teardown. - */ -enum tdls_teardown_reason { - eTDLS_TEARDOWN_EXT_CTRL, - eTDLS_TEARDOWN_CONCURRENCY, - eTDLS_TEARDOWN_RSSI_THRESHOLD, - eTDLS_TEARDOWN_TXRX_THRESHOLD, - eTDLS_TEARDOWN_BTCOEX, - eTDLS_TEARDOWN_SCAN, - eTDLS_TEARDOWN_BSS_DISCONNECT, - eTDLS_TEARDOWN_ANTENNA_SWITCH, -}; - -/** - * enum tdls_link_reason - tdls link reason - * - * @eTDLS_LINK_SUCCESS: Success - * @eTDLS_LINK_UNSPECIFIED: Unspecified reason - * @eTDLS_LINK_NOT_SUPPORTED: Remote side doesn't support TDLS - * @eTDLS_LINK_UNSUPPORTED_BAND: Remote side doesn't support this band - * @eTDLS_LINK_NOT_BENEFICIAL: Going to AP is better than direct - * @eTDLS_LINK_DROPPED_BY_REMOTE: Remote side doesn't want it anymore - */ -enum tdls_link_reason { - eTDLS_LINK_SUCCESS, - eTDLS_LINK_UNSPECIFIED = -1, - eTDLS_LINK_NOT_SUPPORTED = -2, - eTDLS_LINK_UNSUPPORTED_BAND = -3, - eTDLS_LINK_NOT_BENEFICIAL = -4, - eTDLS_LINK_DROPPED_BY_REMOTE = -5 -}; - -/** - * struct tdls_req_params_t - tdls request parameters - * - * @channel: channel hint, in channel number (NOT frequency) - * @global_operating_class: operating class to use - * @max_latency_ms: max latency that can be tolerated by apps - * @min_bandwidth_kbps: bandwidth required by apps, in kilo bits per second - */ -typedef struct { - int channel; - int global_operating_class; - int max_latency_ms; - int min_bandwidth_kbps; -} tdls_req_params_t; - -/** - * enum tdls_state - tdls state - * - * @QCA_WIFI_HAL_TDLS_DISABLED: TDLS is not enabled, or is disabled now - * @QCA_WIFI_HAL_TDLS_ENABLED: TDLS is enabled, but not yet tried - * @QCA_WIFI_HAL_TDLS_ESTABLISHED: Direct link is established - * @QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL: Direct link established using MCC - * @QCA_WIFI_HAL_TDLS_DROPPED: Direct link was established, but is now dropped - * @QCA_WIFI_HAL_TDLS_FAILED: Direct link failed - */ -enum tdls_state { - QCA_WIFI_HAL_TDLS_DISABLED = 1, - QCA_WIFI_HAL_TDLS_ENABLED, - QCA_WIFI_HAL_TDLS_ESTABLISHED, - QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL, - QCA_WIFI_HAL_TDLS_DROPPED, - QCA_WIFI_HAL_TDLS_FAILED -}; - typedef int (*cfg80211_exttdls_callback)(const uint8_t *mac, uint32_t opclass, uint32_t channel, uint32_t state, int32_t reason, void *ctx); -/** - * struct tdls_tx_tput_config_t - tdls tx throughput config - * - * @period: period - * @bytes: bytes - */ -typedef struct { - uint16_t period; - uint16_t bytes; -} tdls_tx_tput_config_t; - -/** - * struct tdls_discovery_config_t - tdls discovery config - * - * @period: period - * @tries: number of tries - */ -typedef struct { - uint16_t period; - uint16_t tries; -} tdls_discovery_config_t; - -/** - * struct tdls_rx_idle_config_t - tdls rx idle config - * - * @timeout: timeout - */ -typedef struct { - uint16_t timeout; -} tdls_rx_idle_config_t; - -/** - * struct tdls_rssi_config_t - tdls rssi config - * - * @rssi_thres: rssi_thres - */ -typedef struct { - uint16_t rssi_thres; -} tdls_rssi_config_t; - -struct _hddTdlsPeer_t; - -/** - * struct tdls_ct_mac_table - connection tracker peer mac address table - * @mac_address: peer mac address - * @tx_packet_cnt: number of tx pkts - * @rx_packet_cnt: number of rx pkts - * @peer_timestamp_ms: time stamp of latest peer traffic - */ -struct tdls_ct_mac_table { - struct qdf_mac_addr mac_address; - uint32_t tx_packet_cnt; - uint32_t rx_packet_cnt; - uint32_t peer_timestamp_ms; -}; - -/** - * struct tdls_set_state_db - set state command data base - * @set_state_cnt: tdls set state count - * @vdev_id: vdev id of last set state command - */ -struct tdls_set_state_info { - uint8_t set_state_cnt; - uint8_t vdev_id; -}; - -/** - * struct tdlsCtx_t - tdls context - * - * @peer_list: peer list - * @pAdapter: pointer to adapter - * @peerDiscoverTimer: peer discovery timer - * @threshold_config: threshold config - * @discovery_peer_cnt: discovery peer count - * @discovery_sent_cnt: discovery sent count - * @ap_rssi: ap rssi - * @curr_candidate: current candidate - * @magic: magic - * @last_flush_ts: last timestamp when flush logs was displayed. - * - */ -typedef struct { - struct list_head peer_list[TDLS_PEER_LIST_SIZE]; - struct hdd_adapter *pAdapter; - tdls_config_params_t threshold_config; - int32_t discovery_peer_cnt; - uint32_t discovery_sent_cnt; - int8_t ap_rssi; - struct _hddTdlsPeer_t *curr_candidate; - uint32_t magic; - uint64_t last_flush_ts; -} tdlsCtx_t; - -/** - * struct hddTdlsPeer_t - tdls peer data - * - * @node: node - * @pHddTdlsCtx: pointer to tdls context - * @peerMac: peer mac address - * @staId: station identifier - * @rssi: rssi - * @tdls_support: tdls support - * @link_status: tdls link status - * @signature: signature - * @is_responder: is responder - * @discovery_processed: discovery processed flag - * @discovery_attempt: discovery attempt - * @uapsdQueues: uapsd queues - * @maxSp: max sp - * @isBufSta: is buffer sta - * @isOffChannelSupported: is offchannel supported flag - * @supported_channels_len: supported channels length - * @supported_channels: supported channels - * @supported_oper_classes_len: supported operation classes length - * @supported_oper_classes: supported operation classes - * @isForcedPeer: is forced peer - * @op_class_for_pref_off_chan: op class for preferred off channel - * @pref_off_chan_num: preferred off channel number - * @op_class_for_pref_off_chan_is_set: op class for preferred off channel set - * @spatial_streams: Number of TX/RX spatial streams for TDLS - * @reason: reason - * @state_change_notification: state change notification - * @qos: QOS capability of TDLS link - */ -typedef struct _hddTdlsPeer_t { - struct list_head node; - tdlsCtx_t *pHddTdlsCtx; - tSirMacAddr peerMac; - uint16_t staId; - int8_t rssi; - enum tdls_cap_type tdls_support; - enum tdls_link_status link_status; - uint8_t signature; - uint8_t is_responder; - uint8_t discovery_processed; - uint16_t discovery_attempt; - uint8_t uapsdQueues; - uint8_t maxSp; - uint8_t isBufSta; - uint8_t isOffChannelSupported; - uint8_t supported_channels_len; - uint8_t supported_channels[SIR_MAC_MAX_SUPP_CHANNELS]; - uint8_t supported_oper_classes_len; - uint8_t supported_oper_classes[REG_MAX_SUPP_OPER_CLASSES]; - bool isForcedPeer; - uint8_t op_class_for_pref_off_chan; - uint8_t pref_off_chan_num; - uint8_t op_class_for_pref_off_chan_is_set; - uint8_t spatial_streams; - enum tdls_link_reason reason; - cfg80211_exttdls_callback state_change_notification; - uint8_t qos; -} hddTdlsPeer_t; - -/** - * struct tdlsConnInfo_t - tdls connection info - * - * @sessionId: Session ID - * @staId: TDLS peer station id - * @peerMac: peer mac address - */ -typedef struct { - uint8_t sessionId; - uint8_t staId; - struct qdf_mac_addr peerMac; -} tdlsConnInfo_t; - /** * struct tdlsInfo_t - tdls info * @@ -486,50 +119,12 @@ typedef struct { uint32_t tdls_peer_kickout_threshold; } tdlsInfo_t; -int wlan_hdd_tdls_init(struct hdd_adapter *pAdapter); - -void wlan_hdd_tdls_exit(struct hdd_adapter *pAdapter); - -void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, uint8_t *mac); - -hddTdlsPeer_t *wlan_hdd_tdls_find_peer(struct hdd_adapter *pAdapter, - const uint8_t *mac); - -hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(struct hdd_context *hdd_ctx, - const uint8_t *mac); - -hddTdlsPeer_t *wlan_hdd_tdls_get_peer(struct hdd_adapter *pAdapter, - const uint8_t *mac); - -void wlan_hdd_tdls_set_peer_link_status(hddTdlsPeer_t *curr_peer, - enum tdls_link_status status, - enum tdls_link_reason reason); - int wlan_hdd_tdls_set_params(struct net_device *dev, tdls_config_params_t *config); -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_indicate_teardown(struct hdd_adapter *pAdapter, - hddTdlsPeer_t *curr_peer, - uint16_t reason); - -int wlan_hdd_tdls_set_extctrl_param(struct hdd_adapter *pAdapter, - const uint8_t *mac, - uint32_t chan, - uint32_t max_latency, - uint32_t op_class, uint32_t min_bandwidth); -int wlan_hdd_tdls_set_force_peer(struct hdd_adapter *pAdapter, - const uint8_t *mac, - bool forcePeer); - -int wlan_hdd_tdls_update_peer_mac(struct hdd_adapter *adapter, - const uint8_t *mac, - uint32_t peer_state); - int wlan_hdd_tdls_extctrl_deconfig_peer(struct hdd_adapter *pAdapter, const uint8_t *peer); int wlan_hdd_tdls_extctrl_config_peer(struct hdd_adapter *pAdapter, @@ -539,14 +134,6 @@ int wlan_hdd_tdls_extctrl_config_peer(struct hdd_adapter *pAdapter, uint32_t max_latency, uint32_t op_class, uint32_t min_bandwidth); -int wlan_hdd_tdls_get_status(struct hdd_adapter *pAdapter, - const uint8_t *mac, uint32_t *opclass, - uint32_t *channel, uint32_t *state, - int32_t *reason); -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); int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, struct wireless_dev *wdev, @@ -610,15 +197,10 @@ int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, #endif #endif -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); -int hdd_set_tdls_secoffchanneloffset(struct hdd_context *hdd_ctx, - int offchanoffset); +int hdd_set_tdls_secoffchanneloffset(struct hdd_context *hdd_ctx, int offchanoffset); int hdd_set_tdls_offchannelmode(struct hdd_adapter *adapter, int offchanmode); int hdd_set_tdls_scan_type(struct hdd_context *hdd_ctx, int val); -void hdd_tdls_context_init(struct hdd_context *hdd_ctx, bool ssr); -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); @@ -645,12 +227,6 @@ QDF_STATUS hdd_tdls_deregister_tdl_peer(void *userdata, uint32_t vdev_id, uint8_t sta_id); #else -static inline void hdd_update_tdls_ct_and_teardown_links(struct hdd_context *hdd_ctx) -{ -} -static inline void wlan_hdd_tdls_exit(struct hdd_adapter *adapter) -{ -} static inline int wlan_hdd_tdls_antenna_switch(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter, @@ -658,15 +234,6 @@ static inline int wlan_hdd_tdls_antenna_switch(struct hdd_context *hdd_ctx, { return 0; } -static inline void wlan_hdd_update_tdls_info(struct hdd_adapter *adapter, - bool tdls_prohibited, - bool tdls_chan_swit_prohibited) -{ -} -static inline void wlan_hdd_tdls_notify_disconnect(struct hdd_adapter *adapter, - bool lfr_roam) -{ -} static inline int wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy, struct wireless_dev *wdev, @@ -676,9 +243,6 @@ static inline int wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy, return 0; } -static inline void wlan_hdd_change_tdls_mode(void *hdd_ctx) -{ -} static inline void hdd_tdls_notify_p2p_roc(struct hdd_context *hdd_ctx, enum tdls_concerned_external_events event) @@ -700,25 +264,4 @@ static QDF_STATUS hdd_tdls_deregister_tdl_peer(void *userdata, { } #endif /* End of FEATURE_WLAN_TDLS */ - -#ifdef FEATURE_WLAN_DIAG_SUPPORT -void hdd_send_wlan_tdls_teardown_event(uint32_t reason, - uint8_t *peer_mac); -void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac, - uint8_t is_off_chan_supported, - uint8_t is_off_chan_configured, - uint8_t is_off_chan_established); -void hdd_wlan_block_scan_by_tdls_event(void); -#else -static inline -void hdd_send_wlan_tdls_teardown_event(uint32_t reason, - uint8_t *peer_mac) {} -static inline -void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac, - uint8_t is_off_chan_supported, - uint8_t is_off_chan_configured, - uint8_t is_off_chan_established) {} -static inline void hdd_wlan_block_scan_by_tdls_event(void) {} -#endif /* FEATURE_WLAN_DIAG_SUPPORT */ -bool cds_check_is_tdls_allowed(enum tQDF_ADAPTER_MODE device_mode); #endif /* __HDD_TDLS_H */ diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 113f46602d15..6033ff086175 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -707,6 +707,7 @@ static int __wlan_hdd_cfg80211_get_tdls_capabilities(struct wiphy *wiphy, struct hdd_context *hdd_ctx = wiphy_priv(wiphy); struct sk_buff *skb; uint32_t set = 0; + uint32_t max_num_tdls_sta = 0; ENTER_DEV(wdev->netdev); @@ -739,11 +740,17 @@ static int __wlan_hdd_cfg80211_get_tdls_capabilities(struct wiphy *wiphy, WIFI_TDLS_EXTERNAL_CONTROL_SUPPORT : 0); set = set | (hdd_ctx->config->fEnableTDLSOffChannel ? WIIF_TDLS_OFFCHANNEL_SUPPORT : 0); + if (hdd_ctx->config->fEnableTDLSSleepSta || + hdd_ctx->config->fEnableTDLSBufferSta || + hdd_ctx->config->fEnableTDLSOffChannel) + max_num_tdls_sta = HDD_MAX_NUM_TDLS_STA_P_UAPSD_OFFCHAN; + else + max_num_tdls_sta = HDD_MAX_NUM_TDLS_STA; + hdd_debug("TDLS Feature supported value %x", set); if (nla_put_u32(skb, PARAM_MAX_TDLS_SESSION, - hdd_ctx->max_num_tdls_sta) || - nla_put_u32(skb, PARAM_TDLS_FEATURE_SUPPORT, - set)) { + max_num_tdls_sta) || + nla_put_u32(skb, PARAM_TDLS_FEATURE_SUPPORT, set)) { hdd_err("nla put fail"); goto fail; } @@ -13458,7 +13465,6 @@ static int __wlan_hdd_cfg80211_change_iface(struct wiphy *wiphy, case NL80211_IFTYPE_P2P_CLIENT: case NL80211_IFTYPE_ADHOC: if (type == NL80211_IFTYPE_ADHOC) { - wlan_hdd_tdls_exit(pAdapter); hdd_deregister_tx_flow_control(pAdapter); hdd_debug("Setting interface Type to ADHOC"); } diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 41db2ee8c360..2304c4c028aa 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -6513,17 +6513,6 @@ static int drv_cmd_set_antenna_mode(struct hdd_adapter *adapter, } ret = 0; exit: -#ifdef FEATURE_WLAN_TDLS - /* Reset tdls NSS flags */ - if (hdd_ctx->tdls_nss_switch_in_progress && - hdd_ctx->tdls_nss_teardown_complete) { - hdd_ctx->tdls_nss_switch_in_progress = false; - hdd_ctx->tdls_nss_teardown_complete = false; - } - hdd_debug("tdls_nss_switch_in_progress: %d tdls_nss_teardown_complete: %d", - hdd_ctx->tdls_nss_switch_in_progress, - hdd_ctx->tdls_nss_teardown_complete); -#endif hdd_debug("Set antenna status: %d current mode: %d", ret, hdd_ctx->current_antenna_mode); return ret; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 01ae31481a68..67f9ebabc4a2 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3126,12 +3126,6 @@ static struct hdd_adapter *hdd_alloc_station_adapter(struct hdd_context *hdd_ctx init_completion(&adapter->sta_authorized_event); init_completion(&adapter->offchannel_tx_event); init_completion(&adapter->tx_action_cnf_event); -#ifdef FEATURE_WLAN_TDLS - init_completion(&adapter->tdls_add_station_comp); - init_completion(&adapter->tdls_del_station_comp); - init_completion(&adapter->tdls_mgmt_comp); - init_completion(&adapter->tdls_link_establish_req_comp); -#endif init_completion(&adapter->ibss_peer_info_comp); init_completion(&adapter->change_country_code); @@ -3252,36 +3246,6 @@ QDF_STATUS hdd_sme_close_session_callback(void *pContext) return QDF_STATUS_SUCCESS; } -/** - * hdd_check_and_init_tdls() - check and init TDLS operation for desired mode - * @adapter: pointer to device adapter - * - * This routine will check the mode of adapter and if it is required then it - * will initialize the TDLS operations - * - * Return: QDF_STATUS - */ -#ifdef FEATURE_WLAN_TDLS -static QDF_STATUS hdd_check_and_init_tdls(struct hdd_adapter *adapter) -{ - if (adapter->device_mode == QDF_IBSS_MODE) - return QDF_STATUS_SUCCESS; - - if (wlan_hdd_tdls_init(adapter)) { - hdd_err("wlan_hdd_tdls_init failed"); - return QDF_STATUS_E_FAILURE; - } - set_bit(TDLS_INIT_DONE, &adapter->event_flags); - - return QDF_STATUS_SUCCESS; -} -#else -static QDF_STATUS hdd_check_and_init_tdls(struct hdd_adapter *adapter) -{ - return QDF_STATUS_SUCCESS; -} -#endif - int hdd_vdev_ready(struct hdd_adapter *adapter) { QDF_STATUS status; @@ -3504,16 +3468,9 @@ QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter) if (ret_val) hdd_err("WMI_PDEV_PARAM_BURST_ENABLE set failed %d", ret_val); - status = hdd_check_and_init_tdls(adapter); - if (status != QDF_STATUS_SUCCESS) - goto error_tdls_init; - adapter->dev->features |= NETIF_F_LRO; return QDF_STATUS_SUCCESS; -error_tdls_init: - clear_bit(WMM_INIT_DONE, &adapter->event_flags); - hdd_wmm_adapter_close(adapter); error_wmm_init: clear_bit(INIT_TX_RX_SUCCESS, &adapter->event_flags); hdd_deinit_tx_rx(adapter); @@ -3586,7 +3543,6 @@ static void hdd_station_adapter_deinit(struct hdd_context *hdd_ctx, } hdd_cleanup_actionframe(hdd_ctx, adapter); - wlan_hdd_tdls_exit(adapter); EXIT(); } @@ -5900,8 +5856,6 @@ static int hdd_context_deinit(struct hdd_context *hdd_ctx) hdd_rx_wake_lock_destroy(hdd_ctx); - hdd_tdls_context_destroy(hdd_ctx); - hdd_scan_context_destroy(hdd_ctx); qdf_list_destroy(&hdd_ctx->hddAdapters); @@ -7713,8 +7667,6 @@ static int hdd_context_init(struct hdd_context *hdd_ctx) if (ret) goto list_destroy; - hdd_tdls_context_init(hdd_ctx, false); - hdd_rx_wake_lock_create(hdd_ctx); ret = hdd_sap_context_init(hdd_ctx); @@ -7745,7 +7697,6 @@ sap_destroy: scan_destroy: hdd_scan_context_destroy(hdd_ctx); hdd_rx_wake_lock_destroy(hdd_ctx); - hdd_tdls_context_destroy(hdd_ctx); list_destroy: qdf_list_destroy(&hdd_ctx->hddAdapters); diff --git a/core/hdd/src/wlan_hdd_tdls.c b/core/hdd/src/wlan_hdd_tdls.c index 58df195722bb..38d7e03b5119 100644 --- a/core/hdd/src/wlan_hdd_tdls.c +++ b/core/hdd/src/wlan_hdd_tdls.c @@ -71,165 +71,6 @@ enum qca_wlan_vendor_tdls_trigger_mode_hdd_map { QCA_WLAN_VENDOR_TDLS_TRIGGER_MODE_IMPLICIT) << 1), }; -/* - * wlan_hdd_tdls_determine_channel_opclass() - determine channel and opclass - * @hddctx: pointer to hdd context - * @adapter: pointer to adapter - * @curr_peer: pointer to current tdls peer - * @channel: pointer to channel - * @opclass: pointer to opclass - * - * Function determines the channel and operating class - * - * Return: None - */ -static void wlan_hdd_tdls_determine_channel_opclass(struct hdd_context *hddctx, - struct hdd_adapter *adapter, hddTdlsPeer_t *curr_peer, - uint32_t *channel, uint32_t *opclass) -{ - struct hdd_station_ctx *hdd_sta_ctx; - - /* - * If tdls offchannel is not enabled then we provide base channel - * and in that case pass opclass as 0 since opclass is mainly needed - * for offchannel cases. - */ - if (!(hddctx->config->fEnableTDLSOffChannel) || - (hddctx->tdls_fw_off_chan_mode != ENABLE_CHANSWITCH)) { - hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); - *channel = hdd_sta_ctx->conn_info.operationChannel; - *opclass = 0; - } else { - *channel = curr_peer->pref_off_chan_num; - *opclass = curr_peer->op_class_for_pref_off_chan; - } - hdd_debug("channel:%d opclass:%d", *channel, *opclass); -} - -#ifdef FEATURE_WLAN_DIAG_SUPPORT -/** - * hdd_send_wlan_tdls_teardown_event()- send TDLS teardown event - * @reason: reason for tear down. - * @peer_mac: peer mac - * - * This Function sends TDLS teardown diag event - * - * Return: void. - */ -void hdd_send_wlan_tdls_teardown_event(uint32_t reason, - uint8_t *peer_mac) -{ - WLAN_HOST_DIAG_EVENT_DEF(tdls_tear_down, - struct host_event_tdls_teardown); - qdf_mem_zero(&tdls_tear_down, - sizeof(tdls_tear_down)); - - tdls_tear_down.reason = reason; - qdf_mem_copy(tdls_tear_down.peer_mac, peer_mac, MAC_ADDR_LEN); - WLAN_HOST_DIAG_EVENT_REPORT(&tdls_tear_down, - EVENT_WLAN_TDLS_TEARDOWN); -} - -/** - * hdd_wlan_tdls_enable_link_event()- send TDLS enable link event - * @peer_mac: peer mac - * @is_off_chan_supported: Does peer supports off chan - * @is_off_chan_configured: If off channel is configured - * @is_off_chan_established: If off chan is established - * - * This Function send TDLS enable link diag event - * - * Return: void. - */ - -void hdd_wlan_tdls_enable_link_event(const uint8_t *peer_mac, - uint8_t is_off_chan_supported, - uint8_t is_off_chan_configured, - uint8_t is_off_chan_established) -{ - WLAN_HOST_DIAG_EVENT_DEF(tdls_event, - struct host_event_tdls_enable_link); - - qdf_mem_copy(tdls_event.peer_mac, - peer_mac, MAC_ADDR_LEN); - - tdls_event.is_off_chan_supported = - is_off_chan_supported; - tdls_event.is_off_chan_configured = - is_off_chan_configured; - tdls_event.is_off_chan_established = - is_off_chan_established; - - WLAN_HOST_DIAG_EVENT_REPORT(&tdls_event, - EVENT_WLAN_TDLS_ENABLE_LINK); -} - -/** - * hdd_wlan_block_scan_by_tdls_event()- send event - * if scan is blocked by tdls - * - * This Function send send diag event if scan is - * blocked by tdls - * - * Return: void. - */ -void hdd_wlan_block_scan_by_tdls_event(void) -{ - WLAN_HOST_DIAG_EVENT_DEF(tdls_scan_block_status, - struct host_event_tdls_scan_rejected); - - tdls_scan_block_status.status = true; - WLAN_HOST_DIAG_EVENT_REPORT(&tdls_scan_block_status, - EVENT_TDLS_SCAN_BLOCK); -} - -#endif - -/** - * wlan_hdd_tdls_hash_key() - calculate tdls hash key given mac address - * @mac: mac address - * - * Return: hash key - */ -static u8 wlan_hdd_tdls_hash_key(const u8 *mac) -{ - int i; - u8 key = 0; - - for (i = 0; i < 6; i++) - key ^= mac[i]; - - return key; -} - -/** - * wlan_hdd_tdls_free_list() - free TDLS peer list - * @pHddTdlsCtx: TDLS context - * - * Return: None - */ -static void wlan_hdd_tdls_free_list(tdlsCtx_t *pHddTdlsCtx) -{ - int i; - struct list_head *head; - hddTdlsPeer_t *tmp; - struct list_head *pos, *q; - - if (NULL == pHddTdlsCtx) { - hdd_debug("pHddTdlsCtx is NULL"); - return; - } - 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); - list_del(pos); - qdf_mem_free(tmp); - tmp = NULL; - } - } -} - /** * dump_tdls_state_param_setting() - print tdls state & parameters to send to fw * @info: tdls setting to be sent to fw @@ -260,408 +101,6 @@ static void dump_tdls_state_param_setting(tdlsInfo_t *info) } -/** - * wlan_hdd_tdls_del_non_forced_peers() - delete non forced tdls peers - * @hdd_tdls_ctx: TDLS context - * - * Return: none - */ -static void wlan_hdd_tdls_del_non_forced_peers(tdlsCtx_t *hdd_tdls_ctx) -{ - struct list_head *head, *pos, *q; - hddTdlsPeer_t *peer = NULL; - int i; - - /* remove entries from peer list only if peer is not forced */ - for (i = 0; i < TDLS_PEER_LIST_SIZE; i++) { - head = &hdd_tdls_ctx->peer_list[i]; - list_for_each_safe(pos, q, head) { - peer = list_entry(pos, hddTdlsPeer_t, node); - if (false == peer->isForcedPeer) { - list_del(pos); - qdf_mem_free(peer); - } else { - peer->link_status = eTDLS_LINK_IDLE; - peer->reason = eTDLS_LINK_UNSPECIFIED; - peer->staId = OL_TXRX_INVALID_TDLS_PEER_ID; - peer->discovery_attempt = 0; - } - } - } -} - -/** - * hdd_tdls_context_init() - Init TDLS context - * @hdd_ctx: HDD context - * @ssr: SSR case - * - * Initialize TDLS global context. - * - * Return: None - */ -void hdd_tdls_context_init(struct hdd_context *hdd_ctx, bool ssr) -{ - uint8_t sta_idx; - - if (!ssr) { - mutex_init(&hdd_ctx->tdls_lock); - qdf_spinlock_create(&hdd_ctx->tdls_ct_spinlock); - } - - /* initialize TDLS global context */ - hdd_ctx->connected_peer_count = 0; - hdd_ctx->tdls_nss_switch_in_progress = false; - hdd_ctx->tdls_teardown_peers_cnt = 0; - hdd_ctx->set_state_info.set_state_cnt = 0; - hdd_ctx->set_state_info.vdev_id = 0; - hdd_ctx->tdls_nss_teardown_complete = false; - hdd_ctx->tdls_nss_transition_mode = TDLS_NSS_TRANSITION_UNKNOWN; - - if (false == hdd_ctx->config->fEnableTDLSImplicitTrigger) { - hdd_ctx->tdls_mode = eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY; - hdd_debug("TDLS Implicit trigger not enabled!"); - } else if (true == hdd_ctx->config->fTDLSExternalControl) { - hdd_ctx->tdls_mode = eTDLS_SUPPORT_EXTERNAL_CONTROL; - } else { - hdd_ctx->tdls_mode = eTDLS_SUPPORT_ENABLED; - } - - hdd_ctx->tdls_mode_last = hdd_ctx->tdls_mode; - - if (hdd_ctx->config->fEnableTDLSSleepSta || - hdd_ctx->config->fEnableTDLSBufferSta || - hdd_ctx->config->fEnableTDLSOffChannel) - hdd_ctx->max_num_tdls_sta = HDD_MAX_NUM_TDLS_STA_P_UAPSD_OFFCHAN; - else - hdd_ctx->max_num_tdls_sta = HDD_MAX_NUM_TDLS_STA; - - hdd_debug("max_num_tdls_sta: %d", hdd_ctx->max_num_tdls_sta); - - for (sta_idx = 0; sta_idx < hdd_ctx->max_num_tdls_sta; sta_idx++) { - hdd_ctx->tdlsConnInfo[sta_idx].staId = 0; - hdd_ctx->tdlsConnInfo[sta_idx].sessionId = 255; - qdf_mem_zero(&hdd_ctx->tdlsConnInfo[sta_idx].peerMac, - QDF_MAC_ADDR_SIZE); - } - - /* Don't reset TDLS external peer count for SSR case */ - if (!ssr) - hdd_ctx->tdls_external_peer_count = 0; -} - -/** - * hdd_tdls_context_destroy() - Destroy TDLS context - * @hdd_ctx: HDD context - * - * Destroy TDLS global context. - * - * Return: None - */ -void hdd_tdls_context_destroy(struct hdd_context *hdd_ctx) -{ - hdd_ctx->tdls_external_peer_count = 0; - hdd_info("hdd_ctx->enable_tdls_connection_tracker: 0"); - mutex_destroy(&hdd_ctx->tdls_lock); - qdf_spinlock_destroy(&hdd_ctx->tdls_ct_spinlock); -} - -/** - * wlan_hdd_tdls_init() - tdls initializaiton - * @pAdapter: hdd adapter - * - * Return: 0 for success or negative errno otherwise - */ -int wlan_hdd_tdls_init(struct hdd_adapter *pAdapter) -{ - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - tdlsCtx_t *pHddTdlsCtx; - int i; - - if (NULL == hdd_ctx) - return -EINVAL; - - ENTER(); - - if (hdd_ctx->tdls_umac_comp_active) - return 0; - - mutex_lock(&hdd_ctx->tdls_lock); - - if (false == hdd_ctx->config->fEnableTDLSSupport) { - hdd_ctx->tdls_mode = eTDLS_SUPPORT_NOT_ENABLED; - pAdapter->sessionCtx.station.pHddTdlsCtx = NULL; - mutex_unlock(&hdd_ctx->tdls_lock); - hdd_err("TDLS not enabled (%d) or FW doesn't support", - hdd_ctx->config->fEnableTDLSSupport); - return 0; - } - /* TDLS is supported only in STA / P2P Client modes, - * hence the check for TDLS support in a specific Device mode. - * Do not return a failure rather do not continue further - * with the initialization as tdls_init would be called - * during the open adapter for a p2p interface at which point - * the device mode would be a P2P_DEVICE. The point here is to - * continue initialization for STA / P2P Client modes. - * TDLS exit also check for the device mode for clean up hence - * there is no issue even if success is returned. - */ - if (0 == WLAN_HDD_IS_TDLS_SUPPORTED_ADAPTER(pAdapter)) { - mutex_unlock(&hdd_ctx->tdls_lock); - return 0; - } - /* Check for the valid pHddTdlsCtx. If valid do not further - * allocate the memory, rather continue with the initialization. - * If tdls_initialization would get reinvoked without tdls_exit - * getting invoked (SSR) there is no point to further proceed - * with the memory allocations. - */ - if (NULL == pAdapter->sessionCtx.station.pHddTdlsCtx) { - pHddTdlsCtx = qdf_mem_malloc(sizeof(tdlsCtx_t)); - - if (NULL == pHddTdlsCtx) { - pAdapter->sessionCtx.station.pHddTdlsCtx = NULL; - mutex_unlock(&hdd_ctx->tdls_lock); - hdd_err("malloc failed!"); - return -ENOMEM; - } - - pAdapter->sessionCtx.station.pHddTdlsCtx = pHddTdlsCtx; - for (i = 0; i < TDLS_PEER_LIST_SIZE; i++) - INIT_LIST_HEAD(&pHddTdlsCtx->peer_list[i]); - } else { - pHddTdlsCtx = pAdapter->sessionCtx.station.pHddTdlsCtx; - - wlan_hdd_tdls_del_non_forced_peers(pHddTdlsCtx); - - hdd_tdls_context_init(hdd_ctx, true); - } - - sme_set_tdls_power_save_prohibited(WLAN_HDD_GET_HAL_CTX(pAdapter), - pAdapter->sessionId, 0); - - pHddTdlsCtx->pAdapter = pAdapter; - - pHddTdlsCtx->curr_candidate = NULL; - pHddTdlsCtx->magic = 0; - hdd_ctx->valid_mac_entries = 0; - pHddTdlsCtx->last_flush_ts = 0; - - pHddTdlsCtx->threshold_config.tx_period_t = - hdd_ctx->config->fTDLSTxStatsPeriod; - pHddTdlsCtx->threshold_config.tx_packet_n = - hdd_ctx->config->fTDLSTxPacketThreshold; - pHddTdlsCtx->threshold_config.discovery_tries_n = - hdd_ctx->config->fTDLSMaxDiscoveryAttempt; - pHddTdlsCtx->threshold_config.idle_timeout_t = - hdd_ctx->config->tdls_idle_timeout; - pHddTdlsCtx->threshold_config.idle_packet_n = - hdd_ctx->config->fTDLSIdlePacketThreshold; - pHddTdlsCtx->threshold_config.rssi_trigger_threshold = - hdd_ctx->config->fTDLSRSSITriggerThreshold; - pHddTdlsCtx->threshold_config.rssi_teardown_threshold = - hdd_ctx->config->fTDLSRSSITeardownThreshold; - pHddTdlsCtx->threshold_config.rssi_delta = - hdd_ctx->config->fTDLSRSSIDelta; - - mutex_unlock(&hdd_ctx->tdls_lock); - - if (hdd_ctx->config->fEnableTDLSOffChannel) - hdd_ctx->tdls_fw_off_chan_mode = ENABLE_CHANSWITCH; - - EXIT(); - return 0; -} - -/** - * wlan_hdd_tdls_exit() - TDLS de-initialization - * @pAdapter: HDD adapter - * - * Return: None - */ -void wlan_hdd_tdls_exit(struct hdd_adapter *pAdapter) -{ - tdlsCtx_t *pHddTdlsCtx; - struct hdd_context *hdd_ctx; - - ENTER(); - hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - if (!hdd_ctx) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN, - FL("hdd_ctx is NULL")); - return; - } - - if (hdd_ctx->tdls_umac_comp_active) - return; - - if (!test_bit(TDLS_INIT_DONE, &pAdapter->event_flags)) { - hdd_info("TDLS init was not done, exit"); - return; - } - - mutex_lock(&hdd_ctx->tdls_lock); - - pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); - if (NULL == pHddTdlsCtx) { - /* - * TDLS context can be null and might have been freed up during - * cleanup for STA adapter - */ - mutex_unlock(&hdd_ctx->tdls_lock); - - hdd_info("pHddTdlsCtx is NULL, adapter device mode: %s(%d)", - hdd_device_mode_to_string(pAdapter->device_mode), - pAdapter->device_mode); - goto done; - } - - /* - * must stop timer here before freeing peer list, because - * peerIdleTimer is part of peer list structure. - */ - wlan_hdd_tdls_free_list(pHddTdlsCtx); - - pHddTdlsCtx->magic = 0; - pHddTdlsCtx->pAdapter = NULL; - pAdapter->sessionCtx.station.pHddTdlsCtx = NULL; - - mutex_unlock(&hdd_ctx->tdls_lock); - - qdf_mem_free(pHddTdlsCtx); -done: - EXIT(); - clear_bit(TDLS_INIT_DONE, &pAdapter->event_flags); -} - -/** - * wlan_hdd_tdls_get_peer() - find or add an peer given mac address - * @pAdapter: HDD adapter - * @mac: MAC address used to find or create peer - * - * Search peer given an MAC address and create one if not found. - * - * Return: Pointer to peer if mac address exist or peer creation - * succeeds; NULL if peer creation fails - */ -hddTdlsPeer_t *wlan_hdd_tdls_get_peer(struct hdd_adapter *pAdapter, - const u8 *mac) -{ - struct list_head *head; - hddTdlsPeer_t *peer; - u8 key; - tdlsCtx_t *pHddTdlsCtx; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - - if (0 != (wlan_hdd_validate_context(hdd_ctx))) - return NULL; - - /* if already there, just update */ - peer = wlan_hdd_tdls_find_peer(pAdapter, mac); - if (peer != NULL) - return peer; - - /* not found, allocate and add the list */ - peer = qdf_mem_malloc(sizeof(hddTdlsPeer_t)); - if (NULL == peer) { - hdd_err("peer malloc failed!"); - return NULL; - } - - peer->staId = 0xff; - pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); - - if (NULL == pHddTdlsCtx) { - qdf_mem_free(peer); - hdd_debug("pHddTdlsCtx is NULL"); - return NULL; - } - - key = wlan_hdd_tdls_hash_key(mac); - head = &pHddTdlsCtx->peer_list[key]; - - qdf_mem_copy(peer->peerMac, mac, sizeof(peer->peerMac)); - peer->pHddTdlsCtx = pHddTdlsCtx; - peer->pref_off_chan_num = hdd_ctx->config->fTDLSPrefOffChanNum; - peer->op_class_for_pref_off_chan = - wlan_hdd_find_opclass(hdd_ctx->hHal, peer->pref_off_chan_num, - hdd_ctx->config->fTDLSPrefOffChanBandwidth); - - list_add_tail(&peer->node, head); - - return peer; -} - -/** - * wlan_hdd_tdls_set_peer_link_status() - set TDLS peer link status - * @curr_peer: peer - * @status: status - * @reason: reason - * - * Return: Void - */ -void wlan_hdd_tdls_set_peer_link_status(hddTdlsPeer_t *curr_peer, - enum tdls_link_status status, - enum tdls_link_reason reason) -{ - uint32_t state = 0; - int32_t res = 0; - struct hdd_context *hdd_ctx; - - if (curr_peer == NULL) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - FL("curr_peer is NULL")); - return; - } - - if (curr_peer->pHddTdlsCtx == NULL) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - FL("curr_peer->pHddTdlsCtx is NULL")); - return; - } - hdd_ctx = WLAN_HDD_GET_CTX(curr_peer->pHddTdlsCtx->pAdapter); - if ((wlan_hdd_validate_context(hdd_ctx))) - return; - hdd_warn("tdls set peer " MAC_ADDRESS_STR " link status to %u", - MAC_ADDR_ARRAY(curr_peer->peerMac), status); - - curr_peer->link_status = status; - - /* If TDLS link status is already passed the discovery state - * then clear discovery attempt count - */ - if (status >= eTDLS_LINK_DISCOVERED) - curr_peer->discovery_attempt = 0; - - if (curr_peer->isForcedPeer && curr_peer->state_change_notification) { - uint32_t opclass; - uint32_t channel; - struct hdd_adapter *adapter = curr_peer->pHddTdlsCtx->pAdapter; - - curr_peer->reason = reason; - - hdd_debug("Peer is forced and the reason:%d", reason); - wlan_hdd_tdls_determine_channel_opclass(hdd_ctx, adapter, - curr_peer, &channel, &opclass); - - wlan_hdd_tdls_get_wifi_hal_state(curr_peer, &state, &res); - (*curr_peer->state_change_notification)(curr_peer->peerMac, - opclass, channel, - state, res, adapter); - } -} - -/** - * wlan_hdd_tdls_extract_sa() - Extract source address from socket buffer - * @skb: socket buffer - * @mac: output mac address buffer to store the source address - * - * Return: Void - */ -void wlan_hdd_tdls_extract_sa(struct sk_buff *skb, uint8_t *mac) -{ - memcpy(mac, skb->data + 6, 6); -} - /** * wlan_hdd_tdls_check_config() - validate tdls configuration parameters * @config: tdls configuration parameter structure @@ -735,116 +174,6 @@ static int wlan_hdd_tdls_check_config(tdls_config_params_t *config) return 0; } -/** - * wlan_hdd_tdls_set_mode() - set TDLS mode - * @hdd_ctx: HDD context - * @tdls_mode: TDLS mode - * @bUpdateLast: Switch on if to set hdd_ctx->tdls_mode_last to tdls_mode. - * If 1, set hdd_ctx->tdls_mode_last to tdls_mode, otherwise - * set hdd_ctx->tdls_mode_last to hdd_ctx->tdls_mode - * @source: TDLS disable source enum values - * - * Return: Void - */ -static void wlan_hdd_tdls_set_mode(struct hdd_context *hdd_ctx, - enum tdls_support_mode tdls_mode, - bool bUpdateLast, - enum tdls_disable_source source) -{ - hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; - QDF_STATUS status; - struct hdd_adapter *pAdapter; - tdlsCtx_t *pHddTdlsCtx; - - ENTER(); - - hdd_debug("mode %d", (int)tdls_mode); - - if (0 != (wlan_hdd_validate_context(hdd_ctx))) - return; - - mutex_lock(&hdd_ctx->tdls_lock); - - if (bUpdateLast) - hdd_ctx->tdls_mode_last = tdls_mode; - - if (hdd_ctx->tdls_mode == tdls_mode) { - mutex_unlock(&hdd_ctx->tdls_lock); - hdd_debug("already in mode %d", (int)tdls_mode); - - switch (tdls_mode) { - /* TDLS is already enabled hence clear source mask, return */ - case eTDLS_SUPPORT_ENABLED: - case eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY: - case eTDLS_SUPPORT_EXTERNAL_CONTROL: - clear_bit((unsigned long)source, - &hdd_ctx->tdls_source_bitmap); - hdd_debug("clear source mask:%d", source); - return; - /* TDLS is already disabled hence set source mask, return */ - case eTDLS_SUPPORT_DISABLED: - set_bit((unsigned long)source, - &hdd_ctx->tdls_source_bitmap); - hdd_debug("set source mask:%d", source); - return; - default: - return; - } - } - - status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode); - - while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) { - pAdapter = pAdapterNode->pAdapter; - pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); - if (NULL != pHddTdlsCtx) { - if (eTDLS_SUPPORT_ENABLED == tdls_mode || - eTDLS_SUPPORT_EXTERNAL_CONTROL == tdls_mode) { - clear_bit((unsigned long)source, - &hdd_ctx->tdls_source_bitmap); - - /* - * Check if any TDLS source bit is set and if - * bitmap is not zero then we should not - * enable TDLS - */ - if (hdd_ctx->tdls_source_bitmap) { - mutex_unlock(&hdd_ctx->tdls_lock); - hdd_debug("Don't enable TDLS, source bitmap: %lu", - hdd_ctx->tdls_source_bitmap); - return; - } - } else if (eTDLS_SUPPORT_DISABLED == tdls_mode) { - set_bit((unsigned long)source, - &hdd_ctx->tdls_source_bitmap); - } else if (eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == - tdls_mode) { - clear_bit((unsigned long)source, - &hdd_ctx->tdls_source_bitmap); - - /* - * Check if any TDLS source bit is set and if - * bitmap is not zero then we should not - * enable TDLS - */ - if (hdd_ctx->tdls_source_bitmap) { - mutex_unlock(&hdd_ctx->tdls_lock); - return; - } - } - } - status = hdd_get_next_adapter(hdd_ctx, pAdapterNode, &pNext); - pAdapterNode = pNext; - } - if (!bUpdateLast) - hdd_ctx->tdls_mode_last = hdd_ctx->tdls_mode; - - hdd_ctx->tdls_mode = tdls_mode; - - mutex_unlock(&hdd_ctx->tdls_lock); - EXIT(); -} - /** * wlan_hdd_tdls_set_params() - set TDLS parameters * @dev: net device @@ -857,41 +186,25 @@ int wlan_hdd_tdls_set_params(struct net_device *dev, { struct hdd_adapter *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - tdlsCtx_t *pHddTdlsCtx; - enum tdls_support_mode req_tdls_mode; + enum tdls_feature_mode req_tdls_mode; tdlsInfo_t *tdlsParams; QDF_STATUS qdf_ret_status = QDF_STATUS_E_FAILURE; + struct tdls_set_mode_params set_mode_params; if (wlan_hdd_tdls_check_config(config) != 0) return -EINVAL; /* config->tdls is mapped to 0->1, 1->2, 2->3 */ req_tdls_mode = config->tdls + 1; - if (hdd_ctx->tdls_mode == req_tdls_mode) { - hdd_err("Already in mode %d", config->tdls); - return -EINVAL; - } - - mutex_lock(&hdd_ctx->tdls_lock); - - pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); - if (NULL == pHddTdlsCtx) { - mutex_unlock(&hdd_ctx->tdls_lock); - hdd_err("pHddTdlsCtx is NULL"); - return -EINVAL; - } /* Copy the configuration only when given tdls mode * is implicit trigger enable */ - if (eTDLS_SUPPORT_ENABLED == req_tdls_mode || - eTDLS_SUPPORT_EXTERNAL_CONTROL == req_tdls_mode) { - memcpy(&pHddTdlsCtx->threshold_config, config, - sizeof(tdls_config_params_t)); + if (TDLS_SUPPORT_IMP_MODE == req_tdls_mode || + TDLS_SUPPORT_EXT_CONTROL == req_tdls_mode) { + /* TODO update threshold config to tdls vdev */ } - mutex_unlock(&hdd_ctx->tdls_lock); - hdd_debug("iw set tdls params: %d %d %d %d %d %d %d", config->tdls, config->tx_period_t, @@ -901,8 +214,12 @@ int wlan_hdd_tdls_set_params(struct net_device *dev, config->rssi_trigger_threshold, config->rssi_teardown_threshold); - wlan_hdd_tdls_set_mode(hdd_ctx, req_tdls_mode, true, - HDD_SET_TDLS_MODE_SOURCE_USER); + set_mode_params.source = TDLS_SET_MODE_SOURCE_USER; + set_mode_params.tdls_mode = req_tdls_mode; + set_mode_params.update_last = true; + set_mode_params.vdev = pAdapter->hdd_vdev; + + ucfg_tdls_set_operating_mode(&set_mode_params); tdlsParams = qdf_mem_malloc(sizeof(tdlsInfo_t)); if (NULL == tdlsParams) { @@ -950,202 +267,6 @@ int wlan_hdd_tdls_set_params(struct net_device *dev, return 0; } -/** - * wlan_hdd_tdls_set_extctrl_param() - set external control parameter on a peer - * @pAdapter: HDD adapter - * @mac: MAC address of the peer - * @chan: Channel - * @max_latency: Maximum latency - * @op_class: Operation class - * @min_bandwidth: Minimal bandwidth - * - * Return: 0 for success; negative errno otherwise - */ -int wlan_hdd_tdls_set_extctrl_param(struct hdd_adapter *pAdapter, - const uint8_t *mac, - uint32_t chan, uint32_t max_latency, - uint32_t op_class, uint32_t min_bandwidth) -{ - hddTdlsPeer_t *curr_peer; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - - if (!hdd_ctx) - return -EINVAL; - - mutex_lock(&hdd_ctx->tdls_lock); - curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac); - if (curr_peer == NULL) { - mutex_unlock(&hdd_ctx->tdls_lock); - return -EINVAL; - } - curr_peer->op_class_for_pref_off_chan = (uint8_t) op_class; - curr_peer->pref_off_chan_num = (uint8_t) chan; - - mutex_unlock(&hdd_ctx->tdls_lock); - return 0; -} - -/** - * wlan_hdd_tdls_update_peer_mac() - Update the peer mac information to firmware - * @adapter: hdd adapter to interface - * @mac: Mac address of the peer to be added - * @peerState: Current state of the peer - * - * This function updates TDLS peer state to firmware. Firmware will update - * connection table based on new peer state. - * - * Return:success (0) or failure (errno value) - */ -int wlan_hdd_tdls_update_peer_mac(struct hdd_adapter *adapter, - const uint8_t *mac, - uint32_t peer_state) -{ - tSmeTdlsPeerStateParams sme_tdls_peer_state_params = {0}; - QDF_STATUS status = QDF_STATUS_E_FAILURE; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - - sme_tdls_peer_state_params.vdevId = adapter->sessionId; - qdf_mem_copy(&sme_tdls_peer_state_params.peerMacAddr, mac, - sizeof(sme_tdls_peer_state_params.peerMacAddr)); - sme_tdls_peer_state_params.peerState = peer_state; - status = sme_update_tdls_peer_state(hdd_ctx->hHal, - &sme_tdls_peer_state_params); - if (QDF_STATUS_SUCCESS != status) { - hdd_err("sme_UpdateTdlsPeerState failed for "MAC_ADDRESS_STR, - MAC_ADDR_ARRAY(mac)); - return -EPERM; - } - return 0; -} - -/** - * wlan_hdd_tdls_set_force_peer() - set/clear isForcedPeer flag on a peer - * @pAdapter: HDD adapter - * @mac: MAC address of the tdls peer - * @forcePeer: value used to set isForcedPeer flag on the peer - * - * Return: 0 for success; negative errno otherwise - */ -int wlan_hdd_tdls_set_force_peer(struct hdd_adapter *pAdapter, - const uint8_t *mac, - bool forcePeer) -{ - hddTdlsPeer_t *curr_peer; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - - if (!hdd_ctx) - return -EINVAL; - - mutex_lock(&hdd_ctx->tdls_lock); - curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac); - if (curr_peer == NULL) { - mutex_unlock(&hdd_ctx->tdls_lock); - return -EINVAL; - } - - curr_peer->isForcedPeer = forcePeer; - mutex_unlock(&hdd_ctx->tdls_lock); - return 0; -} - -/** - * wlan_hdd_tdls_find_peer() - find TDLS peer given its MAC address - * @pAdapter: HDD adapter - * @mac: MAC address of peer - * - * Return: If peerMac is found, then it returns pointer to hddTdlsPeer_t; - * otherwise, it returns NULL - */ -hddTdlsPeer_t *wlan_hdd_tdls_find_peer(struct hdd_adapter *pAdapter, - const uint8_t *mac) -{ - uint8_t key; - struct list_head *pos; - struct list_head *head; - hddTdlsPeer_t *curr_peer; - tdlsCtx_t *pHddTdlsCtx; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - - - if (0 != (wlan_hdd_validate_context(hdd_ctx))) - return NULL; - - pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); - if (NULL == pHddTdlsCtx) - return NULL; - - key = wlan_hdd_tdls_hash_key(mac); - - head = &pHddTdlsCtx->peer_list[key]; - - list_for_each(pos, head) { - curr_peer = list_entry(pos, hddTdlsPeer_t, node); - if (!memcmp(mac, curr_peer->peerMac, 6)) { - hdd_debug("findTdlsPeer: found staId %d", - curr_peer->staId); - return curr_peer; - } - } - - return NULL; -} - -/** - * wlan_hdd_tdls_find_all_peer() - find all peers matching the input MAC - * @hdd_ctx: HDD context - * @mac: MAC address - * - * Return: TDLS peer if a matching is detected; NULL otherwise - */ -hddTdlsPeer_t *wlan_hdd_tdls_find_all_peer(struct hdd_context *hdd_ctx, - const u8 *mac) -{ - hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; - struct hdd_adapter *pAdapter = NULL; - tdlsCtx_t *pHddTdlsCtx = NULL; - hddTdlsPeer_t *curr_peer = NULL; - QDF_STATUS status = 0; - - status = hdd_get_front_adapter(hdd_ctx, &pAdapterNode); - while (NULL != pAdapterNode && QDF_STATUS_SUCCESS == status) { - pAdapter = pAdapterNode->pAdapter; - - pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); - if (NULL != pHddTdlsCtx) { - curr_peer = - wlan_hdd_tdls_find_peer(pAdapter, mac); - if (curr_peer) - return curr_peer; - } - status = hdd_get_next_adapter(hdd_ctx, pAdapterNode, &pNext); - pAdapterNode = pNext; - } - return curr_peer; -} - -/** - * wlan_hdd_tdls_connected_peers() - Find the number of connected TDLS peers - * @pAdapter: HDD adapter - * - * Return: The number of connected TDLS peers or 0 if error is detected - */ -uint16_t wlan_hdd_tdls_connected_peers(struct hdd_adapter *pAdapter) -{ - struct hdd_context *hdd_ctx; - - if ((NULL == pAdapter) || - (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) { - hdd_err("invalid pAdapter: %pK", pAdapter); - return 0; - } - hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - - if (wlan_hdd_validate_context(hdd_ctx)) - return 0; - - return hdd_ctx->connected_peer_count; -} - /** * wlan_hdd_tdls_get_all_peers() - dump all TDLS peer info into output string * @pAdapter: HDD adapter @@ -1157,223 +278,7 @@ 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) { - int i; - int len, init_len; - struct list_head *head; - struct list_head *pos; - hddTdlsPeer_t *curr_peer; - tdlsCtx_t *pHddTdlsCtx; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - struct hdd_station_ctx *hdd_sta_ctx; - - ENTER(); - - if (0 != (wlan_hdd_validate_context(hdd_ctx))) - return 0; - - if ((QDF_STA_MODE != pAdapter->device_mode) - && (QDF_P2P_CLIENT_MODE != pAdapter->device_mode)) { - len = scnprintf(buf, buflen, - "\nNo TDLS support for this adapter\n"); - return len; - } - - hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); - if (eConnectionState_Associated != hdd_sta_ctx->conn_info.connState) { - len = scnprintf(buf, buflen, "\nSTA is not associated\n"); - return len; - } - - init_len = buflen; - len = scnprintf(buf, buflen, "\n%-18s%-3s%-4s%-3s%-5s\n", - "MAC", "Id", "cap", "up", "RSSI"); - buf += len; - buflen -= len; - /* 1234567890123456789012345678901234567 */ - len = scnprintf(buf, buflen, "---------------------------------\n"); - buf += len; - buflen -= len; - - mutex_lock(&hdd_ctx->tdls_lock); - - pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); - if (NULL == pHddTdlsCtx) { - mutex_unlock(&hdd_ctx->tdls_lock); - len = scnprintf(buf, buflen, "TDLS not enabled\n"); - return len; - } - for (i = 0; i < TDLS_PEER_LIST_SIZE; i++) { - head = &pHddTdlsCtx->peer_list[i]; - - list_for_each(pos, head) { - curr_peer = list_entry(pos, hddTdlsPeer_t, node); - - if (buflen < 32 + 1) - break; - len = scnprintf(buf, buflen, - MAC_ADDRESS_STR "%3d%4s%3s%5d\n", - MAC_ADDR_ARRAY(curr_peer->peerMac), - curr_peer->staId, - (curr_peer->tdls_support == - eTDLS_CAP_SUPPORTED) ? "Y" : "N", - TDLS_IS_CONNECTED(curr_peer) ? "Y" : - "N", curr_peer->rssi); - buf += len; - buflen -= len; - } - } - mutex_unlock(&hdd_ctx->tdls_lock); - EXIT(); - return init_len - buflen; -} - -/** - * wlan_hdd_tdls_indicate_teardown() - indicate tdls teardown - * @pAdapter: HDD adapter - * @curr_peer: peer tdls teardown happened - * @reason: teardown reason - * - * Return: Void - */ -void wlan_hdd_tdls_indicate_teardown(struct hdd_adapter *pAdapter, - hddTdlsPeer_t *curr_peer, uint16_t reason) -{ - if ((NULL == pAdapter || WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) || - (NULL == curr_peer)) { - hdd_err("parameters passed are invalid"); - if (!curr_peer) - hdd_err("curr_peer is NULL"); - return; - } - - if (eTDLS_LINK_CONNECTED != curr_peer->link_status) - return; - - wlan_hdd_tdls_set_peer_link_status(curr_peer, - eTDLS_LINK_TEARING, - eTDLS_LINK_UNSPECIFIED); - hdd_debug("Teardown reason %d", reason); - cfg80211_tdls_oper_request(pAdapter->dev, - curr_peer->peerMac, - NL80211_TDLS_TEARDOWN, reason, GFP_KERNEL); -} - -/** - * wlan_hdd_set_callback() - set state change callback on current TDLS peer - * @curr_peer: current TDLS peer - * @callback: state change callback - * - * Return: 0 if success; negative errno otherwise - */ -int wlan_hdd_set_callback(hddTdlsPeer_t *curr_peer, - cfg80211_exttdls_callback callback) -{ - struct hdd_context *hdd_ctx; - struct hdd_adapter *pAdapter; - - if (!curr_peer) - return -EINVAL; - - pAdapter = curr_peer->pHddTdlsCtx->pAdapter; - hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - if (NULL == hdd_ctx) - return -EINVAL; - - curr_peer->state_change_notification = callback; - return 0; -} - -/** - * wlan_hdd_tdls_get_wifi_hal_state() - get tdls wifi hal state on current peer - * @curr_peer: current TDLS peer - * @state: output parameter to store the tdls wifi hal state - * @reason: output parameter to store the reason of the current peer - * - * Return: Void - */ -void wlan_hdd_tdls_get_wifi_hal_state(hddTdlsPeer_t *curr_peer, - uint32_t *state, int32_t *reason) -{ - struct hdd_context *hddctx; - struct hdd_adapter *adapter; - - if (!curr_peer) { - hdd_err("curr_peer is NULL"); - return; - } - - adapter = curr_peer->pHddTdlsCtx->pAdapter; - hddctx = WLAN_HDD_GET_CTX(adapter); - - if (0 != (wlan_hdd_validate_context(hddctx))) - return; - - *reason = curr_peer->reason; - - switch (curr_peer->link_status) { - case eTDLS_LINK_IDLE: - case eTDLS_LINK_DISCOVERED: - *state = QCA_WIFI_HAL_TDLS_ENABLED; - break; - case eTDLS_LINK_DISCOVERING: - case eTDLS_LINK_CONNECTING: - *state = QCA_WIFI_HAL_TDLS_ENABLED; - break; - case eTDLS_LINK_CONNECTED: - if ((hddctx->config->fEnableTDLSOffChannel) && - (hddctx->tdls_fw_off_chan_mode == ENABLE_CHANSWITCH)) - *state = QCA_WIFI_HAL_TDLS_ESTABLISHED_OFF_CHANNEL; - else - *state = QCA_WIFI_HAL_TDLS_ESTABLISHED; - break; - case eTDLS_LINK_TEARING: - *state = QCA_WIFI_HAL_TDLS_DROPPED; - break; - } -} - -/** - * wlan_hdd_tdls_get_status() - get tdls status on current tdls peer - * @pAdapter: HDD adapter - * @mac: MAC address of current TDLS peer - * @state: output parameter to store the tdls wifi hal state - * @reason: output parameter to store the reason of the current peer - * - * Return: 0 if success; negative errno otherwise - */ -int wlan_hdd_tdls_get_status(struct hdd_adapter *pAdapter, - const uint8_t *mac, uint32_t *opclass, - uint32_t *channel, uint32_t *state, - int32_t *reason) -{ - hddTdlsPeer_t *curr_peer; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - - if (0 != (wlan_hdd_validate_context(hdd_ctx))) - return -EINVAL; - - mutex_lock(&hdd_ctx->tdls_lock); - curr_peer = wlan_hdd_tdls_find_peer(pAdapter, mac); - if (curr_peer == NULL) { - mutex_unlock(&hdd_ctx->tdls_lock); - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - FL("curr_peer is NULL")); - *state = QCA_WIFI_HAL_TDLS_DISABLED; - *reason = eTDLS_LINK_UNSPECIFIED; - return -EINVAL; - } - if (hdd_ctx->config->fTDLSExternalControl && - (false == curr_peer->isForcedPeer)) { - hdd_debug("curr_peer is not Forced"); - *state = QCA_WIFI_HAL_TDLS_DISABLED; - *reason = eTDLS_LINK_UNSPECIFIED; - } else { - wlan_hdd_tdls_determine_channel_opclass(hdd_ctx, pAdapter, - curr_peer, channel, opclass); - wlan_hdd_tdls_get_wifi_hal_state(curr_peer, state, reason); - } - mutex_unlock(&hdd_ctx->tdls_lock); - + /* TODO */ return 0; } @@ -1459,82 +364,8 @@ __wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, const void *data, int data_len) { - uint8_t peer[ETH_ALEN] = { 0 }; - struct net_device *dev = wdev->netdev; - struct hdd_adapter *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); - struct hdd_context *hdd_ctx = wiphy_priv(wiphy); - struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; - QDF_STATUS ret; - uint32_t state; - int32_t reason; - uint32_t global_operating_class = 0; - uint32_t channel = 0; - struct sk_buff *skb = NULL; - - ENTER_DEV(dev); - - if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { - hdd_err("Command not allowed in FTM mode"); - return -EPERM; - } - - ret = wlan_hdd_validate_context(hdd_ctx); - if (0 != ret) - return -EINVAL; - - if (hdd_ctx->config->fTDLSExternalControl == false) - return -ENOTSUPP; - - if (hdd_nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, data, - data_len, wlan_hdd_tdls_config_get_status_policy)) { - hdd_err("Invalid attribute"); - return -EINVAL; - } - if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { - hdd_err("attr mac addr failed"); - return -EINVAL; - } - memcpy(peer, - nla_data(tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), - sizeof(peer)); - hdd_debug(MAC_ADDRESS_STR, MAC_ADDR_ARRAY(peer)); - ret = wlan_hdd_tdls_get_status(pAdapter, peer, &global_operating_class, - &channel, &state, &reason); - if (0 != ret) { - hdd_err("get status Failed"); - return -EINVAL; - } - skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, - 4 * sizeof(int32_t) + - NLMSG_HDRLEN); - if (!skb) { - hdd_err("cfg80211_vendor_cmd_alloc_reply_skb failed"); - return -EINVAL; - } - hdd_debug("Reason %d Status %d class %d channel %d peer " MAC_ADDRESS_STR, - reason, state, global_operating_class, channel, - MAC_ADDR_ARRAY(peer)); - if (nla_put_u32(skb, - QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, - state) || - nla_put_s32(skb, - QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, - reason) || - nla_put_u32(skb, - QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS, - global_operating_class) || - nla_put_u32(skb, - QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL, - channel)) { - hdd_err("nla put fail"); - goto nla_put_failure; - } - ret = cfg80211_vendor_cmd_reply(skb); - EXIT(); - return ret; -nla_put_failure: - kfree_skb(skb); - return -EINVAL; + /* TODO */ + return 0; } /** @@ -1557,9 +388,7 @@ __wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy, struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_MAX + 1]; int ret; - enum tdls_support_mode tdls_mode; uint32_t trigger_mode; - tdlsCtx_t *hdd_tdls_ctx; ENTER_DEV(dev); @@ -1594,84 +423,7 @@ __wlan_hdd_cfg80211_configure_tdls_mode(struct wiphy *wiphy, return ret; } - switch (trigger_mode) { - case WLAN_HDD_VENDOR_TDLS_TRIGGER_MODE_EXPLICIT: - tdls_mode = eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY; - break; - case WLAN_HDD_VENDOR_TDLS_TRIGGER_MODE_EXTERNAL: - tdls_mode = eTDLS_SUPPORT_EXTERNAL_CONTROL; - break; - case WLAN_HDD_VENDOR_TDLS_TRIGGER_MODE_IMPLICIT: - tdls_mode = eTDLS_SUPPORT_ENABLED; - break; - default: - hdd_err("Invalid TDLS trigger mode"); - return -EINVAL; - } - wlan_hdd_tdls_set_mode(hdd_ctx, tdls_mode, false, - HDD_SET_TDLS_MODE_SOURCE_USER); - - mutex_lock(&hdd_ctx->tdls_lock); - - hdd_tdls_ctx = adapter->sessionCtx.station.pHddTdlsCtx; - if (NULL == hdd_tdls_ctx) { - mutex_unlock(&hdd_ctx->tdls_lock); - return -EINVAL; - } - - if (tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_TX_STATS_PERIOD]) { - hdd_tdls_ctx->threshold_config.tx_period_t = nla_get_u32( - tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_TX_STATS_PERIOD]); - hdd_debug("attr tdls tx stats period %d", - hdd_tdls_ctx->threshold_config.tx_period_t); - } - - if (tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_TX_THRESHOLD]) { - hdd_tdls_ctx->threshold_config.tx_packet_n = nla_get_u32( - tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_TX_THRESHOLD]); - hdd_debug("attr tdls tx packet period %d", - hdd_tdls_ctx->threshold_config.tx_packet_n); - } - - if (tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_MAX_DISCOVERY_ATTEMPT]) { - hdd_tdls_ctx->threshold_config.discovery_tries_n = nla_get_u32( - tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_MAX_DISCOVERY_ATTEMPT]); - hdd_debug("attr tdls max discovery attempt %d", - hdd_tdls_ctx->threshold_config.discovery_tries_n); - } - - if (tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_IDLE_TIMEOUT]) { - hdd_tdls_ctx->threshold_config.idle_timeout_t = nla_get_u32( - tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_IDLE_TIMEOUT]); - hdd_debug("attr tdls idle time out period %d", - hdd_tdls_ctx->threshold_config.idle_timeout_t); - } - - if (tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_IDLE_PACKET_THRESHOLD]) { - hdd_tdls_ctx->threshold_config.idle_packet_n = nla_get_u32( - tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_IDLE_PACKET_THRESHOLD]); - hdd_debug("attr tdls idle pkt threshold %d", - hdd_tdls_ctx->threshold_config.idle_packet_n); - } - - if (tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_SETUP_RSSI_THRESHOLD]) { - hdd_tdls_ctx->threshold_config.rssi_trigger_threshold = nla_get_s32( - tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_SETUP_RSSI_THRESHOLD]); - hdd_debug("attr tdls rssi trigger threshold %d", - hdd_tdls_ctx->threshold_config.rssi_trigger_threshold); - } - - if (tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_TEARDOWN_RSSI_THRESHOLD]) { - hdd_tdls_ctx->threshold_config.rssi_teardown_threshold = nla_get_s32( - tb[QCA_WLAN_VENDOR_ATTR_TDLS_CONFIG_TEARDOWN_RSSI_THRESHOLD]); - hdd_debug("attr tdls tx stats period %d", - hdd_tdls_ctx->threshold_config.rssi_teardown_threshold); - } - - mutex_unlock(&hdd_ctx->tdls_lock); - - EXIT(); - return ret; + return -EINVAL; } /** @@ -1722,66 +474,6 @@ int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, return ret; } -/** - * wlan_hdd_cfg80211_exttdls_callback() - notify cfg80211 state change - * @mac: MAC address of the peer with state change - * @state: New state - * @reason: Reason to enter new state - * @ctx: HDD adapter - * - * Return: 0 for success; negative errno otherwise - */ -static int wlan_hdd_cfg80211_exttdls_callback(const uint8_t *mac, - uint32_t global_operating_class, - uint32_t channel, - uint32_t state, - int32_t reason, void *ctx) -{ - struct hdd_adapter *pAdapter = (struct hdd_adapter *) ctx; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - struct sk_buff *skb = NULL; - - ENTER(); - - if (wlan_hdd_validate_context(hdd_ctx)) - return -EINVAL; - if (hdd_ctx->config->fTDLSExternalControl == false) - return -ENOTSUPP; - - skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, - NULL, - EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, - QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, - GFP_KERNEL); - if (!skb) { - hdd_err("cfg80211_vendor_event_alloc failed"); - return -EINVAL; - } - hdd_debug("Reason: %d Status: %d Class: %d Channel: %d tdls peer " MAC_ADDRESS_STR, - reason, state, global_operating_class, channel, - MAC_ADDR_ARRAY(mac)); - if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, - QDF_MAC_ADDR_SIZE, mac) || - nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, - state) || - nla_put_s32(skb, QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, - reason) || - nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL, - channel) || - nla_put_u32(skb, - QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS, - global_operating_class)) { - hdd_err("nla put fail"); - goto nla_put_failure; - } - cfg80211_vendor_event(skb, GFP_KERNEL); - EXIT(); - return 0; -nla_put_failure: - kfree_skb(skb); - return -EINVAL; -} - /** * __wlan_hdd_cfg80211_exttdls_enable() - enable an externally controllable * TDLS peer and set parameters @@ -1801,87 +493,8 @@ __wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, const void *data, int data_len) { - uint8_t peer[ETH_ALEN] = { 0 }; - struct net_device *dev = wdev->netdev; - struct hdd_adapter *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); - struct hdd_context *hdd_ctx = wiphy_priv(wiphy); - struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; - QDF_STATUS status; - tdls_req_params_t pReqMsg = { 0 }; - int ret; - - ENTER_DEV(dev); - - if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { - hdd_err("Command not allowed in FTM mode"); - return -EPERM; - } - - status = wlan_hdd_validate_context(hdd_ctx); - if (0 != status) - return -EINVAL; - if (hdd_ctx->config->fTDLSExternalControl == false) { - hdd_err("TDLS External Control is not enabled"); - return -ENOTSUPP; - } - if (hdd_nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, data, - data_len, wlan_hdd_tdls_config_enable_policy)) { - hdd_err("Invalid ATTR"); - return -EINVAL; - } - if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { - hdd_err("attr mac addr failed"); - return -EINVAL; - } - memcpy(peer, nla_data(tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), - sizeof(peer)); - hdd_debug(MAC_ADDRESS_STR, MAC_ADDR_ARRAY(peer)); - if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { - hdd_err("attr channel failed"); - return -EINVAL; - } - pReqMsg.channel = - nla_get_s32(tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); - hdd_debug("Channel Num (%d)", pReqMsg.channel); - if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { - hdd_err("attr operating class failed"); - return -EINVAL; - } - pReqMsg.global_operating_class = - nla_get_s32(tb - [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); - hdd_debug("Operating class (%d)", - pReqMsg.global_operating_class); - if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { - hdd_err("attr latency failed"); - return -EINVAL; - } - pReqMsg.max_latency_ms = - nla_get_s32(tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); - - hdd_debug("Latency (%d)", pReqMsg.max_latency_ms); - - if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { - hdd_err("attr bandwidth failed"); - return -EINVAL; - } - pReqMsg.min_bandwidth_kbps = - nla_get_s32(tb - [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); - - hdd_debug("Bandwidth (%d)", pReqMsg.min_bandwidth_kbps); - - ret = wlan_hdd_tdls_extctrl_config_peer( - pAdapter, - peer, - wlan_hdd_cfg80211_exttdls_callback, - pReqMsg.channel, - pReqMsg.max_latency_ms, - pReqMsg. - global_operating_class, - pReqMsg.min_bandwidth_kbps); - EXIT(); - return ret; + /* TODO */ + return 0; } /** @@ -1924,41 +537,8 @@ static int __wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, const void *data, int data_len) { - u8 peer[ETH_ALEN] = {0}; - struct net_device *dev = wdev->netdev; - struct hdd_adapter *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); - struct hdd_context *hdd_ctx = wiphy_priv(wiphy); - struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; - QDF_STATUS status; - - ENTER_DEV(dev); - - if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { - hdd_err("Command not allowed in FTM mode"); - return -EPERM; - } - - status = wlan_hdd_validate_context(hdd_ctx); - if (0 != status) - return -EINVAL; - if (hdd_ctx->config->fTDLSExternalControl == false) - return -ENOTSUPP; - - if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, - data, data_len, wlan_hdd_tdls_config_disable_policy)) { - hdd_err("Invalid ATTR"); - return -EINVAL; - } - if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { - hdd_err("attr mac addr failed"); - return -EINVAL; - } - memcpy(peer, nla_data(tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), - sizeof(peer)); - hdd_debug(MAC_ADDRESS_STR, MAC_ADDR_ARRAY(peer)); - status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); - EXIT(); - return status; + /* TODO */ + return 0; } /** @@ -2192,92 +772,8 @@ int wlan_hdd_tdls_extctrl_config_peer(struct hdd_adapter *pAdapter, u32 max_latency, u32 op_class, u32 min_bandwidth) { - hddTdlsPeer_t *pTdlsPeer; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - int status = 0; - - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO, - "%s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, - __func__, MAC_ADDR_ARRAY(peer)); - if ((false == hdd_ctx->config->fTDLSExternalControl) || - (false == hdd_ctx->config->fEnableTDLSImplicitTrigger)) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO, - "%s TDLS External control or Implicit Trigger not enabled ", - __func__); - status = -ENOTSUPP; - goto ret_status; - } - - mutex_lock(&hdd_ctx->tdls_lock); - pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); - if (pTdlsPeer == NULL) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s: peer " MAC_ADDRESS_STR " does not exist", - __func__, MAC_ADDR_ARRAY(peer)); - status = -EINVAL; - goto rel_lock; - } - mutex_unlock(&hdd_ctx->tdls_lock); - - if (0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, true)) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s TDLS Add Force Peer Failed", __func__); - status = -EINVAL; - goto ret_status; - } - /* Update the peer mac to firmware, so firmware - * could update the connection table - */ - if (0 != wlan_hdd_tdls_update_peer_mac(pAdapter, peer, - eSME_TDLS_PEER_ADD_MAC_ADDR)) { - hdd_err("TDLS Peer mac update Failed " MAC_ADDRESS_STR, - MAC_ADDR_ARRAY(peer)); - status = -EINVAL; - goto ret_status; - } - - hdd_ctx->tdls_external_peer_count++; - - /* validate if off channel is DFS channel */ - if (wlan_reg_is_dfs_ch(hdd_ctx->hdd_pdev, chan)) { - hdd_err("Resetting TDLS off-channel from %d to %d", - chan, CFG_TDLS_PREFERRED_OFF_CHANNEL_NUM_DEFAULT); - chan = CFG_TDLS_PREFERRED_OFF_CHANNEL_NUM_DEFAULT; - } - - if (0 != wlan_hdd_tdls_set_extctrl_param(pAdapter, peer, - chan, max_latency, - op_class, min_bandwidth)) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s TDLS Set Peer's External Ctrl Parameter Failed", - __func__); - status = -EINVAL; - goto ret_status; - } - - mutex_lock(&hdd_ctx->tdls_lock); - pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); - if (pTdlsPeer == NULL) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s: peer " MAC_ADDRESS_STR " does not exist", - __func__, MAC_ADDR_ARRAY(peer)); - status = -EINVAL; - goto rel_lock; - } - if (0 != wlan_hdd_set_callback(pTdlsPeer, callback)) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s TDLS set callback Failed", __func__); - status = -EINVAL; - goto rel_lock; - } - - mutex_unlock(&hdd_ctx->tdls_lock); - - return status; -rel_lock: - mutex_unlock(&hdd_ctx->tdls_lock); -ret_status: - return status; + /* TODO */ + return 0; } /** @@ -2291,81 +787,8 @@ ret_status: int wlan_hdd_tdls_extctrl_deconfig_peer(struct hdd_adapter *pAdapter, const uint8_t *peer) { - hddTdlsPeer_t *pTdlsPeer; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); - int status = 0; - - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO, - "%s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, - __func__, MAC_ADDR_ARRAY(peer)); - if ((false == hdd_ctx->config->fTDLSExternalControl) || - (false == hdd_ctx->config->fEnableTDLSImplicitTrigger)) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO, - "%s TDLS External control or Implicit Trigger not enabled ", - __func__); - status = -ENOTSUPP; - goto ret_status; - } - - mutex_lock(&hdd_ctx->tdls_lock); - pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer); - if (NULL == pTdlsPeer) { - hdd_debug("peer matching" MAC_ADDRESS_STR "not found", - MAC_ADDR_ARRAY(peer)); - status = -EINVAL; - goto rel_lock; - } - - wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, - eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); - hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_EXT_CTRL, - pTdlsPeer->peerMac); - mutex_unlock(&hdd_ctx->tdls_lock); - - if (0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, false)) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s Failed", __func__); - status = -EINVAL; - goto ret_status; - } - - if (hdd_ctx->tdls_external_peer_count) - hdd_ctx->tdls_external_peer_count--; - - mutex_lock(&hdd_ctx->tdls_lock); - pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer); - if (NULL == pTdlsPeer) { - hdd_debug("peer matching" MAC_ADDRESS_STR "not found", - MAC_ADDR_ARRAY(peer)); - status = -EINVAL; - goto rel_lock; - } - if (0 != wlan_hdd_set_callback(pTdlsPeer, NULL)) { - QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, - "%s TDLS set callback Failed", __func__); - status = -EINVAL; - goto rel_lock; - } - - mutex_unlock(&hdd_ctx->tdls_lock); - - /* Update the peer mac to firmware, so firmware - * could update the connection table - */ - if (0 != wlan_hdd_tdls_update_peer_mac(pAdapter, peer, - eSME_TDLS_PEER_REMOVE_MAC_ADDR)) { - hdd_err("TDLS Peer mac update Failed " MAC_ADDRESS_STR, - MAC_ADDR_ARRAY(peer)); - status = -EINVAL; - goto ret_status; - } - - goto ret_status; - -rel_lock: - mutex_unlock(&hdd_ctx->tdls_lock); -ret_status: - return status; + /* TODO */ + return 0; } /** @@ -2495,46 +918,6 @@ int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, #endif /* End of FEATURE_WLAN_TDLS */ -/** - * wlan_hdd_tdls_find_first_connected_peer() - find the 1st connected tdls peer - * @adapter: Pointer to the HDD adapter - * - * This function searchs for the 1st connected TDLS peer - * - * Return: The first connected TDLS peer if found; NULL otherwise - */ -hddTdlsPeer_t * -wlan_hdd_tdls_find_first_connected_peer(struct hdd_adapter *adapter) -{ - int i; - struct list_head *head; - struct list_head *pos; - hddTdlsPeer_t *curr_peer = NULL; - tdlsCtx_t *hdd_tdls_ctx; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - - if (wlan_hdd_validate_context(hdd_ctx)) - return NULL; - - hdd_tdls_ctx = WLAN_HDD_GET_TDLS_CTX_PTR(adapter); - if (NULL == hdd_tdls_ctx) - return NULL; - - for (i = 0; i < TDLS_PEER_LIST_SIZE; i++) { - head = &hdd_tdls_ctx->peer_list[i]; - list_for_each(pos, head) { - curr_peer = list_entry(pos, hddTdlsPeer_t, node); - if (curr_peer && (curr_peer->link_status == - eTDLS_LINK_CONNECTED)) { - hdd_notice(MAC_ADDRESS_STR" eTDLS_LINK_CONNECTED", - MAC_ADDR_ARRAY(curr_peer->peerMac)); - return curr_peer; - } - } - } - return NULL; -} - /** * hdd_set_tdls_offchannel() - set tdls off-channel number * @adapter: Pointer to the HDD adapter @@ -2546,22 +929,7 @@ wlan_hdd_tdls_find_first_connected_peer(struct hdd_adapter *adapter) */ int hdd_set_tdls_offchannel(struct hdd_context *hdd_ctx, int offchannel) { - if ((true == hdd_ctx->config->fEnableTDLSOffChannel) && - (eTDLS_SUPPORT_ENABLED == hdd_ctx->tdls_mode || - eTDLS_SUPPORT_EXTERNAL_CONTROL == hdd_ctx->tdls_mode || - eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == hdd_ctx->tdls_mode)) { - if (offchannel < CFG_TDLS_PREFERRED_OFF_CHANNEL_NUM_MIN || - offchannel > CFG_TDLS_PREFERRED_OFF_CHANNEL_NUM_MAX) { - hdd_err("Invalid tdls off channel %u", offchannel); - return -EINVAL; - } - } else { - hdd_err("Either TDLS or TDLS Off-channel is not enabled"); - return -ENOTSUPP; - } - hdd_debug("change tdls off channel from %d to %d", - hdd_ctx->tdls_off_channel, offchannel); - hdd_ctx->tdls_off_channel = offchannel; + /* TODO */ return 0; } @@ -2576,37 +944,7 @@ int hdd_set_tdls_offchannel(struct hdd_context *hdd_ctx, int offchannel) */ int hdd_set_tdls_secoffchanneloffset(struct hdd_context *hdd_ctx, int offchanoffset) { - if ((true == hdd_ctx->config->fEnableTDLSOffChannel) && - (eTDLS_SUPPORT_ENABLED == hdd_ctx->tdls_mode || - eTDLS_SUPPORT_EXTERNAL_CONTROL == hdd_ctx->tdls_mode || - eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == hdd_ctx->tdls_mode)) { - hdd_ctx->tdls_channel_offset = 0; - - switch (offchanoffset) { - case TDLS_SEC_OFFCHAN_OFFSET_0: - hdd_ctx->tdls_channel_offset = (1 << BW_20_OFFSET_BIT); - break; - case TDLS_SEC_OFFCHAN_OFFSET_40PLUS: - case TDLS_SEC_OFFCHAN_OFFSET_40MINUS: - hdd_ctx->tdls_channel_offset = (1 << BW_40_OFFSET_BIT); - break; - case TDLS_SEC_OFFCHAN_OFFSET_80: - hdd_ctx->tdls_channel_offset = (1 << BW_80_OFFSET_BIT); - break; - case TDLS_SEC_OFFCHAN_OFFSET_160: - hdd_ctx->tdls_channel_offset = (1 << BW_160_OFFSET_BIT); - break; - default: - hdd_err("Invalid tdls secondary off channel offset %d", - offchanoffset); - return -EINVAL; - } /* end switch */ - } else { - hdd_err("Either TDLS or TDLS Off-channel is not enabled"); - return -ENOTSUPP; - } - hdd_debug("change tdls secondary off channel offset to 0x%x", - hdd_ctx->tdls_channel_offset); + /* TODO */ return 0; } @@ -2621,125 +959,8 @@ int hdd_set_tdls_secoffchanneloffset(struct hdd_context *hdd_ctx, int offchanoff */ int hdd_set_tdls_offchannelmode(struct hdd_adapter *adapter, int offchanmode) { - hddTdlsPeer_t *conn_peer = NULL; - struct hdd_station_ctx *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - sme_tdls_chan_switch_params chan_switch_params; - QDF_STATUS status = QDF_STATUS_E_FAILURE; - int ret_value = 0; - - if (offchanmode < ENABLE_CHANSWITCH || - offchanmode > DISABLE_CHANSWITCH) { - hdd_err("Invalid tdls off channel mode %d", offchanmode); - ret_value = -EINVAL; - goto ret_status; - } - if (eConnectionState_Associated != hdd_sta_ctx->conn_info.connState) { - hdd_err("tdls off channel mode req in not associated state %d", - offchanmode); - ret_value = -EPERM; - goto ret_status; - } - if ((true == hdd_ctx->config->fEnableTDLSOffChannel) && - (eTDLS_SUPPORT_ENABLED == hdd_ctx->tdls_mode || - eTDLS_SUPPORT_EXTERNAL_CONTROL == hdd_ctx->tdls_mode || - eTDLS_SUPPORT_EXPLICIT_TRIGGER_ONLY == hdd_ctx->tdls_mode)) { - mutex_lock(&hdd_ctx->tdls_lock); - conn_peer = wlan_hdd_tdls_find_first_connected_peer(adapter); - if (NULL == conn_peer) { - hdd_err("No TDLS Connected Peer"); - ret_value = -EPERM; - goto rel_lock; - } - } else { - hdd_err("TDLS Connection not supported"); - ret_value = -ENOTSUPP; - goto ret_status; - } - - hdd_debug("TDLS swmode=%d tdls_off_channel %d offchanoffset %d", - offchanmode, hdd_ctx->tdls_off_channel, - hdd_ctx->tdls_channel_offset); - - switch (offchanmode) { - case ENABLE_CHANSWITCH: - if (hdd_ctx->tdls_off_channel && - hdd_ctx->tdls_channel_offset) { - chan_switch_params.tdls_off_channel = - hdd_ctx->tdls_off_channel; - chan_switch_params.tdls_off_ch_bw_offset = - hdd_ctx->tdls_channel_offset; - chan_switch_params.opclass = - wlan_hdd_find_opclass(WLAN_HDD_GET_HAL_CTX(adapter), - chan_switch_params.tdls_off_channel, - chan_switch_params.tdls_off_ch_bw_offset); - } else { - hdd_err("TDLS off-channel parameters are not set yet!!!"); - ret_value = -EINVAL; - goto rel_lock; - } - break; - case DISABLE_CHANSWITCH: - chan_switch_params.tdls_off_channel = 0; - chan_switch_params.tdls_off_ch_bw_offset = 0; - chan_switch_params.opclass = 0; - break; - default: - hdd_err("Incorrect Parameters mode: %d tdls_off_channel: %d offchanoffset: %d", - offchanmode, hdd_ctx->tdls_off_channel, - hdd_ctx->tdls_channel_offset); - ret_value = -EINVAL; - goto rel_lock; - } /* end switch */ - - chan_switch_params.vdev_id = adapter->sessionId; - chan_switch_params.tdls_off_ch_mode = offchanmode; - chan_switch_params.is_responder = - conn_peer->is_responder; - qdf_mem_copy(&chan_switch_params.peer_mac_addr, - &conn_peer->peerMac, - sizeof(tSirMacAddr)); - hdd_debug("Peer " MAC_ADDRESS_STR - " vdevId: %d, off channel: %d, offset: %d, mode: %d, is_responder: %d", - MAC_ADDR_ARRAY(chan_switch_params.peer_mac_addr), - chan_switch_params.vdev_id, - chan_switch_params.tdls_off_channel, - chan_switch_params.tdls_off_ch_bw_offset, - chan_switch_params.tdls_off_ch_mode, - chan_switch_params.is_responder); - mutex_unlock(&hdd_ctx->tdls_lock); - - status = sme_send_tdls_chan_switch_req(WLAN_HDD_GET_HAL_CTX(adapter), - &chan_switch_params); - - if (status != QDF_STATUS_SUCCESS) { - hdd_err("Failed to send channel switch request to sme"); - ret_value = -EINVAL; - goto ret_status; - } - - hdd_ctx->tdls_fw_off_chan_mode = offchanmode; - - if (ENABLE_CHANSWITCH == offchanmode) { - mutex_lock(&hdd_ctx->tdls_lock); - conn_peer = wlan_hdd_tdls_find_first_connected_peer(adapter); - if (NULL == conn_peer) { - hdd_err("No TDLS Connected Peer"); - ret_value = -EPERM; - goto rel_lock; - } - conn_peer->pref_off_chan_num = - chan_switch_params.tdls_off_channel; - conn_peer->op_class_for_pref_off_chan = - chan_switch_params.opclass; - goto rel_lock; - } - goto ret_status; - -rel_lock: - mutex_unlock(&hdd_ctx->tdls_lock); -ret_status: - return ret_value; + /* TODO */ + return 0; } /** @@ -2769,90 +990,6 @@ int hdd_set_tdls_scan_type(struct hdd_context *hdd_ctx, int val) return 0; } -/** - * wlan_hdd_tdls_teardown_links() - teardown tdls links - * @hddCtx : pointer to hdd context - * - * Return: 0 if success else non zero - */ -static int wlan_hdd_tdls_teardown_links(struct hdd_context *hddctx, - uint32_t mode) -{ - uint16_t connected_tdls_peers = 0; - uint8_t staidx; - hddTdlsPeer_t *curr_peer; - struct hdd_adapter *adapter; - int ret = 0; - - if (eTDLS_SUPPORT_NOT_ENABLED == hddctx->tdls_mode) { - hdd_info("TDLS mode is disabled OR not enabled in FW"); - return 0; - } - - adapter = hdd_get_adapter(hddctx, QDF_STA_MODE); - - if (adapter == NULL) { - hdd_info("Station Adapter Not Found"); - return 0; - } - - connected_tdls_peers = wlan_hdd_tdls_connected_peers(adapter); - - if (!connected_tdls_peers) - return 0; - - 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; - } - - /* Check if connected peer supports more than one stream */ - if (curr_peer->spatial_streams == TDLS_NSS_1x1_MODE) { - mutex_unlock(&hddctx->tdls_lock); - continue; - } - - hdd_debug("Indicate TDLS teardown (staId %d)", - curr_peer->staId); - - wlan_hdd_tdls_indicate_teardown( - curr_peer->pHddTdlsCtx->pAdapter, - curr_peer, - eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); - hddctx->tdls_teardown_peers_cnt++; - mutex_unlock(&hddctx->tdls_lock); - } - mutex_lock(&hddctx->tdls_lock); - if (hddctx->tdls_teardown_peers_cnt >= 1) { - hddctx->tdls_nss_switch_in_progress = true; - hdd_debug("TDLS peers to be torn down = %d", - hddctx->tdls_teardown_peers_cnt); - /* Antenna switch 2x2 to 1x1 */ - if (mode == HDD_ANTENNA_MODE_1X1) { - hddctx->tdls_nss_transition_mode = - TDLS_NSS_TRANSITION_2x2_to_1x1; - ret = -EAGAIN; - } else { - /* Antenna switch 1x1 to 2x2 */ - hddctx->tdls_nss_transition_mode = - TDLS_NSS_TRANSITION_1x1_to_2x2; - ret = 0; - } - hdd_debug("TDLS teardown for antenna switch operation starts"); - } - mutex_unlock(&hddctx->tdls_lock); - return ret; -} - /** * wlan_hdd_tdls_antenna_switch() - Dynamic TDLS antenna switch 1x1 <-> 2x2 * antenna mode in standalone station @@ -2865,73 +1002,9 @@ int wlan_hdd_tdls_antenna_switch(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter, uint32_t mode) { - uint8_t tdls_peer_cnt; - uint32_t vdev_nss; - struct hdd_station_ctx *sta_ctx; - - if (hdd_ctx->connected_peer_count == 0) - return 0; - - sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); - /* Check whether TDLS antenna switch is in progress */ - if (hdd_ctx->tdls_nss_switch_in_progress) { - if (hdd_ctx->tdls_nss_teardown_complete == false) { - hdd_err("TDLS antenna switch is in progress"); - return -EAGAIN; - } - goto tdls_ant_sw_done; - } - - /* Check whether TDLS is connected or not */ - mutex_lock(&hdd_ctx->tdls_lock); - tdls_peer_cnt = hdd_ctx->connected_peer_count; - mutex_unlock(&hdd_ctx->tdls_lock); - if (tdls_peer_cnt <= 0) { - hdd_info("No TDLS connection established"); - goto tdls_ant_sw_done; - } - - /* Check the supported nss for TDLS */ - if (IS_5G_CH(sta_ctx->conn_info.operationChannel)) - vdev_nss = CFG_TDLS_NSS( - hdd_ctx->config->vdev_type_nss_5g); - else - vdev_nss = CFG_TDLS_NSS( - hdd_ctx->config->vdev_type_nss_2g); - - if (vdev_nss == HDD_ANTENNA_MODE_1X1) { - hdd_info("Supported NSS is 1X1, no need to teardown TDLS links"); - goto tdls_ant_sw_done; - } - - /* teardown all the tdls connections */ - return wlan_hdd_tdls_teardown_links(hdd_ctx, mode); - -tdls_ant_sw_done: return 0; } -bool cds_check_is_tdls_allowed(enum tQDF_ADAPTER_MODE device_mode) -{ - bool state = false; - uint32_t count; - struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); - - count = policy_mgr_get_connection_count(hdd_ctx->hdd_psoc); - - if (count > 1) - state = false; - else if (device_mode == QDF_STA_MODE || - device_mode == QDF_P2P_CLIENT_MODE) - state = true; - - /* If any concurrency is detected */ - if (!state) - hdd_ipa_set_tx_flow_info(); - - return state; -} - QDF_STATUS hdd_tdls_register_tdls_peer(void *userdata, uint32_t vdev_id, const uint8_t *mac, uint16_t sta_id, uint8_t ucastsig, uint8_t qos) diff --git a/core/mac/inc/ani_global.h b/core/mac/inc/ani_global.h index f6499a059e84..359cea70f857 100644 --- a/core/mac/inc/ani_global.h +++ b/core/mac/inc/ani_global.h @@ -927,10 +927,6 @@ typedef struct sAniSirGlobal { tp2pContext p2pContext; #endif -#ifdef FEATURE_WLAN_TDLS - bool is_tdls_power_save_prohibited; -#endif - uint8_t isCoalesingInIBSSAllowed; bool imps_enabled; diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index fd4b1a42a738..be4d0281cb30 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -678,13 +678,6 @@ bool sme_get_is_ft_feature_enabled(tHalHandle hHal); QDF_STATUS sme_update_roam_scan_offload_enabled(tHalHandle hHal, bool nRoamScanOffloadEnabled); bool sme_is_feature_supported_by_fw(enum cap_bitmap feature); -#ifdef FEATURE_WLAN_TDLS -void sme_set_tdls_power_save_prohibited(tHalHandle hHal, uint32_t sessionId, - bool val); -QDF_STATUS sme_send_tdls_chan_switch_req( - tHalHandle hal, - sme_tdls_chan_switch_params *ch_switch_params); -#endif /* * SME API to enable/disable WLAN driver initiated SSR @@ -739,8 +732,6 @@ QDF_STATUS sme_get_reg_info(tHalHandle hHal, uint8_t chanId, #ifdef FEATURE_WLAN_TDLS QDF_STATUS sme_update_fw_tdls_state(tHalHandle hHal, void *psmeTdlsParams, bool useSmeLock); -QDF_STATUS sme_update_tdls_peer_state(tHalHandle hHal, - tSmeTdlsPeerStateParams *pPeerStateParams); #endif /* FEATURE_WLAN_TDLS */ QDF_STATUS sme_ch_avoid_update_req(tHalHandle hHal); #ifdef FEATURE_WLAN_AUTO_SHUTDOWN diff --git a/core/sme/inc/sme_power_save.h b/core/sme/inc/sme_power_save.h index 793d0b0a63d9..58fe7fa578fa 100644 --- a/core/sme/inc/sme_power_save.h +++ b/core/sme/inc/sme_power_save.h @@ -103,9 +103,7 @@ struct ps_params { tpSirWakeReasonInd wake_reason_ind); void *wake_reason_ind_cb_ctx; #endif /* WLAN_WAKEUP_EVENTS */ -#ifdef FEATURE_WLAN_TDLS - bool is_tdls_power_save_prohibited; -#endif + /* * Auto Sta Ps Enable Timer * Upon expiration of this timer diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 6a48284f3fa6..4672897d3583 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -763,9 +763,6 @@ QDF_STATUS sme_open(tHalHandle hHal) sme_err("sme_ps_open failed with status: %d", status); return status; } -#ifdef FEATURE_WLAN_TDLS - pMac->is_tdls_power_save_prohibited = 0; -#endif #ifndef WLAN_MDM_CODE_REDUCTION_OPT status = sme_qos_open(pMac); @@ -8985,22 +8982,6 @@ bool sme_is_feature_supported_by_fw(enum cap_bitmap feature) } #ifdef FEATURE_WLAN_TDLS -/* --------------------------------------------------------------------------- - \fn sme_set_tdls_power_save_prohibited - \API to set/reset the is_tdls_power_save_prohibited. - - \- return void - -------------------------------------------------------------------------*/ -void sme_set_tdls_power_save_prohibited(tHalHandle hHal, uint32_t sessionId, - bool val) -{ - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - struct ps_global_info *ps_global_info = &pMac->sme.ps_global_info; - struct ps_params *ps_param = &ps_global_info->ps_params[sessionId]; - - ps_param->is_tdls_power_save_prohibited = val; -} - /* * sme_update_fw_tdls_state() - * SME will send message to WMA to set TDLS state in f/w @@ -9045,233 +9026,6 @@ QDF_STATUS sme_update_fw_tdls_state(tHalHandle hHal, void *psmeTdlsParams, return status; } - -/** - * sme_update_tdls_peer_state() - to update the state of TDLS peer - * @hHal: The handle returned by mac_open - * @peerStateParams: TDLS Peer state info to update in f/w - * - * SME will send message to WMA to set TDLS Peer state in f/w - * - * Return: QDF_STATUS - */ -QDF_STATUS sme_update_tdls_peer_state(tHalHandle hHal, - tSmeTdlsPeerStateParams *peerStateParams) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; - tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - tTdlsPeerStateParams *pTdlsPeerStateParams = NULL; - tTdlsPeerCapParams *peer_cap = NULL; - struct scheduler_msg message = {0}; - uint8_t num; - uint8_t peer_chan_len; - uint8_t chanId; - uint8_t i; - - status = sme_acquire_global_lock(&pMac->sme); - if (!QDF_IS_STATUS_SUCCESS(status)) - return status; - pTdlsPeerStateParams = qdf_mem_malloc(sizeof(*pTdlsPeerStateParams)); - if (NULL == pTdlsPeerStateParams) { - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, - FL("failed to allocate mem for tdls peer state param")); - sme_release_global_lock(&pMac->sme); - return QDF_STATUS_E_NOMEM; - } - - qdf_mem_copy(&pTdlsPeerStateParams->peerMacAddr, - &peerStateParams->peerMacAddr, sizeof(tSirMacAddr)); - pTdlsPeerStateParams->vdevId = peerStateParams->vdevId; - pTdlsPeerStateParams->peerState = peerStateParams->peerState; - - switch (peerStateParams->peerState) { - case eSME_TDLS_PEER_STATE_PEERING: - pTdlsPeerStateParams->peerState = - WMA_TDLS_PEER_STATE_PEERING; - break; - - case eSME_TDLS_PEER_STATE_CONNECTED: - pTdlsPeerStateParams->peerState = - WMA_TDLS_PEER_STATE_CONNECTED; - break; - - case eSME_TDLS_PEER_STATE_TEARDOWN: - pTdlsPeerStateParams->peerState = - WMA_TDLS_PEER_STATE_TEARDOWN; - pTdlsPeerStateParams->resp_reqd = false; - break; - - case eSME_TDLS_PEER_ADD_MAC_ADDR: - pTdlsPeerStateParams->peerState = WMA_TDLS_PEER_ADD_MAC_ADDR; - break; - - case eSME_TDLS_PEER_REMOVE_MAC_ADDR: - pTdlsPeerStateParams->peerState = WMA_TDLS_PEER_REMOVE_MAC_ADDR; - break; - - default: - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, - FL("invalid peer state param (%d)"), - peerStateParams->peerState); - goto error_return; - } - peer_cap = &(pTdlsPeerStateParams->peerCap); - peer_cap->isPeerResponder = - peerStateParams->peerCap.isPeerResponder; - peer_cap->peerUapsdQueue = - peerStateParams->peerCap.peerUapsdQueue; - peer_cap->peerMaxSp = - peerStateParams->peerCap.peerMaxSp; - peer_cap->peerBuffStaSupport = - peerStateParams->peerCap.peerBuffStaSupport; - peer_cap->peerOffChanSupport = - peerStateParams->peerCap.peerOffChanSupport; - peer_cap->peerCurrOperClass = - peerStateParams->peerCap.peerCurrOperClass; - peer_cap->selfCurrOperClass = - peerStateParams->peerCap.selfCurrOperClass; - - num = 0; - peer_chan_len = peerStateParams->peerCap.peerChanLen; - - if (peer_chan_len <= SME_TDLS_MAX_SUPP_CHANNELS) { - for (i = 0; i < peerStateParams->peerCap.peerChanLen; i++) { - chanId = peerStateParams->peerCap.peerChan[i]; - if (csr_roam_is_channel_valid(pMac, chanId) && - !(wlan_reg_get_channel_state(pMac->pdev, chanId) == - CHANNEL_STATE_DFS) && - !WLAN_REG_IS_11P_CH(chanId)) { - peer_cap->peerChan[num].chanId = chanId; - peer_cap->peerChan[num].pwr = - csr_get_cfg_max_tx_power(pMac, chanId); - peer_cap->peerChan[num].dfsSet = false; - num++; - } - } - } else { - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, - FL("invalid peer channel len (%d)"), - peer_chan_len); - goto error_return; - } - - peer_cap->peerChanLen = num; - peer_cap->peerOperClassLen = - peerStateParams->peerCap.peerOperClassLen; - for (i = 0; i < HAL_TDLS_MAX_SUPP_OPER_CLASSES; i++) { - peer_cap->peerOperClass[i] = - peerStateParams->peerCap.peerOperClass[i]; - } - - peer_cap->prefOffChanNum = - peerStateParams->peerCap.prefOffChanNum; - peer_cap->prefOffChanBandwidth = - peerStateParams->peerCap.prefOffChanBandwidth; - peer_cap->opClassForPrefOffChan = - peerStateParams->peerCap.opClassForPrefOffChan; - - message.type = WMA_UPDATE_TDLS_PEER_STATE; - message.reserved = 0; - message.bodyptr = pTdlsPeerStateParams; - - qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, - FL("scheduler_post_msg failed ")); - goto error_return; - } else { - goto success_return; - } - -error_return: - status = QDF_STATUS_E_FAILURE; - qdf_mem_free(pTdlsPeerStateParams); -success_return: - sme_release_global_lock(&pMac->sme); - return status; -} - -/** - * sme_send_tdls_chan_switch_req() - send tdls channel switch request - * @hal: UMAC handler - * @ch_switch_params: Pointer to the chan switch parameter structure - * - * API to set tdls channel switch parameters. - * - * Return: QDF_STATUS_SUCCESS on success; another QDF_STATUS_** code otherwise - */ -QDF_STATUS sme_send_tdls_chan_switch_req(tHalHandle hal, - sme_tdls_chan_switch_params *ch_switch_params) -{ - QDF_STATUS status = QDF_STATUS_SUCCESS; - QDF_STATUS qdf_status = QDF_STATUS_SUCCESS; - tpAniSirGlobal mac = PMAC_STRUCT(hal); - tdls_chan_switch_params *chan_switch_params = NULL; - struct scheduler_msg message = {0}; - - MTRACE(qdf_trace(QDF_MODULE_ID_SME, - TRACE_CODE_SME_RX_HDD_TDLS_CHAN_SWITCH_REQ, - NO_SESSION, ch_switch_params->tdls_off_channel)); - status = sme_acquire_global_lock(&mac->sme); - if (QDF_STATUS_SUCCESS != status) - return status; - chan_switch_params = qdf_mem_malloc(sizeof(*chan_switch_params)); - if (NULL == chan_switch_params) { - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, - FL("fail to alloc mem for tdls chan switch param")); - sme_release_global_lock(&mac->sme); - return QDF_STATUS_E_FAILURE; - } - - switch (ch_switch_params->tdls_off_ch_mode) { - case ENABLE_CHANSWITCH: - chan_switch_params->tdls_sw_mode = WMA_TDLS_ENABLE_OFFCHANNEL; - break; - - case DISABLE_CHANSWITCH: - chan_switch_params->tdls_sw_mode = WMA_TDLS_DISABLE_OFFCHANNEL; - break; - - default: - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, - FL("invalid off channel command (%d)"), - ch_switch_params->tdls_off_ch_mode); - qdf_mem_free(chan_switch_params); - sme_release_global_lock(&mac->sme); - return QDF_STATUS_E_FAILURE; - } - - qdf_mem_copy(&chan_switch_params->peer_mac_addr, - &ch_switch_params->peer_mac_addr, sizeof(tSirMacAddr)); - chan_switch_params->vdev_id = ch_switch_params->vdev_id; - chan_switch_params->tdls_off_ch = ch_switch_params->tdls_off_channel; - chan_switch_params->tdls_off_ch_bw_offset = - ch_switch_params->tdls_off_ch_bw_offset; - chan_switch_params->is_responder = ch_switch_params->is_responder; - chan_switch_params->oper_class = ch_switch_params->opclass; - - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, - FL("Country Code=%s, Req offset=%d, Selected Operate Class=%d"), - mac->scan.countryCodeCurrent, - chan_switch_params->tdls_off_ch_bw_offset, - chan_switch_params->oper_class); - - message.type = WMA_TDLS_SET_OFFCHAN_MODE; - message.reserved = 0; - message.bodyptr = chan_switch_params; - - qdf_status = scheduler_post_msg(QDF_MODULE_ID_WMA, &message); - if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { - QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, - FL("Message Post failed status=%d"), - qdf_status); - qdf_mem_free(chan_switch_params); - status = QDF_STATUS_E_FAILURE; - } - sme_release_global_lock(&mac->sme); - return status; -} #endif /* FEATURE_WLAN_TDLS */ QDF_STATUS sme_get_link_speed(tHalHandle hHal, tSirLinkSpeedInfo *lsReq,