| .. | .. |
|---|
| 3 | 3 | |
|---|
| 4 | 4 | #include "dot11d.h" |
|---|
| 5 | 5 | |
|---|
| 6 | | -void Dot11d_Init(struct ieee80211_device *ieee) |
|---|
| 6 | +void rtl8192u_dot11d_init(struct ieee80211_device *ieee) |
|---|
| 7 | 7 | { |
|---|
| 8 | | - struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(ieee); |
|---|
| 8 | + struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(ieee); |
|---|
| 9 | 9 | |
|---|
| 10 | | - pDot11dInfo->enabled = false; |
|---|
| 10 | + dot11d_info->dot11d_enabled = false; |
|---|
| 11 | 11 | |
|---|
| 12 | | - pDot11dInfo->state = DOT11D_STATE_NONE; |
|---|
| 13 | | - pDot11dInfo->country_ie_len = 0; |
|---|
| 14 | | - memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER + 1); |
|---|
| 15 | | - memset(pDot11dInfo->max_tx_pwr_dbm_list, 0xFF, MAX_CHANNEL_NUMBER+1); |
|---|
| 12 | + dot11d_info->state = DOT11D_STATE_NONE; |
|---|
| 13 | + dot11d_info->country_ie_len = 0; |
|---|
| 14 | + memset(dot11d_info->channel_map, 0, MAX_CHANNEL_NUMBER + 1); |
|---|
| 15 | + memset(dot11d_info->max_tx_pwr_dbm_list, 0xFF, MAX_CHANNEL_NUMBER + 1); |
|---|
| 16 | 16 | RESET_CIE_WATCHDOG(ieee); |
|---|
| 17 | 17 | |
|---|
| 18 | | - netdev_info(ieee->dev, "Dot11d_Init()\n"); |
|---|
| 18 | + netdev_info(ieee->dev, "rtl8192u_dot11d_init()\n"); |
|---|
| 19 | 19 | } |
|---|
| 20 | | -EXPORT_SYMBOL(Dot11d_Init); |
|---|
| 20 | +EXPORT_SYMBOL(rtl8192u_dot11d_init); |
|---|
| 21 | 21 | |
|---|
| 22 | 22 | /* Reset to the state as we are just entering a regulatory domain. */ |
|---|
| 23 | | -void Dot11d_Reset(struct ieee80211_device *ieee) |
|---|
| 23 | +void dot11d_reset(struct ieee80211_device *ieee) |
|---|
| 24 | 24 | { |
|---|
| 25 | 25 | u32 i; |
|---|
| 26 | | - struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(ieee); |
|---|
| 26 | + struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(ieee); |
|---|
| 27 | 27 | /* Clear old channel map */ |
|---|
| 28 | | - memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); |
|---|
| 29 | | - memset(pDot11dInfo->max_tx_pwr_dbm_list, 0xFF, MAX_CHANNEL_NUMBER+1); |
|---|
| 28 | + memset(dot11d_info->channel_map, 0, MAX_CHANNEL_NUMBER + 1); |
|---|
| 29 | + memset(dot11d_info->max_tx_pwr_dbm_list, 0xFF, MAX_CHANNEL_NUMBER + 1); |
|---|
| 30 | 30 | /* Set new channel map */ |
|---|
| 31 | 31 | for (i = 1; i <= 11; i++) |
|---|
| 32 | | - (pDot11dInfo->channel_map)[i] = 1; |
|---|
| 32 | + (dot11d_info->channel_map)[i] = 1; |
|---|
| 33 | 33 | |
|---|
| 34 | 34 | for (i = 12; i <= 14; i++) |
|---|
| 35 | | - (pDot11dInfo->channel_map)[i] = 2; |
|---|
| 35 | + (dot11d_info->channel_map)[i] = 2; |
|---|
| 36 | 36 | |
|---|
| 37 | | - pDot11dInfo->state = DOT11D_STATE_NONE; |
|---|
| 38 | | - pDot11dInfo->country_ie_len = 0; |
|---|
| 37 | + dot11d_info->state = DOT11D_STATE_NONE; |
|---|
| 38 | + dot11d_info->country_ie_len = 0; |
|---|
| 39 | 39 | RESET_CIE_WATCHDOG(ieee); |
|---|
| 40 | 40 | } |
|---|
| 41 | | -EXPORT_SYMBOL(Dot11d_Reset); |
|---|
| 41 | +EXPORT_SYMBOL(dot11d_reset); |
|---|
| 42 | 42 | |
|---|
| 43 | 43 | /* |
|---|
| 44 | 44 | * Update country IE from Beacon or Probe Resopnse and configure PHY for |
|---|
| .. | .. |
|---|
| 49 | 49 | * 1. IS_DOT11D_ENABLE() is TRUE. |
|---|
| 50 | 50 | * 2. Input IE is an valid one. |
|---|
| 51 | 51 | */ |
|---|
| 52 | | -void Dot11d_UpdateCountryIe(struct ieee80211_device *dev, u8 *pTaddr, |
|---|
| 52 | +void dot11d_update_country_ie(struct ieee80211_device *dev, u8 *pTaddr, |
|---|
| 53 | 53 | u16 CoutryIeLen, u8 *pCoutryIe) |
|---|
| 54 | 54 | { |
|---|
| 55 | | - struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(dev); |
|---|
| 55 | + struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(dev); |
|---|
| 56 | 56 | u8 i, j, NumTriples, MaxChnlNum; |
|---|
| 57 | 57 | struct chnl_txpower_triple *pTriple; |
|---|
| 58 | 58 | |
|---|
| 59 | | - memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); |
|---|
| 60 | | - memset(pDot11dInfo->max_tx_pwr_dbm_list, 0xFF, MAX_CHANNEL_NUMBER+1); |
|---|
| 59 | + memset(dot11d_info->channel_map, 0, MAX_CHANNEL_NUMBER + 1); |
|---|
| 60 | + memset(dot11d_info->max_tx_pwr_dbm_list, 0xFF, MAX_CHANNEL_NUMBER + 1); |
|---|
| 61 | 61 | MaxChnlNum = 0; |
|---|
| 62 | 62 | NumTriples = (CoutryIeLen - 3) / 3; /* skip 3-byte country string. */ |
|---|
| 63 | 63 | pTriple = (struct chnl_txpower_triple *)(pCoutryIe + 3); |
|---|
| .. | .. |
|---|
| 66 | 66 | /* It is not in a monotonically increasing order, so |
|---|
| 67 | 67 | * stop processing. |
|---|
| 68 | 68 | */ |
|---|
| 69 | | - netdev_err(dev->dev, "Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); |
|---|
| 69 | + netdev_err(dev->dev, "dot11d_update_country_ie(): Invalid country IE, skip it........1\n"); |
|---|
| 70 | 70 | return; |
|---|
| 71 | 71 | } |
|---|
| 72 | 72 | if (MAX_CHANNEL_NUMBER < (pTriple->first_channel + pTriple->num_channels)) { |
|---|
| 73 | 73 | /* It is not a valid set of channel id, so stop |
|---|
| 74 | 74 | * processing. |
|---|
| 75 | 75 | */ |
|---|
| 76 | | - netdev_err(dev->dev, "Dot11d_UpdateCountryIe(): Invalid country IE, skip it........2\n"); |
|---|
| 76 | + netdev_err(dev->dev, "dot11d_update_country_ie(): Invalid country IE, skip it........2\n"); |
|---|
| 77 | 77 | return; |
|---|
| 78 | 78 | } |
|---|
| 79 | 79 | |
|---|
| 80 | 80 | for (j = 0; j < pTriple->num_channels; j++) { |
|---|
| 81 | | - pDot11dInfo->channel_map[pTriple->first_channel + j] = 1; |
|---|
| 82 | | - pDot11dInfo->max_tx_pwr_dbm_list[pTriple->first_channel + j] = pTriple->max_tx_pwr_dbm; |
|---|
| 81 | + dot11d_info->channel_map[pTriple->first_channel + j] = 1; |
|---|
| 82 | + dot11d_info->max_tx_pwr_dbm_list[pTriple->first_channel + j] = pTriple->max_tx_pwr_dbm; |
|---|
| 83 | 83 | MaxChnlNum = pTriple->first_channel + j; |
|---|
| 84 | 84 | } |
|---|
| 85 | 85 | |
|---|
| .. | .. |
|---|
| 87 | 87 | } |
|---|
| 88 | 88 | netdev_info(dev->dev, "Channel List:"); |
|---|
| 89 | 89 | for (i = 1; i <= MAX_CHANNEL_NUMBER; i++) |
|---|
| 90 | | - if (pDot11dInfo->channel_map[i] > 0) |
|---|
| 90 | + if (dot11d_info->channel_map[i] > 0) |
|---|
| 91 | 91 | netdev_info(dev->dev, " %d", i); |
|---|
| 92 | 92 | netdev_info(dev->dev, "\n"); |
|---|
| 93 | 93 | |
|---|
| 94 | 94 | UPDATE_CIE_SRC(dev, pTaddr); |
|---|
| 95 | 95 | |
|---|
| 96 | | - pDot11dInfo->country_ie_len = CoutryIeLen; |
|---|
| 97 | | - memcpy(pDot11dInfo->country_ie_buf, pCoutryIe, CoutryIeLen); |
|---|
| 98 | | - pDot11dInfo->state = DOT11D_STATE_LEARNED; |
|---|
| 96 | + dot11d_info->country_ie_len = CoutryIeLen; |
|---|
| 97 | + memcpy(dot11d_info->country_ie_buf, pCoutryIe, CoutryIeLen); |
|---|
| 98 | + dot11d_info->state = DOT11D_STATE_LEARNED; |
|---|
| 99 | 99 | } |
|---|
| 100 | | -EXPORT_SYMBOL(Dot11d_UpdateCountryIe); |
|---|
| 100 | +EXPORT_SYMBOL(dot11d_update_country_ie); |
|---|
| 101 | 101 | |
|---|
| 102 | | -u8 DOT11D_GetMaxTxPwrInDbm(struct ieee80211_device *dev, u8 Channel) |
|---|
| 102 | +u8 dot11d_get_max_tx_pwr_in_dbm(struct ieee80211_device *dev, u8 Channel) |
|---|
| 103 | 103 | { |
|---|
| 104 | | - struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(dev); |
|---|
| 104 | + struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(dev); |
|---|
| 105 | 105 | u8 MaxTxPwrInDbm = 255; |
|---|
| 106 | 106 | |
|---|
| 107 | 107 | if (Channel > MAX_CHANNEL_NUMBER) { |
|---|
| 108 | | - netdev_err(dev->dev, "DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n"); |
|---|
| 108 | + netdev_err(dev->dev, "dot11d_get_max_tx_pwr_in_dbm(): Invalid Channel\n"); |
|---|
| 109 | 109 | return MaxTxPwrInDbm; |
|---|
| 110 | 110 | } |
|---|
| 111 | | - if (pDot11dInfo->channel_map[Channel]) |
|---|
| 112 | | - MaxTxPwrInDbm = pDot11dInfo->max_tx_pwr_dbm_list[Channel]; |
|---|
| 111 | + if (dot11d_info->channel_map[Channel]) |
|---|
| 112 | + MaxTxPwrInDbm = dot11d_info->max_tx_pwr_dbm_list[Channel]; |
|---|
| 113 | 113 | |
|---|
| 114 | 114 | return MaxTxPwrInDbm; |
|---|
| 115 | 115 | } |
|---|
| 116 | | -EXPORT_SYMBOL(DOT11D_GetMaxTxPwrInDbm); |
|---|
| 116 | +EXPORT_SYMBOL(dot11d_get_max_tx_pwr_in_dbm); |
|---|
| 117 | 117 | |
|---|
| 118 | | -void DOT11D_ScanComplete(struct ieee80211_device *dev) |
|---|
| 118 | +void dot11d_scan_complete(struct ieee80211_device *dev) |
|---|
| 119 | 119 | { |
|---|
| 120 | | - struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(dev); |
|---|
| 120 | + struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(dev); |
|---|
| 121 | 121 | |
|---|
| 122 | | - switch (pDot11dInfo->state) { |
|---|
| 122 | + switch (dot11d_info->state) { |
|---|
| 123 | 123 | case DOT11D_STATE_LEARNED: |
|---|
| 124 | | - pDot11dInfo->state = DOT11D_STATE_DONE; |
|---|
| 124 | + dot11d_info->state = DOT11D_STATE_DONE; |
|---|
| 125 | 125 | break; |
|---|
| 126 | 126 | |
|---|
| 127 | 127 | case DOT11D_STATE_DONE: |
|---|
| 128 | 128 | if (GET_CIE_WATCHDOG(dev) == 0) { |
|---|
| 129 | 129 | /* Reset country IE if previous one is gone. */ |
|---|
| 130 | | - Dot11d_Reset(dev); |
|---|
| 130 | + dot11d_reset(dev); |
|---|
| 131 | 131 | } |
|---|
| 132 | 132 | break; |
|---|
| 133 | 133 | case DOT11D_STATE_NONE: |
|---|
| 134 | 134 | break; |
|---|
| 135 | 135 | } |
|---|
| 136 | 136 | } |
|---|
| 137 | | -EXPORT_SYMBOL(DOT11D_ScanComplete); |
|---|
| 137 | +EXPORT_SYMBOL(dot11d_scan_complete); |
|---|
| 138 | 138 | |
|---|
| 139 | | -int IsLegalChannel(struct ieee80211_device *dev, u8 channel) |
|---|
| 139 | +int is_legal_channel(struct ieee80211_device *dev, u8 channel) |
|---|
| 140 | 140 | { |
|---|
| 141 | | - struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(dev); |
|---|
| 141 | + struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(dev); |
|---|
| 142 | 142 | |
|---|
| 143 | 143 | if (channel > MAX_CHANNEL_NUMBER) { |
|---|
| 144 | | - netdev_err(dev->dev, "IsLegalChannel(): Invalid Channel\n"); |
|---|
| 144 | + netdev_err(dev->dev, "is_legal_channel(): Invalid Channel\n"); |
|---|
| 145 | 145 | return 0; |
|---|
| 146 | 146 | } |
|---|
| 147 | | - if (pDot11dInfo->channel_map[channel] > 0) |
|---|
| 147 | + if (dot11d_info->channel_map[channel] > 0) |
|---|
| 148 | 148 | return 1; |
|---|
| 149 | 149 | return 0; |
|---|
| 150 | 150 | } |
|---|
| 151 | | -EXPORT_SYMBOL(IsLegalChannel); |
|---|
| 151 | +EXPORT_SYMBOL(is_legal_channel); |
|---|
| 152 | 152 | |
|---|
| 153 | | -int ToLegalChannel(struct ieee80211_device *dev, u8 channel) |
|---|
| 153 | +int to_legal_channel(struct ieee80211_device *dev, u8 channel) |
|---|
| 154 | 154 | { |
|---|
| 155 | | - struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(dev); |
|---|
| 155 | + struct rt_dot11d_info *dot11d_info = GET_DOT11D_INFO(dev); |
|---|
| 156 | 156 | u8 default_chn = 0; |
|---|
| 157 | 157 | u32 i = 0; |
|---|
| 158 | 158 | |
|---|
| 159 | 159 | for (i = 1; i <= MAX_CHANNEL_NUMBER; i++) { |
|---|
| 160 | | - if (pDot11dInfo->channel_map[i] > 0) { |
|---|
| 160 | + if (dot11d_info->channel_map[i] > 0) { |
|---|
| 161 | 161 | default_chn = i; |
|---|
| 162 | 162 | break; |
|---|
| 163 | 163 | } |
|---|
| 164 | 164 | } |
|---|
| 165 | 165 | |
|---|
| 166 | 166 | if (channel > MAX_CHANNEL_NUMBER) { |
|---|
| 167 | | - netdev_err(dev->dev, "IsLegalChannel(): Invalid Channel\n"); |
|---|
| 167 | + netdev_err(dev->dev, "is_legal_channel(): Invalid Channel\n"); |
|---|
| 168 | 168 | return default_chn; |
|---|
| 169 | 169 | } |
|---|
| 170 | 170 | |
|---|
| 171 | | - if (pDot11dInfo->channel_map[channel] > 0) |
|---|
| 171 | + if (dot11d_info->channel_map[channel] > 0) |
|---|
| 172 | 172 | return channel; |
|---|
| 173 | 173 | |
|---|
| 174 | 174 | return default_chn; |
|---|
| 175 | 175 | } |
|---|
| 176 | | -EXPORT_SYMBOL(ToLegalChannel); |
|---|
| 176 | +EXPORT_SYMBOL(to_legal_channel); |
|---|