Commit 68f4f09b authored by Lilis Iskandar's avatar Lilis Iskandar Committed by Greg Kroah-Hartman

Staging: bcm: LeakyBucket: Fixed brace issues

Fixed brace issues
Signed-off-by: default avatarLilis Iskandar <veeableful@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 37c79c71
...@@ -23,34 +23,29 @@ static VOID UpdateTokenCount(register struct bcm_mini_adapter *Adapter) ...@@ -23,34 +23,29 @@ static VOID UpdateTokenCount(register struct bcm_mini_adapter *Adapter)
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL,
"=====>\n"); "=====>\n");
if (NULL == Adapter) if (NULL == Adapter) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS,
DBG_LVL_ALL, "Adapter found NULL!\n"); DBG_LVL_ALL, "Adapter found NULL!\n");
return; return;
} }
do_gettimeofday(&tv); do_gettimeofday(&tv);
for (i = 0; i < NO_OF_QUEUES; i++) for (i = 0; i < NO_OF_QUEUES; i++) {
{
if (TRUE == Adapter->PackInfo[i].bValid && if (TRUE == Adapter->PackInfo[i].bValid &&
(1 == Adapter->PackInfo[i].ucDirection)) (1 == Adapter->PackInfo[i].ucDirection)) {
{
liCurrentTime = ((tv.tv_sec- liCurrentTime = ((tv.tv_sec-
Adapter->PackInfo[i].stLastUpdateTokenAt.tv_sec)*1000 + Adapter->PackInfo[i].stLastUpdateTokenAt.tv_sec)*1000 +
(tv.tv_usec-Adapter->PackInfo[i].stLastUpdateTokenAt.tv_usec)/ (tv.tv_usec-Adapter->PackInfo[i].stLastUpdateTokenAt.tv_usec)/
1000); 1000);
if (0 != liCurrentTime) if (0 != liCurrentTime) {
{
Adapter->PackInfo[i].uiCurrentTokenCount += (ULONG) Adapter->PackInfo[i].uiCurrentTokenCount += (ULONG)
((Adapter->PackInfo[i].uiMaxAllowedRate) * ((Adapter->PackInfo[i].uiMaxAllowedRate) *
((ULONG)((liCurrentTime)))/1000); ((ULONG)((liCurrentTime)))/1000);
memcpy(&Adapter->PackInfo[i].stLastUpdateTokenAt, memcpy(&Adapter->PackInfo[i].stLastUpdateTokenAt,
&tv, sizeof(struct timeval)); &tv, sizeof(struct timeval));
Adapter->PackInfo[i].liLastUpdateTokenAt = liCurrentTime; Adapter->PackInfo[i].liLastUpdateTokenAt = liCurrentTime;
if ((Adapter->PackInfo[i].uiCurrentTokenCount) >= if (Adapter->PackInfo[i].uiCurrentTokenCount >=
Adapter->PackInfo[i].uiMaxBucketSize) Adapter->PackInfo[i].uiMaxBucketSize) {
{
Adapter->PackInfo[i].uiCurrentTokenCount = Adapter->PackInfo[i].uiCurrentTokenCount =
Adapter->PackInfo[i].uiMaxBucketSize; Adapter->PackInfo[i].uiMaxBucketSize;
} }
...@@ -82,27 +77,20 @@ static ULONG GetSFTokenCount(struct bcm_mini_adapter *Adapter, struct bcm_packet ...@@ -82,27 +77,20 @@ static ULONG GetSFTokenCount(struct bcm_mini_adapter *Adapter, struct bcm_packet
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "IsPacketAllowedForFlow ===>"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "IsPacketAllowedForFlow ===>");
/* Validate the parameters */ /* Validate the parameters */
if (NULL == Adapter || (psSF < Adapter->PackInfo && if (NULL == Adapter || (psSF < Adapter->PackInfo &&
(uintptr_t)psSF > (uintptr_t) &Adapter->PackInfo[HiPriority])) (uintptr_t)psSF > (uintptr_t) &Adapter->PackInfo[HiPriority])) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "IPAFF: Got wrong Parameters:Adapter: %p, QIndex: %zd\n", Adapter, (psSF-Adapter->PackInfo)); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "IPAFF: Got wrong Parameters:Adapter: %p, QIndex: %zd\n", Adapter, (psSF-Adapter->PackInfo));
return 0; return 0;
} }
if (FALSE != psSF->bValid && psSF->ucDirection) if (FALSE != psSF->bValid && psSF->ucDirection) {
{ if (0 != psSF->uiCurrentTokenCount) {
if (0 != psSF->uiCurrentTokenCount)
{
return psSF->uiCurrentTokenCount; return psSF->uiCurrentTokenCount;
} } else {
else
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "Not enough tokens in queue %zd Available %u\n", BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "Not enough tokens in queue %zd Available %u\n",
psSF-Adapter->PackInfo, psSF->uiCurrentTokenCount); psSF-Adapter->PackInfo, psSF->uiCurrentTokenCount);
psSF->uiPendedLast = 1; psSF->uiPendedLast = 1;
} }
} } else {
else
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "IPAFF: Queue %zd not valid\n", psSF-Adapter->PackInfo); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "IPAFF: Queue %zd not valid\n", psSF-Adapter->PackInfo);
} }
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "IsPacketAllowedForFlow <==="); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "IsPacketAllowedForFlow <===");
...@@ -122,23 +110,19 @@ static INT SendPacketFromQueue(struct bcm_mini_adapter *Adapter,/**<Logical Adap ...@@ -122,23 +110,19 @@ static INT SendPacketFromQueue(struct bcm_mini_adapter *Adapter,/**<Logical Adap
UINT uiIndex = 0, PktLen = 0; UINT uiIndex = 0, PktLen = 0;
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, SEND_QUEUE, DBG_LVL_ALL, "=====>"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, SEND_QUEUE, DBG_LVL_ALL, "=====>");
if (!Adapter || !Packet || !psSF) if (!Adapter || !Packet || !psSF) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, SEND_QUEUE, DBG_LVL_ALL, "Got NULL Adapter or Packet"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, SEND_QUEUE, DBG_LVL_ALL, "Got NULL Adapter or Packet");
return -EINVAL; return -EINVAL;
} }
if (psSF->liDrainCalculated == 0) if (psSF->liDrainCalculated == 0)
{
psSF->liDrainCalculated = jiffies; psSF->liDrainCalculated = jiffies;
}
///send the packet to the fifo.. ///send the packet to the fifo..
PktLen = Packet->len; PktLen = Packet->len;
Status = SetupNextSend(Adapter, Packet, psSF->usVCID_Value); Status = SetupNextSend(Adapter, Packet, psSF->usVCID_Value);
if (Status == 0) if (Status == 0) {
{ for (uiIndex = 0; uiIndex < MIBS_MAX_HIST_ENTRIES; uiIndex++) {
for (uiIndex = 0; uiIndex < MIBS_MAX_HIST_ENTRIES; uiIndex++) if ((PktLen <= MIBS_PKTSIZEHIST_RANGE*(uiIndex+1)) && (PktLen > MIBS_PKTSIZEHIST_RANGE*(uiIndex)))
{ if ((PktLen <= MIBS_PKTSIZEHIST_RANGE*(uiIndex+1)) && (PktLen > MIBS_PKTSIZEHIST_RANGE*(uiIndex)))
Adapter->aTxPktSizeHist[uiIndex]++; Adapter->aTxPktSizeHist[uiIndex]++;
} }
} }
...@@ -167,8 +151,7 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct ...@@ -167,8 +151,7 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "%zd ====>", (psSF-Adapter->PackInfo)); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "%zd ====>", (psSF-Adapter->PackInfo));
if ((psSF != &Adapter->PackInfo[HiPriority]) && Adapter->LinkUpStatus && atomic_read(&psSF->uiPerSFTxResourceCount))//Get data packet if ((psSF != &Adapter->PackInfo[HiPriority]) && Adapter->LinkUpStatus && atomic_read(&psSF->uiPerSFTxResourceCount)) { //Get data packet
{
if (!psSF->ucDirection) if (!psSF->ucDirection)
return; return;
...@@ -177,8 +160,7 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct ...@@ -177,8 +160,7 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct
return; /* in idle mode */ return; /* in idle mode */
// Check for Free Descriptors // Check for Free Descriptors
if (atomic_read(&Adapter->CurrNumFreeTxDesc) <= MINIMUM_PENDING_DESCRIPTORS) if (atomic_read(&Adapter->CurrNumFreeTxDesc) <= MINIMUM_PENDING_DESCRIPTORS) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, " No Free Tx Descriptor(%d) is available for Data pkt..", atomic_read(&Adapter->CurrNumFreeTxDesc)); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, " No Free Tx Descriptor(%d) is available for Data pkt..", atomic_read(&Adapter->CurrNumFreeTxDesc));
return; return;
} }
...@@ -186,8 +168,7 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct ...@@ -186,8 +168,7 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct
spin_lock_bh(&psSF->SFQueueLock); spin_lock_bh(&psSF->SFQueueLock);
QueuePacket = psSF->FirstTxQueue; QueuePacket = psSF->FirstTxQueue;
if (QueuePacket) if (QueuePacket) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Dequeuing Data Packet"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Dequeuing Data Packet");
if (psSF->bEthCSSupport) if (psSF->bEthCSSupport)
...@@ -196,8 +177,7 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct ...@@ -196,8 +177,7 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct
iPacketLen = QueuePacket->len-ETH_HLEN; iPacketLen = QueuePacket->len-ETH_HLEN;
iPacketLen <<= 3; iPacketLen <<= 3;
if (iPacketLen <= GetSFTokenCount(Adapter, psSF)) if (iPacketLen <= GetSFTokenCount(Adapter, psSF)) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Allowed bytes %d", BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Allowed bytes %d",
(iPacketLen >> 3)); (iPacketLen >> 3));
...@@ -209,9 +189,7 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct ...@@ -209,9 +189,7 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct
Status = SendPacketFromQueue(Adapter, psSF, QueuePacket); Status = SendPacketFromQueue(Adapter, psSF, QueuePacket);
psSF->uiPendedLast = FALSE; psSF->uiPendedLast = FALSE;
} } else {
else
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "For Queue: %zd\n", psSF-Adapter->PackInfo); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "For Queue: %zd\n", psSF-Adapter->PackInfo);
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "\nAvailable Tokens = %d required = %d\n", BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "\nAvailable Tokens = %d required = %d\n",
psSF->uiCurrentTokenCount, iPacketLen); psSF->uiCurrentTokenCount, iPacketLen);
...@@ -221,28 +199,20 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct ...@@ -221,28 +199,20 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct
psSF->uiPendedLast = TRUE; psSF->uiPendedLast = TRUE;
spin_unlock_bh(&psSF->SFQueueLock); spin_unlock_bh(&psSF->SFQueueLock);
} }
} } else {
else
{
spin_unlock_bh(&psSF->SFQueueLock); spin_unlock_bh(&psSF->SFQueueLock);
} }
} } else {
else
{
if ((atomic_read(&Adapter->CurrNumFreeTxDesc) > 0) && if ((atomic_read(&Adapter->CurrNumFreeTxDesc) > 0) &&
(atomic_read(&Adapter->index_rd_txcntrlpkt) != (atomic_read(&Adapter->index_rd_txcntrlpkt) !=
atomic_read(&Adapter->index_wr_txcntrlpkt)) atomic_read(&Adapter->index_wr_txcntrlpkt))) {
)
{
pControlPacket = Adapter->txctlpacket pControlPacket = Adapter->txctlpacket
[(atomic_read(&Adapter->index_rd_txcntrlpkt)%MAX_CNTRL_PKTS)]; [(atomic_read(&Adapter->index_rd_txcntrlpkt)%MAX_CNTRL_PKTS)];
if (pControlPacket) if (pControlPacket) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Sending Control packet"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Sending Control packet");
Status = SendControlPacket(Adapter, pControlPacket); Status = SendControlPacket(Adapter, pControlPacket);
if (STATUS_SUCCESS == Status) if (STATUS_SUCCESS == Status) {
{
spin_lock_bh(&psSF->SFQueueLock); spin_lock_bh(&psSF->SFQueueLock);
psSF->NumOfPacketsSent++; psSF->NumOfPacketsSent++;
psSF->uiSentBytes += ((struct bcm_leader *)pControlPacket)->PLength; psSF->uiSentBytes += ((struct bcm_leader *)pControlPacket)->PLength;
...@@ -252,12 +222,10 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct ...@@ -252,12 +222,10 @@ static VOID CheckAndSendPacketFromIndex(struct bcm_mini_adapter *Adapter, struct
psSF->uiCurrentPacketsOnHost--; psSF->uiCurrentPacketsOnHost--;
atomic_inc(&Adapter->index_rd_txcntrlpkt); atomic_inc(&Adapter->index_rd_txcntrlpkt);
spin_unlock_bh(&psSF->SFQueueLock); spin_unlock_bh(&psSF->SFQueueLock);
} } else {
else
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "SendControlPacket Failed\n"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "SendControlPacket Failed\n");
} }
else } else {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, " Control Pkt is not available, Indexing is wrong...."); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, " Control Pkt is not available, Indexing is wrong....");
} }
} }
...@@ -284,13 +252,11 @@ VOID transmit_packets(struct bcm_mini_adapter *Adapter) ...@@ -284,13 +252,11 @@ VOID transmit_packets(struct bcm_mini_adapter *Adapter)
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "=====>"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "=====>");
if (NULL == Adapter) if (NULL == Adapter) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Got NULL Adapter"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Got NULL Adapter");
return; return;
} }
if (Adapter->device_removed == TRUE) if (Adapter->device_removed == TRUE) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Device removed"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Device removed");
return; return;
} }
...@@ -305,34 +271,29 @@ VOID transmit_packets(struct bcm_mini_adapter *Adapter) ...@@ -305,34 +271,29 @@ VOID transmit_packets(struct bcm_mini_adapter *Adapter)
uiPrevTotalCount = atomic_read(&Adapter->TotalPacketCount); uiPrevTotalCount = atomic_read(&Adapter->TotalPacketCount);
for (iIndex = HiPriority; iIndex >= 0; iIndex--) for (iIndex = HiPriority; iIndex >= 0; iIndex--) {
{
if (!uiPrevTotalCount || (TRUE == Adapter->device_removed)) if (!uiPrevTotalCount || (TRUE == Adapter->device_removed))
break; break;
if (Adapter->PackInfo[iIndex].bValid && if (Adapter->PackInfo[iIndex].bValid &&
Adapter->PackInfo[iIndex].uiPendedLast && Adapter->PackInfo[iIndex].uiPendedLast &&
Adapter->PackInfo[iIndex].uiCurrentBytesOnHost) Adapter->PackInfo[iIndex].uiCurrentBytesOnHost) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Calling CheckAndSendPacketFromIndex.."); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Calling CheckAndSendPacketFromIndex..");
CheckAndSendPacketFromIndex(Adapter, &Adapter->PackInfo[iIndex]); CheckAndSendPacketFromIndex(Adapter, &Adapter->PackInfo[iIndex]);
uiPrevTotalCount--; uiPrevTotalCount--;
} }
} }
while (uiPrevTotalCount > 0 && !Adapter->device_removed) while (uiPrevTotalCount > 0 && !Adapter->device_removed) {
{
exit_flag = TRUE; exit_flag = TRUE;
//second iteration to parse non-pending queues //second iteration to parse non-pending queues
for (iIndex = HiPriority; iIndex >= 0; iIndex--) for (iIndex = HiPriority; iIndex >= 0; iIndex--) {
{
if (!uiPrevTotalCount || (TRUE == Adapter->device_removed)) if (!uiPrevTotalCount || (TRUE == Adapter->device_removed))
break; break;
if (Adapter->PackInfo[iIndex].bValid && if (Adapter->PackInfo[iIndex].bValid &&
Adapter->PackInfo[iIndex].uiCurrentBytesOnHost && Adapter->PackInfo[iIndex].uiCurrentBytesOnHost &&
!Adapter->PackInfo[iIndex].uiPendedLast) !Adapter->PackInfo[iIndex].uiPendedLast) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Calling CheckAndSendPacketFromIndex.."); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "Calling CheckAndSendPacketFromIndex..");
CheckAndSendPacketFromIndex(Adapter, &Adapter->PackInfo[iIndex]); CheckAndSendPacketFromIndex(Adapter, &Adapter->PackInfo[iIndex]);
uiPrevTotalCount--; uiPrevTotalCount--;
...@@ -340,8 +301,7 @@ VOID transmit_packets(struct bcm_mini_adapter *Adapter) ...@@ -340,8 +301,7 @@ VOID transmit_packets(struct bcm_mini_adapter *Adapter)
} }
} }
if (Adapter->IdleMode || Adapter->bPreparingForLowPowerMode) if (Adapter->IdleMode || Adapter->bPreparingForLowPowerMode) {
{
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "In Idle Mode\n"); BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "In Idle Mode\n");
break; break;
} }
......
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