Move braces around to be more kernel like.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) {
pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pFrame->pExtSuppRates=[%p].\n", pItem);
- }
- else {
+ } else {
pFrame->pExtSuppRates = NULL;
}
return;
{
int i;
- for (i = 0; i < 16; i++)
- {
+ for (i = 0; i < 16; i++) {
out[i] = sbox_table[in[i]];
}
}
for (i = 0; i < 16; i++)
abyRoundKey[i] = key[i];
- for (round = 0; round < 11; round++)
- {
- if (round == 0)
- {
+ for (round = 0; round < 11; round++) {
+ if (round == 0) {
xor_128(abyRoundKey, data, ciphertext);
AddRoundKey(abyRoundKey, round);
- }
- else if (round == 10)
- {
+ } else if (round == 10) {
SubBytes(ciphertext, TmpdataA);
ShiftRows(TmpdataA, TmpdataB);
xor_128(TmpdataB, abyRoundKey, ciphertext);
- }
- else // round 1 ~ 9
+ } else // round 1 ~ 9
{
SubBytes(ciphertext, TmpdataA);
ShiftRows(TmpdataA, TmpdataB);
}
return (uPreamble + uFrameTime);
- }
- else {
+ } else {
uFrameTime = (cbFrameLength * 8 + 22) / uRate; //????????
uTmp = ((uFrameTime * uRate) - 22) / 8;
if (cbFrameLength != uTmp) {
case RATE_6M:
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9B; //1001 1011
- }
- else {//11g, 2.4GHZ
+ } else {//11g, 2.4GHZ
*pbyPhySgn = 0x8B; //1000 1011
}
break;
case RATE_9M:
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9F; //1001 1111
- }
- else {//11g, 2.4GHZ
+ } else {//11g, 2.4GHZ
*pbyPhySgn = 0x8F; //1000 1111
}
break;
case RATE_12M:
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9A; //1001 1010
- }
- else {//11g, 2.4GHZ
+ } else {//11g, 2.4GHZ
*pbyPhySgn = 0x8A; //1000 1010
}
break;
case RATE_18M:
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9E; //1001 1110
- }
- else {//11g, 2.4GHZ
+ } else {//11g, 2.4GHZ
*pbyPhySgn = 0x8E; //1000 1110
}
break;
case RATE_24M:
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x99; //1001 1001
- }
- else {//11g, 2.4GHZ
+ } else {//11g, 2.4GHZ
*pbyPhySgn = 0x89; //1000 1001
}
break;
case RATE_36M:
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9D; //1001 1101
- }
- else {//11g, 2.4GHZ
+ } else {//11g, 2.4GHZ
*pbyPhySgn = 0x8D; //1000 1101
}
break;
case RATE_48M:
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x98; //1001 1000
- }
- else {//11g, 2.4GHZ
+ } else {//11g, 2.4GHZ
*pbyPhySgn = 0x88; //1000 1000
}
break;
case RATE_54M:
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9C; //1001 1100
- }
- else {//11g, 2.4GHZ
+ } else {//11g, 2.4GHZ
*pbyPhySgn = 0x8C; //1000 1100
}
break;
default:
if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
*pbyPhySgn = 0x9C; //1001 1100
- }
- else {//11g, 2.4GHZ
+ } else {//11g, 2.4GHZ
*pbyPhySgn = 0x8C; //1000 1100
}
break;
if (bExtBit)
*pbyPhySrv = *pbyPhySrv | 0x80;
*pwPhyLen = (unsigned short)cbUsCount;
- }
- else {
+ } else {
*pbyPhySrv = 0x00;
*pwPhyLen = (unsigned short)cbFrameLength;
}
BBbWriteEmbedded(dwIoBase, 0x9A, 0); //CR154
BBbWriteEmbedded(dwIoBase, 0x88, 0x02);//CR239
- }
- else { //OFDM
+ } else { //OFDM
// Enable internal digital loopback:CR154 |= 0000 0001
BBbReadEmbedded(dwIoBase, 0x9A, &byData);//CR154
BBbWriteEmbedded(dwIoBase, 0x9A, (unsigned char)(byData | 0x01));//CR154
// Set the CR33 Bit2 to disable internal Loopback.
BBbReadEmbedded(dwIoBase, 0x21, &byData);//CR33
BBbWriteEmbedded(dwIoBase, 0x21, (unsigned char)(byData & 0xFE));//CR33
- }
- else { // OFDM
+ } else { // OFDM
BBbReadEmbedded(dwIoBase, 0x9A, &byData);//CR154
BBbWriteEmbedded(dwIoBase, 0x9A, (unsigned char)(byData & 0xFE));//CR154
}
BigestCount = pMgmt->sNodeDBTable[ii].uInActiveCount;
SelectIndex = ii;
}
- }
- else {
+ } else {
break;
}
}
while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL)
dev_kfree_skb(skb);
}
- }
- else {
+ } else {
*puNodeIndex = ii;
}
MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO);
if (((!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == false)) || ((pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == true))) && (cc == false)) {
cc = true;
- }
- else if (cc == true) {
+ } else if (cc == true) {
if (pDevice->bHWRadioOff == true) {
if (!(pDevice->byGPIO & GPIO0_DATA))
//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
- { if (status == 1) goto start;
+ {
+ if (status == 1) goto start;
status = 1;
CARDbRadioPowerOff(pDevice);
pMgmt->sNodeDBTable[0].bActive = false;
}
if (pDevice->byGPIO & GPIO0_DATA)
//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
- {if (status == 2) goto start;
+ {
+ if (status == 2) goto start;
status = 2;
CARDbRadioPowerOn(pDevice);
- } }
- else{
+ }
+ } else {
if (pDevice->byGPIO & GPIO0_DATA)
//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
- {if (status == 3) goto start;
+ {
+ if (status == 3) goto start;
status = 3;
CARDbRadioPowerOff(pDevice);
pMgmt->sNodeDBTable[0].bActive = false;
}
if (!(pDevice->byGPIO & GPIO0_DATA))
//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
- {if (status == 4) goto start;
+ {
+ if (status == 4) goto start;
status = 4;
CARDbRadioPowerOn(pDevice);
- } }
+ }
+ }
}
start:
#endif
if (pDevice->wUseProtectCntDown > 0) {
pDevice->wUseProtectCntDown--;
- }
- else {
+ } else {
// disable protect mode
pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1));
}
wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
}
#endif
- }
- else if (pDevice->bLinkPass == true)
+ } else if (pDevice->bLinkPass == true)
pDevice->byReAssocCount = 0;
}
if (ii > 0) {
// ii = 0 for multicast node (AP & Adhoc)
RATEvTxRateFallBack((void *)pDevice, &(pMgmt->sNodeDBTable[ii]));
- }
- else {
+ } else {
// ii = 0 reserved for unicast AP node (Infra STA)
if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)
#ifdef PLICE_DEBUG
MACvEnableProtectMD(pDevice->PortOffset);
pDevice->bProtectMode = true;
}
- }
- else {
+ } else {
if (pDevice->bProtectMode) {
MACvDisableProtectMD(pDevice->PortOffset);
pDevice->bProtectMode = false;
BBvSetShortSlotTime(pDevice);
vUpdateIFS((void *)pDevice);
}
- }
- else {
+ } else {
if (!pDevice->bShortSlotTime) {
pDevice->bShortSlotTime = true;
BBvSetShortSlotTime(pDevice);
MACvEnableBarkerPreambleMd(pDevice->PortOffset);
pDevice->bBarkerPreambleMd = true;
}
- }
- else {
+ } else {
if (pDevice->bBarkerPreambleMd) {
MACvDisableBarkerPreambleMd(pDevice->PortOffset);
pDevice->bBarkerPreambleMd = false;
}
#endif
}
- }
- else if (pItemSSID->len != 0) {
+ } else if (pItemSSID->len != 0) {
if (pDevice->uAutoReConnectTime < 10) {
pDevice->uAutoReConnectTime++;
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
if (pDevice->bWPASuppWextEnabled == true)
pDevice->uAutoReConnectTime = 0;
#endif
- }
- else {
+ } else {
//mike use old encryption status for wpa reauthen
if (pDevice->bWPADEVUp)
pDevice->eEncryptionStatus = pDevice->eOldEncryptionStatus;
if ((pMgmt->eCurrState == WMAC_STATE_STARTED) && (pCurrSSID->len == 0)) {
if (pDevice->uAutoReConnectTime < 10) {
pDevice->uAutoReConnectTime++;
- }
- else {
+ } else {
DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Adhoc re-scanning ...\n");
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);
for (ii = 0; ii < byTxRetry; ii++)
//for (ii=0;ii<txRetryTemp;ii++)
{
- if (ii < 5)
- {
+ if (ii < 5) {
//PLICE_DEBUG
wFallBackRate = awHWRetry0[wRate-RATE_18M][ii];
//wFallBackRate = awHWRetry0[wRate-RATE_12M][ii];
- }
- else
- {
+ } else {
wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
//wFallBackRate = awHWRetry0[wRate-RATE_12M][4];
}
TxOkRatio = (TxCnt < 6) ? 4000 : ((pDevice->scStatistic.TxNoRetryOkCount * 4000) / TxCnt);
RxOkRatio = (RxCnt < 6) ? 2000 : ((pDevice->scStatistic.RxOkCnt * 2000) / RxCnt);
//decide link quality
- if (pDevice->bLinkPass != true)
- {
+ if (pDevice->bLinkPass != true) {
pDevice->scStatistic.LinkQuality = 0;
pDevice->scStatistic.SignalStren = 0;
- }
- else
- {
+ } else {
RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm);
if (-ldBm < 50) {
RssiRatio = 4000;
- }
- else if (-ldBm > 90) {
+ } else if (-ldBm > 90) {
RssiRatio = 0;
- }
- else {
+ } else {
RssiRatio = (40-(-ldBm-50))*4000/40;
}
pDevice->scStatistic.SignalStren = RssiRatio/40;
if (ePHYType == PHY_TYPE_11A) {//5GHZ
*pbyTxRate = 0x9B;
*pbyRsvTime = 44;
- }
- else {
+ } else {
*pbyTxRate = 0x8B;
*pbyRsvTime = 50;
}
if (ePHYType == PHY_TYPE_11A) {//5GHZ
*pbyTxRate = 0x9F;
*pbyRsvTime = 36;
- }
- else {
+ } else {
*pbyTxRate = 0x8F;
*pbyRsvTime = 42;
}
if (ePHYType == PHY_TYPE_11A) {//5GHZ
*pbyTxRate = 0x9A;
*pbyRsvTime = 32;
- }
- else {
+ } else {
*pbyTxRate = 0x8A;
*pbyRsvTime = 38;
}
if (ePHYType == PHY_TYPE_11A) {//5GHZ
*pbyTxRate = 0x9E;
*pbyRsvTime = 28;
- }
- else {
+ } else {
*pbyTxRate = 0x8E;
*pbyRsvTime = 34;
}
if (ePHYType == PHY_TYPE_11A) {//5GHZ
*pbyTxRate = 0x9D;
*pbyRsvTime = 24;
- }
- else {
+ } else {
*pbyTxRate = 0x8D;
*pbyRsvTime = 30;
}
if (ePHYType == PHY_TYPE_11A) {//5GHZ
*pbyTxRate = 0x98;
*pbyRsvTime = 24;
- }
- else {
+ } else {
*pbyTxRate = 0x88;
*pbyRsvTime = 30;
}
if (ePHYType == PHY_TYPE_11A) {//5GHZ
*pbyTxRate = 0x9C;
*pbyRsvTime = 24;
- }
- else {
+ } else {
*pbyTxRate = 0x8C;
*pbyRsvTime = 30;
}
if (ePHYType == PHY_TYPE_11A) {//5GHZ
*pbyTxRate = 0x99;
*pbyRsvTime = 28;
- }
- else {
+ } else {
*pbyTxRate = 0x89;
*pbyRsvTime = 34;
}
*
*/
/*
- bool CARDbSendPacket (void *pDeviceHandler, void *pPacket, CARD_PKT_TYPE ePktType, unsigned int uLength)
- {
+ bool CARDbSendPacket (void *pDeviceHandler, void *pPacket, CARD_PKT_TYPE ePktType, unsigned int uLength) {
PSDevice pDevice = (PSDevice) pDeviceHandler;
if (ePktType == PKT_TYPE_802_11_MNG) {
return TXbTD0Send(pDevice, pPacket, uLength);
if (pDevice->bRadioControlOff == true) printk("chester bRadioControlOff\n");
return false; }
- if (pDevice->bRadioOff == false)
- {
+ if (pDevice->bRadioOff == false) {
printk("chester pbRadioOff\n");
return true; }
pDevice->uDIFS = C_SIFS_A + 2*C_SLOT_SHORT;
pDevice->uCwMin = C_CWMIN_A;
byMaxMin = 4;
- }
- else if (pDevice->byPacketType == PK_TYPE_11B) {//0000 0001 0000 0000,11b
+ } else if (pDevice->byPacketType == PK_TYPE_11B) {//0000 0001 0000 0000,11b
pDevice->uSlot = C_SLOT_LONG;
pDevice->uSIFS = C_SIFS_BG;
pDevice->uDIFS = C_SIFS_BG + 2*C_SLOT_LONG;
pDevice->uCwMin = C_CWMIN_B;
byMaxMin = 5;
- }
- else { // PK_TYPE_11GA & PK_TYPE_11GB
+ } else { // PK_TYPE_11GA & PK_TYPE_11GB
pDevice->uSIFS = C_SIFS_BG;
if (pDevice->bShortSlotTime) {
pDevice->uSlot = C_SLOT_SHORT;
if (pDevice->wBasicRate & 0x0150) { //0000 0001 0101 0000,24M,12M,6M
pDevice->uCwMin = C_CWMIN_A;
byMaxMin = 4;
- }
- else {
+ } else {
pDevice->uCwMin = C_CWMIN_B;
byMaxMin = 5;
}
if (pDevice->byBBType == BB_TYPE_11A || pDevice->byBBType == BB_TYPE_11B) {
return (unsigned char)pDevice->byBBType;
- }
- else if (CARDbIsOFDMinBasicRate((void *)pDevice)) {
+ } else if (CARDbIsOFDMinBasicRate((void *)pDevice)) {
return PK_TYPE_11GA;
- }
- else {
+ } else {
return PK_TYPE_11GB;
}
}
if (LODWORD(qwTSF1) < LODWORD(qwTSF2)) {
// if borrow needed
HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2) - 1;
- }
- else {
+ } else {
HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2);
};
return (qwTSFOffset);
* If Channel Index is invalid, return invalid
*/
if ((ChannelIndex > CB_MAX_CHANNEL) ||
- (ChannelIndex == 0))
- {
+ (ChannelIndex == 0)) {
bValid = false;
goto exit;
}
//{{ RobertYu: 20041202
//// TX_PE will reserve 3 us for MAX2829 A mode only, it is for better TX throughput
- if (pDevice->byRFType == RF_AIROHA7230)
- {
+ if (pDevice->byRFType == RF_AIROHA7230) {
RFbAL7230SelectChannelPostProcess(pDevice->PortOffset, pDevice->byCurrentCh, (unsigned char)uConnectionChannel);
}
//}} RobertYu
inline static void EnQueue(PSDevice pDevice, PSRxMgmtPacket pRxMgmtPacket)
{
- if ((pDevice->rxManeQueue.tail+1) % NUM == pDevice->rxManeQueue.head)
- {
+ if ((pDevice->rxManeQueue.tail+1) % NUM == pDevice->rxManeQueue.head) {
return;
- }
- else
- {
+ } else {
pDevice->rxManeQueue.tail = (pDevice->rxManeQueue.tail + 1) % NUM;
pDevice->rxManeQueue.Q[pDevice->rxManeQueue.tail] = pRxMgmtPacket;
pDevice->rxManeQueue.packet_num++;
inline static PSRxMgmtPacket DeQueue(PSDevice pDevice)
{
PSRxMgmtPacket pRxMgmtPacket;
- if (pDevice->rxManeQueue.tail == pDevice->rxManeQueue.head)
- {
+ if (pDevice->rxManeQueue.tail == pDevice->rxManeQueue.head) {
printk("Queue is Empty\n");
return NULL;
- }
- else
- {
+ } else {
int x;
//x=pDevice->rxManeQueue.head = (pDevice->rxManeQueue.head+1)%NUM;
pDevice->rxManeQueue.head = (pDevice->rxManeQueue.head+1)%NUM;
pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0;
pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :USA\n");
- }
- else if ((zonetype == 1) &&
+ } else if ((zonetype == 1) &&
(pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x01)) { //for Japan
pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01;
pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
- }
- else if ((zonetype == 2) &&
+ } else if ((zonetype == 2) &&
(pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x02)) { //for Europe
pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02;
pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :Europe\n");
}
- else
- {
+ else {
if (zonetype != pDevice->abyEEPROM[EEP_OFS_ZONETYPE])
printk("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n", zonetype, pDevice->abyEEPROM[EEP_OFS_ZONETYPE]);
else
printk("Read Zonetype file success,use default zonetype setting[%02x]\n", zonetype);
}
- }
- else
+ } else
printk("Read Zonetype file fail,use default zonetype setting[%02x]\n", SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ZONETYPE));
// Get RFType
}
if ((pDevice->bRadioControlOff == true)) {
CARDbRadioPowerOff(pDevice);
- }
- else CARDbRadioPowerOn(pDevice);
+ } else CARDbRadioPowerOn(pDevice);
#else
if (((pDevice->byGPIO & GPIO0_DATA) && !(pDevice->byRadioCtl & EEP_RADIOCTL_INV)) ||
(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) {
PCI_BASE_ADDRESS_4,
PCI_BASE_ADDRESS_5,
0};
- for (i = 0; address[i]; i++)
- {
+ for (i = 0; address[i]; i++) {
//pci_write_config_dword(pcid,address[i], 0xFFFFFFFF);
pci_read_config_dword(pcid, address[i], &bar);
printk("bar %d is %x\n", i, bar);
- if (!bar)
- {
+ if (!bar) {
printk("bar %d not implemented\n", i);
continue;
}
len = len & ~(len - 1);
printk("IO space: len in IO %x, BAR %d\n", len, i);
- }
- else
- {
+ } else {
len = bar & 0xFFFFFFF0;
len = ~len + 1;
dev->wireless_handlers = (struct iw_handler_def *)&iwctl_handler_def;
rc = register_netdev(dev);
- if (rc)
- {
+ if (rc) {
printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n");
device_free_info(pDevice);
return -ENODEV;
if (pDevice_Infos == NULL) {
pDevice_Infos = *ppDevice;
- }
- else {
+ } else {
for (p = pDevice_Infos; p->next != NULL; p = p->next)
do {} while (0);
p->next = *ppDevice;
//pci_write_config_word(pcid,PCI_MAX_LAT,max_lat);
//pci_read_config_word(pcid,PCI_MAX_LAT,&max_lat);
- for (ii = 0; ii < 0xFF; ii++)
- {
+ for (ii = 0; ii < 0xFF; ii++) {
pci_read_config_byte(pcid, ii, &value);
pci_config[ii] = value;
}
- for (ii = 0, j = 1; ii < 0x100; ii++, j++)
- {
- if (j % 16 == 0)
- {
+ for (ii = 0, j = 1; ii < 0x100; ii++, j++) {
+ if (j % 16 == 0) {
printk("%x:", pci_config[ii]);
printk("\n");
- }
- else
- {
+ } else {
printk("%x:", pci_config[ii]);
}
}
pDevice_Infos = ptr->next;
else
ptr->prev->next = ptr->next;
- }
- else {
+ } else {
DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "info struct not found\n");
return;
}
}
pStats->tx_packets++;
pStats->tx_bytes += pTD->pTDInfo->skb->len;
- }
- else {
+ } else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Tx[%d] dropped & tsr1[%02X] tsr0[%02X].\n",
(int)uIdx, byTsr1, byTsr0);
pStats->tx_errors++;
//i = 0;
#if 1
- while (1)
- {
+ while (1) {
//down(&pDevice->mlme_semaphore);
// pRxMgmtPacket = DeQueue(pDevice);
#if 1
spin_lock_irq(&pDevice->lock);
- while (pDevice->rxManeQueue.packet_num != 0)
- {
+ while (pDevice->rxManeQueue.packet_num != 0) {
pRxMgmtPacket = DeQueue(pDevice);
//pDevice;
//DequeueManageObject(pDevice->FirstRecvMngList, pDevice->LastRecvMngList);
if (pDevice->pMgmt->eConfigMode == WMAC_CONFIG_AP) {
bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL);
- }
- else {
+ } else {
bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);
bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL);
}
else
pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
}
- }
- else {
+ } else {
pDevice->wCurrentRate = pDevice->pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate;
}
//preamble type
if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) {
pDevice->byPreambleType = pDevice->byShortPreamble;
- }
- else {
+ } else {
pDevice->byPreambleType = PREAMBLE_LONG;
}
pTransmitKey = NULL;
if (pDevice->pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "IBSS and KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode);
- }
- else
+ } else
DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "NOT IBSS and KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode);
} else {
bTKIP_UseGTK = true;
pDevice->byACKRate = (unsigned char) pDevice->wCurrentRate;
pDevice->byTopCCKBasicRate = RATE_1M;
pDevice->byTopOFDMBasicRate = RATE_6M;
- }
- else {
+ } else {
//auto rate
if (pDevice->sTxEthHeader.wType == TYPE_PKT_802_1x) {
if (pDevice->eCurrentPHYType != PHY_TYPE_11A) {
pDevice->byTopCCKBasicRate = RATE_1M;
pDevice->byTopOFDMBasicRate = RATE_6M;
}
- }
- else {
+ } else {
VNTWIFIvGetTxRate(pDevice->pMgmt,
pDevice->sTxEthHeader.abyDstAddr,
&(pDevice->wCurrentRate),
if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pDevice->pMgmt->eCurrState == WMAC_STATE_ASSOC)) {
if (pTransmitKey == NULL) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Don't Find TX KEY\n");
- }
- else {
+ } else {
if (bTKIP_UseGTK == true) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "error: KEY is GTK!!~~\n");
- }
- else {
+ } else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Find PTK [%lX]\n", pTransmitKey->dwKeyIndex);
bNeedEncryption = true;
}
bNeedEncryption = true;
}
}
- }
- else {
+ } else {
if (pTransmitKey == NULL) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return no tx key\n");
dev_kfree_skb_irq(skb);
pDevice->apCurrTD[TYPE_AC0DMA] = pHeadTD;
//#ifdef PLICE_DEBUG
- if (pDevice->bFixRate)
- {
+ if (pDevice->bFixRate) {
printk("FixRate:Rate is %d,TxPower is %d\n", pDevice->wCurrentRate, pDevice->byCurPwr);
- }
- else
- {
+ } else {
}
//#endif
VNSvInPortB(pDevice->PortOffset + MAC_REG_PAGE1SEL, &byOrgPageSel);
if (byOrgPageSel == 1) {
MACvSelectPage0(pDevice->PortOffset);
- }
- else
+ } else
byOrgPageSel = 0;
MACvReadMIBCounter(pDevice->PortOffset, &dwMIBCounter);
if (pMgmt->byDTIMCount > 0) {
pMgmt->byDTIMCount--;
pMgmt->sNodeDBTable[0].bRxPSPoll = false;
- }
- else {
+ } else {
if (pMgmt->byDTIMCount == 0) {
// check if mutltcast tx bufferring
pMgmt->byDTIMCount = pMgmt->byDTIMPeriod - 1;
if (memcmp(tmpbuffer, "USA", 3) == 0) {
result = ZoneType_USA;
- }
- else if (memcmp(tmpbuffer, "JAPAN", 5) == 0) {
+ } else if (memcmp(tmpbuffer, "JAPAN", 5) == 0) {
result = ZoneType_Japan;
- }
- else if (memcmp(tmpbuffer, "EUROPE", 5) == 0) {
+ } else if (memcmp(tmpbuffer, "EUROPE", 5) == 0) {
result = ZoneType_Europe;
- }
- else {
+ } else {
result = -1;
printk("Unknown Zonetype[%s]?\n", tmpbuffer);
}
DBG_PRT(MSG_LEVEL_ERR, KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
/* Unconditionally log net taps. */
pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST|RCR_UNICAST);
- }
- else if ((netdev_mc_count(dev) > pDevice->multicast_limit)
+ } else if ((netdev_mc_count(dev) > pDevice->multicast_limit)
|| (dev->flags & IFF_ALLMULTI)) {
MACvSelectPage1(pDevice->PortOffset);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0, 0xffffffff);
VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0 + 4, 0xffffffff);
MACvSelectPage0(pDevice->PortOffset);
pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST);
- }
- else {
+ } else {
memset(mc_filter, 0, sizeof(mc_filter));
netdev_for_each_mc_addr(ha, dev) {
int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
break;
// Set WEP keys and mode
- case SIOCSIWENCODE:
- {
+ case SIOCSIWENCODE: {
char abyKey[WLAN_WEP232_KEYLEN];
if (wrq->u.encoding.pointer) {
rc = -EOPNOTSUPP;
break;
- case SIOCGIWAPLIST:
- {
+ case SIOCGIWAPLIST: {
char buffer[IW_MAX_AP * (sizeof(struct sockaddr) + sizeof(struct iw_quality))];
if (wrq->u.data.pointer) {
rc = iwctl_giwgenie(dev, NULL, &(wrq->u.data), wrq->u.data.pointer);
break;
- case SIOCSIWENCODEEXT:
- {
+ case SIOCSIWENCODEEXT: {
char extra[sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1];
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODEEXT \n");
if (wrq->u.encoding.pointer) {
spin_lock_irq(&pDevice->lock);
bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL);
spin_unlock_irq(&pDevice->lock);
- }
- else {
+ } else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Commit the settings\n");
spin_lock_irq(&pDevice->lock);
pDevice->bLinkPass = false;
if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
// In Adhoc, BSS state set back to started.
pMgmt->eCurrState = WMAC_STATE_STARTED;
- }
- else {
+ } else {
pMgmt->eCurrMode = WMAC_MODE_STANDBY;
pMgmt->eCurrState = WMAC_STATE_IDLE;
}
// strip IV , add 4 byte
cbHeaderSize += (WLAN_HDR_ADDR3_LEN + 4);
}
- }
- else {
+ } else {
cbHeaderSize += WLAN_HDR_ADDR3_LEN;
};
pbyRxBuffer = (unsigned char *)(pbyRxBufferAddr + cbHeaderSize);
if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_Bridgetunnel[0])) {
cbHeaderSize += 6;
- }
- else if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_RFC1042[0])) {
+ } else if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_RFC1042[0])) {
cbHeaderSize += 6;
pwType = (unsigned short *)(pbyRxBufferAddr + cbHeaderSize);
if ((*pwType != TYPE_PKT_IPX) && (*pwType != cpu_to_le16(0xF380))) {
- }
- else {
+ } else {
cbHeaderSize -= 8;
pwType = (unsigned short *)(pbyRxBufferAddr + cbHeaderSize);
if (bIsWEP) {
} else {
*pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN - 4); // 4 is IV
}
- }
- else {
+ } else {
*pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN);
}
}
- }
- else {
+ } else {
cbHeaderSize -= 2;
pwType = (unsigned short *)(pbyRxBufferAddr + cbHeaderSize);
if (bIsWEP) {
} else {
*pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN - 4); // 4 is IV
}
- }
- else {
+ } else {
*pwType = htons(cbPacketSize - WLAN_HDR_ADDR3_LEN);
}
}
psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr1[ii];
psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr3[ii];
}
- }
- else {
+ } else {
// IBSS mode
for (ii = 0; ii < ETH_ALEN; ii++) {
psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr1[ii];
psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii];
}
}
- }
- else {
+ } else {
// Is AP mode..
if (pMACHeader->wFrameCtl & FC_FROMDS) {
for (ii = 0; ii < ETH_ALEN; ii++) {
psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr4[ii];
cbHeaderSize += 6;
}
- }
- else {
+ } else {
for (ii = 0; ii < ETH_ALEN; ii++) {
psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr3[ii];
psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii];
PSDevice pDevice = (PSDevice) Context;
spin_lock_irq(&pDevice->lock);
- while (pDevice->rxManeQueue.packet_num != 0)
- {
+ while (pDevice->rxManeQueue.packet_num != 0) {
pRxMgmtPacket = DeQueue(pDevice);
vMgrRxManagePacket(pDevice, pDevice->pMgmt, pRxMgmtPacket);
}
skb = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb;
FrameSize = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength;
- }
- else {
+ } else {
return false;
}
}
netif_rx(skb);
return true;
}
- }
- else {
+ } else {
// Control Frame
};
return false;
- }
- else {
+ } else {
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
//In AP mode, hw only check addr1(BSSID or RA) if equal to local MAC.
if (!(*pbyRsr & RSR_BSSIDOK)) {
}
return false;
}
- }
- else {
+ } else {
// discard DATA packet while not associate || BSSID error
if ((pDevice->bLinkPass == false) ||
!(*pbyRsr & RSR_BSSIDOK)) {
if (*pbyRsr & RSR_ADDROK) {
//PSbSendPSPOLL((PSDevice)pDevice);
}
- }
- else {
+ } else {
if (pDevice->pMgmt->bInTIMWake == true) {
pDevice->pMgmt->bInTIMWake = false;
}
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
dwMICKey0 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[24]));
dwMICKey1 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[28]));
- }
- else {
+ } else {
if (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) {
dwMICKey0 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[16]));
dwMICKey1 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[20]));
pMgmt->sNodeDBTable[iSANodeIndex].bRxPSPoll = true;
bScheduleCommand((void *)pDevice, WLAN_CMD_RX_PSPOLL, NULL);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 1\n");
- }
- else {
+ } else {
// check Data PS state
// if PW bit off, send out all PS bufferring packets.
if (!IS_FC_POWERMGT(pbyFrame)) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: WLAN_CMD_RX_PSPOLL 2\n");
}
}
- }
- else {
+ } else {
if (IS_FC_POWERMGT(pbyFrame)) {
pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = true;
// Once if STA in PS state, enable multicast bufferring
pMgmt->sNodeDBTable[0].bPSEnable = true;
- }
- else {
+ } else {
// clear all pending PS frame.
if (pMgmt->sNodeDBTable[iSANodeIndex].wEnQueueCnt > 0) {
pMgmt->sNodeDBTable[iSANodeIndex].bPSEnable = false;
}
}
}
- }
- else {
+ } else {
vMgrDeAuthenBeginSta(pDevice,
pMgmt,
(unsigned char *)(p802_11Header->abyAddr2),
// if any node in PS mode, buffer packet until DTIM.
if (skbcpy == NULL) {
DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "relay multicast no skb available \n");
- }
- else {
+ } else {
skbcpy->dev = pDevice->dev;
skbcpy->len = FrameSize;
memcpy(skbcpy->data, skb->data+cbHeaderOffset, FrameSize);
// set tx map
pMgmt->abyPSTxMap[0] |= byMask[0];
}
- }
- else {
+ } else {
bRelayAndForward = true;
}
- }
- else {
+ } else {
// check if relay
if (BSSDBbIsSTAInNodeDB(pMgmt, (unsigned char *)(skb->data+cbHeaderOffset), &iDANodeIndex)) {
if (pMgmt->sNodeDBTable[iDANodeIndex].eNodeState >= NODE_ASSOC) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "relay: index= %d, pMgmt->abyPSTxMap[%d]= %d\n",
iDANodeIndex, (wAID >> 3), pMgmt->abyPSTxMap[wAID >> 3]);
return true;
- }
- else {
+ } else {
bRelayOnly = true;
}
}
if (BSSDBbIsSTAInNodeDB(pDevice->pMgmt, param->sta_addr, &uNodeIndex)) {
BSSvRemoveOneNode(pDevice, uNodeIndex);
- }
- else {
+ } else {
return -ENOENT;
}
return 0;
(jiffies - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ;
//param->u.get_info_sta.txexc = pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts;
- }
- else {
+ } else {
return -ENOENT;
}
if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts = 0;
- }
- else {
+ } else {
return -ENOENT;
}
pMgmt->sNodeDBTable[uNodeIndex].dwFlags &= param->u.set_flags_sta.flags_and;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " dwFlags = %x \n",
(unsigned int)pMgmt->sNodeDBTable[uNodeIndex].dwFlags);
- }
- else {
+ } else {
return -ENOENT;
}
if (pItemSSID->abySSID[req->essid_len - 1] == '\0') {
if (req->essid_len > 0)
pItemSSID->len = req->essid_len - 1;
- }
- else
+ } else
pItemSSID->len = req->essid_len;
pMgmt->eScanType = WMAC_SCAN_PASSIVE;
PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n", ((PWLAN_IE_SSID)abyScanSSID)->abySSID,
spin_unlock_irq(&pDevice->lock);
return 0;
- }
- else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan
+ } else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan
pMgmt->eScanType = WMAC_SCAN_PASSIVE;
}
- }
- else { //active scan
+ } else { //active scan
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
}
iwe.cmd = SIOCGIWMODE;
if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) {
iwe.u.mode = IW_MODE_INFRA;
- }
- else {
+ } else {
iwe.u.mode = IW_MODE_ADHOC;
}
iwe.len = IW_EV_UINT_LEN;
if (pItemSSID->abySSID[wrq->length - 1] == '\0') {
if (wrq->length > 0)
pItemSSID->len = wrq->length - 1;
- }
- else
+ } else
pItemSSID->len = wrq->length;
printk("set essid to %s \n", pItemSSID->abySSID);
//2008-0409-05, <Add> by Einsn Liu
pMgmt->eScanType = WMAC_SCAN_ACTIVE;
bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
- }
- else { //mike:to find out if that desired SSID is a hidden-ssid AP ,
+ } else { //mike:to find out if that desired SSID is a hidden-ssid AP ,
// by means of judging if there are two same BSSID exist in list ?
for (ii = 0; ii < MAX_BSS_NUM; ii++) {
if (pMgmt->sBSSList[ii].bActive &&
pDevice->bFixRate = true;
if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) {
pDevice->uConnectionRate = 3;
- }
- else {
+ } else {
pDevice->uConnectionRate = brate;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate);
}
- }
- else {
+ } else {
pDevice->bFixRate = false;
pDevice->uConnectionRate = 13;
printk("auto rate:connection_rate is 13\n");
if (pDevice->byBBType == BB_TYPE_11A)
brate = 0x6C;
}
- }
- else
- {
+ } else {
brate = abySupportedRates[TxRate_iwconfig];
}
- }
- else brate = 0;
+ } else brate = 0;
//2007-0118-05,<Mark> by EinsnLiu
//Mark the unnecessary sentences.
/*
if (dwKeyIndex < 1 && ((wrq->flags & IW_ENCODE_NOKEY) == 0)) {//set default key
if (pDevice->byKeyIndex < WLAN_WEP_NKEYS) {
dwKeyIndex = pDevice->byKeyIndex;
- }
- else dwKeyIndex = 0;
+ } else dwKeyIndex = 0;
} else dwKeyIndex--;
if (wrq->length == WLAN_WEP232_KEYLEN) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
- }
- else if (wrq->length == WLAN_WEP104_KEYLEN) {
+ } else if (wrq->length == WLAN_WEP104_KEYLEN) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
- }
- else if (wrq->length == WLAN_WEP40_KEYLEN) {
+ } else if (wrq->length == WLAN_WEP40_KEYLEN) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
} else {//no support length
rc = -EINVAL;
} else if (index > 0) {
//when the length is 0 the request only changes the default transmit key index
//check the new key if it has a non zero length
- if (pDevice->bEncryptionEnable == false)
- {
+ if (pDevice->bEncryptionEnable == false) {
rc = -EINVAL;
return rc;
}
if (wrq->length == WLAN_WEP232_KEYLEN) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
- }
- else if (wrq->length == WLAN_WEP104_KEYLEN) {
+ } else if (wrq->length == WLAN_WEP104_KEYLEN) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
- }
- else if (wrq->length == WLAN_WEP40_KEYLEN) {
+ } else if (wrq->length == WLAN_WEP40_KEYLEN) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
}
memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
// Do we want to just set the transmit key index ?
if (index < 4) {
pDevice->byKeyIndex = index;
- }
- else if (!(wrq->flags & IW_ENCODE_MODE)) {
+ } else if (!(wrq->flags & IW_ENCODE_MODE)) {
rc = -EINVAL;
return rc;
}
int iwctl_giwencode(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *wrq,
- char *extra)
- {
+ char *extra) {
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
int rc = 0;
if (pDevice->bLinkPass == true) {
RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm);
wrq->value = ldBm;
- }
- else {
+ } else {
wrq->value = 0;
};
wrq->disabled = (wrq->value == 0);
if (wrq->value == IW_AUTH_WPA_VERSION_DISABLED) {
PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
//pDevice->bWPADevEnable = false;
- }
- else if (wrq->value == IW_AUTH_WPA_VERSION_WPA) {
+ } else if (wrq->value == IW_AUTH_WPA_VERSION_WPA) {
PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n");
- }
- else {
+ } else {
PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n");
}
//pDevice->bWPASuppWextEnabled =true;
if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) {
*pKey = &(pTable->KeyTable[i].PairwiseKey);
return (true);
- }
- else {
+ } else {
return (false);
}
} else if (dwKeyIndex < MAX_GROUP_KEY) {
if (pTable->KeyTable[i].GroupKey[dwKeyIndex].bKeyValid == true) {
*pKey = &(pTable->KeyTable[i].GroupKey[dwKeyIndex]);
return (true);
- }
- else {
+ } else {
return (false);
}
- }
- else {
+ } else {
return (false);
}
}
if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC
memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
- }
- else {
+ } else {
memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
}
pKey->dwTSC47_16 = 0;
if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC
memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
- }
- else {
+ } else {
memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
}
pKey->dwTSC47_16 = 0;
}
s_vCheckKeyTableValid(pTable, dwIoBase);
return true;
- }
- else if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) {
+ } else if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) {
for (i = 0; i < MAX_KEY_TABLE; i++) {
pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false;
if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[i].dwGTKeyIndex & 0x7FFFFFFF)) {
}
s_vCheckKeyTableValid(pTable, dwIoBase);
return true;
- }
- else {
+ } else {
return false;
}
}
pTable->KeyTable[i].PairwiseKey.bKeyValid = false;
s_vCheckKeyTableValid(pTable, dwIoBase);
return (true);
- }
- else if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) {
+ } else if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) {
pTable->KeyTable[i].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false;
if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[i].dwGTKeyIndex & 0x7FFFFFFF)) {
// remove Group transmit key
}
s_vCheckKeyTableValid(pTable, dwIoBase);
return (true);
- }
- else {
+ } else {
return (false);
}
}
return (true);
- }
- else {
+ } else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PairwiseKey.bKeyValid == false\n");
return (false);
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwGTKeyIndex: %lX\n", pTable->KeyTable[i].dwGTKeyIndex);
return (true);
- }
- else {
+ } else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GroupKey.bKeyValid == false\n");
return (false);
}
if ((dwKeyIndex & USE_KEYRSC) == 0) {
// RSC set by NIC
memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
- }
- else {
+ } else {
memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
}
pKey->dwTSC47_16 = 0;
if (byRSR & RSR_ADDRBROAD) {
pStatistic->ullRxBroadcastFrames++;
pStatistic->ullRxBroadcastBytes += (unsigned long long) cbFrameLength;
- }
- else if (byRSR & RSR_ADDRMULTI) {
+ } else if (byRSR & RSR_ADDRMULTI) {
pStatistic->ullRxMulticastFrames++;
pStatistic->ullRxMulticastBytes += (unsigned long long) cbFrameLength;
- }
- else {
+ } else {
pStatistic->ullRxDirectedFrames++;
pStatistic->ullRxDirectedBytes += (unsigned long long) cbFrameLength;
}
pStatistic->CustomStat.ullRsr11MCRCOk++;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "11M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr11M, (int)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR);
- }
- else if (byRxRate == 11) {
+ } else if (byRxRate == 11) {
pStatistic->CustomStat.ullRsr5M++;
if (byRSR & RSR_CRCOK) {
pStatistic->CustomStat.ullRsr5MCRCOk++;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 5M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr5M, (int)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR);
- }
- else if (byRxRate == 4) {
+ } else if (byRxRate == 4) {
pStatistic->CustomStat.ullRsr2M++;
if (byRSR & RSR_CRCOK) {
pStatistic->CustomStat.ullRsr2MCRCOk++;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 2M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr2M, (int)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR);
- }
- else if (byRxRate == 2) {
+ } else if (byRxRate == 2) {
pStatistic->CustomStat.ullRsr1M++;
if (byRSR & RSR_CRCOK) {
pStatistic->CustomStat.ullRsr1MCRCOk++;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 1M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr1M, (int)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR);
- }
- else if (byRxRate == 12) {
+ } else if (byRxRate == 12) {
pStatistic->CustomStat.ullRsr6M++;
if (byRSR & RSR_CRCOK) {
pStatistic->CustomStat.ullRsr6MCRCOk++;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 6M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr6M, (int)pStatistic->CustomStat.ullRsr6MCRCOk);
- }
- else if (byRxRate == 18) {
+ } else if (byRxRate == 18) {
pStatistic->CustomStat.ullRsr9M++;
if (byRSR & RSR_CRCOK) {
pStatistic->CustomStat.ullRsr9MCRCOk++;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 9M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr9M, (int)pStatistic->CustomStat.ullRsr9MCRCOk);
- }
- else if (byRxRate == 24) {
+ } else if (byRxRate == 24) {
pStatistic->CustomStat.ullRsr12M++;
if (byRSR & RSR_CRCOK) {
pStatistic->CustomStat.ullRsr12MCRCOk++;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "12M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr12M, (int)pStatistic->CustomStat.ullRsr12MCRCOk);
- }
- else if (byRxRate == 36) {
+ } else if (byRxRate == 36) {
pStatistic->CustomStat.ullRsr18M++;
if (byRSR & RSR_CRCOK) {
pStatistic->CustomStat.ullRsr18MCRCOk++;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "18M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr18M, (int)pStatistic->CustomStat.ullRsr18MCRCOk);
- }
- else if (byRxRate == 48) {
+ } else if (byRxRate == 48) {
pStatistic->CustomStat.ullRsr24M++;
if (byRSR & RSR_CRCOK) {
pStatistic->CustomStat.ullRsr24MCRCOk++;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "24M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr24M, (int)pStatistic->CustomStat.ullRsr24MCRCOk);
- }
- else if (byRxRate == 72) {
+ } else if (byRxRate == 72) {
pStatistic->CustomStat.ullRsr36M++;
if (byRSR & RSR_CRCOK) {
pStatistic->CustomStat.ullRsr36MCRCOk++;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "36M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr36M, (int)pStatistic->CustomStat.ullRsr36MCRCOk);
- }
- else if (byRxRate == 96) {
+ } else if (byRxRate == 96) {
pStatistic->CustomStat.ullRsr48M++;
if (byRSR & RSR_CRCOK) {
pStatistic->CustomStat.ullRsr48MCRCOk++;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "48M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr48M, (int)pStatistic->CustomStat.ullRsr48MCRCOk);
- }
- else if (byRxRate == 108) {
+ } else if (byRxRate == 108) {
pStatistic->CustomStat.ullRsr54M++;
if (byRSR & RSR_CRCOK) {
pStatistic->CustomStat.ullRsr54MCRCOk++;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "54M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr54M, (int)pStatistic->CustomStat.ullRsr54MCRCOk);
- }
- else {
+ } else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unknown: Total[%d], CRCOK[%d]\n", (int)pStatistic->dwRsrRxPacket+1, (int)pStatistic->dwRsrCRCOk);
}
if (cbFrameLength < ETH_ZLEN + 4) {
pStatistic->dwRsrRunt++;
- }
- else if (cbFrameLength == ETH_ZLEN + 4) {
+ } else if (cbFrameLength == ETH_ZLEN + 4) {
pStatistic->dwRsrRxFrmLen64++;
- }
- else if ((65 <= cbFrameLength) && (cbFrameLength <= 127)) {
+ } else if ((65 <= cbFrameLength) && (cbFrameLength <= 127)) {
pStatistic->dwRsrRxFrmLen65_127++;
- }
- else if ((128 <= cbFrameLength) && (cbFrameLength <= 255)) {
+ } else if ((128 <= cbFrameLength) && (cbFrameLength <= 255)) {
pStatistic->dwRsrRxFrmLen128_255++;
- }
- else if ((256 <= cbFrameLength) && (cbFrameLength <= 511)) {
+ } else if ((256 <= cbFrameLength) && (cbFrameLength <= 511)) {
pStatistic->dwRsrRxFrmLen256_511++;
- }
- else if ((512 <= cbFrameLength) && (cbFrameLength <= 1023)) {
+ } else if ((512 <= cbFrameLength) && (cbFrameLength <= 1023)) {
pStatistic->dwRsrRxFrmLen512_1023++;
- }
- else if ((1024 <= cbFrameLength) && (cbFrameLength <= ETH_FRAME_LEN + 4)) {
+ } else if ((1024 <= cbFrameLength) && (cbFrameLength <= ETH_FRAME_LEN + 4)) {
pStatistic->dwRsrRxFrmLen1024_1518++;
} else if (cbFrameLength > ETH_FRAME_LEN + 4) {
pStatistic->dwRsrLong++;
pHeader = (PWLAN_80211HDR_A4) pbyBuffer;
if (WLAN_GET_FC_TODS(pHeader->wFrameCtl) == 0) {
pbyDestAddr = &(pHeader->abyAddr1[0]);
- }
- else {
+ } else {
pbyDestAddr = &(pHeader->abyAddr3[0]);
}
// increase tx packet count
if (is_broadcast_ether_addr(pbyDestAddr)) {
pStatistic->ullTxBroadcastFrames[uIdx]++;
pStatistic->ullTxBroadcastBytes[uIdx] += (unsigned long long) cbFrameLength;
- }
- else if (is_multicast_ether_addr(pbyDestAddr)) {
+ } else if (is_multicast_ether_addr(pbyDestAddr)) {
pStatistic->ullTxMulticastFrames[uIdx]++;
pStatistic->ullTxMulticastBytes[uIdx] += (unsigned long long) cbFrameLength;
- }
- else {
+ } else {
pStatistic->ullTxDirectedFrames[uIdx]++;
pStatistic->ullTxDirectedBytes[uIdx] += (unsigned long long) cbFrameLength;
}
- }
- else {
+ } else {
if (byTSR1 & TSR1_TERR)
pStatistic->dwTsrErr[uIdx]++;
if (byTSR1 & TSR1_RETRYTMO)
// Convert from unsigned long to unsigned char [] in a portable way
{
unsigned int i;
- for (i=0; i<4; i++)
- {
+ for (i=0; i<4; i++) {
*p++ = (unsigned char) (val & 0xff);
val >>= 8;
}
M |= b << (8*nBytesInM);
nBytesInM++;
// Process the word if it is full.
- if (nBytesInM >= 4)
- {
+ if (nBytesInM >= 4) {
L ^= M;
R ^= ROL32(L, 17);
L += R;
void MIC_vAppend(unsigned char *src, unsigned int nBytes)
{
// This is simple
- while (nBytes > 0)
- {
+ while (nBytes > 0) {
s_vAppendByte(*src++);
nBytes--;
}
s_vAppendByte(0);
s_vAppendByte(0);
// and then zeroes until the length is a multiple of 4
- while (nBytesInM != 0)
- {
+ while (nBytesInM != 0) {
s_vAppendByte(0);
}
// The s_vAppendByte function has already computed the result.
// first time set listen next beacon
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN);
pMgmt->wCountToWakeUp = wListenInterval;
- }
- else {
+ } else {
// always listen beacon
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
//pDevice->wCFG |= CFG_ALB;
// send the frame
if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet failed..\n");
- }
- else {
+ } else {
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet success..\n");
};
WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL) |
WLAN_SET_FC_PWRMGT(1)
));
- }
- else {
+ } else {
pTxPacket->p80211Header->sA3.wFrameCtl = cpu_to_le16(
(
WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) |
if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet failed !\n");
return false;
- }
- else {
+ } else {
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet success....\n");
}
return false;
}
- if (uChannel <= CB_MAX_CHANNEL_24G)
- {
+ if (uChannel <= CB_MAX_CHANNEL_24G) {
for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++) {
MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230InitTable[ii]);
}
- }
- else
- {
+ } else {
for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++) {
MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230InitTableAMode[ii]);
}
// if change between 11 b/g and 11a need to update the following register
// Channel Index 1~14
- if ((byOldChannel <= CB_MAX_CHANNEL_24G) && (byNewChannel > CB_MAX_CHANNEL_24G))
- {
+ if ((byOldChannel <= CB_MAX_CHANNEL_24G) && (byNewChannel > CB_MAX_CHANNEL_24G)) {
// Change from 2.4G to 5G
bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[2]); //Reg2
bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[3]); //Reg3
bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[10]);//Reg10
bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[12]);//Reg12
bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[15]);//Reg15
- }
- else if ((byOldChannel > CB_MAX_CHANNEL_24G) && (byNewChannel <= CB_MAX_CHANNEL_24G))
- {
+ } else if ((byOldChannel > CB_MAX_CHANNEL_24G) && (byNewChannel <= CB_MAX_CHANNEL_24G)) {
// change from 5G to 2.4G
bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[2]); //Reg2
bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[3]); //Reg3
if (bNeedAck) {
return (uDataTime + pDevice->uSIFS + uAckTime);
- }
- else {
+ } else {
return uDataTime;
}
}
if (byRTSRsvType == 0) { //RTSTxRrvTime_bb
uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate);
uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
- }
- else if (byRTSRsvType == 1) { //RTSTxRrvTime_ba, only in 2.4GHZ
+ } else if (byRTSRsvType == 1) { //RTSTxRrvTime_ba, only in 2.4GHZ
uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate);
uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- }
- else if (byRTSRsvType == 2) { //RTSTxRrvTime_aa
+ } else if (byRTSRsvType == 2) { //RTSTxRrvTime_aa
uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopOFDMBasicRate);
uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- }
- else if (byRTSRsvType == 3) { //CTSTxRrvTime_ba, only in 2.4GHZ
+ } else if (byRTSRsvType == 3) { //CTSTxRrvTime_ba, only in 2.4GHZ
uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
uRrvTime = uCTSTime + uAckTime + uDataTime + 2*pDevice->uSIFS;
} else {
return 0;
}
- }
- else {//First Frag or Mid Frag
+ } else {//First Frag or Mid Frag
if (uFragIdx == (uMACfragNum-2)) {
uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck);
} else {
} else {
return 0;
}
- }
- else {//First Frag or Mid Frag
+ } else {//First Frag or Mid Frag
if (uFragIdx == (uMACfragNum-2)) {
uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck);
} else {
} else {
return 0;
}
- }
- else { //First Frag or Mid Frag
+ } else { //First Frag or Mid Frag
if (byFBOption == AUTO_FB_0) {
if (wRate < RATE_18M)
wRate = RATE_18M;
} else {
return 0;
}
- }
- else { //First Frag or Mid Frag
+ } else { //First Frag or Mid Frag
if (byFBOption == AUTO_FB_0) {
if (wRate < RATE_18M)
wRate = RATE_18M;
return (pBuf->wDuration_a);
} //if (byFBOption == AUTO_FB_NONE)
- }
- else if (byPktType == PK_TYPE_11A) {
+ } else if (byPktType == PK_TYPE_11A) {
if ((byFBOption != AUTO_FB_NONE)) {
// Auto Fallback
PSTxDataHead_a_FB pBuf = (PSTxDataHead_a_FB)pTxDataHead;
pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
return (pBuf->wDuration);
}
- }
- else {
+ } else {
PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
//Get SignalField,ServiceField,Length
BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- }
- else {
+ } else {
memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
}
if (pDevice->eOPMode == OP_MODE_AP) {
memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- else {
+ } else {
memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
}
- }
- else {
+ } else {
PSRTS_g_FB pBuf = (PSRTS_g_FB)pvRTS;
//Get SignalField,ServiceField,Length
BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- }
- else {
+ } else {
memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
}
if (pDevice->eOPMode == OP_MODE_AP) {
memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- else {
+ } else {
memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
}
} // if (byFBOption == AUTO_FB_NONE)
- }
- else if (byPktType == PK_TYPE_11A) {
+ } else if (byPktType == PK_TYPE_11A) {
if (byFBOption == AUTO_FB_NONE) {
PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
//Get SignalField,ServiceField,Length
if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- }
- else {
+ } else {
memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
}
if (pDevice->eOPMode == OP_MODE_AP) {
memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- else {
+ } else {
memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
}
- }
- else {
+ } else {
PSRTS_a_FB pBuf = (PSRTS_a_FB)pvRTS;
//Get SignalField,ServiceField,Length
BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- }
- else {
+ } else {
memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
}
if (pDevice->eOPMode == OP_MODE_AP) {
memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- else {
+ } else {
memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
}
}
- }
- else if (byPktType == PK_TYPE_11B) {
+ } else if (byPktType == PK_TYPE_11B) {
PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
//Get SignalField,ServiceField,Length
BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
(pDevice->eOPMode == OP_MODE_AP)) {
memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- }
- else {
+ } else {
memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
}
if (pDevice->eOPMode == OP_MODE_AP) {
memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- else {
+ } else {
memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
}
}
if (wFifoCtl & FIFOCTL_AUTO_FB_0) {
byFBOption = AUTO_FB_0;
- }
- else if (wFifoCtl & FIFOCTL_AUTO_FB_1) {
+ } else if (wFifoCtl & FIFOCTL_AUTO_FB_1) {
byFBOption = AUTO_FB_1;
}
}
//Fill RTS
s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
- }
- else {//RTS_needless, PCF mode
+ } else {//RTS_needless, PCF mode
//Fill RsvTime
if (pvRrvTime) {
//Fill CTS
s_vFillCTSHead(pDevice, uDMAIdx, byPktType, pvCTS, cbFrameSize, bNeedACK, bDisCRC, wCurrentRate, byFBOption);
}
- }
- else if (byPktType == PK_TYPE_11A) {
+ } else if (byPktType == PK_TYPE_11A) {
if (pvRTS != NULL) {//RTS_need, non PCF mode
//Fill RsvTime
}
//Fill RTS
s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
- }
- else if (pvRTS == NULL) {//RTS_needless, non PCF mode
+ } else if (pvRTS == NULL) {//RTS_needless, non PCF mode
//Fill RsvTime
if (pvRrvTime) {
PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK)); //0:OFDM
}
}
- }
- else if (byPktType == PK_TYPE_11B) {
+ } else if (byPktType == PK_TYPE_11B) {
if ((pvRTS != NULL)) {//RTS_need, non PCF mode
//Fill RsvTime
}
//Fill RTS
s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
- }
- else { //RTS_needless, non PCF mode
+ } else { //RTS_needless, non PCF mode
//Fill RsvTime
if (pvRrvTime) {
PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
ptdCurr->m_td1TD1.wReqCount = cpu_to_le16((unsigned short)(cbReqCount));
if (wFragType == FRAGCTL_ENDFRAG) { //Last Fragmentation
ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU);
- }
- else {
+ } else {
ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP);
}
- }
- else {
+ } else {
//PSTxDesc ptdCurr = (PSTxDesc)s_pvGetTxDescHead(pDevice, uTxType, uCurIdx);
PSTxDesc ptdCurr = (PSTxDesc)pvtdCurr;
//Set TSR1 & ReqCount in TxDescHead
ptdCurr->m_td1TD1.wReqCount = cpu_to_le16((unsigned short)(cbReqCount));
if (wFragType == FRAGCTL_ENDFRAG) { //Last Fragmentation
ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU);
- }
- else {
+ } else {
ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP);
}
}
else
bNeedACK = true;
bIsAdhoc = true;
- }
- else {
+ } else {
// MSDUs in Infra mode always need ACK
bNeedACK = true;
bIsAdhoc = false;
((cbFrameSize >= pDevice->wFragmentationThreshold) && (pDevice->wFragmentationThreshold <= pDevice->wRTSThreshold))
) {
bRTS = false;
- }
- else {
+ } else {
bRTS = true;
psTxBufHd->wFIFOCtl |= (FIFOCTL_RTS | FIFOCTL_LRETRY);
}
//
if (psTxBufHd->wFIFOCtl & FIFOCTL_AUTO_FB_0) {
byFBOption = AUTO_FB_0;
- }
- else if (psTxBufHd->wFIFOCtl & FIFOCTL_AUTO_FB_1) {
+ } else if (psTxBufHd->wFIFOCtl & FIFOCTL_AUTO_FB_1) {
byFBOption = AUTO_FB_1;
}
pvCTS = NULL;
pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g));
cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g) + sizeof(STxDataHead_g);
- }
- else { //RTS_needless
+ } else { //RTS_needless
pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
pvRTS = NULL;
pvCTS = NULL;
pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB));
cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB) + sizeof(STxDataHead_g_FB);
- }
- else { //RTS_needless
+ } else { //RTS_needless
pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
pvRTS = NULL;
cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS_FB) + sizeof(STxDataHead_g_FB);
}
} // Auto Fall Back
- }
- else {//802.11a/b packet
+ } else {//802.11a/b packet
if (byFBOption == AUTO_FB_NONE) {
if (bRTS == true) {
pvCTS = NULL;
pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab));
cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab) + sizeof(STxDataHead_ab);
- }
- else { //RTS_needless, need MICHDR
+ } else { //RTS_needless, need MICHDR
pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
pvRTS = NULL;
pvCTS = NULL;
pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB));
cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB) + sizeof(STxDataHead_a_FB);
- }
- else { //RTS_needless
+ } else { //RTS_needless
pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
pvRTS = NULL;
if (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) {
dwMICKey0 = *(unsigned long *)(&pTransmitKey->abyKey[16]);
dwMICKey1 = *(unsigned long *)(&pTransmitKey->abyKey[20]);
- }
- else if ((pTransmitKey->dwKeyIndex & AUTHENTICATOR_KEY) != 0) {
+ } else if ((pTransmitKey->dwKeyIndex & AUTHENTICATOR_KEY) != 0) {
dwMICKey0 = *(unsigned long *)(&pTransmitKey->abyKey[16]);
dwMICKey1 = *(unsigned long *)(&pTransmitKey->abyKey[20]);
- }
- else {
+ } else {
dwMICKey0 = *(unsigned long *)(&pTransmitKey->abyKey[24]);
dwMICKey1 = *(unsigned long *)(&pTransmitKey->abyKey[28]);
}
if ((psEthHeader->wType == TYPE_PKT_IPX) ||
(psEthHeader->wType == cpu_to_le16(0xF380))) {
memcpy((unsigned char *)(pbyPayloadHead), &pDevice->abySNAP_Bridgetunnel[0], 6);
- }
- else {
+ } else {
memcpy((unsigned char *)(pbyPayloadHead), &pDevice->abySNAP_RFC1042[0], 6);
}
pbyType = (unsigned char *)(pbyPayloadHead + 6);
ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma);
pDevice->iTDUsed[uDMAIdx]++;
pHeadTD = ptdCurr->next;
- }
- else if (uFragIdx == (uMACfragNum-1)) {
+ } else if (uFragIdx == (uMACfragNum-1)) {
//=========================
// Last Fragmentation
//=========================
pDevice->iTDUsed[uDMAIdx]++;
pHeadTD = ptdCurr->next;
- }
- else {
+ } else {
//=========================
// Middle Fragmentation
//=========================
pHeadTD = ptdCurr->next;
}
} // for (uMACfragNum)
- }
- else {
+ } else {
//=========================
// No Fragmentation
//=========================
if ((psEthHeader->wType == TYPE_PKT_IPX) ||
(psEthHeader->wType == cpu_to_le16(0xF380))) {
memcpy((unsigned char *)(pbyPayloadHead), &pDevice->abySNAP_Bridgetunnel[0], 6);
- }
- else {
+ } else {
memcpy((unsigned char *)(pbyPayloadHead), &pDevice->abySNAP_RFC1042[0], 6);
}
pbyType = (unsigned char *)(pbyPayloadHead + 6);
if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0]))) {
bNeedACK = false;
pTxBufHead->wFIFOCtl = pTxBufHead->wFIFOCtl & (~FIFOCTL_NEEDACK);
- }
- else {
+ } else {
bNeedACK = true;
pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK;
}
bIsAdhoc = true;
- }
- else {
+ } else {
// MSDUs in Infra mode always need ACK
bNeedACK = true;
pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK;
//Set packet type
if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000
;
- }
- else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000
+ } else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000
pTxBufHead->wFIFOCtl |= FIFOCTL_11B;
- }
- else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000
+ } else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000
pTxBufHead->wFIFOCtl |= FIFOCTL_11GB;
- }
- else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000
+ } else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000
pTxBufHead->wFIFOCtl |= FIFOCTL_11GA;
}
//Set FIFOCTL_GrpAckPolicy
if ((bNeedEncrypt) && (pTransmitKey != NULL)) { //WEP enabled
if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) {
pTxBufHead->wFragCtl |= FRAGCTL_TKIP;
- }
- else if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { //WEP40 or WEP104
+ } else if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { //WEP40 or WEP104
if (pTransmitKey->uKeyLength != WLAN_WEP232_KEYLEN)
pTxBufHead->wFragCtl |= FRAGCTL_LEGACY;
- }
- else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { //CCMP
+ } else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { //CCMP
pTxBufHead->wFragCtl |= FRAGCTL_AES;
}
}
memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
pMACHeader->wFrameCtl |= FC_FROMDS;
- }
- else {
+ } else {
if (pDevice->eOPMode == OP_MODE_ADHOC) {
memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
memcpy(&(pMACHeader->abyAddr3[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- else {
+ } else {
memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
memcpy(&(pMACHeader->abyAddr1[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
//Set packet type
if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000
pTxBufHead->wFIFOCtl = 0;
- }
- else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000
+ } else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000
pTxBufHead->wFIFOCtl |= FIFOCTL_11B;
- }
- else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000
+ } else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000
pTxBufHead->wFIFOCtl |= FIFOCTL_11GB;
- }
- else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000
+ } else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000
pTxBufHead->wFIFOCtl |= FIFOCTL_11GA;
}
cbIVlen = 4;
cbICVlen = 4;
pTxBufHead->wFragCtl |= FRAGCTL_LEGACY;
- }
- else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
+ } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
cbIVlen = 8;//IV+ExtIV
cbMIClen = 8;
cbICVlen = 4;
//We need to get seed here for filling TxKey entry.
//TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr,
// pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, pDevice->abyPRNG);
- }
- else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
+ } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
cbIVlen = 8;//RSN Header
cbICVlen = 8;//MIC
pTxBufHead->wFragCtl |= FRAGCTL_AES;
pCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + sizeof(SCTS));
cbHeaderSize = wTxBufSize + sizeof(SRrvTime_gCTS) + sizeof(SCTS) + sizeof(STxDataHead_g);
- }
- else { // 802.11a/b packet
+ } else { // 802.11a/b packet
pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
pMICHDR = NULL;
pvRTS = NULL;
memcpy(pMACHeader, pPacket->p80211Header, cbMacHdLen);
memcpy(pbyPayloadHead, ((unsigned char *)(pPacket->p80211Header) + cbMacHdLen),
cbFrameBodySize);
- }
- else {
+ } else {
// Copy the Packet into a tx Buffer
memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen);
}
if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000
pTxDataHead->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameSize, byPktType,
wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE));
- }
- else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000
+ } else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000
pTxBufHead->wFIFOCtl |= FIFOCTL_11B;
pTxDataHead->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameSize, byPktType,
wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE));
bNeedACK = false;
else
bNeedACK = true;
- }
- else {
+ } else {
// MSDUs in Infra mode always need ACK
bNeedACK = true;
}
if (cbMPDULen <= WLAN_HDR_ADDR3_LEN) {
cbFrameBodySize = 0;
- }
- else {
+ } else {
cbFrameBodySize = cbMPDULen - WLAN_HDR_ADDR3_LEN;
}
p80211Header = (PUWLAN_80211HDR)pbMPDU;
//Set packet type
if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000
pTxBufHead->wFIFOCtl = 0;
- }
- else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000
+ } else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000
pTxBufHead->wFIFOCtl |= FIFOCTL_11B;
- }
- else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000
+ } else if (byPktType == PK_TYPE_11GB) {//0000 0010 0000 0000
pTxBufHead->wFIFOCtl |= FIFOCTL_11GB;
- }
- else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000
+ } else if (byPktType == PK_TYPE_11GA) {//0000 0011 0000 0000
pTxBufHead->wFIFOCtl |= FIFOCTL_11GA;
}
uNodeIndex = 0;
bNodeExist = true;
}
- }
- else {
+ } else {
if (pDevice->bEnableHostWEP) {
if (BSSDBbIsSTAInNodeDB(pDevice->pMgmt, (unsigned char *)(p80211Header->sA3.abyAddr1), &uNodeIndex))
bNodeExist = true;
cbIVlen = 4;
cbICVlen = 4;
pTxBufHead->wFragCtl |= FRAGCTL_LEGACY;
- }
- else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
+ } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
cbIVlen = 8;//IV+ExtIV
cbMIClen = 8;
cbICVlen = 4;
//We need to get seed here for filling TxKey entry.
//TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr,
// pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, pDevice->abyPRNG);
- }
- else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
+ } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
cbIVlen = 8;//RSN Header
cbICVlen = 8;//MIC
cbMICHDR = sizeof(SMICHDRHead);
pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS));
cbHeaderSize = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g);
- }
- else {//802.11a/b packet
+ } else {//802.11a/b packet
pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
VNTWIFIbInit(
void *pAdapterHandler,
void **pMgmtHandler
-)
- {
+) {
PSMgmtObject pMgmt = NULL;
unsigned int ii;
VNTWIFIbRadarPresent(
void *pMgmtObject,
unsigned char byChannel
-)
- {
+) {
PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) &&
(byChannel == (unsigned char) pMgmt->uCurrChannel) &&
*/
bStop = false;
if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) &&
- (pMgmt->eCurrState >= WMAC_STATE_STARTED))
- {
+ (pMgmt->eCurrState >= WMAC_STATE_STARTED)) {
if ((pMgmt->uIBSSChannel <= CB_MAX_CHANNEL_24G) &&
- (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G))
- {
+ (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) {
bStop = true;
}
- if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G)
- {
+ if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G) {
bStop = true;
}
}
- if (bStop)
- {
+ if (bStop) {
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
}
* (2) VT3253 is programmed as automatic Beacon Transmitting
*/
if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) &&
- (pMgmt->eCurrState >= WMAC_STATE_STARTED))
- {
+ (pMgmt->eCurrState >= WMAC_STATE_STARTED)) {
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
}
for (ii = 0; ii < 2; ii++) {
if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail.. \n");
- }
- else {
+ } else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending.. \n");
}
}
pMgmt->sNodeDBTable[0].bActive = true;
pMgmt->sNodeDBTable[0].uInActiveCount = 0;
bClearBSSID_SCAN(pDevice);
- }
- else {
+ } else {
// start own IBSS
vMgrCreateOwnIBSS((void *)pDevice, &Status);
if (Status != CMD_STATUS_SUCCESS) {
netif_wake_queue(pDevice->dev);
}
pDevice->bLinkPass = true;
- }
- else {
+ } else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n");
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
// if (pDevice->bWPASuppWextEnabled == true)
else if (pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) {
printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n");
- }
- else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if authenticated_frame delay!
+ } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if authenticated_frame delay!
pDevice->byLinkWaitCount++;
printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount);
spin_unlock_irq(&pDevice->lock);
pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
pDevice->fTxDataInSleep = false;
pDevice->nTxDataTimeCout = 0;
- }
- else {
+ } else {
}
pDevice->IsTxDataTrigger = true;
add_timer(&pDevice->sTimerTxData);
#endif
- }
- else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) {
+ } else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) {
printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n");
- }
- else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay!
+ } else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay!
pDevice->byLinkWaitCount++;
printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount);
spin_unlock_irq(&pDevice->lock);
if (skb_queue_empty(&pMgmt->sNodeDBTable[0].sTxPSQueue)) {
pMgmt->abyPSTxMap[0] &= ~byMask[0];
pDevice->bMoreData = false;
- }
- else {
+ } else {
pDevice->bMoreData = true;
}
if (!device_dma0_xmit(pDevice, skb, 0)) {
pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &=
~byMask[pMgmt->sNodeDBTable[ii].wAID & 7];
pDevice->bMoreData = false;
- }
- else {
+ } else {
pDevice->bMoreData = true;
}
if (!device_dma0_xmit(pDevice, skb, ii)) {
//Command Queue Empty
pDevice->bCmdRunning = false;
return true;
- }
- else {
+ } else {
pDevice->eCommand = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].eCmd;
pSSID = (PWLAN_IE_SSID)pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].abyCmdDesireSSID;
bRadioCmd = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bRadioCmd;
if (pDevice->bCmdRunning == false) {
s_bCommandComplete(pDevice);
- }
- else {
+ } else {
}
return (true);
if (bExtIV)
// ExtIV
uHeaderSize += 4;
- }
- else {
+ } else {
uHeaderSize = 24;
}
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].uLifetime = pDevice->dwMaxReceiveLifetime;
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence = (pMACHeader->wSeqCtl >> 4);
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->wSeqCtl & 0x000F);
- }
- else {
+ } else {
pDevice->uCurrentDFCBIdx = WCTLuInsertDFCB(pDevice, pMACHeader);
if (pDevice->uCurrentDFCBIdx == pDevice->cbDFCB) {
return(false);
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum++;
//DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "First pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx);
return(false);
- }
- else {
+ } else {
pDevice->uCurrentDFCBIdx = WCTLuSearchDFCB(pDevice, pMACHeader);
if (pDevice->uCurrentDFCBIdx != pDevice->cbDFCB) {
if ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence == (pMACHeader->wSeqCtl >> 4)) &&
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer += (cbFrameLength - uHeaderSize);
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum++;
//DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Second pDevice->uCurrentDFCBIdx= %d\n", pDevice->uCurrentDFCBIdx);
- }
- else {
+ } else {
// seq error or frag # error flush DFCB
pDevice->cbFreeDFCB++;
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].bInUse = false;
return(false);
}
- }
- else {
+ } else {
return(false);
}
if (IS_LAST_FRAGMENT_PKT(pMACHeader)) {
pMgmt->eCurrState = WMAC_STATE_ASSOCPENDING;
*pStatus = CMD_STATUS_SUCCESS;
}
- }
- else
+ } else
*pStatus = CMD_STATUS_RESOURCES;
return;
*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");
}
}
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");
}
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");
}
}
if (cpu_to_le16((*(sFrame.pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) {
// 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));
}
#endif //#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//End Add -- //2008-0409-07, <Add> by Einsn Liu
- }
- else {
+ } else {
if (bReAssocType) {
pMgmt->eCurrState = WMAC_STATE_IDLE;
- }
- else {
+ } else {
// jump back to the auth state and indicate the error
pMgmt->eCurrState = WMAC_STATE_AUTH;
}
if (pMgmt->bShareKeyAlgorithm) {
pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_KNOWN;
pMgmt->sNodeDBTable[uNodeIndex].byAuthSequence = 1;
- }
- else {
+ } else {
pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_AUTH;
}
*(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_SUCCESS);
else
*(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG);
- }
- else {
+ } else {
if (pMgmt->bShareKeyAlgorithm)
*(sFrame.pwStatus) = cpu_to_le16(WLAN_MGMT_STATUS_UNSUPPORTED_AUTHALG);
else
PSTxMgmtPacket pTxPacket = NULL;
- switch (cpu_to_le16((*(pFrame->pwAuthAlgorithm))))
- {
+ switch (cpu_to_le16((*(pFrame->pwAuthAlgorithm)))) {
case WLAN_AUTH_ALG_OPENSYSTEM:
if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) {
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Successful.\n");
pMgmt->eCurrState = WMAC_STATE_AUTH;
timer_expire(pDevice->sTimerCommand, 0);
- }
- else {
+ } else {
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (OPEN) Failed.\n");
s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus))));
pMgmt->eCurrState = WMAC_STATE_IDLE;
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 {
+ } 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);
uStatusCode = WLAN_MGMT_STATUS_CHALLENGE_FAIL;
goto reply;
}
- }
- else {
+ } else {
uStatusCode = WLAN_MGMT_STATUS_UNSPEC_FAILURE;
goto reply;
}
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Successful.\n");
pMgmt->eCurrState = WMAC_STATE_AUTH;
timer_expire(pDevice->sTimerCommand, 0);
- }
- else{
+ } else{
DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "802.11 Authen (SHAREDKEY) Failed.\n");
s_vMgrLogStatus(pMgmt, cpu_to_le16((*(pFrame->pwStatus))));
pMgmt->eCurrState = WMAC_STATE_IDLE;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
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) {
+ } else if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
vMgrDecodeDisassociation(&sFrame);
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
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 {
+ } else {
if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
sFrame.len = pRxPacket->cbMPDULen;
sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
sFrame.pHdr->sA4.abyAddr4, // payload of beacon
(void *)pRxPacket
);
- }
- else {
+ } else {
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "update bcn: RxChannel = : %d\n", byCurrChannel);
BSSbUpdateToBSSList((void *)pDevice,
*sFrame.pqwTimestamp,
pDevice->byERPFlag |= WLAN_SET_ERP_USE_PROTECTION(1);
pDevice->wUseProtectCntDown = USE_PROTECT_PERIOD;
}
- }
- else {
+ } else {
pDevice->byERPFlag |= WLAN_SET_ERP_USE_PROTECTION(1);
pDevice->wUseProtectCntDown = USE_PROTECT_PERIOD;
}
if (HIDWORD(qwTimestamp) == HIDWORD(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) {
qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwTimestamp), (qwLocalTSF));
- }
- else {
+ } else {
qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwLocalTSF), (qwTimestamp));
}
if (sFrame.pTIM->len >= (uLocateByteIndex + 4)) {
byTIMBitOn = (0x01) << ((wAIDNumber) % 8);
pMgmt->bInTIM = sFrame.pTIM->byVirtBitMap[uLocateByteIndex] & byTIMBitOn ? true : false;
- }
- else {
+ } else {
pMgmt->bInTIM = false;
};
- }
- else {
+ } else {
pMgmt->bInTIM = false;
};
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:PS-POLL sent..\n");
}
- }
- else {
+ } else {
pMgmt->bInTIMWake = false;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN: Not In TIM..\n");
if (pDevice->bPWBitOn == false) {
pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo);
pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo);
pMgmt->sNodeDBTable[uNodeIndex].uInActiveCount = 0;
- }
- else {
+ } else {
// Todo, initial Node content
BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex);
pMgmt->sNodeDBTable[0].uInActiveCount = 0;
}
- }
- else if (bIsSSIDEqual) {
+ } else if (bIsSSIDEqual) {
// See other adhoc sta with the same SSID but BSSID is different.
// adpot this vars only when TSF larger then us.
}
// endian issue ???
// Update TSF
- if (bUpdateTSF) {
+if (bUpdateTSF) {
CARDbGetCurrentTSF(pDevice->PortOffset, &qwCurrTSF);
CARDbUpdateTSF(pDevice, pRxPacket->byRxRate, qwTimestamp, pRxPacket->qwLocalTSF);
CARDbGetCurrentTSF(pDevice->PortOffset, &qwCurrTSF);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "End of Join AP -- A/B/G Action\n");
- }
- else {
+ } else {
pMgmt->eCurrState = WMAC_STATE_IDLE;
};
- }
- else {
+ } else {
// ad-hoc mode BSS
if (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) {
// Prepare beacon
bMgrPrepareBeaconToSend((void *)pDevice, pMgmt);
- }
- else {
+ } else {
pMgmt->eCurrState = WMAC_STATE_IDLE;
};
};
if (pCurr->abyPKType[0] == WPA_TKIP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP
PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-TKIP]\n");
- }
- else if (pCurr->abyPKType[0] == WPA_AESCCMP) {
+ } else if (pCurr->abyPKType[0] == WPA_AESCCMP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; //AES
PRINT_K("Encyption_Rebuild--->ssid reset config to [WPAPSK-AES]\n");
}
- }
- else if (pCurr->bWPA2Valid == true) { //WPA2-PSK
+ } else if (pCurr->bWPA2Valid == true) { //WPA2-PSK
pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK;
if (pCurr->abyCSSPK[0] == WLAN_11i_CSS_TKIP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled; //TKIP
PRINT_K("Encyption_Rebuild--->ssid reset config to [WPA2PSK-TKIP]\n");
- }
- else if (pCurr->abyCSSPK[0] == WLAN_11i_CSS_CCMP) {
+ } else if (pCurr->abyCSSPK[0] == WLAN_11i_CSS_CCMP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled; //AES
PRINT_K("Encyption_Rebuild--->ssid reset config to [WPA2PSK-AES]\n");
}
*pbyRSN++ = 0xf2;
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.pHdr->sA4.abyAddr4, // payload of probresponse
(void *)pRxPacket
);
- }
- else {
+ } else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp/insert: RxChannel = : %d\n", byCurrChannel);
BSSbInsertToBSSList((void *)pDevice,
sFrame.pHdr->sA3.abyAddr3,
Status = csMgmt_xmit(pDevice, pTxPacket);
if (Status != CMD_STATUS_PENDING) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx failed\n");
- }
- else {
+ } else {
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Mgt:Probe response tx sending..\n");
}
}
&Status
);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: send vMgrDeAuthenBeginSta 1\n");
- }
- else {
+ } else {
s_vMgrRxAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex);
}
break;
// 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
else
// any vendor checks here
;
- }
- else
+ } else
break;
//DBG_PRN_GRP14(("abyPKType[%d]: %X\n", j-1, pBSSList->abyPKType[j-1]));
} //for
else
// any vendor checks here
;
- }
- else
+ } else
break;
//DBG_PRN_GRP14(("abyAuthType[%d]: %X\n", j-1, pBSSList->abyAuthType[j-1]));
}
(pRSN->byElementID == WLAN_EID_RSN_WPA) && !memcmp(pRSN->abyOUI, abyOUI01, 4) &&
(pRSN->wVersion == 1)) {
return true;
- }
- else
+ } else
return false;
}
//spin_unlock_irq(&pDevice->lock);
if (param->u.wpa_key.key && fcpfkernel) {
memcpy(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len);
- }
- else {
+ } 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)) {
if (param->u.wpa_key.alg_name == WPA_ALG_WEP) {
if (dwKeyIndex > 3) {
return -EINVAL;
- }
- else {
+ } else {
if (param->u.wpa_key.set_tx) {
pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
pDevice->bTransmitKey = true;
//spin_unlock_irq(&pDevice->lock);
if (param->u.wpa_key.seq && fcpfkernel) {
memcpy(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len);
- }
- else {
+ } 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)) {
// set bssid
if (memcmp(param->u.wpa_associate.bssid, &abyNullAddr[0], 6) != 0)
memcpy(pMgmt->abyDesireBSSID, param->u.wpa_associate.bssid, 6);
- else
- {
+ else {
bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pItemSSID->abySSID);
}
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
//pMgmt->eAuthenMode = WMAC_AUTH_SHAREKEY;
pMgmt->bShareKeyAlgorithm = true;
- }
- else if (pMgmt->eAuthenMode == WMAC_AUTH_OPEN) {
+ } else if (pMgmt->eAuthenMode == WMAC_AUTH_OPEN) {
if (!bWepEnabled) pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
else pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
//pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
}
}
- }
- else {
+ } else {
pDevice->wCurrentRate = pDevice->pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate;
}