* [PATCH 0/7] vt6655: Cleanup of checkpatch errors
@ 2013-12-30 14:52 Michael Gunselmann
2013-12-30 14:52 ` [PATCH 1/7] vt6655: Remove unused macros in 80211hdr.h Michael Gunselmann
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Michael Gunselmann @ 2013-12-30 14:52 UTC (permalink / raw)
To: michael.gunselmann
Cc: martin.hofmann, forest, gregkh, devel, linux-kernel, linux-kernel
This patch series cleans up all checkpatch errors and some warnings
in some files of the vt6655 driver in staging.
The reference git tree is linux-next.
Some checkpatch warnings were not fixed, they are commented in the
particular patches.
Not all files of the driver were cleaned up in this patch series.
The patches should not incorporate functional changes.
--
1.8.1.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/7] vt6655: Remove unused macros in 80211hdr.h
2013-12-30 14:52 [PATCH 0/7] vt6655: Cleanup of checkpatch errors Michael Gunselmann
@ 2013-12-30 14:52 ` Michael Gunselmann
2013-12-31 16:55 ` Dan Carpenter
2013-12-30 14:52 ` [PATCH 2/7] vt6655: Fix most of checkpatch.pl errors in wroute Michael Gunselmann
` (5 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Michael Gunselmann @ 2013-12-30 14:52 UTC (permalink / raw)
To: michael.gunselmann
Cc: martin.hofmann, forest, gregkh, devel, linux-kernel, linux-kernel
From: Martin Hofmann <martin.hofmann@studium.uni-erlangen.de>
The file 80211hdr.h contained 4 macros (in both little and big endain fashion)
that were not used in the driver. Thus, this patch removes them.
Signed-off-by: Martin Hofmann <martin.hofmann@studium.uni-erlangen.de>
Signed-off-by: Michael Gunselmann <michael.gunselmann@studium.uni-erlangen.de>
---
drivers/staging/vt6655/80211hdr.h | 8 --------
1 file changed, 8 deletions(-)
diff --git a/drivers/staging/vt6655/80211hdr.h b/drivers/staging/vt6655/80211hdr.h
index ba53340..cacf137 100644
--- a/drivers/staging/vt6655/80211hdr.h
+++ b/drivers/staging/vt6655/80211hdr.h
@@ -155,17 +155,13 @@
#ifdef __BIG_ENDIAN
/* GET & SET Frame Control bit */
-#define WLAN_GET_FC_PRVER(n) ((((unsigned short)(n) >> 8) & (BIT0 | BIT1))
#define WLAN_GET_FC_FTYPE(n) ((((unsigned short)(n) >> 8) & (BIT2 | BIT3)) >> 2)
#define WLAN_GET_FC_FSTYPE(n) ((((unsigned short)(n) >> 8) & (BIT4|BIT5|BIT6|BIT7)) >> 4)
#define WLAN_GET_FC_TODS(n) ((((unsigned short)(n) << 8) & (BIT8)) >> 8)
#define WLAN_GET_FC_FROMDS(n) ((((unsigned short)(n) << 8) & (BIT9)) >> 9)
#define WLAN_GET_FC_MOREFRAG(n) ((((unsigned short)(n) << 8) & (BIT10)) >> 10)
-#define WLAN_GET_FC_RETRY(n) ((((unsigned short)(n) << 8) & (BIT11)) >> 11)
#define WLAN_GET_FC_PWRMGT(n) ((((unsigned short)(n) << 8) & (BIT12)) >> 12)
-#define WLAN_GET_FC_MOREDATA(n) ((((unsigned short)(n) << 8) & (BIT13)) >> 13)
#define WLAN_GET_FC_ISWEP(n) ((((unsigned short)(n) << 8) & (BIT14)) >> 14)
-#define WLAN_GET_FC_ORDER(n) ((((unsigned short)(n) << 8) & (BIT15)) >> 15)
/* Sequence Field bit */
#define WLAN_GET_SEQ_FRGNUM(n) (((unsigned short)(n) >> 8) & (BIT0|BIT1|BIT2|BIT3))
@@ -188,17 +184,13 @@
#else
/* GET & SET Frame Control bit */
-#define WLAN_GET_FC_PRVER(n) (((unsigned short)(n)) & (BIT0 | BIT1))
#define WLAN_GET_FC_FTYPE(n) ((((unsigned short)(n)) & (BIT2 | BIT3)) >> 2)
#define WLAN_GET_FC_FSTYPE(n) ((((unsigned short)(n)) & (BIT4|BIT5|BIT6|BIT7)) >> 4)
#define WLAN_GET_FC_TODS(n) ((((unsigned short)(n)) & (BIT8)) >> 8)
#define WLAN_GET_FC_FROMDS(n) ((((unsigned short)(n)) & (BIT9)) >> 9)
#define WLAN_GET_FC_MOREFRAG(n) ((((unsigned short)(n)) & (BIT10)) >> 10)
-#define WLAN_GET_FC_RETRY(n) ((((unsigned short)(n)) & (BIT11)) >> 11)
#define WLAN_GET_FC_PWRMGT(n) ((((unsigned short)(n)) & (BIT12)) >> 12)
-#define WLAN_GET_FC_MOREDATA(n) ((((unsigned short)(n)) & (BIT13)) >> 13)
#define WLAN_GET_FC_ISWEP(n) ((((unsigned short)(n)) & (BIT14)) >> 14)
-#define WLAN_GET_FC_ORDER(n) ((((unsigned short)(n)) & (BIT15)) >> 15)
/* Sequence Field bit */
#define WLAN_GET_SEQ_FRGNUM(n) (((unsigned short)(n)) & (BIT0|BIT1|BIT2|BIT3))
--
1.8.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/7] vt6655: Fix most of checkpatch.pl errors in wroute
2013-12-30 14:52 [PATCH 0/7] vt6655: Cleanup of checkpatch errors Michael Gunselmann
2013-12-30 14:52 ` [PATCH 1/7] vt6655: Remove unused macros in 80211hdr.h Michael Gunselmann
@ 2013-12-30 14:52 ` Michael Gunselmann
2013-12-31 11:12 ` Dan Carpenter
2013-12-30 14:52 ` [PATCH 3/7] vt6655: Fixed most of the checkpatch warnings in wpactl Michael Gunselmann
` (4 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Michael Gunselmann @ 2013-12-30 14:52 UTC (permalink / raw)
To: michael.gunselmann
Cc: martin.hofmann, forest, gregkh, devel, linux-kernel, linux-kernel
wroute.h: Fixed all line-over-80-character errors. No errors remain.
wroute.c: Fixed line-over-80-character errors, bracing errors
and C99-comments.
Three warnings remain, fixing them would deteriorate readability.
One warning on a memory barrier without comment in line 189
will be fixed in a later commit because it's purpose is not
yet known.
Signed-off-by: Michael Gunselmann <michael.gunselmann@studium.uni-erlangen.de>
Signed-off-by: Martin Hofmann <martin.hofmann@studium.uni-erlangen.de>
---
drivers/staging/vt6655/wroute.c | 71 ++++++++++++++++++++++++-----------------
drivers/staging/vt6655/wroute.h | 3 +-
2 files changed, 44 insertions(+), 30 deletions(-)
diff --git a/drivers/staging/vt6655/wroute.c b/drivers/staging/vt6655/wroute.c
index 85302c5..f8899b6 100644
--- a/drivers/staging/vt6655/wroute.c
+++ b/drivers/staging/vt6655/wroute.c
@@ -44,7 +44,7 @@
/*--------------------- Static Variables --------------------------*/
static int msglevel = MSG_LEVEL_INFO;
-//static int msglevel =MSG_LEVEL_DEBUG;
+/* static int msglevel =MSG_LEVEL_DEBUG; */
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
@@ -63,7 +63,8 @@ static int msglevel = MSG_LEVEL_INFO;
* Return Value: true if packet duplicate; otherwise false
*
*/
-bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uDataLen, unsigned int uNodeIndex)
+bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData,
+ unsigned int uDataLen, unsigned int uNodeIndex)
{
PSMgmtObject pMgmt = pDevice->pMgmt;
PSTxDesc pHeadTD, pLastTD;
@@ -78,7 +79,8 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uData
unsigned char *pbyBSSID;
if (AVAIL_TD(pDevice, TYPE_AC0DMA) <= 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Relay can't allocate TD1..\n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Relay can't allocate TD1..\n");
return false;
}
@@ -86,22 +88,25 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uData
pHeadTD->m_td1TD1.byTCR = (TCR_EDP | TCR_STP);
- memcpy(pDevice->sTxEthHeader.abyDstAddr, (unsigned char *)pbySkbData, ETH_HLEN);
+ memcpy(pDevice->sTxEthHeader.abyDstAddr,
+ (unsigned char *)pbySkbData, ETH_HLEN);
cbFrameBodySize = uDataLen - ETH_HLEN;
- if (ntohs(pDevice->sTxEthHeader.wType) > ETH_DATA_LEN) {
+ if (ntohs(pDevice->sTxEthHeader.wType) > ETH_DATA_LEN)
cbFrameBodySize += 8;
- }
if (pDevice->bEncryptionEnable == true) {
bNeedEncryption = true;
- // get group key
+ /* get group key */
pbyBSSID = pDevice->abyBroadcastAddr;
- if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID, GROUP_KEY, &pTransmitKey) == false) {
+ if (KeybGetTransmitKey(&(pDevice->sKey), pbyBSSID,
+ GROUP_KEY, &pTransmitKey) == false) {
pTransmitKey = NULL;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG
+ "KEY is NULL. [%d]\n",
+ pDevice->pMgmt->eCurrMode);
} else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "Get GTK.\n");
}
@@ -110,11 +115,16 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uData
if (pDevice->bEnableHostWEP) {
if (uNodeIndex < MAX_NODE_NUM + 1) {
pTransmitKey = &STempKey;
- pTransmitKey->byCipherSuite = pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite;
- pTransmitKey->dwKeyIndex = pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex;
- pTransmitKey->uKeyLength = pMgmt->sNodeDBTable[uNodeIndex].uWepKeyLength;
- pTransmitKey->dwTSC47_16 = pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16;
- pTransmitKey->wTSC15_0 = pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0;
+ pTransmitKey->byCipherSuite =
+ pMgmt->sNodeDBTable[uNodeIndex].byCipherSuite;
+ pTransmitKey->dwKeyIndex =
+ pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex;
+ pTransmitKey->uKeyLength =
+ pMgmt->sNodeDBTable[uNodeIndex].uWepKeyLength;
+ pTransmitKey->dwTSC47_16 =
+ pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16;
+ pTransmitKey->wTSC15_0 =
+ pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0;
memcpy(pTransmitKey->abyKey,
&pMgmt->sNodeDBTable[uNodeIndex].abyWepKey[0],
pTransmitKey->uKeyLength
@@ -122,20 +132,21 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uData
}
}
- uMACfragNum = cbGetFragCount(pDevice, pTransmitKey, cbFrameBodySize, &pDevice->sTxEthHeader);
+ uMACfragNum = cbGetFragCount(pDevice, pTransmitKey,
+ cbFrameBodySize,
+ &pDevice->sTxEthHeader);
- if (uMACfragNum > AVAIL_TD(pDevice, TYPE_AC0DMA)) {
+ if (uMACfragNum > AVAIL_TD(pDevice, TYPE_AC0DMA))
return false;
- }
byPktType = (unsigned char)pDevice->byPacketType;
if (pDevice->bFixRate) {
if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
- if (pDevice->uConnectionRate >= RATE_11M) {
+ if (pDevice->uConnectionRate >= RATE_11M)
pDevice->wCurrentRate = RATE_11M;
- } else {
- pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
- }
+ else
+ pDevice->wCurrentRate =
+ (unsigned short)pDevice->uConnectionRate;
} else {
if ((pDevice->eCurrentPHYType == PHY_TYPE_11A) &&
(pDevice->uConnectionRate <= RATE_6M)) {
@@ -144,25 +155,27 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uData
if (pDevice->uConnectionRate >= RATE_54M)
pDevice->wCurrentRate = RATE_54M;
else
- pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
+ pDevice->wCurrentRate =
+ (unsigned short)pDevice->uConnectionRate;
}
}
} else {
- pDevice->wCurrentRate = pDevice->pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate;
+ pDevice->wCurrentRate =
+ pDevice->pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate;
}
if (pDevice->wCurrentRate <= RATE_11M)
byPktType = PK_TYPE_11B;
- vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, bNeedEncryption,
- cbFrameBodySize, TYPE_AC0DMA, pHeadTD,
- &pDevice->sTxEthHeader, pbySkbData, pTransmitKey, uNodeIndex,
- &uMACfragNum,
+ vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff,
+ bNeedEncryption, cbFrameBodySize, TYPE_AC0DMA,
+ pHeadTD, &pDevice->sTxEthHeader, pbySkbData,
+ pTransmitKey, uNodeIndex, &uMACfragNum,
&cbHeaderSize
);
if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) {
- // Disable PS
+ /* Disable PS */
MACbPSWakeup(pDevice->PortOffset);
}
@@ -170,7 +183,7 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uData
pLastTD = pHeadTD;
for (ii = 0; ii < uMACfragNum; ii++) {
- // Poll Transmit the adapter
+ /* Poll Transmit the adapter */
wmb();
pHeadTD->m_td0TD0.f1Owner = OWNED_BY_NIC;
wmb();
diff --git a/drivers/staging/vt6655/wroute.h b/drivers/staging/vt6655/wroute.h
index 3abc1d3..b4faafe 100644
--- a/drivers/staging/vt6655/wroute.h
+++ b/drivers/staging/vt6655/wroute.h
@@ -39,6 +39,7 @@
/*--------------------- Export Functions --------------------------*/
-bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uDataLen, unsigned int uNodeIndex);
+bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData,
+ unsigned int uDataLen, unsigned int uNodeIndex);
#endif /* __WROUTE_H__ */
--
1.8.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/7] vt6655: Fixed most of the checkpatch warnings in wpactl
2013-12-30 14:52 [PATCH 0/7] vt6655: Cleanup of checkpatch errors Michael Gunselmann
2013-12-30 14:52 ` [PATCH 1/7] vt6655: Remove unused macros in 80211hdr.h Michael Gunselmann
2013-12-30 14:52 ` [PATCH 2/7] vt6655: Fix most of checkpatch.pl errors in wroute Michael Gunselmann
@ 2013-12-30 14:52 ` Michael Gunselmann
2013-12-30 14:52 ` [PATCH 4/7] vt6655: Fixed most of the checkpatch warnings in wpa2 Michael Gunselmann
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Michael Gunselmann @ 2013-12-30 14:52 UTC (permalink / raw)
To: michael.gunselmann
Cc: martin.hofmann, forest, gregkh, devel, linux-kernel, linux-kernel
wpactl.h: Checkpatch does no longer complain about anything
wpactl.c: The following errors and warnings remain:
ERROR: need consistens spacing around '&'
in line 364, 372 and 411
This is okay, 'cause we need pointers to
the corresponding variables.
WARNING: Prefer netdev_err [...] to printk
This is also okay, 'cause we check if
kmalloc failed or not. This is not a
device-related error.
hostap.c and iwctl.c:
wpactl.h used the typedef statement, which was removed while
fixing checkpatch-errors. For this to work one statement in
hostap.c was adjusted.
The ckecpatch cleanup of these two files still remains.
Signed-off-by: Michael Gunselmann <michael.gunselmann@studium.uni-erlangen.de>
Signed-off-by: Martin Hofmann <martin.hofmann@studium.uni-erlangen.de>
---
drivers/staging/vt6655/hostap.c | 2 +-
drivers/staging/vt6655/iwctl.c | 2 +-
drivers/staging/vt6655/wpactl.c | 300 ++++++++++++++++++++++++----------------
drivers/staging/vt6655/wpactl.h | 16 +--
4 files changed, 190 insertions(+), 130 deletions(-)
diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c
index ca54b79..6eecd53 100644
--- a/drivers/staging/vt6655/hostap.c
+++ b/drivers/staging/vt6655/hostap.c
@@ -454,7 +454,7 @@ static int hostap_set_encryption(PSDevice pDevice,
unsigned long dwKeyIndex = 0;
unsigned char abyKey[MAX_KEY_LEN];
unsigned char abySeq[MAX_KEY_LEN];
- NDIS_802_11_KEY_RSC KeyRSC;
+ unsigned long long KeyRSC;
unsigned char byKeyDecMode = KEY_CTL_WEP;
int ret = 0;
int iNodeIndex = -1;
diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
index 2db4bc8..ac3fc16 100644
--- a/drivers/staging/vt6655/iwctl.c
+++ b/drivers/staging/vt6655/iwctl.c
@@ -1827,7 +1827,7 @@ int iwctl_siwencodeext(struct net_device *dev,
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
struct viawget_wpa_param *param = NULL;
//original member
- wpa_alg alg_name;
+ enum wpa_alg alg_name;
u8 addr[6];
int key_idx, set_tx = 0;
u8 seq[IW_ENCODE_SEQ_MAX_SIZE];
diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c
index ee83704..41e9933 100644
--- a/drivers/staging/vt6655/wpactl.c
+++ b/drivers/staging/vt6655/wpactl.c
@@ -51,7 +51,7 @@ static const int frequency_list[] = {
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
-//static int msglevel =MSG_LEVEL_DEBUG;
+/* static int msglevel =MSG_LEVEL_DEBUG; */
static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/
@@ -90,7 +90,8 @@ static int wpa_init_wpadev(PSDevice pDevice)
struct net_device *dev = pDevice->dev;
int ret = 0;
- pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa", wpadev_setup);
+ pDevice->wpadev =
+ alloc_netdev(sizeof(PSDevice), "vntwpa", wpadev_setup);
if (pDevice->wpadev == NULL)
return -ENOMEM;
@@ -103,7 +104,8 @@ static int wpa_init_wpadev(PSDevice pDevice)
pDevice->wpadev->mem_end = dev->mem_end;
ret = register_netdev(pDevice->wpadev);
if (ret) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdev(WPA) failed!\n",
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "%s: register_netdev(WPA) failed!\n",
dev->name);
free_netdev(pDevice->wpadev);
return -1;
@@ -115,7 +117,8 @@ static int wpa_init_wpadev(PSDevice pDevice)
return -ENOMEM;
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdev %s for WPA management\n",
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "%s: Registered netdev %s for WPA management\n",
dev->name, pDevice->wpadev->name);
return 0;
@@ -142,7 +145,8 @@ static int wpa_release_wpadev(PSDevice pDevice)
}
if (pDevice->wpadev) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n",
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "%s: Netdevice %s unregistered\n",
pDevice->dev->name, pDevice->wpadev->name);
unregister_netdev(pDevice->wpadev);
free_netdev(pDevice->wpadev);
@@ -196,7 +200,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel)
unsigned char abyKey[MAX_KEY_LEN];
unsigned char abySeq[MAX_KEY_LEN];
QWORD KeyRSC;
-// NDIS_802_11_KEY_RSC KeyRSC;
+/* NDIS_802_11_KEY_RSC KeyRSC; */
unsigned char byKeyDecMode = KEY_CTL_WEP;
int ret = 0;
int uu, ii;
@@ -206,26 +210,29 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel)
param->u.wpa_key.seq_len >= MAX_KEY_LEN)
return -EINVAL;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "param->u.wpa_key.alg_name = %d \n", param->u.wpa_key.alg_name);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "param->u.wpa_key.alg_name = %d\n",
+ param->u.wpa_key.alg_name);
if (param->u.wpa_key.alg_name == WPA_ALG_NONE) {
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
pDevice->bEncryptionEnable = false;
pDevice->byKeyIndex = 0;
pDevice->bTransmitKey = false;
KeyvRemoveAllWEPKey(&(pDevice->sKey), pDevice->PortOffset);
- for (uu = 0; uu < MAX_KEY_TABLE; uu++) {
+ for (uu = 0; uu < MAX_KEY_TABLE; uu++)
MACvDisableKeyEntry(pDevice->PortOffset, uu);
- }
return ret;
}
- //spin_unlock_irq(&pDevice->lock);
+ /* spin_unlock_irq(&pDevice->lock); */
if (param->u.wpa_key.key && fcpfkernel) {
- memcpy(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len);
+ memcpy(&abyKey[0], param->u.wpa_key.key,
+ param->u.wpa_key.key_len);
} else {
spin_unlock_irq(&pDevice->lock);
if (param->u.wpa_key.key &&
- copy_from_user(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len)) {
+ copy_from_user(&abyKey[0], param->u.wpa_key.key,
+ param->u.wpa_key.key_len)) {
spin_lock_irq(&pDevice->lock);
return -EINVAL;
}
@@ -258,13 +265,15 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel)
return ret;
}
- //spin_unlock_irq(&pDevice->lock);
+ /* spin_unlock_irq(&pDevice->lock); */
if (param->u.wpa_key.seq && fcpfkernel) {
- memcpy(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len);
+ memcpy(&abySeq[0], param->u.wpa_key.seq,
+ param->u.wpa_key.seq_len);
} else {
spin_unlock_irq(&pDevice->lock);
if (param->u.wpa_key.seq &&
- copy_from_user(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len)) {
+ copy_from_user(&abySeq[0], param->u.wpa_key.seq,
+ param->u.wpa_key.seq_len)) {
spin_lock_irq(&pDevice->lock);
return -EINVAL;
}
@@ -277,7 +286,7 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel)
LODWORD(KeyRSC) |= (abySeq[ii] << (ii * 8));
else
HIDWORD(KeyRSC) |= (abySeq[ii] << ((ii-4) * 8));
- //KeyRSC |= (abySeq[ii] << (ii * 8));
+ /* KeyRSC |= (abySeq[ii] << (ii * 8)); */
}
dwKeyIndex |= 1 << 29;
}
@@ -287,13 +296,11 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel)
return -EINVAL;
}
- if (param->u.wpa_key.alg_name == WPA_ALG_TKIP) {
+ if (param->u.wpa_key.alg_name == WPA_ALG_TKIP)
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
- }
- if (param->u.wpa_key.alg_name == WPA_ALG_CCMP) {
+ if (param->u.wpa_key.alg_name == WPA_ALG_CCMP)
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
- }
if (param->u.wpa_key.set_tx)
dwKeyIndex |= (1 << 31);
@@ -305,7 +312,9 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel)
else
byKeyDecMode = KEY_CTL_WEP;
- // Fix HCT test that set 256 bits KEY and Ndis802_11Encryption3Enabled
+ /* Fix HCT test that set 256 bits KEY
+ * and Ndis802_11Encryption3Enabled
+ */
if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
if (param->u.wpa_key.key_len == MAX_KEY_LEN)
byKeyDecMode = KEY_CTL_TKIP;
@@ -320,102 +329,120 @@ int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel)
byKeyDecMode = KEY_CTL_WEP;
}
- // Check TKIP key length
+ /* Check TKIP key length */
if ((byKeyDecMode == KEY_CTL_TKIP) &&
(param->u.wpa_key.key_len != MAX_KEY_LEN)) {
- // TKIP Key must be 256 bits
- //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA - TKIP Key must be 256 bits\n"));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return- TKIP Key must be 256 bits!\n");
+ /* TKIP Key must be 256 bits
+ * DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA
+ * TKIP Key must be 256 bits\n"));
+ */
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "return- TKIP Key must be 256 bits!\n");
return -EINVAL;
}
- // Check AES key length
+ /* Check AES key length */
if ((byKeyDecMode == KEY_CTL_CCMP) &&
(param->u.wpa_key.key_len != AES_KEY_LEN)) {
- // AES Key must be 128 bits
- //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA - AES Key must be 128 bits\n"));
+ /* AES Key must be 128 bits
+ * DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA
+ * AES Key must be 128 bits\n"));
+ */
return -EINVAL;
}
- // spin_lock_irq(&pDevice->lock);
+ /* spin_lock_irq(&pDevice->lock); */
if (is_broadcast_ether_addr(¶m->addr[0]) || (param->addr == NULL)) {
- // If is_broadcast_ether_addr, set the key as every key entry's group key.
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Groupe Key Assign.\n");
+ /* If is_broadcast_ether_addr,
+ * set the key as every key entry's group key.
+ */
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Groupe Key Assign.\n");
if (KeybSetAllGroupKey(&(pDevice->sKey),
dwKeyIndex,
param->u.wpa_key.key_len,
- (PQWORD) &(KeyRSC),
- (unsigned char *)abyKey,
+ (PQWORD) &KeyRSC,
+ (unsigned char *) abyKey,
byKeyDecMode,
pDevice->PortOffset,
pDevice->byLocalID) &&
KeybSetDefaultKey(&(pDevice->sKey),
dwKeyIndex,
param->u.wpa_key.key_len,
- (PQWORD) &(KeyRSC),
- (unsigned char *)abyKey,
+ (PQWORD) &KeyRSC,
+ (unsigned char *) abyKey,
byKeyDecMode,
pDevice->PortOffset,
pDevice->byLocalID)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP Key Assign.\n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "GROUP Key Assign.\n");
} else {
- //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA -KeybSetDefaultKey Fail.0\n"));
- // spin_unlock_irq(&pDevice->lock);
+ /* DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA
+ * -KeybSetDefaultKey Fail.0\n"));
+ * spin_unlock_irq(&pDevice->lock);
+ */
return -EINVAL;
}
} else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Assign.\n");
- // BSSID not 0xffffffffffff
- // Pairwise Key can't be WEP
+ /* BSSID not 0xffffffffffff
+ Pairwise Key can't be WEP */
if (byKeyDecMode == KEY_CTL_WEP) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key can't be WEP\n");
- //spin_unlock_irq(&pDevice->lock);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Pairwise Key can't be WEP\n");
+ /* spin_unlock_irq(&pDevice->lock); */
return -EINVAL;
}
- dwKeyIndex |= (1 << 30); // set pairwise key
+ dwKeyIndex |= (1 << 30); /* set pairwise key */
if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) {
- //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA - WMAC_CONFIG_IBSS_STA\n"));
- //spin_unlock_irq(&pDevice->lock);
+ /* DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA
+ * WMAC_CONFIG_IBSS_STA\n"));
+ * spin_unlock_irq(&pDevice->lock);
+ */
return -EINVAL;
}
if (KeybSetKey(&(pDevice->sKey),
¶m->addr[0],
dwKeyIndex,
param->u.wpa_key.key_len,
- (PQWORD) &(KeyRSC),
- (unsigned char *)abyKey,
+ (PQWORD) &KeyRSC,
+ (unsigned char *) abyKey,
byKeyDecMode,
pDevice->PortOffset,
pDevice->byLocalID)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Pairwise Key Set\n");
} else {
- // Key Table Full
+ /* Key Table Full */
if (ether_addr_equal(param->addr, pDevice->abyBSSID)) {
- //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA -Key Table Full.2\n"));
- //spin_unlock_irq(&pDevice->lock);
+ /* DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA
+ * -Key Table Full.2\n"));
+ * spin_unlock_irq(&pDevice->lock); */
return -EINVAL;
} else {
- // Save Key and configure just before associate/reassociate to BSSID
- // we do not implement now
- //spin_unlock_irq(&pDevice->lock);
+ /* Save Key and configure just before
+ * associate/reassociate
+ * to BSSID we do not implement now
+ * spin_unlock_irq(&pDevice->lock);
+ */
return -EINVAL;
}
}
- } // BSSID not 0xffffffffffff
+ } /* BSSID not 0xffffffffffff */
if ((ret == 0) && ((param->u.wpa_key.set_tx) != 0)) {
pDevice->byKeyIndex = (unsigned char)param->u.wpa_key.key_index;
pDevice->bTransmitKey = true;
}
pDevice->bEncryptionEnable = true;
- //spin_unlock_irq(&pDevice->lock);
+ /*spin_unlock_irq(&pDevice->lock); */
/*
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx \n",
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx\n",
pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][0],
pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][1],
pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][2],
@@ -476,7 +503,8 @@ static int wpa_set_disassociate(PSDevice pDevice,
spin_lock_irq(&pDevice->lock);
if (pDevice->bLinkPass) {
if (!memcmp(param->addr, pMgmt->abyCurrBSSID, 6))
- bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
+ bScheduleCommand((void *)pDevice,
+ WLAN_CMD_DISASSOCIATE, NULL);
}
spin_unlock_irq(&pDevice->lock);
@@ -558,7 +586,8 @@ static int wpa_get_ssid(PSDevice pDevice,
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
- memcpy(param->u.wpa_associate.ssid, pItemSSID->abySSID , pItemSSID->len);
+ memcpy(param->u.wpa_associate.ssid, pItemSSID->abySSID,
+ pItemSSID->len);
param->u.wpa_associate.ssid_len = pItemSSID->len;
return ret;
@@ -596,7 +625,7 @@ static int wpa_get_scan(PSDevice pDevice,
ptempBSS = kmalloc(sizeof(KnownBSS), (int)GFP_ATOMIC);
if (ptempBSS == NULL) {
- printk("bubble sort kmalloc memory fail@@@\n");
+ printk(KERN_ERR "bubble sort kmalloc memory fail@@@\n");
ret = -ENOMEM;
@@ -606,14 +635,18 @@ static int wpa_get_scan(PSDevice pDevice,
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
for (jj = 0; jj < MAX_BSS_NUM - ii - 1; jj++) {
- if ((pMgmt->sBSSList[jj].bActive != true) ||
+ if ((pMgmt->sBSSList[jj].bActive != true)
+ || ((pMgmt->sBSSList[jj].uRSSI > pMgmt->sBSSList[jj + 1].uRSSI)
+ && (pMgmt->sBSSList[jj + 1].bActive != false))) {
+ memcpy(ptempBSS, &pMgmt->sBSSList[jj],
+ sizeof(KnownBSS));
- ((pMgmt->sBSSList[jj].uRSSI > pMgmt->sBSSList[jj + 1].uRSSI) && (pMgmt->sBSSList[jj + 1].bActive != false))) {
- memcpy(ptempBSS, &pMgmt->sBSSList[jj], sizeof(KnownBSS));
+ memcpy(&pMgmt->sBSSList[jj],
+ &pMgmt->sBSSList[jj + 1],
+ sizeof(KnownBSS));
- memcpy(&pMgmt->sBSSList[jj], &pMgmt->sBSSList[jj + 1], sizeof(KnownBSS));
-
- memcpy(&pMgmt->sBSSList[jj + 1], ptempBSS, sizeof(KnownBSS));
+ memcpy(&pMgmt->sBSSList[jj + 1], ptempBSS,
+ sizeof(KnownBSS));
}
@@ -624,7 +657,7 @@ static int wpa_get_scan(PSDevice pDevice,
kfree(ptempBSS);
#endif
-//******mike:bubble sort by stronger RSSI*****//
+/******mike:bubble sort by stronger RSSI*****/
count = 0;
pBSS = &(pMgmt->sBSSList[0]);
@@ -635,7 +668,8 @@ static int wpa_get_scan(PSDevice pDevice,
count++;
}
- pBuf = kcalloc(count, sizeof(struct viawget_scan_result), (int)GFP_ATOMIC);
+ pBuf = kcalloc(count, sizeof(struct viawget_scan_result),
+ (int)GFP_ATOMIC);
if (pBuf == NULL) {
ret = -ENOMEM;
@@ -650,24 +684,29 @@ static int wpa_get_scan(PSDevice pDevice,
break;
memcpy(scan_buf->bssid, pBSS->abyBSSID, WLAN_BSSID_LEN);
pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
- memcpy(scan_buf->ssid, pItemSSID->abySSID, pItemSSID->len);
+ memcpy(scan_buf->ssid, pItemSSID->abySSID,
+ pItemSSID->len);
scan_buf->ssid_len = pItemSSID->len;
scan_buf->freq = frequency_list[pBSS->uChannel-1];
scan_buf->caps = pBSS->wCapInfo;
- //scan_buf->caps = pBSS->wCapInfo;
- //scan_buf->qual =
- //scan_buf->noise =
- //scan_buf->level =
- //scan_buf->maxrate =
+ /*scan_buf->caps = pBSS->wCapInfo;
+ *scan_buf->qual =
+ *scan_buf->noise =
+ *scan_buf->level =
+ *scan_buf->maxrate =
+ */
if (pBSS->wWPALen != 0) {
scan_buf->wpa_ie_len = pBSS->wWPALen;
- memcpy(scan_buf->wpa_ie, pBSS->byWPAIE, pBSS->wWPALen);
+ memcpy(scan_buf->wpa_ie, pBSS->byWPAIE,
+ pBSS->wWPALen);
}
if (pBSS->wRSNLen != 0) {
scan_buf->rsn_ie_len = pBSS->wRSNLen;
- memcpy(scan_buf->rsn_ie, pBSS->byRSNIE, pBSS->wRSNLen);
+ memcpy(scan_buf->rsn_ie, pBSS->byRSNIE,
+ pBSS->wRSNLen);
}
- scan_buf = (struct viawget_scan_result *)((unsigned char *)scan_buf + sizeof(struct viawget_scan_result));
+ scan_buf = (struct viawget_scan_result *)((unsigned char *)scan_buf
+ + sizeof(struct viawget_scan_result));
jj++;
}
}
@@ -675,9 +714,9 @@ static int wpa_get_scan(PSDevice pDevice,
if (jj < count)
count = jj;
- if (copy_to_user(param->u.scan_results.buf, pBuf, sizeof(struct viawget_scan_result) * count)) {
+ if (copy_to_user(param->u.scan_results.buf, pBuf,
+ sizeof(struct viawget_scan_result) * count))
ret = -EFAULT;
- }
param->u.scan_results.scan_count = count;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " param->u.scan_results.scan_count = %d\n", count)
@@ -709,20 +748,27 @@ static int wpa_set_associate(PSDevice pDevice,
int ret = 0;
bool bWepEnabled = false;
- // set key type & algorithm
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise_suite = %d\n", param->u.wpa_associate.pairwise_suite);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group_suite = %d\n", param->u.wpa_associate.group_suite);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key_mgmt_suite = %d\n", param->u.wpa_associate.key_mgmt_suite);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "auth_alg = %d\n", param->u.wpa_associate.auth_alg);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n", param->u.wpa_associate.mode);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len);
+ /* set key type & algorithm */
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise_suite = %d\n",
+ param->u.wpa_associate.pairwise_suite);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group_suite = %d\n",
+ param->u.wpa_associate.group_suite);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key_mgmt_suite = %d\n",
+ param->u.wpa_associate.key_mgmt_suite);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "auth_alg = %d\n",
+ param->u.wpa_associate.auth_alg);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n",
+ param->u.wpa_associate.mode);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n",
+ param->u.wpa_associate.wpa_ie_len);
if (param->u.wpa_associate.wpa_ie_len) {
if (!param->u.wpa_associate.wpa_ie)
return -EINVAL;
if (param->u.wpa_associate.wpa_ie_len > sizeof(abyWPAIE))
return -EINVAL;
- if (copy_from_user(&abyWPAIE[0], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len))
+ if (copy_from_user(&abyWPAIE[0], param->u.wpa_associate.wpa_ie,
+ param->u.wpa_associate.wpa_ie_len))
return -EFAULT;
}
@@ -730,18 +776,18 @@ static int wpa_set_associate(PSDevice pDevice,
pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
else
pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
- // set ssid
+ /* set ssid */
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
pItemSSID->byElementID = WLAN_EID_SSID;
pItemSSID->len = param->u.wpa_associate.ssid_len;
memcpy(pItemSSID->abySSID, param->u.wpa_associate.ssid, pItemSSID->len);
- // set bssid
+ /* set bssid */
if (memcmp(param->u.wpa_associate.bssid, &abyNullAddr[0], 6) != 0)
memcpy(pMgmt->abyDesireBSSID, param->u.wpa_associate.bssid, 6);
- else {
- bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pItemSSID->abySSID);
- }
+ else
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN,
+ pItemSSID->abySSID);
if (param->u.wpa_associate.wpa_ie_len == 0) {
if (param->u.wpa_associate.auth_alg & AUTH_ALG_SHARED_KEY)
@@ -776,43 +822,54 @@ static int wpa_set_associate(PSDevice pDevice,
break;
case CIPHER_NONE:
if (param->u.wpa_associate.group_suite == CIPHER_CCMP)
- pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
+ pDevice->eEncryptionStatus =
+ Ndis802_11Encryption3Enabled;
else
- pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
+ pDevice->eEncryptionStatus =
+ Ndis802_11Encryption2Enabled;
break;
default:
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
}
-//DavidWang add for WPA_supplicant support open/share mode
+/* DavidWang add for WPA_supplicant support open/share mode */
if (pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) {
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- //pMgmt->eAuthenMode = WMAC_AUTH_SHAREKEY;
+ /* pMgmt->eAuthenMode = WMAC_AUTH_SHAREKEY; */
pMgmt->bShareKeyAlgorithm = true;
} else if (pMgmt->eAuthenMode == WMAC_AUTH_OPEN) {
- if (!bWepEnabled) pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
- else pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- //pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
- //pMgmt->bShareKeyAlgorithm = false; //20080717-06,<Modify> by chester//Fix Open mode, WEP encryption
- }
-//mike save old encryption status
+ if (!bWepEnabled)
+ pDevice->eEncryptionStatus =
+ Ndis802_11EncryptionDisabled;
+ else
+ pDevice->eEncryptionStatus =
+ Ndis802_11Encryption1Enabled;
+ /* pMgmt->eAuthenMode = WMAC_AUTH_OPEN; */
+ /* pMgmt->bShareKeyAlgorithm = false;
+ * 20080717-06,<Modify> by chester//Fix Open mode,
+ * WEP encryption
+ */
+ }
+/* mike save old encryption status */
pDevice->eOldEncryptionStatus = pDevice->eEncryptionStatus;
if (pDevice->eEncryptionStatus != Ndis802_11EncryptionDisabled)
pDevice->bEncryptionEnable = true;
else
pDevice->bEncryptionEnable = false;
- if (!((pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) ||
- ((pMgmt->eAuthenMode == WMAC_AUTH_OPEN) && bWepEnabled))) //DavidWang //20080717-06,<Modify> by chester//Not to initial WEP
+
+ /* DavidWang //20080717-06,<Modify> by chester//Not to initial WEP */
+ if (!((pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY)
+ || ((pMgmt->eAuthenMode == WMAC_AUTH_OPEN) && bWepEnabled)))
KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
spin_lock_irq(&pDevice->lock);
pDevice->bLinkPass = false;
memset(pMgmt->abyCurrBSSID, 0, 6);
pMgmt->eCurrState = WMAC_STATE_IDLE;
netif_stop_queue(pDevice->dev);
- //20080701-02,<Add> by Mike Liu
-/*******search if ap_scan=2 ,which is associating request in hidden ssid mode ****/
+ /* 20080701-02,<Add> by Mike Liu */
+/* search if ap_scan=2 ,which is associating request in hidden ssid mode */
{
PKnownBSS pCurr = NULL;
pCurr = BSSpSearchBSSList(pDevice,
@@ -822,8 +879,9 @@ static int wpa_set_associate(PSDevice pDevice,
);
if (pCurr == NULL) {
- printk("wpa_set_associate---->hidden mode site survey before associate.......\n");
- bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
+ netdev_info(pDevice->dev, "wpa_set_associate---->hidden mode site survey before associate.......\n");
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN,
+ pMgmt->abyDesireSSID);
}
}
/****************************************************************/
@@ -869,18 +927,18 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p)
switch (param->cmd) {
case VIAWGET_SET_WPA:
ret = wpa_set_wpa(pDevice, param);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_WPA \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_WPA\n");
break;
case VIAWGET_SET_KEY:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_KEY \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_KEY\n");
spin_lock_irq(&pDevice->lock);
ret = wpa_set_keys(pDevice, param, false);
spin_unlock_irq(&pDevice->lock);
break;
case VIAWGET_SET_SCAN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_SCAN \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_SCAN\n");
ret = wpa_set_scan(pDevice, param);
break;
@@ -891,38 +949,42 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p)
break;
case VIAWGET_GET_SSID:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SSID \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SSID\n");
ret = wpa_get_ssid(pDevice, param);
wpa_ioctl = 1;
break;
case VIAWGET_GET_BSSID:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_BSSID \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_BSSID\n");
ret = wpa_get_bssid(pDevice, param);
wpa_ioctl = 1;
break;
case VIAWGET_SET_ASSOCIATE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_ASSOCIATE \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "VIAWGET_SET_ASSOCIATE\n");
ret = wpa_set_associate(pDevice, param);
break;
case VIAWGET_SET_DISASSOCIATE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DISASSOCIATE \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "VIAWGET_SET_DISASSOCIATE\n");
ret = wpa_set_disassociate(pDevice, param);
break;
case VIAWGET_SET_DROP_UNENCRYPT:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DROP_UNENCRYPT \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "VIAWGET_SET_DROP_UNENCRYPT\n");
break;
case VIAWGET_SET_DEAUTHENTICATE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DEAUTHENTICATE \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "VIAWGET_SET_DEAUTHENTICATE\n");
break;
default:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ioctl: unknown cmd=%d\n",
- param->cmd);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "wpa_ioctl: unknown cmd=%d\n", param->cmd);
return -EOPNOTSUPP;
break;
}
diff --git a/drivers/staging/vt6655/wpactl.h b/drivers/staging/vt6655/wpactl.h
index b9e2ab2..f398e15 100644
--- a/drivers/staging/vt6655/wpactl.h
+++ b/drivers/staging/vt6655/wpactl.h
@@ -36,13 +36,13 @@
/*--------------------- Export Definitions -------------------------*/
-//WPA related
+/* WPA related */
-typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg;
-typedef enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP,
- CIPHER_WEP104 } wpa_cipher;
-typedef enum { KEY_MGMT_802_1X, KEY_MGMT_CCKM, KEY_MGMT_PSK, KEY_MGMT_NONE,
- KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE } wpa_key_mgmt;
+enum wpa_alg { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP };
+enum wpa_cipher { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP,
+ CIPHER_WEP104 };
+enum wpa_key_mgmt { KEY_MGMT_802_1X, KEY_MGMT_CCKM, KEY_MGMT_PSK,
+ KEY_MGMT_NONE, KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE };
#define AUTH_ALG_OPEN_SYSTEM 0x01
#define AUTH_ALG_SHARED_KEY 0x02
@@ -51,8 +51,6 @@ typedef enum { KEY_MGMT_802_1X, KEY_MGMT_CCKM, KEY_MGMT_PSK, KEY_MGMT_NONE,
#define GENERIC_INFO_ELEM 0xdd
#define RSN_INFO_ELEM 0x30
-typedef unsigned long long NDIS_802_11_KEY_RSC;
-
/*--------------------- Export Classes ----------------------------*/
/*--------------------- Export Variables --------------------------*/
@@ -63,4 +61,4 @@ int wpa_set_wpadev(PSDevice pDevice, int val);
int wpa_ioctl(PSDevice pDevice, struct iw_point *p);
int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel);
-#endif // __WPACL_H__
+#endif /* __WPACL_H__ */
--
1.8.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/7] vt6655: Fixed most of the checkpatch warnings in wpa2
2013-12-30 14:52 [PATCH 0/7] vt6655: Cleanup of checkpatch errors Michael Gunselmann
` (2 preceding siblings ...)
2013-12-30 14:52 ` [PATCH 3/7] vt6655: Fixed most of the checkpatch warnings in wpactl Michael Gunselmann
@ 2013-12-30 14:52 ` Michael Gunselmann
2013-12-31 16:52 ` Dan Carpenter
2013-12-30 14:52 ` [PATCH 5/7] vt6655: Fixed most of the checkpatch warnings in wpa Michael Gunselmann
` (2 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Michael Gunselmann @ 2013-12-30 14:52 UTC (permalink / raw)
To: michael.gunselmann
Cc: martin.hofmann, forest, gregkh, devel, linux-kernel, linux-kernel
wpa2.h: Checkpatch does no longer complain about anything
wpa2.c: Checkpatch complains about some lines that are longer than
80 characters. Breaking them would deteriorate the readability
so these lines were not touched.
vntwifi.c: Fixing style problems in wpa2.h made it necessary to adjust
variable declarations that depended on typedefs in wpa2.h.
The checkpatch cleanup of this file still remains.
Signed-off-by: Michael Gunselmann <michael.gunselmann@studium.uni-erlangen.de>
Signed-off-by: Martin Hofmann <martin.hofmann@studium.uni-erlangen.de>
---
drivers/staging/vt6655/vntwifi.c | 4 +-
drivers/staging/vt6655/wpa2.c | 186 ++++++++++++++++++++++-----------------
drivers/staging/vt6655/wpa2.h | 12 +--
3 files changed, 114 insertions(+), 88 deletions(-)
diff --git a/drivers/staging/vt6655/vntwifi.c b/drivers/staging/vt6655/vntwifi.c
index e78aedf..d6f63d0 100644
--- a/drivers/staging/vt6655/vntwifi.c
+++ b/drivers/staging/vt6655/vntwifi.c
@@ -644,7 +644,7 @@ VNTWIFIbSetPMKIDCache(
return false;
}
pMgmt->gsPMKIDCache.BSSIDInfoCount = ulCount;
- memcpy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(PMKIDInfo)));
+ memcpy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(struct PMKIDInfo)));
return true;
}
@@ -695,7 +695,7 @@ VNTWIFIbMeasureReport(
//spin_lock_irq(&pDevice->lock);
if ((pvMeasureEID != NULL) &&
- (pMgmt->uLengthOfRepEIDs < (WLAN_A3FR_MAXLEN - sizeof(MEASEURE_REP) - sizeof(WLAN_80211HDR_A3) - 3))
+ (pMgmt->uLengthOfRepEIDs < (WLAN_A3FR_MAXLEN - sizeof(MEASEURE_REP) - sizeof(struct WLAN_80211HDR_A3) - 3))
) {
pMgmt->pCurrMeasureEIDRep->byElementID = WLAN_EID_MEASURE_REP;
pMgmt->pCurrMeasureEIDRep->len = 3;
diff --git a/drivers/staging/vt6655/wpa2.c b/drivers/staging/vt6655/wpa2.c
index 2013122..3443556 100644
--- a/drivers/staging/vt6655/wpa2.c
+++ b/drivers/staging/vt6655/wpa2.c
@@ -37,7 +37,7 @@
/*--------------------- Static Definitions -------------------------*/
static int msglevel = MSG_LEVEL_INFO;
-//static int msglevel =MSG_LEVEL_DEBUG;
+/* static int msglevel =MSG_LEVEL_DEBUG; */
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
@@ -121,19 +121,19 @@ WPA2vParseRSN(
WPA2_ClearRSN(pBSSNode);
- if (pRSN->len == 2) { // ver(2)
- if ((pRSN->byElementID == WLAN_EID_RSN) && (pRSN->wVersion == 1)) {
+ if (pRSN->len == 2) { /* ver(2) */
+ if ((pRSN->byElementID == WLAN_EID_RSN)
+ && (pRSN->wVersion == 1))
pBSSNode->bWPA2Valid = true;
- }
return;
}
- if (pRSN->len < 6) { // ver(2) + GK(4)
- // invalid CSS, P802.11i/D10.0, p31
+ if (pRSN->len < 6) { /* ver(2) + GK(4) */
+ /* invalid CSS, P802.11i/D10.0, p31 */
return;
}
- // information element header makes sense
+ /* information element header makes sense */
if ((pRSN->byElementID == WLAN_EID_RSN) &&
(pRSN->wVersion == 1)) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Legal 802.11i RSN\n");
@@ -148,97 +148,121 @@ WPA2vParseRSN(
else if (!memcmp(pbyOUI, abyOUIWEP104, 4))
pBSSNode->byCSSGK = WLAN_11i_CSS_WEP104;
else if (!memcmp(pbyOUI, abyOUIGK, 4)) {
- // invalid CSS, P802.11i/D10.0, p32
+ /* invalid CSS, P802.11i/D10.0, p32 */
return;
} else
- // any vendor checks here
+ /* any vendor checks here */
pBSSNode->byCSSGK = WLAN_11i_CSS_UNKNOWN;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "802.11i CSS: %X\n", pBSSNode->byCSSGK);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "802.11i CSS: %X\n", pBSSNode->byCSSGK);
if (pRSN->len == 6) {
pBSSNode->bWPA2Valid = true;
return;
}
- if (pRSN->len >= 8) { // ver(2) + GK(4) + PK count(2)
- pBSSNode->wCSSPKCount = *((unsigned short *)&(pRSN->abyRSN[4]));
+ if (pRSN->len >= 8) { /* ver(2) + GK(4) + PK count(2) */
+ pBSSNode->wCSSPKCount =
+ *((unsigned short *)&(pRSN->abyRSN[4]));
j = 0;
pbyOUI = &(pRSN->abyRSN[6]);
- for (i = 0; (i < pBSSNode->wCSSPKCount) && (j < sizeof(pBSSNode->abyCSSPK)/sizeof(unsigned char)); i++) {
- if (pRSN->len >= 8+i*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*i)
+ for (i = 0; (i < pBSSNode->wCSSPKCount)
+ && (j < sizeof(pBSSNode->abyCSSPK)/sizeof(unsigned char));
+ i++) {
+ /* ver(2)+GK(4)+PKCnt(2)+PKS(4*i) */
+ if (pRSN->len >= 8+i*4+4) {
if (!memcmp(pbyOUI, abyOUIGK, 4)) {
- pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_USE_GROUP;
+ pBSSNode->abyCSSPK[j++] =
+ WLAN_11i_CSS_USE_GROUP;
bUseGK = true;
- } else if (!memcmp(pbyOUI, abyOUIWEP40, 4)) {
- // Invalid CSS, continue to parsing
- } else if (!memcmp(pbyOUI, abyOUITKIP, 4)) {
- if (pBSSNode->byCSSGK != WLAN_11i_CSS_CCMP)
- pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_TKIP;
- else
- ; // Invalid CSS, continue to parsing
- } else if (!memcmp(pbyOUI, abyOUICCMP, 4)) {
- pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_CCMP;
- } else if (!memcmp(pbyOUI, abyOUIWEP104, 4)) {
- // Invalid CSS, continue to parsing
- } else {
- // any vendor checks here
- pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_UNKNOWN;
- }
+ } else if (!memcmp(pbyOUI, abyOUIWEP40, 4))
+ ; /* Invalid CSS, continue to parsing */
+ else if ((!memcmp(pbyOUI, abyOUITKIP, 4))
+ && (pBSSNode->byCSSGK != WLAN_11i_CSS_CCMP))
+ pBSSNode->abyCSSPK[j++] =
+ WLAN_11i_CSS_TKIP;
+ else if (!memcmp(pbyOUI, abyOUICCMP, 4))
+ pBSSNode->abyCSSPK[j++] =
+ WLAN_11i_CSS_CCMP;
+ else if (!memcmp(pbyOUI, abyOUIWEP104, 4))
+ ; /* Invalid CSS, continue to parsing */
+ else
+ /* any vendor checks here */
+ pBSSNode->abyCSSPK[j++] =
+ WLAN_11i_CSS_UNKNOWN;
pbyOUI += 4;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyCSSPK[%d]: %X\n", j-1, pBSSNode->abyCSSPK[j-1]);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "abyCSSPK[%d]: %X\n", j-1,
+ pBSSNode->abyCSSPK[j-1]);
} else
break;
- } //for
+ } /* for */
if (bUseGK) {
if (j != 1) {
- // invalid CSS, This should be only PK CSS.
+ /* invalid CSS, This should be only PK CSS. */
return;
}
if (pBSSNode->byCSSGK == WLAN_11i_CSS_CCMP) {
- // invalid CSS, If CCMP is enable , PK can't be CSSGK.
+ /* invalid CSS, If CCMP is enable , PK can't be CSSGK. */
return;
}
}
if ((pBSSNode->wCSSPKCount != 0) && (j == 0)) {
- // invalid CSS, No valid PK.
+ /* invalid CSS, No valid PK. */
return;
}
pBSSNode->wCSSPKCount = (unsigned short)j;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wCSSPKCount: %d\n", pBSSNode->wCSSPKCount);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "wCSSPKCount: %d\n", pBSSNode->wCSSPKCount);
}
m = *((unsigned short *)&(pRSN->abyRSN[4]));
- if (pRSN->len >= 10+m*4) { // ver(2) + GK(4) + PK count(2) + PKS(4*m) + AKMSS count(2)
- pBSSNode->wAKMSSAuthCount = *((unsigned short *)&(pRSN->abyRSN[6+4*m]));
+ /* ver(2) + GK(4) + PK count(2) + PKS(4*m) + AKMSS count(2) */
+ if (pRSN->len >= 10+m*4) {
+ pBSSNode->wAKMSSAuthCount =
+ *((unsigned short *)&(pRSN->abyRSN[6+4*m]));
j = 0;
pbyOUI = &(pRSN->abyRSN[8+4*m]);
- for (i = 0; (i < pBSSNode->wAKMSSAuthCount) && (j < sizeof(pBSSNode->abyAKMSSAuthType)/sizeof(unsigned char)); i++) {
- if (pRSN->len >= 10+(m+i)*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSS(2)+AKS(4*i)
+ for (i = 0; (i < pBSSNode->wAKMSSAuthCount)
+ && (j < sizeof(pBSSNode->abyAKMSSAuthType)/sizeof(unsigned char));
+ i++) {
+ /* ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSS(2)+AKS(4*i) */
+ if (pRSN->len >= 10+(m+i)*4+4) {
if (!memcmp(pbyOUI, abyOUI8021X, 4))
- pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_802_1X;
+ pBSSNode->abyAKMSSAuthType[j++] =
+ WLAN_11i_AKMSS_802_1X;
else if (!memcmp(pbyOUI, abyOUIPSK, 4))
- pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_PSK;
+ pBSSNode->abyAKMSSAuthType[j++] =
+ WLAN_11i_AKMSS_PSK;
else
- // any vendor checks here
- pBSSNode->abyAKMSSAuthType[j++] = WLAN_11i_AKMSS_UNKNOWN;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyAKMSSAuthType[%d]: %X\n", j-1, pBSSNode->abyAKMSSAuthType[j-1]);
+ /* any vendor checks here */
+ pBSSNode->abyAKMSSAuthType[j++] =
+ WLAN_11i_AKMSS_UNKNOWN;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "abyAKMSSAuthType[%d]: %X\n",
+ j-1, pBSSNode->abyAKMSSAuthType[j-1]);
} else
break;
}
pBSSNode->wAKMSSAuthCount = (unsigned short)j;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount);
n = *((unsigned short *)&(pRSN->abyRSN[6+4*m]));
- if (pRSN->len >= 12 + 4 * m + 4 * n) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSSCnt(2)+AKMSS(4*n)+Cap(2)
+ /* ver(2)+GK(4)+PKCnt(2)+PKS(4*m)+AKMSSCnt(2)+AKMSS(4*n)+Cap(2) */
+ if (pRSN->len >= 12 + 4 * m + 4 * n) {
pBSSNode->sRSNCapObj.bRSNCapExist = true;
- pBSSNode->sRSNCapObj.wRSNCap = *((unsigned short *)&(pRSN->abyRSN[8+4*m+4*n]));
+ pBSSNode->sRSNCapObj.wRSNCap =
+ *((unsigned short *)&(pRSN->abyRSN[8+4*m+4*n]));
}
}
- //ignore PMKID lists bcs only (Re)Assocrequest has this field
+ /* ignore PMKID lists bcs only
+ * (Re)Assocrequest has this field
+ */
pBSSNode->bWPA2Valid = true;
}
}
@@ -268,66 +292,63 @@ WPA2uSetIEs(
unsigned int ii = 0;
unsigned short *pwPMKID = NULL;
- if (pRSNIEs == NULL) {
+ if (pRSNIEs == NULL)
return 0;
- }
if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) ||
(pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) &&
(pMgmt->pCurrBSS != NULL)) {
/* WPA2 IE */
pbyBuffer = (unsigned char *)pRSNIEs;
pRSNIEs->byElementID = WLAN_EID_RSN;
- pRSNIEs->len = 6; //Version(2)+GK(4)
+ pRSNIEs->len = 6; /* Version(2)+GK(4) */
pRSNIEs->wVersion = 1;
- //Group Key Cipher Suite
+ /* Group Key Cipher Suite */
pRSNIEs->abyRSN[0] = 0x00;
pRSNIEs->abyRSN[1] = 0x0F;
pRSNIEs->abyRSN[2] = 0xAC;
- if (pMgmt->byCSSGK == KEY_CTL_WEP) {
+ if (pMgmt->byCSSGK == KEY_CTL_WEP)
pRSNIEs->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK;
- } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) {
+ else if (pMgmt->byCSSGK == KEY_CTL_TKIP)
pRSNIEs->abyRSN[3] = WLAN_11i_CSS_TKIP;
- } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) {
+ else if (pMgmt->byCSSGK == KEY_CTL_CCMP)
pRSNIEs->abyRSN[3] = WLAN_11i_CSS_CCMP;
- } else {
+ else
pRSNIEs->abyRSN[3] = WLAN_11i_CSS_UNKNOWN;
- }
- // Pairwise Key Cipher Suite
+ /* Pairwise Key Cipher Suite */
pRSNIEs->abyRSN[4] = 1;
pRSNIEs->abyRSN[5] = 0;
pRSNIEs->abyRSN[6] = 0x00;
pRSNIEs->abyRSN[7] = 0x0F;
pRSNIEs->abyRSN[8] = 0xAC;
- if (pMgmt->byCSSPK == KEY_CTL_TKIP) {
+ if (pMgmt->byCSSPK == KEY_CTL_TKIP)
pRSNIEs->abyRSN[9] = WLAN_11i_CSS_TKIP;
- } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) {
+ else if (pMgmt->byCSSPK == KEY_CTL_CCMP)
pRSNIEs->abyRSN[9] = WLAN_11i_CSS_CCMP;
- } else if (pMgmt->byCSSPK == KEY_CTL_NONE) {
+ else if (pMgmt->byCSSPK == KEY_CTL_NONE)
pRSNIEs->abyRSN[9] = WLAN_11i_CSS_USE_GROUP;
- } else {
+ else
pRSNIEs->abyRSN[9] = WLAN_11i_CSS_UNKNOWN;
- }
pRSNIEs->len += 6;
- // Auth Key Management Suite
+ /* Auth Key Management Suite */
pRSNIEs->abyRSN[10] = 1;
pRSNIEs->abyRSN[11] = 0;
pRSNIEs->abyRSN[12] = 0x00;
pRSNIEs->abyRSN[13] = 0x0F;
pRSNIEs->abyRSN[14] = 0xAC;
- if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) {
+ if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)
pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_PSK;
- } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
+ else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)
pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_802_1X;
- } else {
+ else
pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN;
- }
pRSNIEs->len += 6;
- // RSN Capabilities
+ /* RSN Capabilities */
if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) {
- memcpy(&pRSNIEs->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2);
+ memcpy(&pRSNIEs->abyRSN[16],
+ &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2);
} else {
pRSNIEs->abyRSN[16] = 0;
pRSNIEs->abyRSN[17] = 0;
@@ -337,22 +358,27 @@ WPA2uSetIEs(
if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) &&
pMgmt->bRoaming &&
(pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) {
- // RSN PMKID
- pwPMKID = (unsigned short *)(&pRSNIEs->abyRSN[18]); // Point to PMKID count
- *pwPMKID = 0; // Initialize PMKID count
- pbyBuffer = &pRSNIEs->abyRSN[20]; // Point to PMKID list
+ /* RSN PMKID */
+ /* Point to PMKID count */
+ pwPMKID = (unsigned short *)(&pRSNIEs->abyRSN[18]);
+ /* Initialize PMKID count */
+ *pwPMKID = 0;
+ /* Point to PMKID list */
+ pbyBuffer = &pRSNIEs->abyRSN[20];
for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) {
- if (!memcmp(&pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], pMgmt->abyCurrBSSID, ETH_ALEN)) {
+ if (!memcmp(&pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0],
+ pMgmt->abyCurrBSSID, ETH_ALEN)) {
(*pwPMKID)++;
- memcpy(pbyBuffer, pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, 16);
+ memcpy(pbyBuffer,
+ pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID,
+ 16);
pbyBuffer += 16;
}
}
- if (*pwPMKID != 0) {
+ if (*pwPMKID != 0)
pRSNIEs->len += (2 + (*pwPMKID)*16);
- } else {
+ else
pbyBuffer = &pRSNIEs->abyRSN[18];
- }
}
return pRSNIEs->len + WLAN_IEHDR_LEN;
}
diff --git a/drivers/staging/vt6655/wpa2.h b/drivers/staging/vt6655/wpa2.h
index 2d0bd2e..73e29d3 100644
--- a/drivers/staging/vt6655/wpa2.h
+++ b/drivers/staging/vt6655/wpa2.h
@@ -39,15 +39,15 @@
/*--------------------- Export Definitions -------------------------*/
#define MAX_PMKID_CACHE 16
-typedef struct tagsPMKIDInfo {
+struct PMKIDInfo {
unsigned char abyBSSID[6];
unsigned char abyPMKID[16];
-} PMKIDInfo, *PPMKIDInfo;
+};
-typedef struct tagSPMKIDCache {
+struct SPMKIDCache {
unsigned long BSSIDInfoCount;
- PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE];
-} SPMKIDCache, *PSPMKIDCache;
+ struct PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE];
+};
/*--------------------- Export Classes ----------------------------*/
@@ -74,4 +74,4 @@ WPA2uSetIEs(
PWLAN_IE_RSN pRSNIEs
);
-#endif // __WPA2_H__
+#endif /* __WPA2_H__ */
--
1.8.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 5/7] vt6655: Fixed most of the checkpatch warnings in wpa
2013-12-30 14:52 [PATCH 0/7] vt6655: Cleanup of checkpatch errors Michael Gunselmann
` (3 preceding siblings ...)
2013-12-30 14:52 ` [PATCH 4/7] vt6655: Fixed most of the checkpatch warnings in wpa2 Michael Gunselmann
@ 2013-12-30 14:52 ` Michael Gunselmann
2013-12-30 14:52 ` [PATCH 6/7] vt6655: Remove typedefs in 80211hdr.h Michael Gunselmann
2013-12-30 14:52 ` [PATCH 7/7] vt6655: Fixed most of the checkpatch warnings in wmgr Michael Gunselmann
6 siblings, 0 replies; 12+ messages in thread
From: Michael Gunselmann @ 2013-12-30 14:52 UTC (permalink / raw)
To: michael.gunselmann
Cc: martin.hofmann, forest, gregkh, devel, linux-kernel, linux-kernel
wpa.h: Checkpatch does no longer complain about anything.
wpactl.c: Some long-line-warnings still remain but fixing them
would deteriorate code readability.
Signed-off-by: Michael Gunselmann <michael.gunselmann@studium.uni-erlangen.de>
Signed-off-by: Martin Hofmann <martin.hofmann@studium.uni-erlangen.de>
---
drivers/staging/vt6655/wpa.c | 156 ++++++++++++++++++++++++++++---------------
drivers/staging/vt6655/wpa.h | 2 +-
2 files changed, 102 insertions(+), 56 deletions(-)
diff --git a/drivers/staging/vt6655/wpa.c b/drivers/staging/vt6655/wpa.c
index 990ea0f..fdd2722 100644
--- a/drivers/staging/vt6655/wpa.c
+++ b/drivers/staging/vt6655/wpa.c
@@ -116,14 +116,17 @@ WPA_ParseRSN(
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "WPA_ParseRSN: [%d]\n", pRSN->len);
- // information element header makes sense
- if ((pRSN->len >= 6) // oui1(4)+ver(2)
- && (pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4)
+ /* information element header makes sense */
+ if ((pRSN->len >= 6) /* oui1(4)+ver(2) */
+ && (pRSN->byElementID == WLAN_EID_RSN_WPA)
+ && !memcmp(pRSN->abyOUI, abyOUI01, 4)
&& (pRSN->wVersion == 1)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Legal RSN\n");
- // update each variable if pRSN is long enough to contain the variable
- if (pRSN->len >= 10) //oui1(4)+ver(2)+GKSuite(4)
- {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Legal RSN\n");
+ /* update each variable if pRSN is
+ * long enough to contain the variable
+ */
+ if (pRSN->len >= 10) { /* oui1(4)+ver(2)+GKSuite(4) */
if (!memcmp(pRSN->abyMulticast, abyOUI01, 4))
pBSSList->byGKType = WPA_WEP40;
else if (!memcmp(pRSN->abyMulticast, abyOUI02, 4))
@@ -135,80 +138,117 @@ WPA_ParseRSN(
else if (!memcmp(pRSN->abyMulticast, abyOUI05, 4))
pBSSList->byGKType = WPA_WEP104;
else
- // any vendor checks here
+ /* any vendor checks here */
pBSSList->byGKType = WPA_NONE;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "byGKType: %x\n", pBSSList->byGKType);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "byGKType: %x\n", pBSSList->byGKType);
}
- if (pRSN->len >= 12) //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)
- {
+ if (pRSN->len >= 12) { /* oui1(4)+ver(2)+GKS(4)+PKSCnt(2) */
j = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wPKCount: %d, sizeof(pBSSList->abyPKType): %zu\n", pRSN->wPKCount, sizeof(pBSSList->abyPKType));
- for (i = 0; (i < pRSN->wPKCount) && (j < ARRAY_SIZE(pBSSList->abyPKType)); i++) {
- if (pRSN->len >= 12+i*4+4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*i)
- if (!memcmp(pRSN->PKSList[i].abyOUI, abyOUI00, 4))
- pBSSList->abyPKType[j++] = WPA_NONE;
- else if (!memcmp(pRSN->PKSList[i].abyOUI, abyOUI02, 4))
- pBSSList->abyPKType[j++] = WPA_TKIP;
- else if (!memcmp(pRSN->PKSList[i].abyOUI, abyOUI03, 4))
- pBSSList->abyPKType[j++] = WPA_AESWRAP;
- else if (!memcmp(pRSN->PKSList[i].abyOUI, abyOUI04, 4))
- pBSSList->abyPKType[j++] = WPA_AESCCMP;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "wPKCount: %d, sizeof(pBSSList->abyPKType): %zu\n",
+ pRSN->wPKCount, sizeof(pBSSList->abyPKType));
+ for (i = 0; (i < pRSN->wPKCount)
+ && (j < ARRAY_SIZE(pBSSList->abyPKType)); i++) {
+ /* oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*i) */
+ if (pRSN->len >= 12+i*4+4) {
+ if (!memcmp(pRSN->PKSList[i].abyOUI,
+ abyOUI00, 4))
+ pBSSList->abyPKType[j++] =
+ WPA_NONE;
+ else if (!memcmp(pRSN->PKSList[i].abyOUI,
+ abyOUI02, 4))
+ pBSSList->abyPKType[j++] =
+ WPA_TKIP;
+ else if (!memcmp(pRSN->PKSList[i].abyOUI,
+ abyOUI03, 4))
+ pBSSList->abyPKType[j++] =
+ WPA_AESWRAP;
+ else if (!memcmp(pRSN->PKSList[i].abyOUI,
+ abyOUI04, 4))
+ pBSSList->abyPKType[j++] =
+ WPA_AESCCMP;
else
- // any vendor checks here
+ /* any vendor checks here */
;
} else
break;
- //DBG_PRN_GRP14(("abyPKType[%d]: %X\n", j-1, pBSSList->abyPKType[j-1]));
- } //for
+ /* DBG_PRN_GRP14(("abyPKType[%d]: %X\n", j-1,
+ * pBSSList->abyPKType[j-1]));
+ */
+ } /* for */
pBSSList->wPKCount = (unsigned short)j;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wPKCount: %d\n", pBSSList->wPKCount);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "wPKCount: %d\n", pBSSList->wPKCount);
}
m = pRSN->wPKCount;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "m: %d\n", m);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "14+m*4: %d\n", 14+m*4);
- if (pRSN->len >= 14+m*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)
- // overlay IE_RSN_Auth structure into correct place
- pIE_RSN_Auth = (PWLAN_IE_RSN_AUTH) pRSN->PKSList[m].abyOUI;
+ /* oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2) */
+ if (pRSN->len >= 14+m*4) {
+ /* overlay IE_RSN_Auth structure into correct place */
+ pIE_RSN_Auth =
+ (PWLAN_IE_RSN_AUTH) pRSN->PKSList[m].abyOUI;
j = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wAuthCount: %d, sizeof(pBSSList->abyAuthType): %zu\n",
- pIE_RSN_Auth->wAuthCount, sizeof(pBSSList->abyAuthType));
- for (i = 0; (i < pIE_RSN_Auth->wAuthCount) && (j < ARRAY_SIZE(pBSSList->abyAuthType)); i++) {
- if (pRSN->len >= 14+4+(m+i)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*i)
- if (!memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI01, 4))
- pBSSList->abyAuthType[j++] = WPA_AUTH_IEEE802_1X;
- else if (!memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI, abyOUI02, 4))
- pBSSList->abyAuthType[j++] = WPA_AUTH_PSK;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "wAuthCount: %d, sizeof(pBSSList->abyAuthType): %zu\n",
+ pIE_RSN_Auth->wAuthCount,
+ sizeof(pBSSList->abyAuthType));
+ for (i = 0; (i < pIE_RSN_Auth->wAuthCount)
+ && (j < ARRAY_SIZE(pBSSList->abyAuthType)); i++) {
+ /* oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*i) */
+ if (pRSN->len >= 14+4+(m+i)*4) {
+ if (!memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI,
+ abyOUI01, 4))
+ pBSSList->abyAuthType[j++] =
+ WPA_AUTH_IEEE802_1X;
+ else if (!memcmp(pIE_RSN_Auth->AuthKSList[i].abyOUI,
+ abyOUI02, 4))
+ pBSSList->abyAuthType[j++] =
+ WPA_AUTH_PSK;
else
- // any vendor checks here
+ /* any vendor checks here */
;
} else
break;
- //DBG_PRN_GRP14(("abyAuthType[%d]: %X\n", j-1, pBSSList->abyAuthType[j-1]));
+ /* DBG_PRN_GRP14(("abyAuthType[%d]: %X\n",
+ * j-1,
+ * pBSSList->abyAuthType[j-1]));
+ */
}
if (j > 0)
pBSSList->wAuthCount = (unsigned short)j;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wAuthCount: %d\n", pBSSList->wAuthCount);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "wAuthCount: %d\n", pBSSList->wAuthCount);
}
if (pIE_RSN_Auth != NULL) {
n = pIE_RSN_Auth->wAuthCount;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "n: %d\n", n);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "14+4+(m+n)*4: %d\n", 14+4+(m+n)*4);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "14+4+(m+n)*4: %d\n", 14+4+(m+n)*4);
- if (pRSN->len+2 >= 14+4+(m+n)*4) { //oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*n)+Cap(2)
+ /* oui1(4)+ver(2)+GKS(4)+PKSCnt(2)+PKS(4*m)+AKC(2)+AKS(4*n)+Cap(2) */
+ if (pRSN->len+2 >= 14+4+(m+n)*4) {
pbyCaps = (unsigned char *)pIE_RSN_Auth->AuthKSList[n].abyOUI;
- pBSSList->byDefaultK_as_PK = (*pbyCaps) & WPA_GROUPFLAG;
- pBSSList->byReplayIdx = 2 << ((*pbyCaps >> WPA_REPLAYBITSSHIFT) & WPA_REPLAYBITS);
+ pBSSList->byDefaultK_as_PK =
+ (*pbyCaps) & WPA_GROUPFLAG;
+ pBSSList->byReplayIdx =
+ 2 << ((*pbyCaps >> WPA_REPLAYBITSSHIFT) & WPA_REPLAYBITS);
pBSSList->sRSNCapObj.bRSNCapExist = true;
- pBSSList->sRSNCapObj.wRSNCap = *(unsigned short *)pbyCaps;
- //DBG_PRN_GRP14(("pbyCaps: %X\n", *pbyCaps));
- //DBG_PRN_GRP14(("byDefaultK_as_PK: %X\n", pBSSList->byDefaultK_as_PK));
- //DBG_PRN_GRP14(("byReplayIdx: %X\n", pBSSList->byReplayIdx));
+ pBSSList->sRSNCapObj.wRSNCap =
+ *(unsigned short *)pbyCaps;
+ /* DBG_PRN_GRP14(("pbyCaps: %X\n", *pbyCaps));
+ * DBG_PRN_GRP14(("byDefaultK_as_PK: %X\n",
+ * pBSSList->byDefaultK_as_PK));
+ * DBG_PRN_GRP14(("byReplayIdx: %X\n",
+ * pBSSList->byReplayIdx));
+ */
}
}
pBSSList->bWPAValid = true;
@@ -254,11 +294,16 @@ WPA_SearchRSN(
for (ii = 0; ii < pBSSList->wPKCount; ii++) {
if (pBSSList->abyPKType[ii] == WPA_AESCCMP)
byPKType = WPA_AESCCMP;
- else if ((pBSSList->abyPKType[ii] == WPA_TKIP) && (byPKType != WPA_AESCCMP))
+ else if ((pBSSList->abyPKType[ii] == WPA_TKIP)
+ && (byPKType != WPA_AESCCMP))
byPKType = WPA_TKIP;
- else if ((pBSSList->abyPKType[ii] == WPA_WEP40) && (byPKType != WPA_AESCCMP) && (byPKType != WPA_TKIP))
+ else if ((pBSSList->abyPKType[ii] == WPA_WEP40)
+ && (byPKType != WPA_AESCCMP)
+ && (byPKType != WPA_TKIP))
byPKType = WPA_WEP40;
- else if ((pBSSList->abyPKType[ii] == WPA_WEP104) && (byPKType != WPA_AESCCMP) && (byPKType != WPA_TKIP))
+ else if ((pBSSList->abyPKType[ii] == WPA_WEP104)
+ && (byPKType != WPA_AESCCMP)
+ && (byPKType != WPA_TKIP))
byPKType = WPA_WEP104;
}
if (byEncrypt != byPKType)
@@ -295,10 +340,11 @@ WPAb_Is_RSN(
if (pRSN == NULL)
return false;
- if ((pRSN->len >= 6) && // oui1(4)+ver(2)
- (pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4) &&
- (pRSN->wVersion == 1)) {
+ if ((pRSN->len >= 6) /* oui1(4)+ver(2) */
+ && (pRSN->byElementID == WLAN_EID_RSN_WPA)
+ && !memcmp(pRSN->abyOUI, abyOUI01, 4)
+ && (pRSN->wVersion == 1))
return true;
- } else
+ else
return false;
}
diff --git a/drivers/staging/vt6655/wpa.h b/drivers/staging/vt6655/wpa.h
index 1d1918a..d012cb9 100644
--- a/drivers/staging/vt6655/wpa.h
+++ b/drivers/staging/vt6655/wpa.h
@@ -80,4 +80,4 @@ WPAb_Is_RSN(
PWLAN_IE_RSN_EXT pRSN
);
-#endif // __WPA_H__
+#endif /* __WPA_H__ */
--
1.8.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 6/7] vt6655: Remove typedefs in 80211hdr.h
2013-12-30 14:52 [PATCH 0/7] vt6655: Cleanup of checkpatch errors Michael Gunselmann
` (4 preceding siblings ...)
2013-12-30 14:52 ` [PATCH 5/7] vt6655: Fixed most of the checkpatch warnings in wpa Michael Gunselmann
@ 2013-12-30 14:52 ` Michael Gunselmann
2013-12-30 14:52 ` [PATCH 7/7] vt6655: Fixed most of the checkpatch warnings in wmgr Michael Gunselmann
6 siblings, 0 replies; 12+ messages in thread
From: Michael Gunselmann @ 2013-12-30 14:52 UTC (permalink / raw)
To: michael.gunselmann
Cc: martin.hofmann, forest, gregkh, devel, linux-kernel, linux-kernel,
Martin Hofmann, Michael Gunselmann
From: Martin Hofmann <martin.hofmann@studium.uni-erlangen.de>
The file 80211hdr.h contained typedefs for 5 types. To satisfy checkpatch,
this commit removes them. In 10 other files, every occurence of a now deleted
type has been substituted with the correct struct ... syntax.
Signed-off-by: Martin Hofmann <martin.hofmann@studium.uni-erlange.de>
Signed-off-by: Michael Gunselmann <michael.gunselmann@studium.uni-erlange.de>
---
drivers/staging/vt6655/80211hdr.h | 31 ++++++++++++-------------
drivers/staging/vt6655/80211mgr.c | 48 +++++++++++++++++++--------------------
drivers/staging/vt6655/80211mgr.h | 26 ++++++++++-----------
drivers/staging/vt6655/IEEE11h.c | 14 ++++++------
drivers/staging/vt6655/dpc.c | 2 +-
drivers/staging/vt6655/mib.c | 4 ++--
drivers/staging/vt6655/power.c | 4 ++--
drivers/staging/vt6655/rxtx.c | 7 +++---
drivers/staging/vt6655/wcmd.c | 2 +-
drivers/staging/vt6655/wmgr.c | 24 ++++++++++----------
drivers/staging/vt6655/wmgr.h | 6 ++---
11 files changed, 83 insertions(+), 85 deletions(-)
diff --git a/drivers/staging/vt6655/80211hdr.h b/drivers/staging/vt6655/80211hdr.h
index cacf137..067274c 100644
--- a/drivers/staging/vt6655/80211hdr.h
+++ b/drivers/staging/vt6655/80211hdr.h
@@ -266,31 +266,29 @@
#define IEEE_ADDR_UNIVERSAL 0x02
#define IEEE_ADDR_GROUP 0x01
-typedef struct {
+struct IEEE_ADDR {
unsigned char abyAddr[6];
-} IEEE_ADDR, *PIEEE_ADDR;
+};
/* 802.11 Header Format */
-typedef struct tagWLAN_80211HDR_A2 {
+struct WLAN_80211HDR_A2 {
unsigned short wFrameCtl;
unsigned short wDurationID;
unsigned char abyAddr1[WLAN_ADDR_LEN];
unsigned char abyAddr2[WLAN_ADDR_LEN];
-} __attribute__ ((__packed__))
-WLAN_80211HDR_A2, *PWLAN_80211HDR_A2;
+} __attribute__((__packed__));
-typedef struct tagWLAN_80211HDR_A3 {
+struct WLAN_80211HDR_A3 {
unsigned short wFrameCtl;
unsigned short wDurationID;
unsigned char abyAddr1[WLAN_ADDR_LEN];
unsigned char abyAddr2[WLAN_ADDR_LEN];
unsigned char abyAddr3[WLAN_ADDR_LEN];
unsigned short wSeqCtl;
-} __attribute__ ((__packed__))
-WLAN_80211HDR_A3, *PWLAN_80211HDR_A3;
+} __attribute__((__packed__));
-typedef struct tagWLAN_80211HDR_A4 {
+struct WLAN_80211HDR_A4 {
unsigned short wFrameCtl;
unsigned short wDurationID;
unsigned char abyAddr1[WLAN_ADDR_LEN];
@@ -298,14 +296,13 @@ typedef struct tagWLAN_80211HDR_A4 {
unsigned char abyAddr3[WLAN_ADDR_LEN];
unsigned short wSeqCtl;
unsigned char abyAddr4[WLAN_ADDR_LEN];
-} __attribute__ ((__packed__))
-WLAN_80211HDR_A4, *PWLAN_80211HDR_A4;
-
-typedef union tagUWLAN_80211HDR {
- WLAN_80211HDR_A2 sA2;
- WLAN_80211HDR_A3 sA3;
- WLAN_80211HDR_A4 sA4;
-} UWLAN_80211HDR, *PUWLAN_80211HDR;
+} __attribute__((__packed__));
+
+union UWLAN_80211HDR {
+ struct WLAN_80211HDR_A2 sA2;
+ struct WLAN_80211HDR_A3 sA3;
+ struct WLAN_80211HDR_A4 sA4;
+};
/*--------------------- Export Classes ----------------------------*/
diff --git a/drivers/staging/vt6655/80211mgr.c b/drivers/staging/vt6655/80211mgr.c
index 7949d58..e586e51 100644
--- a/drivers/staging/vt6655/80211mgr.c
+++ b/drivers/staging/vt6655/80211mgr.c
@@ -88,7 +88,7 @@ vMgrEncodeBeacon(
PWLAN_FR_BEACON pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -121,7 +121,7 @@ vMgrDecodeBeacon(
{
PWLAN_IE pItem;
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -236,7 +236,7 @@ vMgrEncodeIBSSATIM(
PWLAN_FR_IBSSATIM pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
pFrame->len = WLAN_HDR_ADDR3_LEN;
return;
@@ -258,7 +258,7 @@ vMgrDecodeIBSSATIM(
PWLAN_FR_IBSSATIM pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
return;
}
@@ -279,7 +279,7 @@ vMgrEncodeDisassociation(
PWLAN_FR_DISASSOC pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -305,7 +305,7 @@ vMgrDecodeDisassociation(
PWLAN_FR_DISASSOC pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -330,7 +330,7 @@ vMgrEncodeAssocRequest(
PWLAN_FR_ASSOCREQ pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ WLAN_ASSOCREQ_OFF_CAP_INFO);
@@ -358,7 +358,7 @@ vMgrDecodeAssocRequest(
{
PWLAN_IE pItem;
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ WLAN_ASSOCREQ_OFF_CAP_INFO);
@@ -421,7 +421,7 @@ vMgrEncodeAssocResponse(
PWLAN_FR_ASSOCRESP pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -454,7 +454,7 @@ vMgrDecodeAssocResponse(
{
PWLAN_IE pItem;
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -497,14 +497,14 @@ vMgrEncodeReassocRequest(
PWLAN_FR_REASSOCREQ pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ WLAN_REASSOCREQ_OFF_CAP_INFO);
pFrame->pwListenInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ WLAN_REASSOCREQ_OFF_LISTEN_INT);
- pFrame->pAddrCurrAP = (PIEEE_ADDR)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ pFrame->pAddrCurrAP = (struct IEEE_ADDR *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ WLAN_REASSOCREQ_OFF_CURR_AP);
pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCREQ_OFF_CURR_AP + sizeof(*(pFrame->pAddrCurrAP));
@@ -528,14 +528,14 @@ vMgrDecodeReassocRequest(
)
{
PWLAN_IE pItem;
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ WLAN_REASSOCREQ_OFF_CAP_INFO);
pFrame->pwListenInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ WLAN_REASSOCREQ_OFF_LISTEN_INT);
- pFrame->pAddrCurrAP = (PIEEE_ADDR)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ pFrame->pAddrCurrAP = (struct IEEE_ADDR *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ WLAN_REASSOCREQ_OFF_CURR_AP);
/* Information elements */
@@ -594,7 +594,7 @@ vMgrEncodeProbeRequest(
PWLAN_FR_PROBEREQ pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
pFrame->len = WLAN_HDR_ADDR3_LEN;
return;
}
@@ -617,7 +617,7 @@ vMgrDecodeProbeRequest(
{
PWLAN_IE pItem;
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Information elements */
pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)));
@@ -665,7 +665,7 @@ vMgrEncodeProbeResponse(
PWLAN_FR_PROBERESP pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -699,7 +699,7 @@ vMgrDecodeProbeResponse(
{
PWLAN_IE pItem;
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -808,7 +808,7 @@ vMgrEncodeAuthen(
PWLAN_FR_AUTHEN pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwAuthAlgorithm = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -840,7 +840,7 @@ vMgrDecodeAuthen(
{
PWLAN_IE pItem;
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwAuthAlgorithm = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -877,7 +877,7 @@ vMgrEncodeDeauthen(
PWLAN_FR_DEAUTHEN pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -903,7 +903,7 @@ vMgrDecodeDeauthen(
PWLAN_FR_DEAUTHEN pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -928,7 +928,7 @@ vMgrEncodeReassocResponse(
PWLAN_FR_REASSOCRESP pFrame
)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
@@ -961,7 +961,7 @@ vMgrDecodeReassocResponse(
{
PWLAN_IE pItem;
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (union UWLAN_80211HDR *)pFrame->pBuf;
/* Fixed Fields */
pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
diff --git a/drivers/staging/vt6655/80211mgr.h b/drivers/staging/vt6655/80211mgr.h
index 065238b..e1114ff 100644
--- a/drivers/staging/vt6655/80211mgr.h
+++ b/drivers/staging/vt6655/80211mgr.h
@@ -463,7 +463,7 @@ typedef struct tagWLAN_FR_MGMT {
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ union UWLAN_80211HDR *pHdr;
} WLAN_FR_MGMT, *PWLAN_FR_MGMT;
/* Beacon frame */
@@ -471,7 +471,7 @@ typedef struct tagWLAN_FR_BEACON {
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ union UWLAN_80211HDR *pHdr;
/* fixed fields */
PQWORD pqwTimestamp;
unsigned short *pwBeaconInterval;
@@ -500,7 +500,7 @@ typedef struct tagWLAN_FR_IBSSATIM {
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ union UWLAN_80211HDR *pHdr;
/* fixed fields */
/* info elements */
@@ -512,7 +512,7 @@ typedef struct tagWLAN_FR_DISASSOC {
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ union UWLAN_80211HDR *pHdr;
/*-- fixed fields -----------*/
unsigned short *pwReason;
/*-- info elements ----------*/
@@ -523,7 +523,7 @@ typedef struct tagWLAN_FR_ASSOCREQ {
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ union UWLAN_80211HDR *pHdr;
/*-- fixed fields -----------*/
unsigned short *pwCapInfo;
unsigned short *pwListenInterval;
@@ -542,7 +542,7 @@ typedef struct tagWLAN_FR_ASSOCRESP {
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ union UWLAN_80211HDR *pHdr;
/*-- fixed fields -----------*/
unsigned short *pwCapInfo;
unsigned short *pwStatus;
@@ -557,12 +557,12 @@ typedef struct tagWLAN_FR_REASSOCREQ {
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ union UWLAN_80211HDR *pHdr;
/*-- fixed fields -----------*/
unsigned short *pwCapInfo;
unsigned short *pwListenInterval;
- PIEEE_ADDR pAddrCurrAP;
+ struct IEEE_ADDR *pAddrCurrAP;
/*-- info elements ----------*/
PWLAN_IE_SSID pSSID;
@@ -577,7 +577,7 @@ typedef struct tagWLAN_FR_REASSOCRESP {
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ union UWLAN_80211HDR *pHdr;
/*-- fixed fields -----------*/
unsigned short *pwCapInfo;
unsigned short *pwStatus;
@@ -592,7 +592,7 @@ typedef struct tagWLAN_FR_PROBEREQ {
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ union UWLAN_80211HDR *pHdr;
/*-- fixed fields -----------*/
/*-- info elements ----------*/
PWLAN_IE_SSID pSSID;
@@ -605,7 +605,7 @@ typedef struct tagWLAN_FR_PROBERESP {
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ union UWLAN_80211HDR *pHdr;
/*-- fixed fields -----------*/
PQWORD pqwTimestamp;
unsigned short *pwBeaconInterval;
@@ -632,7 +632,7 @@ typedef struct tagWLAN_FR_AUTHEN {
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ union UWLAN_80211HDR *pHdr;
/*-- fixed fields -----------*/
unsigned short *pwAuthAlgorithm;
unsigned short *pwAuthSequence;
@@ -646,7 +646,7 @@ typedef struct tagWLAN_FR_DEAUTHEN {
unsigned int uType;
unsigned int len;
unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ union UWLAN_80211HDR *pHdr;
/*-- fixed fields -----------*/
unsigned short *pwReason;
diff --git a/drivers/staging/vt6655/IEEE11h.c b/drivers/staging/vt6655/IEEE11h.c
index dfda3c8..5b3eaf0 100644
--- a/drivers/staging/vt6655/IEEE11h.c
+++ b/drivers/staging/vt6655/IEEE11h.c
@@ -46,14 +46,14 @@ static int msglevel = MSG_LEVEL_INFO;
#pragma pack(1)
typedef struct _WLAN_FRAME_ACTION {
- WLAN_80211HDR_A3 Header;
+ struct WLAN_80211HDR_A3 Header;
unsigned char byCategory;
unsigned char byAction;
unsigned char abyVars[1];
} WLAN_FRAME_ACTION, *PWLAN_FRAME_ACTION;
typedef struct _WLAN_FRAME_MSRREQ {
- WLAN_80211HDR_A3 Header;
+ struct WLAN_80211HDR_A3 Header;
unsigned char byCategory;
unsigned char byAction;
unsigned char byDialogToken;
@@ -61,7 +61,7 @@ typedef struct _WLAN_FRAME_MSRREQ {
} WLAN_FRAME_MSRREQ, *PWLAN_FRAME_MSRREQ;
typedef struct _WLAN_FRAME_MSRREP {
- WLAN_80211HDR_A3 Header;
+ struct WLAN_80211HDR_A3 Header;
unsigned char byCategory;
unsigned char byAction;
unsigned char byDialogToken;
@@ -69,7 +69,7 @@ typedef struct _WLAN_FRAME_MSRREP {
} WLAN_FRAME_MSRREP, *PWLAN_FRAME_MSRREP;
typedef struct _WLAN_FRAME_TPCREQ {
- WLAN_80211HDR_A3 Header;
+ struct WLAN_80211HDR_A3 Header;
unsigned char byCategory;
unsigned char byAction;
unsigned char byDialogToken;
@@ -77,7 +77,7 @@ typedef struct _WLAN_FRAME_TPCREQ {
} WLAN_FRAME_TPCREQ, *PWLAN_FRAME_TPCREQ;
typedef struct _WLAN_FRAME_TPCREP {
- WLAN_80211HDR_A3 Header;
+ struct WLAN_80211HDR_A3 Header;
unsigned char byCategory;
unsigned char byAction;
unsigned char byDialogToken;
@@ -130,7 +130,7 @@ static bool s_bRxTPCReq(PSMgmtObject pMgmt,
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket +
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket +
sizeof(STxMgmtPacket));
pFrame = (PWLAN_FRAME_TPCREP)((unsigned char *)pTxPacket +
@@ -291,7 +291,7 @@ bool IEEE11hbMSRRepTx(void *pMgmtHandle)
pTxPacket = (PSTxMgmtPacket)pMgmt->abyCurrentMSRRep;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket +
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket +
sizeof(STxMgmtPacket));
pMSRRep->Header.wFrameCtl = (WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) |
diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c
index 0a29c90..6de720b 100644
--- a/drivers/staging/vt6655/dpc.c
+++ b/drivers/staging/vt6655/dpc.c
@@ -538,7 +538,7 @@ device_receive_frame(
unsigned char *pbyData1;
unsigned char *pbyData2;
- pRxPacket->p80211Header = (PUWLAN_80211HDR)(skb->data+4);
+ pRxPacket->p80211Header = (union UWLAN_80211HDR *)(skb->data+4);
pRxPacket->cbMPDULen = FrameSize;
pRxPacket->uRSSI = *pbyRSSI;
pRxPacket->bySQ = *pbySQ;
diff --git a/drivers/staging/vt6655/mib.c b/drivers/staging/vt6655/mib.c
index 6a59652..53e223f 100644
--- a/drivers/staging/vt6655/mib.c
+++ b/drivers/staging/vt6655/mib.c
@@ -394,11 +394,11 @@ STAvUpdateTDStatCounter(
unsigned int uIdx
)
{
- PWLAN_80211HDR_A4 pHeader;
+ struct WLAN_80211HDR_A4 *pHeader;
unsigned char *pbyDestAddr;
unsigned char byTSR0_NCR = byTSR0 & TSR0_NCR;
- pHeader = (PWLAN_80211HDR_A4) pbyBuffer;
+ pHeader = (struct WLAN_80211HDR_A4 *)pbyBuffer;
if (WLAN_GET_FC_TODS(pHeader->wFrameCtl) == 0) {
pbyDestAddr = &(pHeader->abyAddr1[0]);
} else {
diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c
index 4bd1ccb..12a577d 100644
--- a/drivers/staging/vt6655/power.c
+++ b/drivers/staging/vt6655/power.c
@@ -243,7 +243,7 @@ PSvSendPSPOLL(
memset(pMgmt->pbyPSPacketPool, 0, sizeof(STxMgmtPacket) + WLAN_HDR_ADDR2_LEN);
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyPSPacketPool;
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
pTxPacket->p80211Header->sA2.wFrameCtl = cpu_to_le16(
(
WLAN_SET_FC_FTYPE(WLAN_TYPE_CTL) |
@@ -305,7 +305,7 @@ PSbSendNullPacket(
memset(pMgmt->pbyPSPacketPool, 0, sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN);
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyPSPacketPool;
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
if (pDevice->bEnablePSMode) {
pTxPacket->p80211Header->sA3.wFrameCtl = cpu_to_le16(
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index 6affd6e..5f18051 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -2107,7 +2107,8 @@ vGenerateMACHeader(
pMACHeader->wDurationID = cpu_to_le16(wDuration);
if (pDevice->bLongHeader) {
- PWLAN_80211HDR_A4 pMACA4Header = (PWLAN_80211HDR_A4) pbyBufferAddr;
+ struct WLAN_80211HDR_A4 *pMACA4Header =
+ (struct WLAN_80211HDR_A4 *)pbyBufferAddr;
pMACHeader->wFrameCtl |= (FC_TODS | FC_FROMDS);
memcpy(pMACA4Header->abyAddr4, pDevice->abyBSSID, WLAN_ADDR_LEN);
}
@@ -2603,7 +2604,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un
void *pMICHDR;
PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned short wCurrentRate = RATE_1M;
- PUWLAN_80211HDR p80211Header;
+ union UWLAN_80211HDR *p80211Header;
unsigned int uNodeIndex = 0;
bool bNodeExist = false;
SKeyItem STempKey;
@@ -2622,7 +2623,7 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, un
} else {
cbFrameBodySize = cbMPDULen - WLAN_HDR_ADDR3_LEN;
}
- p80211Header = (PUWLAN_80211HDR)pbMPDU;
+ p80211Header = (union UWLAN_80211HDR *)pbMPDU;
pFrstTD = pDevice->apCurrTD[TYPE_TXDMA0];
pbyTxBufferAddr = (unsigned char *)pFrstTD->pTDInfo->buf;
diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c
index 72caaa2..7fe4c0c 100644
--- a/drivers/staging/vt6655/wcmd.c
+++ b/drivers/staging/vt6655/wcmd.c
@@ -253,7 +253,7 @@ s_MgrMakeProbeRequest(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBEREQ_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_PROBEREQ_FR_MAXLEN;
vMgrEncodeProbeRequest(&sFrame);
diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c
index 5200a2a..f1bb9c4 100644
--- a/drivers/staging/vt6655/wmgr.c
+++ b/drivers/staging/vt6655/wmgr.c
@@ -600,7 +600,7 @@ vMgrDisassocBeginSta(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_DISASSOC_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
// Setup the sFrame structure
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
@@ -1110,7 +1110,7 @@ vMgrAuthenBeginSta(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_AUTHEN_FR_MAXLEN;
vMgrEncodeAuthen(&sFrame);
@@ -1168,7 +1168,7 @@ vMgrDeAuthenBeginSta(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_DEAUTHEN_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_DEAUTHEN_FR_MAXLEN;
vMgrEncodeDeauthen(&sFrame);
@@ -1291,7 +1291,7 @@ s_vMgrRxAuthenSequence_1(
// send auth reply
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_AUTHEN_FR_MAXLEN;
// format buffer structure
@@ -1397,7 +1397,7 @@ s_vMgrRxAuthenSequence_2(
if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) {
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_AUTHEN_FR_MAXLEN;
// format buffer structure
@@ -1500,7 +1500,7 @@ reply:
// send auth reply
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_AUTHEN_FR_MAXLEN;
// format buffer structure
@@ -3056,7 +3056,7 @@ s_MgrMakeBeacon(
// prepare beacon frame
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_BEACON_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
// Setup the sFrame structure.
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_BEACON_FR_MAXLEN;
@@ -3276,7 +3276,7 @@ s_MgrMakeProbeResponse(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBERESP_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
// Setup the sFrame structure.
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_PROBERESP_FR_MAXLEN;
@@ -3453,7 +3453,7 @@ s_MgrMakeAssocRequest(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
// Setup the sFrame structure.
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_ASSOCREQ_FR_MAXLEN;
@@ -3716,7 +3716,7 @@ s_MgrMakeReAssocRequest(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_REASSOCREQ_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
/* Setup the sFrame structure. */
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_REASSOCREQ_FR_MAXLEN;
@@ -3961,7 +3961,7 @@ s_MgrMakeAssocResponse(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
// Setup the sFrame structure
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN;
@@ -4032,7 +4032,7 @@ s_MgrMakeReAssocResponse(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
// Setup the sFrame structure
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN;
diff --git a/drivers/staging/vt6655/wmgr.h b/drivers/staging/vt6655/wmgr.h
index b91f1f8..4026843 100644
--- a/drivers/staging/vt6655/wmgr.h
+++ b/drivers/staging/vt6655/wmgr.h
@@ -196,14 +196,14 @@ typedef enum tagWMAC_CURRENT_MODE {
// Tx Management Packet descriptor
typedef struct tagSTxMgmtPacket {
- PUWLAN_80211HDR p80211Header;
+ union UWLAN_80211HDR *p80211Header;
unsigned int cbMPDULen;
unsigned int cbPayloadLen;
} STxMgmtPacket, *PSTxMgmtPacket;
// Rx Management Packet descriptor
typedef struct tagSRxMgmtPacket {
- PUWLAN_80211HDR p80211Header;
+ union UWLAN_80211HDR *p80211Header;
QWORD qwLocalTSF;
unsigned int cbMPDULen;
unsigned int cbPayloadLen;
@@ -325,7 +325,7 @@ typedef struct tagSMgmtObject
KnownNodeDB sNodeDBTable[MAX_NODE_NUM + 1];
// WPA2 PMKID Cache
- SPMKIDCache gsPMKIDCache;
+ struct SPMKIDCache gsPMKIDCache;
bool bRoaming;
// rate fall back vars
--
1.8.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 7/7] vt6655: Fixed most of the checkpatch warnings in wmgr
2013-12-30 14:52 [PATCH 0/7] vt6655: Cleanup of checkpatch errors Michael Gunselmann
` (5 preceding siblings ...)
2013-12-30 14:52 ` [PATCH 6/7] vt6655: Remove typedefs in 80211hdr.h Michael Gunselmann
@ 2013-12-30 14:52 ` Michael Gunselmann
2014-01-02 14:57 ` Dan Carpenter
6 siblings, 1 reply; 12+ messages in thread
From: Michael Gunselmann @ 2013-12-30 14:52 UTC (permalink / raw)
To: michael.gunselmann
Cc: martin.hofmann, forest, gregkh, devel, linux-kernel, linux-kernel,
Michael Gunselmann, Martin Hofmann
wmgr.h: Fixed checkpatch errors.
Four typedef warnings remain.
line 85: This typedef increases understandability
so this warning is not touched.
line 196, 203 and 214:
These typedef-errors might be fixed in a
later commit. Fixing them makes it necessary
to touch many other files of the driver
using this typedef.
wmgr.c: Fixed checkpatch errors (mostly comments and braces)
Long lines were ignored and will be fixed in a later commit.
Seven warnings remain:
line 562, 770 and 921:
When removing the braces checkpatch complains
about the compiler is running into trouble.
So these lines are not touched.
line 713, 865, 1618 and 2163:
Checkpatch complains about not using netdev_dbg
instead of printk.
These warnings will be fixed in a later commit.
Signed-off-by: Michael Gunselmann <michael.gunselmann@studium.uni-erlange.de>
Signed-off-by: Martin Hofmann <martin.hofmann@studium.uni-erlange.de>
---
drivers/staging/vt6655/wmgr.c | 1177 ++++++++++++++++++++---------------------
drivers/staging/vt6655/wmgr.h | 197 +++----
2 files changed, 681 insertions(+), 693 deletions(-)
diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c
index f1bb9c4..be9e043 100644
--- a/drivers/staging/vt6655/wmgr.c
+++ b/drivers/staging/vt6655/wmgr.c
@@ -88,16 +88,16 @@
/*--------------------- Static Variables --------------------------*/
static int msglevel = MSG_LEVEL_INFO;
-//static int msglevel =MSG_LEVEL_DEBUG;
+/* static int msglevel =MSG_LEVEL_DEBUG; */
/*--------------------- Static Functions --------------------------*/
-//2008-8-4 <add> by chester
+/* 2008-8-4 <add> by chester */
static bool ChannelExceedZoneType(
PSDevice pDevice,
unsigned char byCurrChannel
);
-// Association/diassociation functions
+/* Association/diassociation functions */
static
PSTxMgmtPacket
s_MgrMakeAssocRequest(
@@ -150,7 +150,7 @@ s_vMgrRxDisassociation(
PSRxMgmtPacket pRxPacket
);
-// Authentication/deauthen functions
+/* Authentication/deauthen functions */
static
void
s_vMgrRxAuthenSequence_1(
@@ -199,8 +199,9 @@ s_vMgrRxDeauthentication(
PSRxMgmtPacket pRxPacket
);
-// Scan functions
-// probe request/response functions
+/* Scan functions
+ * probe request/response functions
+ */
static
void
s_vMgrRxProbeRequest(
@@ -217,7 +218,7 @@ s_vMgrRxProbeResponse(
PSRxMgmtPacket pRxPacket
);
-// beacon functions
+/* beacon functions */
static
void
s_vMgrRxBeacon(
@@ -249,7 +250,7 @@ s_MgrMakeBeacon(
PWLAN_IE_SUPP_RATES pCurrExtSuppRates
);
-// Association response
+/* Association response */
static
PSTxMgmtPacket
s_MgrMakeAssocResponse(
@@ -263,7 +264,7 @@ s_MgrMakeAssocResponse(
PWLAN_IE_SUPP_RATES pCurrExtSuppRates
);
-// ReAssociation response
+/* ReAssociation response */
static
PSTxMgmtPacket
s_MgrMakeReAssocResponse(
@@ -277,7 +278,7 @@ s_MgrMakeReAssocResponse(
PWLAN_IE_SUPP_RATES pCurrExtSuppRates
);
-// Probe response
+/* Probe response */
static
PSTxMgmtPacket
s_MgrMakeProbeResponse(
@@ -295,7 +296,7 @@ s_MgrMakeProbeResponse(
unsigned char byPHYType
);
-// received status
+/* received status */
static
void
s_vMgrLogStatus(
@@ -351,11 +352,10 @@ vMgrObjectInit(
pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0];
pMgmt->pbyMgmtPacketPool = &pMgmt->byMgmtPacketPool[0];
pMgmt->uCurrChannel = pDevice->uChannel;
- for (ii = 0; ii < WLAN_BSSID_LEN; ii++) {
+ for (ii = 0; ii < WLAN_BSSID_LEN; ii++)
pMgmt->abyDesireBSSID[ii] = 0xFF;
- }
- pMgmt->sAssocInfo.AssocInfo.Length = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION);
- //memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN +1);
+ pMgmt->sAssocInfo.AssocInfo.Length = sizeof(struct NDIS_802_11_ASSOCIATION_INFORMATION);
+ /* memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN +1); */
pMgmt->byCSSPK = KEY_CTL_NONE;
pMgmt->byCSSGK = KEY_CTL_NONE;
pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI;
@@ -396,7 +396,7 @@ vMgrTimerInit(
init_timer(&pDevice->sTimerTxData);
pDevice->sTimerTxData.data = (unsigned long) pDevice;
pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData;
- pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
+ pDevice->sTimerTxData.expires = RUN_AT(10*HZ); /* 10s callback */
pDevice->fTxDataInSleep = false;
pDevice->IsTxDataTrigger = false;
pDevice->nTxDataTimeCout = 0;
@@ -430,7 +430,7 @@ vMgrObjectReset(
pMgmt->eCurrMode = WMAC_MODE_STANDBY;
pMgmt->eCurrState = WMAC_STATE_IDLE;
pDevice->bEnablePSMode = false;
- // TODO: timer
+ /* TODO: timer */
return;
}
@@ -458,23 +458,20 @@ vMgrAssocBeginSta(
pMgmt->wCurrCapInfo = 0;
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1);
- if (pDevice->bEncryptionEnable) {
+ if (pDevice->bEncryptionEnable)
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1);
- }
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1);
if (pMgmt->wListenInterval == 0)
- pMgmt->wListenInterval = 1; // at least one.
+ pMgmt->wListenInterval = 1; /* at least one. */
- // ERP Phy (802.11g) should support short preamble.
+ /* ERP Phy (802.11g) should support short preamble. */
if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) {
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1);
- if (CARDbIsShorSlotTime(pMgmt->pAdapter)) {
+ if (CARDbIsShorSlotTime(pMgmt->pAdapter))
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1);
- }
} else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) {
- if (CARDbIsShortPreamble(pMgmt->pAdapter)) {
+ if (CARDbIsShortPreamble(pMgmt->pAdapter))
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1);
- }
}
if (pMgmt->b11hEnable)
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1);
@@ -527,25 +524,22 @@ vMgrReAssocBeginSta(
pMgmt->wCurrCapInfo = 0;
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1);
- if (pDevice->bEncryptionEnable) {
+ if (pDevice->bEncryptionEnable)
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1);
- }
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1);
if (pMgmt->wListenInterval == 0)
- pMgmt->wListenInterval = 1; // at least one.
+ pMgmt->wListenInterval = 1; /* at least one. */
- // ERP Phy (802.11g) should support short preamble.
+ /* ERP Phy (802.11g) should support short preamble. */
if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) {
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1);
- if (CARDbIsShorSlotTime(pMgmt->pAdapter)) {
+ if (CARDbIsShorSlotTime(pMgmt->pAdapter))
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1);
- }
} else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) {
- if (CARDbIsShortPreamble(pMgmt->pAdapter)) {
+ if (CARDbIsShortPreamble(pMgmt->pAdapter))
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1);
- }
}
if (pMgmt->b11hEnable)
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1);
@@ -560,16 +554,15 @@ vMgrReAssocBeginSta(
(PWLAN_IE_SSID)pMgmt->abyCurrSSID,
(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates
-);
+ );
if (pTxPacket != NULL) {
/* send the frame */
*pStatus = csMgmt_xmit(pDevice, pTxPacket);
if (*pStatus != CMD_STATUS_PENDING) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx failed.\n");
- } else {
+ } else
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Reassociation tx sending.\n");
- }
}
return;
@@ -602,14 +595,14 @@ vMgrDisassocBeginSta(
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_DISASSOC_FR_MAXLEN);
pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- // Setup the sFrame structure
+ /* Setup the sFrame structure */
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_DISASSOC_FR_MAXLEN;
- // format fixed field frame structure
+ /* format fixed field frame structure */
vMgrEncodeDisassociation(&sFrame);
- // Setup the header
+ /* Setup the header */
sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16(
(
WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) |
@@ -620,12 +613,12 @@ vMgrDisassocBeginSta(
memcpy(sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN);
memcpy(sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
- // Set reason code
+ /* Set reason code */
*(sFrame.pwReason) = cpu_to_le16(wReason);
pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
- // send the frame
+ /* send the frame */
*pStatus = csMgmt_xmit(pDevice, pTxPacket);
if (*pStatus == CMD_STATUS_PENDING) {
pMgmt->eCurrState = WMAC_STATE_IDLE;
@@ -665,12 +658,13 @@ s_vMgrRxAssocRequest(
if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP)
return;
- // node index not found
+ /* node index not found */
if (!uNodeIndex)
return;
- //check if node is authenticated
- //decode the frame
+ /* check if node is authenticated
+ * decode the frame
+ */
memset(&sFrame, 0, sizeof(WLAN_FR_ASSOCREQ));
memset(abyCurrSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
memset(abyCurrExtSuppRates, 0, WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
@@ -685,10 +679,9 @@ s_vMgrRxAssocRequest(
pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = cpu_to_le16(*sFrame.pwListenInterval);
pMgmt->sNodeDBTable[uNodeIndex].bPSEnable =
WLAN_GET_FC_PWRMGT(sFrame.pHdr->sA3.wFrameCtl) ? true : false;
- // Todo: check sta basic rate, if ap can't support, set status code
- if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
+ /* Todo: check sta basic rate, if ap can't support, set status code */
+ if (pDevice->eCurrentPHYType == PHY_TYPE_11B)
uRateLen = WLAN_RATES_MAXLEN_11B;
- }
abyCurrSuppRates[0] = WLAN_EID_SUPP_RATES;
abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates,
(PWLAN_IE_SUPP_RATES)abyCurrSuppRates,
@@ -705,7 +698,7 @@ s_vMgrRxAssocRequest(
RATEvParseMaxRate((void *)pDevice,
(PWLAN_IE_SUPP_RATES)abyCurrSuppRates,
(PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates,
- false, // do not change our basic rate
+ false, /* do not change our basic rate */
&(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate),
&(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate),
&(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate),
@@ -713,13 +706,15 @@ s_vMgrRxAssocRequest(
&(pMgmt->sNodeDBTable[uNodeIndex].byTopOFDMBasicRate)
);
- // set max tx rate
+ /* set max tx rate */
pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate =
pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate;
#ifdef PLICE_DEBUG
- printk("RxAssocRequest:wTxDataRate is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate);
+ printk(KERN_DEBUG
+ "RxAssocRequest:wTxDataRate is %d\n",
+ pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate);
#endif
- // Todo: check sta preamble, if ap can't support, set status code
+ /* Todo: check sta preamble, if ap can't support, set status code */
pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble =
WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo);
pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime =
@@ -727,21 +722,20 @@ s_vMgrRxAssocRequest(
pMgmt->sNodeDBTable[uNodeIndex].wAID = (unsigned short)uNodeIndex;
wAssocStatus = WLAN_MGMT_STATUS_SUCCESS;
wAssocAID = (unsigned short)uNodeIndex;
- // check if ERP support
+ /* check if ERP support */
if (pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M)
pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true;
if (pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate <= RATE_11M) {
- // B only STA join
+ /* B only STA join */
pDevice->bProtectMode = true;
pDevice->bNonERPPresent = true;
}
- if (!pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) {
+ if (!pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble)
pDevice->bBarkerPreambleMd = true;
- }
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Associate AID= %d \n", wAssocAID);
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n",
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Associate AID= %d\n", wAssocAID);
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
sFrame.pHdr->sA3.abyAddr2[0],
sFrame.pHdr->sA3.abyAddr2[1],
sFrame.pHdr->sA3.abyAddr2[2],
@@ -749,14 +743,14 @@ s_vMgrRxAssocRequest(
sFrame.pHdr->sA3.abyAddr2[4],
sFrame.pHdr->sA3.abyAddr2[5]
);
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d \n",
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d\n",
pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate);
- }//else { TODO: received STA under state1 handle }
- else {
- return;
}
+ /* else { TODO: received STA under state1 handle } */
+ else
+ return;
- // assoc response reply..
+ /* assoc response reply.. */
pTxPacket = s_MgrMakeAssocResponse
(
pDevice,
@@ -769,17 +763,14 @@ s_vMgrRxAssocRequest(
(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates
);
if (pTxPacket != NULL) {
- if (pDevice->bEnableHostapd) {
+ if (pDevice->bEnableHostapd)
return;
- }
/* send the frame */
Status = csMgmt_xmit(pDevice, pTxPacket);
if (Status != CMD_STATUS_PENDING) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx failed\n");
- } else {
+ } else
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Assoc response tx sending..\n");
- }
-
}
return;
@@ -821,11 +812,12 @@ s_vMgrRxReAssocRequest(
if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP)
return;
- // node index not found
+ /* node index not found */
if (!uNodeIndex)
return;
- //check if node is authenticated
- //decode the frame
+ /* check if node is authenticated
+ * decode the frame
+ */
memset(&sFrame, 0, sizeof(WLAN_FR_REASSOCREQ));
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
@@ -837,11 +829,10 @@ s_vMgrRxReAssocRequest(
pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = cpu_to_le16(*sFrame.pwListenInterval);
pMgmt->sNodeDBTable[uNodeIndex].bPSEnable =
WLAN_GET_FC_PWRMGT(sFrame.pHdr->sA3.wFrameCtl) ? true : false;
- // Todo: check sta basic rate, if ap can't support, set status code
+ /* Todo: check sta basic rate, if ap can't support, set status code */
- if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
+ if (pDevice->eCurrentPHYType == PHY_TYPE_11B)
uRateLen = WLAN_RATES_MAXLEN_11B;
- }
abyCurrSuppRates[0] = WLAN_EID_SUPP_RATES;
abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates,
@@ -859,7 +850,7 @@ s_vMgrRxReAssocRequest(
RATEvParseMaxRate((void *)pDevice,
(PWLAN_IE_SUPP_RATES)abyCurrSuppRates,
(PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates,
- false, // do not change our basic rate
+ false, /* do not change our basic rate */
&(pMgmt->sNodeDBTable[uNodeIndex].wMaxBasicRate),
&(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate),
&(pMgmt->sNodeDBTable[uNodeIndex].wSuppRate),
@@ -867,13 +858,14 @@ s_vMgrRxReAssocRequest(
&(pMgmt->sNodeDBTable[uNodeIndex].byTopOFDMBasicRate)
);
- // set max tx rate
+ /* set max tx rate */
pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate =
pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate;
#ifdef PLICE_DEBUG
- printk("RxReAssocRequest:TxDataRate is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate);
+ printk(KERN_DEBUG
+ "RxReAssocRequest:TxDataRate is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate);
#endif
- // Todo: check sta preamble, if ap can't support, set status code
+ /* Todo: check sta preamble, if ap can't support, set status code */
pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble =
WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo);
pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime =
@@ -882,21 +874,20 @@ s_vMgrRxReAssocRequest(
wAssocStatus = WLAN_MGMT_STATUS_SUCCESS;
wAssocAID = (unsigned short)uNodeIndex;
- // if suppurt ERP
+ /* if suppurt ERP */
if (pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M)
pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true;
if (pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate <= RATE_11M) {
- // B only STA join
+ /* B only STA join */
pDevice->bProtectMode = true;
pDevice->bNonERPPresent = true;
}
- if (!pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) {
+ if (!pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble)
pDevice->bBarkerPreambleMd = true;
- }
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Rx ReAssociate AID= %d \n", wAssocAID);
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X \n",
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Rx ReAssociate AID= %d\n", wAssocAID);
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "MAC=%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
sFrame.pHdr->sA3.abyAddr2[0],
sFrame.pHdr->sA3.abyAddr2[1],
sFrame.pHdr->sA3.abyAddr2[2],
@@ -904,12 +895,12 @@ s_vMgrRxReAssocRequest(
sFrame.pHdr->sA3.abyAddr2[4],
sFrame.pHdr->sA3.abyAddr2[5]
);
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d \n",
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d\n",
pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate);
}
- // assoc response reply..
+ /* assoc response reply.. */
pTxPacket = s_MgrMakeReAssocResponse
(
pDevice,
@@ -924,15 +915,13 @@ s_vMgrRxReAssocRequest(
if (pTxPacket != NULL) {
/* send the frame */
- if (pDevice->bEnableHostapd) {
+ if (pDevice->bEnableHostapd)
return;
- }
Status = csMgmt_xmit(pDevice, pTxPacket);
if (Status != CMD_STATUS_PENDING) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx failed\n");
- } else {
+ } else
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:ReAssoc response tx sending..\n");
- }
}
return;
}
@@ -965,7 +954,7 @@ s_vMgrRxAssocResponse(
pMgmt->eCurrState == WMAC_STATE_ASSOC) {
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
- // decode the frame
+ /* decode the frame */
vMgrDecodeAssocResponse(&sFrame);
if ((sFrame.pwCapInfo == 0) ||
(sFrame.pwStatus == 0) ||
@@ -986,13 +975,12 @@ s_vMgrRxAssocResponse(
pbyIEs += pMgmt->sAssocInfo.AssocInfo.RequestIELength;
memcpy(pbyIEs, (sFrame.pBuf + 24 + 6), pMgmt->sAssocInfo.AssocInfo.ResponseIELength);
- // save values and set current BSS state
+ /* save values and set current BSS state */
if (cpu_to_le16((*(sFrame.pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) {
- // set AID
+ /* set AID */
pMgmt->wCurrAID = cpu_to_le16((*(sFrame.pwAid)));
- if ((pMgmt->wCurrAID >> 14) != (BIT0 | BIT1)) {
+ if ((pMgmt->wCurrAID >> 14) != (BIT0 | BIT1))
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AID from AP, has two msb clear.\n");
- }
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Association Successful, AID=%d.\n", pMgmt->wCurrAID & ~(BIT14 | BIT15));
pMgmt->eCurrState = WMAC_STATE_ASSOC;
BSSvUpdateAPNode((void *)pDevice, sFrame.pwCapInfo, sFrame.pSuppRates, sFrame.pExtSuppRates);
@@ -1001,8 +989,8 @@ s_vMgrRxAssocResponse(
pDevice->bLinkPass = true;
pDevice->uBBVGADiffCount = 0;
if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
- if (skb_tailroom(pDevice->skb) < (sizeof(viawget_wpa_header) + pMgmt->sAssocInfo.AssocInfo.ResponseIELength +
- pMgmt->sAssocInfo.AssocInfo.RequestIELength)) { //data room not enough
+ if (skb_tailroom(pDevice->skb) < (sizeof(viawget_wpa_header) + pMgmt->sAssocInfo.AssocInfo.ResponseIELength
+ + pMgmt->sAssocInfo.AssocInfo.RequestIELength)) { /* data room not enough */
dev_kfree_skb(pDevice->skb);
pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
}
@@ -1025,7 +1013,7 @@ s_vMgrRxAssocResponse(
pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
}
-//2008-0409-07, <Add> by Einsn Liu
+/* 2008-0409-07, <Add> by Einsn Liu */
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
{
unsigned char buf[512];
@@ -1060,13 +1048,13 @@ s_vMgrRxAssocResponse(
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
}
-#endif //#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
-//End Add -- //2008-0409-07, <Add> by Einsn Liu
+#endif /*#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT */
+/* End Add -- //2008-0409-07, <Add> by Einsn Liu */
} else {
if (bReAssocType) {
pMgmt->eCurrState = WMAC_STATE_IDLE;
} else {
- // jump back to the auth state and indicate the error
+ /* jump back to the auth state and indicate the error */
pMgmt->eCurrState = WMAC_STATE_AUTH;
}
s_vMgrLogStatus(pMgmt, cpu_to_le16((*(sFrame.pwStatus))));
@@ -1075,7 +1063,7 @@ s_vMgrRxAssocResponse(
}
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
-//need clear flags related to Networkmanager
+/* need clear flags related to Networkmanager */
pDevice->bwextcount = 0;
pDevice->bWPASuppWextEnabled = false;
@@ -1183,15 +1171,14 @@ vMgrDeAuthenBeginSta(
memcpy(sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN);
memcpy(sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
- *(sFrame.pwReason) = cpu_to_le16(wReason); // deauthen. bcs left BSS
+ *(sFrame.pwReason) = cpu_to_le16(wReason); /* deauthen. bcs left BSS */
/* Adjust the length fields */
pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
*pStatus = csMgmt_xmit(pDevice, pTxPacket);
- if (*pStatus == CMD_STATUS_PENDING) {
+ if (*pStatus == CMD_STATUS_PENDING)
*pStatus = CMD_STATUS_SUCCESS;
- }
return;
}
@@ -1216,26 +1203,26 @@ s_vMgrRxAuthentication(
{
WLAN_FR_AUTHEN sFrame;
- // we better be an AP or a STA in AUTHPENDING otherwise ignore
+ /* we better be an AP or a STA in AUTHPENDING otherwise ignore */
if (!(pMgmt->eCurrMode == WMAC_MODE_ESS_AP ||
pMgmt->eCurrState == WMAC_STATE_AUTHPENDING)) {
return;
}
- // decode the frame
+ /* decode the frame */
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
vMgrDecodeAuthen(&sFrame);
switch (cpu_to_le16((*(sFrame.pwAuthSequence)))) {
case 1:
- //AP function
+ /* AP function */
s_vMgrRxAuthenSequence_1(pDevice, pMgmt, &sFrame);
break;
case 2:
s_vMgrRxAuthenSequence_2(pDevice, pMgmt, &sFrame);
break;
case 3:
- //AP function
+ /* AP function */
s_vMgrRxAuthenSequence_3(pDevice, pMgmt, &sFrame);
break;
case 4:
@@ -1274,7 +1261,7 @@ s_vMgrRxAuthenSequence_1(
WLAN_FR_AUTHEN sFrame;
PSKeyItem pTransmitKey;
- // Insert a Node entry
+ /* Insert a Node entry */
if (!BSSDBbIsSTAInNodeDB(pMgmt, pFrame->pHdr->sA3.abyAddr2, &uNodeIndex)) {
BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex);
memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, pFrame->pHdr->sA3.abyAddr2,
@@ -1288,15 +1275,15 @@ s_vMgrRxAuthenSequence_1(
pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_AUTH;
}
- // send auth reply
+ /* send auth reply */
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_AUTHEN_FR_MAXLEN;
- // format buffer structure
+ /* format buffer structure */
vMgrEncodeAuthen(&sFrame);
- // insert values
+ /* insert values */
sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16(
(
WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) |
@@ -1328,7 +1315,7 @@ s_vMgrRxAuthenSequence_1(
sFrame.pChallenge->byElementID = WLAN_EID_CHALLENGE;
sFrame.pChallenge->len = WLAN_CHALLENGE_LEN;
memset(pMgmt->abyChallenge, 0, WLAN_CHALLENGE_LEN);
- // get group key
+ /* get group key */
if (KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, GROUP_KEY, &pTransmitKey) == true) {
rc4_init(&pDevice->SBox, pDevice->abyPRNG, pTransmitKey->uKeyLength+3);
rc4_encrypt(&pDevice->SBox, pMgmt->abyChallenge, pMgmt->abyChallenge, WLAN_CHALLENGE_LEN);
@@ -1339,14 +1326,12 @@ s_vMgrRxAuthenSequence_1(
/* Adjust the length fields */
pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
- // send the frame
- if (pDevice->bEnableHostapd) {
+ /* send the frame */
+ if (pDevice->bEnableHostapd)
return;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx.. \n");
- if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx..\n");
+ if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_1 tx failed.\n");
- }
return;
}
@@ -1384,11 +1369,12 @@ s_vMgrRxAuthenSequence_2(
s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus))));
pMgmt->eCurrState = WMAC_STATE_IDLE;
}
- if (pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT) {
-// spin_unlock_irq(&pDevice->lock);
-// vCommandTimerWait((void *)pDevice, 0);
-// spin_lock_irq(&pDevice->lock);
- }
+/* if (pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT) {
+ * spin_unlock_irq(&pDevice->lock);
+ * vCommandTimerWait((void *)pDevice, 0);
+ * spin_lock_irq(&pDevice->lock);
+ * }
+ */
break;
@@ -1400,9 +1386,9 @@ s_vMgrRxAuthenSequence_2(
pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_AUTHEN_FR_MAXLEN;
- // format buffer structure
+ /* format buffer structure */
vMgrEncodeAuthen(&sFrame);
- // insert values
+ /* insert values */
sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16(
(
WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) |
@@ -1420,21 +1406,21 @@ s_vMgrRxAuthenSequence_2(
sFrame.pChallenge->byElementID = WLAN_EID_CHALLENGE;
sFrame.pChallenge->len = WLAN_CHALLENGE_LEN;
memcpy(sFrame.pChallenge->abyChallenge, pFrame->pChallenge->abyChallenge, WLAN_CHALLENGE_LEN);
- // Adjust the length fields
+ /* Adjust the length fields */
pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
- // send the frame
- if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
+ /* send the frame */
+ if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx failed.\n");
- }
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Auth_reply sequence_2 tx ...\n");
} else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:rx Auth_reply sequence_2 status error ...\n");
- if (pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT) {
-// spin_unlock_irq(&pDevice->lock);
-// vCommandTimerWait((void *)pDevice, 0);
-// spin_lock_irq(&pDevice->lock);
- }
+/* if (pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT) {
+ * spin_unlock_irq(&pDevice->lock);
+ * vCommandTimerWait((void *)pDevice, 0);
+ * spin_lock_irq(&pDevice->lock);
+ * }
+ */
s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus))));
}
break;
@@ -1497,13 +1483,13 @@ s_vMgrRxAuthenSequence_3(
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Challenge text check ok..\n");
reply:
- // send auth reply
+ /* send auth reply */
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_AUTHEN_FR_MAXLEN;
- // format buffer structure
+ /* format buffer structure */
vMgrEncodeAuthen(&sFrame);
/* insert values */
sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16(
@@ -1522,13 +1508,11 @@ reply:
/* Adjust the length fields */
pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
- // send the frame
- if (pDevice->bEnableHostapd) {
+ /* send the frame */
+ if (pDevice->bEnableHostapd)
return;
- }
- if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
+ if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Authreq_reply sequence_4 tx failed.\n");
- }
return;
}
@@ -1560,11 +1544,13 @@ s_vMgrRxAuthenSequence_4(
pMgmt->eCurrState = WMAC_STATE_IDLE;
}
- if (pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT) {
-// spin_unlock_irq(&pDevice->lock);
-// vCommandTimerWait((void *)pDevice, 0);
-// spin_lock_irq(&pDevice->lock);
- }
+/* if (pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT) {
+ * spin_unlock_irq(&pDevice->lock);
+ * vCommandTimerWait((void *)pDevice, 0);
+ * spin_lock_irq(&pDevice->lock);
+ *
+ * }
+ */
}
/*+
@@ -1588,26 +1574,26 @@ s_vMgrRxDisassociation(
{
WLAN_FR_DISASSOC sFrame;
unsigned int uNodeIndex = 0;
-// CMD_STATUS CmdStatus;
+/* CMD_STATUS CmdStatus; */
viawget_wpa_header *wpahdr;
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
- // if is acting an AP..
- // a STA is leaving this BSS..
+ /* if is acting an AP.. */
+ /* a STA is leaving this BSS.. */
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
- if (BSSDBbIsSTAInNodeDB(pMgmt, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) {
+ if (BSSDBbIsSTAInNodeDB(pMgmt, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex))
BSSvRemoveOneNode(pDevice, uNodeIndex);
- } else {
+ else
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx disassoc, sta not found\n");
- }
} else if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
vMgrDecodeDisassociation(&sFrame);
DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP disassociated me, reason=%d.\n", cpu_to_le16(*(sFrame.pwReason)));
- //TODO: do something let upper layer know or
- //try to send associate packet again because of inactivity timeout
+ /* TODO: do something let upper layer know or
+ * try to send associate packet again because of inactivity timeout
+ */
if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
wpahdr = (viawget_wpa_header *)pDevice->skb->data;
wpahdr->type = VIAWGET_DISASSOC_MSG;
@@ -1629,7 +1615,8 @@ s_vMgrRxDisassociation(
union iwreq_data wrqu;
memset(&wrqu, 0, sizeof(wrqu));
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
- printk("wireless_send_event--->SIOCGIWAP(disassociated)\n");
+ printk(KERN_DEBUG
+ "wireless_send_event--->SIOCGIWAP(disassociated)\n");
wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
}
#endif
@@ -1663,23 +1650,23 @@ s_vMgrRxDeauthentication(
viawget_wpa_header *wpahdr;
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
- //Todo:
- // if is acting an AP..
- // a STA is leaving this BSS..
+ /* Todo:
+ * if is acting an AP..
+ * a STA is leaving this BSS..
+ */
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
- if (BSSDBbIsSTAInNodeDB(pMgmt, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) {
+ if (BSSDBbIsSTAInNodeDB(pMgmt, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex))
BSSvRemoveOneNode(pDevice, uNodeIndex);
- } else {
+ else
DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Rx deauth, sta not found\n");
- }
} else {
if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
vMgrDecodeDeauthen(&sFrame);
DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP deauthed me, reason=%d.\n", cpu_to_le16((*(sFrame.pwReason))));
- // TODO: update BSS list for specific BSSID if pre-authentication case
+ /* TODO: update BSS list for specific BSSID if pre-authentication case */
if (ether_addr_equal(sFrame.pHdr->sA3.abyAddr3,
pMgmt->abyCurrBSSID)) {
if (pMgmt->eCurrState >= WMAC_STATE_AUTHPENDING) {
@@ -1717,13 +1704,15 @@ s_vMgrRxDeauthentication(
#endif
}
- /* else, ignore it. TODO: IBSS authentication service
- would be implemented here */
+ /* else, ignore it.
+ * TODO: IBSS authentication service
+ * would be implemented here
+ */
}
return;
}
-//2008-8-4 <add> by chester
+/* 2008-8-4 <add> by chester */
/*+
*
* Routine Description:
@@ -1744,16 +1733,16 @@ ChannelExceedZoneType(
bool exceed = false;
switch (pDevice->byZoneType) {
- case 0x00: //USA:1~11
+ case 0x00: /* USA:1~11 */
if ((byCurrChannel < 1) || (byCurrChannel > 11))
exceed = true;
break;
- case 0x01: //Japan:1~13
- case 0x02: //Europe:1~13
+ case 0x01: /* Japan:1~13 */
+ case 0x02: /* Europe:1~13 */
if ((byCurrChannel < 1) || (byCurrChannel > 13))
exceed = true;
break;
- default: //reserve for other zonetype
+ default: /* reserve for other zonetype */
break;
}
@@ -1809,7 +1798,7 @@ s_vMgrRxBeacon(
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
- // decode the beacon frame
+ /* decode the beacon frame */
vMgrDecodeBeacon(&sFrame);
if ((sFrame.pwBeaconInterval == 0) ||
@@ -1822,21 +1811,21 @@ s_vMgrRxBeacon(
if (sFrame.pDSParms != NULL) {
if (byCurrChannel > CB_MAX_CHANNEL_24G) {
- // channel remapping to
+ /* channel remapping to */
byIEChannel = get_channel_mapping(pDevice, sFrame.pDSParms->byCurrChannel, PHY_TYPE_11A);
} else {
byIEChannel = sFrame.pDSParms->byCurrChannel;
}
if (byCurrChannel != byIEChannel) {
- // adjust channel info. bcs we rcv adjacent channel packets
+ /* adjust channel info. bcs we rcv adjacent channel packets */
bChannelHit = false;
byCurrChannel = byIEChannel;
}
} else {
- // no DS channel info
+ /* no DS channel info */
bChannelHit = true;
}
-//2008-0730-01<Add>by MikeLiu
+/* 2008-0730-01<Add>by MikeLiu */
if (ChannelExceedZoneType(pDevice, byCurrChannel))
return;
@@ -1867,11 +1856,11 @@ s_vMgrRxBeacon(
sFrame.pIE_Country,
sFrame.pIE_Quiet,
sFrame.len - WLAN_HDR_ADDR3_LEN,
- sFrame.pHdr->sA4.abyAddr4, // payload of beacon
+ sFrame.pHdr->sA4.abyAddr4, /* payload of beacon */
(void *)pRxPacket
);
} else {
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "update bcn: RxChannel = : %d\n", byCurrChannel);
+/* DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "update bcn: RxChannel = : %d\n", byCurrChannel); */
BSSbUpdateToBSSList((void *)pDevice,
*sFrame.pqwTimestamp,
*sFrame.pwBeaconInterval,
@@ -1888,21 +1877,20 @@ s_vMgrRxBeacon(
sFrame.pIE_Quiet,
pBSSList,
sFrame.len - WLAN_HDR_ADDR3_LEN,
- sFrame.pHdr->sA4.abyAddr4, // payload of probresponse
+ sFrame.pHdr->sA4.abyAddr4, /* payload of probresponse */
(void *)pRxPacket
);
}
- if (bInScan) {
+ if (bInScan)
return;
- }
if (byCurrChannel == (unsigned char)pMgmt->uCurrChannel)
bIsChannelEqual = true;
if (bIsChannelEqual && (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
- // if rx beacon without ERP field
+ /* if rx beacon without ERP field */
if (sERP.bERPExist) {
if (WLAN_GET_ERP_USE_PROTECTION(sERP.byERP)) {
pDevice->byERPFlag |= WLAN_SET_ERP_USE_PROTECTION(1);
@@ -1920,7 +1908,7 @@ s_vMgrRxBeacon(
pDevice->byERPFlag |= WLAN_SET_ERP_NONERP_PRESENT(1);
}
- // set to MAC&BBP
+ /* set to MAC&BBP */
if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) {
if (!pDevice->bProtectMode) {
MACvEnableProtectMD(pDevice->PortOffset);
@@ -1932,22 +1920,22 @@ s_vMgrRxBeacon(
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)
return;
- // check if BSSID the same
+ /* check if BSSID the same */
if (memcmp(sFrame.pHdr->sA3.abyAddr3,
pMgmt->abyCurrBSSID,
WLAN_BSSID_LEN) == 0) {
bIsBSSIDEqual = true;
-// 2008-05-21 <add> by Richardtai
+/* 2008-05-21 <add> by Richardtai */
pDevice->uCurrRSSI = pRxPacket->uRSSI;
pDevice->byCurrSQ = pRxPacket->bySQ;
if (pMgmt->sNodeDBTable[0].uInActiveCount != 0) {
pMgmt->sNodeDBTable[0].uInActiveCount = 0;
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:Wake Count= [%d]\n", pMgmt->wCountToWakeUp);
+ /* DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:Wake Count= [%d]\n", pMgmt->wCountToWakeUp); */
}
}
- // check if SSID the same
+ /* check if SSID the same */
if (sFrame.pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) {
if (memcmp(sFrame.pSSID->abySSID,
((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID,
@@ -1962,12 +1950,12 @@ s_vMgrRxBeacon(
bIsSSIDEqual &&
(pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
(pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
- // add state check to prevent reconnect fail since we'll receive Beacon
+ /* add state check to prevent reconnect fail since we'll receive Beacon */
bIsAPBeacon = true;
if (pBSSList != NULL) {
- // Compare PHY parameter setting
+ /* Compare PHY parameter setting */
if (pMgmt->wCurrCapInfo != pBSSList->wCapInfo) {
bUpdatePhyParameter = true;
pMgmt->wCurrCapInfo = pBSSList->wCapInfo;
@@ -1979,12 +1967,9 @@ s_vMgrRxBeacon(
pMgmt->byERPContext = sFrame.pERP->byContext;
}
}
- //
- // Basic Rate Set may change dynamically
- //
- if (pBSSList->eNetworkTypeInUse == PHY_TYPE_11B) {
+ /* Basic Rate Set may change dynamically */
+ if (pBSSList->eNetworkTypeInUse == PHY_TYPE_11B)
uRateLen = WLAN_RATES_MAXLEN_11B;
- }
pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pBSSList->abySuppRates,
(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
uRateLen);
@@ -2029,12 +2014,12 @@ s_vMgrRxBeacon(
}
}
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Beacon 2 \n");
- // check if CF field exists
+/* DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Beacon 2\n"); */
+ /* check if CF field exists */
if (WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)) {
- if (sFrame.pCFParms->wCFPDurRemaining > 0) {
- // TODO: deal with CFP period to set NAV
- }
+ if (sFrame.pCFParms->wCFPDurRemaining > 0)
+ /* TODO: deal with CFP period to set NAV */
+ ;
}
HIDWORD(qwTimestamp) = cpu_to_le32(HIDWORD(*sFrame.pqwTimestamp));
@@ -2042,51 +2027,48 @@ s_vMgrRxBeacon(
HIDWORD(qwLocalTSF) = HIDWORD(pRxPacket->qwLocalTSF);
LODWORD(qwLocalTSF) = LODWORD(pRxPacket->qwLocalTSF);
- // check if beacon TSF larger or small than our local TSF
+ /* check if beacon TSF larger or small than our local TSF */
if (HIDWORD(qwTimestamp) == HIDWORD(qwLocalTSF)) {
- if (LODWORD(qwTimestamp) >= LODWORD(qwLocalTSF)) {
+ if (LODWORD(qwTimestamp) >= LODWORD(qwLocalTSF))
bTSFOffsetPostive = true;
- } else {
+ else
bTSFOffsetPostive = false;
- }
- } else if (HIDWORD(qwTimestamp) > HIDWORD(qwLocalTSF)) {
+ } else if (HIDWORD(qwTimestamp) > HIDWORD(qwLocalTSF))
bTSFOffsetPostive = true;
- } else if (HIDWORD(qwTimestamp) < HIDWORD(qwLocalTSF)) {
+ else if (HIDWORD(qwTimestamp) < HIDWORD(qwLocalTSF))
bTSFOffsetPostive = false;
- }
- if (bTSFOffsetPostive) {
+ if (bTSFOffsetPostive)
qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwTimestamp), (qwLocalTSF));
- } else {
+ else
qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwLocalTSF), (qwTimestamp));
- }
if (HIDWORD(qwTSFOffset) != 0 ||
(LODWORD(qwTSFOffset) > TRIVIAL_SYNC_DIFFERENCE)) {
bTSFLargeDiff = true;
}
- // if infra mode
+ /* if infra mode */
if (bIsAPBeacon) {
- // Infra mode: Local TSF always follow AP's TSF if Difference huge.
+ /* Infra mode: Local TSF always follow AP's TSF if Difference huge. */
if (bTSFLargeDiff)
bUpdateTSF = true;
if (pDevice->bEnablePSMode && (sFrame.pTIM != 0)) {
- // deal with DTIM, analysis TIM
+ /* deal with DTIM, analysis TIM */
pMgmt->bMulticastTIM = WLAN_MGMT_IS_MULTICAST_TIM(sFrame.pTIM->byBitMapCtl) ? true : false;
pMgmt->byDTIMCount = sFrame.pTIM->byDTIMCount;
pMgmt->byDTIMPeriod = sFrame.pTIM->byDTIMPeriod;
wAIDNumber = pMgmt->wCurrAID & ~(BIT14|BIT15);
- // check if AID in TIM field bit on
- // wStartIndex = N1
+ /* check if AID in TIM field bit on */
+ /* wStartIndex = N1 */
wStartIndex = WLAN_MGMT_GET_TIM_OFFSET(sFrame.pTIM->byBitMapCtl) << 1;
- // AIDIndex = N2
+ /* AIDIndex = N2 */
wAIDIndex = (wAIDNumber >> 3);
if ((wAIDNumber > 0) && (wAIDIndex >= wStartIndex)) {
uLocateByteIndex = wAIDIndex - wStartIndex;
- // len = byDTIMCount + byDTIMPeriod + byDTIMPeriod + byVirtBitMap[0~250]
+ /* len = byDTIMCount + byDTIMPeriod + byDTIMPeriod + byVirtBitMap[0~250] */
if (sFrame.pTIM->len >= (uLocateByteIndex + 4)) {
byTIMBitOn = (0x01) << ((wAIDNumber) % 8);
pMgmt->bInTIM = sFrame.pTIM->byVirtBitMap[uLocateByteIndex] & byTIMBitOn ? true : false;
@@ -2100,11 +2082,11 @@ s_vMgrRxBeacon(
if (pMgmt->bInTIM ||
(pMgmt->bMulticastTIM && (pMgmt->byDTIMCount == 0))) {
pMgmt->bInTIMWake = true;
- // send out ps-poll packet
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:In TIM\n");
+ /* send out ps-poll packet */
+/* DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:In TIM\n"); */
if (pMgmt->bInTIM) {
PSvSendPSPOLL((PSDevice)pDevice);
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:PS-POLL sent..\n");
+/* DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:PS-POLL sent..\n"); */
}
} else {
@@ -2115,30 +2097,30 @@ s_vMgrRxBeacon(
if (PSbSendNullPacket(pDevice))
pDevice->bPWBitOn = true;
}
- if (PSbConsiderPowerDown(pDevice, false, false)) {
+ if (PSbConsiderPowerDown(pDevice, false, false))
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Power down now...\n");
- }
}
}
}
- // if adhoc mode
+ /* if adhoc mode */
if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && !bIsAPBeacon && bIsChannelEqual) {
if (bIsBSSIDEqual) {
- // Use sNodeDBTable[0].uInActiveCount as IBSS beacons received count.
+ /* Use sNodeDBTable[0].uInActiveCount as IBSS beacons received count. */
if (pMgmt->sNodeDBTable[0].uInActiveCount != 0)
pMgmt->sNodeDBTable[0].uInActiveCount = 0;
- // adhoc mode:TSF updated only when beacon larger than local TSF
+ /* adhoc mode:TSF updated only when beacon larger than local TSF */
if (bTSFLargeDiff && bTSFOffsetPostive &&
(pMgmt->eCurrState == WMAC_STATE_JOINTED))
bUpdateTSF = true;
- // During dpc, already in spinlocked.
+ /* During dpc, already in spinlocked. */
if (BSSDBbIsSTAInNodeDB(pMgmt, sFrame.pHdr->sA3.abyAddr2, &uNodeIndex)) {
- // Update the STA, (Technically the Beacons of all the IBSS nodes
- // should be identical, but that's not happening in practice.
+ /* Update the STA, (Technically the Beacons of all the IBSS nodes
+ * should be identical, but that's not happening in practice.
+ */
pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates,
(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
WLAN_RATES_MAXLEN_11B);
@@ -2156,7 +2138,7 @@ s_vMgrRxBeacon(
pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo);
pMgmt->sNodeDBTable[uNodeIndex].uInActiveCount = 0;
} else {
- // Todo, initial Node content
+ /* Todo, initial Node content */
BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex);
pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates,
@@ -2178,7 +2160,10 @@ s_vMgrRxBeacon(
pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate = pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate;
#ifdef PLICE_DEBUG
{
- printk("s_vMgrRxBeacon:TxDataRate is %d,Index is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate, uNodeIndex);
+ printk(KERN_DEBUG
+ "s_vMgrRxBeacon:TxDataRate is %d,Index is %d\n",
+ pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate,
+ uNodeIndex);
}
#endif
/*
@@ -2188,26 +2173,28 @@ s_vMgrRxBeacon(
*/
}
- // if other stations joined, indicate connection to upper layer..
+ /* if other stations joined, indicate connection to upper layer.. */
if (pMgmt->eCurrState == WMAC_STATE_STARTED) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Current IBSS State: [Started]........to: [Jointed] \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Current IBSS State: [Started]........to: [Jointed]\n");
pMgmt->eCurrState = WMAC_STATE_JOINTED;
pDevice->bLinkPass = true;
- if (netif_queue_stopped(pDevice->dev)) {
+ if (netif_queue_stopped(pDevice->dev))
netif_wake_queue(pDevice->dev);
- }
pMgmt->sNodeDBTable[0].bActive = true;
pMgmt->sNodeDBTable[0].uInActiveCount = 0;
}
} else if (bIsSSIDEqual) {
- // See other adhoc sta with the same SSID but BSSID is different.
- // adpot this vars only when TSF larger then us.
+ /* See other adhoc sta with the same SSID but BSSID is different.
+ * adpot this vars only when TSF larger then us.
+ */
if (bTSFLargeDiff && bTSFOffsetPostive) {
- // we don't support ATIM under adhoc mode
- // if (sFrame.pIBSSParms->wATIMWindow == 0) {
- // adpot this vars
- // TODO: check sFrame cap if privacy on, and support rate syn
+ /* we don't support ATIM under adhoc mode
+ * if (sFrame.pIBSSParms->wATIMWindow == 0) {
+ * adpot this vars
+ * TODO: check sFrame cap if privacy on, and support rate syn
+ */
memcpy(pMgmt->abyCurrBSSID, sFrame.pHdr->sA3.abyAddr3, WLAN_BSSID_LEN);
memcpy(pDevice->abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
pMgmt->wCurrATIMWindow = cpu_to_le16(sFrame.pIBSSParms->wATIMWindow);
@@ -2215,12 +2202,12 @@ s_vMgrRxBeacon(
pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)sFrame.pSuppRates,
(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
WLAN_RATES_MAXLEN_11B);
- // set HW beacon interval and re-synchronizing....
+ /* set HW beacon interval and re-synchronizing.... */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rejoining to Other Adhoc group with same SSID........\n");
VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, pMgmt->wCurrBeaconPeriod);
CARDbUpdateTSF(pDevice, pRxPacket->byRxRate, qwTimestamp, qwLocalTSF);
CARDvUpdateNextTBTT(pDevice->PortOffset, qwTimestamp, pMgmt->wCurrBeaconPeriod);
- // Turn off bssid filter to avoid filter others adhoc station which bssid is different.
+ /* Turn off bssid filter to avoid filter others adhoc station which bssid is different. */
MACvWriteBSSIDAddress(pDevice->PortOffset, pMgmt->abyCurrBSSID);
CARDbSetPhyParameter(pMgmt->pAdapter,
@@ -2230,17 +2217,19 @@ s_vMgrRxBeacon(
pMgmt->abyCurrSuppRates,
pMgmt->abyCurrExtSuppRates);
- // MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID);
- // set highest basic rate
- // s_vSetHighestBasicRate(pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates);
- // Prepare beacon frame
+ /* MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID); */
+ /* set highest basic rate
+ * s_vSetHighestBasicRate(pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates);
+ * Prepare beacon frame
+ */
bMgrPrepareBeaconToSend((void *)pDevice, pMgmt);
- // }
+ /* } */
}
}
}
- // endian issue ???
- // Update TSF
+ /* endian issue ???
+ * Update TSF
+ */
if (bUpdateTSF) {
CARDbGetCurrentTSF(pDevice->PortOffset, &qwCurrTSF);
CARDbUpdateTSF(pDevice, pRxPacket->byRxRate, qwTimestamp, pRxPacket->qwLocalTSF);
@@ -2288,7 +2277,7 @@ vMgrCreateOwnIBSS(
if ((pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) &&
(pDevice->eEncryptionStatus != Ndis802_11Encryption2Enabled) &&
(pDevice->eEncryptionStatus != Ndis802_11Encryption3Enabled)) {
- // encryption mode error
+ /* encryption mode error */
*pStatus = CMD_STATUS_FAILURE;
return;
}
@@ -2331,26 +2320,26 @@ vMgrCreateOwnIBSS(
pMgmt->abyCurrExtSuppRates[2+ii] = abyOFDM_RATE[ii+4];
}
- // Disable Protect Mode
+ /* Disable Protect Mode */
pDevice->bProtectMode = false;
MACvDisableProtectMD(pDevice->PortOffset);
pDevice->bBarkerPreambleMd = false;
MACvDisableBarkerPreambleMd(pDevice->PortOffset);
- // Kyle Test 2003.11.04
+ /* Kyle Test 2003.11.04 */
- // set HW beacon interval
+ /* set HW beacon interval */
if (pMgmt->wIBSSBeaconPeriod == 0)
pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI;
CARDbGetCurrentTSF(pDevice->PortOffset, &qwCurrTSF);
- // clear TSF counter
+ /* clear TSF counter */
VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
- // enable TSF counter
+ /* enable TSF counter */
VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
- // set Next TBTT
+ /* set Next TBTT */
CARDvSetFirstNextTBTT(pDevice->PortOffset, pMgmt->wIBSSBeaconPeriod);
pMgmt->uIBSSChannel = pDevice->uChannel;
@@ -2358,16 +2347,15 @@ vMgrCreateOwnIBSS(
if (pMgmt->uIBSSChannel == 0)
pMgmt->uIBSSChannel = DEFAULT_IBSS_CHANNEL;
- // set basic rate
+ /* set basic rate */
RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, true,
&wMaxBasicRate, &wMaxSuppRate, &wSuppRate,
&byTopCCKBasicRate, &byTopOFDMBasicRate);
- if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
+ if (pMgmt->eConfigMode == WMAC_CONFIG_AP)
pMgmt->eCurrMode = WMAC_MODE_ESS_AP;
- }
if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) {
memcpy(pMgmt->abyIBSSDFSOwner, pDevice->abyCurrentNetAddr, 6);
@@ -2375,7 +2363,7 @@ vMgrCreateOwnIBSS(
pMgmt->eCurrMode = WMAC_MODE_IBSS_STA;
}
- // Adopt pre-configured IBSS vars to current vars
+ /* Adopt pre-configured IBSS vars to current vars */
pMgmt->eCurrState = WMAC_STATE_STARTED;
pMgmt->wCurrBeaconPeriod = pMgmt->wIBSSBeaconPeriod;
pMgmt->uCurrChannel = pMgmt->uIBSSChannel;
@@ -2383,8 +2371,9 @@ vMgrCreateOwnIBSS(
MACvWriteATIMW(pDevice->PortOffset, pMgmt->wCurrATIMWindow);
pDevice->uCurrRSSI = 0;
pDevice->byCurrSQ = 0;
- //memcpy(pMgmt->abyDesireSSID,pMgmt->abyAdHocSSID,
- // ((PWLAN_IE_SSID)pMgmt->abyAdHocSSID)->len + WLAN_IEHDR_LEN);
+ /* memcpy(pMgmt->abyDesireSSID,pMgmt->abyAdHocSSID,
+ * ((PWLAN_IE_SSID)pMgmt->abyAdHocSSID)->len + WLAN_IEHDR_LEN);
+ */
memset(pMgmt->abyCurrSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
memcpy(pMgmt->abyCurrSSID,
pMgmt->abyDesireSSID,
@@ -2392,14 +2381,14 @@ vMgrCreateOwnIBSS(
);
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
- // AP mode BSSID = MAC addr
+ /* AP mode BSSID = MAC addr */
memcpy(pMgmt->abyCurrBSSID, pMgmt->abyMACAddr, WLAN_ADDR_LEN);
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "AP beacon created BSSID:%pM\n",
pMgmt->abyCurrBSSID);
}
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
- // BSSID selected must be randomized as spec 11.1.3
+ /* BSSID selected must be randomized as spec 11.1.3 */
pMgmt->abyCurrBSSID[5] = (unsigned char) (LODWORD(qwCurrTSF) & 0x000000ff);
pMgmt->abyCurrBSSID[4] = (unsigned char)((LODWORD(qwCurrTSF) & 0x0000ff00) >> 8);
pMgmt->abyCurrBSSID[3] = (unsigned char)((LODWORD(qwCurrTSF) & 0x00ff0000) >> 16);
@@ -2419,7 +2408,7 @@ vMgrCreateOwnIBSS(
pMgmt->abyCurrBSSID);
}
- // Set Capability Info
+ /* Set Capability Info */
pMgmt->wCurrCapInfo = 0;
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
@@ -2428,9 +2417,8 @@ vMgrCreateOwnIBSS(
pMgmt->byDTIMCount = pMgmt->byDTIMPeriod - 1;
}
- if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
+ if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_IBSS(1);
- }
if (pDevice->bEncryptionEnable) {
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1);
@@ -2453,13 +2441,12 @@ vMgrCreateOwnIBSS(
pMgmt->byERPContext = 0;
-// memcpy(pDevice->abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
+/* memcpy(pDevice->abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN); */
- if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
+ if (pMgmt->eConfigMode == WMAC_CONFIG_AP)
CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_AP);
- } else {
+ else
CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
- }
CARDbSetPhyParameter(pMgmt->pAdapter,
pMgmt->eCurrentPHYMode,
@@ -2470,28 +2457,25 @@ vMgrCreateOwnIBSS(
);
CARDbSetBeaconPeriod(pMgmt->pAdapter, pMgmt->wIBSSBeaconPeriod);
- // set channel and clear NAV
+ /* set channel and clear NAV */
set_channel(pMgmt->pAdapter, pMgmt->uIBSSChannel);
pMgmt->uCurrChannel = pMgmt->uIBSSChannel;
- if (CARDbIsShortPreamble(pMgmt->pAdapter)) {
+ if (CARDbIsShortPreamble(pMgmt->pAdapter))
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1);
- } else {
+ else
pMgmt->wCurrCapInfo &= (~WLAN_SET_CAP_INFO_SHORTPREAMBLE(1));
- }
if (pMgmt->b11hEnable &&
- (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) {
+ (pMgmt->eCurrentPHYMode == PHY_TYPE_11A))
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1);
- } else {
+ else
pMgmt->wCurrCapInfo &= (~WLAN_SET_CAP_INFO_SPECTRUMMNG(1));
- }
pMgmt->eCurrState = WMAC_STATE_STARTED;
- // Prepare beacon to send
- if (bMgrPrepareBeaconToSend((void *)pDevice, pMgmt)) {
+ /* Prepare beacon to send */
+ if (bMgrPrepareBeaconToSend((void *)pDevice, pMgmt))
*pStatus = CMD_STATUS_SUCCESS;
- }
return;
}
@@ -2540,8 +2524,8 @@ vMgrJoinBSSBegin(
return;
}
- // memset(pMgmt->abyDesireBSSID, 0, WLAN_BSSID_LEN);
- // Search known BSS list for prefer BSSID or SSID
+ /* memset(pMgmt->abyDesireBSSID, 0, WLAN_BSSID_LEN); */
+ /* Search known BSS list for prefer BSSID or SSID */
pCurr = BSSpSearchBSSList(pDevice,
pMgmt->abyDesireBSSID,
@@ -2559,30 +2543,30 @@ vMgrJoinBSSBegin(
DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP(BSS) finding:Found a AP(BSS)..\n");
if (WLAN_GET_CAP_INFO_ESS(cpu_to_le16(pCurr->wCapInfo))) {
if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)) {
- // patch for CISCO migration mode
+ /* patch for CISCO migration mode */
/*
- if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
- if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == false) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
- // encryption mode error
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- return;
- }
- } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
- if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == false) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
- // encryption mode error
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- return;
- }
- }
-*/
+ * if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
+ * if (WPA_SearchRSN(0, WPA_TKIP, pCurr) == false) {
+ * DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
+ * // encryption mode error
+ * pMgmt->eCurrState = WMAC_STATE_IDLE;
+ * return;
+ * }
+ * } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
+ * if (WPA_SearchRSN(0, WPA_AESCCMP, pCurr) == false) {
+ * DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "No match RSN info. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
+ * // encryption mode error
+ * pMgmt->eCurrState = WMAC_STATE_IDLE;
+ * return;
+ * }
+ * }
+ */
}
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
Encyption_Rebuild(pDevice, pCurr);
#endif
- // Infrastructure BSS
+ /* Infrastructure BSS */
s_vMgrSynchBSS(pDevice,
WMAC_MODE_ESS_STA,
pCurr,
@@ -2590,31 +2574,30 @@ vMgrJoinBSSBegin(
);
if (*pStatus == CMD_STATUS_SUCCESS) {
- // Adopt this BSS state vars in Mgmt Object
+ /* Adopt this BSS state vars in Mgmt Object */
pMgmt->uCurrChannel = pCurr->uChannel;
memset(pMgmt->abyCurrSuppRates, 0 , WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
memset(pMgmt->abyCurrExtSuppRates, 0 , WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1);
- if (pCurr->eNetworkTypeInUse == PHY_TYPE_11B) {
+ if (pCurr->eNetworkTypeInUse == PHY_TYPE_11B)
uRateLen = WLAN_RATES_MAXLEN_11B;
- }
pItemRates = (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates;
pItemExtRates = (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates;
- // Parse Support Rate IE
+ /* Parse Support Rate IE */
pItemRates->byElementID = WLAN_EID_SUPP_RATES;
pItemRates->len = RATEuSetIE((PWLAN_IE_SUPP_RATES)pCurr->abySuppRates,
pItemRates,
uRateLen);
- // Parse Extension Support Rate IE
+ /* Parse Extension Support Rate IE */
pItemExtRates->byElementID = WLAN_EID_EXTSUPP_RATES;
pItemExtRates->len = RATEuSetIE((PWLAN_IE_SUPP_RATES)pCurr->abyExtSuppRates,
pItemExtRates,
uRateLen);
- // Stuffing Rate IE
+ /* Stuffing Rate IE */
if ((pItemExtRates->len > 0) && (pItemRates->len < 8)) {
for (ii = 0; ii < (unsigned int)(8 - pItemRates->len);) {
pItemRates->abyRates[pItemRates->len + ii] = pItemExtRates->abyRates[ii];
@@ -2625,9 +2608,8 @@ vMgrJoinBSSBegin(
pItemRates->len += (unsigned char)ii;
if (pItemExtRates->len - ii > 0) {
pItemExtRates->len -= (unsigned char)ii;
- for (uu = 0; uu < pItemExtRates->len; uu++) {
+ for (uu = 0; uu < pItemExtRates->len; uu++)
pItemExtRates->abyRates[uu] = pItemExtRates->abyRates[uu + ii];
- }
} else {
pItemExtRates->len = 0;
}
@@ -2637,8 +2619,8 @@ vMgrJoinBSSBegin(
&wMaxBasicRate, &wMaxSuppRate, &wSuppRate,
&byTopCCKBasicRate, &byTopOFDMBasicRate);
- // TODO: deal with if wCapInfo the privacy is on, but station WEP is off
- // TODO: deal with if wCapInfo the PS-Pollable is on.
+ /* TODO: deal with if wCapInfo the privacy is on, but station WEP is off */
+ /* TODO: deal with if wCapInfo the PS-Pollable is on. */
pMgmt->wCurrBeaconPeriod = pCurr->wBeaconInterval;
memset(pMgmt->abyCurrSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
memcpy(pMgmt->abyCurrBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN);
@@ -2647,12 +2629,14 @@ vMgrJoinBSSBegin(
pMgmt->eCurrMode = WMAC_MODE_ESS_STA;
pMgmt->eCurrState = WMAC_STATE_JOINTED;
- // Adopt BSS state in Adapter Device Object
- //pDevice->byOpMode = OP_MODE_INFRASTRUCTURE;
-// memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN);
-
- // Add current BSS to Candidate list
- // This should only works for WPA2 BSS, and WPA2 BSS check must be done before.
+ /* Adopt BSS state in Adapter Device Object
+ * pDevice->byOpMode = OP_MODE_INFRASTRUCTURE;
+ * memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN);
+ */
+
+ /* Add current BSS to Candidate list
+ * This should only works for WPA2 BSS, and WPA2 BSS check must be done before.
+ */
if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
bool bResult = bAdd_PMKID_Candidate((void *)pDevice, pMgmt->abyCurrBSSID, &pCurr->sRSNCapObj);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bAdd_PMKID_Candidate: 1(%d)\n", bResult);
@@ -2663,8 +2647,9 @@ vMgrJoinBSSBegin(
}
}
- // Preamble type auto-switch: if AP can receive short-preamble cap,
- // we can turn on too.
+ /* Preamble type auto-switch: if AP can receive short-preamble cap,
+ * we can turn on too.
+ */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Join ESS\n");
@@ -2674,22 +2659,22 @@ vMgrJoinBSSBegin(
}
} else {
- // ad-hoc mode BSS
+ /* ad-hoc mode BSS */
if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) {
if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
if (!WPA_SearchRSN(0, WPA_TKIP, pCurr)) {
- // encryption mode error
+ /* encryption mode error */
pMgmt->eCurrState = WMAC_STATE_IDLE;
return;
}
} else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
if (!WPA_SearchRSN(0, WPA_AESCCMP, pCurr)) {
- // encryption mode error
+ /* encryption mode error */
pMgmt->eCurrState = WMAC_STATE_IDLE;
return;
}
} else {
- // encryption mode error
+ /* encryption mode error */
pMgmt->eCurrState = WMAC_STATE_IDLE;
return;
}
@@ -2702,16 +2687,16 @@ vMgrJoinBSSBegin(
);
if (*pStatus == CMD_STATUS_SUCCESS) {
- // Adopt this BSS state vars in Mgmt Object
- // TODO: check if CapInfo privacy on, but we don't..
+ /* Adopt this BSS state vars in Mgmt Object */
+ /* TODO: check if CapInfo privacy on, but we don't.. */
pMgmt->uCurrChannel = pCurr->uChannel;
- // Parse Support Rate IE
+ /* Parse Support Rate IE */
pMgmt->abyCurrSuppRates[0] = WLAN_EID_SUPP_RATES;
pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pCurr->abySuppRates,
(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
WLAN_RATES_MAXLEN_11B);
- // set basic rate
+ /* set basic rate */
RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
NULL, true, &wMaxBasicRate, &wMaxSuppRate, &wSuppRate,
&byTopCCKBasicRate, &byTopOFDMBasicRate);
@@ -2721,22 +2706,24 @@ vMgrJoinBSSBegin(
memset(pMgmt->abyCurrSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN);
memcpy(pMgmt->abyCurrBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN);
memcpy(pMgmt->abyCurrSSID, pCurr->abySSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN);
-// pMgmt->wCurrATIMWindow = pCurr->wATIMWindow;
+/* pMgmt->wCurrATIMWindow = pCurr->wATIMWindow; */
MACvWriteATIMW(pDevice->PortOffset, pMgmt->wCurrATIMWindow);
pMgmt->eCurrMode = WMAC_MODE_IBSS_STA;
pMgmt->eCurrState = WMAC_STATE_STARTED;
- // Adopt BSS state in Adapter Device Object
- //pDevice->byOpMode = OP_MODE_ADHOC;
-// pDevice->bLinkPass = true;
-// memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN);
+ /* Adopt BSS state in Adapter Device Object
+ * pDevice->byOpMode = OP_MODE_ADHOC;
+ * pDevice->bLinkPass = true;
+ * memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN);
+ */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Join IBSS ok:%pM\n",
pMgmt->abyCurrBSSID);
- // Preamble type auto-switch: if AP can receive short-preamble cap,
- // and if registry setting is short preamble we can turn on too.
+ /* Preamble type auto-switch: if AP can receive short-preamble cap,
+ * and if registry setting is short preamble we can turn on too.
+ */
- // Prepare beacon
+ /* Prepare beacon */
bMgrPrepareBeaconToSend((void *)pDevice, pMgmt);
} else {
pMgmt->eCurrState = WMAC_STATE_IDLE;
@@ -2766,11 +2753,11 @@ s_vMgrSynchBSS(
{
CARD_PHY_TYPE ePhyType = PHY_TYPE_11B;
PSMgmtObject pMgmt = pDevice->pMgmt;
-// int ii;
- //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M
+/* int ii; */
+ /* 1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M */
unsigned char abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C};
unsigned char abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, 4, 0x0C, 0x12, 0x18, 0x60};
- //6M, 9M, 12M, 48M
+ /* 6M, 9M, 12M, 48M */
unsigned char abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
unsigned char abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
@@ -2786,13 +2773,13 @@ s_vMgrSynchBSS(
pMgmt->pCurrBSS = pCurr;
- // if previous mode is IBSS.
+ /* if previous mode is IBSS. */
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_BCNDMACTL, BEACON_READY);
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
}
- // Init the BSS informations
+ /* Init the BSS informations */
pDevice->bCCK = true;
pDevice->bProtectMode = false;
MACvDisableProtectMD(pDevice->PortOffset);
@@ -2801,25 +2788,26 @@ s_vMgrSynchBSS(
pDevice->bNonERPPresent = false;
pDevice->byPreambleType = 0;
pDevice->wBasicRate = 0;
- // Set Basic Rate
+ /* Set Basic Rate */
CARDbAddBasicRate((void *)pDevice, RATE_1M);
- // calculate TSF offset
- // TSF Offset = Received Timestamp TSF - Marked Local's TSF
+ /* calculate TSF offset */
+ /* TSF Offset = Received Timestamp TSF - Marked Local's TSF */
CARDbUpdateTSF(pDevice, pCurr->byRxRate, pCurr->qwBSSTimestamp, pCurr->qwLocalTSF);
CARDbSetBeaconPeriod(pDevice, pCurr->wBeaconInterval);
- // set Next TBTT
- // Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval
+ /* set Next TBTT */
+ /* Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval */
CARDvSetFirstNextTBTT(pDevice->PortOffset, pCurr->wBeaconInterval);
- // set BSSID
+ /* set BSSID */
MACvWriteBSSIDAddress(pDevice->PortOffset, pCurr->abyBSSID);
MACvReadBSSIDAddress(pDevice->PortOffset, pMgmt->abyCurrBSSID);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:set CurrBSSID address = "
- "%pM\n", pMgmt->abyCurrBSSID);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
+ "Sync:set CurrBSSID address = %pM\n",
+ pMgmt->abyCurrBSSID);
if (pCurr->eNetworkTypeInUse == PHY_TYPE_11A) {
if ((pMgmt->eConfigPHYMode == PHY_TYPE_11A) ||
@@ -2860,11 +2848,11 @@ s_vMgrSynchBSS(
if (WLAN_GET_CAP_INFO_ESS(pCurr->wCapInfo)) {
CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_INFRASTRUCTURE);
- // Add current BSS to Candidate list
- // This should only works for WPA2 BSS, and WPA2 BSS check must be done before.
- if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
+ /* Add current BSS to Candidate list
+ * This should only works for WPA2 BSS, and WPA2 BSS check must be done before.
+ */
+ if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)
CARDbAdd_PMKID_Candidate(pMgmt->pAdapter, pMgmt->abyCurrBSSID, pCurr->sRSNCapObj.bRSNCapExist, pCurr->sRSNCapObj.wRSNCap);
- }
} else {
CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_ADHOC);
}
@@ -2878,7 +2866,7 @@ s_vMgrSynchBSS(
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Phy Mode Fail [%d]\n", ePhyType);
return;
}
- // set channel and clear NAV
+ /* set channel and clear NAV */
if (!set_channel(pMgmt->pAdapter, pCurr->uChannel)) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Channel [%d]\n", pCurr->uChannel);
return;
@@ -2893,13 +2881,13 @@ s_vMgrSynchBSS(
}
if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "RSSI[%d] NewGain[%d] OldGain[%d] \n",
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "RSSI[%d] NewGain[%d] OldGain[%d]\n",
(int)pCurr->ldBmMAX, pDevice->byBBVGANew, pDevice->byBBVGACurrent);
- printk("RSSI[%d] NewGain[%d] OldGain[%d] \n",
+ printk("RSSI[%d] NewGain[%d] OldGain[%d]\n",
(int)pCurr->ldBmMAX, pDevice->byBBVGANew, pDevice->byBBVGACurrent);
BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew);
}
- printk("ldBmMAX[%d] NewGain[%d] OldGain[%d] \n",
+ printk("ldBmMAX[%d] NewGain[%d] OldGain[%d]\n",
(int)pCurr->ldBmMAX, pDevice->byBBVGANew, pDevice->byBBVGACurrent);
*/
pMgmt->uCurrChannel = pCurr->uChannel;
@@ -2912,8 +2900,9 @@ s_vMgrSynchBSS(
return;
};
-//mike add: fix NetworkManager 0.7.0 hidden ssid mode in WPA encryption
-// ,need reset eAuthenMode and eEncryptionStatus
+/* mike add: fix NetworkManager 0.7.0 hidden ssid mode in WPA encryption
+ * ,need reset eAuthenMode and eEncryptionStatus
+ */
static void Encyption_Rebuild(
PSDevice pDevice,
PKnownBSS pCurr
@@ -2921,29 +2910,36 @@ static void Encyption_Rebuild(
{
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- if ((pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || //networkmanager 0.7.0 does not give the pairwise-key selection,
- (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { // so we need re-select it according to real pairwise-key info.
- if (pCurr->bWPAValid) { //WPA-PSK
+ /* networkmanager 0.7.0 does not give the pairwise-key selection,
+ * so we need re-select it according to real pairwise-key info.
+ */
+ if ((pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) ||
+ (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) {
+ if (pCurr->bWPAValid) { /*WPA-PSK */
pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK;
if (pCurr->abyPKType[0] == WPA_TKIP) {
- pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP
+ /* TKIP */
+ pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-TKIP]\n");
} else if (pCurr->abyPKType[0] == WPA_AESCCMP) {
- pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; //AES
+ /* AES */
+ pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-AES]\n");
}
- } else if (pCurr->bWPA2Valid) { //WPA2-PSK
+ } else if (pCurr->bWPA2Valid) { /*WPA2-PSK */
pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK;
if (pCurr->abyCSSPK[0] == WLAN_11i_CSS_TKIP) {
- pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP
+ /* TKIP */
+ pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
PRINT_K("Encyption_Rebuild--->ssid reset config to [WPA2PSK-TKIP]\n");
} else if (pCurr->abyCSSPK[0] == WLAN_11i_CSS_CCMP) {
- pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; //AES
+ /* AES */
+ pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
PRINT_K("Encyption_Rebuild--->ssid reset config to [WPA2PSK-AES]\n");
}
}
}
- // }
+ /* } */
return;
}
@@ -2973,15 +2969,14 @@ s_vMgrFormatTIM(
unsigned short wStartIndex = 0;
unsigned short wEndIndex = 0;
- // Find size of partial virtual bitmap
+ /* Find size of partial virtual bitmap */
for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
byMap = pMgmt->abyPSTxMap[ii];
if (!ii) {
- // Mask out the broadcast bit which is indicated separately.
+ /* Mask out the broadcast bit which is indicated separately. */
bMulticast = (byMap & byMask[0]) != 0;
- if (bMulticast) {
+ if (bMulticast)
pMgmt->sNodeDBTable[0].bRxPSPoll = true;
- }
byMap = 0;
}
if (byMap) {
@@ -2993,29 +2988,28 @@ s_vMgrFormatTIM(
}
}
- // Round start index down to nearest even number
+ /* Round start index down to nearest even number */
wStartIndex &= ~BIT0;
- // Round end index up to nearest even number
+ /* Round end index up to nearest even number */
wEndIndex = ((wEndIndex + 1) & ~BIT0);
- // Size of element payload
+ /* Size of element payload */
pTIM->len = 3 + (wEndIndex - wStartIndex) + 1;
- // Fill in the Fixed parts of the TIM
+ /* Fill in the Fixed parts of the TIM */
pTIM->byDTIMCount = pMgmt->byDTIMCount;
pTIM->byDTIMPeriod = pMgmt->byDTIMPeriod;
pTIM->byBitMapCtl = (bMulticast ? TIM_MULTICAST_MASK : 0) |
(((wStartIndex >> 1) << 1) & TIM_BITMAPOFFSET_MASK);
- // Append variable part of TIM
+ /* Append variable part of TIM */
- for (ii = wStartIndex, jj = 0; ii <= wEndIndex; ii++, jj++) {
+ for (ii = wStartIndex, jj = 0; ii <= wEndIndex; ii++, jj++)
pTIM->byVirtBitMap[jj] = pMgmt->abyPSTxMap[ii];
- }
- // Aid = 0 don't used.
+ /* Aid = 0 don't used. */
pTIM->byVirtBitMap[0] &= ~BIT0;
}
@@ -3053,45 +3047,44 @@ s_MgrMakeBeacon(
PWLAN_IE_IBSS_DFS pIBSSDFS = NULL;
unsigned int ii;
- // prepare beacon frame
+ /* prepare beacon frame */
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_BEACON_FR_MAXLEN);
pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- // Setup the sFrame structure.
+ /* Setup the sFrame structure. */
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_BEACON_FR_MAXLEN;
vMgrEncodeBeacon(&sFrame);
- // Setup the header
+ /* Setup the header */
sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16(
(
WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) |
WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_BEACON)
));
- if (pDevice->bEnablePSMode) {
+ if (pDevice->bEnablePSMode)
sFrame.pHdr->sA3.wFrameCtl |= cpu_to_le16((unsigned short)WLAN_SET_FC_PWRMGT(1));
- }
memcpy(sFrame.pHdr->sA3.abyAddr1, abyBroadcastAddr, WLAN_ADDR_LEN);
memcpy(sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN);
memcpy(sFrame.pHdr->sA3.abyAddr3, pCurrBSSID, WLAN_BSSID_LEN);
*sFrame.pwBeaconInterval = cpu_to_le16(wCurrBeaconPeriod);
*sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo);
- // Copy SSID
+ /* Copy SSID */
sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len);
sFrame.len += ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len + WLAN_IEHDR_LEN;
memcpy(sFrame.pSSID,
pCurrSSID,
((PWLAN_IE_SSID)pCurrSSID)->len + WLAN_IEHDR_LEN
);
- // Copy the rate set
+ /* Copy the rate set */
sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len);
sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN;
memcpy(sFrame.pSuppRates,
pCurrSuppRates,
((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN
);
- // DS parameter
+ /* DS parameter */
if (pDevice->eCurrentPHYType != PHY_TYPE_11A) {
sFrame.pDSParms = (PWLAN_IE_DS_PARMS)(sFrame.pBuf + sFrame.len);
sFrame.len += (1) + WLAN_IEHDR_LEN;
@@ -3099,7 +3092,7 @@ s_MgrMakeBeacon(
sFrame.pDSParms->len = 1;
sFrame.pDSParms->byCurrChannel = (unsigned char)uCurrChannel;
}
- // TIM field
+ /* TIM field */
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
sFrame.pTIM = (PWLAN_IE_TIM)(sFrame.pBuf + sFrame.len);
sFrame.pTIM->byElementID = WLAN_EID_TIM;
@@ -3108,7 +3101,7 @@ s_MgrMakeBeacon(
}
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
- // IBSS parameter
+ /* IBSS parameter */
sFrame.pIBSSParms = (PWLAN_IE_IBSS_PARMS)(sFrame.pBuf + sFrame.len);
sFrame.len += (2) + WLAN_IEHDR_LEN;
sFrame.pIBSSParms->byElementID = WLAN_EID_IBSS_PARMS;
@@ -3128,21 +3121,25 @@ s_MgrMakeBeacon(
sFrame.pRSNWPA->abyMulticast[1] = 0x50;
sFrame.pRSNWPA->abyMulticast[2] = 0xf2;
if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)
- sFrame.pRSNWPA->abyMulticast[3] = 0x04;//AES
+ /* AES */
+ sFrame.pRSNWPA->abyMulticast[3] = 0x04;
else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled)
- sFrame.pRSNWPA->abyMulticast[3] = 0x02;//TKIP
+ /* TKIP */
+ sFrame.pRSNWPA->abyMulticast[3] = 0x02;
else if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled)
- sFrame.pRSNWPA->abyMulticast[3] = 0x01;//WEP40
+ /* WEP40 */
+ sFrame.pRSNWPA->abyMulticast[3] = 0x01;
else
- sFrame.pRSNWPA->abyMulticast[3] = 0x00;//NONE
+ /* NONE */
+ sFrame.pRSNWPA->abyMulticast[3] = 0x00;
- // Pairwise Key Cipher Suite
+ /* Pairwise Key Cipher Suite */
sFrame.pRSNWPA->wPKCount = 0;
- // Auth Key Management Suite
+ /* Auth Key Management Suite */
*((unsigned short *)(sFrame.pBuf + sFrame.len + sFrame.pRSNWPA->len)) = 0;
sFrame.pRSNWPA->len += 2;
- // RSN Capabilities
+ /* RSN Capabilities */
*((unsigned short *)(sFrame.pBuf + sFrame.len + sFrame.pRSNWPA->len)) = 0;
sFrame.pRSNWPA->len += 2;
sFrame.len += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN;
@@ -3150,20 +3147,20 @@ s_MgrMakeBeacon(
}
if (pMgmt->b11hEnable && (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) {
- // Country IE
+ /* Country IE */
pbyBuffer = (unsigned char *)(sFrame.pBuf + sFrame.len);
set_country_IE(pMgmt->pAdapter, pbyBuffer);
set_country_info(pMgmt->pAdapter, PHY_TYPE_11A, pbyBuffer);
uLength += ((PWLAN_IE_COUNTRY) pbyBuffer)->len + WLAN_IEHDR_LEN;
pbyBuffer += (((PWLAN_IE_COUNTRY) pbyBuffer)->len + WLAN_IEHDR_LEN);
- // Power Constrain IE
+ /* Power Constrain IE */
((PWLAN_IE_PW_CONST) pbyBuffer)->byElementID = WLAN_EID_PWR_CONSTRAINT;
((PWLAN_IE_PW_CONST) pbyBuffer)->len = 1;
((PWLAN_IE_PW_CONST) pbyBuffer)->byPower = 0;
pbyBuffer += (1) + WLAN_IEHDR_LEN;
uLength += (1) + WLAN_IEHDR_LEN;
if (pMgmt->bSwitchChannel) {
- // Channel Switch IE
+ /* Channel Switch IE */
((PWLAN_IE_CH_SW) pbyBuffer)->byElementID = WLAN_EID_CH_SWITCH;
((PWLAN_IE_CH_SW) pbyBuffer)->len = 3;
((PWLAN_IE_CH_SW) pbyBuffer)->byMode = 1;
@@ -3172,14 +3169,14 @@ s_MgrMakeBeacon(
pbyBuffer += (3) + WLAN_IEHDR_LEN;
uLength += (3) + WLAN_IEHDR_LEN;
}
- // TPC report
+ /* TPC report */
((PWLAN_IE_TPC_REP) pbyBuffer)->byElementID = WLAN_EID_TPC_REP;
((PWLAN_IE_TPC_REP) pbyBuffer)->len = 2;
((PWLAN_IE_TPC_REP) pbyBuffer)->byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter);
((PWLAN_IE_TPC_REP) pbyBuffer)->byLinkMargin = 0;
pbyBuffer += (2) + WLAN_IEHDR_LEN;
uLength += (2) + WLAN_IEHDR_LEN;
- // IBSS DFS
+ /* IBSS DFS */
if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) {
pIBSSDFS = (PWLAN_IE_IBSS_DFS) pbyBuffer;
pIBSSDFS->byElementID = WLAN_EID_IBSS_DFS;
@@ -3222,7 +3219,7 @@ s_MgrMakeBeacon(
((PWLAN_IE_SUPP_RATES)pCurrExtSuppRates)->len + WLAN_IEHDR_LEN
);
}
- // hostapd wpa/wpa2 IE
+ /* hostapd wpa/wpa2 IE */
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && pDevice->bEnableHostapd) {
if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) {
if (pMgmt->wWPAIELen != 0) {
@@ -3277,11 +3274,11 @@ s_MgrMakeProbeResponse(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBERESP_FR_MAXLEN);
pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- // Setup the sFrame structure.
+ /* Setup the sFrame structure. */
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_PROBERESP_FR_MAXLEN;
vMgrEncodeProbeResponse(&sFrame);
- // Setup the header
+ /* Setup the header */
sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16(
(
WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) |
@@ -3293,18 +3290,17 @@ s_MgrMakeProbeResponse(
*sFrame.pwBeaconInterval = cpu_to_le16(wCurrBeaconPeriod);
*sFrame.pwCapInfo = cpu_to_le16(wCurrCapInfo);
- if (byPHYType == BB_TYPE_11B) {
+ if (byPHYType == BB_TYPE_11B)
*sFrame.pwCapInfo &= cpu_to_le16((unsigned short)~(WLAN_SET_CAP_INFO_SHORTSLOTTIME(1)));
- }
- // Copy SSID
+ /* Copy SSID */
sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len);
sFrame.len += ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len + WLAN_IEHDR_LEN;
memcpy(sFrame.pSSID,
pCurrSSID,
((PWLAN_IE_SSID)pCurrSSID)->len + WLAN_IEHDR_LEN
);
- // Copy the rate set
+ /* Copy the rate set */
sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len);
sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN;
@@ -3313,7 +3309,7 @@ s_MgrMakeProbeResponse(
((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN
);
- // DS parameter
+ /* DS parameter */
if (pDevice->eCurrentPHYType != PHY_TYPE_11A) {
sFrame.pDSParms = (PWLAN_IE_DS_PARMS)(sFrame.pBuf + sFrame.len);
sFrame.len += (1) + WLAN_IEHDR_LEN;
@@ -3323,7 +3319,7 @@ s_MgrMakeProbeResponse(
}
if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) {
- // IBSS parameter
+ /* IBSS parameter */
sFrame.pIBSSParms = (PWLAN_IE_IBSS_PARMS)(sFrame.pBuf + sFrame.len);
sFrame.len += (2) + WLAN_IEHDR_LEN;
sFrame.pIBSSParms->byElementID = WLAN_EID_IBSS_PARMS;
@@ -3345,20 +3341,20 @@ s_MgrMakeProbeResponse(
}
if (pMgmt->b11hEnable && (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) {
- // Country IE
+ /* Country IE */
pbyBuffer = (unsigned char *)(sFrame.pBuf + sFrame.len);
set_country_IE(pMgmt->pAdapter, pbyBuffer);
set_country_info(pMgmt->pAdapter, PHY_TYPE_11A, pbyBuffer);
uLength += ((PWLAN_IE_COUNTRY) pbyBuffer)->len + WLAN_IEHDR_LEN;
pbyBuffer += (((PWLAN_IE_COUNTRY) pbyBuffer)->len + WLAN_IEHDR_LEN);
- // Power Constrain IE
+ /* Power Constrain IE */
((PWLAN_IE_PW_CONST) pbyBuffer)->byElementID = WLAN_EID_PWR_CONSTRAINT;
((PWLAN_IE_PW_CONST) pbyBuffer)->len = 1;
((PWLAN_IE_PW_CONST) pbyBuffer)->byPower = 0;
pbyBuffer += (1) + WLAN_IEHDR_LEN;
uLength += (1) + WLAN_IEHDR_LEN;
if (pMgmt->bSwitchChannel) {
- // Channel Switch IE
+ /* Channel Switch IE */
((PWLAN_IE_CH_SW) pbyBuffer)->byElementID = WLAN_EID_CH_SWITCH;
((PWLAN_IE_CH_SW) pbyBuffer)->len = 3;
((PWLAN_IE_CH_SW) pbyBuffer)->byMode = 1;
@@ -3367,14 +3363,14 @@ s_MgrMakeProbeResponse(
pbyBuffer += (3) + WLAN_IEHDR_LEN;
uLength += (3) + WLAN_IEHDR_LEN;
}
- // TPC report
+ /* TPC report */
((PWLAN_IE_TPC_REP) pbyBuffer)->byElementID = WLAN_EID_TPC_REP;
((PWLAN_IE_TPC_REP) pbyBuffer)->len = 2;
((PWLAN_IE_TPC_REP) pbyBuffer)->byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter);
((PWLAN_IE_TPC_REP) pbyBuffer)->byLinkMargin = 0;
pbyBuffer += (2) + WLAN_IEHDR_LEN;
uLength += (2) + WLAN_IEHDR_LEN;
- // IBSS DFS
+ /* IBSS DFS */
if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) {
pIBSSDFS = (PWLAN_IE_IBSS_DFS) pbyBuffer;
pIBSSDFS->byElementID = WLAN_EID_IBSS_DFS;
@@ -3405,7 +3401,7 @@ s_MgrMakeProbeResponse(
);
}
- // hostapd wpa/wpa2 IE
+ /* hostapd wpa/wpa2 IE */
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && pDevice->bEnableHostapd) {
if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) {
if (pMgmt->wWPAIELen != 0) {
@@ -3416,7 +3412,7 @@ s_MgrMakeProbeResponse(
}
}
- // Adjust the length fields
+ /* Adjust the length fields */
pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
@@ -3454,12 +3450,12 @@ s_MgrMakeAssocRequest(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- // Setup the sFrame structure.
+ /* Setup the sFrame structure. */
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_ASSOCREQ_FR_MAXLEN;
- // format fixed field frame structure
+ /* format fixed field frame structure */
vMgrEncodeAssocRequest(&sFrame);
- // Setup the header
+ /* Setup the header */
sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16(
(
WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) |
@@ -3469,22 +3465,22 @@ s_MgrMakeAssocRequest(
memcpy(sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN);
memcpy(sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
- // Set the capability and listen interval
+ /* Set the capability and listen interval */
*(sFrame.pwCapInfo) = cpu_to_le16(wCurrCapInfo);
*(sFrame.pwListenInterval) = cpu_to_le16(wListenInterval);
- // sFrame.len point to end of fixed field
+ /* sFrame.len point to end of fixed field */
sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len);
sFrame.len += pCurrSSID->len + WLAN_IEHDR_LEN;
memcpy(sFrame.pSSID, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN);
pMgmt->sAssocInfo.AssocInfo.RequestIELength = pCurrSSID->len + WLAN_IEHDR_LEN;
- pMgmt->sAssocInfo.AssocInfo.OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION);
+ pMgmt->sAssocInfo.AssocInfo.OffsetRequestIEs = sizeof(struct NDIS_802_11_ASSOCIATION_INFORMATION);
pbyIEs = pMgmt->sAssocInfo.abyIEs;
memcpy(pbyIEs, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN);
pbyIEs += pCurrSSID->len + WLAN_IEHDR_LEN;
- // Copy the rate set
+ /* Copy the rate set */
sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len);
if ((pDevice->eCurrentPHYType == PHY_TYPE_11B) && (pCurrRates->len > 4))
sFrame.len += 4 + WLAN_IEHDR_LEN;
@@ -3492,7 +3488,7 @@ s_MgrMakeAssocRequest(
sFrame.len += pCurrRates->len + WLAN_IEHDR_LEN;
memcpy(sFrame.pSuppRates, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN);
- // Copy the extension rate set
+ /* Copy the extension rate set */
if ((pDevice->eCurrentPHYType == PHY_TYPE_11G) && (pCurrExtSuppRates->len > 0)) {
sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len);
sFrame.len += pCurrExtSuppRates->len + WLAN_IEHDR_LEN;
@@ -3503,7 +3499,7 @@ s_MgrMakeAssocRequest(
memcpy(pbyIEs, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN);
pbyIEs += pCurrRates->len + WLAN_IEHDR_LEN;
- // for 802.11h
+ /* for 802.11h */
if (pMgmt->b11hEnable) {
if (sFrame.pCurrPowerCap == NULL) {
sFrame.pCurrPowerCap = (PWLAN_IE_PW_CAP)(sFrame.pBuf + sFrame.len);
@@ -3534,32 +3530,30 @@ s_MgrMakeAssocRequest(
sFrame.pRSNWPA->abyOUI[2] = 0xf2;
sFrame.pRSNWPA->abyOUI[3] = 0x01;
sFrame.pRSNWPA->wVersion = 1;
- //Group Key Cipher Suite
+ /* Group Key Cipher Suite */
sFrame.pRSNWPA->abyMulticast[0] = 0x00;
sFrame.pRSNWPA->abyMulticast[1] = 0x50;
sFrame.pRSNWPA->abyMulticast[2] = 0xf2;
- if (pMgmt->byCSSGK == KEY_CTL_WEP) {
+ if (pMgmt->byCSSGK == KEY_CTL_WEP)
sFrame.pRSNWPA->abyMulticast[3] = pMgmt->pCurrBSS->byGKType;
- } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) {
+ else if (pMgmt->byCSSGK == KEY_CTL_TKIP)
sFrame.pRSNWPA->abyMulticast[3] = WPA_TKIP;
- } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) {
+ else if (pMgmt->byCSSGK == KEY_CTL_CCMP)
sFrame.pRSNWPA->abyMulticast[3] = WPA_AESCCMP;
- } else {
+ else
sFrame.pRSNWPA->abyMulticast[3] = WPA_NONE;
- }
- // Pairwise Key Cipher Suite
+ /* Pairwise Key Cipher Suite */
sFrame.pRSNWPA->wPKCount = 1;
sFrame.pRSNWPA->PKSList[0].abyOUI[0] = 0x00;
sFrame.pRSNWPA->PKSList[0].abyOUI[1] = 0x50;
sFrame.pRSNWPA->PKSList[0].abyOUI[2] = 0xf2;
- if (pMgmt->byCSSPK == KEY_CTL_TKIP) {
+ if (pMgmt->byCSSPK == KEY_CTL_TKIP)
sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_TKIP;
- } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) {
+ else if (pMgmt->byCSSPK == KEY_CTL_CCMP)
sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_AESCCMP;
- } else {
+ else
sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_NONE;
- }
- // Auth Key Management Suite
+ /* Auth Key Management Suite */
pbyRSN = (unsigned char *)(sFrame.pBuf + sFrame.len + 2 + sFrame.pRSNWPA->len);
*pbyRSN++ = 0x01;
*pbyRSN++ = 0x00;
@@ -3567,24 +3561,23 @@ s_MgrMakeAssocRequest(
*pbyRSN++ = 0x50;
*pbyRSN++ = 0xf2;
- if (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) {
+ if (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)
*pbyRSN++ = WPA_AUTH_PSK;
- } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA) {
+ else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA)
*pbyRSN++ = WPA_AUTH_IEEE802_1X;
- } else {
+ else
*pbyRSN++ = WPA_NONE;
- }
sFrame.pRSNWPA->len += 6;
- // RSN Capabilities
+ /* RSN Capabilities */
*pbyRSN++ = 0x00;
*pbyRSN++ = 0x00;
sFrame.pRSNWPA->len += 2;
sFrame.len += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN;
- // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION
+ /* copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION */
pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN;
memcpy(pbyIEs, sFrame.pRSNWPA, sFrame.pRSNWPA->len + WLAN_IEHDR_LEN);
pbyIEs += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN;
@@ -3595,72 +3588,69 @@ s_MgrMakeAssocRequest(
unsigned int ii;
unsigned short *pwPMKID;
- // WPA IE
+ /* WPA IE */
sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len);
sFrame.pRSN->byElementID = WLAN_EID_RSN;
- sFrame.pRSN->len = 6; //Version(2)+GK(4)
+ sFrame.pRSN->len = 6; /*Version(2)+GK(4) */
sFrame.pRSN->wVersion = 1;
- //Group Key Cipher Suite
+ /* Group Key Cipher Suite */
sFrame.pRSN->abyRSN[0] = 0x00;
sFrame.pRSN->abyRSN[1] = 0x0F;
sFrame.pRSN->abyRSN[2] = 0xAC;
- if (pMgmt->byCSSGK == KEY_CTL_WEP) {
+ if (pMgmt->byCSSGK == KEY_CTL_WEP)
sFrame.pRSN->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK;
- } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) {
+ else if (pMgmt->byCSSGK == KEY_CTL_TKIP)
sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_TKIP;
- } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) {
+ else if (pMgmt->byCSSGK == KEY_CTL_CCMP)
sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_CCMP;
- } else {
+ else
sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_UNKNOWN;
- }
- // Pairwise Key Cipher Suite
+ /* Pairwise Key Cipher Suite */
sFrame.pRSN->abyRSN[4] = 1;
sFrame.pRSN->abyRSN[5] = 0;
sFrame.pRSN->abyRSN[6] = 0x00;
sFrame.pRSN->abyRSN[7] = 0x0F;
sFrame.pRSN->abyRSN[8] = 0xAC;
- if (pMgmt->byCSSPK == KEY_CTL_TKIP) {
+ if (pMgmt->byCSSPK == KEY_CTL_TKIP)
sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_TKIP;
- } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) {
+ else if (pMgmt->byCSSPK == KEY_CTL_CCMP)
sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_CCMP;
- } else if (pMgmt->byCSSPK == KEY_CTL_NONE) {
+ else if (pMgmt->byCSSPK == KEY_CTL_NONE)
sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_USE_GROUP;
- } else {
+ else
sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_UNKNOWN;
- }
sFrame.pRSN->len += 6;
- // Auth Key Management Suite
+ /* Auth Key Management Suite */
sFrame.pRSN->abyRSN[10] = 1;
sFrame.pRSN->abyRSN[11] = 0;
sFrame.pRSN->abyRSN[12] = 0x00;
sFrame.pRSN->abyRSN[13] = 0x0F;
sFrame.pRSN->abyRSN[14] = 0xAC;
- if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) {
+ if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)
sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_PSK;
- } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
+ else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)
sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_802_1X;
- } else {
+ else
sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN;
- }
sFrame.pRSN->len += 6;
- // RSN Capabilities
- if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist) {
+ /* RSN Capabilities */
+ if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist)
memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2);
- } else {
+ else {
sFrame.pRSN->abyRSN[16] = 0;
sFrame.pRSN->abyRSN[17] = 0;
}
sFrame.pRSN->len += 2;
if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && pDevice->bRoaming && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) {
- // RSN PMKID
+ /* RSN PMKID */
pbyRSN = &sFrame.pRSN->abyRSN[18];
- pwPMKID = (unsigned short *)pbyRSN; // Point to PMKID count
- *pwPMKID = 0; // Initialize PMKID count
- pbyRSN += 2; // Point to PMKID list
+ pwPMKID = (unsigned short *)pbyRSN; /* Point to PMKID count */
+ *pwPMKID = 0; /* Initialize PMKID count */
+ pbyRSN += 2; /* Point to PMKID list */
for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) {
if (!memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], pMgmt->abyCurrBSSID, ETH_ALEN)) {
(*pwPMKID)++;
@@ -3668,19 +3658,18 @@ s_MgrMakeAssocRequest(
pbyRSN += 16;
}
}
- if (*pwPMKID != 0) {
+ if (*pwPMKID != 0)
sFrame.pRSN->len += (2 + (*pwPMKID)*16);
- }
}
sFrame.len += sFrame.pRSN->len + WLAN_IEHDR_LEN;
- // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION
+ /* copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION */
pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSN->len + WLAN_IEHDR_LEN;
memcpy(pbyIEs, sFrame.pRSN, sFrame.pRSN->len + WLAN_IEHDR_LEN);
pbyIEs += sFrame.pRSN->len + WLAN_IEHDR_LEN;
}
- // Adjust the length fields
+ /* Adjust the length fields */
pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
return pTxPacket;
@@ -3721,7 +3710,7 @@ s_MgrMakeReAssocRequest(
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_REASSOCREQ_FR_MAXLEN;
- // format fixed field frame structure
+ /* format fixed field frame structure */
vMgrEncodeReassocRequest(&sFrame);
/* Setup the header */
@@ -3746,7 +3735,7 @@ s_MgrMakeReAssocRequest(
memcpy(sFrame.pSSID, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN);
pMgmt->sAssocInfo.AssocInfo.RequestIELength = pCurrSSID->len + WLAN_IEHDR_LEN;
- pMgmt->sAssocInfo.AssocInfo.OffsetRequestIEs = sizeof(NDIS_802_11_ASSOCIATION_INFORMATION);
+ pMgmt->sAssocInfo.AssocInfo.OffsetRequestIEs = sizeof(struct NDIS_802_11_ASSOCIATION_INFORMATION);
pbyIEs = pMgmt->sAssocInfo.abyIEs;
memcpy(pbyIEs, pCurrSSID, pCurrSSID->len + WLAN_IEHDR_LEN);
pbyIEs += pCurrSSID->len + WLAN_IEHDR_LEN;
@@ -3757,7 +3746,7 @@ s_MgrMakeReAssocRequest(
sFrame.len += pCurrRates->len + WLAN_IEHDR_LEN;
memcpy(sFrame.pSuppRates, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN);
- // Copy the extension rate set
+ /* Copy the extension rate set */
if ((pMgmt->eCurrentPHYMode == PHY_TYPE_11G) && (pCurrExtSuppRates->len > 0)) {
sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len);
sFrame.len += pCurrExtSuppRates->len + WLAN_IEHDR_LEN;
@@ -3781,32 +3770,30 @@ s_MgrMakeReAssocRequest(
sFrame.pRSNWPA->abyOUI[2] = 0xf2;
sFrame.pRSNWPA->abyOUI[3] = 0x01;
sFrame.pRSNWPA->wVersion = 1;
- //Group Key Cipher Suite
+ /* Group Key Cipher Suite */
sFrame.pRSNWPA->abyMulticast[0] = 0x00;
sFrame.pRSNWPA->abyMulticast[1] = 0x50;
sFrame.pRSNWPA->abyMulticast[2] = 0xf2;
- if (pMgmt->byCSSGK == KEY_CTL_WEP) {
+ if (pMgmt->byCSSGK == KEY_CTL_WEP)
sFrame.pRSNWPA->abyMulticast[3] = pMgmt->pCurrBSS->byGKType;
- } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) {
+ else if (pMgmt->byCSSGK == KEY_CTL_TKIP)
sFrame.pRSNWPA->abyMulticast[3] = WPA_TKIP;
- } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) {
+ else if (pMgmt->byCSSGK == KEY_CTL_CCMP)
sFrame.pRSNWPA->abyMulticast[3] = WPA_AESCCMP;
- } else {
+ else
sFrame.pRSNWPA->abyMulticast[3] = WPA_NONE;
- }
- // Pairwise Key Cipher Suite
+ /* Pairwise Key Cipher Suite */
sFrame.pRSNWPA->wPKCount = 1;
sFrame.pRSNWPA->PKSList[0].abyOUI[0] = 0x00;
sFrame.pRSNWPA->PKSList[0].abyOUI[1] = 0x50;
sFrame.pRSNWPA->PKSList[0].abyOUI[2] = 0xf2;
- if (pMgmt->byCSSPK == KEY_CTL_TKIP) {
+ if (pMgmt->byCSSPK == KEY_CTL_TKIP)
sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_TKIP;
- } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) {
+ else if (pMgmt->byCSSPK == KEY_CTL_CCMP)
sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_AESCCMP;
- } else {
+ else
sFrame.pRSNWPA->PKSList[0].abyOUI[3] = WPA_NONE;
- }
- // Auth Key Management Suite
+ /* Auth Key Management Suite */
pbyRSN = (unsigned char *)(sFrame.pBuf + sFrame.len + 2 + sFrame.pRSNWPA->len);
*pbyRSN++ = 0x01;
*pbyRSN++ = 0x00;
@@ -3814,23 +3801,22 @@ s_MgrMakeReAssocRequest(
*pbyRSN++ = 0x50;
*pbyRSN++ = 0xf2;
- if (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) {
+ if (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)
*pbyRSN++ = WPA_AUTH_PSK;
- } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA) {
+ else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA)
*pbyRSN++ = WPA_AUTH_IEEE802_1X;
- } else {
+ else
*pbyRSN++ = WPA_NONE;
- }
sFrame.pRSNWPA->len += 6;
- // RSN Capabilities
+ /* RSN Capabilities */
*pbyRSN++ = 0x00;
*pbyRSN++ = 0x00;
sFrame.pRSNWPA->len += 2;
sFrame.len += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN;
- // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION
+ /* copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION */
pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN;
memcpy(pbyIEs, sFrame.pRSNWPA, sFrame.pRSNWPA->len + WLAN_IEHDR_LEN);
pbyIEs += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN;
@@ -3844,55 +3830,52 @@ s_MgrMakeReAssocRequest(
/* WPA IE */
sFrame.pRSN = (PWLAN_IE_RSN)(sFrame.pBuf + sFrame.len);
sFrame.pRSN->byElementID = WLAN_EID_RSN;
- sFrame.pRSN->len = 6; //Version(2)+GK(4)
+ sFrame.pRSN->len = 6; /* Version(2)+GK(4) */
sFrame.pRSN->wVersion = 1;
- //Group Key Cipher Suite
+ /* Group Key Cipher Suite */
sFrame.pRSN->abyRSN[0] = 0x00;
sFrame.pRSN->abyRSN[1] = 0x0F;
sFrame.pRSN->abyRSN[2] = 0xAC;
- if (pMgmt->byCSSGK == KEY_CTL_WEP) {
+ if (pMgmt->byCSSGK == KEY_CTL_WEP)
sFrame.pRSN->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK;
- } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) {
+ else if (pMgmt->byCSSGK == KEY_CTL_TKIP)
sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_TKIP;
- } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) {
+ else if (pMgmt->byCSSGK == KEY_CTL_CCMP)
sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_CCMP;
- } else {
+ else
sFrame.pRSN->abyRSN[3] = WLAN_11i_CSS_UNKNOWN;
- }
- // Pairwise Key Cipher Suite
+ /* Pairwise Key Cipher Suite */
sFrame.pRSN->abyRSN[4] = 1;
sFrame.pRSN->abyRSN[5] = 0;
sFrame.pRSN->abyRSN[6] = 0x00;
sFrame.pRSN->abyRSN[7] = 0x0F;
sFrame.pRSN->abyRSN[8] = 0xAC;
- if (pMgmt->byCSSPK == KEY_CTL_TKIP) {
+ if (pMgmt->byCSSPK == KEY_CTL_TKIP)
sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_TKIP;
- } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) {
+ else if (pMgmt->byCSSPK == KEY_CTL_CCMP)
sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_CCMP;
- } else if (pMgmt->byCSSPK == KEY_CTL_NONE) {
+ else if (pMgmt->byCSSPK == KEY_CTL_NONE)
sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_USE_GROUP;
- } else {
+ else
sFrame.pRSN->abyRSN[9] = WLAN_11i_CSS_UNKNOWN;
- }
sFrame.pRSN->len += 6;
- // Auth Key Management Suite
+ /* Auth Key Management Suite */
sFrame.pRSN->abyRSN[10] = 1;
sFrame.pRSN->abyRSN[11] = 0;
sFrame.pRSN->abyRSN[12] = 0x00;
sFrame.pRSN->abyRSN[13] = 0x0F;
sFrame.pRSN->abyRSN[14] = 0xAC;
- if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) {
+ if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)
sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_PSK;
- } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
+ else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)
sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_802_1X;
- } else {
+ else
sFrame.pRSN->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN;
- }
sFrame.pRSN->len += 6;
- // RSN Capabilities
+ /* RSN Capabilities */
if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist) {
memcpy(&sFrame.pRSN->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2);
} else {
@@ -3902,11 +3885,11 @@ s_MgrMakeReAssocRequest(
sFrame.pRSN->len += 2;
if ((pDevice->gsPMKID.BSSIDInfoCount > 0) && pDevice->bRoaming && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) {
- // RSN PMKID
+ /* RSN PMKID */
pbyRSN = &sFrame.pRSN->abyRSN[18];
- pwPMKID = (unsigned short *)pbyRSN; // Point to PMKID count
- *pwPMKID = 0; // Initialize PMKID count
- pbyRSN += 2; // Point to PMKID list
+ pwPMKID = (unsigned short *)pbyRSN; /* Point to PMKID count */
+ *pwPMKID = 0; /* Initialize PMKID count */
+ pbyRSN += 2; /* Point to PMKID list */
for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) {
if (!memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], pMgmt->abyCurrBSSID, ETH_ALEN)) {
(*pwPMKID)++;
@@ -3914,13 +3897,12 @@ s_MgrMakeReAssocRequest(
pbyRSN += 16;
}
}
- if (*pwPMKID != 0) {
+ if (*pwPMKID != 0)
sFrame.pRSN->len += (2 + (*pwPMKID) * 16);
- }
}
sFrame.len += sFrame.pRSN->len + WLAN_IEHDR_LEN;
- // copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION
+ /* copy to AssocInfo. for OID_802_11_ASSOCIATION_INFORMATION */
pMgmt->sAssocInfo.AssocInfo.RequestIELength += sFrame.pRSN->len + WLAN_IEHDR_LEN;
memcpy(pbyIEs, sFrame.pRSN, sFrame.pRSN->len + WLAN_IEHDR_LEN);
pbyIEs += sFrame.pRSN->len + WLAN_IEHDR_LEN;
@@ -3962,11 +3944,11 @@ s_MgrMakeAssocResponse(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- // Setup the sFrame structure
+ /* Setup the sFrame structure */
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN;
vMgrEncodeAssocResponse(&sFrame);
- // Setup the header
+ /* Setup the header */
sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16(
(
WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) |
@@ -3980,7 +3962,7 @@ s_MgrMakeAssocResponse(
*sFrame.pwStatus = cpu_to_le16(wAssocStatus);
*sFrame.pwAid = cpu_to_le16((unsigned short)(wAssocAID | BIT14 | BIT15));
- // Copy the rate set
+ /* Copy the rate set */
sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len);
sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN;
memcpy(sFrame.pSuppRates,
@@ -3997,7 +3979,7 @@ s_MgrMakeAssocResponse(
);
}
- // Adjust the length fields
+ /* Adjust the length fields */
pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
@@ -4033,11 +4015,11 @@ s_MgrMakeReAssocResponse(
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
pTxPacket->p80211Header = (union UWLAN_80211HDR *)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- // Setup the sFrame structure
+ /* Setup the sFrame structure */
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_REASSOCRESP_FR_MAXLEN;
vMgrEncodeReassocResponse(&sFrame);
- // Setup the header
+ /* Setup the header */
sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16(
(
WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) |
@@ -4051,7 +4033,7 @@ s_MgrMakeReAssocResponse(
*sFrame.pwStatus = cpu_to_le16(wAssocStatus);
*sFrame.pwAid = cpu_to_le16((unsigned short)(wAssocAID | BIT14 | BIT15));
- // Copy the rate set
+ /* Copy the rate set */
sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len);
sFrame.len += ((PWLAN_IE_SUPP_RATES)pCurrSuppRates)->len + WLAN_IEHDR_LEN;
memcpy(sFrame.pSuppRates,
@@ -4068,7 +4050,7 @@ s_MgrMakeReAssocResponse(
);
}
- // Adjust the length fields
+ /* Adjust the length fields */
pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
@@ -4102,7 +4084,7 @@ s_vMgrRxProbeResponse(
bool bChannelHit = true;
memset(&sFrame, 0, sizeof(WLAN_FR_PROBERESP));
- // decode the frame
+ /* decode the frame */
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
vMgrDecodeProbeResponse(&sFrame);
@@ -4112,32 +4094,32 @@ s_vMgrRxProbeResponse(
(sFrame.pwCapInfo == 0) ||
(sFrame.pSSID == 0) ||
(sFrame.pSuppRates == 0)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p] \n", pRxPacket->p80211Header);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p]\n", pRxPacket->p80211Header);
DBG_PORT80(0xCC);
return;
}
if (sFrame.pSSID->len == 0)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0 \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0\n");
if (sFrame.pDSParms != 0) {
if (byCurrChannel > CB_MAX_CHANNEL_24G) {
- // channel remapping to
+ /* channel remapping to */
byIEChannel = get_channel_mapping(pMgmt->pAdapter, sFrame.pDSParms->byCurrChannel, PHY_TYPE_11A);
} else {
byIEChannel = sFrame.pDSParms->byCurrChannel;
}
if (byCurrChannel != byIEChannel) {
- // adjust channel info. bcs we rcv adjacent channel packets
+ /* adjust channel info. bcs we rcv adjacent channel packets */
bChannelHit = false;
byCurrChannel = byIEChannel;
}
} else {
- // no DS channel info
+ /* no DS channel info */
bChannelHit = true;
}
-//2008-0730-01<Add>by MikeLiu
+/* 2008-0730-01<Add>by MikeLiu */
if (ChannelExceedZoneType(pDevice, byCurrChannel))
return;
@@ -4149,7 +4131,7 @@ s_vMgrRxProbeResponse(
sERP.byERP = 0;
}
- // update or insert the bss
+ /* update or insert the bss */
pBSSList = BSSpAddrIsInBSSList((void *)pDevice, sFrame.pHdr->sA3.abyAddr3, sFrame.pSSID);
if (pBSSList) {
BSSbUpdateToBSSList((void *)pDevice,
@@ -4168,7 +4150,7 @@ s_vMgrRxProbeResponse(
sFrame.pIE_Quiet,
pBSSList,
sFrame.len - WLAN_HDR_ADDR3_LEN,
- sFrame.pHdr->sA4.abyAddr4, // payload of probresponse
+ sFrame.pHdr->sA4.abyAddr4, /* payload of probresponse */
(void *)pRxPacket
);
} else {
@@ -4188,7 +4170,7 @@ s_vMgrRxProbeResponse(
sFrame.pIE_Country,
sFrame.pIE_Quiet,
sFrame.len - WLAN_HDR_ADDR3_LEN,
- sFrame.pHdr->sA4.abyAddr4, // payload of beacon
+ sFrame.pHdr->sA4.abyAddr4, /* payload of beacon */
(void *)pRxPacket
);
}
@@ -4219,12 +4201,13 @@ s_vMgrRxProbeRequest(
PSTxMgmtPacket pTxPacket;
unsigned char byPHYType = BB_TYPE_11B;
- // STA in Ad-hoc mode: when latest TBTT beacon transmit success,
- // STA have to response this request.
+ /* STA in Ad-hoc mode: when latest TBTT beacon transmit success,
+ * STA have to response this request.
+ */
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) ||
((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && pDevice->bBeaconSent)) {
memset(&sFrame, 0, sizeof(WLAN_FR_PROBEREQ));
- // decode the frame
+ /* decode the frame */
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
vMgrDecodeProbeRequest(&sFrame);
@@ -4242,11 +4225,10 @@ s_vMgrRxProbeRequest(
}
}
- if ((sFrame.pSuppRates->len > 4) || (sFrame.pExtSuppRates != NULL)) {
+ if ((sFrame.pSuppRates->len > 4) || (sFrame.pExtSuppRates != NULL))
byPHYType = BB_TYPE_11G;
- }
- // Probe response reply..
+ /* Probe response reply.. */
pTxPacket = s_MgrMakeProbeResponse
(
pDevice,
@@ -4265,11 +4247,12 @@ s_vMgrRxProbeRequest(
if (pTxPacket != NULL) {
/* send the frame */
Status = csMgmt_xmit(pDevice, pTxPacket);
- if (Status != CMD_STATUS_PENDING) {
+ if (Status != CMD_STATUS_PENDING)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx failed\n");
- } else {
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx sending..\n");
- }
+/* else
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx sending..\n");
+ ;
+*/
}
}
@@ -4310,11 +4293,12 @@ vMgrRxManagePacket(
switch (WLAN_GET_FC_FSTYPE((pRxPacket->p80211Header->sA3.wFrameCtl))) {
case WLAN_FSTYPE_ASSOCREQ:
- // Frame Clase = 2
+ /* Frame Clase = 2 */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocreq\n");
if (eNodeState < NODE_AUTH) {
- // send deauth notification
- // reason = (6) class 2 received from nonauth sta
+ /* send deauth notification
+ * reason = (6) class 2 received from nonauth sta
+ */
vMgrDeAuthenBeginSta(pDevice,
pMgmt,
pRxPacket->p80211Header->sA3.abyAddr2,
@@ -4328,19 +4312,19 @@ vMgrRxManagePacket(
break;
case WLAN_FSTYPE_ASSOCRESP:
- // Frame Clase = 2
+ /* Frame Clase = 2 */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp1\n");
s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, false);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx assocresp2\n");
break;
case WLAN_FSTYPE_REASSOCREQ:
- // Frame Clase = 2
+ /* Frame Clase = 2 */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocreq\n");
- // Todo: reassoc
+ /* Todo: reassoc */
if (eNodeState < NODE_AUTH) {
- // send deauth notification
- // reason = (6) class 2 received from nonauth sta
+ /* send deauth notification */
+ /* reason = (6) class 2 received from nonauth sta */
vMgrDeAuthenBeginSta(pDevice,
pMgmt,
pRxPacket->p80211Header->sA3.abyAddr2,
@@ -4354,44 +4338,44 @@ vMgrRxManagePacket(
break;
case WLAN_FSTYPE_REASSOCRESP:
- // Frame Clase = 2
+ /* Frame Clase = 2 */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx reassocresp\n");
s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket, true);
break;
case WLAN_FSTYPE_PROBEREQ:
- // Frame Clase = 0
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx probereq\n");
+ /* Frame Clase = 0 */
+ /* DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx probereq\n"); */
s_vMgrRxProbeRequest(pDevice, pMgmt, pRxPacket);
break;
case WLAN_FSTYPE_PROBERESP:
- // Frame Clase = 0
+ /* Frame Clase = 0 */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx proberesp\n");
s_vMgrRxProbeResponse(pDevice, pMgmt, pRxPacket);
break;
case WLAN_FSTYPE_BEACON:
- // Frame Clase = 0
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx beacon\n");
- if (pMgmt->eScanState != WMAC_NO_SCANNING) {
+ /* Frame Clase = 0 */
+ /* DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx beacon\n"); */
+ if (pMgmt->eScanState != WMAC_NO_SCANNING)
bInScan = true;
- }
s_vMgrRxBeacon(pDevice, pMgmt, pRxPacket, bInScan);
break;
case WLAN_FSTYPE_ATIM:
- // Frame Clase = 1
+ /* Frame Clase = 1 */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx atim\n");
break;
case WLAN_FSTYPE_DISASSOC:
- // Frame Clase = 2
+ /* Frame Clase = 2 */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx disassoc\n");
if (eNodeState < NODE_AUTH) {
- // send deauth notification
- // reason = (6) class 2 received from nonauth sta
+ /* send deauth notification
+ * reason = (6) class 2 received from nonauth sta
+ */
vMgrDeAuthenBeginSta(pDevice,
pMgmt,
pRxPacket->p80211Header->sA3.abyAddr2,
@@ -4404,13 +4388,13 @@ vMgrRxManagePacket(
break;
case WLAN_FSTYPE_AUTHEN:
- // Frame Clase = 1
+ /* Frame Clase = 1 */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx authen\n");
s_vMgrRxAuthentication(pDevice, pMgmt, pRxPacket);
break;
case WLAN_FSTYPE_DEAUTHEN:
- // Frame Clase = 1
+ /* Frame Clase = 1 */
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "rx deauthen\n");
s_vMgrRxDeauthentication(pDevice, pMgmt, pRxPacket);
break;
@@ -4442,12 +4426,11 @@ bMgrPrepareBeaconToSend(
PSDevice pDevice = (PSDevice)hDeviceContext;
PSTxMgmtPacket pTxPacket;
-// pDevice->bBeaconBufReady = false;
- if (pDevice->bEncryptionEnable || pDevice->bEnable8021x) {
+/* pDevice->bBeaconBufReady = false; */
+ if (pDevice->bEncryptionEnable || pDevice->bEnable8021x)
pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_PRIVACY(1);
- } else {
+ else
pMgmt->wCurrCapInfo &= ~WLAN_SET_CAP_INFO_PRIVACY(1);
- }
pTxPacket = s_MgrMakeBeacon
(
pDevice,
@@ -4455,7 +4438,7 @@ bMgrPrepareBeaconToSend(
pMgmt->wCurrCapInfo,
pMgmt->wCurrBeaconPeriod,
pMgmt->uCurrChannel,
- pMgmt->wCurrATIMWindow, //0,
+ pMgmt->wCurrATIMWindow, /* 0, */
(PWLAN_IE_SSID)pMgmt->abyCurrSSID,
(unsigned char *)pMgmt->abyCurrBSSID,
(PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates,
@@ -4571,26 +4554,24 @@ bAdd_PMKID_Candidate(
if (pDevice->gsPMKIDCandidate.NumCandidates >= MAX_PMKIDLIST)
return false;
- // Update Old Candidate
+ /* Update Old Candidate */
for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) {
pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii];
if (!memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) {
- if (psRSNCapObj->bRSNCapExist && (psRSNCapObj->wRSNCap & BIT0)) {
+ if (psRSNCapObj->bRSNCapExist && (psRSNCapObj->wRSNCap & BIT0))
pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED;
- } else {
+ else
pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED);
- }
return true;
}
}
- // New Candidate
+ /* New Candidate */
pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[pDevice->gsPMKIDCandidate.NumCandidates];
- if (psRSNCapObj->bRSNCapExist && (psRSNCapObj->wRSNCap & BIT0)) {
+ if (psRSNCapObj->bRSNCapExist && (psRSNCapObj->wRSNCap & BIT0))
pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED;
- } else {
+ else
pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED);
- }
memcpy(pCandidateList->BSSID, pbyBSSID, ETH_ALEN);
pDevice->gsPMKIDCandidate.NumCandidates++;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates);
@@ -4639,19 +4620,20 @@ s_bCipherMatch(
if (pBSSNode == NULL)
return false;
- // check cap. of BSS
+ /* check cap. of BSS */
if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) &&
(EncStatus == Ndis802_11Encryption1Enabled)) {
- // default is WEP only
+ /* default is WEP only */
byMulticastCipher = KEY_CTL_WEP;
}
if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) &&
pBSSNode->bWPA2Valid &&
- //20080123-01,<Add> by Einsn Liu
+ /* 20080123-01,<Add> by Einsn Liu */
((EncStatus == Ndis802_11Encryption3Enabled) || (EncStatus == Ndis802_11Encryption2Enabled))) {
- //WPA2
- // check Group Key Cipher
+ /* WPA2
+ * check Group Key Cipher
+ */
if ((pBSSNode->byCSSGK == WLAN_11i_CSS_WEP40) ||
(pBSSNode->byCSSGK == WLAN_11i_CSS_WEP104)) {
byMulticastCipher = KEY_CTL_WEP;
@@ -4663,18 +4645,18 @@ s_bCipherMatch(
byMulticastCipher = KEY_CTL_INVALID;
}
- // check Pairwise Key Cipher
+ /* check Pairwise Key Cipher */
for (i = 0; i < pBSSNode->wCSSPKCount; i++) {
if ((pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_WEP40) ||
(pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_WEP104)) {
- // this should not happen as defined 802.11i
+ /* this should not happen as defined 802.11i */
byCipherMask |= 0x01;
} else if (pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_TKIP) {
byCipherMask |= 0x02;
} else if (pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_CCMP) {
byCipherMask |= 0x04;
} else if (pBSSNode->abyCSSPK[i] == WLAN_11i_CSS_USE_GROUP) {
- // use group key only ignore all others
+ /* use group key only ignore all others */
byCipherMask = 0;
i = pBSSNode->wCSSPKCount;
}
@@ -4683,8 +4665,9 @@ s_bCipherMatch(
} else if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) &&
pBSSNode->bWPAValid &&
((EncStatus == Ndis802_11Encryption3Enabled) || (EncStatus == Ndis802_11Encryption2Enabled))) {
- //WPA
- // check Group Key Cipher
+ /* WPA
+ * check Group Key Cipher
+ */
if ((pBSSNode->byGKType == WPA_WEP40) ||
(pBSSNode->byGKType == WPA_WEP104)) {
byMulticastCipher = KEY_CTL_WEP;
@@ -4696,14 +4679,14 @@ s_bCipherMatch(
byMulticastCipher = KEY_CTL_INVALID;
}
- // check Pairwise Key Cipher
+ /* check Pairwise Key Cipher */
for (i = 0; i < pBSSNode->wPKCount; i++) {
if (pBSSNode->abyPKType[i] == WPA_TKIP) {
byCipherMask |= 0x02;
} else if (pBSSNode->abyPKType[i] == WPA_AESCCMP) {
byCipherMask |= 0x04;
} else if (pBSSNode->abyPKType[i] == WPA_NONE) {
- // use group key only ignore all others
+ /* use group key only ignore all others */
byCipherMask = 0;
i = pBSSNode->wPKCount;
}
@@ -4713,9 +4696,9 @@ s_bCipherMatch(
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%d, %d, %d, %d, EncStatus:%d\n",
byMulticastCipher, byCipherMask, pBSSNode->bWPAValid, pBSSNode->bWPA2Valid, EncStatus);
- // mask our cap. with BSS
+ /* mask our cap. with BSS */
if (EncStatus == Ndis802_11Encryption1Enabled) {
- // For supporting Cisco migration mode, don't care pairwise key cipher
+ /* For supporting Cisco migration mode, don't care pairwise key cipher */
if ((byMulticastCipher == KEY_CTL_WEP) &&
(byCipherMask == 0)) {
*pbyCCSGK = KEY_CTL_WEP;
@@ -4747,7 +4730,7 @@ s_bCipherMatch(
} else if (EncStatus == Ndis802_11Encryption3Enabled) {
if ((byMulticastCipher == KEY_CTL_CCMP) &&
(byCipherMask == 0)) {
- // When CCMP is enable, "Use group cipher suite" shall not be a valid option.
+ /* When CCMP is enable, "Use group cipher suite" shall not be a valid option. */
return false;
} else if ((byMulticastCipher == KEY_CTL_WEP) &&
((byCipherMask & 0x04) != 0)) {
diff --git a/drivers/staging/vt6655/wmgr.h b/drivers/staging/vt6655/wmgr.h
index 4026843..e0c9e4c 100644
--- a/drivers/staging/vt6655/wmgr.h
+++ b/drivers/staging/vt6655/wmgr.h
@@ -45,24 +45,24 @@
/*--------------------- Export Definitions -------------------------*/
-// Scan time
-#define PROBE_DELAY 100 // (us)
-#define SWITCH_CHANNEL_DELAY 200 // (us)
-#define WLAN_SCAN_MINITIME 25 // (ms)
-#define WLAN_SCAN_MAXTIME 100 // (ms)
-#define TRIVIAL_SYNC_DIFFERENCE 0 // (us)
-#define DEFAULT_IBSS_BI 100 // (ms)
+/* Scan time */
+#define PROBE_DELAY 100 /* (us) */
+#define SWITCH_CHANNEL_DELAY 200 /* (us) */
+#define WLAN_SCAN_MINITIME 25 /* (ms) */
+#define WLAN_SCAN_MAXTIME 100 /* (ms) */
+#define TRIVIAL_SYNC_DIFFERENCE 0 /* (us) */
+#define DEFAULT_IBSS_BI 100 /* (ms) */
-#define WCMD_ACTIVE_SCAN_TIME 50 //(ms)
-#define WCMD_PASSIVE_SCAN_TIME 100 //(ms)
+#define WCMD_ACTIVE_SCAN_TIME 50 /* (ms) */
+#define WCMD_PASSIVE_SCAN_TIME 100 /* (ms) */
-#define DEFAULT_MSDU_LIFETIME 512 // ms
-#define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us
+#define DEFAULT_MSDU_LIFETIME 512 /* ms */
+#define DEFAULT_MSDU_LIFETIME_RES_64us 8000 /* 64us */
-#define DEFAULT_MGN_LIFETIME 8 // ms
-#define DEFAULT_MGN_LIFETIME_RES_64us 125 // 64us
+#define DEFAULT_MGN_LIFETIME 8 /* ms */
+#define DEFAULT_MGN_LIFETIME_RES_64us 125 /* 64us */
-#define MAKE_BEACON_RESERVED 10 //(us)
+#define MAKE_BEACON_RESERVED 10 /* (us) */
#define TIM_MULTICAST_MASK 0x01
#define TIM_BITMAPOFFSET_MASK 0xFE
@@ -70,7 +70,7 @@
#define AP_LONG_RETRY_LIMIT 4
-#define DEFAULT_IBSS_CHANNEL 6 //2.4G
+#define DEFAULT_IBSS_CHANNEL 6 /* 2.4G */
/*--------------------- Export Classes ----------------------------*/
@@ -80,44 +80,41 @@
#define timer_expire(timer, next_tick) mod_timer(&timer, RUN_AT(next_tick))
typedef void (*TimerFunction)(unsigned long);
-//+++ NDIS related
+/* +++ NDIS related */
typedef unsigned char NDIS_802_11_MAC_ADDRESS[6];
-typedef struct _NDIS_802_11_AI_REQFI
-{
+struct NDIS_802_11_AI_REQFI {
unsigned short Capabilities;
unsigned short ListenInterval;
NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
-} NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
+};
-typedef struct _NDIS_802_11_AI_RESFI
-{
+struct NDIS_802_11_AI_RESFI {
unsigned short Capabilities;
unsigned short StatusCode;
unsigned short AssociationId;
-} NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
+};
-typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
-{
+struct NDIS_802_11_ASSOCIATION_INFORMATION {
unsigned long Length;
unsigned short AvailableRequestFixedIEs;
- NDIS_802_11_AI_REQFI RequestFixedIEs;
+ struct NDIS_802_11_AI_REQFI RequestFixedIEs;
unsigned long RequestIELength;
unsigned long OffsetRequestIEs;
unsigned short AvailableResponseFixedIEs;
- NDIS_802_11_AI_RESFI ResponseFixedIEs;
+ struct NDIS_802_11_AI_RESFI ResponseFixedIEs;
unsigned long ResponseIELength;
unsigned long OffsetResponseIEs;
-} NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
+};
-typedef struct tagSAssocInfo {
- NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
+struct SAssocInfo {
+ struct NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
unsigned char abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN];
- // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION
+ /* store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION */
unsigned long RequestIELength;
unsigned char abyReqIEs[WLAN_BEACON_FR_MAXLEN];
-} SAssocInfo, *PSAssocInfo;
-//---
+};
+/*--- */
/*
typedef enum tagWMAC_AUTHENTICATION_MODE {
@@ -134,7 +131,7 @@ typedef struct tagSAssocInfo {
} WMAC_AUTHENTICATION_MODE, *PWMAC_AUTHENTICATION_MODE;
*/
-// Pre-configured Mode (from XP)
+/* Pre-configured Mode (from XP) */
/*
typedef enum tagWMAC_CONFIG_MODE {
WMAC_CONFIG_ESS_STA,
@@ -145,29 +142,30 @@ typedef struct tagSAssocInfo {
} WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE;
*/
-typedef enum tagWMAC_SCAN_TYPE {
+enum WMAC_SCAN_TYPE {
WMAC_SCAN_ACTIVE,
WMAC_SCAN_PASSIVE,
WMAC_SCAN_HYBRID
-} WMAC_SCAN_TYPE, *PWMAC_SCAN_TYPE;
+};
-typedef enum tagWMAC_SCAN_STATE {
+enum WMAC_SCAN_STATE {
WMAC_NO_SCANNING,
WMAC_IS_SCANNING,
WMAC_IS_PROBEPENDING
-} WMAC_SCAN_STATE, *PWMAC_SCAN_STATE;
-
-// Notes:
-// Basic Service Set state explained as following:
-// WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra)
-// WMAC_STATE_STARTED : no BSS is selected, start own IBSS (Adhoc only)
-// WMAC_STATE_JOINTED : BSS is selected and synchronized (Adhoc or Infra)
-// WMAC_STATE_AUTHPENDING : Authentication pending (Infra)
-// WMAC_STATE_AUTH : Authenticated (Infra)
-// WMAC_STATE_ASSOCPENDING : Association pending (Infra)
-// WMAC_STATE_ASSOC : Associated (Infra)
-
-typedef enum tagWMAC_BSS_STATE {
+};
+
+/* Notes:
+ * Basic Service Set state explained as following:
+ * WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra)
+ * WMAC_STATE_STARTED : no BSS is selected, start own IBSS (Adhoc only)
+ * WMAC_STATE_JOINTED : BSS is selected and synchronized (Adhoc or Infra)
+ * WMAC_STATE_AUTHPENDING : Authentication pending (Infra)
+ * WMAC_STATE_AUTH : Authenticated (Infra)
+ * WMAC_STATE_ASSOCPENDING : Association pending (Infra)
+ * WMAC_STATE_ASSOC : Associated (Infra)
+ */
+
+enum WMAC_BSS_STATE {
WMAC_STATE_IDLE,
WMAC_STATE_STARTED,
WMAC_STATE_JOINTED,
@@ -175,15 +173,15 @@ typedef enum tagWMAC_BSS_STATE {
WMAC_STATE_AUTH,
WMAC_STATE_ASSOCPENDING,
WMAC_STATE_ASSOC
-} WMAC_BSS_STATE, *PWMAC_BSS_STATE;
+};
-// WMAC selected running mode
-typedef enum tagWMAC_CURRENT_MODE {
+/* WMAC selected running mode */
+enum WMAC_CURRENT_MODE {
WMAC_MODE_STANDBY,
WMAC_MODE_ESS_STA,
WMAC_MODE_IBSS_STA,
WMAC_MODE_ESS_AP
-} WMAC_CURRENT_MODE, *PWMAC_CURRENT_MODE;
+};
/*
typedef enum tagWMAC_POWER_MODE {
@@ -194,14 +192,14 @@ typedef enum tagWMAC_CURRENT_MODE {
} WMAC_POWER_MODE, *PWMAC_POWER_MODE;
*/
-// Tx Management Packet descriptor
+/* Tx Management Packet descriptor */
typedef struct tagSTxMgmtPacket {
union UWLAN_80211HDR *p80211Header;
unsigned int cbMPDULen;
unsigned int cbPayloadLen;
} STxMgmtPacket, *PSTxMgmtPacket;
-// Rx Management Packet descriptor
+/* Rx Management Packet descriptor */
typedef struct tagSRxMgmtPacket {
union UWLAN_80211HDR *p80211Header;
QWORD qwLocalTSF;
@@ -213,32 +211,32 @@ typedef struct tagSRxMgmtPacket {
unsigned char byRxChannel;
} SRxMgmtPacket, *PSRxMgmtPacket;
-typedef struct tagSMgmtObject
-{
+typedef struct tagSMgmtObject {
void *pAdapter;
- // MAC address
+ /* MAC address */
unsigned char abyMACAddr[WLAN_ADDR_LEN];
- // Configuration Mode
- WMAC_CONFIG_MODE eConfigMode; // MAC pre-configed mode
+ /* Configuration Mode */
+ WMAC_CONFIG_MODE eConfigMode; /* MAC pre-configed mode */
CARD_PHY_TYPE eCurrentPHYMode;
CARD_PHY_TYPE eConfigPHYMode;
- // Operation state variables
- WMAC_CURRENT_MODE eCurrMode; // MAC current connection mode
- WMAC_BSS_STATE eCurrState; // MAC current BSS state
+ /* Operation state variables */
+ enum WMAC_CURRENT_MODE eCurrMode; /* MAC current connection mode */
+ enum WMAC_BSS_STATE eCurrState; /* MAC current BSS state */
PKnownBSS pCurrBSS;
unsigned char byCSSGK;
unsigned char byCSSPK;
-// unsigned char abyNewSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
-// unsigned char abyNewExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
+/* unsigned char abyNewSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN]; */
+/* unsigned char abyNewExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN]; */
- // Current state vars
+ /* Current state vars */
unsigned int uCurrChannel;
unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
- unsigned char abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
+ unsigned char abyCurrExtSuppRates[WLAN_IEHDR_LEN
+ + WLAN_RATES_MAXLEN + 1];
unsigned char abyCurrSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
unsigned char abyCurrBSSID[WLAN_BSSID_LEN];
unsigned short wCurrCapInfo;
@@ -251,12 +249,13 @@ typedef struct tagSMgmtObject
CMD_STATE eCommandState;
unsigned int uScanChannel;
- // Desire joining BSS vars
+ /* Desire joining BSS vars */
unsigned char abyDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
unsigned char abyDesireBSSID[WLAN_BSSID_LEN];
- // Adhoc or AP configuration vars
- //unsigned char abyAdHocSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
+ /* Adhoc or AP configuration vars
+ * unsigned char abyAdHocSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
+ */
unsigned short wIBSSBeaconPeriod;
unsigned short wIBSSATIMWindow;
unsigned int uIBSSChannel;
@@ -268,79 +267,85 @@ typedef struct tagSMgmtObject
unsigned int uAssocCount;
bool bMoreData;
- // Scan state vars
- WMAC_SCAN_STATE eScanState;
- WMAC_SCAN_TYPE eScanType;
+ /* Scan state vars */
+ enum WMAC_SCAN_STATE eScanState;
+ enum WMAC_SCAN_TYPE eScanType;
unsigned int uScanStartCh;
unsigned int uScanEndCh;
unsigned short wScanSteps;
unsigned int uScanBSSType;
- // Desire scanning vars
- unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
+ /* Desire scanning vars */
+ unsigned char abyScanSSID[WLAN_IEHDR_LEN
+ + WLAN_SSID_MAXLEN + 1];
unsigned char abyScanBSSID[WLAN_BSSID_LEN];
- // Privacy
+ /* Privacy */
WMAC_AUTHENTICATION_MODE eAuthenMode;
WMAC_ENCRYPTION_MODE eEncryptionMode;
bool bShareKeyAlgorithm;
unsigned char abyChallenge[WLAN_CHALLENGE_LEN];
bool bPrivacyInvoked;
- // Received beacon state vars
+ /* Received beacon state vars */
bool bInTIM;
bool bMulticastTIM;
unsigned char byDTIMCount;
unsigned char byDTIMPeriod;
- // Power saving state vars
+ /* Power saving state vars */
WMAC_POWER_MODE ePSMode;
unsigned short wListenInterval;
unsigned short wCountToWakeUp;
bool bInTIMWake;
unsigned char *pbyPSPacketPool;
- unsigned char byPSPacketPool[sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN];
+ unsigned char byPSPacketPool[sizeof(STxMgmtPacket)
+ + WLAN_NULLDATA_FR_MAXLEN];
bool bRxBeaconInTBTTWake;
unsigned char abyPSTxMap[MAX_NODE_NUM + 1];
- // management command related
+ /* management command related */
unsigned int uCmdBusy;
unsigned int uCmdHostAPBusy;
- // management packet pool
+ /* management packet pool */
unsigned char *pbyMgmtPacketPool;
- unsigned char byMgmtPacketPool[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
+ unsigned char byMgmtPacketPool[sizeof(STxMgmtPacket)
+ + WLAN_A3FR_MAXLEN];
- // One second callback timer
+ /* One second callback timer */
struct timer_list sTimerSecondCallback;
- // Temporarily Rx Mgmt Packet Descriptor
+ /* Temporarily Rx Mgmt Packet Descriptor */
SRxMgmtPacket sRxPacket;
- // link list of known bss's (scan results)
+ /* link list of known bss's (scan results) */
KnownBSS sBSSList[MAX_BSS_NUM];
- // table list of known node
- // sNodeDBList[0] is reserved for AP under Infra mode
- // sNodeDBList[0] is reserved for Multicast under adhoc/AP mode
+ /* table list of known node
+ * sNodeDBList[0] is reserved for AP under Infra mode
+ * sNodeDBList[0] is reserved for Multicast under adhoc/AP mode
+ */
KnownNodeDB sNodeDBTable[MAX_NODE_NUM + 1];
- // WPA2 PMKID Cache
+ /* WPA2 PMKID Cache */
struct SPMKIDCache gsPMKIDCache;
bool bRoaming;
- // rate fall back vars
+ /* rate fall back vars */
- // associate info
- SAssocInfo sAssocInfo;
+ /* associate info */
+ struct SAssocInfo sAssocInfo;
- // for 802.11h
+ /* for 802.11h */
bool b11hEnable;
bool bSwitchChannel;
unsigned char byNewChannel;
PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep;
unsigned int uLengthOfRepEIDs;
- unsigned char abyCurrentMSRReq[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
- unsigned char abyCurrentMSRRep[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
+ unsigned char abyCurrentMSRReq[sizeof(STxMgmtPacket)
+ + WLAN_A3FR_MAXLEN];
+ unsigned char abyCurrentMSRRep[sizeof(STxMgmtPacket)
+ + WLAN_A3FR_MAXLEN];
unsigned char abyIECountry[WLAN_A3FR_MAXLEN];
unsigned char abyIBSSDFSOwner[6];
unsigned char byIBSSDFSRecovery;
@@ -451,4 +456,4 @@ vFlush_PMKID_Candidate(
void *hDeviceContext
);
-#endif // __WMGR_H__
+#endif /* __WMGR_H__ */
--
1.8.1.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/7] vt6655: Fix most of checkpatch.pl errors in wroute
2013-12-30 14:52 ` [PATCH 2/7] vt6655: Fix most of checkpatch.pl errors in wroute Michael Gunselmann
@ 2013-12-31 11:12 ` Dan Carpenter
0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2013-12-31 11:12 UTC (permalink / raw)
To: Michael Gunselmann
Cc: devel, linux-kernel, gregkh, linux-kernel, martin.hofmann, forest
On Mon, Dec 30, 2013 at 03:52:32PM +0100, Michael Gunselmann wrote:
> wroute.h: Fixed all line-over-80-character errors. No errors remain.
> wroute.c: Fixed line-over-80-character errors, bracing errors
> and C99-comments.
> Three warnings remain, fixing them would deteriorate readability.
> One warning on a memory barrier without comment in line 189
> will be fixed in a later commit because it's purpose is not
> yet known.
>
Don't do the weird indenting.
> @@ -86,22 +88,25 @@ bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uData
>
> pHeadTD->m_td1TD1.byTCR = (TCR_EDP | TCR_STP);
>
> - memcpy(pDevice->sTxEthHeader.abyDstAddr, (unsigned char *)pbySkbData, ETH_HLEN);
> + memcpy(pDevice->sTxEthHeader.abyDstAddr,
> + (unsigned char *)pbySkbData, ETH_HLEN);
>
It would be better to fix this like so:
memcpy(pDevice->sTxEthHeader.abyDstAddr, pbySkbData, ETH_HLEN);
> - }
> + else
> + pDevice->wCurrentRate =
> + (unsigned short)pDevice->uConnectionRate;
Remove the silly cast here as well.
pDevice->wCurrentRate = pDevice->uConnectionRate;
Both your patch and mine are still 81 characters long.
I don't get upset by lines over 80 characters... Eventually we will fix
that. Just leave it as-is, until we can clean it up from a human
perspective as well as from a checkpatch.pl robot perspective.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/7] vt6655: Fixed most of the checkpatch warnings in wpa2
2013-12-30 14:52 ` [PATCH 4/7] vt6655: Fixed most of the checkpatch warnings in wpa2 Michael Gunselmann
@ 2013-12-31 16:52 ` Dan Carpenter
0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2013-12-31 16:52 UTC (permalink / raw)
To: Michael Gunselmann
Cc: devel, linux-kernel, gregkh, linux-kernel, martin.hofmann, forest
On Mon, Dec 30, 2013 at 03:52:34PM +0100, Michael Gunselmann wrote:
> wpa2.h: Checkpatch does no longer complain about anything
>
> wpa2.c: Checkpatch complains about some lines that are longer than
> 80 characters. Breaking them would deteriorate the readability
> so these lines were not touched.
>
> vntwifi.c: Fixing style problems in wpa2.h made it necessary to adjust
> variable declarations that depended on typedefs in wpa2.h.
> The checkpatch cleanup of this file still remains.
>
This patch changes too many things at once to review comfortably. It
random changes to several files all jumbled together. Break it apart
into logical chunks and resend.
>
> - if (pRSN->len >= 8) { // ver(2) + GK(4) + PK count(2)
> - pBSSNode->wCSSPKCount = *((unsigned short *)&(pRSN->abyRSN[4]));
> + if (pRSN->len >= 8) { /* ver(2) + GK(4) + PK count(2) */
> + pBSSNode->wCSSPKCount =
> + *((unsigned short *)&(pRSN->abyRSN[4]));
> j = 0;
> pbyOUI = &(pRSN->abyRSN[6]);
>
> - for (i = 0; (i < pBSSNode->wCSSPKCount) && (j < sizeof(pBSSNode->abyCSSPK)/sizeof(unsigned char)); i++) {
> - if (pRSN->len >= 8+i*4+4) { // ver(2)+GK(4)+PKCnt(2)+PKS(4*i)
> + for (i = 0; (i < pBSSNode->wCSSPKCount)
> + && (j < sizeof(pBSSNode->abyCSSPK)/sizeof(unsigned char));
> + i++) {
This for loop is a quite nasty. It would be better to check "j"
separately inside the loop. There should be spaces around the divide
operation but really the "j" condition should just be:
j < ARRAY_SIZE(pBSSNode->abyCSSPK)
> + /* ver(2)+GK(4)+PKCnt(2)+PKS(4*i) */
> + if (pRSN->len >= 8+i*4+4) {
> if (!memcmp(pbyOUI, abyOUIGK, 4)) {
> - pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_USE_GROUP;
> + pBSSNode->abyCSSPK[j++] =
> + WLAN_11i_CSS_USE_GROUP;
> bUseGK = true;
> - } else if (!memcmp(pbyOUI, abyOUIWEP40, 4)) {
> - // Invalid CSS, continue to parsing
> - } else if (!memcmp(pbyOUI, abyOUITKIP, 4)) {
> - if (pBSSNode->byCSSGK != WLAN_11i_CSS_CCMP)
> - pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_TKIP;
> - else
> - ; // Invalid CSS, continue to parsing
> - } else if (!memcmp(pbyOUI, abyOUICCMP, 4)) {
> - pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_CCMP;
> - } else if (!memcmp(pbyOUI, abyOUIWEP104, 4)) {
> - // Invalid CSS, continue to parsing
> - } else {
> - // any vendor checks here
> - pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_UNKNOWN;
> - }
> + } else if (!memcmp(pbyOUI, abyOUIWEP40, 4))
> + ; /* Invalid CSS, continue to parsing */
> + else if ((!memcmp(pbyOUI, abyOUITKIP, 4))
> + && (pBSSNode->byCSSGK != WLAN_11i_CSS_CCMP))
> + pBSSNode->abyCSSPK[j++] =
> + WLAN_11i_CSS_TKIP;
> + else if (!memcmp(pbyOUI, abyOUICCMP, 4))
> + pBSSNode->abyCSSPK[j++] =
> + WLAN_11i_CSS_CCMP;
> + else if (!memcmp(pbyOUI, abyOUIWEP104, 4))
> + ; /* Invalid CSS, continue to parsing */
> + else
> + /* any vendor checks here */
> + pBSSNode->abyCSSPK[j++] =
> + WLAN_11i_CSS_UNKNOWN;
> pbyOUI += 4;
You have changed the logic here without meaning to. Can you spot the
bug?
I don't like the way the lines are broken at all. This is a randomly
indented text jumble. *SPLATCH!*.
If you need to break up a compound condition put the "&&" at the end
of the first line instead of at the start of the second line.
Multi-line indents get curly braces for readability, even though they
are not needed for syntax reasons. So it would be:
} else {
/* any vendor checks here */
pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_UNKNOWN;
}
I know that is over the 80 character limit, so checkpatch.pl will
complain but checkpatch.pl is a perl script and not the king of the
world. Don't make the code worse just to please a perl script.
The real reason we are going past the end of the line here is because
the code is indented 40 characters to begin with. You could bring it in
one indent level by reversing the break condition.
if (pRSN->len < 8 + i * 4 + 4)
break;
> - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyCSSPK[%d]: %X\n", j-1, pBSSNode->abyCSSPK[j-1]);
> + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
> + "abyCSSPK[%d]: %X\n", j-1,
> + pBSSNode->abyCSSPK[j-1]);
> } else
> break;
> - } //for
> + } /* for */
^^^^^^^^^
Delete these nonsense comments.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/7] vt6655: Remove unused macros in 80211hdr.h
2013-12-30 14:52 ` [PATCH 1/7] vt6655: Remove unused macros in 80211hdr.h Michael Gunselmann
@ 2013-12-31 16:55 ` Dan Carpenter
0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2013-12-31 16:55 UTC (permalink / raw)
To: Michael Gunselmann
Cc: devel, linux-kernel, gregkh, linux-kernel, martin.hofmann, forest
On Mon, Dec 30, 2013 at 03:52:31PM +0100, Michael Gunselmann wrote:
> From: Martin Hofmann <martin.hofmann@studium.uni-erlangen.de>
>
> The file 80211hdr.h contained 4 macros (in both little and big endain fashion)
> that were not used in the driver. Thus, this patch removes them.
>
Better to leave them in. They are useful as documentation.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 7/7] vt6655: Fixed most of the checkpatch warnings in wmgr
2013-12-30 14:52 ` [PATCH 7/7] vt6655: Fixed most of the checkpatch warnings in wmgr Michael Gunselmann
@ 2014-01-02 14:57 ` Dan Carpenter
0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2014-01-02 14:57 UTC (permalink / raw)
To: Michael Gunselmann
Cc: devel, linux-kernel, Martin Hofmann, gregkh, linux-kernel,
Michael Gunselmann, martin.hofmann, forest
On Mon, Dec 30, 2013 at 03:52:37PM +0100, Michael Gunselmann wrote:
> wmgr.h: Fixed checkpatch errors.
> Four typedef warnings remain.
> line 85: This typedef increases understandability
> so this warning is not touched.
> line 196, 203 and 214:
> These typedef-errors might be fixed in a
> later commit. Fixing them makes it necessary
> to touch many other files of the driver
> using this typedef.
>
> wmgr.c: Fixed checkpatch errors (mostly comments and braces)
> Long lines were ignored and will be fixed in a later commit.
> Seven warnings remain:
> line 562, 770 and 921:
> When removing the braces checkpatch complains
> about the compiler is running into trouble.
> So these lines are not touched.
> line 713, 865, 1618 and 2163:
> Checkpatch complains about not using netdev_dbg
> instead of printk.
> These warnings will be fixed in a later commit.
>
Don't list the things which you don't change. We're not interested in
that.
This patch does too many changes at once. If you want to fix all all
the "checkpatch warnings" and your diff is around 20 lines long then
that counts as doing one thing per patch. If the diffstat is over a
thousand lines long like in this patch then it can't be a grab bag of
random things all munged together in one gigantor patch.
This patch mindlessly updates comment style. If we wanted that we
could script it.
> -//2008-8-4 <add> by chester
> +/* 2008-8-4 <add> by chester */
Delete these. We have proper version control now.
> - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d \n",
> + DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Max Support rate = %d\n",
> pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate);
> - }//else { TODO: received STA under state1 handle }
> - else {
> - return;
> }
> + /* else { TODO: received STA under state1 handle } */
> + else
> + return;
This isn't right. The correct style is:
} else {
return;
}
But even better would be to reverse the condition and pull everything
in one indent level.
if (pMgmt->sNodeDBTable[uNodeIndex].eNodeState < NODE_AUTH)
return;
pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC;
pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = cpu_to_le16(*sFrame.pwCapInfo);
etc...
> @@ -1384,11 +1369,12 @@ s_vMgrRxAuthenSequence_2(
> s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus))));
> pMgmt->eCurrState = WMAC_STATE_IDLE;
> }
> - if (pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT) {
> -// spin_unlock_irq(&pDevice->lock);
> -// vCommandTimerWait((void *)pDevice, 0);
> -// spin_lock_irq(&pDevice->lock);
> - }
> +/* if (pDevice->eCommandState == WLAN_AUTHENTICATE_WAIT) {
> + * spin_unlock_irq(&pDevice->lock);
> + * vCommandTimerWait((void *)pDevice, 0);
> + * spin_lock_irq(&pDevice->lock);
> + * }
> + */
>
Just delete this sort of thing instead of updating the comment style.
There are a couple other examples of this as well. Please redo this
patch.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-01-02 14:58 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-30 14:52 [PATCH 0/7] vt6655: Cleanup of checkpatch errors Michael Gunselmann
2013-12-30 14:52 ` [PATCH 1/7] vt6655: Remove unused macros in 80211hdr.h Michael Gunselmann
2013-12-31 16:55 ` Dan Carpenter
2013-12-30 14:52 ` [PATCH 2/7] vt6655: Fix most of checkpatch.pl errors in wroute Michael Gunselmann
2013-12-31 11:12 ` Dan Carpenter
2013-12-30 14:52 ` [PATCH 3/7] vt6655: Fixed most of the checkpatch warnings in wpactl Michael Gunselmann
2013-12-30 14:52 ` [PATCH 4/7] vt6655: Fixed most of the checkpatch warnings in wpa2 Michael Gunselmann
2013-12-31 16:52 ` Dan Carpenter
2013-12-30 14:52 ` [PATCH 5/7] vt6655: Fixed most of the checkpatch warnings in wpa Michael Gunselmann
2013-12-30 14:52 ` [PATCH 6/7] vt6655: Remove typedefs in 80211hdr.h Michael Gunselmann
2013-12-30 14:52 ` [PATCH 7/7] vt6655: Fixed most of the checkpatch warnings in wmgr Michael Gunselmann
2014-01-02 14:57 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox