wifi: renew patch drivers/net/wireless
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / mt5931_kk / drv_wlan / include / mgmt / cnm.h
1 /*
2 ** $Id: //Department/DaVinci/BRANCHES/MT662X_593X_WIFI_DRIVER_V2_3/include/mgmt/cnm.h#1 $
3 */
4
5 /*! \file   "cnm.h"
6     \brief
7 */
8
9 /*******************************************************************************
10 * Copyright (c) 2009 MediaTek Inc.
11 *
12 * All rights reserved. Copying, compilation, modification, distribution
13 * or any other use whatsoever of this material is strictly prohibited
14 * except in accordance with a Software License Agreement with
15 * MediaTek Inc.
16 ********************************************************************************
17 */
18
19 /*******************************************************************************
20 * LEGAL DISCLAIMER
21 *
22 * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND
23 * AGREES THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK
24 * SOFTWARE") RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
25 * PROVIDED TO BUYER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY
26 * DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
27 * LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
28 * PARTICULAR PURPOSE OR NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE
29 * ANY WARRANTY WHATSOEVER WITH RESPECT TO THE SOFTWARE OF ANY THIRD PARTY
30 * WHICH MAY BE USED BY, INCORPORATED IN, OR SUPPLIED WITH THE MEDIATEK
31 * SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY
32 * WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE
33 * FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S SPECIFICATION OR TO
34 * CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
35 *
36 * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
37 * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL
38 * BE, AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT
39 * ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
40 * BUYER TO MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
41 *
42 * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
43 * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT
44 * OF LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING
45 * THEREOF AND RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN
46 * FRANCISCO, CA, UNDER THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE
47 * (ICC).
48 ********************************************************************************
49 */
50
51 /*
52 ** $Log: cnm.h $
53  *
54  * 06 23 2011 cp.wu
55  * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
56  * change parameter name from PeerAddr to BSSID
57  *
58  * 06 20 2011 cp.wu
59  * [WCXRP00000798] [MT6620 Wi-Fi][Firmware] Follow-ups for WAPI frequency offset workaround in firmware SCN module
60  * 1. specify target's BSSID when requesting channel privilege.
61  * 2. pass BSSID information to firmware domain
62  *
63  * 04 12 2011 cm.chang
64  * [WCXRP00000634] [MT6620 Wi-Fi][Driver][FW] 2nd BSS will not support 40MHz bandwidth for concurrency
65  * .
66  *
67  * 03 10 2011 cm.chang
68  * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module
69  * Add some functions to let AIS/Tethering or AIS/BOW be the same channel
70  *
71  * 01 12 2011 cm.chang
72  * [WCXRP00000358] [MT6620 Wi-Fi][Driver] Provide concurrent information for each module
73  * Provide function to decide if BSS can be activated or not
74  *
75  * 12 07 2010 cm.chang
76  * [WCXRP00000239] MT6620 Wi-Fi][Driver][FW] Merge concurrent branch back to maintrunk
77  * 1. BSSINFO include RLM parameter
78  * 2. free all sta records when network is disconnected
79  *
80  * 08 24 2010 cm.chang
81  * NULL
82  * Support RLM initail channel of Ad-hoc, P2P and BOW
83  *
84  * 07 19 2010 cm.chang
85  *
86  * Set RLM parameters and enable CNM channel manager
87  *
88  * 07 13 2010 cm.chang
89  *
90  * Rename MSG_CH_RELEASE_T to MSG_CH_ABORT_T
91  *
92  * 07 08 2010 cp.wu
93  *
94  * [WPD00003833] [MT6620 and MT5931] Driver migration - move to new repository.
95  *
96  * 07 08 2010 cm.chang
97  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
98  * Rename MID_MNY_CNM_CH_RELEASE to MID_MNY_CNM_CH_ABORT
99  *
100  * 07 01 2010 cm.chang
101  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
102  * Need bandwidth info when requesting channel privilege
103  *
104  * 07 01 2010 cm.chang
105  * [WPD00003841][LITE Driver] Migrate RLM/CNM to host driver
106  * Modify CNM message handler for new flow
107  *
108  * 05 12 2010 kevin.huang
109  * [BORA00000794][WIFISYS][New Feature]Power Management Support
110  * Add Power Management - Legacy PS-POLL support.
111  *
112  * 05 05 2010 cm.chang
113  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
114  * Add a new function to send abort message
115  *
116  * 03 16 2010 kevin.huang
117  * [BORA00000663][WIFISYS][New Feature] AdHoc Mode Support
118  * Add AdHoc Mode
119  *
120  * 03 10 2010 kevin.huang
121  * [BORA00000654][WIFISYS][New Feature] CNM Module - Ch Manager Support
122  * Add Channel Manager for arbitration of JOIN and SCAN Req
123  *
124  * 02 08 2010 cm.chang
125  * [BORA00000018]Integrate WIFI part into BORA for the 1st time
126  * Support partial part about cmd basic configuration
127  *
128  * Nov 18 2009 mtk01104
129  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
130  * Add prototype of cnmFsmEventInit()
131  *
132  * Nov 2 2009 mtk01104
133  * [BORA00000018] Integrate WIFI part into BORA for the 1st time
134  *
135 **
136 */
137
138 #ifndef _CNM_H
139 #define _CNM_H
140
141 /*******************************************************************************
142 *                         C O M P I L E R   F L A G S
143 ********************************************************************************
144 */
145
146 /*******************************************************************************
147 *                    E X T E R N A L   R E F E R E N C E S
148 ********************************************************************************
149 */
150
151 /*******************************************************************************
152 *                              C O N S T A N T S
153 ********************************************************************************
154 */
155
156 /*******************************************************************************
157 *                             D A T A   T Y P E S
158 ********************************************************************************
159 */
160
161 typedef enum _ENUM_CH_REQ_TYPE_T {
162     CH_REQ_TYPE_JOIN,
163     CH_REQ_TYPE_P2P_LISTEN,
164
165     CH_REQ_TYPE_NUM
166 } ENUM_CH_REQ_TYPE_T, *P_ENUM_CH_REQ_TYPE_T;
167
168 typedef struct _MSG_CH_REQ_T {
169     MSG_HDR_T           rMsgHdr;    /* Must be the first member */
170     UINT_8              ucNetTypeIndex;
171     UINT_8              ucTokenID;
172     UINT_8              ucPrimaryChannel;
173     ENUM_CHNL_EXT_T     eRfSco;
174     ENUM_BAND_T         eRfBand;
175     ENUM_CH_REQ_TYPE_T  eReqType;
176     UINT_32             u4MaxInterval;  /* In unit of ms */
177     UINT_8              aucBSSID[6];
178     UINT_8              aucReserved[2];
179 } MSG_CH_REQ_T, *P_MSG_CH_REQ_T;
180
181 typedef struct _MSG_CH_ABORT_T {
182     MSG_HDR_T           rMsgHdr;    /* Must be the first member */
183     UINT_8              ucNetTypeIndex;
184     UINT_8              ucTokenID;
185 } MSG_CH_ABORT_T, *P_MSG_CH_ABORT_T;
186
187 typedef struct _MSG_CH_GRANT_T {
188     MSG_HDR_T           rMsgHdr;    /* Must be the first member */
189     UINT_8              ucNetTypeIndex;
190     UINT_8              ucTokenID;
191     UINT_8              ucPrimaryChannel;
192     ENUM_CHNL_EXT_T     eRfSco;
193     ENUM_BAND_T         eRfBand;
194     ENUM_CH_REQ_TYPE_T  eReqType;
195     UINT_32             u4GrantInterval;    /* In unit of ms */
196 } MSG_CH_GRANT_T, *P_MSG_CH_GRANT_T;
197
198 typedef struct _MSG_CH_REOCVER_T {
199     MSG_HDR_T           rMsgHdr;    /* Must be the first member */
200     UINT_8              ucNetTypeIndex;
201     UINT_8              ucTokenID;
202     UINT_8              ucPrimaryChannel;
203     ENUM_CHNL_EXT_T     eRfSco;
204     ENUM_BAND_T         eRfBand;
205     ENUM_CH_REQ_TYPE_T  eReqType;
206 } MSG_CH_RECOVER_T, *P_MSG_CH_RECOVER_T;
207
208
209 typedef struct _CNM_INFO_T {
210     UINT_32     u4Reserved;
211 } CNM_INFO_T, *P_CNM_INFO_T;
212
213 #if CFG_ENABLE_WIFI_DIRECT
214 /* Moved from p2p_fsm.h */
215 typedef struct _DEVICE_TYPE_T {
216     UINT_16     u2CategoryId;           /* Category ID */
217     UINT_8      aucOui[4];              /* OUI */
218     UINT_16     u2SubCategoryId;        /* Sub Category ID */
219 } __KAL_ATTRIB_PACKED__ DEVICE_TYPE_T, *P_DEVICE_TYPE_T;
220 #endif
221
222
223 /*******************************************************************************
224 *                            P U B L I C   D A T A
225 ********************************************************************************
226 */
227
228 /*******************************************************************************
229 *                           P R I V A T E   D A T A
230 ********************************************************************************
231 */
232
233 /*******************************************************************************
234 *                                 M A C R O S
235 ********************************************************************************
236 */
237
238 /*******************************************************************************
239 *                   F U N C T I O N   D E C L A R A T I O N S
240 ********************************************************************************
241 */
242 VOID
243 cnmInit (
244     P_ADAPTER_T prAdapter
245     );
246
247 VOID
248 cnmUninit (
249     P_ADAPTER_T     prAdapter
250     );
251
252 VOID
253 cnmChMngrRequestPrivilege (
254     P_ADAPTER_T prAdapter,
255     P_MSG_HDR_T prMsgHdr
256     );
257
258 VOID
259 cnmChMngrAbortPrivilege (
260     P_ADAPTER_T prAdapter,
261     P_MSG_HDR_T prMsgHdr
262     );
263
264 VOID
265 cnmChMngrHandleChEvent (
266     P_ADAPTER_T     prAdapter,
267     P_WIFI_EVENT_T  prEvent
268     );
269
270 BOOLEAN
271 cnmPreferredChannel (
272     P_ADAPTER_T         prAdapter,
273     P_ENUM_BAND_T       prBand,
274     PUINT_8             pucPrimaryChannel,
275     P_ENUM_CHNL_EXT_T   prBssSCO
276     );
277
278 BOOLEAN
279 cnmAisInfraChannelFixed (
280     P_ADAPTER_T         prAdapter,
281     P_ENUM_BAND_T       prBand,
282     PUINT_8             pucPrimaryChannel
283     );
284
285 VOID
286 cnmAisInfraConnectNotify (
287     P_ADAPTER_T         prAdapter
288     );
289
290 BOOLEAN
291 cnmAisIbssIsPermitted (
292     P_ADAPTER_T     prAdapter
293     );
294
295 BOOLEAN
296 cnmP2PIsPermitted (
297     P_ADAPTER_T     prAdapter
298     );
299
300 BOOLEAN
301 cnmBowIsPermitted (
302     P_ADAPTER_T     prAdapter
303     );
304
305 BOOLEAN
306 cnmBss40mBwPermitted (
307     P_ADAPTER_T                 prAdapter,
308     ENUM_NETWORK_TYPE_INDEX_T   eNetTypeIdx
309     );
310
311 /*******************************************************************************
312 *                              F U N C T I O N S
313 ********************************************************************************
314 */
315 #ifndef _lint
316 /* We don't have to call following function to inspect the data structure.
317  * It will check automatically while at compile time.
318  * We'll need this to guarantee the same member order in different structures
319  * to simply handling effort in some functions.
320  */
321 __KAL_INLINE__ VOID
322 cnmMsgDataTypeCheck (
323     VOID
324     )
325 {
326     DATA_STRUC_INSPECTING_ASSERT(
327         OFFSET_OF(MSG_CH_GRANT_T,rMsgHdr) == 0);
328
329     DATA_STRUC_INSPECTING_ASSERT(
330         OFFSET_OF(MSG_CH_GRANT_T,rMsgHdr) ==
331         OFFSET_OF(MSG_CH_RECOVER_T,rMsgHdr));
332
333     DATA_STRUC_INSPECTING_ASSERT(
334         OFFSET_OF(MSG_CH_GRANT_T,ucNetTypeIndex) ==
335         OFFSET_OF(MSG_CH_RECOVER_T,ucNetTypeIndex));
336
337     DATA_STRUC_INSPECTING_ASSERT(
338         OFFSET_OF(MSG_CH_GRANT_T,ucTokenID) ==
339         OFFSET_OF(MSG_CH_RECOVER_T,ucTokenID));
340
341     DATA_STRUC_INSPECTING_ASSERT(
342         OFFSET_OF(MSG_CH_GRANT_T,ucPrimaryChannel) ==
343         OFFSET_OF(MSG_CH_RECOVER_T,ucPrimaryChannel));
344
345     DATA_STRUC_INSPECTING_ASSERT(
346         OFFSET_OF(MSG_CH_GRANT_T,eRfSco) ==
347         OFFSET_OF(MSG_CH_RECOVER_T,eRfSco));
348
349     DATA_STRUC_INSPECTING_ASSERT(
350         OFFSET_OF(MSG_CH_GRANT_T,eRfBand) ==
351         OFFSET_OF(MSG_CH_RECOVER_T,eRfBand));
352
353     DATA_STRUC_INSPECTING_ASSERT(
354         OFFSET_OF(MSG_CH_GRANT_T,eReqType) ==
355         OFFSET_OF(MSG_CH_RECOVER_T,eReqType));
356
357     return;
358 }
359 #endif /* _lint */
360
361 #endif /* _CNM_H */
362
363