Commit 8f284d79 authored by Simon Schuster's avatar Simon Schuster Committed by Greg Kroah-Hartman

Staging: vt6656: Combined nested conditions

This patch reduces the level of indentation in bssdb.c of the vt6656
driver by transforming nested conditions to a series of logical
conjunctions. E.g.

if (cond1) {
        if (cond2) {
                block();
        }
}

is transformed to

if (cond1 && cond2) {
        block();
}
Signed-off-by: default avatarSebastian Rachuj <sebastian.rachuj@studium.uni-erlangen.de>
Signed-off-by: default avatarSimon Schuster <linux@rationality.eu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b7fce6ae
...@@ -107,10 +107,9 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, ...@@ -107,10 +107,9 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
(memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)) (memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0))
pbyBSSID = pbyDesireBSSID; pbyBSSID = pbyDesireBSSID;
} }
if (pbyDesireSSID != NULL) { if ((pbyDesireSSID != NULL) &&
if (((PWLAN_IE_SSID) pbyDesireSSID)->len != 0) (((PWLAN_IE_SSID) pbyDesireSSID)->len != 0))
pSSID = (PWLAN_IE_SSID) pbyDesireSSID; pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
}
if ((pbyBSSID != NULL) && (pDevice->bRoaming == false)) { if ((pbyBSSID != NULL) && (pDevice->bRoaming == false)) {
/* match BSSID first */ /* match BSSID first */
...@@ -120,27 +119,27 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, ...@@ -120,27 +119,27 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
pCurrBSS->bSelected = false; pCurrBSS->bSelected = false;
if ((pCurrBSS->bActive) && if ((pCurrBSS->bActive) &&
(pCurrBSS->bSelected == false)) { (pCurrBSS->bSelected == false) &&
if (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID)) { (ether_addr_equal(pCurrBSS->abyBSSID, pbyBSSID))) {
if (pSSID != NULL) { if (pSSID != NULL) {
/* compare ssid */ /* compare ssid */
if (!memcmp(pSSID->abySSID, if ((!memcmp(pSSID->abySSID,
((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID, ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
pSSID->len)) { pSSID->len)) &&
if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) || ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) || ((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) &&
((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
) { ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) &&
pCurrBSS->bSelected = true; WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)))) {
return pCurrBSS;
}
}
} else if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) {
pCurrBSS->bSelected = true; pCurrBSS->bSelected = true;
return pCurrBSS; return pCurrBSS;
} }
} else if ((pMgmt->eConfigMode == WMAC_CONFIG_AUTO) ||
((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ||
((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo))) {
pCurrBSS->bSelected = true;
return pCurrBSS;
} }
} }
} }
...@@ -156,16 +155,17 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, ...@@ -156,16 +155,17 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
pCurrBSS->bSelected = false; pCurrBSS->bSelected = false;
if (pCurrBSS->bActive) { if (pCurrBSS->bActive) {
if (pSSID != NULL) { if ((pSSID != NULL) &&
/* matched SSID */ /* matched SSID */
if (memcmp(pSSID->abySSID, (memcmp(pSSID->abySSID,
((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID, ((PWLAN_IE_SSID) pCurrBSS->abySSID)->abySSID,
pSSID->len) || pSSID->len) ||
(pSSID->len != ((PWLAN_IE_SSID) pCurrBSS->abySSID)->len)) { (pSSID->len !=
/* SSID not match skip this BSS */ ((PWLAN_IE_SSID) pCurrBSS->abySSID)->len))) {
continue; /* SSID not match skip this BSS */
} continue;
} }
if (((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) || if (((pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) && WLAN_GET_CAP_INFO_ESS(pCurrBSS->wCapInfo)) ||
((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo)) ((pMgmt->eConfigMode == WMAC_CONFIG_ESS_STA) && WLAN_GET_CAP_INFO_IBSS(pCurrBSS->wCapInfo))
) { ) {
...@@ -174,13 +174,14 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, ...@@ -174,13 +174,14 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice,
continue; continue;
} }
if (ePhyType != PHY_TYPE_AUTO) { if ((ePhyType != PHY_TYPE_AUTO) &&
if (((ePhyType == PHY_TYPE_11A) && (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) || (((ePhyType == PHY_TYPE_11A) &&
((ePhyType != PHY_TYPE_11A) && (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse))) { (PHY_TYPE_11A != pCurrBSS->eNetworkTypeInUse)) ||
/* PhyType not match skip this BSS */ ((ePhyType != PHY_TYPE_11A) &&
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse); (PHY_TYPE_11A == pCurrBSS->eNetworkTypeInUse)))) {
continue; /* PhyType not match skip this BSS */
} DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Physical type mismatch.... ePhyType[%d] BSS[%d]\n", ePhyType, pCurrBSS->eNetworkTypeInUse);
continue;
} }
pMgmt->pSameBSS[jj].uChannel = pCurrBSS->uChannel; pMgmt->pSameBSS[jj].uChannel = pCurrBSS->uChannel;
...@@ -228,21 +229,20 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID) ...@@ -228,21 +229,20 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID)
int ii; int ii;
for (ii = 0; ii < MAX_BSS_NUM; ii++) { for (ii = 0; ii < MAX_BSS_NUM; ii++) {
if (bKeepCurrBSSID) { if (bKeepCurrBSSID &&
if (pMgmt->sBSSList[ii].bActive && pMgmt->sBSSList[ii].bActive &&
ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID, ether_addr_equal(pMgmt->sBSSList[ii].abyBSSID,
pMgmt->abyCurrBSSID)) { pMgmt->abyCurrBSSID)) {
/* mike mark: /* mike mark:
* there are two BSSID's in list. If that AP is * there are two BSSID's in list. If that AP is
* in hidden ssid mode, one SSID is null, but * in hidden ssid mode, one SSID is null, but
* other's might not be obvious, so if it * other's might not be obvious, so if it
* associate's with your STA, you must keep the * associate's with your STA, you must keep the
* two of them!! bKeepCurrBSSID = false; * two of them!! bKeepCurrBSSID = false;
*/ */
continue; continue;
}
} }
pMgmt->sBSSList[ii].bActive = false; pMgmt->sBSSList[ii].bActive = false;
...@@ -268,16 +268,13 @@ PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice, ...@@ -268,16 +268,13 @@ PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice,
for (ii = 0; ii < MAX_BSS_NUM; ii++) { for (ii = 0; ii < MAX_BSS_NUM; ii++) {
pBSSList = &(pMgmt->sBSSList[ii]); pBSSList = &(pMgmt->sBSSList[ii]);
if (pBSSList->bActive) { if ((pBSSList->bActive) &&
if (ether_addr_equal(pBSSList->abyBSSID, abyBSSID)) { (ether_addr_equal(pBSSList->abyBSSID, abyBSSID)) &&
if (pSSID->len == ((PWLAN_IE_SSID) pBSSList->abySSID)->len) { (pSSID->len == ((PWLAN_IE_SSID) pBSSList->abySSID)->len) &&
if (memcmp(pSSID->abySSID, (memcmp(pSSID->abySSID,
((PWLAN_IE_SSID) pBSSList->abySSID)->abySSID, ((PWLAN_IE_SSID) pBSSList->abySSID)->abySSID,
pSSID->len) == 0) pSSID->len) == 0))
return pBSSList; return pBSSList;
}
}
}
} }
return NULL; return NULL;
...@@ -371,11 +368,10 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice, ...@@ -371,11 +368,10 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
pBSSList->bySQ = pRxPacket->bySQ; pBSSList->bySQ = pRxPacket->bySQ;
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
(pMgmt->eCurrState == WMAC_STATE_ASSOC)) { (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
/* assoc with BSS */ /* assoc with BSS */
if (pBSSList == pMgmt->pCurrBSS) (pBSSList == pMgmt->pCurrBSS))
bParsingQuiet = true; bParsingQuiet = true;
}
WPA_ClearRSN(pBSSList); WPA_ClearRSN(pBSSList);
...@@ -421,13 +417,19 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice, ...@@ -421,13 +417,19 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice,
pBSSList->abyBSSID, pBSSList->abyBSSID,
&pBSSList->sRSNCapObj); &pBSSList->sRSNCapObj);
if ((pDevice->bLinkPass == true) && (pMgmt->eCurrState == WMAC_STATE_ASSOC)) { if ((pDevice->bLinkPass == true) &&
if ((KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) || (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
(KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, GROUP_KEY, &pTransmitKey) == true)) { ((KeybGetTransmitKey(&(pDevice->sKey),
pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList; pDevice->abyBSSID,
pDevice->gsPMKIDCandidate.Version = 1; PAIRWISE_KEY,
&pTransmitKey) == true) ||
(KeybGetTransmitKey(&(pDevice->sKey),
pDevice->abyBSSID,
GROUP_KEY,
&pTransmitKey) == true))) {
pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList;
pDevice->gsPMKIDCandidate.Version = 1;
}
} }
} }
...@@ -524,11 +526,10 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice, ...@@ -524,11 +526,10 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice,
pBSSList->bySQ = pRxPacket->bySQ; pBSSList->bySQ = pRxPacket->bySQ;
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
(pMgmt->eCurrState == WMAC_STATE_ASSOC)) { (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
/* assoc with BSS */ /* assoc with BSS */
if (pBSSList == pMgmt->pCurrBSS) (pBSSList == pMgmt->pCurrBSS))
bParsingQuiet = true; bParsingQuiet = true;
}
WPA_ClearRSN(pBSSList); /* mike update */ WPA_ClearRSN(pBSSList); /* mike update */
...@@ -597,12 +598,11 @@ int BSSbIsSTAInNodeDB(struct vnt_private *pDevice, ...@@ -597,12 +598,11 @@ int BSSbIsSTAInNodeDB(struct vnt_private *pDevice,
/* Index = 0 reserved for AP Node */ /* Index = 0 reserved for AP Node */
for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
if (pMgmt->sNodeDBTable[ii].bActive) { if ((pMgmt->sNodeDBTable[ii].bActive) &&
if (ether_addr_equal(abyDstAddr, (ether_addr_equal(abyDstAddr,
pMgmt->sNodeDBTable[ii].abyMACAddr)) { pMgmt->sNodeDBTable[ii].abyMACAddr))) {
*puNodeIndex = ii; *puNodeIndex = ii;
return true; return true;
}
} }
} }
...@@ -1064,16 +1064,15 @@ void BSSvSecondCallBack(struct work_struct *work) ...@@ -1064,16 +1064,15 @@ void BSSvSecondCallBack(struct work_struct *work)
} }
if (pDevice->bLinkPass == true) { if (pDevice->bLinkPass == true) {
if (pMgmt->eAuthenMode < WMAC_AUTH_WPA || if ((pMgmt->eAuthenMode < WMAC_AUTH_WPA ||
pDevice->fWPA_Authened == true) { pDevice->fWPA_Authened == true) &&
if (++pDevice->tx_data_time_out > 40) { (++pDevice->tx_data_time_out > 40)) {
pDevice->tx_trigger = true; pDevice->tx_trigger = true;
PSbSendNullPacket(pDevice); PSbSendNullPacket(pDevice);
pDevice->tx_trigger = false; pDevice->tx_trigger = false;
pDevice->tx_data_time_out = 0; pDevice->tx_data_time_out = 0;
}
} }
if (netif_queue_stopped(pDevice->dev)) if (netif_queue_stopped(pDevice->dev))
...@@ -1177,58 +1176,56 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO) ...@@ -1177,58 +1176,56 @@ void BSSvUpdateNodeTxCounter(struct vnt_private *pDevice, u8 byTSR, u8 byPktNO)
} }
} }
if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) || if (((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
(pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) { (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) &&
(BSSbIsSTAInNodeDB((void *) pDevice,
if (BSSbIsSTAInNodeDB((void *) pDevice, pbyDestAddr,
pbyDestAddr, &uNodeIndex))) {
&uNodeIndex)) { pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1; if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
if (!(byTSR & (TSR_TMO | TSR_RETRYTMO))) { /* transmit success, TxAttempts at least plus one */
/* transmit success, TxAttempts at least plus one */ pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++;
pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++; if ((byFallBack == AUTO_FB_NONE) ||
if ((byFallBack == AUTO_FB_NONE) || (wRate < RATE_18M)) {
(wRate < RATE_18M)) { wFallBackRate = wRate;
wFallBackRate = wRate; } else if (byFallBack == AUTO_FB_0) {
} else if (byFallBack == AUTO_FB_0) { if (byTxRetry < 5)
if (byTxRetry < 5) wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry];
wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry]; else
wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
} else if (byFallBack == AUTO_FB_1) {
if (byTxRetry < 5)
wFallBackRate = awHWRetry1[wRate-RATE_18M][byTxRetry];
else
wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
}
pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wFallBackRate]++;
} else {
pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++;
}
pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += byTxRetry;
if (byTxRetry != 0) {
pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE] += byTxRetry;
if ((byFallBack == AUTO_FB_NONE) ||
(wRate < RATE_18M)) {
pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate] += byTxRetry;
} else if (byFallBack == AUTO_FB_0) {
for (ii = 0; ii < byTxRetry; ii++) {
if (ii < 5)
wFallBackRate =
awHWRetry0[wRate-RATE_18M][ii];
else else
wFallBackRate = awHWRetry0[wRate-RATE_18M][4]; wFallBackRate =
} else if (byFallBack == AUTO_FB_1) { awHWRetry0[wRate-RATE_18M][4];
if (byTxRetry < 5) pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
wFallBackRate = awHWRetry1[wRate-RATE_18M][byTxRetry]; }
} else if (byFallBack == AUTO_FB_1) {
for (ii = 0; ii < byTxRetry; ii++) {
if (ii < 5)
wFallBackRate = awHWRetry1[wRate-RATE_18M][ii];
else else
wFallBackRate = awHWRetry1[wRate-RATE_18M][4]; wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
} pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wFallBackRate]++;
} else {
pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++;
}
pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += byTxRetry;
if (byTxRetry != 0) {
pMgmt->sNodeDBTable[uNodeIndex].uTxFail[MAX_RATE] += byTxRetry;
if ((byFallBack == AUTO_FB_NONE) ||
(wRate < RATE_18M)) {
pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wRate] += byTxRetry;
} else if (byFallBack == AUTO_FB_0) {
for (ii = 0; ii < byTxRetry; ii++) {
if (ii < 5)
wFallBackRate =
awHWRetry0[wRate-RATE_18M][ii];
else
wFallBackRate =
awHWRetry0[wRate-RATE_18M][4];
pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
}
} else if (byFallBack == AUTO_FB_1) {
for (ii = 0; ii < byTxRetry; ii++) {
if (ii < 5)
wFallBackRate = awHWRetry1[wRate-RATE_18M][ii];
else
wFallBackRate = awHWRetry1[wRate-RATE_18M][4];
pMgmt->sNodeDBTable[uNodeIndex].uTxFail[wFallBackRate]++;
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment