Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: vt6655: dead code remove ioctl.c/h

The driver nolonger supports these io functions

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Malcolm Priestley and committed by
Greg Kroah-Hartman
ae1927eb 0d24c970

-620
-1
drivers/staging/vt6655/Makefile
··· 21 21 rc4.o \ 22 22 tether.o \ 23 23 tcrc.o \ 24 - ioctl.o \ 25 24 hostap.o \ 26 25 wpa.o \ 27 26 key.o \
-1
drivers/staging/vt6655/device_main.c
··· 70 70 #include "bssdb.h" 71 71 #include "hostap.h" 72 72 #include "wpactl.h" 73 - #include "ioctl.h" 74 73 #include "dpc.h" 75 74 #include "datarate.h" 76 75 #include "rf.h"
-582
drivers/staging/vt6655/ioctl.c
··· 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 - * File: ioctl.c 20 - * 21 - * Purpose: private ioctl functions 22 - * 23 - * Author: Lyndon Chen 24 - * 25 - * Date: Auguest 20, 2003 26 - * 27 - * Functions: 28 - * 29 - * Revision History: 30 - * 31 - */ 32 - 33 - #include "ioctl.h" 34 - #include "iocmd.h" 35 - #include "mac.h" 36 - #include "card.h" 37 - #include "hostap.h" 38 - #include "wpactl.h" 39 - #include "rf.h" 40 - 41 - int private_ioctl(struct vnt_private *pDevice, struct ifreq *rq) 42 - { 43 - PSCmdRequest pReq = (PSCmdRequest)rq; 44 - PSMgmtObject pMgmt = pDevice->pMgmt; 45 - int result = 0; 46 - PWLAN_IE_SSID pItemSSID; 47 - SCmdBSSJoin sJoinCmd; 48 - SCmdScan sScanCmd; 49 - SCmdStartAP sStartAPCmd; 50 - SCmdSetWEP sWEPCmd; 51 - SCmdValue sValue; 52 - SBSSIDList sList; 53 - SNodeList sNodeList; 54 - PSBSSIDList pList; 55 - PSNodeList pNodeList; 56 - unsigned int cbListCount; 57 - PKnownBSS pBSS; 58 - PKnownNodeDB pNode; 59 - unsigned int ii, jj; 60 - unsigned char abySuppRates[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16}; 61 - unsigned char abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 62 - unsigned long dwKeyIndex = 0; 63 - unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; 64 - long ldBm; 65 - 66 - pReq->wResult = 0; 67 - 68 - switch (pReq->wCmdCode) { 69 - case WLAN_CMD_BSS_SCAN: 70 - pr_debug("WLAN_CMD_BSS_SCAN..begin\n"); 71 - if (copy_from_user(&sScanCmd, pReq->data, sizeof(SCmdScan))) { 72 - result = -EFAULT; 73 - break; 74 - } 75 - 76 - pItemSSID = (PWLAN_IE_SSID)sScanCmd.ssid; 77 - if (pItemSSID->len > WLAN_SSID_MAXLEN + 1) 78 - return -EINVAL; 79 - if (pItemSSID->len != 0) { 80 - memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); 81 - memcpy(abyScanSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN); 82 - } 83 - 84 - if (pDevice->bMACSuspend == true) { 85 - if (pDevice->bRadioOff == true) 86 - CARDbRadioPowerOn(pDevice); 87 - vMgrTimerInit(pDevice); 88 - MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); 89 - add_timer(&pMgmt->sTimerSecondCallback); 90 - pDevice->bMACSuspend = false; 91 - } 92 - spin_lock_irq(&pDevice->lock); 93 - if (memcmp(pMgmt->abyCurrBSSID, &abyNullAddr[0], 6) == 0) 94 - BSSvClearBSSList((void *)pDevice, false); 95 - else 96 - BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass); 97 - 98 - if (pItemSSID->len != 0) 99 - bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID); 100 - else 101 - bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL); 102 - spin_unlock_irq(&pDevice->lock); 103 - break; 104 - 105 - case WLAN_CMD_ZONETYPE_SET: 106 - /* mike add :can't support. */ 107 - result = -EOPNOTSUPP; 108 - break; 109 - 110 - case WLAN_CMD_BSS_JOIN: 111 - if (pDevice->bMACSuspend == true) { 112 - if (pDevice->bRadioOff == true) 113 - CARDbRadioPowerOn(pDevice); 114 - vMgrTimerInit(pDevice); 115 - MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); 116 - add_timer(&pMgmt->sTimerSecondCallback); 117 - pDevice->bMACSuspend = false; 118 - } 119 - 120 - if (copy_from_user(&sJoinCmd, pReq->data, sizeof(SCmdBSSJoin))) { 121 - result = -EFAULT; 122 - break; 123 - } 124 - 125 - pItemSSID = (PWLAN_IE_SSID)sJoinCmd.ssid; 126 - if (pItemSSID->len > WLAN_SSID_MAXLEN + 1) 127 - return -EINVAL; 128 - memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); 129 - memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN); 130 - if (sJoinCmd.wBSSType == ADHOC) { 131 - pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; 132 - pr_debug("ioct set to adhoc mode\n"); 133 - } else { 134 - pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA; 135 - pr_debug("ioct set to STA mode\n"); 136 - } 137 - if (sJoinCmd.bPSEnable == true) { 138 - pDevice->ePSMode = WMAC_POWER_FAST; 139 - pMgmt->wListenInterval = 2; 140 - pr_debug("Power Saving On\n"); 141 - } else { 142 - pDevice->ePSMode = WMAC_POWER_CAM; 143 - pMgmt->wListenInterval = 1; 144 - pr_debug("Power Saving Off\n"); 145 - } 146 - 147 - if (sJoinCmd.bShareKeyAuth == true) { 148 - pMgmt->bShareKeyAlgorithm = true; 149 - pr_debug("Share Key\n"); 150 - } else { 151 - pMgmt->bShareKeyAlgorithm = false; 152 - pr_debug("Open System\n"); 153 - } 154 - pDevice->uChannel = sJoinCmd.uChannel; 155 - netif_stop_queue(pDevice->dev); 156 - spin_lock_irq(&pDevice->lock); 157 - pMgmt->eCurrState = WMAC_STATE_IDLE; 158 - bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); 159 - bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL); 160 - spin_unlock_irq(&pDevice->lock); 161 - break; 162 - 163 - case WLAN_CMD_SET_WEP: 164 - pr_debug("WLAN_CMD_SET_WEP Key\n"); 165 - memset(&sWEPCmd, 0, sizeof(SCmdSetWEP)); 166 - if (copy_from_user(&sWEPCmd, pReq->data, sizeof(SCmdSetWEP))) { 167 - result = -EFAULT; 168 - break; 169 - } 170 - if (sWEPCmd.bEnableWep != true) { 171 - pDevice->bEncryptionEnable = false; 172 - pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; 173 - MACvDisableDefaultKey(pDevice->PortOffset); 174 - pr_debug("WEP function disable\n"); 175 - break; 176 - } 177 - 178 - for (ii = 0; ii < WLAN_WEP_NKEYS; ii++) { 179 - if (sWEPCmd.bWepKeyAvailable[ii]) { 180 - if (ii == sWEPCmd.byKeyIndex) 181 - dwKeyIndex = ii | (1 << 31); 182 - else 183 - dwKeyIndex = ii; 184 - 185 - KeybSetDefaultKey(&(pDevice->sKey), 186 - dwKeyIndex, 187 - sWEPCmd.auWepKeyLength[ii], 188 - NULL, 189 - (unsigned char *)&sWEPCmd.abyWepKey[ii][0], 190 - KEY_CTL_WEP, 191 - pDevice->PortOffset, 192 - pDevice->byLocalID); 193 - } 194 - } 195 - pDevice->byKeyIndex = sWEPCmd.byKeyIndex; 196 - pDevice->bTransmitKey = true; 197 - pDevice->bEncryptionEnable = true; 198 - pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled; 199 - break; 200 - 201 - case WLAN_CMD_GET_LINK: { 202 - SCmdLinkStatus sLinkStatus; 203 - 204 - pr_debug("WLAN_CMD_GET_LINK status\n"); 205 - 206 - memset(&sLinkStatus, 0, sizeof(sLinkStatus)); 207 - 208 - if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) 209 - sLinkStatus.wBSSType = ADHOC; 210 - else 211 - sLinkStatus.wBSSType = INFRA; 212 - 213 - if (pMgmt->eCurrState == WMAC_STATE_JOINTED) 214 - sLinkStatus.byState = ADHOC_JOINTED; 215 - else 216 - sLinkStatus.byState = ADHOC_STARTED; 217 - 218 - sLinkStatus.uChannel = pMgmt->uCurrChannel; 219 - if (pDevice->bLinkPass == true) { 220 - sLinkStatus.bLink = true; 221 - pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; 222 - memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len); 223 - memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); 224 - sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate; 225 - pr_debug(" Link Success!\n"); 226 - } else { 227 - sLinkStatus.bLink = false; 228 - sLinkStatus.uLinkRate = 0; 229 - } 230 - if (copy_to_user(pReq->data, &sLinkStatus, sizeof(SCmdLinkStatus))) { 231 - result = -EFAULT; 232 - break; 233 - } 234 - break; 235 - } 236 - case WLAN_CMD_GET_LISTLEN: 237 - cbListCount = 0; 238 - pBSS = &(pMgmt->sBSSList[0]); 239 - for (ii = 0; ii < MAX_BSS_NUM; ii++) { 240 - pBSS = &(pMgmt->sBSSList[ii]); 241 - if (!pBSS->bActive) 242 - continue; 243 - cbListCount++; 244 - } 245 - sList.uItem = cbListCount; 246 - if (copy_to_user(pReq->data, &sList, sizeof(SBSSIDList))) { 247 - result = -EFAULT; 248 - break; 249 - } 250 - pReq->wResult = 0; 251 - break; 252 - 253 - case WLAN_CMD_GET_LIST: 254 - if (copy_from_user(&sList, pReq->data, sizeof(SBSSIDList))) { 255 - result = -EFAULT; 256 - break; 257 - } 258 - if (sList.uItem > (ULONG_MAX - sizeof(SBSSIDList)) / sizeof(SBSSIDItem)) { 259 - result = -EINVAL; 260 - break; 261 - } 262 - pList = (PSBSSIDList)kmalloc(sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)), 263 - GFP_ATOMIC); 264 - if (pList == NULL) { 265 - result = -ENOMEM; 266 - break; 267 - } 268 - pList->uItem = sList.uItem; 269 - pBSS = &(pMgmt->sBSSList[0]); 270 - for (ii = 0, jj = 0; jj < MAX_BSS_NUM; jj++) { 271 - pBSS = &(pMgmt->sBSSList[jj]); 272 - if (pBSS->bActive) { 273 - pList->sBSSIDList[ii].uChannel = pBSS->uChannel; 274 - pList->sBSSIDList[ii].wBeaconInterval = pBSS->wBeaconInterval; 275 - pList->sBSSIDList[ii].wCapInfo = pBSS->wCapInfo; 276 - RFvRSSITodBm(pDevice, (unsigned char)(pBSS->uRSSI), &ldBm); 277 - pList->sBSSIDList[ii].uRSSI = (unsigned int)ldBm; 278 - memcpy(pList->sBSSIDList[ii].abyBSSID, pBSS->abyBSSID, WLAN_BSSID_LEN); 279 - pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID; 280 - memset(pList->sBSSIDList[ii].abySSID, 0, WLAN_SSID_MAXLEN + 1); 281 - memcpy(pList->sBSSIDList[ii].abySSID, pItemSSID->abySSID, pItemSSID->len); 282 - if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) 283 - pList->sBSSIDList[ii].byNetType = INFRA; 284 - else 285 - pList->sBSSIDList[ii].byNetType = ADHOC; 286 - 287 - if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) 288 - pList->sBSSIDList[ii].bWEPOn = true; 289 - else 290 - pList->sBSSIDList[ii].bWEPOn = false; 291 - 292 - ii++; 293 - if (ii >= pList->uItem) 294 - break; 295 - } 296 - } 297 - 298 - if (copy_to_user(pReq->data, pList, sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)))) { 299 - result = -EFAULT; 300 - break; 301 - } 302 - kfree(pList); 303 - pReq->wResult = 0; 304 - break; 305 - 306 - case WLAN_CMD_GET_MIB: 307 - if (copy_to_user(pReq->data, &(pDevice->s802_11Counter), sizeof(SDot11MIBCount))) { 308 - result = -EFAULT; 309 - break; 310 - } 311 - break; 312 - 313 - case WLAN_CMD_GET_STAT: 314 - if (copy_to_user(pReq->data, &(pDevice->scStatistic), sizeof(SStatCounter))) { 315 - result = -EFAULT; 316 - break; 317 - } 318 - break; 319 - 320 - case WLAN_CMD_STOP_MAC: 321 - pr_debug("WLAN_CMD_STOP_MAC\n"); 322 - netif_stop_queue(pDevice->dev); 323 - 324 - spin_lock_irq(&pDevice->lock); 325 - if (pDevice->bRadioOff == false) 326 - CARDbRadioPowerOff(pDevice); 327 - 328 - pDevice->bLinkPass = false; 329 - memset(pMgmt->abyCurrBSSID, 0, 6); 330 - pMgmt->eCurrState = WMAC_STATE_IDLE; 331 - del_timer(&pDevice->sTimerCommand); 332 - del_timer(&pMgmt->sTimerSecondCallback); 333 - pDevice->bCmdRunning = false; 334 - pDevice->bMACSuspend = true; 335 - MACvIntDisable(pDevice->PortOffset); 336 - spin_unlock_irq(&pDevice->lock); 337 - break; 338 - 339 - case WLAN_CMD_START_MAC: 340 - pr_debug("WLAN_CMD_START_MAC\n"); 341 - 342 - if (pDevice->bMACSuspend == true) { 343 - if (pDevice->bRadioOff == true) 344 - CARDbRadioPowerOn(pDevice); 345 - vMgrTimerInit(pDevice); 346 - MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); 347 - add_timer(&pMgmt->sTimerSecondCallback); 348 - pDevice->bMACSuspend = false; 349 - } 350 - break; 351 - 352 - case WLAN_CMD_SET_HOSTAPD: 353 - pr_debug("WLAN_CMD_SET_HOSTAPD\n"); 354 - 355 - if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { 356 - result = -EFAULT; 357 - break; 358 - } 359 - if (sValue.dwValue == 1) { 360 - if (vt6655_hostap_set_hostapd(pDevice, 1, 1) == 0) { 361 - pr_debug("Enable HOSTAP\n"); 362 - } else { 363 - result = -EFAULT; 364 - break; 365 - } 366 - } else { 367 - vt6655_hostap_set_hostapd(pDevice, 0, 1); 368 - pr_debug("Disable HOSTAP\n"); 369 - } 370 - break; 371 - 372 - case WLAN_CMD_SET_HOSTAPD_STA: 373 - pr_debug("WLAN_CMD_SET_HOSTAPD_STA\n"); 374 - break; 375 - 376 - case WLAN_CMD_SET_802_1X: 377 - pr_debug("WLAN_CMD_SET_802_1X\n"); 378 - if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { 379 - result = -EFAULT; 380 - break; 381 - } 382 - 383 - if (sValue.dwValue == 1) { 384 - pDevice->bEnable8021x = true; 385 - pr_debug("Enable 802.1x\n"); 386 - } else { 387 - pDevice->bEnable8021x = false; 388 - pr_debug("Disable 802.1x\n"); 389 - } 390 - break; 391 - 392 - case WLAN_CMD_SET_HOST_WEP: 393 - pr_debug("WLAN_CMD_SET_HOST_WEP\n"); 394 - if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { 395 - result = -EFAULT; 396 - break; 397 - } 398 - 399 - if (sValue.dwValue == 1) { 400 - pDevice->bEnableHostWEP = true; 401 - pr_debug("Enable HostWEP\n"); 402 - } else { 403 - pDevice->bEnableHostWEP = false; 404 - pr_debug("Disable HostWEP\n"); 405 - } 406 - break; 407 - 408 - case WLAN_CMD_SET_WPA: 409 - pr_debug("WLAN_CMD_SET_WPA\n"); 410 - 411 - if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) { 412 - result = -EFAULT; 413 - break; 414 - } 415 - if (sValue.dwValue == 1) { 416 - pr_debug("up wpadev\n"); 417 - eth_hw_addr_inherit(pDevice->wpadev, pDevice->dev); 418 - pDevice->bWPADEVUp = true; 419 - } else { 420 - pr_debug("close wpadev\n"); 421 - pDevice->bWPADEVUp = false; 422 - } 423 - break; 424 - 425 - case WLAN_CMD_AP_START: 426 - pr_debug("WLAN_CMD_AP_START\n"); 427 - if (pDevice->bRadioOff == true) { 428 - CARDbRadioPowerOn(pDevice); 429 - vMgrTimerInit(pDevice); 430 - MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE); 431 - add_timer(&pMgmt->sTimerSecondCallback); 432 - } 433 - if (copy_from_user(&sStartAPCmd, pReq->data, sizeof(SCmdStartAP))) { 434 - result = -EFAULT; 435 - break; 436 - } 437 - 438 - if (sStartAPCmd.wBSSType == AP) { 439 - pMgmt->eConfigMode = WMAC_CONFIG_AP; 440 - pr_debug("ioct set to AP mode\n"); 441 - } else { 442 - pr_debug("ioct BSS type not set to AP mode\n"); 443 - result = -EFAULT; 444 - break; 445 - } 446 - 447 - if (sStartAPCmd.wBBPType == PHY80211g) 448 - pMgmt->byAPBBType = PHY_TYPE_11G; 449 - else if (sStartAPCmd.wBBPType == PHY80211a) 450 - pMgmt->byAPBBType = PHY_TYPE_11A; 451 - else 452 - pMgmt->byAPBBType = PHY_TYPE_11B; 453 - 454 - pItemSSID = (PWLAN_IE_SSID)sStartAPCmd.ssid; 455 - if (pItemSSID->len > WLAN_SSID_MAXLEN + 1) 456 - return -EINVAL; 457 - memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); 458 - memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN); 459 - 460 - if ((sStartAPCmd.uChannel > 0) && (sStartAPCmd.uChannel <= 14)) 461 - pDevice->uChannel = sStartAPCmd.uChannel; 462 - 463 - if ((sStartAPCmd.uBeaconInt >= 20) && (sStartAPCmd.uBeaconInt <= 1000)) 464 - pMgmt->wIBSSBeaconPeriod = sStartAPCmd.uBeaconInt; 465 - else 466 - pMgmt->wIBSSBeaconPeriod = 100; 467 - 468 - if (sStartAPCmd.bShareKeyAuth == true) { 469 - pMgmt->bShareKeyAlgorithm = true; 470 - pr_debug("Share Key\n"); 471 - } else { 472 - pMgmt->bShareKeyAlgorithm = false; 473 - pr_debug("Open System\n"); 474 - } 475 - memcpy(pMgmt->abyIBSSSuppRates, abySuppRates, 6); 476 - 477 - if (sStartAPCmd.byBasicRate & BIT3) { 478 - pMgmt->abyIBSSSuppRates[2] |= BIT7; 479 - pMgmt->abyIBSSSuppRates[3] |= BIT7; 480 - pMgmt->abyIBSSSuppRates[4] |= BIT7; 481 - pMgmt->abyIBSSSuppRates[5] |= BIT7; 482 - } else if (sStartAPCmd.byBasicRate & BIT2) { 483 - pMgmt->abyIBSSSuppRates[2] |= BIT7; 484 - pMgmt->abyIBSSSuppRates[3] |= BIT7; 485 - pMgmt->abyIBSSSuppRates[4] |= BIT7; 486 - } else if (sStartAPCmd.byBasicRate & BIT1) { 487 - pMgmt->abyIBSSSuppRates[2] |= BIT7; 488 - pMgmt->abyIBSSSuppRates[3] |= BIT7; 489 - } else if (sStartAPCmd.byBasicRate & BIT1) { 490 - pMgmt->abyIBSSSuppRates[2] |= BIT7; 491 - } else { 492 - /* default 1,2M */ 493 - pMgmt->abyIBSSSuppRates[2] |= BIT7; 494 - pMgmt->abyIBSSSuppRates[3] |= BIT7; 495 - } 496 - 497 - pr_debug("Support Rate= %*ph\n", 498 - 4, pMgmt->abyIBSSSuppRates + 2); 499 - 500 - netif_stop_queue(pDevice->dev); 501 - spin_lock_irq(&pDevice->lock); 502 - bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL); 503 - spin_unlock_irq(&pDevice->lock); 504 - break; 505 - 506 - case WLAN_CMD_GET_NODE_CNT: 507 - cbListCount = 0; 508 - pNode = &(pMgmt->sNodeDBTable[0]); 509 - for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { 510 - pNode = &(pMgmt->sNodeDBTable[ii]); 511 - if (!pNode->bActive) 512 - continue; 513 - cbListCount++; 514 - } 515 - 516 - sNodeList.uItem = cbListCount; 517 - if (copy_to_user(pReq->data, &sNodeList, sizeof(SNodeList))) { 518 - result = -EFAULT; 519 - break; 520 - } 521 - pReq->wResult = 0; 522 - break; 523 - 524 - case WLAN_CMD_GET_NODE_LIST: 525 - if (copy_from_user(&sNodeList, pReq->data, sizeof(SNodeList))) { 526 - result = -EFAULT; 527 - break; 528 - } 529 - if (sNodeList.uItem > (ULONG_MAX - sizeof(SNodeList)) / sizeof(SNodeItem)) { 530 - result = -EINVAL; 531 - break; 532 - } 533 - pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), 534 - GFP_ATOMIC); 535 - if (pNodeList == NULL) { 536 - result = -ENOMEM; 537 - break; 538 - } 539 - pNodeList->uItem = sNodeList.uItem; 540 - pNode = &(pMgmt->sNodeDBTable[0]); 541 - for (ii = 0, jj = 0; ii < (MAX_NODE_NUM + 1); ii++) { 542 - pNode = &(pMgmt->sNodeDBTable[ii]); 543 - if (pNode->bActive) { 544 - pNodeList->sNodeList[jj].wAID = pNode->wAID; 545 - memcpy(pNodeList->sNodeList[jj].abyMACAddr, pNode->abyMACAddr, WLAN_ADDR_LEN); 546 - pNodeList->sNodeList[jj].wTxDataRate = pNode->wTxDataRate; 547 - pNodeList->sNodeList[jj].wInActiveCount = (unsigned short)pNode->uInActiveCount; 548 - pNodeList->sNodeList[jj].wEnQueueCnt = (unsigned short)pNode->wEnQueueCnt; 549 - pNodeList->sNodeList[jj].wFlags = (unsigned short)pNode->dwFlags; 550 - pNodeList->sNodeList[jj].bPWBitOn = pNode->bPSEnable; 551 - pNodeList->sNodeList[jj].byKeyIndex = pNode->byKeyIndex; 552 - pNodeList->sNodeList[jj].wWepKeyLength = pNode->uWepKeyLength; 553 - memcpy(&(pNodeList->sNodeList[jj].abyWepKey[0]), &(pNode->abyWepKey[0]), WEP_KEYMAXLEN); 554 - pr_debug("key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", 555 - pNodeList->sNodeList[jj].abyWepKey[0], 556 - pNodeList->sNodeList[jj].abyWepKey[1], 557 - pNodeList->sNodeList[jj].abyWepKey[2], 558 - pNodeList->sNodeList[jj].abyWepKey[3], 559 - pNodeList->sNodeList[jj].abyWepKey[4]); 560 - pNodeList->sNodeList[jj].bIsInFallback = pNode->bIsInFallback; 561 - pNodeList->sNodeList[jj].uTxFailures = pNode->uTxFailures; 562 - pNodeList->sNodeList[jj].uTxAttempts = pNode->uTxAttempts; 563 - pNodeList->sNodeList[jj].wFailureRatio = (unsigned short)pNode->uFailureRatio; 564 - jj++; 565 - if (jj >= pNodeList->uItem) 566 - break; 567 - } 568 - } 569 - if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) { 570 - result = -EFAULT; 571 - break; 572 - } 573 - kfree(pNodeList); 574 - pReq->wResult = 0; 575 - break; 576 - 577 - default: 578 - pr_debug("Private command not support..\n"); 579 - } 580 - 581 - return result; 582 - }
-36
drivers/staging/vt6655/ioctl.h
··· 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 - * File: hostap.h 20 - * 21 - * Purpose: 22 - * 23 - * Author: Lyndon Chen 24 - * 25 - * Date: May 21, 2003 26 - * 27 - */ 28 - 29 - #ifndef __IOCTL_H__ 30 - #define __IOCTL_H__ 31 - 32 - #include "device.h" 33 - 34 - int private_ioctl(struct vnt_private *, struct ifreq *rq); 35 - 36 - #endif /* __IOCTL_H__ */