]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/staging/bcm/LeakyBucket.c
Merge tag 'v2.6.38' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[mv-sheeva.git] / drivers / staging / bcm / LeakyBucket.c
index cae382313ce91d78b22e54d18382b97a5ad25a47..f4cf41c0e46bbc51e019338c37e170bfb35d7965 100644 (file)
@@ -75,14 +75,14 @@ static VOID UpdateTokenCount(register PMINI_ADAPTER Adapter)
 * Returns     - The number of bytes allowed for transmission.
 *
 ***********************************************************************/
-static __inline ULONG GetSFTokenCount(PMINI_ADAPTER Adapter, PacketInfo *psSF)
+static ULONG GetSFTokenCount(PMINI_ADAPTER Adapter, PacketInfo *psSF)
 {
        BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "IsPacketAllowedForFlow ===>");
        /* Validate the parameters */
        if(NULL == Adapter || (psSF < Adapter->PackInfo &&
                (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: %ld\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;
        }
 
@@ -94,51 +94,27 @@ static __inline ULONG GetSFTokenCount(PMINI_ADAPTER Adapter, PacketInfo *psSF)
                }
                else
                {
-                       BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "Not enough tokens in queue %ld 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->uiPendedLast = 1;
                }
        }
        else
        {
-               BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TOKEN_COUNTS, DBG_LVL_ALL, "IPAFF: Queue %ld 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 <===");
        return 0;
 }
 
-static __inline void RemovePacketFromQueue(PacketInfo *pPackInfo , struct sk_buff *Packet)
-{
-       struct sk_buff *psQueueCurrent=NULL, *psLastQueueNode=NULL;
-       psQueueCurrent = pPackInfo->FirstTxQueue;
-       while(psQueueCurrent)
-       {
-               if(Packet == psQueueCurrent)
-               {
-                       if(psQueueCurrent == pPackInfo->FirstTxQueue)
-                       {
-                               pPackInfo->FirstTxQueue=psQueueCurrent->next;
-                               if(psQueueCurrent==pPackInfo->LastTxQueue)
-                                       pPackInfo->LastTxQueue=NULL;
-                       }
-                       else
-                       {
-                               psLastQueueNode->next=psQueueCurrent->next;
-                       }
-                       break;
-               }
-               psLastQueueNode = psQueueCurrent;
-               psQueueCurrent=psQueueCurrent->next;
-       }
-}
 /**
 @ingroup tx_functions
 This function despatches packet from the specified queue.
 @return Zero(success) or Negative value(failure)
 */
-static __inline INT SendPacketFromQueue(PMINI_ADAPTER Adapter,/**<Logical Adapter*/
-                                                               PacketInfo *psSF,               /**<Queue identifier*/
-                                                               struct sk_buff*  Packet)        /**<Pointer to the packet to be sent*/
+static INT SendPacketFromQueue(PMINI_ADAPTER Adapter,/**<Logical Adapter*/
+                              PacketInfo *psSF,                /**<Queue identifier*/
+                              struct sk_buff*  Packet) /**<Pointer to the packet to be sent*/
 {
        INT     Status=STATUS_FAILURE;
        UINT uiIndex =0,PktLen = 0;
@@ -180,8 +156,7 @@ static __inline INT SendPacketFromQueue(PMINI_ADAPTER Adapter,/**<Logical Adapte
 * Returns     - None.
 *
 ****************************************************************************/
-static __inline VOID CheckAndSendPacketFromIndex
-(PMINI_ADAPTER Adapter, PacketInfo *psSF)
+static VOID CheckAndSendPacketFromIndex(PMINI_ADAPTER Adapter, PacketInfo *psSF)
 {
        struct sk_buff  *QueuePacket=NULL;
        char                    *pControlPacket = NULL;
@@ -189,7 +164,7 @@ static __inline VOID CheckAndSendPacketFromIndex
        int                             iPacketLen=0;
 
 
-       BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "%ld ====>", (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->ucDirection )
@@ -197,10 +172,8 @@ static __inline VOID CheckAndSendPacketFromIndex
 
                BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "UpdateTokenCount ");
                if(Adapter->IdleMode || Adapter->bPreparingForLowPowerMode)
-               {
-                       BCM_DEBUG_PRINT(Adapter,DBG_TYPE_PRINTK, 0, 0,"Device is in Idle Mode..Hence blocking Data Packets..\n");
-                       return;
-               }
+                       return; /* in idle mode */
+
                // Check for Free Descriptors
                if(atomic_read(&Adapter->CurrNumFreeTxDesc) <= MINIMUM_PENDING_DESCRIPTORS)
                {
@@ -208,9 +181,6 @@ static __inline VOID CheckAndSendPacketFromIndex
                        return ;
                }
 
-#if 0
-               PruneQueue(Adapter,(psSF-Adapter->PackInfo));
-#endif
                spin_lock_bh(&psSF->SFQueueLock);
                QueuePacket=psSF->FirstTxQueue;
 
@@ -240,7 +210,7 @@ static __inline VOID CheckAndSendPacketFromIndex
                        }
                        else
                        {
-                               BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "For Queue: %ld\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",
                                        psSF->uiCurrentTokenCount, iPacketLen);
                                //this part indicates that becuase of non-availability of the tokens
@@ -290,17 +260,6 @@ static __inline VOID CheckAndSendPacketFromIndex
                        }
                }
        }
-
-       if(Status != STATUS_SUCCESS)    //Tx of data packet to device Failed
-       {
-               if(Adapter->bcm_jiffies == 0)
-                       Adapter->bcm_jiffies = jiffies;
-       }
-       else
-       {
-               Adapter->bcm_jiffies = 0;
-       }
-       BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "<=====");
 }
 
 
@@ -387,12 +346,7 @@ VOID transmit_packets(PMINI_ADAPTER Adapter)
                if(exit_flag == TRUE )
                    break ;
        }/* end of inner while loop */
-       if(Adapter->bcm_jiffies == 0 &&
-               atomic_read(&Adapter->TotalPacketCount) != 0 &&
-               uiPrevTotalCount == atomic_read(&Adapter->TotalPacketCount))
-       {
-               Adapter->bcm_jiffies = jiffies;
-       }
+
        update_per_cid_rx  (Adapter);
        Adapter->txtransmit_running = 0;
        BCM_DEBUG_PRINT(Adapter,DBG_TYPE_TX, TX_PACKETS, DBG_LVL_ALL, "<======");