blob: 4ff54c72872bdef06f600bfae533113a10c29bc0 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
2 * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28#if !defined(__SMEINTERNAL_H)
29#define __SMEINTERNAL_H
30
31/**
32 * \file sme_internal.h
33 *
34 * \brief prototype for SME internal structures and APIs used for SME and MAC
35 */
36
37/*--------------------------------------------------------------------------
38 Include Files
39 ------------------------------------------------------------------------*/
40#include "cdf_status.h"
41#include "cdf_lock.h"
42#include "cdf_trace.h"
43#include "cdf_memory.h"
44#include "cdf_types.h"
45#include "host_diag_core_event.h"
46#include "csr_link_list.h"
47#include "sme_power_save.h"
48
49/*--------------------------------------------------------------------------
50 Type declarations
51 ------------------------------------------------------------------------*/
52
53/* Mask can be only have one bit set */
54typedef enum eSmeCommandType {
55 eSmeNoCommand = 0,
56 eSmeDropCommand,
57 /* this is not a command, it is to identify this is a CSR command */
58 eSmeCsrCommandMask = 0x10000,
59 eSmeCommandScan,
60 eSmeCommandRoam,
61 eSmeCommandWmStatusChange,
62 eSmeCommandSetKey,
63 eSmeCommandAddStaSession,
64 eSmeCommandDelStaSession,
65#ifdef FEATURE_WLAN_TDLS
66 /*
67 * eSmeTdlsCommandMask = 0x80000,
68 * To identify TDLS commands <TODO>
69 * These can be considered as csr commands.
70 */
71 eSmeCommandTdlsSendMgmt,
72 eSmeCommandTdlsAddPeer,
73 eSmeCommandTdlsDelPeer,
74 eSmeCommandTdlsLinkEstablish,
75#endif
76 /* PMC */
77 eSmePmcCommandMask = 0x20000, /* To identify PMC commands */
78 eSmeCommandEnterBmps,
79 eSmeCommandExitBmps,
80 eSmeCommandEnterUapsd,
81 eSmeCommandExitUapsd,
82 eSmeCommandExitWowl,
83 eSmeCommandEnterStandby,
84 /* QOS */
85 eSmeQosCommandMask = 0x40000, /* To identify Qos commands */
86 eSmeCommandAddTs,
87 eSmeCommandDelTs,
88#ifdef FEATURE_OEM_DATA_SUPPORT
89 eSmeCommandOemDataReq = 0x80000, /* To identify the oem data commands */
90#endif
91 eSmeCommandRemainOnChannel,
92 e_sme_command_set_hw_mode,
93 e_sme_command_nss_update,
94 e_sme_command_set_dual_mac_config,
95} eSmeCommandType;
96
97typedef enum eSmeState {
98 SME_STATE_STOP,
99 SME_STATE_START,
100 SME_STATE_READY,
101} eSmeState;
102
103#define SME_IS_START(pMac) (SME_STATE_STOP != (pMac)->sme.state)
104#define SME_IS_READY(pMac) (SME_STATE_READY == (pMac)->sme.state)
105
106typedef struct sStatsExtEvent {
107 uint32_t vdev_id;
108 uint32_t event_data_len;
109 uint8_t event_data[];
110} tStatsExtEvent, *tpStatsExtEvent;
111
112#define MAX_ACTIVE_CMD_STATS 16
113
114typedef struct sActiveCmdStats {
115 eSmeCommandType command;
116 uint32_t reason;
117 uint32_t sessionId;
118 uint64_t timestamp;
119} tActiveCmdStats;
120
121typedef struct sSelfRecoveryStats {
122 tActiveCmdStats activeCmdStats[MAX_ACTIVE_CMD_STATS];
123 uint8_t cmdStatsIndx;
124} tSelfRecoveryStats;
125
126#ifdef WLAN_FEATURE_GTK_OFFLOAD
127/* GTK Offload Information Callback declaration */
128typedef void (*gtk_offload_get_info_callback)(void *callback_context,
129 tpSirGtkOffloadGetInfoRspParams
130 pGtkOffloadGetInfoRsp);
131#endif
132#ifdef FEATURE_WLAN_SCAN_PNO
133/*Pref netw found Cb declaration*/
134typedef void (*preferred_network_found_ind_cb)(void *callback_context,
135 tpSirPrefNetworkFoundInd
136 pPrefNetworkFoundInd);
137#endif
138
139typedef void (*ocb_callback)(void *context, void *response);
140typedef void (*sme_set_thermal_level_callback)(void *context, u_int8_t level);
141
142typedef struct tagSmeStruct {
143 eSmeState state;
144 cdf_mutex_t lkSmeGlobalLock;
145 uint32_t totalSmeCmd;
146 void *pSmeCmdBufAddr;
147 tDblLinkList smeCmdActiveList;
148 tDblLinkList smeCmdPendingList;
149 tDblLinkList smeCmdFreeList; /* preallocated roam cmd list */
150 tCDF_CON_MODE currDeviceMode;
151#ifdef FEATURE_WLAN_LPHB
152 void (*pLphbIndCb)(void *pHddCtx, tSirLPHBInd *indParam);
153#endif /* FEATURE_WLAN_LPHB */
154 /* pending scan command list */
155 tDblLinkList smeScanCmdPendingList;
156 /* active scan command list */
157 tDblLinkList smeScanCmdActiveList;
158#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
159 host_event_wlan_status_payload_type eventPayload;
160#endif
161#ifdef FEATURE_WLAN_CH_AVOID
162 void (*pChAvoidNotificationCb)(void *hdd_context, void *indi_param);
163#endif /* FEATURE_WLAN_CH_AVOID */
164#ifdef WLAN_FEATURE_LINK_LAYER_STATS
165 void (*pLinkLayerStatsIndCallback)(void *callbackContext,
166 int indType, void *pRsp);
167#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
168#ifdef FEATURE_WLAN_AUTO_SHUTDOWN
169 void (*pAutoShutdownNotificationCb)(void);
170#endif
171 /* Maximum interfaces allowed by the host */
172 uint8_t max_intf_count;
173 void (*StatsExtCallback)(void *, tStatsExtEvent *);
174 /* linkspeed callback */
175 void (*pLinkSpeedIndCb)(tSirLinkSpeedInfo *indParam,
176 void *pDevContext);
177 void *pLinkSpeedCbContext;
178#ifdef FEATURE_WLAN_EXTSCAN
179 void (*pExtScanIndCb)(void *, const uint16_t, void *);
180#endif /* FEATURE_WLAN_EXTSCAN */
181#ifdef WLAN_FEATURE_NAN
182 void (*nanCallback)(void *, tSirNanEvent *);
183#endif
184 bool enableSelfRecovery;
185 tCsrLinkStatusCallback linkStatusCallback;
186 void *linkStatusContext;
187 /* get temperature event context and callback */
188 void *pTemperatureCbContext;
189 void (*pGetTemperatureCb)(int temperature, void *context);
190 uint8_t miracast_value;
191 struct ps_global_info ps_global_info;
192#ifdef WLAN_FEATURE_GTK_OFFLOAD
193 /* routine to call for GTK Offload Information */
194 gtk_offload_get_info_callback gtk_offload_get_info_cb;
195 /* value to be passed as parameter to routine specified above */
196 void *gtk_offload_get_info_cb_context;
197#endif /* WLAN_FEATURE_GTK_OFFLOAD */
198#ifdef FEATURE_WLAN_SCAN_PNO
199 /* routine to call for Preferred Network Found Indication */
200 preferred_network_found_ind_cb pref_netw_found_cb;
201 /* value to be passed as parameter to routine specified above */
202 void *preferred_network_found_ind_cb_ctx;
203#endif /* FEATURE_WLAN_SCAN_PNO */
204 void (*rssi_threshold_breached_cb)(void *, struct rssi_breach_event *);
205#ifdef WLAN_FEATURE_MEMDUMP
206 void (*fw_dump_callback)(void *context, struct fw_dump_rsp *rsp);
207#endif
208 hw_mode_transition_cb sme_hw_mode_trans_cb;
209 /* OCB callbacks */
210 void *ocb_set_config_context;
211 ocb_callback ocb_set_config_callback;
212 void *ocb_get_tsf_timer_context;
213 ocb_callback ocb_get_tsf_timer_callback;
214 void *dcc_get_stats_context;
215 ocb_callback dcc_get_stats_callback;
216 void *dcc_update_ndl_context;
217 ocb_callback dcc_update_ndl_callback;
218 void *dcc_stats_event_context;
219 ocb_callback dcc_stats_event_callback;
220 sme_set_thermal_level_callback set_thermal_level_cb;
221} tSmeStruct, *tpSmeStruct;
222
223#endif /* #if !defined( __SMEINTERNAL_H ) */