Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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 *
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>
14 ******************************************************************************/
15#ifndef __INC_DOT11D_H
16#define __INC_DOT11D_H
17
18#include "rtllib.h"
19
20struct chnl_txpow_triple {
21 u8 FirstChnl;
22 u8 NumChnls;
23 u8 MaxTxPowerInDbm;
24};
25
26enum dot11d_state {
27 DOT11D_STATE_NONE = 0,
28 DOT11D_STATE_LEARNED,
29 DOT11D_STATE_DONE,
30};
31
32/**
33 * struct rt_dot11d_info * @CountryIeLen: value greater than 0 if
34 * @CountryIeBuf contains valid country information element.
35 * @channel_map: holds channel values
36 * 0 - invalid,
37 * 1 - valid (active scan),
38 * 2 - valid (passive scan)
39 * @CountryIeSrcAddr - Source AP of the country IE
40 */
41
42struct rt_dot11d_info {
43 bool bEnabled;
44
45 u16 CountryIeLen;
46 u8 CountryIeBuf[MAX_IE_LEN];
47 u8 CountryIeSrcAddr[6];
48 u8 CountryIeWatchdog;
49
50 u8 channel_map[MAX_CHANNEL_NUMBER + 1];
51 u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER + 1];
52
53 enum dot11d_state State;
54};
55
56static inline void cpMacAddr(unsigned char *des, unsigned char *src)
57{
58 memcpy(des, src, 6);
59}
60
61#define GET_DOT11D_INFO(__pIeeeDev) \
62 ((struct rt_dot11d_info *)((__pIeeeDev)->pDot11dInfo))
63
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)
68
69#define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) \
70 ether_addr_equal_unaligned( \
71 GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
72#define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \
73 cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
74
75#define GET_CIE_WATCHDOG(__pIeeeDev) \
76 (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog)
77static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev)
78{
79 GET_CIE_WATCHDOG(__pIeeeDev) = 0;
80}
81
82#define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev))
83
84void dot11d_init(struct rtllib_device *dev);
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);
89void DOT11D_ScanComplete(struct rtllib_device *dev);
90
91#endif