Commit 92363b52 authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

Staging: otus: 80211core: Hoist assign from if

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7c2c2eb7
......@@ -2485,7 +2485,7 @@ void zfAggTxRetransmit(zdev_t* dev, struct bufInfo *buf_info, struct aggControl
BAW->insert(dev, buf_info->buf, tid_tx->bar_ssn >> 4, aggControl->tid_baw, buf_info->baw_retransmit, &header_r);
}*/
if ((err = zfHpSend(dev,
err = zfHpSend(dev,
buf_info->baw_header->header,
buf_info->baw_header->headerLen,
buf_info->baw_header->snap,
......@@ -2496,7 +2496,8 @@ void zfAggTxRetransmit(zdev_t* dev, struct bufInfo *buf_info, struct aggControl
buf_info->baw_header->removeLen,
ZM_EXTERNAL_ALLOC_BUF,
(u8_t)tid_tx->ac,
buf_info->baw_header->keyIdx)) != ZM_SUCCESS)
buf_info->baw_header->keyIdx);
if (err != ZM_SUCCESS)
{
goto zlError;
}
......@@ -2797,9 +2798,10 @@ u16_t zfAggTxSendEth(zdev_t* dev, zbuf_t* buf, u16_t port, u16_t bufType, u8_t f
BAW->insert(dev, buf, tid_tx->bar_ssn >> 4, aggControl->tid_baw, 0, &header_r);
}*/
if ((err = zfHpSend(dev, header, headerLen, snap, snapLen,
err = zfHpSend(dev, header, headerLen, snap, snapLen,
mic, micLen, frag.buf[i], removeLen,
frag.bufType[i], zcUpToAc[up&0x7], keyIdx)) != ZM_SUCCESS)
frag.bufType[i], zcUpToAc[up&0x7], keyIdx);
if (err != ZM_SUCCESS)
{
goto zlError;
}
......@@ -2849,7 +2851,8 @@ u16_t zfAggSendAddbaRequest(zdev_t* dev, u16_t *dst, u16_t ac, u16_t up)
/*
* TBD : Maximum size of management frame
*/
if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
buf = zfwBufAllocate(dev, 1024);
if (buf == NULL)
{
zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
return ZM_SUCCESS;
......@@ -2892,8 +2895,9 @@ u16_t zfAggSendAddbaRequest(zdev_t* dev, u16_t *dst, u16_t ac, u16_t up)
//zm_msg2_mm(ZM_LV_2, "buf->data=", buf->data);
#if 0
if ((err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
ZM_INTERNAL_ALLOC_BUF, 0, 0xff);
if (err != ZM_SUCCESS)
{
goto zlError;
}
......@@ -3290,7 +3294,8 @@ u16_t zfAggSendAddbaResponse(zdev_t* dev, struct aggBaFrameParameter *bf)
/*
* TBD : Maximum size of management frame
*/
if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
buf = zfwBufAllocate(dev, 1024);
if (buf == NULL)
{
zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
return ZM_SUCCESS;
......@@ -3337,8 +3342,9 @@ u16_t zfAggSendAddbaResponse(zdev_t* dev, struct aggBaFrameParameter *bf)
//zm_msg2_mm(ZM_LV_2, "buf->data=", buf->data);
#if 0
if ((err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
ZM_INTERNAL_ALLOC_BUF, 0, 0xff);
if (err != ZM_SUCCESS)
{
goto zlError;
}
......@@ -3443,7 +3449,8 @@ u16_t zfAggSendBar(zdev_t* dev, TID_TX tid_tx, struct aggBarControl *aggBarCon
/*
* TBD : Maximum size of management frame
*/
if ((buf = zfwBufAllocate(dev, 1024)) == NULL)
buf = zfwBufAllocate(dev, 1024);
if (buf == NULL)
{
zm_msg0_mm(ZM_LV_0, "Alloc mm buf Fail!");
return ZM_SUCCESS;
......@@ -3486,8 +3493,9 @@ u16_t zfAggSendBar(zdev_t* dev, TID_TX tid_tx, struct aggBarControl *aggBarCon
//zm_msg2_mm(ZM_LV_2, "buf->data=", buf->data);
#if 0
if ((err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
ZM_INTERNAL_ALLOC_BUF, 0, 0xff);
if (err != ZM_SUCCESS)
{
goto zlError;
}
......
......@@ -1436,7 +1436,8 @@ u16_t zfiWlanDeauth(zdev_t *dev, u16_t *macAddr, u16_t reason)
*/
/*
if ((id = zfApFindSta(dev, macAddr)) != 0xffff)
id = zfApFindSta(dev, macAddr);
if (id != 0xffff)
{
u32_t key[8];
u16_t nullAddr[3] = { 0x0, 0x0, 0x0 };
......
......@@ -1072,7 +1072,8 @@ u16_t zfFindCleanFrequency(zdev_t* dev, u32_t adhocMode)
zmw_get_wlan_dev(dev);
if ((pBssInfo = wd->sta.bssList.head) == NULL)
pBssInfo = wd->sta.bssList.head;
if (pBssInfo == NULL)
{
if( adhocMode == ZM_ADHOCBAND_B || adhocMode == ZM_ADHOCBAND_G ||
adhocMode == ZM_ADHOCBAND_BG || adhocMode == ZM_ADHOCBAND_ABG )
......
......@@ -329,7 +329,8 @@ void zfCoreEvent(zdev_t* dev, u16_t event, u8_t* rsp)
if (wd->wlanMode == ZM_MODE_AP)
{
zmw_enter_critical_section(dev);
if ((i=zfApFindSta(dev, (u16_t*)rsp)) != 0xffff)
i = zfApFindSta(dev, (u16_t*)rsp);
if (i != 0xffff)
{
zfRateCtrlTxFailEvent(dev, &wd->ap.staTable[i].rcCell, 0,(u32_t)zfPhyCtrlToRate(retryRate));
}
......@@ -357,7 +358,8 @@ void zfCoreEvent(zdev_t* dev, u16_t event, u8_t* rsp)
if (wd->wlanMode == ZM_MODE_AP)
{
zmw_enter_critical_section(dev);
if ((i=zfApFindSta(dev, (u16_t*)rsp)) != 0xffff)
i = zfApFindSta(dev, (u16_t*)rsp);
if (i != 0xffff)
{
zfRateCtrlTxFailEvent(dev, &wd->ap.staTable[i].rcCell, 0,(u32_t)zfPhyCtrlToRate(retryRate));
}
......@@ -387,7 +389,8 @@ void zfCoreEvent(zdev_t* dev, u16_t event, u8_t* rsp)
if (wd->wlanMode == ZM_MODE_AP)
{
zmw_enter_critical_section(dev);
if ((i=zfApFindSta(dev, (u16_t*)rsp)) != 0xffff)
i = zfApFindSta(dev, (u16_t*)rsp);
if (i != 0xffff)
{
zfRateCtrlTxSuccessEvent(dev, &wd->ap.staTable[i].rcCell, zfPhyCtrlToRate(retryRate));
}
......
......@@ -622,7 +622,8 @@ u16_t zfTxGenWlanHeader(zdev_t* dev, zbuf_t* buf, u16_t* header, u16_t seq,
phyCtrl = 0xc0001; //PHY control L
/* WDS port checking */
if ((wdsPort = (port - 0x20)) >= ZM_MAX_WDS_SUPPORT)
wdsPort = port - 0x20;
if (wdsPort >= ZM_MAX_WDS_SUPPORT)
{
wdsPort = 0;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -553,7 +553,8 @@ u8_t zfiWlanSetKey(zdev_t* dev, struct zsKeyInfo keyInfo)
if (keyInfo.flag & ZM_KEY_FLAG_PK)
{
/* Find STA's information */
if ((id = zfApFindSta(dev, keyInfo.macAddr)) == 0xffff)
id = zfApFindSta(dev, keyInfo.macAddr);
if (id == 0xffff)
{
/* Can't STA in the staTable */
return ZM_STATUS_FAILURE;
......
......@@ -602,7 +602,8 @@ void zfPowerSavingMgrProcessBeacon(zdev_t* dev, zbuf_t* buf)
wd->sta.psMgr.isSleepAllowed = 1;
if ( (offset=zfFindElement(dev, buf, ZM_WLAN_EID_TIM)) != 0xffff )
offset = zfFindElement(dev, buf, ZM_WLAN_EID_TIM);
if (offset != 0xffff)
{
length = zmw_rx_buf_readb(dev, buf, offset+1);
......
......@@ -109,7 +109,8 @@ void zfGetRxIvIcvLength(zdev_t* dev, zbuf_t* buf, u8_t vap, u16_t* pIvLen,
addr[2] = zmw_rx_buf_readh(dev, buf, ZM_WLAN_HEADER_A2_OFFSET+4);
/* Find STA's information */
if ((id = zfApFindSta(dev, addr)) != 0xffff)
id = zfApFindSta(dev, addr);
if (id != 0xffff)
{
if (wd->ap.staTable[id].encryMode == ZM_TKIP)
{
......@@ -132,7 +133,8 @@ void zfGetRxIvIcvLength(zdev_t* dev, zbuf_t* buf, u8_t vap, u16_t* pIvLen,
}
}
/* WDS port checking */
if ((wdsPort = vap - 0x20) >= ZM_MAX_WDS_SUPPORT)
wdsPort = vap - 0x20;
if (wdsPort >= ZM_MAX_WDS_SUPPORT)
{
wdsPort = 0;
}
......@@ -741,8 +743,9 @@ u16_t zfiTxSend80211Mgmt(zdev_t* dev, zbuf_t* buf, u16_t port)
zfwBufRemoveHead(dev, buf, 24);
if ((err = zfHpSend(dev, header, hlen, NULL, 0, NULL, 0, buf, 0,
ZM_EXTERNAL_ALLOC_BUF, 0, 0)) != ZM_SUCCESS)
err = zfHpSend(dev, header, hlen, NULL, 0, NULL, 0, buf, 0,
ZM_EXTERNAL_ALLOC_BUF, 0, 0);
if (err != ZM_SUCCESS)
{
goto zlError;
}
......@@ -799,7 +802,8 @@ u16_t zfiTxSendEth(zdev_t* dev, zbuf_t* buf, u16_t port)
ZM_PERFORMANCE_TX_MSDU(dev, wd->tick);
zm_msg1_tx(ZM_LV_2, "zfiTxSendEth(), port=", port);
/* Return error if port is disabled */
if ((err = zfTxPortControl(dev, buf, port)) == ZM_PORT_DISABLED)
err = zfTxPortControl(dev, buf, port);
if (err == ZM_PORT_DISABLED)
{
err = ZM_ERR_TX_PORT_DISABLED;
goto zlError;
......@@ -809,7 +813,8 @@ u16_t zfiTxSendEth(zdev_t* dev, zbuf_t* buf, u16_t port)
if ((wd->wlanMode == ZM_MODE_AP) && (port < 0x20))
{
/* AP : Buffer frame for power saving STA */
if ((ret = zfApBufferPsFrame(dev, buf, port)) == 1)
ret = zfApBufferPsFrame(dev, buf, port);
if (ret == 1)
{
return ZM_SUCCESS;
}
......@@ -1119,7 +1124,8 @@ u16_t zfTxSendEth(zdev_t* dev, zbuf_t* buf, u16_t port, u16_t bufType, u16_t fla
i = 0;
while( frameLen > 0 )
{
if ((frag.buf[i] = zfwBufAllocate(dev, fragLen+32)) != NULL)
frag.buf[i] = zfwBufAllocate(dev, fragLen+32);
if (frag.buf[i] != NULL)
{
frag.bufType[i] = ZM_INTERNAL_ALLOC_BUF;
frag.seq[i] = frag.seq[0] + i;
......@@ -1276,7 +1282,8 @@ void zfCoreRecv(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo)
bssid[2] = zmw_buf_readh(dev, buf, 20);
/* Validate Rx frame */
if ((ret = zfWlanRxValidate(dev, buf)) != ZM_SUCCESS)
ret = zfWlanRxValidate(dev, buf);
if (ret != ZM_SUCCESS)
{
zm_msg1_rx(ZM_LV_1, "Rx invalid:", ret);
goto zlError;
......@@ -1301,7 +1308,8 @@ void zfCoreRecv(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo)
#endif
/* Filter Rx frame */
if ((ret = zfWlanRxFilter(dev, buf)) != ZM_SUCCESS)
ret = zfWlanRxFilter(dev, buf);
if (ret != ZM_SUCCESS)
{
zm_msg1_rx(ZM_LV_1, "Rx duplicated:", ret);
goto zlError;
......@@ -2086,7 +2094,8 @@ void zfiRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo)
//zm_msg0_rx(ZM_LV_0, "Rx data");
if (wd->wlanMode == ZM_MODE_AP)
{
if ((ret = zfApUpdatePsBit(dev, buf, &vap, &uapsdTrig)) != ZM_SUCCESS)
ret = zfApUpdatePsBit(dev, buf, &vap, &uapsdTrig);
if (ret != ZM_SUCCESS)
{
zfwBufFree(dev, buf, 0);
return;
......@@ -2115,7 +2124,8 @@ void zfiRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo)
for (ii=0; ii<pktNum; ii++)
{
//if ((psBuf = zfQueueGet(dev, wd->ap.uapsdQ)) != NULL)
if ((psBuf = zfQueueGetWithMac(dev, wd->ap.uapsdQ, src, &mb)) != NULL)
psBuf = zfQueueGetWithMac(dev, wd->ap.uapsdQ, src, &mb);
if (psBuf != NULL)
{
if ((ii+1) == pktNum)
{
......@@ -2232,7 +2242,8 @@ void zfiRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo)
}
else
{
if ( (buf = zfDefragment(dev, buf, &bIsDefrag, addInfo)) == NULL )
buf = zfDefragment(dev, buf, &bIsDefrag, addInfo);
if (buf == NULL)
{
/* In this case, the buffer has been freed in zfDefragment */
return;
......@@ -2836,7 +2847,8 @@ void zfiRecv80211(zdev_t* dev, zbuf_t* buf, struct zsAdditionInfo* addInfo)
zfwBufRemoveHead(dev, buf, 18+offset);
#endif // ZM_ENABLE_NATIVE_WIFI
#if 1
if ((ret = zfIntrabssForward(dev, buf, vap)) == 1)
ret = zfIntrabssForward(dev, buf, vap);
if (ret == 1)
{
/* Free Rx buffer if intra-BSS unicast frame */
zm_msg0_rx(ZM_LV_2, "Free intra-BSS unicast frame");
......@@ -3037,7 +3049,8 @@ u16_t zfWlanRxValidate(zdev_t* dev, zbuf_t* buf)
}
else if ( wd->wlanMode != ZM_MODE_PSEUDO )
{
if ( (ret=zfStaRxValidateFrame(dev, buf))!=ZM_SUCCESS )
ret = zfStaRxValidateFrame(dev, buf);
if (ret != ZM_SUCCESS)
{
//zm_debug_msg1("discard frame, code = ", ret);
return ret;
......@@ -3787,12 +3800,14 @@ void zfPushVtxq(zdev_t* dev)
/* 2006.12.20, Serve Management queue */
while( zfHpGetFreeTxdCount(dev) > 0 )
{
if ((buf = zfGetVmmq(dev)) != 0)
buf = zfGetVmmq(dev);
if (buf != 0)
{
txed = 1;
//zm_debug_msg2("send buf = ", buf);
if ((err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
ZM_INTERNAL_ALLOC_BUF, 0, 0xff)) != ZM_SUCCESS)
err = zfHpSend(dev, NULL, 0, NULL, 0, NULL, 0, buf, 0,
ZM_INTERNAL_ALLOC_BUF, 0, 0xff);
if (err != ZM_SUCCESS)
{
zfwBufFree(dev, buf, 0);
}
......@@ -3831,9 +3846,11 @@ void zfPushVtxq(zdev_t* dev)
/* Service VTxQ[3] */
for (i=0; i<4; i++)
{
if ((freeTxd = zfHpGetFreeTxdCount(dev)) >= 3)
freeTxd = zfHpGetFreeTxdCount(dev);
if (freeTxd >= 3)
{
if ((buf = zfGetVtxq(dev, 3)) != 0)
buf = zfGetVtxq(dev, 3);
if (buf != 0)
{
txed = 1;
//zm_debug_msg2("send buf = ", buf);
......@@ -3850,9 +3867,11 @@ void zfPushVtxq(zdev_t* dev)
/* Service VTxQ[2] */
for (i=0; i<3; i++)
{
if ((freeTxd = zfHpGetFreeTxdCount(dev)) >= (zfHpGetMaxTxdCount(dev)*1/4))
freeTxd = zfHpGetFreeTxdCount(dev);
if (freeTxd >= (zfHpGetMaxTxdCount(dev)*1/4))
{
if ((buf = zfGetVtxq(dev, 2)) != 0)
buf = zfGetVtxq(dev, 2);
if (buf != 0)
{
txed = 1;
zfTxSendEth(dev, buf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
......@@ -3860,7 +3879,8 @@ void zfPushVtxq(zdev_t* dev)
}
if (wd->sta.ac0PriorityHigherThanAc2 == 1)
{
if ((buf = zfGetVtxq(dev, 0)) != 0)
buf = zfGetVtxq(dev, 0);
if (buf != 0)
{
txed = 1;
zfTxSendEth(dev, buf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
......@@ -3877,9 +3897,11 @@ void zfPushVtxq(zdev_t* dev)
/* Service VTxQ[0] */
for (i=0; i<2; i++)
{
if ((freeTxd = zfHpGetFreeTxdCount(dev)) >= (zfHpGetMaxTxdCount(dev)*2/4))
freeTxd = zfHpGetFreeTxdCount(dev);
if (freeTxd >= (zfHpGetMaxTxdCount(dev)*2/4))
{
if ((buf = zfGetVtxq(dev, 0)) != 0)
buf = zfGetVtxq(dev, 0);
if (buf != 0)
{
txed = 1;
zfTxSendEth(dev, buf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
......@@ -3894,9 +3916,11 @@ void zfPushVtxq(zdev_t* dev)
}
/* Service VTxQ[1] */
if ((freeTxd = zfHpGetFreeTxdCount(dev)) >= (zfHpGetMaxTxdCount(dev)*3/4))
freeTxd = zfHpGetFreeTxdCount(dev);
if (freeTxd >= (zfHpGetMaxTxdCount(dev)*3/4))
{
if ((buf = zfGetVtxq(dev, 1)) != 0)
buf = zfGetVtxq(dev, 1);
if (buf != 0)
{
txed = 1;
zfTxSendEth(dev, buf, 0, ZM_EXTERNAL_ALLOC_BUF, 0);
......@@ -3983,9 +4007,10 @@ void zf80211FrameSend(zdev_t* dev, zbuf_t* buf, u16_t* header, u16_t snapLen,
}
wd->ledStruct.txTraffic++;
if ((err = zfHpSend(dev, header, headerLen, snap, snapLen,
err = zfHpSend(dev, header, headerLen, snap, snapLen,
tail, tailLen, buf, offset,
bufType, ac, keyIdx)) != ZM_SUCCESS)
bufType, ac, keyIdx);
if (err != ZM_SUCCESS)
{
if (bufType == ZM_EXTERNAL_ALLOC_BUF)
{
......
......@@ -31,8 +31,9 @@ struct zsQueue* zfQueueCreate(zdev_t* dev, u16_t size)
{
struct zsQueue* q;
if ((q = (struct zsQueue*)zfwMemAllocate(dev, sizeof(struct zsQueue)
+ (sizeof(struct zsQueueCell)*(size-1)))) != NULL)
q = (struct zsQueue*)zfwMemAllocate(dev, sizeof(struct zsQueue)
+ (sizeof(struct zsQueueCell)*(size-1)));
if (q != NULL)
{
q->size = size;
q->sizeMask = size-1;
......
......@@ -538,7 +538,8 @@ u16_t zfRateCtrlGetTxRate(zdev_t* dev, struct zsRcCell* rcCell, u16_t* probing)
((rcCell->currentRate <= 16) &&
((wd->PER[rcCell->currentRate]/2) <= ZM_RATE_PROBING_THRESHOLD)))
{
if ((newRate=zfRateCtrlGetHigherRate(rcCell)) != rcCell->currentRate)
newRate = zfRateCtrlGetHigherRate(rcCell);
if (newRate != rcCell->currentRate)
{
*probing = 1;
wd->probeCount++;
......
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