]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - drivers/staging/rtl8192e/dot11d.h
Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[mirror_ubuntu-artful-kernel.git] / drivers / staging / rtl8192e / dot11d.h
CommitLineData
94a79942
LF
1/******************************************************************************
2 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
3 *
4 * This program is distributed in the hope that it will be useful, but WITHOUT
5 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
7 * more details.
8 *
94a79942
LF
9 * The full GNU General Public License is included in this distribution in the
10 * file called LICENSE.
11 *
12 * Contact Information:
13 * wlanfae <wlanfae@realtek.com>
284a4e3a 14 ******************************************************************************/
94a79942
LF
15#ifndef __INC_DOT11D_H
16#define __INC_DOT11D_H
17
18#include "rtllib.h"
19
94a79942 20struct chnl_txpow_triple {
ecdfa446
GKH
21 u8 FirstChnl;
22 u8 NumChnls;
23 u8 MaxTxPowerInDbm;
45ce3f6f 24};
ecdfa446 25
94a79942 26enum dot11d_state {
ecdfa446
GKH
27 DOT11D_STATE_NONE = 0,
28 DOT11D_STATE_LEARNED,
29 DOT11D_STATE_DONE,
45ce3f6f 30};
789d9dbd
RV
31
32/**
66cd0471
KM
33 * struct rt_dot11d_info * @CountryIeLen: value greater than 0 if
34 * @CountryIeBuf contains valid country information element.
e0e2615a 35 * @channel_map: holds channel values
789d9dbd
RV
36 * 0 - invalid,
37 * 1 - valid (active scan),
dc6b15f3 38 * 2 - valid (passive scan)
789d9dbd
RV
39 * @CountryIeSrcAddr - Source AP of the country IE
40 */
ecdfa446 41
94a79942 42struct rt_dot11d_info {
789d9dbd 43 bool bEnabled;
ecdfa446 44
789d9dbd 45 u16 CountryIeLen;
94a79942
LF
46 u8 CountryIeBuf[MAX_IE_LEN];
47 u8 CountryIeSrcAddr[6];
48 u8 CountryIeWatchdog;
ecdfa446 49
986fb011
NS
50 u8 channel_map[MAX_CHANNEL_NUMBER + 1];
51 u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER + 1];
ecdfa446 52
94a79942 53 enum dot11d_state State;
45ce3f6f 54};
789d9dbd 55
dd184733
MM
56static inline void cpMacAddr(unsigned char *des, unsigned char *src)
57{
58 memcpy(des, src, 6);
59}
789d9dbd 60
94a79942
LF
61#define GET_DOT11D_INFO(__pIeeeDev) \
62 ((struct rt_dot11d_info *)((__pIeeeDev)->pDot11dInfo))
ecdfa446 63
94a79942
LF
64#define IS_DOT11D_ENABLE(__pIeeeDev) \
65 (GET_DOT11D_INFO(__pIeeeDev)->bEnabled)
66#define IS_COUNTRY_IE_VALID(__pIeeeDev) \
67 (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0)
ecdfa446 68
94a79942 69#define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) \
35e33b04
MK
70 ether_addr_equal_unaligned( \
71 GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
94a79942
LF
72#define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \
73 cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
ecdfa446 74
94a79942
LF
75#define GET_CIE_WATCHDOG(__pIeeeDev) \
76 (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog)
fa7b3d02
HS
77static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev)
78{
79 GET_CIE_WATCHDOG(__pIeeeDev) = 0;
80}
8e9253b7 81
dc6b15f3 82#define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev))
ecdfa446 83
976d5341 84void dot11d_init(struct rtllib_device *dev);
94a79942
LF
85void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee);
86void Dot11d_Reset(struct rtllib_device *dev);
87void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr,
88 u16 CoutryIeLen, u8 *pCoutryIe);
94a79942 89void DOT11D_ScanComplete(struct rtllib_device *dev);
789d9dbd 90
94a79942 91#endif