aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/vt6656
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/vt6656')
-rw-r--r--drivers/staging/vt6656/80211mgr.c2
-rw-r--r--drivers/staging/vt6656/Makefile1
-rw-r--r--drivers/staging/vt6656/bssdb.c43
-rw-r--r--drivers/staging/vt6656/desc.h28
-rw-r--r--drivers/staging/vt6656/device.h48
-rw-r--r--drivers/staging/vt6656/dpc.c64
-rw-r--r--drivers/staging/vt6656/firmware.c22
-rw-r--r--drivers/staging/vt6656/hostap.c6
-rw-r--r--drivers/staging/vt6656/int.h4
-rw-r--r--drivers/staging/vt6656/ioctl.c648
-rw-r--r--drivers/staging/vt6656/ioctl.h54
-rw-r--r--drivers/staging/vt6656/iwctl.c510
-rw-r--r--drivers/staging/vt6656/iwctl.h79
-rw-r--r--drivers/staging/vt6656/key.c55
-rw-r--r--drivers/staging/vt6656/key.h8
-rw-r--r--drivers/staging/vt6656/mac.c6
-rw-r--r--drivers/staging/vt6656/main_usb.c552
-rw-r--r--drivers/staging/vt6656/mib.c1
-rw-r--r--drivers/staging/vt6656/mib.h1
-rw-r--r--drivers/staging/vt6656/rf.c3
-rw-r--r--drivers/staging/vt6656/rxtx.c36
-rw-r--r--drivers/staging/vt6656/rxtx.h8
-rw-r--r--drivers/staging/vt6656/tkip.c40
-rw-r--r--drivers/staging/vt6656/ttype.h16
-rw-r--r--drivers/staging/vt6656/upc.h162
-rw-r--r--drivers/staging/vt6656/usbpipe.c4
-rw-r--r--drivers/staging/vt6656/wcmd.c44
-rw-r--r--drivers/staging/vt6656/wmgr.c66
-rw-r--r--drivers/staging/vt6656/wmgr.h42
-rw-r--r--drivers/staging/vt6656/wpa2.c2
-rw-r--r--drivers/staging/vt6656/wpa2.h4
-rw-r--r--drivers/staging/vt6656/wpactl.c664
-rw-r--r--drivers/staging/vt6656/wpactl.h12
33 files changed, 583 insertions, 2652 deletions
diff --git a/drivers/staging/vt6656/80211mgr.c b/drivers/staging/vt6656/80211mgr.c
index 39f98423dc02..e6ced95e6fa7 100644
--- a/drivers/staging/vt6656/80211mgr.c
+++ b/drivers/staging/vt6656/80211mgr.c
@@ -52,11 +52,11 @@
*
*/
+#include "device.h"
#include "tmacro.h"
#include "tether.h"
#include "80211mgr.h"
#include "80211hdr.h"
-#include "device.h"
#include "wpa.h"
/*--------------------- Static Definitions -------------------------*/
diff --git a/drivers/staging/vt6656/Makefile b/drivers/staging/vt6656/Makefile
index 41ed06bb6654..c998547884c0 100644
--- a/drivers/staging/vt6656/Makefile
+++ b/drivers/staging/vt6656/Makefile
@@ -20,7 +20,6 @@ vt6656_stage-y += main_usb.o \
rc4.o \
tether.o \
tcrc.o \
- ioctl.o \
hostap.o \
wpa.o \
key.o \
diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index 2ac066df8340..6a1394192248 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -882,7 +882,6 @@ void BSSvSecondCallBack(void *hDeviceContext)
unsigned int uSleepySTACnt = 0;
unsigned int uNonShortSlotSTACnt = 0;
unsigned int uLongPreambleSTACnt = 0;
- viawget_wpa_header *wpahdr;
spin_lock_irq(&pDevice->lock);
@@ -913,7 +912,6 @@ if(pDevice->byReAssocCount > 0) {
if((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != TRUE)) { //10 sec timeout
printk("Re-association timeout!!!\n");
pDevice->byReAssocCount = 0;
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
// if(pDevice->bWPASuppWextEnabled == TRUE)
{
union iwreq_data wrqu;
@@ -922,20 +920,11 @@ if(pDevice->byReAssocCount > 0) {
PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
}
- #endif
}
else if(pDevice->bLinkPass == TRUE)
pDevice->byReAssocCount = 0;
}
-if((pMgmt->eCurrState!=WMAC_STATE_ASSOC) &&
- (pMgmt->eLastState==WMAC_STATE_ASSOC))
-{
- union iwreq_data wrqu;
- memset(&wrqu, 0, sizeof(wrqu));
- wrqu.data.flags = RT_DISCONNECTED_EVENT_FLAG;
- wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, NULL);
-}
pMgmt->eLastState = pMgmt->eCurrState ;
s_uCalculateLinkQual((void *)pDevice);
@@ -1102,21 +1091,6 @@ if((pMgmt->eCurrState!=WMAC_STATE_ASSOC) &&
DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
/* let wpa supplicant know AP may disconnect */
- if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- wpahdr->type = VIAWGET_DISASSOC_MSG;
- wpahdr->resp_ie_len = 0;
- wpahdr->req_ie_len = 0;
- skb_put(pDevice->skb, sizeof(viawget_wpa_header));
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- }
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
{
union iwreq_data wrqu;
memset(&wrqu, 0, sizeof (wrqu));
@@ -1124,7 +1098,6 @@ if((pMgmt->eCurrState!=WMAC_STATE_ASSOC) &&
PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
}
- #endif
}
}
else if (pItemSSID->len != 0) {
@@ -1144,20 +1117,6 @@ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming );
pDevice->uAutoReConnectTime = 0;
pDevice->uIsroamingTime = 0;
pDevice->bRoaming = FALSE;
-
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- wpahdr->type = VIAWGET_CCKM_ROAM_MSG;
- wpahdr->resp_ie_len = 0;
- wpahdr->req_ie_len = 0;
- skb_put(pDevice->skb, sizeof(viawget_wpa_header));
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
-
}
else if ((pDevice->bRoaming == FALSE)&&(pDevice->bIsRoaming == TRUE)) {
pDevice->uIsroamingTime++;
@@ -1169,11 +1128,9 @@ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming );
else {
if (pDevice->uAutoReConnectTime < 10) {
pDevice->uAutoReConnectTime++;
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//network manager support need not do Roaming scan???
if(pDevice->bWPASuppWextEnabled ==TRUE)
pDevice->uAutoReConnectTime = 0;
- #endif
}
else {
//mike use old encryption status for wpa reauthen
diff --git a/drivers/staging/vt6656/desc.h b/drivers/staging/vt6656/desc.h
index b68b2ec96eaa..5007e98d1b0e 100644
--- a/drivers/staging/vt6656/desc.h
+++ b/drivers/staging/vt6656/desc.h
@@ -298,7 +298,7 @@ typedef const SCTS_FB *PCSCTS_FB;
// Tx FIFO header
//
typedef struct tagSTxBufHead {
- DWORD adwTxKey[4];
+ u32 adwTxKey[4];
WORD wFIFOCtl;
WORD wTimeStamp;
WORD wFragCtl;
@@ -376,24 +376,24 @@ typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB;
// MICHDR data header
//
typedef struct tagSMICHDRHead {
- DWORD adwHDR0[4];
- DWORD adwHDR1[4];
- DWORD adwHDR2[4];
+ u32 adwHDR0[4];
+ u32 adwHDR1[4];
+ u32 adwHDR2[4];
} __attribute__ ((__packed__))
SMICHDRHead, *PSMICHDRHead;
typedef const SMICHDRHead *PCSMICHDRHead;
typedef struct tagSBEACONCtl {
- DWORD BufReady : 1;
- DWORD TSF : 15;
- DWORD BufLen : 11;
- DWORD Reserved : 5;
+ u32 BufReady:1;
+ u32 TSF:15;
+ u32 BufLen:11;
+ u32 Reserved:5;
} __attribute__ ((__packed__))
SBEACONCtl;
typedef struct tagSSecretKey {
- DWORD dwLowDword;
+ u32 dwLowDword;
BYTE byHighByte;
} __attribute__ ((__packed__))
SSecretKey;
@@ -402,11 +402,11 @@ typedef struct tagSKeyEntry {
BYTE abyAddrHi[2];
WORD wKCTL;
BYTE abyAddrLo[4];
- DWORD dwKey0[4];
- DWORD dwKey1[4];
- DWORD dwKey2[4];
- DWORD dwKey3[4];
- DWORD dwKey4[4];
+ u32 dwKey0[4];
+ u32 dwKey1[4];
+ u32 dwKey2[4];
+ u32 dwKey3[4];
+ u32 dwKey4[4];
} __attribute__ ((__packed__))
SKeyEntry;
diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 6370d1039103..25bf03af7733 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -30,47 +30,28 @@
#define __DEVICE_H__
#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/mm.h>
-#include <linux/errno.h>
-#include <linux/ioport.h>
-#include <linux/pci.h>
#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/delay.h>
-#include <linux/timer.h>
#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/string.h>
-#include <linux/wait.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/firmware.h>
+#include <linux/etherdevice.h>
+#include <linux/suspend.h>
#include <linux/if_arp.h>
-#include <linux/sched.h>
-#include <linux/if.h>
-#include <linux/rtnetlink.h>//James
-#include <linux/proc_fs.h>
-#include <linux/inetdevice.h>
-#include <linux/reboot.h>
+#include <linux/wireless.h>
+#include <net/iw_handler.h>
+#include <net/cfg80211.h>
+#include <linux/timer.h>
#include <linux/usb.h>
-#include <linux/signal.h>
-#include <linux/firmware.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
+
+
#ifdef SIOCETHTOOL
#define DEVICE_ETHTOOL_IOCTL_SUPPORT
#include <linux/ethtool.h>
#else
#undef DEVICE_ETHTOOL_IOCTL_SUPPORT
#endif
-/* Include Wireless Extension definition and check version - Jean II */
-#include <linux/wireless.h>
-#include <net/iw_handler.h> // New driver API
-
-#ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
-#define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
-#endif
//please copy below macro to driver_event.c for API
#define RT_INSMOD_EVENT_FLAG 0x0101
@@ -418,7 +399,6 @@ typedef struct __device_info {
struct net_device* dev;
struct net_device_stats stats;
- const struct firmware *firmware;
OPTIONS sOpts;
@@ -734,7 +714,6 @@ typedef struct __device_info {
BYTE byKeyIndex;
BOOL bAES;
- BYTE byCntMeasure;
unsigned int uKeyLength;
BYTE abyKey[WLAN_WEP232_KEYLEN];
@@ -814,16 +793,13 @@ typedef struct __device_info {
//WPA supplicant daemon
struct net_device *wpadev;
BOOL bWPADEVUp;
- struct sk_buff *skb;
//--
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
BOOL bwextstep0;
BOOL bwextstep1;
BOOL bwextstep2;
BOOL bwextstep3;
BOOL bWPASuppWextEnabled;
-#endif
#ifdef HOSTAP
// user space daemon: hostapd, is used for HOSTAP
diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
index 28edf9e7efcb..e94f6a1647a3 100644
--- a/drivers/staging/vt6656/dpc.c
+++ b/drivers/staging/vt6656/dpc.c
@@ -332,7 +332,7 @@ RXbBulkInProcessData (
PBYTE pbyFrame;
BOOL bDeFragRx = FALSE;
unsigned int cbHeaderOffset;
- unsigned int FrameSize;
+ u32 FrameSize;
WORD wEtherType = 0;
signed int iSANodeIndex = -1;
signed int iDANodeIndex = -1;
@@ -351,7 +351,7 @@ RXbBulkInProcessData (
/* signed long ldBm = 0; */
BOOL bIsWEP = FALSE;
BOOL bExtIV = FALSE;
- DWORD dwWbkStatus;
+ u32 dwWbkStatus;
PRCB pRCBIndicate = pRCB;
PBYTE pbyDAddress;
PWORD pwPLCP_Length;
@@ -366,15 +366,15 @@ RXbBulkInProcessData (
skb = pRCB->skb;
- //[31:16]RcvByteCount ( not include 4-byte Status )
- dwWbkStatus = *( (PDWORD)(skb->data) );
- FrameSize = (unsigned int)(dwWbkStatus >> 16);
- FrameSize += 4;
+ /* [31:16]RcvByteCount ( not include 4-byte Status ) */
+ dwWbkStatus = *((u32 *)(skb->data));
+ FrameSize = dwWbkStatus >> 16;
+ FrameSize += 4;
- if (BytesToIndicate != FrameSize) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- WRONG Length 1 \n");
- return FALSE;
- }
+ if (BytesToIndicate != FrameSize) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"------- WRONG Length 1\n");
+ return FALSE;
+ }
if ((BytesToIndicate > 2372) || (BytesToIndicate <= 40)) {
// Frame Size error drop this packet.
@@ -617,7 +617,7 @@ RXbBulkInProcessData (
//Discard beacon packet which channel is 0
if ( (WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl)) == WLAN_FSTYPE_BEACON) ||
(WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl)) == WLAN_FSTYPE_PROBERESP) ) {
- return TRUE;
+ return FALSE;
}
}
pRxPacket->byRxChannel = (*pbyRxSts) >> 2;
@@ -818,7 +818,6 @@ RXbBulkInProcessData (
DWORD dwMICKey0 = 0, dwMICKey1 = 0;
DWORD dwLocalMIC_L = 0;
DWORD dwLocalMIC_R = 0;
- viawget_wpa_header *wpahdr;
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
@@ -864,7 +863,6 @@ RXbBulkInProcessData (
pDevice->dev->name);
}
}
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//send event to wpa_supplicant
//if(pDevice->bWPASuppWextEnabled == TRUE)
{
@@ -889,31 +887,6 @@ RXbBulkInProcessData (
wireless_send_event(pDevice->dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&ev);
}
- #endif
-
-
- if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
- (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
- (*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) == 0) {
- //s802_11_Status.Flags = NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR;
- wpahdr->type = VIAWGET_PTK_MIC_MSG;
- } else {
- //s802_11_Status.Flags = NDIS_802_11_AUTH_REQUEST_GROUP_ERROR;
- wpahdr->type = VIAWGET_GTK_MIC_MSG;
- }
- wpahdr->resp_ie_len = 0;
- wpahdr->req_ie_len = 0;
- skb_put(pDevice->skb, sizeof(viawget_wpa_header));
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- }
return FALSE;
@@ -1217,7 +1190,7 @@ static BOOL s_bHandleRxEncryption (
if (byDecMode == KEY_CTL_WEP) {
// handle WEP
if ((pDevice->byLocalID <= REV_ID_VT3253_A1) ||
- (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == TRUE)) {
+ (((PSKeyTable)(&pKey->pvKeyTable))->bSoftWEP == TRUE)) {
// Software WEP
// 1. 3253A
// 2. WEP 256
@@ -1238,7 +1211,7 @@ static BOOL s_bHandleRxEncryption (
PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc
*pdwRxTSC47_16 = cpu_to_le32(*(PDWORD)(pbyIV + 4));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %x\n", *pdwRxTSC47_16);
if (byDecMode == KEY_CTL_TKIP) {
*pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV));
} else {
@@ -1324,9 +1297,9 @@ static BOOL s_bHostWepRxEncryption (
if (byDecMode == KEY_CTL_WEP) {
// handle WEP
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byDecMode == KEY_CTL_WEP \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"byDecMode == KEY_CTL_WEP\n");
if ((pDevice->byLocalID <= REV_ID_VT3253_A1) ||
- (((PSKeyTable)(pKey->pvKeyTable))->bSoftWEP == TRUE) ||
+ (((PSKeyTable)(&pKey->pvKeyTable))->bSoftWEP == TRUE) ||
(bOnFly == FALSE)) {
// Software WEP
// 1. 3253A
@@ -1349,7 +1322,7 @@ static BOOL s_bHostWepRxEncryption (
PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc
*pdwRxTSC47_16 = cpu_to_le32(*(PDWORD)(pbyIV + 4));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %x\n", *pdwRxTSC47_16);
if (byDecMode == KEY_CTL_TKIP) {
*pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV));
@@ -1534,6 +1507,11 @@ RXvFreeRCB(
ASSERT(!pRCB->Ref); // should be 0
ASSERT(pRCB->pDevice); // shouldn't be NULL
+ if (bReAllocSkb == FALSE) {
+ kfree_skb(pRCB->skb);
+ bReAllocSkb = TRUE;
+ }
+
if (bReAllocSkb == TRUE) {
pRCB->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
// todo error handling
diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c
index 8c8126a3540b..8831ea03c001 100644
--- a/drivers/staging/vt6656/firmware.c
+++ b/drivers/staging/vt6656/firmware.c
@@ -61,28 +61,24 @@ FIRMWAREbDownload(
PSDevice pDevice
)
{
+ struct device *dev = &pDevice->usb->dev;
const struct firmware *fw;
int NdisStatus;
void *pBuffer = NULL;
BOOL result = FALSE;
u16 wLength;
- int ii;
+ int ii, rc;
+
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Download firmware\n");
spin_unlock_irq(&pDevice->lock);
- if (!pDevice->firmware) {
- struct device *dev = &pDevice->usb->dev;
- int rc;
-
- rc = request_firmware(&pDevice->firmware, FIRMWARE_NAME, dev);
- if (rc) {
- dev_err(dev, "firmware file %s request failed (%d)\n",
- FIRMWARE_NAME, rc);
+ rc = request_firmware(&fw, FIRMWARE_NAME, dev);
+ if (rc) {
+ dev_err(dev, "firmware file %s request failed (%d)\n",
+ FIRMWARE_NAME, rc);
goto out;
- }
}
- fw = pDevice->firmware;
pBuffer = kmalloc(FIRMWARE_CHUNK_SIZE, GFP_KERNEL);
if (!pBuffer)
@@ -103,10 +99,12 @@ FIRMWAREbDownload(
DBG_PRT(MSG_LEVEL_DEBUG,
KERN_INFO"Download firmware...%d %zu\n", ii, fw->size);
if (NdisStatus != STATUS_SUCCESS)
- goto out;
+ goto free_fw;
}
result = TRUE;
+free_fw:
+ release_firmware(fw);
out:
kfree(pBuffer);
diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c
index 0a73d4060ee1..26a7d0e4b048 100644
--- a/drivers/staging/vt6656/hostap.c
+++ b/drivers/staging/vt6656/hostap.c
@@ -542,9 +542,9 @@ static int hostap_set_encryption(PSDevice pDevice,
if (param->u.crypt.seq) {
memcpy(&abySeq, param->u.crypt.seq, 8);
- for (ii = 0 ; ii < 8 ; ii++) {
- KeyRSC |= (abySeq[ii] << (ii * 8));
- }
+ for (ii = 0 ; ii < 8 ; ii++)
+ KeyRSC |= (unsigned long)abySeq[ii] << (ii * 8);
+
dwKeyIndex |= 1 << 29;
pMgmt->sNodeDBTable[iNodeIndex].KeyRSC = KeyRSC;
}
diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h
index 3734e2c953d9..5d8faf9f96ec 100644
--- a/drivers/staging/vt6656/int.h
+++ b/drivers/staging/vt6656/int.h
@@ -48,8 +48,8 @@ typedef struct tagSINTData {
BYTE byTSR3;
BYTE byPkt3;
WORD wTime3;
- DWORD dwLoTSF;
- DWORD dwHiTSF;
+ u32 dwLoTSF;
+ u32 dwHiTSF;
BYTE byISR0;
BYTE byISR1;
BYTE byRTSSuccess;
diff --git a/drivers/staging/vt6656/ioctl.c b/drivers/staging/vt6656/ioctl.c
deleted file mode 100644
index b6af5f691128..000000000000
--- a/drivers/staging/vt6656/ioctl.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/*
- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * File: ioctl.c
- *
- * Purpose: private ioctl functions
- *
- * Author: Lyndon Chen
- *
- * Date: Auguest 20, 2003
- *
- * Functions:
- *
- * Revision History:
- *
- */
-
-#include "ioctl.h"
-#include "iocmd.h"
-#include "mac.h"
-#include "card.h"
-#include "hostap.h"
-#include "wpactl.h"
-#include "control.h"
-#include "rndis.h"
-#include "rf.h"
-
-SWPAResult wpa_Result;
-static int msglevel = MSG_LEVEL_INFO;
-
-int private_ioctl(PSDevice pDevice, struct ifreq *rq)
-{
-
- PSCmdRequest pReq = (PSCmdRequest)rq;
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int result = 0;
- PWLAN_IE_SSID pItemSSID;
- SCmdBSSJoin sJoinCmd;
- SCmdZoneTypeSet sZoneTypeCmd;
- SCmdScan sScanCmd;
- SCmdStartAP sStartAPCmd;
- SCmdSetWEP sWEPCmd;
- SCmdValue sValue;
- SBSSIDList sList;
- SNodeList sNodeList;
- PSBSSIDList pList;
- PSNodeList pNodeList;
- unsigned int cbListCount;
- PKnownBSS pBSS;
- PKnownNodeDB pNode;
- unsigned int ii, jj;
- SCmdLinkStatus sLinkStatus;
- BYTE abySuppRates[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
- BYTE abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- DWORD dwKeyIndex = 0;
- BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
- signed long ldBm;
-
- pReq->wResult = 0;
-
- switch (pReq->wCmdCode) {
- case WLAN_CMD_BSS_SCAN:
- if (copy_from_user(&sScanCmd, pReq->data, sizeof(SCmdScan))) {
- result = -EFAULT;
- break;
- }
-
- pItemSSID = (PWLAN_IE_SSID)sScanCmd.ssid;
- if (pItemSSID->len > WLAN_SSID_MAXLEN + 1)
- return -EINVAL;
- if (pItemSSID->len != 0) {
- memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- memcpy(abyScanSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);
- }
- spin_lock_irq(&pDevice->lock);
-
- if (memcmp(pMgmt->abyCurrBSSID, &abyNullAddr[0], 6) == 0)
- BSSvClearBSSList(pDevice, FALSE);
- else
- BSSvClearBSSList(pDevice, pDevice->bLinkPass);
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_BSS_SCAN..begin\n");
-
- if (pItemSSID->len != 0)
- bScheduleCommand(pDevice, WLAN_CMD_BSSID_SCAN,
- abyScanSSID);
- else
- bScheduleCommand(pDevice, WLAN_CMD_BSSID_SCAN, NULL);
-
- spin_unlock_irq(&pDevice->lock);
- break;
-
- case WLAN_CMD_ZONETYPE_SET:
- result = -EOPNOTSUPP;
- break;
-
- if (copy_from_user(&sZoneTypeCmd, pReq->data, sizeof(SCmdZoneTypeSet))) {
- result = -EFAULT;
- break;
- }
-
- if (sZoneTypeCmd.bWrite == TRUE) {
- /* write zonetype */
- if (sZoneTypeCmd.ZoneType == ZoneType_USA) {
- /* set to USA */
- printk("set_ZoneType:USA\n");
- } else if (sZoneTypeCmd.ZoneType == ZoneType_Japan) {
- /* set to Japan */
- printk("set_ZoneType:Japan\n");
- } else if (sZoneTypeCmd.ZoneType == ZoneType_Europe) {
- /* set to Europe */
- printk("set_ZoneType:Europe\n");
- }
- } else {
- /* read zonetype */
- BYTE zonetype = 0;
-
- if (zonetype == 0x00) { /* USA */
- sZoneTypeCmd.ZoneType = ZoneType_USA;
- } else if (zonetype == 0x01) { /* Japan */
- sZoneTypeCmd.ZoneType = ZoneType_Japan;
- } else if (zonetype == 0x02) { /* Europe */
- sZoneTypeCmd.ZoneType = ZoneType_Europe;
- } else { /* Unknown ZoneType */
- printk("Error:ZoneType[%x] Unknown ???\n", zonetype);
- result = -EFAULT;
- break;
- }
-
- if (copy_to_user(pReq->data, &sZoneTypeCmd,
- sizeof(SCmdZoneTypeSet))) {
- result = -EFAULT;
- break;
- }
- }
- break;
-
- case WLAN_CMD_BSS_JOIN:
- if (copy_from_user(&sJoinCmd, pReq->data, sizeof(SCmdBSSJoin))) {
- result = -EFAULT;
- break;
- }
-
- pItemSSID = (PWLAN_IE_SSID)sJoinCmd.ssid;
- if (pItemSSID->len > WLAN_SSID_MAXLEN + 1)
- return -EINVAL;
- memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);
- if (sJoinCmd.wBSSType == ADHOC) {
- pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to adhoc mode\n");
- } else {
- pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to STA mode\n");
- }
- if (sJoinCmd.bPSEnable == TRUE) {
- pDevice->ePSMode = WMAC_POWER_FAST;
- pMgmt->wListenInterval = 2;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving On\n");
- } else {
- pDevice->ePSMode = WMAC_POWER_CAM;
- pMgmt->wListenInterval = 1;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Power Saving Off\n");
- }
-
- if (sJoinCmd.bShareKeyAuth == TRUE) {
- pMgmt->bShareKeyAlgorithm = TRUE;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key\n");
- } else {
- pMgmt->bShareKeyAlgorithm = FALSE;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System\n");
- }
-
- pDevice->uChannel = sJoinCmd.uChannel;
- netif_stop_queue(pDevice->dev);
- spin_lock_irq(&pDevice->lock);
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- bScheduleCommand(pDevice, WLAN_CMD_BSSID_SCAN,
- pMgmt->abyDesireSSID);
- bScheduleCommand(pDevice, WLAN_CMD_SSID, NULL);
- spin_unlock_irq(&pDevice->lock);
- break;
-
- case WLAN_CMD_SET_WEP:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WEP Key.\n");
- memset(&sWEPCmd, 0, sizeof(SCmdSetWEP));
- if (copy_from_user(&sWEPCmd, pReq->data, sizeof(SCmdSetWEP))) {
- result = -EFAULT;
- break;
- }
- if (sWEPCmd.bEnableWep != TRUE) {
- int uu;
-
- pDevice->bEncryptionEnable = FALSE;
- pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
- spin_lock_irq(&pDevice->lock);
- for (uu = 0; uu < MAX_KEY_TABLE; uu++)
- MACvDisableKeyEntry(pDevice, uu);
- spin_unlock_irq(&pDevice->lock);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WEP function disable.\n");
- break;
- }
-
- for (ii = 0; ii < WLAN_WEP_NKEYS; ii++) {
- if (sWEPCmd.bWepKeyAvailable[ii]) {
- if (ii == sWEPCmd.byKeyIndex)
- dwKeyIndex = ii | (1 << 31);
- else
- dwKeyIndex = ii;
- spin_lock_irq(&pDevice->lock);
- KeybSetDefaultKey(pDevice, &(pDevice->sKey),
- dwKeyIndex,
- sWEPCmd.auWepKeyLength[ii],
- NULL,
- (PBYTE)&sWEPCmd.abyWepKey[ii][0],
- KEY_CTL_WEP);
- spin_unlock_irq(&pDevice->lock);
- }
- }
- pDevice->byKeyIndex = sWEPCmd.byKeyIndex;
- pDevice->bTransmitKey = TRUE;
- pDevice->bEncryptionEnable = TRUE;
- pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- break;
-
- case WLAN_CMD_GET_LINK:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_GET_LINK status.\n");
-
- memset(sLinkStatus.abySSID, 0, WLAN_SSID_MAXLEN + 1);
-
- if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)
- sLinkStatus.wBSSType = ADHOC;
- else
- sLinkStatus.wBSSType = INFRA;
-
- if (pMgmt->eCurrState == WMAC_STATE_JOINTED)
- sLinkStatus.byState = ADHOC_JOINTED;
- else
- sLinkStatus.byState = ADHOC_STARTED;
-
- sLinkStatus.uChannel = pMgmt->uCurrChannel;
- if (pDevice->bLinkPass == TRUE) {
- sLinkStatus.bLink = TRUE;
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
- memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len);
- memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
- sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Link Success!\n");
- } else {
- sLinkStatus.bLink = FALSE;
- sLinkStatus.uLinkRate = 0;
- }
- if (copy_to_user(pReq->data, &sLinkStatus,
- sizeof(SCmdLinkStatus))) {
- result = -EFAULT;
- break;
- }
- break;
-
- case WLAN_CMD_GET_LISTLEN:
- cbListCount = 0;
- pBSS = &(pMgmt->sBSSList[0]);
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- pBSS = &(pMgmt->sBSSList[ii]);
- if (!pBSS->bActive)
- continue;
- cbListCount++;
- }
- sList.uItem = cbListCount;
- if (copy_to_user(pReq->data, &sList, sizeof(SBSSIDList))) {
- result = -EFAULT;
- break;
- }
- pReq->wResult = 0;
- break;
-
- case WLAN_CMD_GET_LIST:
- if (copy_from_user(&sList, pReq->data, sizeof(SBSSIDList))) {
- result = -EFAULT;
- break;
- }
- if (sList.uItem > (ULONG_MAX - sizeof(SBSSIDList)) / sizeof(SBSSIDItem)) {
- result = -EINVAL;
- break;
- }
- pList = kmalloc(sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)), GFP_ATOMIC);
- if (pList == NULL) {
- result = -ENOMEM;
- break;
- }
- pList->uItem = sList.uItem;
- pBSS = &(pMgmt->sBSSList[0]);
- for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) {
- pBSS = &(pMgmt->sBSSList[jj]);
- if (pBSS->bActive) {
- pList->sBSSIDList[ii].uChannel = pBSS->uChannel;
- pList->sBSSIDList[ii].wBeaconInterval = pBSS->wBeaconInterval;
- pList->sBSSIDList[ii].wCapInfo = pBSS->wCapInfo;
- RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm);
- pList->sBSSIDList[ii].uRSSI = (unsigned int)ldBm;
- /* pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI; */
- memcpy(pList->sBSSIDList[ii].abyBSSID, pBSS->abyBSSID, WLAN_BSSID_LEN);
- pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
- memset(pList->sBSSIDList[ii].abySSID, 0, WLAN_SSID_MAXLEN + 1);
- memcpy(pList->sBSSIDList[ii].abySSID, pItemSSID->abySSID, pItemSSID->len);
- if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) {
- pList->sBSSIDList[ii].byNetType = INFRA;
- } else {
- pList->sBSSIDList[ii].byNetType = ADHOC;
- }
- if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) {
- pList->sBSSIDList[ii].bWEPOn = TRUE;
- } else {
- pList->sBSSIDList[ii].bWEPOn = FALSE;
- }
- ii++;
- if (ii >= pList->uItem)
- break;
- }
- }
-
- if (copy_to_user(pReq->data, pList, sizeof(SBSSIDList) + (sList.uItem * sizeof(SBSSIDItem)))) {
- result = -EFAULT;
- break;
- }
- kfree(pList);
- pReq->wResult = 0;
- break;
-
- case WLAN_CMD_GET_MIB:
- if (copy_to_user(pReq->data, &(pDevice->s802_11Counter), sizeof(SDot11MIBCount))) {
- result = -EFAULT;
- break;
- }
- break;
-
- case WLAN_CMD_GET_STAT:
- if (copy_to_user(pReq->data, &(pDevice->scStatistic), sizeof(SStatCounter))) {
- result = -EFAULT;
- break;
- }
- break;
-
- case WLAN_CMD_STOP_MAC:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_STOP_MAC\n");
- /* Todo xxxxxx */
- netif_stop_queue(pDevice->dev);
- spin_lock_irq(&pDevice->lock);
- if (pDevice->bRadioOff == FALSE) {
- CARDbRadioPowerOff(pDevice);
- }
- pDevice->bLinkPass = FALSE;
- ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW);
- memset(pMgmt->abyCurrBSSID, 0, 6);
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- /* del_timer(&pDevice->sTimerCommand); */
- /* del_timer(&pMgmt->sTimerSecondCallback); */
- pDevice->bCmdRunning = FALSE;
- spin_unlock_irq(&pDevice->lock);
- break;
-
- case WLAN_CMD_START_MAC:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_START_MAC\n");
- /* Todo xxxxxxx */
- if (pDevice->bRadioOff == TRUE)
- CARDbRadioPowerOn(pDevice);
- break;
-
- case WLAN_CMD_SET_HOSTAPD:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD\n");
-
- if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
- result = -EFAULT;
- break;
- }
- if (sValue.dwValue == 1) {
- if (vt6656_hostap_set_hostapd(pDevice, 1, 1) == 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HOSTAP\n");
- } else {
- result = -EFAULT;
- break;
- }
- } else {
- vt6656_hostap_set_hostapd(pDevice, 0, 1);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HOSTAP\n");
- }
- break;
-
- case WLAN_CMD_SET_HOSTAPD_STA:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOSTAPD_STA\n");
- break;
-
- case WLAN_CMD_SET_802_1X:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_802_1X\n");
- if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
- result = -EFAULT;
- break;
- }
-
- if (sValue.dwValue == 1) {
- pDevice->bEnable8021x = TRUE;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable 802.1x\n");
- } else {
- pDevice->bEnable8021x = FALSE;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable 802.1x\n");
- }
- break;
-
- case WLAN_CMD_SET_HOST_WEP:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_HOST_WEP\n");
- if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
- result = -EFAULT;
- break;
- }
-
- if (sValue.dwValue == 1) {
- pDevice->bEnableHostWEP = TRUE;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable HostWEP\n");
- } else {
- pDevice->bEnableHostWEP = FALSE;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable HostWEP\n");
- }
- break;
-
- case WLAN_CMD_SET_WPA:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_SET_WPA\n");
-
- if (copy_from_user(&sValue, pReq->data, sizeof(SCmdValue))) {
- result = -EFAULT;
- break;
- }
- if (sValue.dwValue == 1) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n");
- memcpy(pDevice->wpadev->dev_addr, pDevice->dev->dev_addr,
- ETH_ALEN);
- pDevice->bWPADEVUp = TRUE;
- } else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "close wpadev\n");
- pDevice->bWPADEVUp = FALSE;
- }
- break;
-
- case WLAN_CMD_AP_START:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WLAN_CMD_AP_START\n");
- if (pDevice->bRadioOff == TRUE) {
- CARDbRadioPowerOn(pDevice);
- add_timer(&pMgmt->sTimerSecondCallback);
- }
- if (copy_from_user(&sStartAPCmd, pReq->data, sizeof(SCmdStartAP))) {
- result = -EFAULT;
- break;
- }
-
- if (sStartAPCmd.wBSSType == AP) {
- pMgmt->eConfigMode = WMAC_CONFIG_AP;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct set to AP mode\n");
- } else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ioct BSS type not set to AP mode\n");
- result = -EFAULT;
- break;
- }
-
- if (sStartAPCmd.wBBPType == PHY80211g) {
- pMgmt->byAPBBType = PHY_TYPE_11G;
- } else if (sStartAPCmd.wBBPType == PHY80211a) {
- pMgmt->byAPBBType = PHY_TYPE_11A;
- } else {
- pMgmt->byAPBBType = PHY_TYPE_11B;
- }
-
- pItemSSID = (PWLAN_IE_SSID)sStartAPCmd.ssid;
- if (pItemSSID->len > WLAN_SSID_MAXLEN + 1)
- return -EINVAL;
- memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- memcpy(pMgmt->abyDesireSSID, pItemSSID, pItemSSID->len + WLAN_IEHDR_LEN);
-
- if ((sStartAPCmd.uChannel > 0) && (sStartAPCmd.uChannel <= 14))
- pDevice->uChannel = sStartAPCmd.uChannel;
-
- if ((sStartAPCmd.uBeaconInt >= 20) && (sStartAPCmd.uBeaconInt <= 1000))
- pMgmt->wIBSSBeaconPeriod = sStartAPCmd.uBeaconInt;
- else
- pMgmt->wIBSSBeaconPeriod = 100;
-
- if (sStartAPCmd.bShareKeyAuth == TRUE) {
- pMgmt->bShareKeyAlgorithm = TRUE;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Share Key\n");
- } else {
- pMgmt->bShareKeyAlgorithm = FALSE;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Open System\n");
- }
- memcpy(pMgmt->abyIBSSSuppRates, abySuppRates, 6);
-
- if (sStartAPCmd.byBasicRate & BIT3) {
- pMgmt->abyIBSSSuppRates[2] |= BIT7;
- pMgmt->abyIBSSSuppRates[3] |= BIT7;
- pMgmt->abyIBSSSuppRates[4] |= BIT7;
- pMgmt->abyIBSSSuppRates[5] |= BIT7;
- } else if (sStartAPCmd.byBasicRate & BIT2) {
- pMgmt->abyIBSSSuppRates[2] |= BIT7;
- pMgmt->abyIBSSSuppRates[3] |= BIT7;
- pMgmt->abyIBSSSuppRates[4] |= BIT7;
- } else if (sStartAPCmd.byBasicRate & BIT1) {
- pMgmt->abyIBSSSuppRates[2] |= BIT7;
- pMgmt->abyIBSSSuppRates[3] |= BIT7;
- } else if (sStartAPCmd.byBasicRate & BIT1) {
- pMgmt->abyIBSSSuppRates[2] |= BIT7;
- } else {
- /* default 1,2M */
- pMgmt->abyIBSSSuppRates[2] |= BIT7;
- pMgmt->abyIBSSSuppRates[3] |= BIT7;
- }
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Support Rate= %*ph\n",
- 4, pMgmt->abyIBSSSuppRates + 2);
-
- netif_stop_queue(pDevice->dev);
- spin_lock_irq(&pDevice->lock);
- bScheduleCommand(pDevice, WLAN_CMD_RUN_AP, NULL);
- spin_unlock_irq(&pDevice->lock);
- break;
-
- case WLAN_CMD_GET_NODE_CNT:
- cbListCount = 0;
- pNode = &(pMgmt->sNodeDBTable[0]);
- for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
- pNode = &(pMgmt->sNodeDBTable[ii]);
- if (!pNode->bActive)
- continue;
- cbListCount++;
- }
-
- sNodeList.uItem = cbListCount;
- if (copy_to_user(pReq->data, &sNodeList, sizeof(SNodeList))) {
- result = -EFAULT;
- break;
- }
- pReq->wResult = 0;
- break;
-
- case WLAN_CMD_GET_NODE_LIST:
- if (copy_from_user(&sNodeList, pReq->data, sizeof(SNodeList))) {
- result = -EFAULT;
- break;
- }
- if (sNodeList.uItem > (ULONG_MAX - sizeof(SNodeList)) / sizeof(SNodeItem)) {
- result = -ENOMEM;
- break;
- }
- pNodeList = kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), GFP_ATOMIC);
- if (pNodeList == NULL) {
- result = -ENOMEM;
- break;
- }
- pNodeList->uItem = sNodeList.uItem;
- pNode = &(pMgmt->sNodeDBTable[0]);
- for (ii = 0, jj = 0; ii < (MAX_NODE_NUM + 1); ii++) {
- pNode = &(pMgmt->sNodeDBTable[ii]);
- if (pNode->bActive) {
- pNodeList->sNodeList[jj].wAID = pNode->wAID;
- memcpy(pNodeList->sNodeList[jj].abyMACAddr, pNode->abyMACAddr, WLAN_ADDR_LEN);
- pNodeList->sNodeList[jj].wTxDataRate = pNode->wTxDataRate;
- pNodeList->sNodeList[jj].wInActiveCount = (WORD)pNode->uInActiveCount;
- pNodeList->sNodeList[jj].wEnQueueCnt = (WORD)pNode->wEnQueueCnt;
- pNodeList->sNodeList[jj].wFlags = (WORD)pNode->dwFlags;
- pNodeList->sNodeList[jj].bPWBitOn = pNode->bPSEnable;
- pNodeList->sNodeList[jj].byKeyIndex = pNode->byKeyIndex;
- pNodeList->sNodeList[jj].wWepKeyLength = pNode->uWepKeyLength;
- memcpy(&(pNodeList->sNodeList[jj].abyWepKey[0]), &(pNode->abyWepKey[0]), WEP_KEYMAXLEN);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
- pNodeList->sNodeList[jj].abyWepKey[0],
- pNodeList->sNodeList[jj].abyWepKey[1],
- pNodeList->sNodeList[jj].abyWepKey[2],
- pNodeList->sNodeList[jj].abyWepKey[3],
- pNodeList->sNodeList[jj].abyWepKey[4]);
- pNodeList->sNodeList[jj].bIsInFallback = pNode->bIsInFallback;
- pNodeList->sNodeList[jj].uTxFailures = pNode->uTxFailures;
- pNodeList->sNodeList[jj].uTxAttempts = pNode->uTxAttempts;
- pNodeList->sNodeList[jj].wFailureRatio = (WORD)pNode->uFailureRatio;
- jj++;
- if (jj >= pNodeList->uItem)
- break;
- }
- }
- if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) {
- kfree(pNodeList);
- result = -EFAULT;
- break;
- }
- kfree(pNodeList);
- pReq->wResult = 0;
- break;
-
- case 0xFF:
- memset(wpa_Result.ifname, 0, sizeof(wpa_Result.ifname));
- wpa_Result.proto = 0;
- wpa_Result.key_mgmt = 0;
- wpa_Result.eap_type = 0;
- wpa_Result.authenticated = FALSE;
- pDevice->fWPA_Authened = FALSE;
- if (copy_from_user(&wpa_Result, pReq->data, sizeof(wpa_Result))) {
- result = -EFAULT;
- break;
- }
- /* for some AP's maybe a good authentication */
- if (wpa_Result.key_mgmt == 0x20)
- pMgmt->Cisco_cckm = 1;
- else
- pMgmt->Cisco_cckm = 0;
-
- if (wpa_Result.authenticated == TRUE) {
- {
- union iwreq_data wrqu;
-
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
- memset(&wrqu, 0, sizeof(wrqu));
- wrqu.data.flags = RT_WPACONNECTED_EVENT_FLAG;
- wrqu.data.length = pItemSSID->len;
- wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, pItemSSID->abySSID);
- }
-
- pDevice->fWPA_Authened = TRUE; /* is successful peer to wpa_Result.authenticated? */
- }
-
- pReq->wResult = 0;
- break;
-
- default:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Private command not supported..\n");
- }
-
- return result;
-}
diff --git a/drivers/staging/vt6656/ioctl.h b/drivers/staging/vt6656/ioctl.h
deleted file mode 100644
index caa4ac963d93..000000000000
--- a/drivers/staging/vt6656/ioctl.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * File: hostap.h
- *
- * Purpose:
- *
- * Author: Lyndon Chen
- *
- * Date: May 21, 2003
- *
- */
-
-#ifndef __IOCTL_H__
-#define __IOCTL_H__
-
-#include "device.h"
-
-/*--------------------- Export Definitions -------------------------*/
-
-
-/*--------------------- Export Classes ----------------------------*/
-
-/*--------------------- Export Variables --------------------------*/
-
-/*--------------------- Export Functions --------------------------*/
-
-int private_ioctl(PSDevice pDevice, struct ifreq *rq);
-
-/*
-void vConfigWEPKey (
- PSDevice pDevice,
- DWORD dwKeyIndex,
- PBYTE pbyKey,
- unsigned long uKeyLength
- );
-*/
-
-#endif /* __IOCTL_H__ */
diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c
index 8f198749ca51..52fce6902508 100644
--- a/drivers/staging/vt6656/iwctl.c
+++ b/drivers/staging/vt6656/iwctl.c
@@ -31,26 +31,17 @@
*/
#include "device.h"
-#include "ioctl.h"
-#include "iocmd.h"
+#include "iwctl.h"
#include "mac.h"
#include "card.h"
#include "hostap.h"
#include "power.h"
#include "rf.h"
-
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
#include "iowpa.h"
#include "wpactl.h"
-#endif
-
-#include <net/iw_handler.h>
+#include "control.h"
+#include "rndis.h"
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
-#define SUPPORTED_WIRELESS_EXT 18
-#else
-#define SUPPORTED_WIRELESS_EXT 17
-#endif
static const long frequency_list[] = {
2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484,
@@ -88,9 +79,9 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
* Wireless Handler: get protocol name
*/
int iwctl_giwname(struct net_device *dev, struct iw_request_info *info,
- char *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
- strcpy(wrq, "802.11-a/b/g");
+ strcpy(wrqu->name, "802.11-a/b/g");
return 0;
}
@@ -98,9 +89,10 @@ int iwctl_giwname(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: set scan
*/
int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_point *wrq = &wrqu->data;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_scan_req *req = (struct iw_scan_req *)extra;
BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
@@ -109,7 +101,10 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info,
if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
return -EINVAL;
- PRINT_K(" SIOCSIWSCAN \n");
+ PRINT_K(" SIOCSIWSCAN\n");
+
+ if (pMgmt == NULL)
+ return -EFAULT;
if (pMgmt->eScanState == WMAC_IS_SCANNING) {
// In scanning..
@@ -137,9 +132,9 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info,
pItemSSID = (PWLAN_IE_SSID)abyScanSSID;
pItemSSID->byElementID = WLAN_EID_SSID;
memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len);
- if (pItemSSID->abySSID[req->essid_len - 1] == '\0') {
+ if (pItemSSID->abySSID[req->essid_len] == '\0') {
if (req->essid_len > 0)
- pItemSSID->len = req->essid_len - 1;
+ pItemSSID->len = req->essid_len;
} else {
pItemSSID->len = req->essid_len;
}
@@ -168,8 +163,9 @@ int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler : get scan results
*/
int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
+ struct iw_point *wrq = &wrqu->data;
int ii;
int jj;
int kk;
@@ -184,10 +180,12 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info,
char *current_val = NULL;
struct iw_event iwe;
long ldBm;
- char buf[MAX_WPA_IE_LEN * 2 + 30];
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN\n");
+ if (pMgmt == NULL)
+ return -EFAULT;
+
if (pMgmt->eScanState == WMAC_IS_SCANNING) {
// In scanning..
return -EAGAIN;
@@ -286,12 +284,6 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info,
if ((current_val - current_ev) > IW_EV_LCP_LEN)
current_ev = current_val;
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = IWEVCUSTOM;
- sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval);
- iwe.u.data.length = strlen(buf);
- current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, buf);
-
if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) {
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVGENIE;
@@ -315,12 +307,13 @@ int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: set frequence or channel
*/
int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info,
- struct iw_freq *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_freq *wrq = &wrqu->freq;
int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ\n");
// If setting by frequency, convert to a channel
if ((wrq->e == 1) && (wrq->m >= (int)2.412e8) &&
@@ -353,12 +346,17 @@ int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: get frequence or channel
*/
int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info,
- struct iw_freq *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_freq *wrq = &wrqu->freq;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ\n");
+
+ if (pMgmt == NULL)
+ return -EFAULT;
+
#ifdef WEXT_USECHANNELS
wrq->m = (int)pMgmt->uCurrChannel;
@@ -379,16 +377,21 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: set operation mode
*/
int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info,
- __u32 *wmode, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ __u32 *wmode = &wrqu->mode;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE\n");
+
+ if (pMgmt == NULL)
+ return -EFAULT;
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Can't set operation mode, hostapd is running \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Can't set operation mode, hostapd is running\n");
return rc;
}
@@ -432,19 +435,72 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info,
rc = -EINVAL;
}
+ if (pDevice->bCommit) {
+ if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
+ netif_stop_queue(pDevice->dev);
+ spin_lock_irq(&pDevice->lock);
+ bScheduleCommand((void *) pDevice,
+ WLAN_CMD_RUN_AP, NULL);
+ spin_unlock_irq(&pDevice->lock);
+ } else {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Commit the settings\n");
+
+ spin_lock_irq(&pDevice->lock);
+
+ if (pDevice->bLinkPass &&
+ memcmp(pMgmt->abyCurrSSID,
+ pMgmt->abyDesireSSID,
+ WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN)) {
+ bScheduleCommand((void *) pDevice,
+ WLAN_CMD_DISASSOCIATE, NULL);
+ } else {
+ pDevice->bLinkPass = FALSE;
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ memset(pMgmt->abyCurrBSSID, 0, 6);
+ }
+
+ ControlvMaskByte(pDevice,
+ MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY,
+ LEDSTS_STS, LEDSTS_SLOW);
+
+ netif_stop_queue(pDevice->dev);
+
+ pMgmt->eScanType = WMAC_SCAN_ACTIVE;
+
+ if (!pDevice->bWPASuppWextEnabled)
+ bScheduleCommand((void *) pDevice,
+ WLAN_CMD_BSSID_SCAN,
+ pMgmt->abyDesireSSID);
+
+ bScheduleCommand((void *) pDevice,
+ WLAN_CMD_SSID,
+ NULL);
+
+ spin_unlock_irq(&pDevice->lock);
+ }
+ pDevice->bCommit = FALSE;
+ }
+
+
return rc;
}
/*
* Wireless Handler: get operation mode
*/
-void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info,
- __u32 *wmode, char *extra)
+int iwctl_giwmode(struct net_device *dev, struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ __u32 *wmode = &wrqu->mode;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE\n");
+
+ if (pMgmt == NULL)
+ return -EFAULT;
+
// If not managed, assume it's ad-hoc
switch (pMgmt->eConfigMode) {
case WMAC_CONFIG_ESS_STA:
@@ -462,14 +518,17 @@ void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info,
default:
*wmode = IW_MODE_ADHOC;
}
+
+ return 0;
}
/*
* Wireless Handler: get capability range
*/
-void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+int iwctl_giwrange(struct net_device *dev, struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
+ struct iw_point *wrq = &wrqu->data;
struct iw_range *range = (struct iw_range *)extra;
int i;
int k;
@@ -546,7 +605,7 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info,
range->txpower[0] = 100;
range->num_txpower = 1;
range->txpower_capa = IW_TXPOW_MWATT;
- range->we_version_source = SUPPORTED_WIRELESS_EXT;
+ range->we_version_source = WIRELESS_EXT;
range->we_version_compiled = WIRELESS_EXT;
range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
range->retry_flags = IW_RETRY_LIMIT;
@@ -562,20 +621,26 @@ void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info,
range->avg_qual.level = 176; // -80 dBm
range->avg_qual.noise = 0;
}
+
+ return 0;
}
/*
* Wireless Handler : set ap mac address
*/
int iwctl_siwap(struct net_device *dev, struct iw_request_info *info,
- struct sockaddr *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct sockaddr *wrq = &wrqu->ap_addr;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0;
BYTE ZeroBSSID[WLAN_BSSID_LEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
- PRINT_K(" SIOCSIWAP \n");
+ PRINT_K(" SIOCSIWAP\n");
+
+ if (pMgmt == NULL)
+ return -EFAULT;
if (wrq->sa_family != ARPHRD_ETHER) {
rc = -EINVAL;
@@ -616,12 +681,16 @@ int iwctl_siwap(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: get ap mac address
*/
int iwctl_giwap(struct net_device *dev, struct iw_request_info *info,
- struct sockaddr *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct sockaddr *wrq = &wrqu->ap_addr;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP\n");
+
+ if (pMgmt == NULL)
+ return -EFAULT;
memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
@@ -639,59 +708,77 @@ int iwctl_giwap(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: get ap list
*/
int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
+ struct iw_point *wrq = &wrqu->data;
+ struct sockaddr *sock;
+ struct iw_quality *qual;
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &pDevice->sMgmtObj;
+ PKnownBSS pBSS = &pMgmt->sBSSList[0];
int ii;
int jj;
- int rc = 0;
- struct sockaddr sock[IW_MAX_AP];
- struct iw_quality qual[IW_MAX_AP];
- PSDevice pDevice = netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n");
- // Only super-user can see AP list
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST\n");
+ /* Only super-user can see AP list */
- if (!capable(CAP_NET_ADMIN)) {
- rc = -EPERM;
- return rc;
- }
+ if (pBSS == NULL)
+ return -ENODEV;
- if (wrq->pointer) {
- PKnownBSS pBSS = &(pMgmt->sBSSList[0]);
+ if (!capable(CAP_NET_ADMIN))
+ return -EPERM;
- for (ii = 0, jj= 0; ii < MAX_BSS_NUM; ii++) {
- pBSS = &(pMgmt->sBSSList[ii]);
- if (!pBSS->bActive)
- continue;
- if (jj >= IW_MAX_AP)
- break;
- memcpy(sock[jj].sa_data, pBSS->abyBSSID, 6);
- sock[jj].sa_family = ARPHRD_ETHER;
- qual[jj].level = pBSS->uRSSI;
- qual[jj].qual = qual[jj].noise = 0;
- qual[jj].updated = 2;
- jj++;
- }
+ if (!wrq->pointer)
+ return -EINVAL;
- wrq->flags = 1; // Should be defined
- wrq->length = jj;
- memcpy(extra, sock, sizeof(struct sockaddr) * jj);
- memcpy(extra + sizeof(struct sockaddr) * jj, qual, sizeof(struct iw_quality) * jj);
+ sock = kzalloc(sizeof(struct sockaddr) * IW_MAX_AP, GFP_KERNEL);
+ if (sock == NULL)
+ return -ENOMEM;
+ qual = kzalloc(sizeof(struct iw_quality) * IW_MAX_AP, GFP_KERNEL);
+ if (qual == NULL) {
+ kfree(sock);
+ return -ENOMEM;
}
- return rc;
+
+ for (ii = 0, jj = 0; ii < MAX_BSS_NUM; ii++) {
+ if (!pBSS[ii].bActive)
+ continue;
+ if (jj >= IW_MAX_AP)
+ break;
+ memcpy(sock[jj].sa_data, pBSS[ii].abyBSSID, 6);
+ sock[jj].sa_family = ARPHRD_ETHER;
+ qual[jj].level = pBSS[ii].uRSSI;
+ qual[jj].qual = qual[jj].noise = 0;
+ qual[jj].updated = 2;
+ jj++;
+ }
+
+ wrq->flags = 1; /* Should be defined */
+ wrq->length = jj;
+ memcpy(extra, sock, sizeof(struct sockaddr) * jj);
+ memcpy(extra + sizeof(struct sockaddr) * jj, qual,
+ sizeof(struct iw_quality) * jj);
+
+ kfree(sock);
+ kfree(qual);
+
+ return 0;
}
/*
* Wireless Handler: set essid
*/
int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_point *wrq = &wrqu->essid;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PWLAN_IE_SSID pItemSSID;
+ if (pMgmt == NULL)
+ return -EFAULT;
+
if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
return -EINVAL;
@@ -704,10 +791,8 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
memset(pMgmt->abyDesireBSSID, 0xFF,6);
PRINT_K("set essid to 'any' \n");
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
// Unknown desired AP, so here need not associate??
return 0;
-#endif
} else {
// Set the SSID
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
@@ -715,9 +800,9 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
pItemSSID->byElementID = WLAN_EID_SSID;
memcpy(pItemSSID->abySSID, extra, wrq->length);
- if (pItemSSID->abySSID[wrq->length - 1] == '\0') {
+ if (pItemSSID->abySSID[wrq->length] == '\0') {
if (wrq->length>0)
- pItemSSID->len = wrq->length - 1;
+ pItemSSID->len = wrq->length;
} else {
pItemSSID->len = wrq->length;
}
@@ -729,7 +814,6 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
return 0;
}
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
// Wext wil order another command of siwap to link
// with desired AP, so here need not associate??
if (pDevice->bWPASuppWextEnabled == TRUE) {
@@ -778,7 +862,6 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
}
return 0;
}
-#endif
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID);
}
@@ -792,14 +875,18 @@ int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
/*
* Wireless Handler: get essid
*/
-void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+int iwctl_giwessid(struct net_device *dev, struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_point *wrq = &wrqu->essid;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PWLAN_IE_SSID pItemSSID;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID\n");
+
+ if (pMgmt == NULL)
+ return -EFAULT;
// Note: if wrq->u.data.flags != 0, we should get the relevant
// SSID from the SSID list...
@@ -811,15 +898,18 @@ void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info,
wrq->length = pItemSSID->len;
wrq->flags = 1; // active
+
+ return 0;
}
/*
* Wireless Handler: set data rate
*/
int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_param *wrq = &wrqu->bitrate;
int rc = 0;
u8 brate = 0;
int i;
@@ -893,13 +983,18 @@ int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info,
/*
* Wireless Handler: get data rate
*/
-void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra)
+int iwctl_giwrate(struct net_device *dev, struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_param *wrq = &wrqu->bitrate;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE\n");
+
+ if (pMgmt == NULL)
+ return -EFAULT;
+
{
BYTE abySupportedRates[13] = {
0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30,
@@ -932,14 +1027,18 @@ void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info,
if (pDevice->bFixRate == TRUE)
wrq->fixed = TRUE;
}
+
+ return 0;
}
/*
* Wireless Handler: set rts threshold
*/
-int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq)
+int iwctl_siwrts(struct net_device *dev, struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_param *wrq = &wrqu->rts;
if ((wrq->value < 0 || wrq->value > 2312) && !wrq->disabled)
return -EINVAL;
@@ -956,11 +1055,12 @@ int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq)
* Wireless Handler: get rts
*/
int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_param *wrq = &wrqu->rts;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS\n");
wrq->value = pDevice->wRTSThreshold;
wrq->disabled = (wrq->value >= 2312);
wrq->fixed = 1;
@@ -971,13 +1071,14 @@ int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: set fragment threshold
*/
int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_param *wrq = &wrqu->frag;
int rc = 0;
int fthr = wrq->value;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG\n");
if (wrq->disabled)
fthr = 2312;
@@ -994,11 +1095,12 @@ int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: get fragment threshold
*/
int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_param *wrq = &wrqu->frag;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG\n");
wrq->value = pDevice->wFragmentationThreshold;
wrq->disabled = (wrq->value >= 2312);
wrq->fixed = 1;
@@ -1009,12 +1111,13 @@ int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: set retry threshold
*/
int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_param *wrq = &wrqu->retry;
int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY\n");
if (wrq->disabled) {
rc = -EINVAL;
@@ -1041,10 +1144,11 @@ int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: get retry threshold
*/
int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n");
+ struct iw_param *wrq = &wrqu->retry;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY\n");
wrq->disabled = 0; // Can't be disabled
// Note: by default, display the min retry number
@@ -1067,17 +1171,21 @@ int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: set encode mode
*/
int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DWORD dwKeyIndex = (DWORD)(wrq->flags & IW_ENCODE_INDEX);
+ struct iw_point *wrq = &wrqu->encoding;
+ u32 dwKeyIndex = (u32)(wrq->flags & IW_ENCODE_INDEX);
int ii;
int uu;
int rc = 0;
int index = (wrq->flags & IW_ENCODE_INDEX);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE\n");
+
+ if (pMgmt == NULL)
+ return -EFAULT;
// Check the size of the key
if (wrq->length > WLAN_WEP232_KEYLEN) {
@@ -1155,17 +1263,17 @@ int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info,
pMgmt->bShareKeyAlgorithm = FALSE;
}
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
memset(pMgmt->abyDesireBSSID, 0xFF, 6);
-#endif
+
return rc;
}
int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ struct iw_point *wrq = &wrqu->encoding;
char abyKey[WLAN_WEP232_KEYLEN];
unsigned index = (unsigned)(wrq->flags & IW_ENCODE_INDEX);
@@ -1173,6 +1281,9 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info,
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
+ if (pMgmt == NULL)
+ return -EFAULT;
+
if (index > WLAN_WEP_NKEYS)
return -EINVAL;
if (index < 1) { // get default key
@@ -1220,13 +1331,17 @@ int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: set power mode
*/
int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ struct iw_param *wrq = &wrqu->power;
int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER\n");
+
+ if (pMgmt == NULL)
+ return -EFAULT;
if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
rc = -EINVAL;
@@ -1268,24 +1383,31 @@ int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: get power mode
*/
int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ struct iw_param *wrq = &wrqu->power;
int mode = pDevice->ePSMode;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER\n");
+
+ if (pMgmt == NULL)
+ return -EFAULT;
if ((wrq->disabled = (mode == WMAC_POWER_CAM)))
return 0;
if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
- wrq->value = (int)((pMgmt->wListenInterval * pMgmt->wCurrBeaconPeriod) << 10);
+ wrq->value = (int)((pMgmt->wListenInterval *
+ pMgmt->wCurrBeaconPeriod) / 100);
wrq->flags = IW_POWER_TIMEOUT;
} else {
- wrq->value = (int)((pMgmt->wListenInterval * pMgmt->wCurrBeaconPeriod) << 10);
+ wrq->value = (int)((pMgmt->wListenInterval *
+ pMgmt->wCurrBeaconPeriod) / 100);
wrq->flags = IW_POWER_PERIOD;
}
+
wrq->flags |= IW_POWER_ALL_R;
return 0;
}
@@ -1294,12 +1416,13 @@ int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info,
* Wireless Handler: get Sensitivity
*/
int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
+ struct iw_param *wrq = &wrqu->sens;
long ldBm;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS\n");
if (pDevice->bLinkPass == TRUE) {
RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm);
wrq->value = ldBm;
@@ -1311,18 +1434,20 @@ int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info,
return 0;
}
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
-
int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ struct iw_param *wrq = &wrqu->param;
int ret = 0;
static int wpa_version = 0; // must be static to save the last value, einsn liu
static int pairwise = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n");
+ if (pMgmt == NULL)
+ return -EFAULT;
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH\n");
switch (wrq->flags & IW_AUTH_INDEX) {
case IW_AUTH_WPA_VERSION:
wpa_version = wrq->value;
@@ -1406,6 +1531,7 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
}
break;
default:
+ PRINT_K("iwctl_siwauth: not supported %x\n", wrq->flags);
ret = -EOPNOTSUPP;
break;
}
@@ -1413,18 +1539,22 @@ int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
}
int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
return -EOPNOTSUPP;
}
int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ struct iw_point *wrq = &wrqu->data;
int ret = 0;
+ if (pMgmt == NULL)
+ return -EFAULT;
+
if (wrq->length){
if ((wrq->length < 2) || (extra[1] + 2 != wrq->length)) {
ret = -EINVAL;
@@ -1450,13 +1580,17 @@ out: // not completely ...not necessary in wpa_supplicant 0.5.8
}
int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ struct iw_point *wrq = &wrqu->data;
int ret = 0;
int space = wrq->length;
+ if (pMgmt == NULL)
+ return -EFAULT;
+
wrq->length = 0;
if (pMgmt->wWPAIELen > 0) {
wrq->length = pMgmt->wWPAIELen;
@@ -1472,10 +1606,11 @@ int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info,
}
int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ struct iw_point *wrq = &wrqu->encoding;
struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
struct viawget_wpa_param *param=NULL;
// original member
@@ -1488,17 +1623,18 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info,
size_t seq_len = 0;
size_t key_len = 0;
u8 *buf;
- size_t blen;
u8 key_array[64];
int ret = 0;
- PRINT_K("SIOCSIWENCODEEXT...... \n");
+ PRINT_K("SIOCSIWENCODEEXT......\n");
- blen = sizeof(*param);
- buf = kmalloc((int)blen, (int)GFP_KERNEL);
+ if (pMgmt == NULL)
+ return -EFAULT;
+
+ buf = kzalloc(sizeof(struct viawget_wpa_param), GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
- memset(buf, 0, blen);
+
param = (struct viawget_wpa_param *)buf;
// recover alg_name
@@ -1588,28 +1724,33 @@ int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info,
}
/*******/
spin_lock_irq(&pDevice->lock);
- ret = wpa_set_keys(pDevice, param, TRUE);
+ ret = wpa_set_keys(pDevice, param);
spin_unlock_irq(&pDevice->lock);
error:
- kfree(param);
+ kfree(buf);
return ret;
}
int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
return -EOPNOTSUPP;
}
int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra)
+ union iwreq_data *wrqu, char *extra)
{
PSDevice pDevice = netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_mlme *mlme = (struct iw_mlme *)extra;
int ret = 0;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMLME\n");
+
+ if (pMgmt == NULL)
+ return -EFAULT;
+
if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)) {
ret = -EINVAL;
return ret;
@@ -1629,81 +1770,62 @@ int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info,
return ret;
}
-#endif
+static int iwctl_config_commit(struct net_device *dev,
+ struct iw_request_info *info, union iwreq_data *wrqu, char *extra)
+{
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SIOCSIWCOMMIT\n");
+
+ return 0;
+}
static const iw_handler iwctl_handler[] = {
- (iw_handler)NULL, // SIOCSIWCOMMIT
- (iw_handler)NULL, // SIOCGIWNAME
- (iw_handler)NULL, // SIOCSIWNWID
- (iw_handler)NULL, // SIOCGIWNWID
- (iw_handler)NULL, // SIOCSIWFREQ
- (iw_handler)NULL, // SIOCGIWFREQ
- (iw_handler)NULL, // SIOCSIWMODE
- (iw_handler)NULL, // SIOCGIWMODE
- (iw_handler)NULL, // SIOCSIWSENS
- (iw_handler)NULL, // SIOCGIWSENS
- (iw_handler)NULL, // SIOCSIWRANGE
- (iw_handler)iwctl_giwrange, // SIOCGIWRANGE
- (iw_handler)NULL, // SIOCSIWPRIV
- (iw_handler)NULL, // SIOCGIWPRIV
- (iw_handler)NULL, // SIOCSIWSTATS
- (iw_handler)NULL, // SIOCGIWSTATS
- (iw_handler)NULL, // SIOCSIWSPY
- (iw_handler)NULL, // SIOCGIWSPY
- (iw_handler)NULL, // -- hole --
- (iw_handler)NULL, // -- hole --
- (iw_handler)NULL, // SIOCSIWAP
- (iw_handler)NULL, // SIOCGIWAP
- (iw_handler)NULL, // -- hole -- 0x16
- (iw_handler)NULL, // SIOCGIWAPLIST
- (iw_handler)iwctl_siwscan, // SIOCSIWSCAN
- (iw_handler)iwctl_giwscan, // SIOCGIWSCAN
- (iw_handler)NULL, // SIOCSIWESSID
- (iw_handler)NULL, // SIOCGIWESSID
- (iw_handler)NULL, // SIOCSIWNICKN
- (iw_handler)NULL, // SIOCGIWNICKN
- (iw_handler)NULL, // -- hole --
- (iw_handler)NULL, // -- hole --
- (iw_handler)NULL, // SIOCSIWRATE 0x20
- (iw_handler)NULL, // SIOCGIWRATE
- (iw_handler)NULL, // SIOCSIWRTS
- (iw_handler)NULL, // SIOCGIWRTS
- (iw_handler)NULL, // SIOCSIWFRAG
- (iw_handler)NULL, // SIOCGIWFRAG
- (iw_handler)NULL, // SIOCSIWTXPOW
- (iw_handler)NULL, // SIOCGIWTXPOW
- (iw_handler)NULL, // SIOCSIWRETRY
- (iw_handler)NULL, // SIOCGIWRETRY
- (iw_handler)NULL, // SIOCSIWENCODE
- (iw_handler)NULL, // SIOCGIWENCODE
- (iw_handler)NULL, // SIOCSIWPOWER
- (iw_handler)NULL, // SIOCGIWPOWER
- (iw_handler)NULL, // -- hole --
- (iw_handler)NULL, // -- hole --
- (iw_handler)NULL, // SIOCSIWGENIE
- (iw_handler)NULL, // SIOCGIWGENIE
- (iw_handler)NULL, // SIOCSIWAUTH
- (iw_handler)NULL, // SIOCGIWAUTH
- (iw_handler)NULL, // SIOCSIWENCODEEXT
- (iw_handler)NULL, // SIOCGIWENCODEEXT
- (iw_handler)NULL, // SIOCSIWPMKSA
- (iw_handler)NULL, // -- hole --
+ IW_HANDLER(SIOCSIWCOMMIT, iwctl_config_commit),
+ IW_HANDLER(SIOCGIWNAME, iwctl_giwname),
+ IW_HANDLER(SIOCSIWFREQ, iwctl_siwfreq),
+ IW_HANDLER(SIOCGIWFREQ, iwctl_giwfreq),
+ IW_HANDLER(SIOCSIWMODE, iwctl_siwmode),
+ IW_HANDLER(SIOCGIWMODE, iwctl_giwmode),
+ IW_HANDLER(SIOCGIWSENS, iwctl_giwsens),
+ IW_HANDLER(SIOCGIWRANGE, iwctl_giwrange),
+ IW_HANDLER(SIOCSIWAP, iwctl_siwap),
+ IW_HANDLER(SIOCGIWAP, iwctl_giwap),
+ IW_HANDLER(SIOCSIWMLME, iwctl_siwmlme),
+ IW_HANDLER(SIOCGIWAPLIST, iwctl_giwaplist),
+ IW_HANDLER(SIOCSIWSCAN, iwctl_siwscan),
+ IW_HANDLER(SIOCGIWSCAN, iwctl_giwscan),
+ IW_HANDLER(SIOCSIWESSID, iwctl_siwessid),
+ IW_HANDLER(SIOCGIWESSID, iwctl_giwessid),
+ IW_HANDLER(SIOCSIWRATE, iwctl_siwrate),
+ IW_HANDLER(SIOCGIWRATE, iwctl_giwrate),
+ IW_HANDLER(SIOCSIWRTS, iwctl_siwrts),
+ IW_HANDLER(SIOCGIWRTS, iwctl_giwrts),
+ IW_HANDLER(SIOCSIWFRAG, iwctl_siwfrag),
+ IW_HANDLER(SIOCGIWFRAG, iwctl_giwfrag),
+ IW_HANDLER(SIOCSIWRETRY, iwctl_siwretry),
+ IW_HANDLER(SIOCGIWRETRY, iwctl_giwretry),
+ IW_HANDLER(SIOCSIWENCODE, iwctl_siwencode),
+ IW_HANDLER(SIOCGIWENCODE, iwctl_giwencode),
+ IW_HANDLER(SIOCSIWPOWER, iwctl_siwpower),
+ IW_HANDLER(SIOCGIWPOWER, iwctl_giwpower),
+ IW_HANDLER(SIOCSIWGENIE, iwctl_siwgenie),
+ IW_HANDLER(SIOCGIWGENIE, iwctl_giwgenie),
+ IW_HANDLER(SIOCSIWMLME, iwctl_siwmlme),
+ IW_HANDLER(SIOCSIWAUTH, iwctl_siwauth),
+ IW_HANDLER(SIOCGIWAUTH, iwctl_giwauth),
+ IW_HANDLER(SIOCSIWENCODEEXT, iwctl_siwencodeext),
+ IW_HANDLER(SIOCGIWENCODEEXT, iwctl_giwencodeext)
};
static const iw_handler iwctl_private_handler[] = {
NULL, // SIOCIWFIRSTPRIV
};
-struct iw_priv_args iwctl_private_args[] = {
- { IOCTL_CMD_SET, IW_PRIV_TYPE_CHAR | 1024, 0, "set" },
-};
-
const struct iw_handler_def iwctl_handler_def = {
.get_wireless_stats = &iwctl_get_wireless_stats,
- .num_standard = sizeof(iwctl_handler) / sizeof(iw_handler),
+ .num_standard = ARRAY_SIZE(iwctl_handler),
.num_private = 0,
.num_private_args = 0,
- .standard = (iw_handler *)iwctl_handler,
+ .standard = iwctl_handler,
.private = NULL,
.private_args = NULL,
};
diff --git a/drivers/staging/vt6656/iwctl.h b/drivers/staging/vt6656/iwctl.h
index d056f83a9158..b594a10db318 100644
--- a/drivers/staging/vt6656/iwctl.h
+++ b/drivers/staging/vt6656/iwctl.h
@@ -42,106 +42,105 @@
struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev);
int iwctl_siwap(struct net_device *dev, struct iw_request_info *info,
- struct sockaddr *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
-void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra);
+int iwctl_giwrange(struct net_device *dev, struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra);
-void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info,
- __u32 *wmode, char *extra);
+int iwctl_giwmode(struct net_device *dev, struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra);
int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info,
- __u32 *wmode, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info,
- struct iw_freq *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info,
- struct iw_freq *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwname(struct net_device *dev, struct iw_request_info *info,
- char *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwap(struct net_device *dev, struct iw_request_info *info,
- struct sockaddr *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
-void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra);
+int iwctl_giwessid(struct net_device *dev, struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra);
int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
-void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+int iwctl_giwrate(struct net_device *dev, struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra);
-int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq);
+int iwctl_siwrts(struct net_device *dev, struct iw_request_info *info,
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info,
- struct iw_param *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra);
+ union iwreq_data *wrqu, char *extra);
int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info,
- struct iw_point *wrq, char *extra);
-#endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+ union iwreq_data *wrqu, char *extra);
extern const struct iw_handler_def iwctl_handler_def;
-extern const struct iw_priv_args iwctl_private_args;
+extern const struct iw_priv_args iwctl_priv_args;
#endif /* __IWCTL_H__ */
diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c
index a61fcb9591aa..8c78b86b5c80 100644
--- a/drivers/staging/vt6656/key.c
+++ b/drivers/staging/vt6656/key.c
@@ -36,9 +36,9 @@
*
*/
+#include "mac.h"
#include "tmacro.h"
#include "key.h"
-#include "mac.h"
#include "rndis.h"
#include "control.h"
@@ -223,7 +223,7 @@ BOOL KeybSetKey(
PSKeyManagement pTable,
PBYTE pbyBSSID,
DWORD dwKeyIndex,
- unsigned long uKeyLength,
+ u32 uKeyLength,
PQWORD pKeyRSC,
PBYTE pbyKey,
BYTE byKeyDecMode
@@ -235,7 +235,8 @@ BOOL KeybSetKey(
PSKeyItem pKey;
unsigned int uKeyIdx;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetKey: %lX\n", dwKeyIndex);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Enter KeybSetKey: %X\n", dwKeyIndex);
j = (MAX_KEY_TABLE-1);
for (i=0;i<(MAX_KEY_TABLE-1);i++) {
@@ -261,7 +262,9 @@ BOOL KeybSetKey(
if ((dwKeyIndex & TRANSMIT_KEY) != 0) {
// Group transmit key
pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Group transmit key(R)[%X]: %d\n",
+ pTable->KeyTable[i].dwGTKeyIndex, i);
}
pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed
pTable->KeyTable[i].wKeyCtl |= (byKeyDecMode << 4);
@@ -302,9 +305,12 @@ BOOL KeybSetKey(
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", pKey->wTSC15_0);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n ",
+ pKey->dwTSC47_16);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ",
+ pKey->wTSC15_0);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n ",
+ pKey->dwKeyIndex);
return (TRUE);
}
@@ -326,7 +332,9 @@ BOOL KeybSetKey(
if ((dwKeyIndex & TRANSMIT_KEY) != 0) {
// Group transmit key
pTable->KeyTable[j].dwGTKeyIndex = dwKeyIndex;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(N)[%lX]: %d\n", pTable->KeyTable[j].dwGTKeyIndex, j);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Group transmit key(N)[%X]: %d\n",
+ pTable->KeyTable[j].dwGTKeyIndex, j);
}
pTable->KeyTable[j].wKeyCtl &= 0xFF0F; // clear group key control filed
pTable->KeyTable[j].wKeyCtl |= (byKeyDecMode << 4);
@@ -367,9 +375,11 @@ BOOL KeybSetKey(
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n ",
+ pKey->dwTSC47_16);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", pKey->wTSC15_0);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n ",
+ pKey->dwKeyIndex);
return (TRUE);
}
@@ -597,7 +607,8 @@ BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType,
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x ", pTable->KeyTable[i].abyBSSID[ii]);
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwGTKeyIndex: %lX\n", pTable->KeyTable[i].dwGTKeyIndex);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwGTKeyIndex: %X\n",
+ pTable->KeyTable[i].dwGTKeyIndex);
return (TRUE);
}
@@ -664,7 +675,7 @@ BOOL KeybSetDefaultKey(
void *pDeviceHandler,
PSKeyManagement pTable,
DWORD dwKeyIndex,
- unsigned long uKeyLength,
+ u32 uKeyLength,
PQWORD pKeyRSC,
PBYTE pbyKey,
BYTE byKeyDecMode
@@ -696,7 +707,10 @@ BOOL KeybSetDefaultKey(
if ((dwKeyIndex & TRANSMIT_KEY) != 0) {
// Group transmit key
pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = dwKeyIndex;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex, MAX_KEY_TABLE-1);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Group transmit key(R)[%X]: %d\n",
+ pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex,
+ MAX_KEY_TABLE-1);
}
pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl &= 0x7F00; // clear all key control filed
@@ -747,9 +761,11 @@ BOOL KeybSetDefaultKey(
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n", pKey->dwTSC47_16);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n",
+ pKey->dwTSC47_16);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n", pKey->wTSC15_0);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n", pKey->dwKeyIndex);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n",
+ pKey->dwKeyIndex);
return (TRUE);
}
@@ -775,7 +791,7 @@ BOOL KeybSetAllGroupKey(
void *pDeviceHandler,
PSKeyManagement pTable,
DWORD dwKeyIndex,
- unsigned long uKeyLength,
+ u32 uKeyLength,
PQWORD pKeyRSC,
PBYTE pbyKey,
BYTE byKeyDecMode
@@ -787,7 +803,8 @@ BOOL KeybSetAllGroupKey(
PSKeyItem pKey;
unsigned int uKeyIdx;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %lX\n", dwKeyIndex);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %X\n",
+ dwKeyIndex);
if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key
@@ -804,7 +821,9 @@ BOOL KeybSetAllGroupKey(
if ((dwKeyIndex & TRANSMIT_KEY) != 0) {
// Group transmit key
pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Group transmit key(R)[%X]: %d\n",
+ pTable->KeyTable[i].dwGTKeyIndex, i);
}
pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed
diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h
index f749c7a027d3..bd35d39621ae 100644
--- a/drivers/staging/vt6656/key.h
+++ b/drivers/staging/vt6656/key.h
@@ -58,7 +58,7 @@
typedef struct tagSKeyItem
{
BOOL bKeyValid;
- unsigned long uKeyLength;
+ u32 uKeyLength;
BYTE abyKey[MAX_KEY_LEN];
QWORD KeyRSC;
DWORD dwTSC47_16;
@@ -107,7 +107,7 @@ BOOL KeybSetKey(
PSKeyManagement pTable,
PBYTE pbyBSSID,
DWORD dwKeyIndex,
- unsigned long uKeyLength,
+ u32 uKeyLength,
PQWORD pKeyRSC,
PBYTE pbyKey,
BYTE byKeyDecMode
@@ -146,7 +146,7 @@ BOOL KeybSetDefaultKey(
void *pDeviceHandler,
PSKeyManagement pTable,
DWORD dwKeyIndex,
- unsigned long uKeyLength,
+ u32 uKeyLength,
PQWORD pKeyRSC,
PBYTE pbyKey,
BYTE byKeyDecMode
@@ -156,7 +156,7 @@ BOOL KeybSetAllGroupKey(
void *pDeviceHandler,
PSKeyManagement pTable,
DWORD dwKeyIndex,
- unsigned long uKeyLength,
+ u32 uKeyLength,
PQWORD pKeyRSC,
PBYTE pbyKey,
BYTE byKeyDecMode
diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c
index af4a29d14775..8fddc7b3930b 100644
--- a/drivers/staging/vt6656/mac.c
+++ b/drivers/staging/vt6656/mac.c
@@ -260,7 +260,8 @@ BYTE pbyData[24];
dwData1 <<= 16;
dwData1 |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData1, wKeyCtl);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %X,"\
+ " KeyCtl:%X\n", wOffset, dwData1, wKeyCtl);
//VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
//VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
@@ -277,7 +278,8 @@ BYTE pbyData[24];
dwData2 <<= 8;
dwData2 |= *(pbyAddr+0);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %lX\n", wOffset, dwData2);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %X\n",
+ wOffset, dwData2);
//VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
//VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index ad422dea702b..f33086d66496 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -61,7 +61,6 @@
#include "bssdb.h"
#include "hostap.h"
#include "wpactl.h"
-#include "ioctl.h"
#include "iwctl.h"
#include "dpc.h"
#include "datarate.h"
@@ -244,7 +243,6 @@ static int Config_FileGetParameter(unsigned char *string,
unsigned char *dest,
unsigned char *source);
-static BOOL device_release_WPADEV(PSDevice pDevice);
static void usb_device_reset(PSDevice pDevice);
@@ -634,40 +632,6 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)
return TRUE;
}
-static BOOL device_release_WPADEV(PSDevice pDevice)
-{
- viawget_wpa_header *wpahdr;
- int ii=0;
- // wait_queue_head_t Set_wait;
- //send device close to wpa_supplicant layer
- if (pDevice->bWPADEVUp==TRUE) {
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- wpahdr->type = VIAWGET_DEVICECLOSE_MSG;
- wpahdr->resp_ie_len = 0;
- wpahdr->req_ie_len = 0;
- skb_put(pDevice->skb, sizeof(viawget_wpa_header));
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
-
- //wait release WPADEV
- // init_waitqueue_head(&Set_wait);
- // wait_event_timeout(Set_wait, ((pDevice->wpadev==NULL)&&(pDevice->skb == NULL)),5*HZ); //1s wait
- while(pDevice->bWPADEVUp==TRUE) {
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout (HZ/20); //wait 50ms
- ii++;
- if(ii>20)
- break;
- }
- }
- return TRUE;
-}
-
#ifdef CONFIG_PM /* Minimal support for suspend and resume */
static int vt6656_suspend(struct usb_interface *intf, pm_message_t message)
@@ -711,7 +675,7 @@ static const struct net_device_ops device_netdev_ops = {
.ndo_set_rx_mode = device_set_multi,
};
-static int __devinit
+static int
vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
{
u8 fake_mac[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
@@ -758,17 +722,6 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
usb_device_reset(pDevice);
- {
- union iwreq_data wrqu;
- memset(&wrqu, 0, sizeof(wrqu));
- wrqu.data.flags = RT_INSMOD_EVENT_FLAG;
- wrqu.data.length = IFNAMSIZ;
- wireless_send_event(pDevice->dev,
- IWEVCUSTOM,
- &wrqu,
- pDevice->dev->name);
- }
-
return 0;
err_netdev:
@@ -991,12 +944,6 @@ BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) {
static int device_open(struct net_device *dev) {
PSDevice pDevice=(PSDevice) netdev_priv(dev);
- extern SWPAResult wpa_Result;
- memset(wpa_Result.ifname,0,sizeof(wpa_Result.ifname));
- wpa_Result.proto = 0;
- wpa_Result.key_mgmt = 0;
- wpa_Result.eap_type = 0;
- wpa_Result.authenticated = FALSE;
pDevice->fWPA_Authened = FALSE;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " device_open...\n");
@@ -1056,13 +1003,11 @@ static int device_open(struct net_device *dev) {
pDevice->bEventAvailable = FALSE;
pDevice->bWPADEVUp = FALSE;
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
pDevice->bwextstep0 = FALSE;
pDevice->bwextstep1 = FALSE;
pDevice->bwextstep2 = FALSE;
pDevice->bwextstep3 = FALSE;
pDevice->bWPASuppWextEnabled = FALSE;
-#endif
pDevice->byReAssocCount = 0;
RXvWorkItem(pDevice);
@@ -1096,15 +1041,8 @@ static int device_open(struct net_device *dev) {
netif_stop_queue(pDevice->dev);
pDevice->flags |= DEVICE_FLAGS_OPENED;
-{
- union iwreq_data wrqu;
- memset(&wrqu, 0, sizeof(wrqu));
- wrqu.data.flags = RT_UPDEV_EVENT_FLAG;
- wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, NULL);
-}
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success.. \n");
- return 0;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success..\n");
+ return 0;
free_all:
device_free_frag_bufs(pDevice);
@@ -1133,19 +1071,11 @@ static int device_close(struct net_device *dev) {
if (pDevice == NULL)
return -ENODEV;
-{
- union iwreq_data wrqu;
- memset(&wrqu, 0, sizeof(wrqu));
- wrqu.data.flags = RT_DOWNDEV_EVENT_FLAG;
- wireless_send_event(pDevice->dev, IWEVCUSTOM, &wrqu, NULL);
-}
-
if (pDevice->bLinkPass) {
bScheduleCommand((void *) pDevice, WLAN_CMD_DISASSOCIATE, NULL);
mdelay(30);
}
-device_release_WPADEV(pDevice);
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
pMgmt->bShareKeyAlgorithm = FALSE;
@@ -1204,22 +1134,13 @@ device_release_WPADEV(pDevice);
return 0;
}
-static void __devexit vt6656_disconnect(struct usb_interface *intf)
+static void vt6656_disconnect(struct usb_interface *intf)
{
PSDevice device = usb_get_intfdata(intf);
if (!device)
return;
- {
- union iwreq_data req;
- memset(&req, 0, sizeof(req));
- req.data.flags = RT_RMMOD_EVENT_FLAG;
- wireless_send_event(device->dev, IWEVCUSTOM, &req, NULL);
- }
-
- device_release_WPADEV(device);
- release_firmware(device->firmware);
usb_set_intfdata(intf, NULL);
usb_put_dev(interface_to_usbdev(intf));
@@ -1228,9 +1149,9 @@ static void __devexit vt6656_disconnect(struct usb_interface *intf)
if (device->dev) {
unregister_netdev(device->dev);
- wpa_set_wpadev(device, 0);
free_netdev(device->dev);
}
+
}
static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev)
@@ -1549,470 +1470,35 @@ static void device_set_multi(struct net_device *dev) {
}
-
-static struct net_device_stats *device_get_stats(struct net_device *dev) {
+static struct net_device_stats *device_get_stats(struct net_device *dev)
+{
PSDevice pDevice=(PSDevice) netdev_priv(dev);
return &pDevice->stats;
}
-
-static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- PSCmdRequest pReq;
- //BOOL bCommit = FALSE;
+static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+{
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
struct iwreq *wrq = (struct iwreq *) rq;
- int rc =0;
-
- if (pMgmt == NULL) {
- rc = -EFAULT;
- return rc;
- }
-
- switch(cmd) {
-
- case SIOCGIWNAME:
- rc = iwctl_giwname(dev, NULL, (char *)&(wrq->u.name), NULL);
- break;
-
- case SIOCSIWNWID:
- case SIOCGIWNWID: //0x8b03 support
- rc = -EOPNOTSUPP;
- break;
-
- // Set frequency/channel
- case SIOCSIWFREQ:
- rc = iwctl_siwfreq(dev, NULL, &(wrq->u.freq), NULL);
- break;
-
- // Get frequency/channel
- case SIOCGIWFREQ:
- rc = iwctl_giwfreq(dev, NULL, &(wrq->u.freq), NULL);
- break;
-
- // Set desired network name (ESSID)
- case SIOCSIWESSID:
-
- {
- char essid[IW_ESSID_MAX_SIZE+1];
- if (wrq->u.essid.length > IW_ESSID_MAX_SIZE) {
- rc = -E2BIG;
- break;
- }
- if (copy_from_user(essid, wrq->u.essid.pointer,
- wrq->u.essid.length)) {
- rc = -EFAULT;
- break;
- }
- rc = iwctl_siwessid(dev, NULL,
- &(wrq->u.essid), essid);
- }
- break;
-
-
- // Get current network name (ESSID)
- case SIOCGIWESSID:
-
- {
- char essid[IW_ESSID_MAX_SIZE+1];
- if (wrq->u.essid.pointer) {
- iwctl_giwessid(dev, NULL,
- &(wrq->u.essid), essid);
- if (copy_to_user(wrq->u.essid.pointer,
- essid,
- wrq->u.essid.length) )
- rc = -EFAULT;
- }
- }
- break;
-
- case SIOCSIWAP:
-
- rc = iwctl_siwap(dev, NULL, &(wrq->u.ap_addr), NULL);
- break;
-
-
- // Get current Access Point (BSSID)
- case SIOCGIWAP:
- rc = iwctl_giwap(dev, NULL, &(wrq->u.ap_addr), NULL);
- break;
-
-
- // Set desired station name
- case SIOCSIWNICKN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWNICKN \n");
- rc = -EOPNOTSUPP;
- break;
-
- // Get current station name
- case SIOCGIWNICKN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWNICKN \n");
- rc = -EOPNOTSUPP;
- break;
-
- // Set the desired bit-rate
- case SIOCSIWRATE:
- rc = iwctl_siwrate(dev, NULL, &(wrq->u.bitrate), NULL);
- break;
-
- // Get the current bit-rate
- case SIOCGIWRATE:
- iwctl_giwrate(dev, NULL, &(wrq->u.bitrate), NULL);
- break;
-
- // Set the desired RTS threshold
- case SIOCSIWRTS:
-
- rc = iwctl_siwrts(dev, &(wrq->u.rts));
- break;
-
- // Get the current RTS threshold
- case SIOCGIWRTS:
-
- rc = iwctl_giwrts(dev, NULL, &(wrq->u.rts), NULL);
- break;
-
- // Set the desired fragmentation threshold
- case SIOCSIWFRAG:
-
- rc = iwctl_siwfrag(dev, NULL, &(wrq->u.frag), NULL);
- break;
-
- // Get the current fragmentation threshold
- case SIOCGIWFRAG:
-
- rc = iwctl_giwfrag(dev, NULL, &(wrq->u.frag), NULL);
- break;
-
- // Set mode of operation
- case SIOCSIWMODE:
- rc = iwctl_siwmode(dev, NULL, &(wrq->u.mode), NULL);
- break;
-
- // Get mode of operation
- case SIOCGIWMODE:
- iwctl_giwmode(dev, NULL, &(wrq->u.mode), NULL);
- break;
-
- // Set WEP keys and mode
- case SIOCSIWENCODE:
- {
- char abyKey[WLAN_WEP232_KEYLEN];
-
- if (wrq->u.encoding.pointer) {
-
-
- if (wrq->u.encoding.length > WLAN_WEP232_KEYLEN) {
- rc = -E2BIG;
- break;
- }
- memset(abyKey, 0, WLAN_WEP232_KEYLEN);
- if (copy_from_user(abyKey,
- wrq->u.encoding.pointer,
- wrq->u.encoding.length)) {
- rc = -EFAULT;
- break;
- }
- } else if (wrq->u.encoding.length != 0) {
- rc = -EINVAL;
- break;
- }
- rc = iwctl_siwencode(dev, NULL, &(wrq->u.encoding), abyKey);
- }
- break;
-
- // Get the WEP keys and mode
- case SIOCGIWENCODE:
-
- if (!capable(CAP_NET_ADMIN)) {
- rc = -EPERM;
- break;
- }
- {
- char abyKey[WLAN_WEP232_KEYLEN];
-
- rc = iwctl_giwencode(dev, NULL, &(wrq->u.encoding), abyKey);
- if (rc != 0) break;
- if (wrq->u.encoding.pointer) {
- if (copy_to_user(wrq->u.encoding.pointer,
- abyKey,
- wrq->u.encoding.length))
- rc = -EFAULT;
- }
- }
- break;
-
- // Get the current Tx-Power
- case SIOCGIWTXPOW:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW \n");
- rc = -EOPNOTSUPP;
- break;
-
- case SIOCSIWTXPOW:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW \n");
- rc = -EOPNOTSUPP;
- break;
-
- case SIOCSIWRETRY:
-
- rc = iwctl_siwretry(dev, NULL, &(wrq->u.retry), NULL);
- break;
-
- case SIOCGIWRETRY:
-
- rc = iwctl_giwretry(dev, NULL, &(wrq->u.retry), NULL);
- break;
-
- // Get range of parameters
- case SIOCGIWRANGE:
-
- {
- struct iw_range range;
-
- iwctl_giwrange(dev, NULL, &(wrq->u.data), (char *) &range);
- if (copy_to_user(wrq->u.data.pointer, &range, sizeof(struct iw_range)))
- rc = -EFAULT;
- }
-
- break;
-
- case SIOCGIWPOWER:
-
- rc = iwctl_giwpower(dev, NULL, &(wrq->u.power), NULL);
- break;
-
-
- case SIOCSIWPOWER:
-
- rc = iwctl_siwpower(dev, NULL, &(wrq->u.power), NULL);
- break;
-
-
- case SIOCGIWSENS:
-
- rc = iwctl_giwsens(dev, NULL, &(wrq->u.sens), NULL);
- break;
-
- case SIOCSIWSENS:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSENS \n");
- rc = -EOPNOTSUPP;
- break;
-
- case SIOCGIWAPLIST:
- {
- char buffer[IW_MAX_AP * (sizeof(struct sockaddr) + sizeof(struct iw_quality))];
-
- if (wrq->u.data.pointer) {
- rc = iwctl_giwaplist(dev, NULL, &(wrq->u.data), buffer);
- if (rc == 0) {
- if (copy_to_user(wrq->u.data.pointer,
- buffer,
- (wrq->u.data.length * (sizeof(struct sockaddr) + sizeof(struct iw_quality)))
- ))
- rc = -EFAULT;
- }
- }
- }
- break;
-
-
-#ifdef WIRELESS_SPY
- // Set the spy list
- case SIOCSIWSPY:
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY \n");
- rc = -EOPNOTSUPP;
- break;
-
- // Get the spy list
- case SIOCGIWSPY:
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY \n");
- rc = -EOPNOTSUPP;
- break;
-
-#endif // WIRELESS_SPY
-
- case SIOCGIWPRIV:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPRIV \n");
- rc = -EOPNOTSUPP;
-/*
- if(wrq->u.data.pointer) {
- wrq->u.data.length = sizeof(iwctl_private_args) / sizeof( iwctl_private_args[0]);
-
- if(copy_to_user(wrq->u.data.pointer,
- (u_char *) iwctl_private_args,
- sizeof(iwctl_private_args)))
- rc = -EFAULT;
- }
-*/
- break;
-
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- case SIOCSIWAUTH:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH\n");
- rc = iwctl_siwauth(dev, NULL, &(wrq->u.param), NULL);
- break;
-
- case SIOCGIWAUTH:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAUTH \n");
- rc = iwctl_giwauth(dev, NULL, &(wrq->u.param), NULL);
- break;
-
- case SIOCSIWGENIE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWGENIE \n");
- rc = iwctl_siwgenie(dev, NULL, &(wrq->u.data), wrq->u.data.pointer);
- break;
-
- case SIOCGIWGENIE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWGENIE \n");
- rc = iwctl_giwgenie(dev, NULL, &(wrq->u.data), wrq->u.data.pointer);
- break;
-
- case SIOCSIWENCODEEXT:
- {
- char extra[sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1];
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODEEXT \n");
- if(wrq->u.encoding.pointer){
- memset(extra, 0, sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1);
- if(wrq->u.encoding.length > (sizeof(struct iw_encode_ext)+ MAX_KEY_LEN)){
- rc = -E2BIG;
- break;
- }
- if(copy_from_user(extra, wrq->u.encoding.pointer,wrq->u.encoding.length)){
- rc = -EFAULT;
- break;
- }
- }else if(wrq->u.encoding.length != 0){
- rc = -EINVAL;
- break;
- }
- rc = iwctl_siwencodeext(dev, NULL, &(wrq->u.encoding), extra);
- }
- break;
-
- case SIOCGIWENCODEEXT:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODEEXT \n");
- rc = iwctl_giwencodeext(dev, NULL, &(wrq->u.encoding), NULL);
- break;
-
- case SIOCSIWMLME:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMLME \n");
- rc = iwctl_siwmlme(dev, NULL, &(wrq->u.data), wrq->u.data.pointer);
- break;
-
-#endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
-
- case IOCTL_CMD_TEST:
-
- if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
- rc = -EFAULT;
- break;
- } else {
- rc = 0;
- }
- pReq = (PSCmdRequest)rq;
-
- //20080130-01,<Remark> by Mike Liu
- // if(pDevice->bLinkPass==TRUE)
- pReq->wResult = MAGIC_CODE; //Linking status:0x3142
- //20080130-02,<Remark> by Mike Liu
- // else
- // pReq->wResult = MAGIC_CODE+1; //disconnect status:0x3143
- break;
-
- case IOCTL_CMD_SET:
- if (!(pDevice->flags & DEVICE_FLAGS_OPENED) &&
- (((PSCmdRequest)rq)->wCmdCode !=WLAN_CMD_SET_WPA))
- {
- rc = -EFAULT;
- break;
- } else {
- rc = 0;
- }
+ int rc = 0;
- if (test_and_set_bit( 0, (void*)&(pMgmt->uCmdBusy))) {
- return -EBUSY;
- }
- rc = private_ioctl(pDevice, rq);
- clear_bit( 0, (void*)&(pMgmt->uCmdBusy));
- break;
+ switch (cmd) {
- case IOCTL_CMD_HOSTAPD:
+ case IOCTL_CMD_HOSTAPD:
- if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
- rc = -EFAULT;
- break;
- } else {
- rc = 0;
- }
+ if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
+ rc = -EFAULT;
rc = vt6656_hostap_ioctl(pDevice, &wrq->u.data);
- break;
-
- case IOCTL_CMD_WPA:
-
- if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
- rc = -EFAULT;
- break;
- } else {
- rc = 0;
- }
-
- rc = wpa_ioctl(pDevice, &wrq->u.data);
- break;
+ break;
case SIOCETHTOOL:
- return ethtool_ioctl(dev, (void *) rq->ifr_data);
- // All other calls are currently unsupported
-
- default:
- rc = -EOPNOTSUPP;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Ioctl command not supported..%x\n", cmd);
-
-
- }
-
- if (pDevice->bCommit) {
- if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
- netif_stop_queue(pDevice->dev);
- spin_lock_irq(&pDevice->lock);
- bScheduleCommand((void *) pDevice, WLAN_CMD_RUN_AP, NULL);
- spin_unlock_irq(&pDevice->lock);
- }
- else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Commit the settings\n");
- spin_lock_irq(&pDevice->lock);
-//2007-1121-01<Modify>by EinsnLiu
- if (pDevice->bLinkPass &&
- memcmp(pMgmt->abyCurrSSID,pMgmt->abyDesireSSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN)) {
- bScheduleCommand((void *) pDevice, WLAN_CMD_DISASSOCIATE, NULL);
- } else {
- pDevice->bLinkPass = FALSE;
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- memset(pMgmt->abyCurrBSSID, 0, 6);
- }
- ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW);
-//End Modify
- netif_stop_queue(pDevice->dev);
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- pMgmt->eScanType = WMAC_SCAN_ACTIVE;
- if (!pDevice->bWPASuppWextEnabled)
-#endif
- bScheduleCommand((void *) pDevice,
- WLAN_CMD_BSSID_SCAN,
- pMgmt->abyDesireSSID);
- bScheduleCommand((void *) pDevice,
- WLAN_CMD_SSID,
- NULL);
- spin_unlock_irq(&pDevice->lock);
- }
- pDevice->bCommit = FALSE;
- }
+ return ethtool_ioctl(dev, (void *) rq->ifr_data);
+ }
- return rc;
+ return rc;
}
diff --git a/drivers/staging/vt6656/mib.c b/drivers/staging/vt6656/mib.c
index 8a6ee72f4409..d4c7b0cc7ecd 100644
--- a/drivers/staging/vt6656/mib.c
+++ b/drivers/staging/vt6656/mib.c
@@ -37,7 +37,6 @@
*
*/
-#include "upc.h"
#include "mac.h"
#include "tether.h"
#include "mib.h"
diff --git a/drivers/staging/vt6656/mib.h b/drivers/staging/vt6656/mib.h
index 82d69a9cc209..85c28e923663 100644
--- a/drivers/staging/vt6656/mib.h
+++ b/drivers/staging/vt6656/mib.h
@@ -68,7 +68,6 @@ typedef struct tagSDot11Counters {
unsigned long long TKIPLocalMICFailures;
unsigned long long TKIPRemoteMICFailures;
unsigned long long TKIPICVErrors;
- unsigned long long TKIPCounterMeasuresInvoked;
unsigned long long TKIPReplays;
unsigned long long CCMPFormatErrors;
unsigned long long CCMPReplays;
diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 593cdc713b0e..74c0598e37b7 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -769,6 +769,9 @@ BYTE byPwr = pDevice->byCCKPwr;
return TRUE;
}
+ if (uCH == 0)
+ return -EINVAL;
+
switch (uRATE) {
case RATE_1M:
case RATE_2M:
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 339083879883..83c04e120935 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -355,7 +355,7 @@ s_vFillTxKey (
}
// Append IV after Mac Header
*pdwIV &= WEP_IV_MASK;//00000000 11111111 11111111 11111111
- *pdwIV |= (pDevice->byKeyIndex << 30);
+ *pdwIV |= (u32)pDevice->byKeyIndex << 30;
*pdwIV = cpu_to_le32(*pdwIV);
pDevice->dwIVCounter++;
if (pDevice->dwIVCounter > WEP_IV_MASK) {
@@ -375,7 +375,8 @@ s_vFillTxKey (
*(pbyIVHead+3) = (BYTE)(((pDevice->byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV
// Append IV&ExtIV after Mac Header
*pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFillTxKey()---- pdwExtIV: %lx\n", *pdwExtIV);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFillTxKey()---- pdwExtIV: %x\n",
+ *pdwExtIV);
} else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) {
pTransmitKey->wTSC15_0++;
@@ -1452,12 +1453,10 @@ s_bPacketToWirelessUsb(
pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
- if ((bNeedEncryption) && (pTransmitKey != NULL)) {
- if (((PSKeyTable) (pTransmitKey->pvKeyTable))->bSoftWEP == TRUE) {
- // WEP 256
- bSoftWEP = TRUE;
- }
- }
+ if (bNeedEncryption && pTransmitKey->pvKeyTable) {
+ if (((PSKeyTable)&pTransmitKey->pvKeyTable)->bSoftWEP == TRUE)
+ bSoftWEP = TRUE; /* WEP 256 */
+ }
pTxBufHead = (PTX_BUFFER) usbPacketBuf;
memset(pTxBufHead, 0, sizeof(TX_BUFFER));
@@ -1751,7 +1750,8 @@ s_bPacketToWirelessUsb(
MIC_vAppend((PBYTE)&(psEthHeader->abyDstAddr[0]), 12);
dwMIC_Priority = 0;
MIC_vAppend((PBYTE)&dwMIC_Priority, 4);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC KEY: %X, %X\n",
+ dwMICKey0, dwMICKey1);
///////////////////////////////////////////////////////////////////
@@ -2633,7 +2633,8 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) {
MIC_vAppend((PBYTE)&(sEthHeader.abyDstAddr[0]), 12);
dwMIC_Priority = 0;
MIC_vAppend((PBYTE)&dwMIC_Priority, 4);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0_tx_8021:MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0_tx_8021:MIC KEY:"\
+ " %X, %X\n", dwMICKey0, dwMICKey1);
uLength = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen;
@@ -2653,7 +2654,8 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderSize, uPadding, cbIVlen);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%lx, %lx\n", *pdwMIC_L, *pdwMIC_R);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%x, %x\n",
+ *pdwMIC_L, *pdwMIC_R);
}
@@ -3027,21 +3029,18 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"error: KEY is GTK!!~~\n");
}
else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%lX]\n", pTransmitKey->dwKeyIndex);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%X]\n",
+ pTransmitKey->dwKeyIndex);
bNeedEncryption = TRUE;
}
}
}
- if (pDevice->byCntMeasure == 2) {
- bNeedDeAuth = TRUE;
- pDevice->s802_11Counter.TKIPCounterMeasuresInvoked++;
- }
-
if (pDevice->bEnableHostWEP) {
if ((uNodeIndex != 0) &&
(pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex & PAIRWISE_KEY)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%lX]\n", pTransmitKey->dwKeyIndex);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%X]\n",
+ pTransmitKey->dwKeyIndex);
bNeedEncryption = TRUE;
}
}
@@ -3050,6 +3049,7 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb)
if (pTransmitKey == NULL) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"return no tx key\n");
+ pContext->bBoolInUse = FALSE;
dev_kfree_skb_irq(skb);
pStats->tx_dropped++;
return STATUS_FAILURE;
diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index f99acf1d8eb9..dd2198acc636 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -61,9 +61,9 @@ typedef struct tagSCTSDataF {
// MICHDR data header
//
typedef struct tagSMICHDR {
- DWORD adwHDR0[4];
- DWORD adwHDR1[4];
- DWORD adwHDR2[4];
+ u32 adwHDR0[4];
+ u32 adwHDR1[4];
+ u32 adwHDR2[4];
} SMICHDR, *PSMICHDR;
@@ -630,7 +630,7 @@ typedef struct tagSTX_BUFFER
BYTE byPKTNO;
WORD wTxByteCount;
- DWORD adwTxKey[4];
+ u32 adwTxKey[4];
WORD wFIFOCtl;
WORD wTimeStamp;
WORD wFragCtl;
diff --git a/drivers/staging/vt6656/tkip.c b/drivers/staging/vt6656/tkip.c
index 003123e550f6..282c08d65761 100644
--- a/drivers/staging/vt6656/tkip.c
+++ b/drivers/staging/vt6656/tkip.c
@@ -189,27 +189,25 @@ void TKIPvMixKey(
PBYTE pbyRC4Key
)
{
- unsigned int p1k[5];
-// unsigned int ttak0, ttak1, ttak2, ttak3, ttak4;
- unsigned int tsc0, tsc1, tsc2;
- unsigned int ppk0, ppk1, ppk2, ppk3, ppk4, ppk5;
- unsigned long int pnl,pnh;
-
- int i, j;
-
- pnl = wTSC15_0;
- pnh = dwTSC47_16;
-
- tsc0 = (unsigned int)((pnh >> 16) % 65536); /* msb */
- tsc1 = (unsigned int)(pnh % 65536);
- tsc2 = (unsigned int)(pnl % 65536); /* lsb */
-
- /* Phase 1, step 1 */
- p1k[0] = tsc1;
- p1k[1] = tsc0;
- p1k[2] = (unsigned int)(pbyTA[0] + (pbyTA[1]*256));
- p1k[3] = (unsigned int)(pbyTA[2] + (pbyTA[3]*256));
- p1k[4] = (unsigned int)(pbyTA[4] + (pbyTA[5]*256));
+ u32 p1k[5];
+ u32 tsc0, tsc1, tsc2;
+ u32 ppk0, ppk1, ppk2, ppk3, ppk4, ppk5;
+ u32 pnl, pnh;
+ int i, j;
+
+ pnl = (u32)wTSC15_0;
+ pnh = (u32)(dwTSC47_16 & 0xffffffff);
+
+ tsc0 = (u32)((pnh >> 16) % 65536); /* msb */
+ tsc1 = (u32)(pnh % 65536);
+ tsc2 = (u32)(pnl % 65536); /* lsb */
+
+ /* Phase 1, step 1 */
+ p1k[0] = tsc1;
+ p1k[1] = tsc0;
+ p1k[2] = (u32)(pbyTA[0] + (pbyTA[1]*256));
+ p1k[3] = (u32)(pbyTA[2] + (pbyTA[3]*256));
+ p1k[4] = (u32)(pbyTA[4] + (pbyTA[5]*256));
/* Phase 1, step 2 */
for (i=0; i<8; i++) {
diff --git a/drivers/staging/vt6656/ttype.h b/drivers/staging/vt6656/ttype.h
index 8e9450ef3997..dfbf74713a80 100644
--- a/drivers/staging/vt6656/ttype.h
+++ b/drivers/staging/vt6656/ttype.h
@@ -29,6 +29,8 @@
#ifndef __TTYPE_H__
#define __TTYPE_H__
+#include <linux/types.h>
+
/******* Common definitions and typedefs ***********************************/
typedef int BOOL;
@@ -42,17 +44,17 @@ typedef int BOOL;
/****** Simple typedefs ***************************************************/
-typedef unsigned char BYTE; // 8-bit
-typedef unsigned short WORD; // 16-bit
-typedef unsigned long DWORD; // 32-bit
+typedef u8 BYTE;
+typedef u16 WORD;
+typedef u32 DWORD;
// QWORD is for those situation that we want
// an 8-byte-aligned 8 byte long structure
// which is NOT really a floating point number.
typedef union tagUQuadWord {
struct {
- DWORD dwLowDword;
- DWORD dwHighDword;
+ u32 dwLowDword;
+ u32 dwHighDword;
} u;
double DoNotUseThisField;
} UQuadWord;
@@ -60,8 +62,8 @@ typedef UQuadWord QWORD; // 64-bit
/****** Common pointer types ***********************************************/
-typedef unsigned long ULONG_PTR; // 32-bit
-typedef unsigned long DWORD_PTR; // 32-bit
+typedef u32 ULONG_PTR;
+typedef u32 DWORD_PTR;
// boolean pointer
diff --git a/drivers/staging/vt6656/upc.h b/drivers/staging/vt6656/upc.h
deleted file mode 100644
index b33aba4b12c9..000000000000
--- a/drivers/staging/vt6656/upc.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * File: upc.h
- *
- * Purpose: Macros to access device
- *
- * Author: Tevin Chen
- *
- * Date: Mar 17, 1997
- *
- */
-
-#ifndef __UPC_H__
-#define __UPC_H__
-
-#include "device.h"
-#include "ttype.h"
-
-/*--------------------- Export Definitions -------------------------*/
-
-
-//
-// For IO mapped
-//
-
-#ifdef IO_MAP
-
-#define VNSvInPortB(dwIOAddress, pbyData) { \
- *(pbyData) = inb(dwIOAddress); \
-}
-
-
-#define VNSvInPortW(dwIOAddress, pwData) { \
- *(pwData) = inw(dwIOAddress); \
-}
-
-#define VNSvInPortD(dwIOAddress, pdwData) { \
- *(pdwData) = inl(dwIOAddress); \
-}
-
-
-#define VNSvOutPortB(dwIOAddress, byData) { \
- outb(byData, dwIOAddress); \
-}
-
-
-#define VNSvOutPortW(dwIOAddress, wData) { \
- outw(wData, dwIOAddress); \
-}
-
-#define VNSvOutPortD(dwIOAddress, dwData) { \
- outl(dwData, dwIOAddress); \
-}
-
-#else
-
-//
-// For memory mapped IO
-//
-
-
-#define VNSvInPortB(dwIOAddress, pbyData) { \
- volatile BYTE* pbyAddr = ((PBYTE)(dwIOAddress)); \
- *(pbyData) = readb(pbyAddr); \
-}
-
-
-#define VNSvInPortW(dwIOAddress, pwData) { \
- volatile WORD* pwAddr = ((PWORD)(dwIOAddress)); \
- *(pwData) = readw(pwAddr); \
-}
-
-#define VNSvInPortD(dwIOAddress, pdwData) { \
- volatile DWORD* pdwAddr = ((PDWORD)(dwIOAddress)); \
- *(pdwData) = readl(pdwAddr); \
-}
-
-
-#define VNSvOutPortB(dwIOAddress, byData) { \
- volatile BYTE* pbyAddr = ((PBYTE)(dwIOAddress)); \
- writeb((BYTE)byData, pbyAddr); \
-}
-
-
-#define VNSvOutPortW(dwIOAddress, wData) { \
- volatile WORD* pwAddr = ((PWORD)(dwIOAddress)); \
- writew((WORD)wData, pwAddr); \
-}
-
-#define VNSvOutPortD(dwIOAddress, dwData) { \
- volatile DWORD* pdwAddr = ((PDWORD)(dwIOAddress)); \
- writel((DWORD)dwData, pdwAddr); \
-}
-
-#endif
-
-
-//
-// ALWAYS IO-Mapped IO when in 16-bit/32-bit environment
-//
-#define PCBvInPortB(dwIOAddress, pbyData) { \
- *(pbyData) = inb(dwIOAddress); \
-}
-
-#define PCBvInPortW(dwIOAddress, pwData) { \
- *(pwData) = inw(dwIOAddress); \
-}
-
-#define PCBvInPortD(dwIOAddress, pdwData) { \
- *(pdwData) = inl(dwIOAddress); \
-}
-
-#define PCBvOutPortB(dwIOAddress, byData) { \
- outb(byData, dwIOAddress); \
-}
-
-#define PCBvOutPortW(dwIOAddress, wData) { \
- outw(wData, dwIOAddress); \
-}
-
-#define PCBvOutPortD(dwIOAddress, dwData) { \
- outl(dwData, dwIOAddress); \
-}
-
-
-#define PCAvDelayByIO(uDelayUnit) { \
- BYTE byData; \
- unsigned long ii; \
- \
- if (uDelayUnit <= 50) { \
- udelay(uDelayUnit); \
- } \
- else { \
- for (ii = 0; ii < (uDelayUnit); ii++) \
- byData = inb(0x61); \
- } \
-}
-
-
-/*--------------------- Export Classes ----------------------------*/
-
-/*--------------------- Export Variables --------------------------*/
-
-/*--------------------- Export Functions --------------------------*/
-
-#endif /* __UPC_H__ */
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 609e8fa10b98..fc68518526e0 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -575,7 +575,8 @@ s_nsBulkInUsbIoCompleteRead(
// MP_SET_FLAG(pDevice, fMP_DISCONNECTED);
// }
} else {
- bIndicateReceive = TRUE;
+ if (bytesRead)
+ bIndicateReceive = TRUE;
pDevice->ulBulkInContCRCError = 0;
pDevice->ulBulkInBytesRead += bytesRead;
@@ -660,6 +661,7 @@ PIPEnsSendBulkOut(
if (status != 0)
{
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Submit Tx URB failed %d\n", status);
+ pContext->bBoolInUse = FALSE;
return STATUS_FAILURE;
}
return STATUS_PENDING;
diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c
index 586fbe1627f7..22f6b41cfd19 100644
--- a/drivers/staging/vt6656/wcmd.c
+++ b/drivers/staging/vt6656/wcmd.c
@@ -316,17 +316,19 @@ s_MgrMakeProbeRequest(
return pTxPacket;
}
-void vCommandTimerWait(void *hDeviceContext, unsigned int MSecond)
+void vCommandTimerWait(void *hDeviceContext, unsigned long MSecond)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
- init_timer(&pDevice->sTimerCommand);
- pDevice->sTimerCommand.data = (unsigned long)pDevice;
- pDevice->sTimerCommand.function = (TimerFunction)vRunCommand;
- // RUN_AT :1 msec ~= (HZ/1024)
- pDevice->sTimerCommand.expires = (unsigned int)RUN_AT((MSecond * HZ) >> 10);
- add_timer(&pDevice->sTimerCommand);
- return;
+ init_timer(&pDevice->sTimerCommand);
+
+ pDevice->sTimerCommand.data = (unsigned long)pDevice;
+ pDevice->sTimerCommand.function = (TimerFunction)vRunCommand;
+ pDevice->sTimerCommand.expires = RUN_AT((MSecond * HZ) / 1000);
+
+ add_timer(&pDevice->sTimerCommand);
+
+ return;
}
void vRunCommand(void *hDeviceContext)
@@ -340,6 +342,7 @@ void vRunCommand(void *hDeviceContext)
BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
struct sk_buff *skb;
BYTE byData;
+ union iwreq_data wrqu;
if (pDevice->dwDiagRefCount != 0)
@@ -501,16 +504,11 @@ void vRunCommand(void *hDeviceContext)
pMgmt->eScanState = WMAC_NO_SCANNING;
pDevice->bStopDataPkt = FALSE;
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- if(pMgmt->eScanType == WMAC_SCAN_PASSIVE)
- {
- //send scan event to wpa_Supplicant
- union iwreq_data wrqu;
- PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n");
- memset(&wrqu, 0, sizeof(wrqu));
- wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL);
- }
-#endif
+ /*send scan event to wpa_Supplicant*/
+ PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n");
+ memset(&wrqu, 0, sizeof(wrqu));
+ wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL);
+
s_bCommandComplete(pDevice);
break;
@@ -523,13 +521,11 @@ void vRunCommand(void *hDeviceContext)
return;
} else {
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
pDevice->bwextstep0 = FALSE;
pDevice->bwextstep1 = FALSE;
pDevice->bwextstep2 = FALSE;
pDevice->bwextstep3 = FALSE;
pDevice->bWPASuppWextEnabled = FALSE;
- #endif
pDevice->fWPA_Authened = FALSE;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send Disassociation Packet..\n");
@@ -672,7 +668,6 @@ void vRunCommand(void *hDeviceContext)
}
else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n");
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
// if(pDevice->bWPASuppWextEnabled == TRUE)
{
union iwreq_data wrqu;
@@ -681,7 +676,6 @@ void vRunCommand(void *hDeviceContext)
PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated:vMgrJoinBSSBegin Fail !!)\n");
wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
}
- #endif
}
}
s_bCommandComplete(pDevice);
@@ -924,7 +918,6 @@ void vRunCommand(void *hDeviceContext)
// unlock command busy
pMgmt->eCurrState = WMAC_STATE_IDLE;
pMgmt->sNodeDBTable[0].bActive = FALSE;
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
// if(pDevice->bWPASuppWextEnabled == TRUE)
{
union iwreq_data wrqu;
@@ -933,15 +926,12 @@ void vRunCommand(void *hDeviceContext)
PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
}
- #endif
}
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
pDevice->bwextstep0 = FALSE;
pDevice->bwextstep1 = FALSE;
pDevice->bwextstep2 = FALSE;
pDevice->bwextstep3 = FALSE;
pDevice->bWPASuppWextEnabled = FALSE;
- #endif
//clear current SSID
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
pItemSSID->len = 0;
diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c
index 7db6a8d3508b..95ddc8303bb3 100644
--- a/drivers/staging/vt6656/wmgr.c
+++ b/drivers/staging/vt6656/wmgr.c
@@ -925,7 +925,6 @@ s_vMgrRxAssocResponse(
WLAN_FR_ASSOCRESP sFrame;
PWLAN_IE_SSID pItemSSID;
PBYTE pbyIEs;
- viawget_wpa_header *wpahdr;
@@ -973,32 +972,7 @@ s_vMgrRxAssocResponse(
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Link with AP(SSID): %s\n", pItemSSID->abySSID);
pDevice->bLinkPass = TRUE;
ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER);
- if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
- if(skb_tailroom(pDevice->skb) <(sizeof(viawget_wpa_header)+pMgmt->sAssocInfo.AssocInfo.ResponseIELength+
- pMgmt->sAssocInfo.AssocInfo.RequestIELength)) { //data room not enough
- dev_kfree_skb(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- }
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- wpahdr->type = VIAWGET_ASSOC_MSG;
- wpahdr->resp_ie_len = pMgmt->sAssocInfo.AssocInfo.ResponseIELength;
- wpahdr->req_ie_len = pMgmt->sAssocInfo.AssocInfo.RequestIELength;
- memcpy(pDevice->skb->data + sizeof(viawget_wpa_header), pMgmt->sAssocInfo.abyIEs, wpahdr->req_ie_len);
- memcpy(pDevice->skb->data + sizeof(viawget_wpa_header) + wpahdr->req_ie_len,
- pbyIEs,
- wpahdr->resp_ie_len
- );
- skb_put(pDevice->skb, sizeof(viawget_wpa_header) + wpahdr->resp_ie_len + wpahdr->req_ie_len);
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- }
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//if(pDevice->bWPASuppWextEnabled == TRUE)
{
BYTE buf[512];
@@ -1037,7 +1011,6 @@ s_vMgrRxAssocResponse(
wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
}
-#endif //#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
}
else {
@@ -1053,14 +1026,12 @@ s_vMgrRxAssocResponse(
}
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//need clear flags related to Networkmanager
pDevice->bwextstep0 = FALSE;
pDevice->bwextstep1 = FALSE;
pDevice->bwextstep2 = FALSE;
pDevice->bwextstep3 = FALSE;
pDevice->bWPASuppWextEnabled = FALSE;
-#endif
if(pMgmt->eCurrState == WMAC_STATE_ASSOC)
timer_expire(pDevice->sTimerCommand, 0);
@@ -1587,7 +1558,6 @@ s_vMgrRxDisassociation(
WLAN_FR_DISASSOC sFrame;
unsigned int uNodeIndex = 0;
CMD_STATUS CmdStatus;
- viawget_wpa_header *wpahdr;
if ( pMgmt->eCurrMode == WMAC_MODE_ESS_AP ){
// if is acting an AP..
@@ -1608,20 +1578,6 @@ s_vMgrRxDisassociation(
DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP disassociated me, reason=%d.\n", cpu_to_le16(*(sFrame.pwReason)));
pDevice->fWPA_Authened = FALSE;
- if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- wpahdr->type = VIAWGET_DISASSOC_MSG;
- wpahdr->resp_ie_len = 0;
- wpahdr->req_ie_len = 0;
- skb_put(pDevice->skb, sizeof(viawget_wpa_header));
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- }
//TODO: do something let upper layer know or
//try to send associate packet again because of inactivity timeout
@@ -1638,7 +1594,6 @@ s_vMgrRxDisassociation(
}
}
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
// if(pDevice->bWPASuppWextEnabled == TRUE)
{
union iwreq_data wrqu;
@@ -1647,7 +1602,6 @@ s_vMgrRxDisassociation(
PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n");
wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
}
- #endif
}
/* else, ignore it */
@@ -1676,7 +1630,6 @@ s_vMgrRxDeauthentication(
{
WLAN_FR_DEAUTHEN sFrame;
unsigned int uNodeIndex = 0;
- viawget_wpa_header *wpahdr;
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP ){
@@ -1712,22 +1665,6 @@ s_vMgrRxDeauthentication(
}
}
- if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- wpahdr->type = VIAWGET_DISASSOC_MSG;
- wpahdr->resp_ie_len = 0;
- wpahdr->req_ie_len = 0;
- skb_put(pDevice->skb, sizeof(viawget_wpa_header));
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- }
-
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
// if(pDevice->bWPASuppWextEnabled == TRUE)
{
union iwreq_data wrqu;
@@ -1736,7 +1673,6 @@ s_vMgrRxDeauthentication(
PRINT_K("wireless_send_event--->SIOCGIWAP(disauthen)\n");
wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
}
- #endif
}
/* else, ignore it. TODO: IBSS authentication service
@@ -2645,10 +2581,8 @@ void vMgrJoinBSSBegin(void *hDeviceContext, PCMD_STATUS pStatus)
*/
}
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//if(pDevice->bWPASuppWextEnabled == TRUE)
Encyption_Rebuild(pDevice, pCurr);
-#endif
// Infrastructure BSS
s_vMgrSynchBSS(pDevice,
diff --git a/drivers/staging/vt6656/wmgr.h b/drivers/staging/vt6656/wmgr.h
index 13dfb3bf8328..52b1b562b141 100644
--- a/drivers/staging/vt6656/wmgr.h
+++ b/drivers/staging/vt6656/wmgr.h
@@ -89,44 +89,44 @@ typedef void (*TimerFunction)(unsigned long);
//+++ NDIS related
-typedef unsigned char NDIS_802_11_MAC_ADDRESS[ETH_ALEN];
+typedef u8 NDIS_802_11_MAC_ADDRESS[ETH_ALEN];
typedef struct _NDIS_802_11_AI_REQFI
{
- unsigned short Capabilities;
- unsigned short ListenInterval;
+ u16 Capabilities;
+ u16 ListenInterval;
NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
} NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
typedef struct _NDIS_802_11_AI_RESFI
{
- unsigned short Capabilities;
- unsigned short StatusCode;
- unsigned short AssociationId;
+ u16 Capabilities;
+ u16 StatusCode;
+ u16 AssociationId;
} NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
{
- unsigned long Length;
- unsigned short AvailableRequestFixedIEs;
- NDIS_802_11_AI_REQFI RequestFixedIEs;
- unsigned long RequestIELength;
- unsigned long OffsetRequestIEs;
- unsigned short AvailableResponseFixedIEs;
- NDIS_802_11_AI_RESFI ResponseFixedIEs;
- unsigned long ResponseIELength;
- unsigned long OffsetResponseIEs;
+ u32 Length;
+ u16 AvailableRequestFixedIEs;
+ NDIS_802_11_AI_REQFI RequestFixedIEs;
+ u32 RequestIELength;
+ u32 OffsetRequestIEs;
+ u16 AvailableResponseFixedIEs;
+ NDIS_802_11_AI_RESFI ResponseFixedIEs;
+ u32 ResponseIELength;
+ u32 OffsetResponseIEs;
} NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
typedef struct tagSAssocInfo {
- NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
- BYTE abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN];
- // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION
- unsigned long RequestIELength;
- BYTE abyReqIEs[WLAN_BEACON_FR_MAXLEN];
+ NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
+ u8 abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN];
+ /* store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION */
+ u32 RequestIELength;
+ u8 abyReqIEs[WLAN_BEACON_FR_MAXLEN];
} SAssocInfo, *PSAssocInfo;
-//---
+
diff --git a/drivers/staging/vt6656/wpa2.c b/drivers/staging/vt6656/wpa2.c
index c0926976627d..616e24dcf42b 100644
--- a/drivers/staging/vt6656/wpa2.c
+++ b/drivers/staging/vt6656/wpa2.c
@@ -31,8 +31,8 @@
*
*/
-#include "wpa2.h"
#include "device.h"
+#include "wpa2.h"
/*--------------------- Static Definitions -------------------------*/
static int msglevel =MSG_LEVEL_INFO;
diff --git a/drivers/staging/vt6656/wpa2.h b/drivers/staging/vt6656/wpa2.h
index 46c295905b48..c359252a6b0e 100644
--- a/drivers/staging/vt6656/wpa2.h
+++ b/drivers/staging/vt6656/wpa2.h
@@ -45,8 +45,8 @@ typedef struct tagsPMKIDInfo {
} PMKIDInfo, *PPMKIDInfo;
typedef struct tagSPMKIDCache {
- unsigned long BSSIDInfoCount;
- PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE];
+ u32 BSSIDInfoCount;
+ PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE];
} SPMKIDCache, *PSPMKIDCache;
diff --git a/drivers/staging/vt6656/wpactl.c b/drivers/staging/vt6656/wpactl.c
index 3e65aa132011..cc1d48bced2d 100644
--- a/drivers/staging/vt6656/wpactl.c
+++ b/drivers/staging/vt6656/wpactl.c
@@ -44,13 +44,6 @@
/*--------------------- Static Definitions -------------------------*/
-#define VIAWGET_WPA_MAX_BUF_SIZE 1024
-
-static const int frequency_list[] = {
- 2412, 2417, 2422, 2427, 2432, 2437, 2442,
- 2447, 2452, 2457, 2462, 2467, 2472, 2484
-};
-
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
@@ -59,118 +52,7 @@ static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
-static void wpadev_setup(struct net_device *dev)
-{
- dev->type = ARPHRD_IEEE80211;
- dev->hard_header_len = ETH_HLEN;
- dev->mtu = 2048;
- dev->addr_len = ETH_ALEN;
- dev->tx_queue_len = 1000;
- memset(dev->broadcast, 0xFF, ETH_ALEN);
-
- dev->flags = IFF_BROADCAST | IFF_MULTICAST;
-}
-
-/*
- * Description:
- * register netdev for wpa supplicant daemon
- *
- * Parameters:
- * In:
- * pDevice -
- * enable -
- * Out:
- *
- * Return Value:
- *
- */
-static int wpa_init_wpadev(PSDevice pDevice)
-{
- PSDevice wpadev_priv;
- struct net_device *dev = pDevice->dev;
- int ret = 0;
-
- pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa", wpadev_setup);
- if (pDevice->wpadev == NULL)
- return -ENOMEM;
-
- wpadev_priv = netdev_priv(pDevice->wpadev);
- *wpadev_priv = *pDevice;
- memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, ETH_ALEN);
- pDevice->wpadev->base_addr = dev->base_addr;
- pDevice->wpadev->irq = dev->irq;
- pDevice->wpadev->mem_start = dev->mem_start;
- pDevice->wpadev->mem_end = dev->mem_end;
- ret = register_netdev(pDevice->wpadev);
- if (ret) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdev(WPA) failed!\n",
- dev->name);
- free_netdev(pDevice->wpadev);
- return -1;
- }
-
- if (pDevice->skb == NULL) {
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- if (pDevice->skb == NULL)
- return -ENOMEM;
- }
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdev %s for WPA management\n",
- dev->name, pDevice->wpadev->name);
-
- return 0;
-}
-
-/*
- * Description:
- * unregister net_device (wpadev)
- *
- * Parameters:
- * In:
- * pDevice -
- * Out:
- *
- * Return Value:
- *
- */
-static int wpa_release_wpadev(PSDevice pDevice)
-{
- if (pDevice->skb) {
- dev_kfree_skb(pDevice->skb);
- pDevice->skb = NULL;
- }
-
- if (pDevice->wpadev) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n",
- pDevice->dev->name, pDevice->wpadev->name);
- unregister_netdev(pDevice->wpadev);
- free_netdev(pDevice->wpadev);
- pDevice->wpadev = NULL;
- }
-
- return 0;
-}
-
-/*
- * Description:
- * Set enable/disable dev for wpa supplicant daemon
- *
- * Parameters:
- * In:
- * pDevice -
- * val -
- * Out:
- *
- * Return Value:
- *
- */
-int wpa_set_wpadev(PSDevice pDevice, int val)
-{
- if (val)
- return wpa_init_wpadev(pDevice);
- return wpa_release_wpadev(pDevice);
-}
/*
* Description:
@@ -185,7 +67,7 @@ int wpa_set_wpadev(PSDevice pDevice, int val)
* Return Value:
*
*/
- int wpa_set_keys(PSDevice pDevice, void *ctx, BOOL fcpfkernel)
+int wpa_set_keys(PSDevice pDevice, void *ctx)
{
struct viawget_wpa_param *param = ctx;
PSMgmtObject pMgmt = &pDevice->sMgmtObj;
@@ -217,18 +99,7 @@ int wpa_set_wpadev(PSDevice pDevice, int val)
if (param->u.wpa_key.key && param->u.wpa_key.key_len > sizeof(abyKey))
return -EINVAL;
- spin_unlock_irq(&pDevice->lock);
- if (param->u.wpa_key.key && fcpfkernel) {
- memcpy(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len);
- } else {
- if (param->u.wpa_key.key &&
- copy_from_user(&abyKey[0], param->u.wpa_key.key,
- param->u.wpa_key.key_len)) {
- spin_lock_irq(&pDevice->lock);
- return -EINVAL;
- }
- }
- spin_lock_irq(&pDevice->lock);
+ memcpy(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len);
dwKeyIndex = (DWORD)(param->u.wpa_key.key_index);
@@ -260,18 +131,7 @@ int wpa_set_wpadev(PSDevice pDevice, int val)
if (param->u.wpa_key.seq && param->u.wpa_key.seq_len > sizeof(abySeq))
return -EINVAL;
- spin_unlock_irq(&pDevice->lock);
- if (param->u.wpa_key.seq && fcpfkernel) {
- memcpy(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len);
- } else {
- if (param->u.wpa_key.seq &&
- copy_from_user(&abySeq[0], param->u.wpa_key.seq,
- param->u.wpa_key.seq_len)) {
- spin_lock_irq(&pDevice->lock);
- return -EINVAL;
- }
- }
- spin_lock_irq(&pDevice->lock);
+ memcpy(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len);
if (param->u.wpa_key.seq_len > 0) {
for (ii = 0 ; ii < param->u.wpa_key.seq_len ; ii++) {
@@ -399,521 +259,3 @@ int wpa_set_wpadev(PSDevice pDevice, int val)
}
-/*
- * Description:
- * enable wpa auth & mode
- *
- * Parameters:
- * In:
- * pDevice -
- * param -
- * Out:
- *
- * Return Value:
- *
- */
-static int wpa_set_wpa(PSDevice pDevice, struct viawget_wpa_param *param)
-{
- PSMgmtObject pMgmt = &pDevice->sMgmtObj;
- int ret = 0;
-
- pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
- pMgmt->bShareKeyAlgorithm = FALSE;
-
- return ret;
-}
-
- /*
- * Description:
- * set disassociate
- *
- * Parameters:
- * In:
- * pDevice -
- * param -
- * Out:
- *
- * Return Value:
- *
- */
-static int wpa_set_disassociate(PSDevice pDevice, struct viawget_wpa_param *param)
-{
- PSMgmtObject pMgmt = &pDevice->sMgmtObj;
- int ret = 0;
-
- spin_lock_irq(&pDevice->lock);
- if (pDevice->bLinkPass) {
- if (!memcmp(param->addr, pMgmt->abyCurrBSSID, 6))
- bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
- }
- spin_unlock_irq(&pDevice->lock);
-
- return ret;
-}
-
-/*
- * Description:
- * enable scan process
- *
- * Parameters:
- * In:
- * pDevice -
- * param -
- * Out:
- *
- * Return Value:
- *
- */
-static int wpa_set_scan(PSDevice pDevice, struct viawget_wpa_param *param)
-{
- int ret = 0;
-
-/**set ap_scan=1&&scan_ssid=1 under hidden ssid mode**/
- PSMgmtObject pMgmt = &pDevice->sMgmtObj;
- PWLAN_IE_SSID pItemSSID;
- printk("wpa_set_scan-->desired [ssid=%s,ssid_len=%d]\n",
- param->u.scan_req.ssid,param->u.scan_req.ssid_len);
-// Set the SSID
- memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
- pItemSSID->byElementID = WLAN_EID_SSID;
- memcpy(pItemSSID->abySSID, param->u.scan_req.ssid, param->u.scan_req.ssid_len);
- pItemSSID->len = param->u.scan_req.ssid_len;
-
- spin_lock_irq(&pDevice->lock);
- BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN,
- pMgmt->abyDesireSSID);
- spin_unlock_irq(&pDevice->lock);
-
- return ret;
-}
-
-/*
- * Description:
- * get bssid
- *
- * Parameters:
- * In:
- * pDevice -
- * param -
- * Out:
- *
- * Return Value:
- *
- */
-static int wpa_get_bssid(PSDevice pDevice, struct viawget_wpa_param *param)
-{
- PSMgmtObject pMgmt = &pDevice->sMgmtObj;
- int ret = 0;
- memcpy(param->u.wpa_associate.bssid, pMgmt->abyCurrBSSID, 6);
-
- return ret;
-}
-
-/*
- * Description:
- * get bssid
- *
- * Parameters:
- * In:
- * pDevice -
- * param -
- * Out:
- *
- * Return Value:
- *
- */
-static int wpa_get_ssid(PSDevice pDevice, struct viawget_wpa_param *param)
-{
- PSMgmtObject pMgmt = &pDevice->sMgmtObj;
- PWLAN_IE_SSID pItemSSID;
- int ret = 0;
-
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
-
- memcpy(param->u.wpa_associate.ssid, pItemSSID->abySSID, pItemSSID->len);
- param->u.wpa_associate.ssid_len = pItemSSID->len;
-
- return ret;
-}
-
-/*
- * Description:
- * get scan results
- *
- * Parameters:
- * In:
- * pDevice -
- * param -
- * Out:
- *
- * Return Value:
- *
- */
-static int wpa_get_scan(PSDevice pDevice, struct viawget_wpa_param *param)
-{
- struct viawget_scan_result *scan_buf;
- PSMgmtObject pMgmt = &pDevice->sMgmtObj;
- PWLAN_IE_SSID pItemSSID;
- PKnownBSS pBSS;
- PBYTE pBuf;
- int ret = 0;
- u16 count = 0;
- u16 ii;
- u16 jj;
- long ldBm; //James //add
-
-//******mike:bubble sort by stronger RSSI*****//
- PBYTE ptempBSS;
-
- ptempBSS = kmalloc(sizeof(KnownBSS), GFP_ATOMIC);
-
- if (ptempBSS == NULL) {
- printk("bubble sort kmalloc memory fail@@@\n");
- ret = -ENOMEM;
- return ret;
- }
-
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- for (jj = 0; jj < MAX_BSS_NUM - ii - 1; jj++) {
- if ((pMgmt->sBSSList[jj].bActive != TRUE)
- || ((pMgmt->sBSSList[jj].uRSSI > pMgmt->sBSSList[jj + 1].uRSSI)
- && (pMgmt->sBSSList[jj + 1].bActive != FALSE))) {
- memcpy(ptempBSS,&pMgmt->sBSSList[jj], sizeof(KnownBSS));
- memcpy(&pMgmt->sBSSList[jj], &pMgmt->sBSSList[jj + 1],
- sizeof(KnownBSS));
- memcpy(&pMgmt->sBSSList[jj + 1], ptempBSS, sizeof(KnownBSS));
- }
- }
- }
- kfree(ptempBSS);
-
- count = 0;
- pBSS = &(pMgmt->sBSSList[0]);
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- pBSS = &(pMgmt->sBSSList[ii]);
- if (!pBSS->bActive)
- continue;
- count++;
- }
-
- pBuf = kcalloc(count, sizeof(struct viawget_scan_result), GFP_ATOMIC);
-
- if (pBuf == NULL) {
- ret = -ENOMEM;
- return ret;
- }
- scan_buf = (struct viawget_scan_result *)pBuf;
- pBSS = &(pMgmt->sBSSList[0]);
- for (ii = 0, jj = 0; ii < MAX_BSS_NUM; ii++) {
- pBSS = &(pMgmt->sBSSList[ii]);
- if (pBSS->bActive) {
- if (jj >= count)
- break;
- memcpy(scan_buf->bssid, pBSS->abyBSSID, WLAN_BSSID_LEN);
- pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
- memcpy(scan_buf->ssid, pItemSSID->abySSID, pItemSSID->len);
- scan_buf->ssid_len = pItemSSID->len;
- scan_buf->freq = frequency_list[pBSS->uChannel-1];
- scan_buf->caps = pBSS->wCapInfo; // DavidWang for sharemode
-
- RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm);
- if (-ldBm < 50)
- scan_buf->qual = 100;
- else if (-ldBm > 90)
- scan_buf->qual = 0;
- else
- scan_buf->qual=(40-(-ldBm-50))*100/40;
-
- //James
- //scan_buf->caps = pBSS->wCapInfo;
- //scan_buf->qual =
- scan_buf->noise = 0;
- scan_buf->level = ldBm;
-
- //scan_buf->maxrate =
- if (pBSS->wWPALen != 0) {
- scan_buf->wpa_ie_len = pBSS->wWPALen;
- memcpy(scan_buf->wpa_ie, pBSS->byWPAIE, pBSS->wWPALen);
- }
- if (pBSS->wRSNLen != 0) {
- scan_buf->rsn_ie_len = pBSS->wRSNLen;
- memcpy(scan_buf->rsn_ie, pBSS->byRSNIE, pBSS->wRSNLen);
- }
- scan_buf = (struct viawget_scan_result *)((PBYTE)scan_buf + sizeof(struct viawget_scan_result));
- jj ++;
- }
- }
-
- if (jj < count)
- count = jj;
-
- if (copy_to_user(param->u.scan_results.buf, pBuf, sizeof(struct viawget_scan_result) * count))
- ret = -EFAULT;
-
- param->u.scan_results.scan_count = count;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " param->u.scan_results.scan_count = %d\n", count);
-
- kfree(pBuf);
- return ret;
-}
-
-/*
- * Description:
- * set associate with AP
- *
- * Parameters:
- * In:
- * pDevice -
- * param -
- * Out:
- *
- * Return Value:
- *
- */
-static int wpa_set_associate(PSDevice pDevice, struct viawget_wpa_param *param)
-{
- PSMgmtObject pMgmt = &pDevice->sMgmtObj;
- PWLAN_IE_SSID pItemSSID;
- BYTE abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- BYTE abyWPAIE[64];
- int ret = 0;
- BOOL bwepEnabled=FALSE;
-
- // set key type & algorithm
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise_suite = %d\n", param->u.wpa_associate.pairwise_suite);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group_suite = %d\n", param->u.wpa_associate.group_suite);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key_mgmt_suite = %d\n", param->u.wpa_associate.key_mgmt_suite);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "auth_alg = %d\n", param->u.wpa_associate.auth_alg);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n", param->u.wpa_associate.mode);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Roaming dBm = %d\n", param->u.wpa_associate.roam_dbm); // Davidwang
-
- if (param->u.wpa_associate.wpa_ie) {
- if (param->u.wpa_associate.wpa_ie_len > sizeof(abyWPAIE))
- return -EINVAL;
-
- if (copy_from_user(&abyWPAIE[0], param->u.wpa_associate.wpa_ie,
- param->u.wpa_associate.wpa_ie_len))
- return -EFAULT;
- }
-
- if (param->u.wpa_associate.mode == 1)
- pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
- else
- pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
-
- // set bssid
- if (memcmp(param->u.wpa_associate.bssid, &abyNullAddr[0], 6) != 0)
- memcpy(pMgmt->abyDesireBSSID, param->u.wpa_associate.bssid, 6);
- // set ssid
- memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
- pItemSSID->byElementID = WLAN_EID_SSID;
- pItemSSID->len = param->u.wpa_associate.ssid_len;
- memcpy(pItemSSID->abySSID, param->u.wpa_associate.ssid, pItemSSID->len);
-
- if (param->u.wpa_associate.wpa_ie_len == 0) {
- if (param->u.wpa_associate.auth_alg & AUTH_ALG_SHARED_KEY)
- pMgmt->eAuthenMode = WMAC_AUTH_SHAREKEY;
- else
- pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
- } else if (abyWPAIE[0] == RSN_INFO_ELEM) {
- if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_PSK)
- pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK;
- else
- pMgmt->eAuthenMode = WMAC_AUTH_WPA2;
- } else {
- if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_WPA_NONE)
- pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
- else if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_PSK)
- pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK;
- else
- pMgmt->eAuthenMode = WMAC_AUTH_WPA;
- }
-
- switch (param->u.wpa_associate.pairwise_suite) {
- case CIPHER_CCMP:
- pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
- break;
- case CIPHER_TKIP:
- pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
- break;
- case CIPHER_WEP40:
- case CIPHER_WEP104:
- pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- bwepEnabled = TRUE;
- break;
- case CIPHER_NONE:
- if (param->u.wpa_associate.group_suite == CIPHER_CCMP)
- pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
- else
- pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
- break;
- default:
- pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
- }
-
- pMgmt->Roam_dbm = param->u.wpa_associate.roam_dbm;
- if (pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) { // @wep-sharekey
- pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- pMgmt->bShareKeyAlgorithm = TRUE;
- } else if (pMgmt->eAuthenMode == WMAC_AUTH_OPEN) {
- if(bwepEnabled==TRUE) { //@open-wep
- pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- } else {
- // @only open
- pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
- }
- }
- // mike save old encryption status
- pDevice->eOldEncryptionStatus = pDevice->eEncryptionStatus;
-
- if (pDevice->eEncryptionStatus != Ndis802_11EncryptionDisabled)
- pDevice->bEncryptionEnable = TRUE;
- else
- pDevice->bEncryptionEnable = FALSE;
-
- if ((pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) ||
- ((pMgmt->eAuthenMode == WMAC_AUTH_OPEN) && (bwepEnabled==TRUE))) {
- // mike re-comment:open-wep && sharekey-wep needn't do initial key!!
- } else {
- KeyvInitTable(pDevice,&pDevice->sKey);
- }
-
- spin_lock_irq(&pDevice->lock);
- pDevice->bLinkPass = FALSE;
- ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW);
- memset(pMgmt->abyCurrBSSID, 0, 6);
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- netif_stop_queue(pDevice->dev);
-
-/******* search if ap_scan=2, which is associating request in hidden ssid mode ****/
- {
- PKnownBSS pCurr = NULL;
- pCurr = BSSpSearchBSSList(pDevice,
- pMgmt->abyDesireBSSID,
- pMgmt->abyDesireSSID,
- pDevice->eConfigPHYMode
- );
-
- if (pCurr == NULL){
- printk("wpa_set_associate---->hidden mode site survey before associate.......\n");
- bScheduleCommand((void *)pDevice,
- WLAN_CMD_BSSID_SCAN,
- pMgmt->abyDesireSSID);
- }
- }
-/****************************************************************/
-
- bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL);
- spin_unlock_irq(&pDevice->lock);
-
- return ret;
-}
-
-/*
- * Description:
- * wpa_ioctl main function supported for wpa supplicant
- *
- * Parameters:
- * In:
- * pDevice -
- * iw_point -
- * Out:
- *
- * Return Value:
- *
- */
-int wpa_ioctl(PSDevice pDevice, struct iw_point *p)
-{
- struct viawget_wpa_param *param;
- int ret = 0;
- int wpa_ioctl = 0;
-
- if (p->length < sizeof(struct viawget_wpa_param) ||
- p->length > VIAWGET_WPA_MAX_BUF_SIZE || !p->pointer)
- return -EINVAL;
-
- param = kmalloc((int)p->length, GFP_KERNEL);
- if (param == NULL)
- return -ENOMEM;
-
- if (copy_from_user(param, p->pointer, p->length)) {
- ret = -EFAULT;
- goto out;
- }
-
- switch (param->cmd) {
- case VIAWGET_SET_WPA:
- ret = wpa_set_wpa(pDevice, param);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_WPA \n");
- break;
-
- case VIAWGET_SET_KEY:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_KEY \n");
- spin_lock_irq(&pDevice->lock);
- ret = wpa_set_keys(pDevice, param, FALSE);
- spin_unlock_irq(&pDevice->lock);
- break;
-
- case VIAWGET_SET_SCAN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_SCAN \n");
- ret = wpa_set_scan(pDevice, param);
- break;
-
- case VIAWGET_GET_SCAN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SCAN\n");
- ret = wpa_get_scan(pDevice, param);
- wpa_ioctl = 1;
- break;
-
- case VIAWGET_GET_SSID:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SSID \n");
- ret = wpa_get_ssid(pDevice, param);
- wpa_ioctl = 1;
- break;
-
- case VIAWGET_GET_BSSID:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_BSSID \n");
- ret = wpa_get_bssid(pDevice, param);
- wpa_ioctl = 1;
- break;
-
- case VIAWGET_SET_ASSOCIATE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_ASSOCIATE \n");
- ret = wpa_set_associate(pDevice, param);
- break;
-
- case VIAWGET_SET_DISASSOCIATE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DISASSOCIATE \n");
- ret = wpa_set_disassociate(pDevice, param);
- break;
-
- case VIAWGET_SET_DROP_UNENCRYPT:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DROP_UNENCRYPT \n");
- break;
-
- case VIAWGET_SET_DEAUTHENTICATE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DEAUTHENTICATE \n");
- break;
-
- default:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ioctl: unknown cmd=%d\n",
- param->cmd);
- kfree(param);
- return -EOPNOTSUPP;
- }
-
- if ((ret == 0) && wpa_ioctl) {
- if (copy_to_user(p->pointer, param, p->length)) {
- ret = -EFAULT;
- goto out;
- }
- }
-
-out:
- kfree(param);
- return ret;
-}
diff --git a/drivers/staging/vt6656/wpactl.h b/drivers/staging/vt6656/wpactl.h
index 00c8451ab50b..b4ec6b0e1c67 100644
--- a/drivers/staging/vt6656/wpactl.h
+++ b/drivers/staging/vt6656/wpactl.h
@@ -30,9 +30,7 @@
#define __WPACTL_H__
#include "device.h"
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
#include "iowpa.h"
-#endif
/*--------------------- Export Definitions -------------------------*/
@@ -40,17 +38,11 @@
//WPA related
typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg;
-typedef enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP,
- CIPHER_WEP104 } wpa_cipher;
-typedef enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE,
- KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE, KEY_MGMT_CCKM } wpa_key_mgmt;//20080717-02,<Modify> by James Li
#define AUTH_ALG_OPEN_SYSTEM 0x01
#define AUTH_ALG_SHARED_KEY 0x02
#define AUTH_ALG_LEAP 0x04
-#define GENERIC_INFO_ELEM 0xdd
-#define RSN_INFO_ELEM 0x30
typedef unsigned long long NDIS_802_11_KEY_RSC;
@@ -60,8 +52,6 @@ typedef unsigned long long NDIS_802_11_KEY_RSC;
/*--------------------- Export Functions --------------------------*/
-int wpa_set_wpadev(PSDevice pDevice, int val);
-int wpa_ioctl(PSDevice pDevice, struct iw_point *p);
-int wpa_set_keys(PSDevice pDevice, void *ctx, BOOL fcpfkernel);
+int wpa_set_keys(PSDevice pDevice, void *ctx);
#endif /* __WPACL_H__ */