summaryrefslogtreecommitdiffstats
path: root/drivers/staging/vt6656
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/vt6656')
-rw-r--r--drivers/staging/vt6656/80211hdr.h2
-rw-r--r--drivers/staging/vt6656/bssdb.c9
-rw-r--r--drivers/staging/vt6656/bssdb.h2
-rw-r--r--drivers/staging/vt6656/card.c1
-rw-r--r--drivers/staging/vt6656/card.h1
-rw-r--r--drivers/staging/vt6656/channel.c2
-rw-r--r--drivers/staging/vt6656/desc.h19
-rw-r--r--drivers/staging/vt6656/device.h4
-rw-r--r--drivers/staging/vt6656/hostap.c63
-rw-r--r--drivers/staging/vt6656/int.c43
-rw-r--r--drivers/staging/vt6656/int.h43
-rw-r--r--drivers/staging/vt6656/iwctl.c2050
-rw-r--r--drivers/staging/vt6656/iwctl.h262
-rw-r--r--drivers/staging/vt6656/main_usb.c40
-rw-r--r--drivers/staging/vt6656/mib.h1
-rw-r--r--drivers/staging/vt6656/rxtx.c2
-rw-r--r--drivers/staging/vt6656/tether.h2
-rw-r--r--drivers/staging/vt6656/usbpipe.c3
-rw-r--r--drivers/staging/vt6656/wcmd.c85
19 files changed, 1129 insertions, 1505 deletions
diff --git a/drivers/staging/vt6656/80211hdr.h b/drivers/staging/vt6656/80211hdr.h
index 15c6ef1a635c..b87d5434077a 100644
--- a/drivers/staging/vt6656/80211hdr.h
+++ b/drivers/staging/vt6656/80211hdr.h
@@ -78,7 +78,6 @@
#define WLAN_HDR_ADDR4_LEN 30
#define WLAN_IEHDR_LEN 2
#define WLAN_SSID_MAXLEN 32
-/* #define WLAN_RATES_MAXLEN 255 */
#define WLAN_RATES_MAXLEN 16
#define WLAN_RATES_MAXLEN_11B 4
#define WLAN_RSN_MAXLEN 32
@@ -104,7 +103,6 @@
#define WLAN_WEP40_KEYLEN 5
#define WLAN_WEP104_KEYLEN 13
#define WLAN_WEP232_KEYLEN 29
-/* #define WLAN_WEPMAX_KEYLEN 29 */
#define WLAN_WEPMAX_KEYLEN 32
#define WLAN_CHALLENGE_IE_MAXLEN 255
#define WLAN_CHALLENGE_IE_LEN 130
diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c
index 619c257e8773..099936771e69 100644
--- a/drivers/staging/vt6656/bssdb.c
+++ b/drivers/staging/vt6656/bssdb.c
@@ -129,9 +129,8 @@ PKnownBSS BSSpSearchBSSList(void *hDeviceContext,
unsigned int ii = 0;
unsigned int jj = 0;
if (pbyDesireBSSID != NULL) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSpSearchBSSList BSSID[%02X %02X %02X-%02X %02X %02X]\n",
- *pbyDesireBSSID,*(pbyDesireBSSID+1),*(pbyDesireBSSID+2),
- *(pbyDesireBSSID+3),*(pbyDesireBSSID+4),*(pbyDesireBSSID+5));
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID);
if ((!is_broadcast_ether_addr(pbyDesireBSSID)) &&
(memcmp(pbyDesireBSSID, ZeroBSSID, 6)!= 0)){
pbyBSSID = pbyDesireBSSID;
@@ -218,7 +217,9 @@ PKnownBSS BSSpSearchBSSList(void *hDeviceContext,
}
pMgmt->pSameBSS[jj].uChannel = pCurrBSS->uChannel;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSpSearchBSSList pSelect1[%02X %02X %02X-%02X %02X %02X]\n",*pCurrBSS->abyBSSID,*(pCurrBSS->abyBSSID+1),*(pCurrBSS->abyBSSID+2),*(pCurrBSS->abyBSSID+3),*(pCurrBSS->abyBSSID+4),*(pCurrBSS->abyBSSID+5));
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "BSSpSearchBSSList pSelect1[%pM]\n",
+ pCurrBSS->abyBSSID);
jj++;
diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h
index a8f97ebb659b..6b2ec390e775 100644
--- a/drivers/staging/vt6656/bssdb.h
+++ b/drivers/staging/vt6656/bssdb.h
@@ -64,8 +64,6 @@
// send and receive non-IEEE 802.1X frames
#define WLAN_STA_AUTHORIZED BIT5
-//#define MAX_RATE 12
-
#define MAX_WPA_IE_LEN 64
diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index 9d09e9fd8e18..e3ddc0b55317 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -66,7 +66,6 @@ static int msglevel =MSG_LEVEL_INFO;
/*--------------------- Static Definitions -------------------------*/
-#define CB_TXPOWER_LEVEL 6
/*--------------------- Static Classes ----------------------------*/
diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h
index 9cf71a3d8801..55962b198831 100644
--- a/drivers/staging/vt6656/card.h
+++ b/drivers/staging/vt6656/card.h
@@ -52,7 +52,6 @@ typedef enum _CARD_OP_MODE {
} CARD_OP_MODE, *PCARD_OP_MODE;
#define CB_MAX_CHANNEL_24G 14
-/* #define CB_MAX_CHANNEL_5G 24 */
#define CB_MAX_CHANNEL_5G 42 /* add channel9(5045MHz), 41==>42 */
#define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G)
diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c
index 99e054d2d601..650217607858 100644
--- a/drivers/staging/vt6656/channel.c
+++ b/drivers/staging/vt6656/channel.c
@@ -368,8 +368,6 @@ static struct
/* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 */
};
-#define NUM_RULES ARRAY_SIZE(ChannelRuleTab)
-
/*--------------------- Export function -------------------------*/
/************************************************************************
* Country Channel Valid
diff --git a/drivers/staging/vt6656/desc.h b/drivers/staging/vt6656/desc.h
index 767112b3c4a9..b68b2ec96eaa 100644
--- a/drivers/staging/vt6656/desc.h
+++ b/drivers/staging/vt6656/desc.h
@@ -36,8 +36,6 @@
#include "ttype.h"
#include "tether.h"
-/*--------------------- Export Definitions -------------------------*/
-
// max transmit or receive buffer size
#define CB_MAX_BUF_SIZE 2900U // max buffer size
// NOTE: must be multiple of 4
@@ -120,17 +118,11 @@
#define FRAGCTL_TKIP 0x0200 // 0000 0010 0000 0000
#define FRAGCTL_LEGACY 0x0100 // 0000 0001 0000 0000
#define FRAGCTL_NONENCRYPT 0x0000 // 0000 0000 0000 0000
-//#define FRAGCTL_AC3 0x000C // 0000 0000 0000 1100
-//#define FRAGCTL_AC2 0x0008 // 0000 0000 0000 1000
-//#define FRAGCTL_AC1 0x0004 // 0000 0000 0000 0100
-//#define FRAGCTL_AC0 0x0000 // 0000 0000 0000 0000
#define FRAGCTL_ENDFRAG 0x0003 // 0000 0000 0000 0011
#define FRAGCTL_MIDFRAG 0x0002 // 0000 0000 0000 0010
#define FRAGCTL_STAFRAG 0x0001 // 0000 0000 0000 0001
#define FRAGCTL_NONFRAG 0x0000 // 0000 0000 0000 0000
-//#define TYPE_AC0DMA 0
-//#define TYPE_TXDMA0 1
#define TYPE_TXDMA0 0
#define TYPE_AC0DMA 1
#define TYPE_ATIMDMA 2
@@ -147,9 +139,6 @@
#define TD_FLAGS_NETIF_SKB 0x01 // check if need release skb
#define TD_FLAGS_PRIV_SKB 0x02 // check if called from private skb(hostap)
#define TD_FLAGS_PS_RETRY 0x04 // check if PS STA frame re-transmit
-//#define TD_FLAGS_NETIF_SKB 0x04
-
-/*--------------------- Export Types ------------------------------*/
//
// RsvTime buffer header
@@ -268,7 +257,6 @@ SRTS_a_FB, *PSRTS_a_FB;
typedef const SRTS_a_FB *PCSRTS_a_FB;
-
//
// CTS buffer header
//
@@ -421,12 +409,5 @@ typedef struct tagSKeyEntry {
DWORD dwKey4[4];
} __attribute__ ((__packed__))
SKeyEntry;
-/*--------------------- Export Macros ------------------------------*/
-
-/*--------------------- Export Classes ----------------------------*/
-
-/*--------------------- Export Variables --------------------------*/
-
-/*--------------------- Export Functions --------------------------*/
#endif /* __DESC_H__ */
diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index f1496ec5dc72..171dd68cf5b2 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -106,10 +106,6 @@
#define MAX_MULTICAST_ADDRESS_NUM 32
#define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN)
-//#define OP_MODE_INFRASTRUCTURE 0
-//#define OP_MODE_ADHOC 1
-//#define OP_MODE_AP 2
-
#define DUPLICATE_RX_CACHE_LENGTH 5
#define NUM_KEY_ENTRY 11
diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c
index 51b5adf36577..682002a5b8d7 100644
--- a/drivers/staging/vt6656/hostap.c
+++ b/drivers/staging/vt6656/hostap.c
@@ -41,31 +41,11 @@
#define VIAWGET_HOSTAPD_MAX_BUF_SIZE 1024
#define HOSTAP_CRYPT_FLAG_SET_TX_KEY BIT0
-#define HOSTAP_CRYPT_FLAG_PERMANENT BIT1
-#define HOSTAP_CRYPT_ERR_UNKNOWN_ALG 2
#define HOSTAP_CRYPT_ERR_UNKNOWN_ADDR 3
-#define HOSTAP_CRYPT_ERR_CRYPT_INIT_FAILED 4
#define HOSTAP_CRYPT_ERR_KEY_SET_FAILED 5
-#define HOSTAP_CRYPT_ERR_TX_KEY_SET_FAILED 6
-#define HOSTAP_CRYPT_ERR_CARD_CONF_FAILED 7
-
-/*--------------------- Static Definitions -------------------------*/
-
-/*--------------------- Static Classes ----------------------------*/
-
-/*--------------------- Static Variables --------------------------*/
-//static int msglevel =MSG_LEVEL_DEBUG;
static int msglevel =MSG_LEVEL_INFO;
-/*--------------------- Static Functions --------------------------*/
-
-
-
-
-/*--------------------- Export Variables --------------------------*/
-
-
/*
* Description:
* register net_device (AP) for hostap deamon
@@ -314,37 +294,6 @@ static int hostap_get_info_sta(PSDevice pDevice,
return 0;
}
-/*
- * Description:
- * reset txexec
- *
- * Parameters:
- * In:
- * pDevice -
- * param -
- * Out:
- * TURE, FALSE
- *
- * Return Value:
- *
- */
-/*
-static int hostap_reset_txexc_sta(PSDevice pDevice,
- struct viawget_hostapd_param *param)
-{
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- unsigned int uNodeIndex;
-
- if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) {
- pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts = 0;
- }
- else {
- return -ENOENT;
- }
-
- return 0;
-}
-*/
/*
* Description:
@@ -479,12 +428,6 @@ static int hostap_set_encryption(PSDevice pDevice,
param->u.crypt.err = 0;
-/*
- if (param_len !=
- (int) ((char *) param->u.crypt.key - (char *) param) +
- param->u.crypt.key_len)
- return -EINVAL;
-*/
if (param->u.crypt.alg > WPA_ALG_CCMP)
return -EINVAL;
@@ -814,12 +757,6 @@ int vt6656_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
ret = hostap_get_info_sta(pDevice, param);
ap_ioctl = 1;
break;
-/*
- case VIAWGET_HOSTAPD_RESET_TXEXC_STA:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_RESET_TXEXC_STA \n");
- ret = hostap_reset_txexc_sta(pDevice, param);
- break;
-*/
case VIAWGET_HOSTAPD_SET_FLAGS_STA:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_FLAGS_STA \n");
ret = hostap_set_flags_sta(pDevice, param);
diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c
index 0a114231145f..eba4b5061cf7 100644
--- a/drivers/staging/vt6656/int.c
+++ b/drivers/staging/vt6656/int.c
@@ -41,9 +41,7 @@
#include "usbpipe.h"
/*--------------------- Static Definitions -------------------------*/
-/* static int msglevel = MSG_LEVEL_DEBUG; */
-static int msglevel = MSG_LEVEL_INFO;
-
+static int msglevel = MSG_LEVEL_INFO; /* MSG_LEVEL_DEBUG */
/*--------------------- Static Classes ----------------------------*/
@@ -53,10 +51,8 @@ static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Export Variables --------------------------*/
-
/*--------------------- Export Functions --------------------------*/
-
/*+
*
* Function: InterruptPollingThread
@@ -81,7 +77,7 @@ static int msglevel = MSG_LEVEL_INFO;
-*/
void INTvWorkItem(void *Context)
{
- PSDevice pDevice = (PSDevice) Context;
+ PSDevice pDevice = Context;
int ntStatus;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Interrupt Polling Thread\n");
@@ -94,8 +90,8 @@ void INTvWorkItem(void *Context)
void INTnsProcessData(PSDevice pDevice)
{
- PSINTData pINTData;
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSINTData pINTData;
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct net_device_stats *pStats = &pDevice->stats;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsInterruptProcessData\n");
@@ -103,8 +99,8 @@ void INTnsProcessData(PSDevice pDevice)
pINTData = (PSINTData) pDevice->intBuf.pDataBuf;
if (pINTData->byTSR0 & TSR_VALID) {
STAvUpdateTDStatCounter(&(pDevice->scStatistic),
- (BYTE) (pINTData->byPkt0 & 0x0F),
- (BYTE) (pINTData->byPkt0>>4),
+ (BYTE)(pINTData->byPkt0 & 0x0F),
+ (BYTE)(pINTData->byPkt0>>4),
pINTData->byTSR0);
BSSvUpdateNodeTxCounter(pDevice,
&(pDevice->scStatistic),
@@ -114,8 +110,8 @@ void INTnsProcessData(PSDevice pDevice)
}
if (pINTData->byTSR1 & TSR_VALID) {
STAvUpdateTDStatCounter(&(pDevice->scStatistic),
- (BYTE) (pINTData->byPkt1 & 0x0F),
- (BYTE) (pINTData->byPkt1>>4),
+ (BYTE)(pINTData->byPkt1 & 0x0F),
+ (BYTE)(pINTData->byPkt1>>4),
pINTData->byTSR1);
BSSvUpdateNodeTxCounter(pDevice,
&(pDevice->scStatistic),
@@ -125,8 +121,8 @@ void INTnsProcessData(PSDevice pDevice)
}
if (pINTData->byTSR2 & TSR_VALID) {
STAvUpdateTDStatCounter(&(pDevice->scStatistic),
- (BYTE) (pINTData->byPkt2 & 0x0F),
- (BYTE) (pINTData->byPkt2>>4),
+ (BYTE)(pINTData->byPkt2 & 0x0F),
+ (BYTE)(pINTData->byPkt2>>4),
pINTData->byTSR2);
BSSvUpdateNodeTxCounter(pDevice,
&(pDevice->scStatistic),
@@ -136,8 +132,8 @@ void INTnsProcessData(PSDevice pDevice)
}
if (pINTData->byTSR3 & TSR_VALID) {
STAvUpdateTDStatCounter(&(pDevice->scStatistic),
- (BYTE) (pINTData->byPkt3 & 0x0F),
- (BYTE) (pINTData->byPkt3>>4),
+ (BYTE)(pINTData->byPkt3 & 0x0F),
+ (BYTE)(pINTData->byPkt3>>4),
pINTData->byTSR3);
BSSvUpdateNodeTxCounter(pDevice,
&(pDevice->scStatistic),
@@ -186,11 +182,11 @@ void INTnsProcessData(PSDevice pDevice)
LODWORD(pDevice->qwCurrTSF) = pINTData->dwLoTSF;
HIDWORD(pDevice->qwCurrTSF) = pINTData->dwHiTSF;
/*DBG_PRN_GRP01(("ISR0 = %02x ,
- LoTsf = %08x,
- HiTsf = %08x\n",
- pINTData->byISR0,
- pINTData->dwLoTSF,
- pINTData->dwHiTSF)); */
+ LoTsf = %08x,
+ HiTsf = %08x\n",
+ pINTData->byISR0,
+ pINTData->dwLoTSF,
+ pINTData->dwHiTSF)); */
STAvUpdate802_11Counter(&pDevice->s802_11Counter,
&pDevice->scStatistic,
@@ -202,7 +198,6 @@ void INTnsProcessData(PSDevice pDevice)
pINTData->byISR0,
pINTData->byISR1);
}
-
if (pINTData->byISR1 != 0)
if (pINTData->byISR1 & ISR_GPIO3)
bScheduleCommand((void *) pDevice,
@@ -213,8 +208,8 @@ void INTnsProcessData(PSDevice pDevice)
pStats->tx_packets = pDevice->scStatistic.ullTsrOK;
pStats->tx_bytes = pDevice->scStatistic.ullTxDirectedBytes +
- pDevice->scStatistic.ullTxMulticastBytes +
- pDevice->scStatistic.ullTxBroadcastBytes;
+ pDevice->scStatistic.ullTxMulticastBytes +
+ pDevice->scStatistic.ullTxBroadcastBytes;
pStats->tx_errors = pDevice->scStatistic.dwTsrErr;
pStats->tx_dropped = pDevice->scStatistic.dwTsrErr;
}
diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h
index a5d96b968176..3734e2c953d9 100644
--- a/drivers/staging/vt6656/int.h
+++ b/drivers/staging/vt6656/int.h
@@ -36,31 +36,30 @@
/*--------------------- Export Definitions -------------------------*/
#pragma pack(1)
typedef struct tagSINTData {
- BYTE byTSR0;
- BYTE byPkt0;
- WORD wTime0;
- BYTE byTSR1;
- BYTE byPkt1;
- WORD wTime1;
- BYTE byTSR2;
- BYTE byPkt2;
- WORD wTime2;
- BYTE byTSR3;
- BYTE byPkt3;
- WORD wTime3;
- DWORD dwLoTSF;
- DWORD dwHiTSF;
- BYTE byISR0;
- BYTE byISR1;
- BYTE byRTSSuccess;
- BYTE byRTSFail;
- BYTE byACKFail;
- BYTE byFCSErr;
- BYTE abySW[2];
+ BYTE byTSR0;
+ BYTE byPkt0;
+ WORD wTime0;
+ BYTE byTSR1;
+ BYTE byPkt1;
+ WORD wTime1;
+ BYTE byTSR2;
+ BYTE byPkt2;
+ WORD wTime2;
+ BYTE byTSR3;
+ BYTE byPkt3;
+ WORD wTime3;
+ DWORD dwLoTSF;
+ DWORD dwHiTSF;
+ BYTE byISR0;
+ BYTE byISR1;
+ BYTE byRTSSuccess;
+ BYTE byRTSFail;
+ BYTE byACKFail;
+ BYTE byFCSErr;
+ BYTE abySW[2];
} __attribute__ ((__packed__))
SINTData, *PSINTData;
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c
index b24e5314a6af..8b9894b1146a 100644
--- a/drivers/staging/vt6656/iwctl.c
+++ b/drivers/staging/vt6656/iwctl.c
@@ -47,20 +47,20 @@
#include <net/iw_handler.h>
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
-#define SUPPORTED_WIRELESS_EXT 18
+#define SUPPORTED_WIRELESS_EXT 18
#else
-#define SUPPORTED_WIRELESS_EXT 17
+#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,
- 4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980,
- 5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240,
- 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680,
- 5700, 5745, 5765, 5785, 5805, 5825
- };
+ 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484,
+ 4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980,
+ 5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240,
+ 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680,
+ 5700, 5745, 5765, 5785, 5805, 5825
+};
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
{
@@ -68,9 +68,9 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
long ldBm;
pDevice->wstats.status = pDevice->eOPMode;
- if(pDevice->scStatistic.LinkQuality > 100)
- pDevice->scStatistic.LinkQuality = 100;
- pDevice->wstats.qual.qual =(BYTE) pDevice->scStatistic.LinkQuality;
+ if (pDevice->scStatistic.LinkQuality > 100)
+ pDevice->scStatistic.LinkQuality = 100;
+ pDevice->wstats.qual.qual =(BYTE)pDevice->scStatistic.LinkQuality;
RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm);
pDevice->wstats.qual.level = ldBm;
pDevice->wstats.qual.noise = 0;
@@ -81,93 +81,84 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
pDevice->wstats.discard.retries = pDevice->scStatistic.dwTsrErr;
pDevice->wstats.discard.misc = 0;
pDevice->wstats.miss.beacon = 0;
-
return &pDevice->wstats;
}
/*
- * Wireless Handler : get protocol name
+ * Wireless Handler: get protocol name
*/
-
-int iwctl_giwname(struct net_device *dev,
- struct iw_request_info *info,
- char *wrq,
- char *extra)
+int iwctl_giwname(struct net_device *dev, struct iw_request_info *info,
+ char *wrq, char *extra)
{
strcpy(wrq, "802.11-a/b/g");
return 0;
}
/*
- * Wireless Handler : set scan
+ * Wireless Handler: set scan
*/
-
-int iwctl_siwscan(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- struct iw_scan_req *req = (struct iw_scan_req *)extra;
- BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
- PWLAN_IE_SSID pItemSSID=NULL;
-
- if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
- return -EINVAL;
-
- PRINT_K(" SIOCSIWSCAN \n");
-
-if (pMgmt->eScanState == WMAC_IS_SCANNING) {
- // In scanning..
- PRINT_K("SIOCSIWSCAN(overlap??)-->In scanning...\n");
- return -EAGAIN;
- }
-
-if(pDevice->byReAssocCount > 0) { //reject scan when re-associating!
-//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);
- return 0;
-}
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ struct iw_scan_req *req = (struct iw_scan_req *)extra;
+ BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
+ PWLAN_IE_SSID pItemSSID = NULL;
+
+ if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
+ return -EINVAL;
+
+ PRINT_K(" SIOCSIWSCAN \n");
+
+ if (pMgmt->eScanState == WMAC_IS_SCANNING) {
+ // In scanning..
+ PRINT_K("SIOCSIWSCAN(overlap??)-->In scanning...\n");
+ return -EAGAIN;
+ }
+
+ if (pDevice->byReAssocCount > 0) { // reject scan when re-associating!
+ // 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);
+ return 0;
+ }
spin_lock_irq(&pDevice->lock);
- BSSvClearBSSList((void *) pDevice, pDevice->bLinkPass);
-
-//mike add: active scan OR passive scan OR desire_ssid scan
- if(wrq->length == sizeof(struct iw_scan_req)) {
- if (wrq->flags & IW_SCAN_THIS_ESSID) { //desire_ssid scan
- memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- 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(req->essid_len>0)
- pItemSSID->len = req->essid_len - 1;
- }
- else
- pItemSSID->len = req->essid_len;
- pMgmt->eScanType = WMAC_SCAN_PASSIVE;
- PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID)abyScanSSID)->abySSID,
- ((PWLAN_IE_SSID)abyScanSSID)->len);
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID);
- spin_unlock_irq(&pDevice->lock);
+ BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
+
+ // mike add: active scan OR passive scan OR desire_ssid scan
+ if (wrq->length == sizeof(struct iw_scan_req)) {
+ if (wrq->flags & IW_SCAN_THIS_ESSID) { // desire_ssid scan
+ memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
+ 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 (req->essid_len > 0)
+ pItemSSID->len = req->essid_len - 1;
+ } else {
+ pItemSSID->len = req->essid_len;
+ }
+ pMgmt->eScanType = WMAC_SCAN_PASSIVE;
+ PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n", ((PWLAN_IE_SSID)abyScanSSID)->abySSID,
+ ((PWLAN_IE_SSID)abyScanSSID)->len);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID);
+ spin_unlock_irq(&pDevice->lock);
+
+ return 0;
+ } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { // passive scan
+ pMgmt->eScanType = WMAC_SCAN_PASSIVE;
+ }
+ } else { // active scan
+ pMgmt->eScanType = WMAC_SCAN_ACTIVE;
+ }
- return 0;
- }
- else if(req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan
- pMgmt->eScanType = WMAC_SCAN_PASSIVE;
- }
- }
- else { //active scan
- pMgmt->eScanType = WMAC_SCAN_ACTIVE;
- }
-
- pMgmt->eScanType = WMAC_SCAN_PASSIVE;
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
+ pMgmt->eScanType = WMAC_SCAN_PASSIVE;
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);
spin_unlock_irq(&pDevice->lock);
return 0;
@@ -176,18 +167,18 @@ if(pDevice->byReAssocCount > 0) { //reject scan when re-associating!
/*
* Wireless Handler : get scan results
*/
-
-int iwctl_giwscan(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
- int ii, jj, kk;
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- PKnownBSS pBSS;
- PWLAN_IE_SSID pItemSSID;
- PWLAN_IE_SUPP_RATES pSuppRates, pExtSuppRates;
+ int ii;
+ int jj;
+ int kk;
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PKnownBSS pBSS;
+ PWLAN_IE_SSID pItemSSID;
+ PWLAN_IE_SUPP_RATES pSuppRates;
+ PWLAN_IE_SUPP_RATES pExtSuppRates;
char *current_ev = extra;
char *end_buf = extra + IW_SCAN_MAX_DATA;
char *current_val = NULL;
@@ -195,194 +186,179 @@ int iwctl_giwscan(struct net_device *dev,
long ldBm;
char buf[MAX_WPA_IE_LEN * 2 + 30];
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN\n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN\n");
- if (pMgmt->eScanState == WMAC_IS_SCANNING) {
- // In scanning..
+ if (pMgmt->eScanState == WMAC_IS_SCANNING) {
+ // In scanning..
return -EAGAIN;
}
pBSS = &(pMgmt->sBSSList[0]);
- for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) {
+ for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) {
if (current_ev >= end_buf)
break;
- pBSS = &(pMgmt->sBSSList[jj]);
- if (pBSS->bActive) {
- //ADD mac address
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = SIOCGIWAP;
- iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
+ pBSS = &(pMgmt->sBSSList[jj]);
+ if (pBSS->bActive) {
+ // ADD mac address
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWAP;
+ iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
memcpy(iwe.u.ap_addr.sa_data, pBSS->abyBSSID, WLAN_BSSID_LEN);
- current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_ADDR_LEN);
- //ADD ssid
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = SIOCGIWESSID;
- pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
- iwe.u.data.length = pItemSSID->len;
- iwe.u.data.flags = 1;
- current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID);
- //ADD mode
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = SIOCGIWMODE;
- if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) {
- iwe.u.mode = IW_MODE_INFRA;
- }
- else {
- iwe.u.mode = IW_MODE_ADHOC;
- }
- iwe.len = IW_EV_UINT_LEN;
- current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
- //ADD frequency
- pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates;
- pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates;
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = SIOCGIWFREQ;
- iwe.u.freq.m = pBSS->uChannel;
- iwe.u.freq.e = 0;
- iwe.u.freq.i = 0;
- current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN);
+ current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
+ // ADD ssid
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWESSID;
+ pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
+ iwe.u.data.length = pItemSSID->len;
+ iwe.u.data.flags = 1;
+ current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID);
+ // ADD mode
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWMODE;
+ if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo))
+ iwe.u.mode = IW_MODE_INFRA;
+ else
+ iwe.u.mode = IW_MODE_ADHOC;
+ iwe.len = IW_EV_UINT_LEN;
+ current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
+ // ADD frequency
+ pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates;
+ pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates;
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWFREQ;
+ iwe.u.freq.m = pBSS->uChannel;
+ iwe.u.freq.e = 0;
+ iwe.u.freq.i = 0;
+ current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe, IW_EV_FREQ_LEN);
{
- int f = (int)pBSS->uChannel - 1;
- if(f < 0)f = 0;
- iwe.u.freq.m = frequency_list[f] * 100000;
- iwe.u.freq.e = 1;
+ int f = (int)pBSS->uChannel - 1;
+ if (f < 0)
+ f = 0;
+ iwe.u.freq.m = frequency_list[f] * 100000;
+ iwe.u.freq.e = 1;
}
- current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN);
- //ADD quality
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = IWEVQUAL;
- RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm);
- iwe.u.qual.level = ldBm;
- iwe.u.qual.noise = 0;
-
- if(-ldBm<50){
+ current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
+ // ADD quality
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = IWEVQUAL;
+ RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm);
+ iwe.u.qual.level = ldBm;
+ iwe.u.qual.noise = 0;
+
+ if (-ldBm < 50)
iwe.u.qual.qual = 100;
- }else if(-ldBm > 90) {
- iwe.u.qual.qual = 0;
- }else {
- iwe.u.qual.qual=(40-(-ldBm-50))*100/40;
+ else if (-ldBm > 90)
+ iwe.u.qual.qual = 0;
+ else
+ iwe.u.qual.qual = (40 - (-ldBm - 50)) * 100 / 40;
+ iwe.u.qual.updated = 7;
+
+ current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
+ // ADD encryption
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWENCODE;
+ iwe.u.data.length = 0;
+ if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo))
+ iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
+ else
+ iwe.u.data.flags = IW_ENCODE_DISABLED;
+ current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID);
+
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWRATE;
+ iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
+ current_val = current_ev + IW_EV_LCP_LEN;
+
+ for (kk = 0; kk < 12; kk++) {
+ if (pSuppRates->abyRates[kk] == 0)
+ break;
+ // Bit rate given in 500 kb/s units (+ 0x80)
+ iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000);
+ current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
}
- iwe.u.qual.updated=7;
-
- current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
- //ADD encryption
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = SIOCGIWENCODE;
- iwe.u.data.length = 0;
- if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) {
- iwe.u.data.flags =IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
- }else {
- iwe.u.data.flags = IW_ENCODE_DISABLED;
- }
- current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID);
-
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = SIOCGIWRATE;
- iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
- current_val = current_ev + IW_EV_LCP_LEN;
-
- for (kk = 0 ; kk < 12 ; kk++) {
- if (pSuppRates->abyRates[kk] == 0)
- break;
- // Bit rate given in 500 kb/s units (+ 0x80)
- iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000);
- current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
- }
- for (kk = 0 ; kk < 8 ; kk++) {
- if (pExtSuppRates->abyRates[kk] == 0)
- break;
- // Bit rate given in 500 kb/s units (+ 0x80)
- iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000);
- current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
- }
-
- 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;
- iwe.u.data.length = pBSS->wWPALen;
- current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byWPAIE);
- }
-
- if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) {
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = IWEVGENIE;
- iwe.u.data.length = pBSS->wRSNLen;
- current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byRSNIE);
- }
-
- }
- }// for
+ for (kk = 0; kk < 8; kk++) {
+ if (pExtSuppRates->abyRates[kk] == 0)
+ break;
+ // Bit rate given in 500 kb/s units (+ 0x80)
+ iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000);
+ current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
+ }
+
+ 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;
+ iwe.u.data.length = pBSS->wWPALen;
+ current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pBSS->byWPAIE);
+ }
+
+ if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) {
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = IWEVGENIE;
+ iwe.u.data.length = pBSS->wRSNLen;
+ current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pBSS->byRSNIE);
+ }
+ }
+ } // for
wrq->length = current_ev - extra;
return 0;
-
}
-
/*
- * Wireless Handler : set frequence or channel
+ * Wireless Handler: set frequence or channel
*/
-
-int iwctl_siwfreq(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_freq *wrq,
- char *extra)
+int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info,
+ struct iw_freq *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ PSDevice pDevice = netdev_priv(dev);
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) &&
- (wrq->m <= (int) 2.487e8)) {
+ if ((wrq->e == 1) && (wrq->m >= (int)2.412e8) &&
+ (wrq->m <= (int)2.487e8)) {
int f = wrq->m / 100000;
int c = 0;
- while((c < 14) && (f != frequency_list[c]))
+ while ((c < 14) && (f != frequency_list[c]))
c++;
wrq->e = 0;
wrq->m = c + 1;
}
// Setting by channel number
- if((wrq->m > 14) || (wrq->e > 0))
+ if ((wrq->m > 14) || (wrq->e > 0)) {
rc = -EOPNOTSUPP;
- else {
+ } else {
int channel = wrq->m;
- if((channel < 1) || (channel > 14)) {
+ if ((channel < 1) || (channel > 14)) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m);
rc = -EINVAL;
} else {
- // Yes ! We can set it !!!
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel);
- pDevice->uChannel = channel;
+ // Yes ! We can set it !!!
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel);
+ pDevice->uChannel = channel;
}
}
-
return rc;
}
/*
- * Wireless Handler : get frequence or channel
+ * Wireless Handler: get frequence or channel
*/
-
-int iwctl_giwfreq(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_freq *wrq,
- char *extra)
+int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info,
+ struct iw_freq *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n");
#ifdef WEXT_USECHANNELS
wrq->m = (int)pMgmt->uCurrChannel;
@@ -390,74 +366,66 @@ int iwctl_giwfreq(struct net_device *dev,
#else
{
int f = (int)pMgmt->uCurrChannel - 1;
- if(f < 0)
- f = 0;
+ if (f < 0)
+ f = 0;
wrq->m = frequency_list[f] * 100000;
wrq->e = 1;
}
#endif
-
return 0;
}
/*
- * Wireless Handler : set operation mode
+ * Wireless Handler: set operation mode
*/
-
-int iwctl_siwmode(struct net_device *dev,
- struct iw_request_info *info,
- __u32 *wmode,
- char *extra)
+int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info,
+ __u32 *wmode, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int rc = 0;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n");
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ int rc = 0;
- 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");
- return rc;
- }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n");
- switch(*wmode) {
+ 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");
+ return rc;
+ }
+ switch (*wmode) {
case IW_MODE_ADHOC:
- if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) {
- pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- pDevice->bCommit = TRUE;
- }
+ if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) {
+ pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
+ if (pDevice->flags & DEVICE_FLAGS_OPENED)
+ pDevice->bCommit = TRUE;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n");
break;
case IW_MODE_AUTO:
case IW_MODE_INFRA:
- if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) {
- pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- pDevice->bCommit = TRUE;
- }
+ if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) {
+ pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
+ if (pDevice->flags & DEVICE_FLAGS_OPENED)
+ pDevice->bCommit = TRUE;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n");
break;
case IW_MODE_MASTER:
- pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
+ pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
rc = -EOPNOTSUPP;
break;
- if (pMgmt->eConfigMode != WMAC_CONFIG_AP) {
- pMgmt->eConfigMode = WMAC_CONFIG_AP;
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- pDevice->bCommit = TRUE;
- }
+ if (pMgmt->eConfigMode != WMAC_CONFIG_AP) {
+ pMgmt->eConfigMode = WMAC_CONFIG_AP;
+ if (pDevice->flags & DEVICE_FLAGS_OPENED)
+ pDevice->bCommit = TRUE;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n");
break;
case IW_MODE_REPEAT:
- pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
+ pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
rc = -EOPNOTSUPP;
break;
default:
@@ -468,26 +436,22 @@ int iwctl_siwmode(struct net_device *dev,
}
/*
- * Wireless Handler : get operation mode
+ * Wireless Handler: get operation mode
*/
-
-void iwctl_giwmode(struct net_device *dev,
- struct iw_request_info *info,
- __u32 *wmode,
- char *extra)
+void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info,
+ __u32 *wmode, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
-
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n");
// If not managed, assume it's ad-hoc
switch (pMgmt->eConfigMode) {
case WMAC_CONFIG_ESS_STA:
*wmode = IW_MODE_INFRA;
break;
case WMAC_CONFIG_IBSS_STA:
- *wmode = IW_MODE_ADHOC;
+ *wmode = IW_MODE_ADHOC;
break;
case WMAC_CONFIG_AUTO:
*wmode = IW_MODE_INFRA;
@@ -500,21 +464,21 @@ void iwctl_giwmode(struct net_device *dev,
}
}
-
/*
- * Wireless Handler : get capability range
+ * Wireless Handler: get capability range
*/
-
-void iwctl_giwrange(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
- struct iw_range *range = (struct iw_range *) extra;
- int i,k;
- BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
+ struct iw_range *range = (struct iw_range *)extra;
+ int i;
+ int k;
+ BYTE abySupportedRates[13] = {
+ 0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48,
+ 0x60, 0x6C, 0x90
+ };
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE\n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE\n");
if (wrq->pointer) {
wrq->length = sizeof(struct iw_range);
memset(range, 0, sizeof(struct iw_range));
@@ -522,7 +486,7 @@ void iwctl_giwrange(struct net_device *dev,
range->max_nwid = 0x0000;
range->num_channels = 14;
// Should be based on cap_rid.country to give only
- // what the current card support
+ // what the current card support
k = 0;
for (i = 0; i < 14; i++) {
range->freq[k].i = i + 1; // List index
@@ -531,14 +495,14 @@ void iwctl_giwrange(struct net_device *dev,
}
range->num_frequency = k;
// Hum... Should put the right values there
- range->max_qual.qual = 100;
+ range->max_qual.qual = 100;
range->max_qual.level = 0;
range->max_qual.noise = 0;
range->sensitivity = 255;
- for (i = 0 ; i < 13 ; i++) {
+ for (i = 0; i < 13; i++) {
range->bitrate[i] = abySupportedRates[i] * 500000;
- if(range->bitrate[i] == 0)
+ if (range->bitrate[i] == 0)
break;
}
range->num_bitrates = i;
@@ -546,7 +510,7 @@ void iwctl_giwrange(struct net_device *dev,
// Set an indication of the max TCP throughput
// in bit/s that we can expect using this interface.
// May be use for QoS stuff... Jean II
- if(i > 2)
+ if (i > 2)
range->throughput = 5 * 1000 * 1000;
else
range->throughput = 1.5 * 1000 * 1000;
@@ -556,32 +520,30 @@ void iwctl_giwrange(struct net_device *dev,
range->min_frag = 256;
range->max_frag = 2312;
+ // the encoding capabilities
+ range->num_encoding_sizes = 3;
+ // 64(40) bits WEP
+ range->encoding_size[0] = 5;
+ // 128(104) bits WEP
+ range->encoding_size[1] = 13;
+ // 256 bits for WPA-PSK
+ range->encoding_size[2] = 32;
+ // 4 keys are allowed
+ range->max_encoding_tokens = 4;
- // the encoding capabilities
- range->num_encoding_sizes = 3;
- // 64(40) bits WEP
- range->encoding_size[0] = 5;
- // 128(104) bits WEP
- range->encoding_size[1] = 13;
- // 256 bits for WPA-PSK
- range->encoding_size[2] = 32;
- // 4 keys are allowed
- range->max_encoding_tokens = 4;
-
- range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
- IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
+ range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
+ IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
range->min_pmp = 0;
- range->max_pmp = 1000000;// 1 secs
+ range->max_pmp = 1000000; // 1 secs
range->min_pmt = 0;
- range->max_pmt = 1000000;// 1 secs
+ range->max_pmt = 1000000; // 1 secs
range->pmp_flags = IW_POWER_PERIOD;
range->pmt_flags = IW_POWER_TIMEOUT;
range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
// Transmit Power - values are in mW
-
- range->txpower[0] = 100;
+ range->txpower[0] = 100;
range->num_txpower = 1;
range->txpower_capa = IW_TXPOW_MWATT;
range->we_version_source = SUPPORTED_WIRELESS_EXT;
@@ -597,111 +559,97 @@ void iwctl_giwrange(struct net_device *dev,
// Note : with or without the (local->rssi), results
// are somewhat different. - Jean II
range->avg_qual.qual = 6;
- range->avg_qual.level = 176; // -80 dBm
+ range->avg_qual.level = 176; // -80 dBm
range->avg_qual.noise = 0;
}
}
-
/*
* Wireless Handler : set ap mac address
*/
-
-int iwctl_siwap(struct net_device *dev,
- struct iw_request_info *info,
- struct sockaddr *wrq,
- char *extra)
+int iwctl_siwap(struct net_device *dev, struct iw_request_info *info,
+ struct sockaddr *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int rc = 0;
- BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00};
+ PSDevice pDevice = netdev_priv(dev);
+ 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 (wrq->sa_family != ARPHRD_ETHER)
+ if (wrq->sa_family != ARPHRD_ETHER) {
rc = -EINVAL;
- else {
+ } else {
memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6);
+ // mike: add
+ if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) ||
+ (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)) {
+ PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n");
+ return rc;
+ }
+ // mike add: if desired AP is hidden ssid(there are
+ // two same BSSID in list), then ignore,because you
+ // don't known which one to be connect with??
+ {
+ unsigned ii;
+ unsigned uSameBssidNum = 0;
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ if (pMgmt->sBSSList[ii].bActive &&
+ !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID,
+ pMgmt->abyDesireBSSID)) {
+ uSameBssidNum++;
+ }
+ }
+ if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!!
+ PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n");
+ return rc;
+ }
+ }
- //mike :add
- if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) ||
- (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)){
- PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n");
- return rc;
- }
- //mike add: if desired AP is hidden ssid(there are two same BSSID in list),
- // then ignore,because you don't known which one to be connect with??
- {
- unsigned int ii, uSameBssidNum = 0;
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- if (pMgmt->sBSSList[ii].bActive &&
- !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID,
- pMgmt->abyDesireBSSID)) {
- uSameBssidNum++;
- }
- }
- if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!!
- PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n");
- return rc;
- }
- }
-
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- pDevice->bCommit = TRUE;
- }
+ if (pDevice->flags & DEVICE_FLAGS_OPENED)
+ pDevice->bCommit = TRUE;
}
return rc;
}
/*
- * Wireless Handler : get ap mac address
+ * Wireless Handler: get ap mac address
*/
-
-int iwctl_giwap(struct net_device *dev,
- struct iw_request_info *info,
- struct sockaddr *wrq,
- char *extra)
+int iwctl_giwap(struct net_device *dev, struct iw_request_info *info,
+ struct sockaddr *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
-
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n");
- memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
+ memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
- if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP))
- memset(wrq->sa_data, 0, 6);
+ if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP))
+ memset(wrq->sa_data, 0, 6);
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
- memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
- }
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)
+ memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
wrq->sa_family = ARPHRD_ETHER;
-
return 0;
-
}
-
/*
- * Wireless Handler : get ap list
+ * Wireless Handler: get ap list
*/
-
-int iwctl_giwaplist(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
- int ii,jj, rc = 0;
+ int ii;
+ int jj;
+ int rc = 0;
struct sockaddr sock[IW_MAX_AP];
struct iw_quality qual[IW_MAX_AP];
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
-
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n");
// Only super-user can see AP list
if (!capable(CAP_NET_ADMIN)) {
@@ -710,15 +658,14 @@ int iwctl_giwaplist(struct net_device *dev,
}
if (wrq->pointer) {
-
PKnownBSS pBSS = &(pMgmt->sBSSList[0]);
for (ii = 0, jj= 0; ii < MAX_BSS_NUM; ii++) {
- pBSS = &(pMgmt->sBSSList[ii]);
- if (!pBSS->bActive)
- continue;
- if ( jj >= IW_MAX_AP)
- break;
+ 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;
@@ -729,151 +676,137 @@ int iwctl_giwaplist(struct net_device *dev,
wrq->flags = 1; // Should be define'd
wrq->length = jj;
- memcpy(extra, sock, sizeof(struct sockaddr)*jj);
- memcpy(extra + sizeof(struct sockaddr)*jj, qual, sizeof(struct iw_quality)*jj);
+ memcpy(extra, sock, sizeof(struct sockaddr) * jj);
+ memcpy(extra + sizeof(struct sockaddr) * jj, qual, sizeof(struct iw_quality) * jj);
}
-
return rc;
}
-
/*
- * Wireless Handler : set essid
+ * Wireless Handler: set essid
*/
-
-int iwctl_siwessid(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- PWLAN_IE_SSID pItemSSID;
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PWLAN_IE_SSID pItemSSID;
- if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
- return -EINVAL;
+ if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
+ return -EINVAL;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID :\n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID :\n");
- pDevice->fWPA_Authened = FALSE;
+ pDevice->fWPA_Authened = FALSE;
// Check if we asked for `any'
- if(wrq->flags == 0) {
+ if (wrq->flags == 0) {
// Just send an empty SSID list
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
+ 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);
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
- pItemSSID->byElementID = WLAN_EID_SSID;
+ pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
+ pItemSSID->byElementID = WLAN_EID_SSID;
memcpy(pItemSSID->abySSID, extra, wrq->length);
- if (pItemSSID->abySSID[wrq->length - 1] == '\0') {
- if(wrq->length>0)
- pItemSSID->len = wrq->length - 1;
- }
- else
- pItemSSID->len = wrq->length;
- PRINT_K("set essid to %s \n",pItemSSID->abySSID);
+ if (pItemSSID->abySSID[wrq->length - 1] == '\0') {
+ if (wrq->length>0)
+ pItemSSID->len = wrq->length - 1;
+ } else {
+ pItemSSID->len = wrq->length;
+ }
+ PRINT_K("set essid to %s \n", pItemSSID->abySSID);
- //mike:need clear desiredBSSID
- if(pItemSSID->len==0) {
- memset(pMgmt->abyDesireBSSID, 0xFF,6);
- return 0;
- }
+ // mike: need clear desiredBSSID
+ if (pItemSSID->len==0) {
+ memset(pMgmt->abyDesireBSSID, 0xFF, 6);
+ 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) {
- /*******search if in hidden ssid mode ****/
- {
- PKnownBSS pCurr = NULL;
- BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
- unsigned int ii, uSameBssidNum = 0;
-
- memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID));
- pCurr = BSSpSearchBSSList(pDevice,
- NULL,
- abyTmpDesireSSID,
- pDevice->eConfigPHYMode
- );
-
- if (pCurr == NULL){
- PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n");
- vResetCommandTimer((void *) pDevice);
- pMgmt->eScanType = WMAC_SCAN_ACTIVE;
- bScheduleCommand((void *) pDevice,
- WLAN_CMD_BSSID_SCAN,
- pMgmt->abyDesireSSID);
- bScheduleCommand((void *) pDevice,
- WLAN_CMD_SSID,
- pMgmt->abyDesireSSID);
- }
- else { //mike:to find out if that desired SSID is a hidden-ssid AP ,
- // by means of judging if there are two same BSSID exist in list ?
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- if (pMgmt->sBSSList[ii].bActive &&
- !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID,
- pCurr->abyBSSID)) {
- uSameBssidNum++;
- }
- }
- if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!!
- PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n");
- vResetCommandTimer((void *) pDevice);
- pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result!
- bScheduleCommand((void *) pDevice,
- WLAN_CMD_BSSID_SCAN,
- pMgmt->abyDesireSSID);
- bScheduleCommand((void *) pDevice,
- WLAN_CMD_SSID,
- pMgmt->abyDesireSSID);
- }
- }
- }
- return 0;
- }
- #endif
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID);
- }
+ // Wext wil order another command of siwap to link
+ // with desired AP, so here need not associate??
+ if (pDevice->bWPASuppWextEnabled == TRUE) {
+ /*******search if in hidden ssid mode ****/
+ PKnownBSS pCurr = NULL;
+ BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
+ unsigned ii;
+ unsigned uSameBssidNum = 0;
+
+ memcpy(abyTmpDesireSSID, pMgmt->abyDesireSSID, sizeof(abyTmpDesireSSID));
+ pCurr = BSSpSearchBSSList(pDevice, NULL,
+ abyTmpDesireSSID,
+ pDevice->eConfigPHYMode);
+
+ if (pCurr == NULL) {
+ PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n");
+ vResetCommandTimer((void *)pDevice);
+ pMgmt->eScanType = WMAC_SCAN_ACTIVE;
+ bScheduleCommand((void *)pDevice,
+ WLAN_CMD_BSSID_SCAN,
+ pMgmt->abyDesireSSID);
+ bScheduleCommand((void *)pDevice,
+ WLAN_CMD_SSID,
+ pMgmt->abyDesireSSID);
+ } else { // mike: to find out if that desired SSID is a
+ // hidden-ssid AP, by means of judging if there
+ // are two same BSSID exist in list ?
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ if (pMgmt->sBSSList[ii].bActive &&
+ !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID,
+ pCurr->abyBSSID)) {
+ uSameBssidNum++;
+ }
+ }
+ if (uSameBssidNum >= 2) { // hit: desired AP is in hidden ssid mode!!!
+ PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n");
+ vResetCommandTimer((void *)pDevice);
+ pMgmt->eScanType = WMAC_SCAN_PASSIVE; // this scan type, you'll submit scan result!
+ bScheduleCommand((void *)pDevice,
+ WLAN_CMD_BSSID_SCAN,
+ pMgmt->abyDesireSSID);
+ bScheduleCommand((void *)pDevice,
+ WLAN_CMD_SSID,
+ pMgmt->abyDesireSSID);
+ }
+ }
+ return 0;
+ }
+#endif
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- pDevice->bCommit = TRUE;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID);
}
+ if (pDevice->flags & DEVICE_FLAGS_OPENED)
+ pDevice->bCommit = TRUE;
return 0;
}
-
/*
- * Wireless Handler : get essid
+ * Wireless Handler: get essid
*/
-void iwctl_giwessid(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PWLAN_IE_SSID pItemSSID;
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- 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");
- // Note : if wrq->u.data.flags != 0, we should
- // get the relevant SSID from the SSID list...
+ // Note: if wrq->u.data.flags != 0, we should get the relevant
+ // SSID from the SSID list...
// Get the current SSID
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
- memcpy(extra, pItemSSID->abySSID , pItemSSID->len);
+ pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
+ memcpy(extra, pItemSSID->abySSID, pItemSSID->len);
extra[pItemSSID->len] = '\0';
wrq->length = pItemSSID->len;
@@ -881,146 +814,138 @@ void iwctl_giwessid(struct net_device *dev,
}
/*
- * Wireless Handler : set data rate
+ * Wireless Handler: set data rate
*/
-
-int iwctl_siwrate(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- int rc = 0;
- u8 brate = 0;
- int i;
- BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
-
+ PSDevice pDevice = netdev_priv(dev);
+ int rc = 0;
+ u8 brate = 0;
+ int i;
+ BYTE abySupportedRates[13] = {
+ 0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48,
+ 0x60, 0x6C, 0x90
+ };
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n");
- if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
- rc = -EINVAL;
- return rc;
- }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n");
+ if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
+ rc = -EINVAL;
+ return rc;
+ }
- // First : get a valid bit rate value
+ // First: get a valid bit rate value
// Which type of value
- if((wrq->value < 13) &&
- (wrq->value >= 0)) {
+ if ((wrq->value < 13) && (wrq->value >= 0)) {
// Setting by rate index
// Find value in the magic rate table
brate = wrq->value;
} else {
// Setting by frequency value
- u8 normvalue = (u8) (wrq->value/500000);
+ u8 normvalue = (u8)(wrq->value/500000);
// Check if rate is valid
- for (i = 0 ; i < 13 ; i++) {
- if(normvalue == abySupportedRates[i]) {
+ for (i = 0; i < 13; i++) {
+ if (normvalue == abySupportedRates[i]) {
brate = i;
break;
}
}
}
// -1 designed the max rate (mostly auto mode)
- if(wrq->value == -1) {
+ if (wrq->value == -1) {
// Get the highest available rate
- for (i = 0 ; i < 13 ; i++) {
- if(abySupportedRates[i] == 0)
+ for (i = 0; i < 13; i++) {
+ if (abySupportedRates[i] == 0)
break;
}
- if(i != 0)
+ if (i != 0)
brate = i - 1;
}
// Check that it is valid
// brate is index of abySupportedRates[]
- if(brate > 13 ) {
+ if (brate > 13 ) {
rc = -EINVAL;
return rc;
}
// Now, check if we want a fixed or auto value
- if(wrq->fixed != 0) {
+ if (wrq->fixed != 0) {
// Fixed mode
// One rate, fixed
pDevice->bFixRate = TRUE;
- if ((pDevice->byBBType == BB_TYPE_11B)&& (brate > 3)) {
- pDevice->uConnectionRate = 3;
- }
- else {
- pDevice->uConnectionRate = brate;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate);
- }
-
+ if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) {
+ pDevice->uConnectionRate = 3;
+ } else {
+ pDevice->uConnectionRate = brate;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate);
+ }
+ } else {
+ pDevice->bFixRate = FALSE;
+ pDevice->uConnectionRate = 13;
}
- else {
- pDevice->bFixRate = FALSE;
- pDevice->uConnectionRate = 13;
- }
return rc;
}
/*
- * Wireless Handler : get data rate
+ * Wireless Handler: get data rate
*/
-void iwctl_giwrate(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n");
+ {
+ BYTE abySupportedRates[13] = {
+ 0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30,
+ 0x48, 0x60, 0x6C, 0x90
+ };
+ int brate = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n");
- {
- BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
- int brate = 0;
if (pDevice->uConnectionRate < 13) {
- brate = abySupportedRates[pDevice->uConnectionRate];
- }else {
- if (pDevice->byBBType == BB_TYPE_11B)
- brate = 0x16;
- if (pDevice->byBBType == BB_TYPE_11G)
- brate = 0x6C;
- if (pDevice->byBBType == BB_TYPE_11A)
- brate = 0x6C;
- }
-
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
- if (pDevice->byBBType == BB_TYPE_11B)
- brate = 0x16;
- if (pDevice->byBBType == BB_TYPE_11G)
- brate = 0x6C;
- if (pDevice->byBBType == BB_TYPE_11A)
- brate = 0x6C;
- }
+ brate = abySupportedRates[pDevice->uConnectionRate];
+ } else {
+ if (pDevice->byBBType == BB_TYPE_11B)
+ brate = 0x16;
+ if (pDevice->byBBType == BB_TYPE_11G)
+ brate = 0x6C;
+ if (pDevice->byBBType == BB_TYPE_11A)
+ brate = 0x6C;
+ }
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
+ if (pDevice->byBBType == BB_TYPE_11B)
+ brate = 0x16;
+ if (pDevice->byBBType == BB_TYPE_11G)
+ brate = 0x6C;
+ if (pDevice->byBBType == BB_TYPE_11A)
+ brate = 0x6C;
+ }
if (pDevice->uConnectionRate == 13)
- brate = abySupportedRates[pDevice->wCurrentRate];
- wrq->value = brate * 500000;
- // If more than one rate, set auto
- if (pDevice->bFixRate == TRUE)
- wrq->fixed = TRUE;
- }
+ brate = abySupportedRates[pDevice->wCurrentRate];
+ wrq->value = brate * 500000;
+ // If more than one rate, set auto
+ if (pDevice->bFixRate == TRUE)
+ wrq->fixed = TRUE;
+ }
}
-
-
/*
- * Wireless Handler : set rts threshold
+ * 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_param *wrq)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ PSDevice pDevice = netdev_priv(dev);
if ((wrq->value < 0 || wrq->value > 2312) && !wrq->disabled)
return -EINVAL;
else if (wrq->disabled)
pDevice->wRTSThreshold = 2312;
-
else
pDevice->wRTSThreshold = wrq->value;
@@ -1028,87 +953,68 @@ int iwctl_siwrts(struct net_device *dev,
}
/*
- * Wireless Handler : get rts
+ * Wireless Handler: get rts
*/
-
-int iwctl_giwrts(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ PSDevice pDevice = netdev_priv(dev);
- 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;
-
return 0;
}
/*
- * Wireless Handler : set fragment threshold
+ * Wireless Handler: set fragment threshold
*/
-
-int iwctl_siwfrag(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- int rc = 0;
- int fthr = wrq->value;
-
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n");
+ PSDevice pDevice = netdev_priv(dev);
+ int rc = 0;
+ int fthr = wrq->value;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n");
- if (wrq->disabled)
+ if (wrq->disabled)
fthr = 2312;
- if((fthr < 256) || (fthr > 2312)) {
+ if ((fthr < 256) || (fthr > 2312)) {
rc = -EINVAL;
- }else {
- fthr &= ~0x1; // Get an even value
- pDevice->wFragmentationThreshold = (u16)fthr;
- }
-
+ } else {
+ fthr &= ~0x1; // Get an even value
+ pDevice->wFragmentationThreshold = (u16)fthr;
+ }
return rc;
}
/*
- * Wireless Handler : get fragment threshold
+ * Wireless Handler: get fragment threshold
*/
-
-int iwctl_giwfrag(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ PSDevice pDevice = netdev_priv(dev);
- 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;
-
return 0;
}
-
-
/*
- * Wireless Handler : set retry threshold
+ * Wireless Handler: set retry threshold
*/
-int iwctl_siwretry(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- int rc = 0;
-
+ PSDevice pDevice = netdev_priv(dev);
+ 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;
@@ -1116,238 +1022,215 @@ int iwctl_siwretry(struct net_device *dev,
}
if (wrq->flags & IW_RETRY_LIMIT) {
- if(wrq->flags & IW_RETRY_MAX)
+ if (wrq->flags & IW_RETRY_MAX) {
pDevice->byLongRetryLimit = wrq->value;
- else if (wrq->flags & IW_RETRY_MIN)
+ } else if (wrq->flags & IW_RETRY_MIN) {
pDevice->byShortRetryLimit = wrq->value;
- else {
+ } else {
// No modifier : set both
pDevice->byShortRetryLimit = wrq->value;
pDevice->byLongRetryLimit = wrq->value;
}
}
- if (wrq->flags & IW_RETRY_LIFETIME) {
+ if (wrq->flags & IW_RETRY_LIFETIME)
pDevice->wMaxTransmitMSDULifetime = wrq->value;
- }
-
-
return rc;
}
/*
- * Wireless Handler : get retry threshold
+ * Wireless Handler: get retry threshold
*/
-int iwctl_giwretry(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n");
- wrq->disabled = 0; // Can't be disabled
+ PSDevice pDevice = netdev_priv(dev);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n");
+ wrq->disabled = 0; // Can't be disabled
- // Note : by default, display the min retry number
- if((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
+ // Note: by default, display the min retry number
+ if ((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
wrq->flags = IW_RETRY_LIFETIME;
- wrq->value = (int)pDevice->wMaxTransmitMSDULifetime; //ms
- } else if((wrq->flags & IW_RETRY_MAX)) {
+ wrq->value = (int)pDevice->wMaxTransmitMSDULifetime; // ms
+ } else if ((wrq->flags & IW_RETRY_MAX)) {
wrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
wrq->value = (int)pDevice->byLongRetryLimit;
} else {
wrq->flags = IW_RETRY_LIMIT;
wrq->value = (int)pDevice->byShortRetryLimit;
- if((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit)
+ if ((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit)
wrq->flags |= IW_RETRY_MIN;
}
-
-
return 0;
}
-
/*
- * Wireless Handler : set encode mode
+ * Wireless Handler: set encode mode
*/
-int iwctl_siwencode(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
DWORD dwKeyIndex = (DWORD)(wrq->flags & IW_ENCODE_INDEX);
- int ii,uu, rc = 0;
+ 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");
// Check the size of the key
if (wrq->length > WLAN_WEP232_KEYLEN) {
rc = -EINVAL;
- return rc;
+ return rc;
}
if (dwKeyIndex > WLAN_WEP_NKEYS) {
rc = -EINVAL;
- return rc;
- }
+ return rc;
+ }
- if (dwKeyIndex > 0)
+ if (dwKeyIndex > 0)
dwKeyIndex--;
// Send the key to the card
if (wrq->length > 0) {
-
- if (wrq->length == WLAN_WEP232_KEYLEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
- }
- else if (wrq->length == WLAN_WEP104_KEYLEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
- }
- else if (wrq->length == WLAN_WEP40_KEYLEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
- }
- memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
- memcpy(pDevice->abyKey, extra, wrq->length);
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: ");
- for (ii = 0; ii < wrq->length; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
- }
-
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- spin_lock_irq(&pDevice->lock);
- KeybSetDefaultKey( pDevice,
- &(pDevice->sKey),
- dwKeyIndex | (1 << 31),
- wrq->length,
- NULL,
- pDevice->abyKey,
- KEY_CTL_WEP
- );
- spin_unlock_irq(&pDevice->lock);
- }
- pDevice->byKeyIndex = (BYTE)dwKeyIndex;
- pDevice->uKeyLength = wrq->length;
- pDevice->bTransmitKey = TRUE;
- pDevice->bEncryptionEnable = TRUE;
- pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
-
- // Do we want to just set the transmit key index ?
- if ( index < 4 ) {
- pDevice->byKeyIndex = index;
+ if (wrq->length == WLAN_WEP232_KEYLEN) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
+ } else if (wrq->length == WLAN_WEP104_KEYLEN) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
+ } else if (wrq->length == WLAN_WEP40_KEYLEN) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
+ }
+ memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
+ memcpy(pDevice->abyKey, extra, wrq->length);
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: ");
+ for (ii = 0; ii < wrq->length; ii++)
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
+
+ if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ spin_lock_irq(&pDevice->lock);
+ KeybSetDefaultKey(pDevice,
+ &(pDevice->sKey),
+ dwKeyIndex | (1 << 31),
+ wrq->length, NULL,
+ pDevice->abyKey,
+ KEY_CTL_WEP);
+ spin_unlock_irq(&pDevice->lock);
+ }
+ pDevice->byKeyIndex = (BYTE)dwKeyIndex;
+ pDevice->uKeyLength = wrq->length;
+ pDevice->bTransmitKey = TRUE;
+ pDevice->bEncryptionEnable = TRUE;
+ pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
+
+ // Do we want to just set the transmit key index?
+ if (index < 4) {
+ pDevice->byKeyIndex = index;
} else if (!(wrq->flags & IW_ENCODE_MODE)) {
- rc = -EINVAL;
- return rc;
- }
+ rc = -EINVAL;
+ return rc;
+ }
}
// Read the flags
- if(wrq->flags & IW_ENCODE_DISABLED){
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
+ if (wrq->flags & IW_ENCODE_DISABLED) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
pMgmt->bShareKeyAlgorithm = FALSE;
- pDevice->bEncryptionEnable = FALSE;
- pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- spin_lock_irq(&pDevice->lock);
- for (uu = 0; uu < MAX_KEY_TABLE; uu++)
- MACvDisableKeyEntry(pDevice, uu);
- spin_unlock_irq(&pDevice->lock);
- }
+ pDevice->bEncryptionEnable = FALSE;
+ pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
+ if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ spin_lock_irq(&pDevice->lock);
+ for (uu = 0; uu < MAX_KEY_TABLE; uu++)
+ MACvDisableKeyEntry(pDevice, uu);
+ spin_unlock_irq(&pDevice->lock);
+ }
}
- if(wrq->flags & IW_ENCODE_RESTRICTED) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n");
+ if (wrq->flags & IW_ENCODE_RESTRICTED) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n");
pMgmt->bShareKeyAlgorithm = TRUE;
}
- if(wrq->flags & IW_ENCODE_OPEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n");
+ if (wrq->flags & IW_ENCODE_OPEN) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n");
pMgmt->bShareKeyAlgorithm = FALSE;
}
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- memset(pMgmt->abyDesireBSSID, 0xFF,6);
+ 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)
+int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
char abyKey[WLAN_WEP232_KEYLEN];
- unsigned int index = (unsigned int)(wrq->flags & IW_ENCODE_INDEX);
- PSKeyItem pKey = NULL;
+ unsigned index = (unsigned)(wrq->flags & IW_ENCODE_INDEX);
+ PSKeyItem pKey = NULL;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
- if (index > WLAN_WEP_NKEYS) {
+ if (index > WLAN_WEP_NKEYS)
return -EINVAL;
+ if (index < 1) { // get default key
+ if (pDevice->byKeyIndex < WLAN_WEP_NKEYS)
+ index = pDevice->byKeyIndex;
+ else
+ index = 0;
+ } else {
+ index--;
}
- if(index<1){//get default key
- if(pDevice->byKeyIndex<WLAN_WEP_NKEYS){
- index=pDevice->byKeyIndex;
- } else
- index=0;
- }else
- index--;
memset(abyKey, 0, WLAN_WEP232_KEYLEN);
// Check encryption mode
wrq->flags = IW_ENCODE_NOKEY;
// Is WEP enabled ???
if (pDevice->bEncryptionEnable)
- wrq->flags |= IW_ENCODE_ENABLED;
+ wrq->flags |= IW_ENCODE_ENABLED;
else
- wrq->flags |= IW_ENCODE_DISABLED;
+ wrq->flags |= IW_ENCODE_DISABLED;
if (pMgmt->bShareKeyAlgorithm)
- wrq->flags |= IW_ENCODE_RESTRICTED;
+ wrq->flags |= IW_ENCODE_RESTRICTED;
else
- wrq->flags |= IW_ENCODE_OPEN;
- wrq->length=0;
-
- if((index==0)&&(pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled||
- pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){//get wpa pairwise key
- if (KeybGetKey(&(pDevice->sKey),pMgmt->abyCurrBSSID, 0xffffffff, &pKey)){
- wrq->length = pKey->uKeyLength;
- memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
- memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
- }
- }else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index , &pKey)){
+ wrq->flags |= IW_ENCODE_OPEN;
+ wrq->length = 0;
+
+ if ((index == 0) && (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled ||
+ pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)) { // get wpa pairwise key
+ if (KeybGetKey(&(pDevice->sKey), pMgmt->abyCurrBSSID, 0xffffffff, &pKey)) {
wrq->length = pKey->uKeyLength;
- memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
- memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
+ memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
+ memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
+ }
+ } else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index, &pKey)) {
+ wrq->length = pKey->uKeyLength;
+ memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
+ memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
}
- wrq->flags |= index+1;
-
+ wrq->flags |= index + 1;
return 0;
}
-
/*
- * Wireless Handler : set power mode
+ * Wireless Handler: set power mode
*/
-int iwctl_siwpower(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int rc = 0;
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n");
- if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
- rc = -EINVAL;
- return rc;
+ if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
+ rc = -EINVAL;
+ return rc;
}
if (wrq->disabled) {
@@ -1356,23 +1239,23 @@ int iwctl_siwpower(struct net_device *dev,
return rc;
}
if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
- pDevice->ePSMode = WMAC_POWER_FAST;
- PSvEnablePowerSaving((void *) pDevice, pMgmt->wListenInterval);
+ pDevice->ePSMode = WMAC_POWER_FAST;
+ PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
} else if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
- pDevice->ePSMode = WMAC_POWER_FAST;
- PSvEnablePowerSaving((void *) pDevice, pMgmt->wListenInterval);
+ pDevice->ePSMode = WMAC_POWER_FAST;
+ PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
}
switch (wrq->flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n");
rc = -EINVAL;
break;
case IW_POWER_ALL_R:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n");
rc = -EINVAL;
case IW_POWER_ON:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n");
break;
default:
rc = -EINVAL;
@@ -1382,23 +1265,19 @@ int iwctl_siwpower(struct net_device *dev,
}
/*
- * Wireless Handler : get power mode
+ * Wireless Handler: get power mode
*/
-int iwctl_giwpower(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int mode = pDevice->ePSMode;
-
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n");
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ int mode = pDevice->ePSMode;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n");
if ((wrq->disabled = (mode == WMAC_POWER_CAM)))
- return 0;
+ return 0;
if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
wrq->value = (int)((pMgmt->wListenInterval * pMgmt->wCurrBeaconPeriod) << 10);
@@ -1408,117 +1287,105 @@ int iwctl_giwpower(struct net_device *dev,
wrq->flags = IW_POWER_PERIOD;
}
wrq->flags |= IW_POWER_ALL_R;
-
return 0;
}
-
/*
- * Wireless Handler : get Sensitivity
+ * Wireless Handler: get Sensitivity
*/
-int iwctl_giwsens(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- long ldBm;
+ PSDevice pDevice = netdev_priv(dev);
+ long ldBm;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n");
- if (pDevice->bLinkPass == TRUE) {
- RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm);
- wrq->value = ldBm;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n");
+ if (pDevice->bLinkPass == TRUE) {
+ RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm);
+ wrq->value = ldBm;
+ } else {
+ wrq->value = 0;
}
- else {
- wrq->value = 0;
- };
wrq->disabled = (wrq->value == 0);
wrq->fixed = 1;
-
-
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)
+int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int ret=0;
- static int wpa_version=0; //must be static to save the last value,einsn liu
- static int pairwise=0;
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ 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");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n");
switch (wrq->flags & IW_AUTH_INDEX) {
case IW_AUTH_WPA_VERSION:
wpa_version = wrq->value;
- if(wrq->value == IW_AUTH_WPA_VERSION_DISABLED) {
- PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
- }
- else if(wrq->value == IW_AUTH_WPA_VERSION_WPA) {
- PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n");
- }
- else {
- PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n");
+ if (wrq->value == IW_AUTH_WPA_VERSION_DISABLED) {
+ PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
+ } else if (wrq->value == IW_AUTH_WPA_VERSION_WPA) {
+ PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n");
+ } else {
+ PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n");
}
break;
case IW_AUTH_CIPHER_PAIRWISE:
pairwise = wrq->value;
- PRINT_K("iwctl_siwauth:set pairwise=%d\n",pairwise);
- if(pairwise == IW_AUTH_CIPHER_CCMP){
+ PRINT_K("iwctl_siwauth:set pairwise=%d\n", pairwise);
+ if (pairwise == IW_AUTH_CIPHER_CCMP){
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
- }else if(pairwise == IW_AUTH_CIPHER_TKIP){
+ } else if (pairwise == IW_AUTH_CIPHER_TKIP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
} else if (pairwise == IW_AUTH_CIPHER_WEP40 ||
- pairwise == IW_AUTH_CIPHER_WEP104) {
+ pairwise == IW_AUTH_CIPHER_WEP104) {
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- }else if(pairwise == IW_AUTH_CIPHER_NONE){
- //do nothing,einsn liu
- }else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
-
+ } else if (pairwise == IW_AUTH_CIPHER_NONE) {
+ // do nothing, einsn liu
+ } else {
+ pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
+ }
break;
case IW_AUTH_CIPHER_GROUP:
- PRINT_K("iwctl_siwauth:set GROUP=%d\n",wrq->value);
- if(wpa_version == IW_AUTH_WPA_VERSION_DISABLED)
+ PRINT_K("iwctl_siwauth:set GROUP=%d\n", wrq->value);
+ if (wpa_version == IW_AUTH_WPA_VERSION_DISABLED)
break;
- if(pairwise == IW_AUTH_CIPHER_NONE){
- if(wrq->value == IW_AUTH_CIPHER_CCMP){
+ if (pairwise == IW_AUTH_CIPHER_NONE) {
+ if (wrq->value == IW_AUTH_CIPHER_CCMP)
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
- }else {
+ else
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
- }
}
break;
case IW_AUTH_KEY_MGMT:
- PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n",wpa_version,wrq->value);
- if(wpa_version == IW_AUTH_WPA_VERSION_WPA2){
- if(wrq->value == IW_AUTH_KEY_MGMT_PSK)
+ PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n", wpa_version,wrq->value);
+ if (wpa_version == IW_AUTH_WPA_VERSION_WPA2){
+ if (wrq->value == IW_AUTH_KEY_MGMT_PSK)
pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK;
else pMgmt->eAuthenMode = WMAC_AUTH_WPA2;
- }else if(wpa_version == IW_AUTH_WPA_VERSION_WPA){
- if(wrq->value == 0){
+ } else if (wpa_version == IW_AUTH_WPA_VERSION_WPA) {
+ if (wrq->value == 0){
pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
- }else if(wrq->value == IW_AUTH_KEY_MGMT_PSK)
+ } else if (wrq->value == IW_AUTH_KEY_MGMT_PSK)
pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK;
- else pMgmt->eAuthenMode = WMAC_AUTH_WPA;
+ } else {
+ pMgmt->eAuthenMode = WMAC_AUTH_WPA;
}
-
break;
case IW_AUTH_TKIP_COUNTERMEASURES:
- break; /* FIXME */
+ break; /* FIXME */
case IW_AUTH_DROP_UNENCRYPTED:
break;
case IW_AUTH_80211_AUTH_ALG:
- PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n",wrq->value);
- if(wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){
- pMgmt->bShareKeyAlgorithm=FALSE;
- }else if(wrq->value==IW_AUTH_ALG_SHARED_KEY){
- pMgmt->bShareKeyAlgorithm=TRUE;
- }
+ PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n", wrq->value);
+ if (wrq->value == IW_AUTH_ALG_OPEN_SYSTEM)
+ pMgmt->bShareKeyAlgorithm = FALSE;
+ else if (wrq->value == IW_AUTH_ALG_SHARED_KEY)
+ pMgmt->bShareKeyAlgorithm = TRUE;
break;
case IW_AUTH_WPA_ENABLED:
break;
@@ -1529,345 +1396,314 @@ int iwctl_siwauth(struct net_device *dev,
break;
case IW_AUTH_PRIVACY_INVOKED:
pDevice->bEncryptionEnable = !!wrq->value;
- if(pDevice->bEncryptionEnable == FALSE){
+ if (pDevice->bEncryptionEnable == FALSE) {
wpa_version = 0;
pairwise = 0;
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
pMgmt->bShareKeyAlgorithm = FALSE;
pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
- PRINT_K("iwctl_siwauth:set WPADEV to disaable at 2?????\n");
+ PRINT_K("iwctl_siwauth:set WPADEV to disaable at 2?????\n");
}
-
break;
default:
ret = -EOPNOTSUPP;
break;
}
- return ret;
+ return ret;
}
-
-int iwctl_giwauth(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra)
{
return -EOPNOTSUPP;
}
-
-
-int iwctl_siwgenie(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int ret=0;
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ int ret = 0;
- if(wrq->length){
- if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) {
+ if (wrq->length){
+ if ((wrq->length < 2) || (extra[1] + 2 != wrq->length)) {
ret = -EINVAL;
goto out;
}
- if(wrq->length > MAX_WPA_IE_LEN){
+ if (wrq->length > MAX_WPA_IE_LEN){
ret = -ENOMEM;
goto out;
}
memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
- if(copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)){
+ if (copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)){
ret = -EFAULT;
goto out;
}
pMgmt->wWPAIELen = wrq->length;
- }else {
+ } else {
memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
pMgmt->wWPAIELen = 0;
}
- out://not completely ...not necessary in wpa_supplicant 0.5.8
+out: // not completely ...not necessary in wpa_supplicant 0.5.8
return ret;
}
-int iwctl_giwgenie(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int ret=0;
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ int ret = 0;
int space = wrq->length;
wrq->length = 0;
- if(pMgmt->wWPAIELen > 0){
+ if (pMgmt->wWPAIELen > 0) {
wrq->length = pMgmt->wWPAIELen;
- if(pMgmt->wWPAIELen <= space){
- if(copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)){
+ if (pMgmt->wWPAIELen <= space) {
+ if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)) {
ret = -EFAULT;
}
- }else
+ } else {
ret = -E2BIG;
+ }
}
-
return ret;
}
-
-int iwctl_siwencodeext(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
- struct viawget_wpa_param *param=NULL;
-//original member
- wpa_alg alg_name;
- u8 addr[6];
- int key_idx, set_tx=0;
- u8 seq[IW_ENCODE_SEQ_MAX_SIZE];
- u8 key[64];
- size_t seq_len=0,key_len=0;
- u8 *buf;
- size_t blen;
- u8 key_array[64];
- int ret=0;
-
-PRINT_K("SIOCSIWENCODEEXT...... \n");
-
-blen = sizeof(*param);
-buf = kmalloc((int)blen, (int)GFP_KERNEL);
-if (buf == NULL)
- return -ENOMEM;
-memset(buf, 0, blen);
-param = (struct viawget_wpa_param *) buf;
-
-//recover alg_name
-switch (ext->alg) {
- case IW_ENCODE_ALG_NONE:
- alg_name = WPA_ALG_NONE;
+ struct viawget_wpa_param *param=NULL;
+// original member
+ wpa_alg alg_name;
+ u8 addr[6];
+ int key_idx;
+ int set_tx = 0;
+ u8 seq[IW_ENCODE_SEQ_MAX_SIZE];
+ u8 key[64];
+ 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");
+
+ blen = sizeof(*param);
+ buf = kmalloc((int)blen, (int)GFP_KERNEL);
+ if (buf == NULL)
+ return -ENOMEM;
+ memset(buf, 0, blen);
+ param = (struct viawget_wpa_param *)buf;
+
+// recover alg_name
+ switch (ext->alg) {
+ case IW_ENCODE_ALG_NONE:
+ alg_name = WPA_ALG_NONE;
break;
- case IW_ENCODE_ALG_WEP:
- alg_name = WPA_ALG_WEP;
+ case IW_ENCODE_ALG_WEP:
+ alg_name = WPA_ALG_WEP;
break;
- case IW_ENCODE_ALG_TKIP:
- alg_name = WPA_ALG_TKIP;
+ case IW_ENCODE_ALG_TKIP:
+ alg_name = WPA_ALG_TKIP;
break;
- case IW_ENCODE_ALG_CCMP:
- alg_name = WPA_ALG_CCMP;
+ case IW_ENCODE_ALG_CCMP:
+ alg_name = WPA_ALG_CCMP;
break;
- default:
+ default:
PRINT_K("Unknown alg = %d\n",ext->alg);
ret= -ENOMEM;
goto error;
- }
-//recover addr
- memcpy(addr, ext->addr.sa_data, ETH_ALEN);
-//recover key_idx
- key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1;
-//recover set_tx
-if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
- set_tx = 1;
-//recover seq,seq_len
- if(ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
- seq_len=IW_ENCODE_SEQ_MAX_SIZE;
- memcpy(seq, ext->rx_seq, seq_len);
- }
-//recover key,key_len
-if(ext->key_len) {
- key_len=ext->key_len;
- memcpy(key, &ext->key[0], key_len);
}
-
-memset(key_array, 0, 64);
-if ( key_len > 0) {
- memcpy(key_array, key, key_len);
- if (key_len == 32) {
- // notice ! the oder
- memcpy(&key_array[16], &key[24], 8);
- memcpy(&key_array[24], &key[16], 8);
+// recover addr
+ memcpy(addr, ext->addr.sa_data, ETH_ALEN);
+// recover key_idx
+ key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1;
+// recover set_tx
+ if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
+ set_tx = 1;
+// recover seq,seq_len
+ if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
+ seq_len=IW_ENCODE_SEQ_MAX_SIZE;
+ memcpy(seq, ext->rx_seq, seq_len);
}
+// recover key,key_len
+ if (ext->key_len) {
+ key_len = ext->key_len;
+ memcpy(key, &ext->key[0], key_len);
+ }
+ memset(key_array, 0, 64);
+ if (key_len > 0) {
+ memcpy(key_array, key, key_len);
+ if (key_len == 32) {
+ // notice ! the oder
+ memcpy(&key_array[16], &key[24], 8);
+ memcpy(&key_array[24], &key[16], 8);
+ }
}
/**************Translate iw_encode_ext to viawget_wpa_param****************/
-memcpy(param->addr, addr, ETH_ALEN);
-param->u.wpa_key.alg_name = (int)alg_name;
-param->u.wpa_key.set_tx = set_tx;
-param->u.wpa_key.key_index = key_idx;
-param->u.wpa_key.key_len = key_len;
-param->u.wpa_key.key = (u8 *)key_array;
-param->u.wpa_key.seq = (u8 *)seq;
-param->u.wpa_key.seq_len = seq_len;
-
-//****set if current action is Network Manager count??
-//****this method is so foolish,but there is no other way???
-if(param->u.wpa_key.alg_name == WPA_ALG_NONE) {
- if(param->u.wpa_key.key_index ==0) {
- pDevice->bwextstep0 = TRUE;
- }
- if((pDevice->bwextstep0 = TRUE)&&(param->u.wpa_key.key_index ==1)) {
- pDevice->bwextstep0 = FALSE;
- pDevice->bwextstep1 = TRUE;
- }
- if((pDevice->bwextstep1 = TRUE)&&(param->u.wpa_key.key_index ==2)) {
- pDevice->bwextstep1 = FALSE;
- pDevice->bwextstep2 = TRUE;
+ memcpy(param->addr, addr, ETH_ALEN);
+ param->u.wpa_key.alg_name = (int)alg_name;
+ param->u.wpa_key.set_tx = set_tx;
+ param->u.wpa_key.key_index = key_idx;
+ param->u.wpa_key.key_len = key_len;
+ param->u.wpa_key.key = (u8 *)key_array;
+ param->u.wpa_key.seq = (u8 *)seq;
+ param->u.wpa_key.seq_len = seq_len;
+
+/****set if current action is Network Manager count?? */
+/****this method is so foolish,but there is no other way??? */
+ if (param->u.wpa_key.alg_name == WPA_ALG_NONE) {
+ if (param->u.wpa_key.key_index ==0) {
+ pDevice->bwextstep0 = TRUE;
+ }
+ if ((pDevice->bwextstep0 == TRUE) && (param->u.wpa_key.key_index == 1)) {
+ pDevice->bwextstep0 = FALSE;
+ pDevice->bwextstep1 = TRUE;
+ }
+ if ((pDevice->bwextstep1 == TRUE) && (param->u.wpa_key.key_index == 2)) {
+ pDevice->bwextstep1 = FALSE;
+ pDevice->bwextstep2 = TRUE;
+ }
+ if ((pDevice->bwextstep2 == TRUE) && (param->u.wpa_key.key_index == 3)) {
+ pDevice->bwextstep2 = FALSE;
+ pDevice->bwextstep3 = TRUE;
+ }
+ }
+ if (pDevice->bwextstep3 == TRUE) {
+ PRINT_K("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n");
+ pDevice->bwextstep0 = FALSE;
+ pDevice->bwextstep1 = FALSE;
+ pDevice->bwextstep2 = FALSE;
+ pDevice->bwextstep3 = FALSE;
+ pDevice->bWPASuppWextEnabled = TRUE;
+ memset(pMgmt->abyDesireBSSID, 0xFF, 6);
+ KeyvInitTable(pDevice, &pDevice->sKey);
}
- if((pDevice->bwextstep2 = TRUE)&&(param->u.wpa_key.key_index ==3)) {
- pDevice->bwextstep2 = FALSE;
- pDevice->bwextstep3 = TRUE;
- }
- }
-if(pDevice->bwextstep3 == TRUE) {
- PRINT_K("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n");
- pDevice->bwextstep0 = FALSE;
- pDevice->bwextstep1 = FALSE;
- pDevice->bwextstep2 = FALSE;
- pDevice->bwextstep3 = FALSE;
- pDevice->bWPASuppWextEnabled = TRUE;
- memset(pMgmt->abyDesireBSSID, 0xFF,6);
- KeyvInitTable(pDevice,&pDevice->sKey);
- }
-//******
-
- spin_lock_irq(&pDevice->lock);
- ret = wpa_set_keys(pDevice, param, TRUE);
- spin_unlock_irq(&pDevice->lock);
+/*******/
+ spin_lock_irq(&pDevice->lock);
+ ret = wpa_set_keys(pDevice, param, TRUE);
+ spin_unlock_irq(&pDevice->lock);
error:
-kfree(param);
+ kfree(param);
return ret;
}
-
-
-int iwctl_giwencodeext(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
- return -EOPNOTSUPP;
+ return -EOPNOTSUPP;
}
-int iwctl_siwmlme(struct net_device *dev,
- struct iw_request_info * info,
- struct iw_point *wrq,
- char *extra)
+int iwctl_siwmlme(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSDevice pDevice = netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_mlme *mlme = (struct iw_mlme *)extra;
int ret = 0;
- if(memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)){
+ if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)) {
ret = -EINVAL;
return ret;
}
- switch(mlme->cmd){
+ switch (mlme->cmd){
case IW_MLME_DEAUTH:
case IW_MLME_DISASSOC:
- if(pDevice->bLinkPass == TRUE){
- PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n");
- bScheduleCommand((void *) pDevice,
- WLAN_CMD_DISASSOCIATE,
- NULL);
+ if (pDevice->bLinkPass == TRUE) {
+ PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n");
+ bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE,
+ NULL);
}
break;
default:
ret = -EOPNOTSUPP;
}
-
return ret;
-
}
#endif
-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 --
+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 --
};
-
-static const iw_handler iwctl_private_handler[] =
-{
- NULL, // SIOCIWFIRSTPRIV
+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"},
+ { 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_private = 0,
- .num_private_args = 0,
- .standard = (iw_handler *) iwctl_handler,
- .private = NULL,
- .private_args = NULL,
+const struct iw_handler_def iwctl_handler_def = {
+ .get_wireless_stats = &iwctl_get_wireless_stats,
+ .num_standard = sizeof(iwctl_handler) / sizeof(iw_handler),
+ .num_private = 0,
+ .num_private_args = 0,
+ .standard = (iw_handler *)iwctl_handler,
+ .private = NULL,
+ .private_args = NULL,
};
diff --git a/drivers/staging/vt6656/iwctl.h b/drivers/staging/vt6656/iwctl.h
index 0c6e0496779b..d056f83a9158 100644
--- a/drivers/staging/vt6656/iwctl.h
+++ b/drivers/staging/vt6656/iwctl.h
@@ -41,173 +41,107 @@
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);
-
-void iwctl_giwrange(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
-
-
-void iwctl_giwmode(struct net_device *dev,
- struct iw_request_info *info,
- __u32 *wmode,
- char *extra);
-
-int iwctl_siwmode(struct net_device *dev,
- struct iw_request_info *info,
- __u32 *wmode,
- char *extra);
-
-int iwctl_giwfreq(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_freq *wrq,
- char *extra);
-
-int iwctl_siwfreq(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_freq *wrq,
- char *extra);
-
-int iwctl_giwname(struct net_device *dev,
- struct iw_request_info *info,
- char *wrq,
- char *extra);
-
-int iwctl_giwsens(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
-
-int iwctl_giwap(struct net_device *dev,
- struct iw_request_info *info,
- struct sockaddr *wrq,
- char *extra);
-
-int iwctl_giwaplist(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
-
-int iwctl_siwessid(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
-
-void iwctl_giwessid(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
-
-int iwctl_siwrate(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
-
-void iwctl_giwrate(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
-
-int iwctl_siwrts(struct net_device *dev,
- struct iw_param *wrq);
-
-int iwctl_giwrts(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
-
-int iwctl_siwfrag(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
-
-int iwctl_giwfrag(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
-
-int iwctl_siwretry(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
-
-int iwctl_giwretry(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
-
-int iwctl_siwencode(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
-
-int iwctl_giwencode(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
-
-int iwctl_siwpower(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
-
-int iwctl_giwpower(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
-
-int iwctl_giwscan(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
-
-int iwctl_siwscan(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+int iwctl_siwap(struct net_device *dev, struct iw_request_info *info,
+ struct sockaddr *wrq, char *extra);
+
+void iwctl_giwrange(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra);
+
+void iwctl_giwmode(struct net_device *dev, struct iw_request_info *info,
+ __u32 *wmode, char *extra);
+
+int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info,
+ __u32 *wmode, char *extra);
+
+int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info,
+ struct iw_freq *wrq, char *extra);
+
+int iwctl_siwfreq(struct net_device *dev, struct iw_request_info *info,
+ struct iw_freq *wrq, char *extra);
+
+int iwctl_giwname(struct net_device *dev, struct iw_request_info *info,
+ char *wrq, char *extra);
+
+int iwctl_giwsens(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra);
+
+int iwctl_giwap(struct net_device *dev, struct iw_request_info *info,
+ struct sockaddr *wrq, char *extra);
+
+int iwctl_giwaplist(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra);
+
+int iwctl_siwessid(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra);
+
+void iwctl_giwessid(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra);
+
+int iwctl_siwrate(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra);
+
+void iwctl_giwrate(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra);
+
+int iwctl_siwrts(struct net_device *dev, struct iw_param *wrq);
+
+int iwctl_giwrts(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra);
+
+int iwctl_siwfrag(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra);
+
+int iwctl_giwfrag(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra);
+
+int iwctl_siwretry(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra);
+
+int iwctl_giwretry(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra);
+
+int iwctl_siwencode(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra);
+
+int iwctl_giwencode(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra);
+
+int iwctl_siwpower(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra);
+
+int iwctl_giwpower(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra);
+
+int iwctl_giwscan(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra);
+
+int iwctl_siwscan(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, 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);
-
-int iwctl_giwauth(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
-
-int iwctl_siwgenie(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
-
-int iwctl_giwgenie(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
-
-int iwctl_siwencodeext(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
-
-int iwctl_giwencodeext(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
-
-int iwctl_siwmlme(struct net_device *dev,
- struct iw_request_info * info,
- struct iw_point *wrq,
- char *extra);
+int iwctl_siwauth(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra);
+
+int iwctl_giwauth(struct net_device *dev, struct iw_request_info *info,
+ struct iw_param *wrq, char *extra);
+
+int iwctl_siwgenie(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra);
+
+int iwctl_giwgenie(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra);
+
+int iwctl_siwencodeext(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, char *extra);
+
+int iwctl_giwencodeext(struct net_device *dev, struct iw_request_info *info,
+ struct iw_point *wrq, 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
-extern const struct iw_handler_def iwctl_handler_def;
-extern const struct iw_priv_args iwctl_private_args;
+extern const struct iw_handler_def iwctl_handler_def;
+extern const struct iw_priv_args iwctl_private_args;
#endif /* __IWCTL_H__ */
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index ee5261a36886..b06fd5b723fa 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -92,22 +92,14 @@ MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM);
module_param_array(N, int, NULL, 0);\
MODULE_PARM_DESC(N, D);
-#define RX_DESC_MIN0 16
-#define RX_DESC_MAX0 128
#define RX_DESC_DEF0 64
DEVICE_PARAM(RxDescriptors0,"Number of receive usb desc buffer");
-#define TX_DESC_MIN0 16
-#define TX_DESC_MAX0 128
#define TX_DESC_DEF0 64
DEVICE_PARAM(TxDescriptors0,"Number of transmit usb desc buffer");
-
-#define CHANNEL_MIN 1
-#define CHANNEL_MAX 14
#define CHANNEL_DEF 6
-
DEVICE_PARAM(Channel, "Channel number");
@@ -120,23 +112,13 @@ DEVICE_PARAM(Channel, "Channel number");
DEVICE_PARAM(PreambleType, "Preamble Type");
-
-#define RTS_THRESH_MIN 512
-#define RTS_THRESH_MAX 2347
#define RTS_THRESH_DEF 2347
-
DEVICE_PARAM(RTSThreshold, "RTS threshold");
-
-#define FRAG_THRESH_MIN 256
-#define FRAG_THRESH_MAX 2346
#define FRAG_THRESH_DEF 2346
-
DEVICE_PARAM(FragThreshold, "Fragmentation threshold");
-#define DATA_RATE_MIN 0
-#define DATA_RATE_MAX 13
#define DATA_RATE_DEF 13
/* datarate[] index
0: indicate 1 Mbps 0x02
@@ -157,10 +139,7 @@ DEVICE_PARAM(FragThreshold, "Fragmentation threshold");
DEVICE_PARAM(ConnectionRate, "Connection data rate");
-#define OP_MODE_MAX 2
#define OP_MODE_DEF 0
-#define OP_MODE_MIN 0
-
DEVICE_PARAM(OPMode, "Infrastruct, adhoc, AP mode ");
/* OpMode[] is used for transmit.
@@ -176,34 +155,22 @@ DEVICE_PARAM(OPMode, "Infrastruct, adhoc, AP mode ");
*/
#define PS_MODE_DEF 0
-
DEVICE_PARAM(PSMode, "Power saving mode");
-#define SHORT_RETRY_MIN 0
-#define SHORT_RETRY_MAX 31
#define SHORT_RETRY_DEF 8
-
-
DEVICE_PARAM(ShortRetryLimit, "Short frame retry limits");
-#define LONG_RETRY_MIN 0
-#define LONG_RETRY_MAX 15
#define LONG_RETRY_DEF 4
-
-
DEVICE_PARAM(LongRetryLimit, "long frame retry limits");
-
/* BasebandType[] baseband type selected
0: indicate 802.11a type
1: indicate 802.11b type
2: indicate 802.11g type
*/
-#define BBP_TYPE_MIN 0
-#define BBP_TYPE_MAX 2
-#define BBP_TYPE_DEF 2
+#define BBP_TYPE_DEF 2
DEVICE_PARAM(BasebandType, "baseband type");
@@ -238,11 +205,6 @@ static const long frequency_list[] = {
};
-#ifndef IW_ENCODE_NOKEY
-#define IW_ENCODE_NOKEY 0x0800
-#define IW_ENCODE_MODE (IW_ENCODE_DISABLED | IW_ENCODE_RESTRICTED | IW_ENCODE_OPEN)
-#endif
-
static const struct iw_handler_def iwctl_handler_def;
*/
diff --git a/drivers/staging/vt6656/mib.h b/drivers/staging/vt6656/mib.h
index a89cca0c5ecf..82d69a9cc209 100644
--- a/drivers/staging/vt6656/mib.h
+++ b/drivers/staging/vt6656/mib.h
@@ -113,7 +113,6 @@ typedef struct tagSMib2Counter {
} SMib2Counter, *PSMib2Counter;
// Value in the ifType entry
-//#define ETHERNETCSMACD 6 //
#define WIRELESSLANIEEE80211b 6 //
// Value in the ifAdminStatus/ifOperStatus entry
diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 9b64b102f55c..bb464527fc1b 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -73,8 +73,6 @@ static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/
/*--------------------- Static Definitions -------------------------*/
-#define CRITICAL_PACKET_LEN 256 // if packet size < 256 -> in-direct send
- // packet size >= 256 -> direct send
const WORD wTimeStampOff[2][MAX_RATE] = {
{384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, // Long Preamble
diff --git a/drivers/staging/vt6656/tether.h b/drivers/staging/vt6656/tether.h
index 4ec05237469b..8c1f5d253f88 100644
--- a/drivers/staging/vt6656/tether.h
+++ b/drivers/staging/vt6656/tether.h
@@ -72,7 +72,6 @@
#define TYPE_CTL_ACK 0xd400
-//#define WEP_IV_MASK 0xFFFFFF00
#else //if LITTLE_ENDIAN
//
@@ -111,7 +110,6 @@
#define TYPE_CTL_ACK 0x00d4
-//#define WEP_IV_MASK 0x00FFFFFF
#endif //#ifdef __BIG_ENDIAN
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index c612ab58f389..609e8fa10b98 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -52,9 +52,6 @@
//endpoint 2: read bulk
//endpoint 3: write bulk
-//RequestType:
-//#define REQUEST_OUT (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE) // 0x40
-//#define REQUEST_IN (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE ) //0xc0
//static int msglevel =MSG_LEVEL_DEBUG;
static int msglevel =MSG_LEVEL_INFO;
diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c
index 78ea121b7e2e..9d2caa819f47 100644
--- a/drivers/staging/vt6656/wcmd.c
+++ b/drivers/staging/vt6656/wcmd.c
@@ -1254,51 +1254,50 @@ static BOOL s_bClearBSSID_SCAN(void *hDeviceContext)
//mike add:reset command timer
void vResetCommandTimer(void *hDeviceContext)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
-
- //delete timer
- del_timer(&pDevice->sTimerCommand);
- //init timer
- init_timer(&pDevice->sTimerCommand);
- pDevice->sTimerCommand.data = (unsigned long)pDevice;
- pDevice->sTimerCommand.function = (TimerFunction)vRunCommand;
- pDevice->sTimerCommand.expires = RUN_AT(HZ);
- pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
- pDevice->uCmdDequeueIdx = 0;
- pDevice->uCmdEnqueueIdx = 0;
- pDevice->eCommandState = WLAN_CMD_IDLE;
- pDevice->bCmdRunning = FALSE;
- pDevice->bCmdClear = FALSE;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+
+ //delete timer
+ del_timer(&pDevice->sTimerCommand);
+ //init timer
+ init_timer(&pDevice->sTimerCommand);
+ pDevice->sTimerCommand.data = (unsigned long)pDevice;
+ pDevice->sTimerCommand.function = (TimerFunction)vRunCommand;
+ pDevice->sTimerCommand.expires = RUN_AT(HZ);
+ pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
+ pDevice->uCmdDequeueIdx = 0;
+ pDevice->uCmdEnqueueIdx = 0;
+ pDevice->eCommandState = WLAN_CMD_IDLE;
+ pDevice->bCmdRunning = FALSE;
+ pDevice->bCmdClear = FALSE;
}
void BSSvSecondTxData(void *hDeviceContext)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
-
- pDevice->nTxDataTimeCout++;
-
- if(pDevice->nTxDataTimeCout<4) //don't tx data if timer less than 40s
- {
- // printk("mike:%s-->no data Tx not exceed the desired Time as %d\n",__FUNCTION__,
- // (int)pDevice->nTxDataTimeCout);
- pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
- add_timer(&pDevice->sTimerTxData);
- return;
- }
-
- spin_lock_irq(&pDevice->lock);
- //is wap_supplicant running successful OR only open && sharekey mode!
- if(((pDevice->bLinkPass ==TRUE)&&(pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking
- (pDevice->fWPA_Authened == TRUE)) { //wpa linking
- // printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__);
- pDevice->fTxDataInSleep = TRUE;
- PSbSendNullPacket(pDevice); //send null packet
- pDevice->fTxDataInSleep = FALSE;
- }
- spin_unlock_irq(&pDevice->lock);
-
- pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
- add_timer(&pDevice->sTimerTxData);
- return;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+
+ pDevice->nTxDataTimeCout++;
+
+ if (pDevice->nTxDataTimeCout < 4) { //don't tx data if timer less than 40s
+ // printk("mike:%s-->no data Tx not exceed the desired Time as %d\n",__FUNCTION__,
+ // (int)pDevice->nTxDataTimeCout);
+ pDevice->sTimerTxData.expires = RUN_AT(10 * HZ); //10s callback
+ add_timer(&pDevice->sTimerTxData);
+ return;
+ }
+
+ spin_lock_irq(&pDevice->lock);
+ //is wap_supplicant running successful OR only open && sharekey mode!
+ if (((pDevice->bLinkPass == TRUE) &&
+ (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking
+ (pDevice->fWPA_Authened == TRUE)) { //wpa linking
+ // printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__);
+ pDevice->fTxDataInSleep = TRUE;
+ PSbSendNullPacket(pDevice); //send null packet
+ pDevice->fTxDataInSleep = FALSE;
+ }
+ spin_unlock_irq(&pDevice->lock);
+
+ pDevice->sTimerTxData.expires = RUN_AT(10 * HZ); //10s callback
+ add_timer(&pDevice->sTimerTxData);
}