0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __INC_DOT11D_H
0009 #define __INC_DOT11D_H
0010
0011 #include "rtllib.h"
0012
0013 struct chnl_txpow_triple {
0014 u8 first_channel;
0015 u8 num_channels;
0016 u8 max_tx_power;
0017 };
0018
0019 enum dot11d_state {
0020 DOT11D_STATE_NONE = 0,
0021 DOT11D_STATE_LEARNED,
0022 DOT11D_STATE_DONE,
0023 };
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 struct rt_dot11d_info {
0036 bool enabled;
0037
0038 u16 country_len;
0039 u8 country_buffer[MAX_IE_LEN];
0040 u8 country_src_addr[6];
0041 u8 country_watchdog;
0042
0043 u8 channel_map[MAX_CHANNEL_NUMBER + 1];
0044 u8 max_tx_power_list[MAX_CHANNEL_NUMBER + 1];
0045
0046 enum dot11d_state state;
0047 };
0048
0049 static inline void copy_mac_addr(unsigned char *des, unsigned char *src)
0050 {
0051 memcpy(des, src, 6);
0052 }
0053
0054 #define GET_DOT11D_INFO(__ieee_dev) \
0055 ((struct rt_dot11d_info *)((__ieee_dev)->dot11d_info))
0056
0057 #define IS_DOT11D_ENABLE(__ieee_dev) \
0058 (GET_DOT11D_INFO(__ieee_dev)->enabled)
0059 #define IS_COUNTRY_IE_VALID(__ieee_dev) \
0060 (GET_DOT11D_INFO(__ieee_dev)->country_len > 0)
0061
0062 #define IS_EQUAL_CIE_SRC(__ieee_dev, __address) \
0063 ether_addr_equal_unaligned( \
0064 GET_DOT11D_INFO(__ieee_dev)->country_src_addr, __address)
0065 #define UPDATE_CIE_SRC(__ieee_dev, __address) \
0066 copy_mac_addr(GET_DOT11D_INFO(__ieee_dev)->country_src_addr, __address)
0067
0068 #define GET_CIE_WATCHDOG(__ieee_dev) \
0069 (GET_DOT11D_INFO(__ieee_dev)->country_watchdog)
0070 static inline void RESET_CIE_WATCHDOG(struct rtllib_device *__ieee_dev)
0071 {
0072 GET_CIE_WATCHDOG(__ieee_dev) = 0;
0073 }
0074
0075 #define UPDATE_CIE_WATCHDOG(__ieee_dev) (++GET_CIE_WATCHDOG(__ieee_dev))
0076
0077 void dot11d_init(struct rtllib_device *dev);
0078 void dot11d_channel_map(u8 channel_plan, struct rtllib_device *ieee);
0079 void dot11d_reset(struct rtllib_device *dev);
0080 void dot11d_update_country(struct rtllib_device *dev, u8 *address,
0081 u16 country_len, u8 *country);
0082 void dot11d_scan_complete(struct rtllib_device *dev);
0083
0084 #endif