Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 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 | * You should have received a copy of the GNU General Public License along with |
| 10 | * this program; if not, write to the Free Software Foundation, Inc., |
| 11 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA |
| 12 | * |
| 13 | * The full GNU General Public License is included in this distribution in the |
| 14 | * file called LICENSE. |
| 15 | * |
| 16 | * Contact Information: |
| 17 | * wlanfae <wlanfae@realtek.com> |
| 18 | ******************************************************************************/ |
| 19 | #ifndef __INC_DOT11D_H |
| 20 | #define __INC_DOT11D_H |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 21 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 22 | #include "rtllib.h" |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 23 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 24 | |
| 25 | |
| 26 | struct chnl_txpow_triple { |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 27 | u8 FirstChnl; |
| 28 | u8 NumChnls; |
| 29 | u8 MaxTxPowerInDbm; |
Ken O'Brien | 45ce3f6 | 2011-06-05 18:24:33 +0100 | [diff] [blame] | 30 | }; |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 31 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 32 | enum dot11d_state { |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 33 | DOT11D_STATE_NONE = 0, |
| 34 | DOT11D_STATE_LEARNED, |
| 35 | DOT11D_STATE_DONE, |
Ken O'Brien | 45ce3f6 | 2011-06-05 18:24:33 +0100 | [diff] [blame] | 36 | }; |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 37 | |
| 38 | /** |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 39 | * struct rt_dot11d_info * @CountryIeLen: value greater than 0 if @CountryIeBuf contains |
Ken O'Brien | dc6b15f | 2011-06-05 18:24:32 +0100 | [diff] [blame] | 40 | * valid country information element. |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 41 | * @chanell_map: holds channel values |
| 42 | * 0 - invalid, |
| 43 | * 1 - valid (active scan), |
Ken O'Brien | dc6b15f | 2011-06-05 18:24:32 +0100 | [diff] [blame] | 44 | * 2 - valid (passive scan) |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 45 | * @CountryIeSrcAddr - Source AP of the country IE |
| 46 | */ |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 47 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 48 | struct rt_dot11d_info { |
| 49 | |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 50 | bool bEnabled; |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 51 | |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 52 | u16 CountryIeLen; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 53 | u8 CountryIeBuf[MAX_IE_LEN]; |
| 54 | u8 CountryIeSrcAddr[6]; |
| 55 | u8 CountryIeWatchdog; |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 56 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 57 | u8 channel_map[MAX_CHANNEL_NUMBER+1]; |
| 58 | u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1]; |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 59 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 60 | enum dot11d_state State; |
Ken O'Brien | 45ce3f6 | 2011-06-05 18:24:33 +0100 | [diff] [blame] | 61 | }; |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 62 | |
Mike McCormack | dd18473 | 2010-12-27 21:49:49 +0900 | [diff] [blame] | 63 | static inline void cpMacAddr(unsigned char *des, unsigned char *src) |
| 64 | { |
| 65 | memcpy(des, src, 6); |
| 66 | } |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 67 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 68 | #define GET_DOT11D_INFO(__pIeeeDev) \ |
| 69 | ((struct rt_dot11d_info *)((__pIeeeDev)->pDot11dInfo)) |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 70 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 71 | #define IS_DOT11D_ENABLE(__pIeeeDev) \ |
| 72 | (GET_DOT11D_INFO(__pIeeeDev)->bEnabled) |
| 73 | #define IS_COUNTRY_IE_VALID(__pIeeeDev) \ |
| 74 | (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0) |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 75 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 76 | #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) \ |
| 77 | eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) |
| 78 | #define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \ |
| 79 | cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 80 | |
| 81 | #define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \ |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 82 | (((__Ie).Length == 0 || (__Ie).Length != \ |
| 83 | GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? \ |
| 84 | false : (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, \ |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 85 | (__Ie).Octet, (__Ie).Length))) |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 86 | |
| 87 | #define CIE_WATCHDOG_TH 1 |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 88 | #define GET_CIE_WATCHDOG(__pIeeeDev) \ |
| 89 | (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog) |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 90 | #define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0 |
Ken O'Brien | dc6b15f | 2011-06-05 18:24:32 +0100 | [diff] [blame] | 91 | #define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev)) |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 92 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 93 | #define IS_DOT11D_STATE_DONE(__pIeeeDev) \ |
| 94 | (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 95 | |
Sean MacLennan | 976d534 | 2011-11-30 15:18:52 -0500 | [diff] [blame] | 96 | void dot11d_init(struct rtllib_device *dev); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 97 | void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee); |
| 98 | void Dot11d_Reset(struct rtllib_device *dev); |
| 99 | void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, |
| 100 | u16 CoutryIeLen, u8 *pCoutryIe); |
| 101 | u8 DOT11D_GetMaxTxPwrInDbm(struct rtllib_device *dev, u8 Channel); |
| 102 | void DOT11D_ScanComplete(struct rtllib_device *dev); |
| 103 | int ToLegalChannel(struct rtllib_device *dev, u8 channel); |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 104 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 105 | #endif |