Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along |
| 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | * |
| 19 | * |
| 20 | * File: vntwifi.c |
| 21 | * |
| 22 | * Purpose: export functions for vntwifi lib |
| 23 | * |
| 24 | * Functions: |
| 25 | * |
| 26 | * Revision History: |
| 27 | * |
| 28 | * Author: Yiching Chen |
| 29 | * |
| 30 | * Date: feb. 2, 2005 |
| 31 | * |
| 32 | */ |
| 33 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 34 | #include "vntwifi.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 35 | #include "IEEE11h.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 36 | #include "country.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 37 | #include "device.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 38 | #include "wmgr.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 39 | #include "datarate.h" |
Jim Lieb | a7ad322 | 2009-08-12 14:54:09 -0700 | [diff] [blame] | 40 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 41 | /*--------------------- Static Definitions -------------------------*/ |
| 42 | //static int msglevel =MSG_LEVEL_DEBUG; |
| 43 | //static int msglevel =MSG_LEVEL_INFO; |
| 44 | |
| 45 | /*--------------------- Static Classes ----------------------------*/ |
| 46 | |
| 47 | /*--------------------- Static Variables --------------------------*/ |
| 48 | |
| 49 | /*--------------------- Static Functions --------------------------*/ |
| 50 | |
| 51 | /*--------------------- Export Variables --------------------------*/ |
| 52 | |
| 53 | /*--------------------- Export Functions --------------------------*/ |
| 54 | |
| 55 | /*+ |
| 56 | * |
| 57 | * Description: |
| 58 | * Set Operation Mode |
| 59 | * |
| 60 | * Parameters: |
| 61 | * In: |
| 62 | * pMgmtHandle - pointer to management object |
Justin P. Mattock | 789d1ae | 2012-08-20 08:43:13 -0700 | [diff] [blame] | 63 | * eOPMode - Operation Mode |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 64 | * Out: |
| 65 | * none |
| 66 | * |
| 67 | * Return Value: none |
| 68 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 69 | -*/ |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 70 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 71 | VNTWIFIvSetOPMode( |
| 72 | void *pMgmtHandle, |
| 73 | WMAC_CONFIG_MODE eOPMode |
| 74 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 75 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 76 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 77 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 78 | pMgmt->eConfigMode = eOPMode; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 79 | } |
| 80 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 81 | /*+ |
| 82 | * |
| 83 | * Description: |
| 84 | * Set Operation Mode |
| 85 | * |
| 86 | * Parameters: |
| 87 | * In: |
| 88 | * pMgmtHandle - pointer to management object |
| 89 | * wBeaconPeriod - Beacon Period |
| 90 | * wATIMWindow - ATIM window |
| 91 | * uChannel - channel number |
| 92 | * Out: |
| 93 | * none |
| 94 | * |
| 95 | * Return Value: none |
| 96 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 97 | -*/ |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 98 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 99 | VNTWIFIvSetIBSSParameter( |
| 100 | void *pMgmtHandle, |
| 101 | unsigned short wBeaconPeriod, |
| 102 | unsigned short wATIMWindow, |
| 103 | unsigned int uChannel |
| 104 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 105 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 106 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 107 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 108 | pMgmt->wIBSSBeaconPeriod = wBeaconPeriod; |
| 109 | pMgmt->wIBSSATIMWindow = wATIMWindow; |
| 110 | pMgmt->uIBSSChannel = uChannel; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | /*+ |
| 114 | * |
| 115 | * Description: |
| 116 | * Get current SSID |
| 117 | * |
| 118 | * Parameters: |
| 119 | * In: |
| 120 | * pMgmtHandle - pointer to management object |
| 121 | * Out: |
| 122 | * none |
| 123 | * |
| 124 | * Return Value: current SSID pointer. |
| 125 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 126 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 127 | PWLAN_IE_SSID |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 128 | VNTWIFIpGetCurrentSSID( |
| 129 | void *pMgmtHandle |
| 130 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 131 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 132 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 133 | return (PWLAN_IE_SSID) pMgmt->abyCurrSSID; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 134 | } |
| 135 | |
| 136 | /*+ |
| 137 | * |
| 138 | * Description: |
| 139 | * Get current link channel |
| 140 | * |
| 141 | * Parameters: |
| 142 | * In: |
| 143 | * pMgmtHandle - pointer to management object |
| 144 | * Out: |
| 145 | * none |
| 146 | * |
| 147 | * Return Value: current Channel. |
| 148 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 149 | -*/ |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 150 | unsigned int |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 151 | VNTWIFIpGetCurrentChannel( |
| 152 | void *pMgmtHandle |
| 153 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 154 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 155 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
| 156 | if (pMgmtHandle != NULL) { |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 157 | return pMgmt->uCurrChannel; |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 158 | } |
| 159 | return 0; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | /*+ |
| 163 | * |
| 164 | * Description: |
| 165 | * Get current Assoc ID |
| 166 | * |
| 167 | * Parameters: |
| 168 | * In: |
| 169 | * pMgmtHandle - pointer to management object |
| 170 | * Out: |
| 171 | * none |
| 172 | * |
| 173 | * Return Value: current Assoc ID |
| 174 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 175 | -*/ |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 176 | unsigned short |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 177 | VNTWIFIwGetAssocID( |
| 178 | void *pMgmtHandle |
| 179 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 180 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 181 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 182 | return pMgmt->wCurrAID; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 183 | } |
| 184 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 185 | /*+ |
| 186 | * |
| 187 | * Description: |
| 188 | * This routine return max support rate of IES |
| 189 | * |
| 190 | * Parameters: |
| 191 | * In: |
| 192 | * pSupportRateIEs |
| 193 | * pExtSupportRateIEs |
| 194 | * |
| 195 | * Out: |
| 196 | * |
| 197 | * Return Value: max support rate |
| 198 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 199 | -*/ |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 200 | unsigned char |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 201 | VNTWIFIbyGetMaxSupportRate( |
| 202 | PWLAN_IE_SUPP_RATES pSupportRateIEs, |
| 203 | PWLAN_IE_SUPP_RATES pExtSupportRateIEs |
| 204 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 205 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 206 | unsigned char byMaxSupportRate = RATE_1M; |
| 207 | unsigned char bySupportRate = RATE_1M; |
| 208 | unsigned int ii = 0; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 209 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 210 | if (pSupportRateIEs) { |
| 211 | for (ii = 0; ii < pSupportRateIEs->len; ii++) { |
| 212 | bySupportRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]); |
| 213 | if (bySupportRate > byMaxSupportRate) { |
| 214 | byMaxSupportRate = bySupportRate; |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | if (pExtSupportRateIEs) { |
| 219 | for (ii = 0; ii < pExtSupportRateIEs->len; ii++) { |
| 220 | bySupportRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]); |
| 221 | if (bySupportRate > byMaxSupportRate) { |
| 222 | byMaxSupportRate = bySupportRate; |
| 223 | } |
| 224 | } |
| 225 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 226 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 227 | return byMaxSupportRate; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | /*+ |
| 231 | * |
| 232 | * Description: |
| 233 | * This routine return data rate of ACK packtet |
| 234 | * |
| 235 | * Parameters: |
| 236 | * In: |
| 237 | * byRxDataRate |
| 238 | * pSupportRateIEs |
| 239 | * pExtSupportRateIEs |
| 240 | * |
| 241 | * Out: |
| 242 | * |
| 243 | * Return Value: max support rate |
| 244 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 245 | -*/ |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 246 | unsigned char |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 247 | VNTWIFIbyGetACKTxRate( |
| 248 | unsigned char byRxDataRate, |
| 249 | PWLAN_IE_SUPP_RATES pSupportRateIEs, |
| 250 | PWLAN_IE_SUPP_RATES pExtSupportRateIEs |
| 251 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 252 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 253 | unsigned char byMaxAckRate; |
| 254 | unsigned char byBasicRate; |
| 255 | unsigned int ii; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 256 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 257 | if (byRxDataRate <= RATE_11M) { |
| 258 | byMaxAckRate = RATE_1M; |
| 259 | } else { |
| 260 | // 24M is mandatory for 802.11a and 802.11g |
| 261 | byMaxAckRate = RATE_24M; |
| 262 | } |
| 263 | if (pSupportRateIEs) { |
| 264 | for (ii = 0; ii < pSupportRateIEs->len; ii++) { |
| 265 | if (pSupportRateIEs->abyRates[ii] & 0x80) { |
| 266 | byBasicRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]); |
| 267 | if ((byBasicRate <= byRxDataRate) && |
| 268 | (byBasicRate > byMaxAckRate)) { |
| 269 | byMaxAckRate = byBasicRate; |
| 270 | } |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | if (pExtSupportRateIEs) { |
| 275 | for (ii = 0; ii < pExtSupportRateIEs->len; ii++) { |
| 276 | if (pExtSupportRateIEs->abyRates[ii] & 0x80) { |
| 277 | byBasicRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]); |
| 278 | if ((byBasicRate <= byRxDataRate) && |
| 279 | (byBasicRate > byMaxAckRate)) { |
| 280 | byMaxAckRate = byBasicRate; |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 285 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 286 | return byMaxAckRate; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | /*+ |
| 290 | * |
| 291 | * Description: |
| 292 | * Set Authentication Mode |
| 293 | * |
| 294 | * Parameters: |
| 295 | * In: |
| 296 | * pMgmtHandle - pointer to management object |
| 297 | * eAuthMode - Authentication mode |
| 298 | * Out: |
| 299 | * none |
| 300 | * |
| 301 | * Return Value: none |
| 302 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 303 | -*/ |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 304 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 305 | VNTWIFIvSetAuthenticationMode( |
| 306 | void *pMgmtHandle, |
| 307 | WMAC_AUTHENTICATION_MODE eAuthMode |
| 308 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 309 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 310 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 311 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 312 | pMgmt->eAuthenMode = eAuthMode; |
| 313 | if ((eAuthMode == WMAC_AUTH_SHAREKEY) || |
| 314 | (eAuthMode == WMAC_AUTH_AUTO)) { |
| 315 | pMgmt->bShareKeyAlgorithm = true; |
| 316 | } else { |
| 317 | pMgmt->bShareKeyAlgorithm = false; |
| 318 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 319 | } |
| 320 | |
| 321 | /*+ |
| 322 | * |
| 323 | * Description: |
| 324 | * Set Encryption Mode |
| 325 | * |
| 326 | * Parameters: |
| 327 | * In: |
| 328 | * pMgmtHandle - pointer to management object |
| 329 | * eAuthMode - Authentication mode |
| 330 | * Out: |
| 331 | * none |
| 332 | * |
| 333 | * Return Value: none |
| 334 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 335 | -*/ |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 336 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 337 | VNTWIFIvSetEncryptionMode( |
| 338 | void *pMgmtHandle, |
| 339 | WMAC_ENCRYPTION_MODE eEncryptionMode |
| 340 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 341 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 342 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 343 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 344 | pMgmt->eEncryptionMode = eEncryptionMode; |
| 345 | if ((eEncryptionMode == WMAC_ENCRYPTION_WEPEnabled) || |
| 346 | (eEncryptionMode == WMAC_ENCRYPTION_TKIPEnabled) || |
| 347 | (eEncryptionMode == WMAC_ENCRYPTION_AESEnabled)) { |
| 348 | pMgmt->bPrivacyInvoked = true; |
| 349 | } else { |
| 350 | pMgmt->bPrivacyInvoked = false; |
| 351 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 352 | } |
| 353 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 354 | bool |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 355 | VNTWIFIbConfigPhyMode( |
| 356 | void *pMgmtHandle, |
| 357 | CARD_PHY_TYPE ePhyType |
| 358 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 359 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 360 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 361 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 362 | if ((ePhyType != PHY_TYPE_AUTO) && |
| 363 | (ePhyType != pMgmt->eCurrentPHYMode)) { |
| 364 | if (CARDbSetPhyParameter(pMgmt->pAdapter, ePhyType, 0, 0, NULL, NULL) == true) { |
| 365 | pMgmt->eCurrentPHYMode = ePhyType; |
| 366 | } else { |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 367 | return false; |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 368 | } |
| 369 | } |
| 370 | pMgmt->eConfigPHYMode = ePhyType; |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 371 | return true; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 372 | } |
| 373 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 374 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 375 | VNTWIFIbGetConfigPhyMode( |
| 376 | void *pMgmtHandle, |
| 377 | void *pePhyType |
| 378 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 379 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 380 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 381 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 382 | if ((pMgmt != NULL) && (pePhyType != NULL)) { |
| 383 | *(PCARD_PHY_TYPE)pePhyType = pMgmt->eConfigPHYMode; |
| 384 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | /*+ |
| 388 | * |
| 389 | * Description: |
| 390 | * Clear BSS List Database except current assoc BSS |
| 391 | * |
| 392 | * Parameters: |
| 393 | * In: |
| 394 | * pMgmtHandle - Management Object structure |
| 395 | * bLinkPass - Current Link status |
| 396 | * Out: |
| 397 | * |
| 398 | * Return Value: None. |
| 399 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 400 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 401 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 402 | /*+ |
| 403 | * |
| 404 | * Description: |
| 405 | * Query BSS List in management database |
| 406 | * |
| 407 | * Parameters: |
| 408 | * In: |
| 409 | * pMgmtHandle - Management Object structure |
| 410 | * Out: |
| 411 | * puBSSCount - BSS count |
| 412 | * pvFirstBSS - pointer to first BSS |
| 413 | * |
| 414 | * Return Value: None. |
| 415 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 416 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 417 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 418 | void |
Charles Clément | fe4f34b | 2010-06-25 10:48:53 -0700 | [diff] [blame] | 419 | VNTWIFIvQueryBSSList(void *pMgmtHandle, unsigned int *puBSSCount, void **pvFirstBSS) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 420 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 421 | unsigned int ii = 0; |
| 422 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
| 423 | PKnownBSS pBSS = NULL; |
| 424 | unsigned int uCount = 0; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 425 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 426 | *pvFirstBSS = NULL; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 427 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 428 | for (ii = 0; ii < MAX_BSS_NUM; ii++) { |
| 429 | pBSS = &(pMgmt->sBSSList[ii]); |
| 430 | if (!pBSS->bActive) { |
| 431 | continue; |
| 432 | } |
| 433 | if (*pvFirstBSS == NULL) { |
| 434 | *pvFirstBSS = &(pMgmt->sBSSList[ii]); |
| 435 | } |
| 436 | uCount++; |
| 437 | } |
| 438 | *puBSSCount = uCount; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 439 | } |
| 440 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 441 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 442 | VNTWIFIvGetNextBSS( |
| 443 | void *pMgmtHandle, |
| 444 | void *pvCurrentBSS, |
| 445 | void **pvNextBSS |
| 446 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 447 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 448 | PKnownBSS pBSS = (PKnownBSS) pvCurrentBSS; |
| 449 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 450 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 451 | *pvNextBSS = NULL; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 452 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 453 | while (*pvNextBSS == NULL) { |
| 454 | pBSS++; |
| 455 | if (pBSS > &(pMgmt->sBSSList[MAX_BSS_NUM])) { |
| 456 | return; |
| 457 | } |
| 458 | if (pBSS->bActive == true) { |
| 459 | *pvNextBSS = pBSS; |
| 460 | return; |
| 461 | } |
| 462 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 463 | } |
| 464 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 465 | /*+ |
| 466 | * |
| 467 | * Description: |
| 468 | * Update Tx attemps, Tx failure counter in Node DB |
| 469 | * |
| 470 | * In: |
| 471 | * Out: |
| 472 | * none |
| 473 | * |
| 474 | * Return Value: none |
| 475 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 476 | -*/ |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 477 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 478 | VNTWIFIvUpdateNodeTxCounter( |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 479 | void *pMgmtHandle, |
| 480 | unsigned char *pbyDestAddress, |
| 481 | bool bTxOk, |
| 482 | unsigned short wRate, |
| 483 | unsigned char *pbyTxFailCount |
| 484 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 485 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 486 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
| 487 | unsigned int uNodeIndex = 0; |
| 488 | unsigned int ii; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 489 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 490 | if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) || |
| 491 | (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) { |
| 492 | if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex) == false) { |
| 493 | return; |
| 494 | } |
| 495 | } |
| 496 | pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts++; |
| 497 | if (bTxOk == true) { |
| 498 | // transmit success, TxAttempts at least plus one |
| 499 | pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++; |
| 500 | pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wRate]++; |
| 501 | } else { |
| 502 | pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++; |
| 503 | } |
| 504 | pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += pbyTxFailCount[MAX_RATE]; |
| 505 | for (ii = 0; ii < MAX_RATE; ii++) { |
| 506 | pMgmt->sNodeDBTable[uNodeIndex].uTxFail[ii] += pbyTxFailCount[ii]; |
| 507 | } |
| 508 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 509 | } |
| 510 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 511 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 512 | VNTWIFIvGetTxRate( |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 513 | void *pMgmtHandle, |
| 514 | unsigned char *pbyDestAddress, |
| 515 | unsigned short *pwTxDataRate, |
| 516 | unsigned char *pbyACKRate, |
| 517 | unsigned char *pbyCCKBasicRate, |
| 518 | unsigned char *pbyOFDMBasicRate |
| 519 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 520 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 521 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
| 522 | unsigned int uNodeIndex = 0; |
| 523 | unsigned short wTxDataRate = RATE_1M; |
| 524 | unsigned char byACKRate = RATE_1M; |
| 525 | unsigned char byCCKBasicRate = RATE_1M; |
| 526 | unsigned char byOFDMBasicRate = RATE_24M; |
| 527 | PWLAN_IE_SUPP_RATES pSupportRateIEs = NULL; |
| 528 | PWLAN_IE_SUPP_RATES pExtSupportRateIEs = NULL; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 529 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 530 | if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) || |
| 531 | (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) { |
| 532 | // Adhoc Tx rate decided from node DB |
| 533 | if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex)) { |
| 534 | wTxDataRate = (pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate); |
| 535 | pSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrSuppRates); |
| 536 | pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrExtSuppRates); |
| 537 | } else { |
| 538 | if (pMgmt->eCurrentPHYMode != PHY_TYPE_11A) { |
| 539 | wTxDataRate = RATE_2M; |
| 540 | } else { |
| 541 | wTxDataRate = RATE_24M; |
| 542 | } |
| 543 | pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates; |
| 544 | pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates; |
| 545 | } |
| 546 | } else { // Infrastructure: rate decided from AP Node, index = 0 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 547 | |
| 548 | wTxDataRate = (pMgmt->sNodeDBTable[0].wTxDataRate); |
| 549 | #ifdef PLICE_DEBUG |
Andy Shevchenko | 3c02dc2 | 2010-09-11 17:17:12 +0300 | [diff] [blame] | 550 | printk(KERN_DEBUG "GetTxRate:AP MAC is %pM,TxRate is %d\n", |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 551 | pMgmt->sNodeDBTable[0].abyMACAddr, wTxDataRate); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 552 | #endif |
| 553 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 554 | pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates; |
| 555 | pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates; |
| 556 | } |
| 557 | byACKRate = VNTWIFIbyGetACKTxRate((unsigned char) wTxDataRate, |
| 558 | pSupportRateIEs, |
| 559 | pExtSupportRateIEs |
| 560 | ); |
| 561 | if (byACKRate > (unsigned char) wTxDataRate) { |
| 562 | byACKRate = (unsigned char) wTxDataRate; |
| 563 | } |
| 564 | byCCKBasicRate = VNTWIFIbyGetACKTxRate(RATE_11M, |
| 565 | pSupportRateIEs, |
| 566 | pExtSupportRateIEs |
| 567 | ); |
| 568 | byOFDMBasicRate = VNTWIFIbyGetACKTxRate(RATE_54M, |
| 569 | pSupportRateIEs, |
| 570 | pExtSupportRateIEs |
| 571 | ); |
| 572 | *pwTxDataRate = wTxDataRate; |
| 573 | *pbyACKRate = byACKRate; |
| 574 | *pbyCCKBasicRate = byCCKBasicRate; |
| 575 | *pbyOFDMBasicRate = byOFDMBasicRate; |
| 576 | return; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 577 | } |
| 578 | |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 579 | unsigned char |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 580 | VNTWIFIbyGetKeyCypher( |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 581 | void *pMgmtHandle, |
| 582 | bool bGroupKey |
| 583 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 584 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 585 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 586 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 587 | if (bGroupKey == true) { |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 588 | return pMgmt->byCSSGK; |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 589 | } else { |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 590 | return pMgmt->byCSSPK; |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 591 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 592 | } |
| 593 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 594 | /* |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 595 | bool |
| 596 | VNTWIFIbInit( |
| 597 | void *pAdapterHandler, |
| 598 | void **pMgmtHandler |
Joe Perches | 5e0cc8a | 2013-03-18 20:55:37 -0700 | [diff] [blame] | 599 | ) { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 600 | PSMgmtObject pMgmt = NULL; |
| 601 | unsigned int ii; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 602 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 603 | pMgmt = (PSMgmtObject)kmalloc(sizeof(SMgmtObject), (int)GFP_ATOMIC); |
| 604 | if (pMgmt == NULL) { |
| 605 | *pMgmtHandler = NULL; |
| 606 | return false; |
| 607 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 608 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 609 | memset(pMgmt, 0, sizeof(SMgmtObject)); |
| 610 | pMgmt->pAdapter = (void *) pAdapterHandler; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 611 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 612 | // should initial MAC address abyMACAddr |
| 613 | for (ii=0; ii<WLAN_BSSID_LEN; ii++) { |
| 614 | pMgmt->abyDesireBSSID[ii] = 0xFF; |
| 615 | } |
| 616 | pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0]; |
| 617 | pMgmt->pbyMgmtPacketPool = &pMgmt->byMgmtPacketPool[0]; |
| 618 | pMgmt->byCSSPK = KEY_CTL_NONE; |
| 619 | pMgmt->byCSSGK = KEY_CTL_NONE; |
| 620 | pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 621 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 622 | pMgmt->cbFreeCmdQueue = CMD_Q_SIZE; |
| 623 | pMgmt->uCmdDequeueIdx = 0; |
| 624 | pMgmt->uCmdEnqueueIdx = 0; |
| 625 | pMgmt->eCommandState = WLAN_CMD_STATE_IDLE; |
| 626 | pMgmt->bCmdStop = false; |
| 627 | pMgmt->bCmdRunning = false; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 628 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 629 | *pMgmtHandler = pMgmt; |
| 630 | return true; |
| 631 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 632 | */ |
| 633 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 634 | bool |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 635 | VNTWIFIbSetPMKIDCache( |
| 636 | void *pMgmtObject, |
| 637 | unsigned long ulCount, |
| 638 | void *pPMKIDInfo |
| 639 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 640 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 641 | PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 642 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 643 | if (ulCount > MAX_PMKID_CACHE) { |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 644 | return false; |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 645 | } |
| 646 | pMgmt->gsPMKIDCache.BSSIDInfoCount = ulCount; |
| 647 | memcpy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(PMKIDInfo))); |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 648 | return true; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 649 | } |
| 650 | |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 651 | unsigned short |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 652 | VNTWIFIwGetMaxSupportRate( |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 653 | void *pMgmtObject |
| 654 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 655 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 656 | unsigned short wRate = RATE_54M; |
| 657 | PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 658 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 659 | for (wRate = RATE_54M; wRate > RATE_1M; wRate--) { |
| 660 | if (pMgmt->sNodeDBTable[0].wSuppRate & (1<<wRate)) { |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 661 | return wRate; |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 662 | } |
| 663 | } |
| 664 | if (pMgmt->eCurrentPHYMode == PHY_TYPE_11A) { |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 665 | return RATE_6M; |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 666 | } else { |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 667 | return RATE_1M; |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 668 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 669 | } |
| 670 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 671 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 672 | VNTWIFIvSet11h( |
| 673 | void *pMgmtObject, |
| 674 | bool b11hEnable |
| 675 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 676 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 677 | PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 678 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 679 | pMgmt->b11hEnable = b11hEnable; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 680 | } |
| 681 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 682 | bool |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 683 | VNTWIFIbMeasureReport( |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 684 | void *pMgmtObject, |
| 685 | bool bEndOfReport, |
| 686 | void *pvMeasureEID, |
| 687 | unsigned char byReportMode, |
| 688 | unsigned char byBasicMap, |
| 689 | unsigned char byCCAFraction, |
| 690 | unsigned char *pbyRPIs |
| 691 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 692 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 693 | PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; |
| 694 | unsigned char *pbyCurrentEID = (unsigned char *)(pMgmt->pCurrMeasureEIDRep); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 695 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 696 | //spin_lock_irq(&pDevice->lock); |
| 697 | if ((pvMeasureEID != NULL) && |
| 698 | (pMgmt->uLengthOfRepEIDs < (WLAN_A3FR_MAXLEN - sizeof(MEASEURE_REP) - sizeof(WLAN_80211HDR_A3) - 3)) |
| 699 | ) { |
| 700 | pMgmt->pCurrMeasureEIDRep->byElementID = WLAN_EID_MEASURE_REP; |
| 701 | pMgmt->pCurrMeasureEIDRep->len = 3; |
| 702 | pMgmt->pCurrMeasureEIDRep->byToken = ((PWLAN_IE_MEASURE_REQ)pvMeasureEID)->byToken; |
| 703 | pMgmt->pCurrMeasureEIDRep->byMode = byReportMode; |
| 704 | pMgmt->pCurrMeasureEIDRep->byType = ((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->byType; |
| 705 | switch (pMgmt->pCurrMeasureEIDRep->byType) { |
| 706 | case MEASURE_TYPE_BASIC: |
| 707 | pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_BASIC); |
| 708 | memcpy(&(pMgmt->pCurrMeasureEIDRep->sRep.sBasic), |
| 709 | &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq), |
| 710 | sizeof(MEASEURE_REQ)); |
| 711 | pMgmt->pCurrMeasureEIDRep->sRep.sBasic.byMap = byBasicMap; |
| 712 | break; |
| 713 | case MEASURE_TYPE_CCA: |
| 714 | pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_CCA); |
| 715 | memcpy(&(pMgmt->pCurrMeasureEIDRep->sRep.sCCA), |
| 716 | &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq), |
| 717 | sizeof(MEASEURE_REQ)); |
| 718 | pMgmt->pCurrMeasureEIDRep->sRep.sCCA.byCCABusyFraction = byCCAFraction; |
| 719 | break; |
| 720 | case MEASURE_TYPE_RPI: |
| 721 | pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_RPI); |
| 722 | memcpy(&(pMgmt->pCurrMeasureEIDRep->sRep.sRPI), |
| 723 | &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq), |
| 724 | sizeof(MEASEURE_REQ)); |
| 725 | memcpy(pMgmt->pCurrMeasureEIDRep->sRep.sRPI.abyRPIdensity, pbyRPIs, 8); |
| 726 | break; |
| 727 | default: |
| 728 | break; |
| 729 | } |
| 730 | pbyCurrentEID += (2 + pMgmt->pCurrMeasureEIDRep->len); |
| 731 | pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len); |
| 732 | pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) pbyCurrentEID; |
| 733 | } |
| 734 | if (bEndOfReport == true) { |
| 735 | IEEE11hbMSRRepTx(pMgmt); |
| 736 | } |
| 737 | //spin_unlock_irq(&pDevice->lock); |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 738 | return true; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 739 | } |
| 740 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 741 | bool |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 742 | VNTWIFIbChannelSwitch( |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 743 | void *pMgmtObject, |
| 744 | unsigned char byNewChannel |
| 745 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 746 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 747 | PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 748 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 749 | //spin_lock_irq(&pDevice->lock); |
| 750 | pMgmt->uCurrChannel = byNewChannel; |
| 751 | pMgmt->bSwitchChannel = false; |
| 752 | //spin_unlock_irq(&pDevice->lock); |
| 753 | return true; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 754 | } |
| 755 | |
| 756 | /* |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 757 | bool |
| 758 | VNTWIFIbRadarPresent( |
| 759 | void *pMgmtObject, |
| 760 | unsigned char byChannel |
Joe Perches | 5e0cc8a | 2013-03-18 20:55:37 -0700 | [diff] [blame] | 761 | ) { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 762 | PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; |
| 763 | if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && |
| 764 | (byChannel == (unsigned char) pMgmt->uCurrChannel) && |
| 765 | (pMgmt->bSwitchChannel != true) && |
| 766 | (pMgmt->b11hEnable == true)) { |
| 767 | if (!compare_ether_addr(pMgmt->abyIBSSDFSOwner, CARDpGetCurrentAddress(pMgmt->pAdapter))) { |
| 768 | pMgmt->byNewChannel = CARDbyAutoChannelSelect(pMgmt->pAdapter,(unsigned char) pMgmt->uCurrChannel); |
| 769 | pMgmt->bSwitchChannel = true; |
| 770 | } |
| 771 | BEACONbSendBeacon(pMgmt); |
| 772 | CARDbChannelSwitch(pMgmt->pAdapter, 0, pMgmt->byNewChannel, 10); |
| 773 | } |
| 774 | return true; |
| 775 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 776 | */ |