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 | * |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 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 |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 17 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 18 | #include "rtllib.h" |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 19 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 20 | struct chnl_txpow_triple { |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 21 | u8 FirstChnl; |
| 22 | u8 NumChnls; |
| 23 | u8 MaxTxPowerInDbm; |
Ken O'Brien | 45ce3f6 | 2011-06-05 18:24:33 +0100 | [diff] [blame] | 24 | }; |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 25 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 26 | enum dot11d_state { |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 27 | DOT11D_STATE_NONE = 0, |
| 28 | DOT11D_STATE_LEARNED, |
| 29 | DOT11D_STATE_DONE, |
Ken O'Brien | 45ce3f6 | 2011-06-05 18:24:33 +0100 | [diff] [blame] | 30 | }; |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 31 | |
| 32 | /** |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 33 | * 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] | 34 | * valid country information element. |
Masanari Iida | e0e2615 | 2013-09-16 09:58:07 +0900 | [diff] [blame] | 35 | * @channel_map: holds channel values |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 36 | * 0 - invalid, |
| 37 | * 1 - valid (active scan), |
Ken O'Brien | dc6b15f | 2011-06-05 18:24:32 +0100 | [diff] [blame] | 38 | * 2 - valid (passive scan) |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 39 | * @CountryIeSrcAddr - Source AP of the country IE |
| 40 | */ |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 41 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 42 | struct rt_dot11d_info { |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 43 | bool bEnabled; |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 44 | |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 45 | u16 CountryIeLen; |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 46 | u8 CountryIeBuf[MAX_IE_LEN]; |
| 47 | u8 CountryIeSrcAddr[6]; |
| 48 | u8 CountryIeWatchdog; |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 49 | |
Namrata A Shettar | 986fb01 | 2016-09-19 20:27:46 +0530 | [diff] [blame] | 50 | u8 channel_map[MAX_CHANNEL_NUMBER + 1]; |
| 51 | u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER + 1]; |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 52 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 53 | enum dot11d_state State; |
Ken O'Brien | 45ce3f6 | 2011-06-05 18:24:33 +0100 | [diff] [blame] | 54 | }; |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 55 | |
Mike McCormack | dd18473 | 2010-12-27 21:49:49 +0900 | [diff] [blame] | 56 | static inline void cpMacAddr(unsigned char *des, unsigned char *src) |
| 57 | { |
| 58 | memcpy(des, src, 6); |
| 59 | } |
Radu Voicilas | 789d9db | 2009-12-04 20:42:53 -0800 | [diff] [blame] | 60 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 61 | #define GET_DOT11D_INFO(__pIeeeDev) \ |
| 62 | ((struct rt_dot11d_info *)((__pIeeeDev)->pDot11dInfo)) |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 63 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 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) |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 68 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 69 | #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) \ |
Mateusz Kulikowski | 35e33b0 | 2015-05-31 20:19:40 +0200 | [diff] [blame] | 70 | ether_addr_equal_unaligned( \ |
| 71 | GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 72 | #define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \ |
| 73 | cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa) |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 74 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 75 | #define GET_CIE_WATCHDOG(__pIeeeDev) \ |
| 76 | (GET_DOT11D_INFO(__pIeeeDev)->CountryIeWatchdog) |
Himangi Saraogi | fa7b3d0 | 2013-11-10 03:04:54 +0530 | [diff] [blame] | 77 | static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__pIeeeDev) |
| 78 | { |
| 79 | GET_CIE_WATCHDOG(__pIeeeDev) = 0; |
| 80 | } |
Namrata A Shettar | 8e9253b | 2016-09-19 20:27:56 +0530 | [diff] [blame] | 81 | |
Ken O'Brien | dc6b15f | 2011-06-05 18:24:32 +0100 | [diff] [blame] | 82 | #define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev)) |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 83 | |
Sean MacLennan | 976d534 | 2011-11-30 15:18:52 -0500 | [diff] [blame] | 84 | void dot11d_init(struct rtllib_device *dev); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 85 | void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee); |
| 86 | void Dot11d_Reset(struct rtllib_device *dev); |
| 87 | void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, |
| 88 | u16 CoutryIeLen, u8 *pCoutryIe); |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 89 | void DOT11D_ScanComplete(struct rtllib_device *dev); |
Greg Kroah-Hartman | ecdfa44 | 2009-08-04 15:57:55 -0700 | [diff] [blame] | 90 | |
Larry Finger | 94a7994 | 2011-08-23 19:00:42 -0500 | [diff] [blame] | 91 | #endif |