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 -------------------------*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 42 | |
| 43 | /*--------------------- Static Classes ----------------------------*/ |
| 44 | |
| 45 | /*--------------------- Static Variables --------------------------*/ |
| 46 | |
| 47 | /*--------------------- Static Functions --------------------------*/ |
| 48 | |
| 49 | /*--------------------- Export Variables --------------------------*/ |
| 50 | |
| 51 | /*--------------------- Export Functions --------------------------*/ |
| 52 | |
| 53 | /*+ |
| 54 | * |
| 55 | * Description: |
| 56 | * Set Operation Mode |
| 57 | * |
| 58 | * Parameters: |
| 59 | * In: |
| 60 | * pMgmtHandle - pointer to management object |
Justin P. Mattock | 789d1ae | 2012-08-20 08:43:13 -0700 | [diff] [blame] | 61 | * eOPMode - Operation Mode |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 62 | * Out: |
| 63 | * none |
| 64 | * |
| 65 | * Return Value: none |
| 66 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 67 | -*/ |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 68 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 69 | VNTWIFIvSetOPMode( |
| 70 | void *pMgmtHandle, |
| 71 | WMAC_CONFIG_MODE eOPMode |
| 72 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 73 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 74 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
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 | pMgmt->eConfigMode = eOPMode; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 77 | } |
| 78 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 79 | /*+ |
| 80 | * |
| 81 | * Description: |
| 82 | * Set Operation Mode |
| 83 | * |
| 84 | * Parameters: |
| 85 | * In: |
| 86 | * pMgmtHandle - pointer to management object |
| 87 | * wBeaconPeriod - Beacon Period |
| 88 | * wATIMWindow - ATIM window |
| 89 | * uChannel - channel number |
| 90 | * Out: |
| 91 | * none |
| 92 | * |
| 93 | * Return Value: none |
| 94 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 95 | -*/ |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 96 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 97 | VNTWIFIvSetIBSSParameter( |
| 98 | void *pMgmtHandle, |
| 99 | unsigned short wBeaconPeriod, |
| 100 | unsigned short wATIMWindow, |
| 101 | unsigned int uChannel |
| 102 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 103 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 104 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
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 | pMgmt->wIBSSBeaconPeriod = wBeaconPeriod; |
| 107 | pMgmt->wIBSSATIMWindow = wATIMWindow; |
| 108 | pMgmt->uIBSSChannel = uChannel; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | /*+ |
| 112 | * |
| 113 | * Description: |
| 114 | * Get current SSID |
| 115 | * |
| 116 | * Parameters: |
| 117 | * In: |
| 118 | * pMgmtHandle - pointer to management object |
| 119 | * Out: |
| 120 | * none |
| 121 | * |
| 122 | * Return Value: current SSID pointer. |
| 123 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 124 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 125 | PWLAN_IE_SSID |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 126 | VNTWIFIpGetCurrentSSID( |
| 127 | void *pMgmtHandle |
| 128 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 129 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 130 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Guillaume Clement | 6b71127 | 2014-07-25 01:06:16 +0200 | [diff] [blame] | 131 | |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 132 | return (PWLAN_IE_SSID) pMgmt->abyCurrSSID; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 133 | } |
| 134 | |
| 135 | /*+ |
| 136 | * |
| 137 | * Description: |
| 138 | * Get current link channel |
| 139 | * |
| 140 | * Parameters: |
| 141 | * In: |
| 142 | * pMgmtHandle - pointer to management object |
| 143 | * Out: |
| 144 | * none |
| 145 | * |
| 146 | * Return Value: current Channel. |
| 147 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 148 | -*/ |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 149 | unsigned int |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 150 | VNTWIFIpGetCurrentChannel( |
| 151 | void *pMgmtHandle |
| 152 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 153 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 154 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Guillaume Clement | 6b71127 | 2014-07-25 01:06:16 +0200 | [diff] [blame] | 155 | |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 156 | if (pMgmtHandle != NULL) |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 157 | return pMgmt->uCurrChannel; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 158 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 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; |
Guillaume Clement | 6b71127 | 2014-07-25 01:06:16 +0200 | [diff] [blame] | 182 | |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 183 | return pMgmt->wCurrAID; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 184 | } |
| 185 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 186 | /*+ |
| 187 | * |
| 188 | * Description: |
| 189 | * This routine return max support rate of IES |
| 190 | * |
| 191 | * Parameters: |
| 192 | * In: |
| 193 | * pSupportRateIEs |
| 194 | * pExtSupportRateIEs |
| 195 | * |
| 196 | * Out: |
| 197 | * |
| 198 | * Return Value: max support rate |
| 199 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 200 | -*/ |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 201 | unsigned char |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 202 | VNTWIFIbyGetMaxSupportRate( |
| 203 | PWLAN_IE_SUPP_RATES pSupportRateIEs, |
| 204 | PWLAN_IE_SUPP_RATES pExtSupportRateIEs |
| 205 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 206 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 207 | unsigned char byMaxSupportRate = RATE_1M; |
| 208 | unsigned char bySupportRate = RATE_1M; |
| 209 | unsigned int ii = 0; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 210 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 211 | if (pSupportRateIEs) { |
| 212 | for (ii = 0; ii < pSupportRateIEs->len; ii++) { |
| 213 | bySupportRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]); |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 214 | if (bySupportRate > byMaxSupportRate) |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 215 | byMaxSupportRate = bySupportRate; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 216 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 217 | } |
| 218 | } |
| 219 | if (pExtSupportRateIEs) { |
| 220 | for (ii = 0; ii < pExtSupportRateIEs->len; ii++) { |
| 221 | bySupportRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]); |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 222 | if (bySupportRate > byMaxSupportRate) |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 223 | byMaxSupportRate = bySupportRate; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 224 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 225 | } |
| 226 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 227 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 228 | return byMaxSupportRate; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | /*+ |
| 232 | * |
| 233 | * Description: |
| 234 | * This routine return data rate of ACK packtet |
| 235 | * |
| 236 | * Parameters: |
| 237 | * In: |
| 238 | * byRxDataRate |
| 239 | * pSupportRateIEs |
| 240 | * pExtSupportRateIEs |
| 241 | * |
| 242 | * Out: |
| 243 | * |
| 244 | * Return Value: max support rate |
| 245 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 246 | -*/ |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 247 | unsigned char |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 248 | VNTWIFIbyGetACKTxRate( |
| 249 | unsigned char byRxDataRate, |
| 250 | PWLAN_IE_SUPP_RATES pSupportRateIEs, |
| 251 | PWLAN_IE_SUPP_RATES pExtSupportRateIEs |
| 252 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 253 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 254 | unsigned char byMaxAckRate; |
| 255 | unsigned char byBasicRate; |
| 256 | unsigned int ii; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 257 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 258 | if (byRxDataRate <= RATE_11M) { |
| 259 | byMaxAckRate = RATE_1M; |
| 260 | } else { |
Merlin Chlosta | 5c3ddb3 | 2014-06-19 19:59:32 +0200 | [diff] [blame] | 261 | /* 24M is mandatory for 802.11a and 802.11g */ |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 262 | byMaxAckRate = RATE_24M; |
| 263 | } |
| 264 | if (pSupportRateIEs) { |
| 265 | for (ii = 0; ii < pSupportRateIEs->len; ii++) { |
| 266 | if (pSupportRateIEs->abyRates[ii] & 0x80) { |
| 267 | byBasicRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]); |
| 268 | if ((byBasicRate <= byRxDataRate) && |
| 269 | (byBasicRate > byMaxAckRate)) { |
| 270 | byMaxAckRate = byBasicRate; |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | } |
| 275 | if (pExtSupportRateIEs) { |
| 276 | for (ii = 0; ii < pExtSupportRateIEs->len; ii++) { |
| 277 | if (pExtSupportRateIEs->abyRates[ii] & 0x80) { |
| 278 | byBasicRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]); |
| 279 | if ((byBasicRate <= byRxDataRate) && |
| 280 | (byBasicRate > byMaxAckRate)) { |
| 281 | byMaxAckRate = byBasicRate; |
| 282 | } |
| 283 | } |
| 284 | } |
| 285 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 286 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 287 | return byMaxAckRate; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 288 | } |
| 289 | |
| 290 | /*+ |
| 291 | * |
| 292 | * Description: |
| 293 | * Set Authentication Mode |
| 294 | * |
| 295 | * Parameters: |
| 296 | * In: |
| 297 | * pMgmtHandle - pointer to management object |
| 298 | * eAuthMode - Authentication mode |
| 299 | * Out: |
| 300 | * none |
| 301 | * |
| 302 | * Return Value: none |
| 303 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 304 | -*/ |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 305 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 306 | VNTWIFIvSetAuthenticationMode( |
| 307 | void *pMgmtHandle, |
| 308 | WMAC_AUTHENTICATION_MODE eAuthMode |
| 309 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 310 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 311 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 312 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 313 | pMgmt->eAuthenMode = eAuthMode; |
| 314 | if ((eAuthMode == WMAC_AUTH_SHAREKEY) || |
| 315 | (eAuthMode == WMAC_AUTH_AUTO)) { |
| 316 | pMgmt->bShareKeyAlgorithm = true; |
| 317 | } else { |
| 318 | pMgmt->bShareKeyAlgorithm = false; |
| 319 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 320 | } |
| 321 | |
| 322 | /*+ |
| 323 | * |
| 324 | * Description: |
| 325 | * Set Encryption Mode |
| 326 | * |
| 327 | * Parameters: |
| 328 | * In: |
| 329 | * pMgmtHandle - pointer to management object |
| 330 | * eAuthMode - Authentication mode |
| 331 | * Out: |
| 332 | * none |
| 333 | * |
| 334 | * Return Value: none |
| 335 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 336 | -*/ |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 337 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 338 | VNTWIFIvSetEncryptionMode( |
| 339 | void *pMgmtHandle, |
| 340 | WMAC_ENCRYPTION_MODE eEncryptionMode |
| 341 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 342 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 343 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 344 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 345 | pMgmt->eEncryptionMode = eEncryptionMode; |
| 346 | if ((eEncryptionMode == WMAC_ENCRYPTION_WEPEnabled) || |
| 347 | (eEncryptionMode == WMAC_ENCRYPTION_TKIPEnabled) || |
| 348 | (eEncryptionMode == WMAC_ENCRYPTION_AESEnabled)) { |
| 349 | pMgmt->bPrivacyInvoked = true; |
| 350 | } else { |
| 351 | pMgmt->bPrivacyInvoked = false; |
| 352 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 353 | } |
| 354 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 355 | bool |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 356 | VNTWIFIbConfigPhyMode( |
| 357 | void *pMgmtHandle, |
| 358 | CARD_PHY_TYPE ePhyType |
| 359 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 360 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 361 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 362 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 363 | if ((ePhyType != PHY_TYPE_AUTO) && |
| 364 | (ePhyType != pMgmt->eCurrentPHYMode)) { |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 365 | if (CARDbSetPhyParameter(pMgmt->pAdapter, ePhyType, 0, 0, NULL, NULL) == true) |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 366 | pMgmt->eCurrentPHYMode = ePhyType; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 367 | else |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 368 | return false; |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 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 | |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 382 | if ((pMgmt != NULL) && (pePhyType != NULL)) |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 383 | *(PCARD_PHY_TYPE)pePhyType = pMgmt->eConfigPHYMode; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 384 | } |
| 385 | |
| 386 | /*+ |
| 387 | * |
| 388 | * Description: |
| 389 | * Clear BSS List Database except current assoc BSS |
| 390 | * |
| 391 | * Parameters: |
| 392 | * In: |
| 393 | * pMgmtHandle - Management Object structure |
| 394 | * bLinkPass - Current Link status |
| 395 | * Out: |
| 396 | * |
| 397 | * Return Value: None. |
| 398 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 399 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 400 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 401 | /*+ |
| 402 | * |
| 403 | * Description: |
| 404 | * Query BSS List in management database |
| 405 | * |
| 406 | * Parameters: |
| 407 | * In: |
| 408 | * pMgmtHandle - Management Object structure |
| 409 | * Out: |
| 410 | * puBSSCount - BSS count |
| 411 | * pvFirstBSS - pointer to first BSS |
| 412 | * |
| 413 | * Return Value: None. |
| 414 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 415 | -*/ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 416 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 417 | void |
Charles Clément | fe4f34b | 2010-06-25 10:48:53 -0700 | [diff] [blame] | 418 | VNTWIFIvQueryBSSList(void *pMgmtHandle, unsigned int *puBSSCount, void **pvFirstBSS) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 419 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 420 | unsigned int ii = 0; |
| 421 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
| 422 | PKnownBSS pBSS = NULL; |
| 423 | unsigned int uCount = 0; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 424 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 425 | *pvFirstBSS = NULL; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 426 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 427 | for (ii = 0; ii < MAX_BSS_NUM; ii++) { |
| 428 | pBSS = &(pMgmt->sBSSList[ii]); |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 429 | if (!pBSS->bActive) |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 430 | continue; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 431 | |
| 432 | if (*pvFirstBSS == NULL) |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 433 | *pvFirstBSS = &(pMgmt->sBSSList[ii]); |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 434 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 435 | uCount++; |
| 436 | } |
| 437 | *puBSSCount = uCount; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 438 | } |
| 439 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 440 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 441 | VNTWIFIvGetNextBSS( |
| 442 | void *pMgmtHandle, |
| 443 | void *pvCurrentBSS, |
| 444 | void **pvNextBSS |
| 445 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 446 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 447 | PKnownBSS pBSS = (PKnownBSS) pvCurrentBSS; |
| 448 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 449 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 450 | *pvNextBSS = NULL; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 451 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 452 | while (*pvNextBSS == NULL) { |
| 453 | pBSS++; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 454 | if (pBSS > &(pMgmt->sBSSList[MAX_BSS_NUM])) |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 455 | return; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 456 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 457 | if (pBSS->bActive == true) { |
| 458 | *pvNextBSS = pBSS; |
| 459 | return; |
| 460 | } |
| 461 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 462 | } |
| 463 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 464 | /*+ |
| 465 | * |
| 466 | * Description: |
| 467 | * Update Tx attemps, Tx failure counter in Node DB |
| 468 | * |
| 469 | * In: |
| 470 | * Out: |
| 471 | * none |
| 472 | * |
| 473 | * Return Value: none |
| 474 | * |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 475 | -*/ |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 476 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 477 | VNTWIFIvUpdateNodeTxCounter( |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 478 | void *pMgmtHandle, |
| 479 | unsigned char *pbyDestAddress, |
| 480 | bool bTxOk, |
| 481 | unsigned short wRate, |
| 482 | unsigned char *pbyTxFailCount |
| 483 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 484 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 485 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
| 486 | unsigned int uNodeIndex = 0; |
| 487 | unsigned int ii; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 488 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 489 | if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) || |
| 490 | (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) { |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 491 | if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex) == false) |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 492 | return; |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 493 | } |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 494 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 495 | pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts++; |
Teodora Baluta | 1208f14a | 2013-11-10 17:12:42 +0200 | [diff] [blame] | 496 | if (bTxOk) { |
Merlin Chlosta | 5c3ddb3 | 2014-06-19 19:59:32 +0200 | [diff] [blame] | 497 | /* transmit success, TxAttempts at least plus one */ |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 498 | pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++; |
| 499 | pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wRate]++; |
| 500 | } else { |
| 501 | pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++; |
| 502 | } |
| 503 | pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += pbyTxFailCount[MAX_RATE]; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 504 | for (ii = 0; ii < MAX_RATE; ii++) |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 505 | pMgmt->sNodeDBTable[uNodeIndex].uTxFail[ii] += pbyTxFailCount[ii]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 506 | } |
| 507 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 508 | void |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 509 | VNTWIFIvGetTxRate( |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 510 | void *pMgmtHandle, |
| 511 | unsigned char *pbyDestAddress, |
| 512 | unsigned short *pwTxDataRate, |
| 513 | unsigned char *pbyACKRate, |
| 514 | unsigned char *pbyCCKBasicRate, |
| 515 | unsigned char *pbyOFDMBasicRate |
| 516 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 517 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 518 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
| 519 | unsigned int uNodeIndex = 0; |
| 520 | unsigned short wTxDataRate = RATE_1M; |
| 521 | unsigned char byACKRate = RATE_1M; |
| 522 | unsigned char byCCKBasicRate = RATE_1M; |
| 523 | unsigned char byOFDMBasicRate = RATE_24M; |
| 524 | PWLAN_IE_SUPP_RATES pSupportRateIEs = NULL; |
| 525 | PWLAN_IE_SUPP_RATES pExtSupportRateIEs = NULL; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 526 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 527 | if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) || |
| 528 | (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) { |
Merlin Chlosta | 5c3ddb3 | 2014-06-19 19:59:32 +0200 | [diff] [blame] | 529 | /* Adhoc Tx rate decided from node DB */ |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 530 | if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex)) { |
| 531 | wTxDataRate = (pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate); |
| 532 | pSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrSuppRates); |
| 533 | pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrExtSuppRates); |
| 534 | } else { |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 535 | if (pMgmt->eCurrentPHYMode != PHY_TYPE_11A) |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 536 | wTxDataRate = RATE_2M; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 537 | else |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 538 | wTxDataRate = RATE_24M; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 539 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 540 | pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates; |
| 541 | pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates; |
| 542 | } |
Merlin Chlosta | 5c3ddb3 | 2014-06-19 19:59:32 +0200 | [diff] [blame] | 543 | } else { /* Infrastructure: rate decided from AP Node, index = 0 */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 544 | |
| 545 | wTxDataRate = (pMgmt->sNodeDBTable[0].wTxDataRate); |
| 546 | #ifdef PLICE_DEBUG |
Guillaume Clement | 941ead9 | 2014-07-25 01:06:21 +0200 | [diff] [blame] | 547 | pr_debug("GetTxRate:AP MAC is %pM,TxRate is %d\n", |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 548 | pMgmt->sNodeDBTable[0].abyMACAddr, wTxDataRate); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 549 | #endif |
| 550 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 551 | pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates; |
| 552 | pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates; |
| 553 | } |
| 554 | byACKRate = VNTWIFIbyGetACKTxRate((unsigned char) wTxDataRate, |
| 555 | pSupportRateIEs, |
| 556 | pExtSupportRateIEs |
| 557 | ); |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 558 | if (byACKRate > (unsigned char) wTxDataRate) |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 559 | byACKRate = (unsigned char) wTxDataRate; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 560 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 561 | byCCKBasicRate = VNTWIFIbyGetACKTxRate(RATE_11M, |
| 562 | pSupportRateIEs, |
| 563 | pExtSupportRateIEs |
| 564 | ); |
| 565 | byOFDMBasicRate = VNTWIFIbyGetACKTxRate(RATE_54M, |
| 566 | pSupportRateIEs, |
| 567 | pExtSupportRateIEs |
| 568 | ); |
| 569 | *pwTxDataRate = wTxDataRate; |
| 570 | *pbyACKRate = byACKRate; |
| 571 | *pbyCCKBasicRate = byCCKBasicRate; |
| 572 | *pbyOFDMBasicRate = byOFDMBasicRate; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 573 | } |
| 574 | |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 575 | unsigned char |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 576 | VNTWIFIbyGetKeyCypher( |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 577 | void *pMgmtHandle, |
| 578 | bool bGroupKey |
| 579 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 580 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 581 | PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 582 | |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 583 | if (bGroupKey) |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 584 | return pMgmt->byCSSGK; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 585 | else |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 586 | return pMgmt->byCSSPK; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 587 | } |
| 588 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 589 | bool |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 590 | VNTWIFIbSetPMKIDCache( |
| 591 | void *pMgmtObject, |
| 592 | unsigned long ulCount, |
| 593 | void *pPMKIDInfo |
| 594 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 595 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 596 | PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 597 | |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 598 | if (ulCount > MAX_PMKID_CACHE) |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 599 | return false; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 600 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 601 | pMgmt->gsPMKIDCache.BSSIDInfoCount = ulCount; |
| 602 | memcpy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(PMKIDInfo))); |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 603 | return true; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 604 | } |
| 605 | |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 606 | unsigned short |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 607 | VNTWIFIwGetMaxSupportRate( |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 608 | void *pMgmtObject |
| 609 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 610 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 611 | unsigned short wRate = RATE_54M; |
| 612 | PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 613 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 614 | for (wRate = RATE_54M; wRate > RATE_1M; wRate--) { |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 615 | if (pMgmt->sNodeDBTable[0].wSuppRate & (1<<wRate)) |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 616 | return wRate; |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 617 | } |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 618 | |
| 619 | if (pMgmt->eCurrentPHYMode == PHY_TYPE_11A) |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 620 | return RATE_6M; |
Guido Martínez | bc5cf65 | 2014-04-19 16:45:00 -0300 | [diff] [blame] | 621 | else |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 622 | return RATE_1M; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 623 | } |
| 624 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 625 | void |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 626 | VNTWIFIvSet11h( |
| 627 | void *pMgmtObject, |
| 628 | bool b11hEnable |
| 629 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 630 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 631 | PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 632 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 633 | pMgmt->b11hEnable = b11hEnable; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 634 | } |
| 635 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 636 | bool |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 637 | VNTWIFIbMeasureReport( |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 638 | void *pMgmtObject, |
| 639 | bool bEndOfReport, |
| 640 | void *pvMeasureEID, |
| 641 | unsigned char byReportMode, |
| 642 | unsigned char byBasicMap, |
| 643 | unsigned char byCCAFraction, |
| 644 | unsigned char *pbyRPIs |
| 645 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 646 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 647 | PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; |
| 648 | unsigned char *pbyCurrentEID = (unsigned char *)(pMgmt->pCurrMeasureEIDRep); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 649 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 650 | if ((pvMeasureEID != NULL) && |
| 651 | (pMgmt->uLengthOfRepEIDs < (WLAN_A3FR_MAXLEN - sizeof(MEASEURE_REP) - sizeof(WLAN_80211HDR_A3) - 3)) |
| 652 | ) { |
| 653 | pMgmt->pCurrMeasureEIDRep->byElementID = WLAN_EID_MEASURE_REP; |
| 654 | pMgmt->pCurrMeasureEIDRep->len = 3; |
| 655 | pMgmt->pCurrMeasureEIDRep->byToken = ((PWLAN_IE_MEASURE_REQ)pvMeasureEID)->byToken; |
| 656 | pMgmt->pCurrMeasureEIDRep->byMode = byReportMode; |
| 657 | pMgmt->pCurrMeasureEIDRep->byType = ((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->byType; |
| 658 | switch (pMgmt->pCurrMeasureEIDRep->byType) { |
| 659 | case MEASURE_TYPE_BASIC: |
| 660 | pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_BASIC); |
| 661 | memcpy(&(pMgmt->pCurrMeasureEIDRep->sRep.sBasic), |
| 662 | &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq), |
| 663 | sizeof(MEASEURE_REQ)); |
| 664 | pMgmt->pCurrMeasureEIDRep->sRep.sBasic.byMap = byBasicMap; |
| 665 | break; |
| 666 | case MEASURE_TYPE_CCA: |
| 667 | pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_CCA); |
| 668 | memcpy(&(pMgmt->pCurrMeasureEIDRep->sRep.sCCA), |
| 669 | &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq), |
| 670 | sizeof(MEASEURE_REQ)); |
| 671 | pMgmt->pCurrMeasureEIDRep->sRep.sCCA.byCCABusyFraction = byCCAFraction; |
| 672 | break; |
| 673 | case MEASURE_TYPE_RPI: |
| 674 | pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_RPI); |
| 675 | memcpy(&(pMgmt->pCurrMeasureEIDRep->sRep.sRPI), |
| 676 | &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq), |
| 677 | sizeof(MEASEURE_REQ)); |
| 678 | memcpy(pMgmt->pCurrMeasureEIDRep->sRep.sRPI.abyRPIdensity, pbyRPIs, 8); |
| 679 | break; |
| 680 | default: |
| 681 | break; |
| 682 | } |
| 683 | pbyCurrentEID += (2 + pMgmt->pCurrMeasureEIDRep->len); |
| 684 | pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len); |
| 685 | pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) pbyCurrentEID; |
| 686 | } |
Guillaume Clement | cba6090 | 2014-07-25 01:06:25 +0200 | [diff] [blame] | 687 | if (bEndOfReport) |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 688 | IEEE11hbMSRRepTx(pMgmt); |
Guido Martínez | 4e8a7e5 | 2014-04-19 16:44:59 -0300 | [diff] [blame] | 689 | |
Joe Perches | a4ef27a | 2013-03-18 20:55:38 -0700 | [diff] [blame] | 690 | return true; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 691 | } |
| 692 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 693 | bool |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 694 | VNTWIFIbChannelSwitch( |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 695 | void *pMgmtObject, |
| 696 | unsigned char byNewChannel |
| 697 | ) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 698 | { |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 699 | PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 700 | |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 701 | pMgmt->uCurrChannel = byNewChannel; |
| 702 | pMgmt->bSwitchChannel = false; |
Joe Perches | d9d644e | 2013-03-18 10:45:08 -0700 | [diff] [blame] | 703 | return true; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 704 | } |