]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
beceem: statistics and transmit queue changes
authorStephen Hemminger <stephen.hemminger@vyatta.com>
Mon, 1 Nov 2010 17:34:35 +0000 (13:34 -0400)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Mon, 1 Nov 2010 17:53:30 +0000 (13:53 -0400)
Use standard network statistics variables and routines.
Transmit counters are per queue, and skb mapping is already in
skb and does not need to be recomputed. Move SearchVcId to only
place it is used.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
drivers/staging/bcm/Adapter.h
drivers/staging/bcm/Bcmnet.c
drivers/staging/bcm/CmHost.c
drivers/staging/bcm/InterfaceRx.c
drivers/staging/bcm/Misc.c
drivers/staging/bcm/Prototypes.h
drivers/staging/bcm/Qos.c
drivers/staging/bcm/Transmit.c
drivers/staging/bcm/hostmibs.c
drivers/staging/bcm/led_control.c

index e5aaec508bf9d66e46212a6d0e47f6ca82b3743e..5e97cbeb58ec6b87b108009baff58aa02e1a6b43 100644 (file)
@@ -414,17 +414,8 @@ struct _MINI_ADAPTER
        // this to keep track of the Tx and Rx MailBox Registers.
        atomic_t                    CurrNumFreeTxDesc;
        // to keep track the no of byte recieved
-       atomic_t                        RxRollOverCount;
        USHORT                          PrevNumRecvDescs;
        USHORT                          CurrNumRecvDescs;
-       atomic_t                        GoodRxByteCount;
-       atomic_t                        GoodRxPktCount;
-       atomic_t                        BadRxByteCount;
-       atomic_t                        RxPacketDroppedCount;
-       atomic_t                        GoodTxByteCount;
-       atomic_t                        TxTotalPacketCount;
-       atomic_t                        TxDroppedPacketCount;
-
        UINT                            u32TotalDSD;
        PacketInfo                  PackInfo[NO_OF_QUEUES];
        S_CLASSIFIER_RULE       astClassifierTable[MAX_CLASSIFIERS];
index 82270c18c6acff0fa4e35b9d762eb15f7478a99a..eb224a9dafabc13b76feadcdbe1e2f953ec34a06 100644 (file)
@@ -48,25 +48,6 @@ static INT bcm_close(struct net_device *dev)
        return 0;
 }
 
-static struct net_device_stats *bcm_get_stats(struct net_device *dev)
-{
-       PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev);
-       struct net_device_stats*        netstats = &dev->stats;
-
-       netstats->rx_packets = atomic_read(&Adapter->RxRollOverCount)*64*1024
-               + Adapter->PrevNumRecvDescs;
-       netstats->rx_bytes = atomic_read(&Adapter->GoodRxByteCount)
-               + atomic_read(&Adapter->BadRxByteCount);
-
-       netstats->rx_dropped = atomic_read(&Adapter->RxPacketDroppedCount);
-       netstats->rx_errors  = atomic_read(&Adapter->RxPacketDroppedCount);
-       netstats->tx_bytes   = atomic_read(&Adapter->GoodTxByteCount);
-       netstats->tx_packets = atomic_read(&Adapter->TxTotalPacketCount);
-       netstats->tx_dropped = atomic_read(&Adapter->TxDroppedPacketCount);
-
-       return netstats;
-}
-
 static u16 bcm_select_queue(struct net_device *dev, struct sk_buff *skb)
 {
        return ClassifyPacket(netdev_priv(dev), skb);
@@ -140,7 +121,6 @@ Register other driver entry points with the kernel
 static const struct net_device_ops bcmNetDevOps = {
     .ndo_open          = bcm_open,
     .ndo_stop          = bcm_close,
-    .ndo_get_stats     = bcm_get_stats,
     .ndo_start_xmit    = bcm_transmit,
     .ndo_change_mtu    = eth_change_mtu,
     .ndo_set_mac_address = eth_mac_addr,
index 553da135c8281a9f445e2b16828e3e42eb1bb1a8..38b64e69d81a991648bf765b913195998f8d3f9e 100644 (file)
@@ -58,18 +58,6 @@ static INT SearchFreeSfid(PMINI_ADAPTER Adapter)
        return NO_OF_QUEUES+1;
 }
 
-int SearchVcid(PMINI_ADAPTER Adapter,unsigned short usVcid)
-{
-       int iIndex=0;
-
-       for(iIndex=(NO_OF_QUEUES-1);iIndex>=0;iIndex--)
-               if(Adapter->PackInfo[iIndex].usVCID_Value == usVcid)
-                       return iIndex;
-       return NO_OF_QUEUES+1;
-
-}
-
-
 /*
 Function:                              SearchClsid
 Description:                   This routinue would search Classifier  having specified ClassifierID as input parameter
index 07326a97c4a247f96f11c3b753c677e9ddec112d..533f8ebe0f8426ff528f2ef6f1596db1b40ac494 100644 (file)
@@ -1,5 +1,15 @@
 #include "headers.h"
-extern int SearchVcid(PMINI_ADAPTER , unsigned short);
+
+static int SearchVcid(PMINI_ADAPTER Adapter,unsigned short usVcid)
+{
+       int iIndex=0;
+
+       for(iIndex=(NO_OF_QUEUES-1);iIndex>=0;iIndex--)
+               if(Adapter->PackInfo[iIndex].usVCID_Value == usVcid)
+                       return iIndex;
+       return NO_OF_QUEUES+1;
+
+}
 
 
 static PUSB_RCB
@@ -88,8 +98,7 @@ static void read_bulk_callback(struct urb *urb)
                if (netif_msg_rx_err(Adapter))
                        pr_info(PFX "%s: corrupted leader length...%d\n",
                                Adapter->dev->name, pLeader->PLength);
-               atomic_inc(&Adapter->RxPacketDroppedCount);
-               atomic_add(pLeader->PLength, &Adapter->BadRxByteCount);
+               ++Adapter->dev->stats.rx_dropped;
                atomic_dec(&psIntfAdapter->uNumRcbUsed);
                return;
        }
@@ -142,7 +151,6 @@ static void read_bulk_callback(struct urb *urb)
                skb_put (skb, pLeader->PLength + ETH_HLEN);
                Adapter->PackInfo[QueueIndex].uiTotalRxBytes+=pLeader->PLength;
                Adapter->PackInfo[QueueIndex].uiThisPeriodRxBytes+= pLeader->PLength;
-               atomic_add(pLeader->PLength, &Adapter->GoodRxByteCount);
         BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_DATA, DBG_LVL_ALL, "Recived Data pkt of len :0x%X", pLeader->PLength);
 
                if(netif_running(Adapter->dev))
@@ -172,7 +180,10 @@ static void read_bulk_callback(struct urb *urb)
                    BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_DATA, DBG_LVL_ALL, "i/f not up hance freeing SKB...");
                        dev_kfree_skb(skb);
                }
-               atomic_inc(&Adapter->GoodRxPktCount);
+
+               ++Adapter->dev->stats.rx_packets;
+               Adapter->dev->stats.rx_bytes += pLeader->PLength;
+
                for(uiIndex = 0 ; uiIndex < MIBS_MAX_HIST_ENTRIES ; uiIndex++)
                {
                        if((pLeader->PLength <= MIBS_PKTSIZEHIST_RANGE*(uiIndex+1))
index 2f849b2a1275dfcfc432830fa308f95baa801203..c1d73a70f9e4d911fef2aa93c3f26da7c7569d15 100644 (file)
@@ -1859,8 +1859,6 @@ void flush_queue(PMINI_ADAPTER Adapter, UINT iQIndex)
 
                        dev_kfree_skb(PacketToDrop);
                        atomic_dec(&Adapter->TotalPacketCount);
-                       atomic_inc(&Adapter->TxDroppedPacketCount);
-
                }
        }
        spin_unlock_bh(&Adapter->PackInfo[iQIndex].SFQueueLock);
index c27fce875be796b363c395b13e3ef8593679bea4..ba0444e7057728cf2c51b5a3c1e2abf262048f70 100644 (file)
@@ -93,8 +93,6 @@ void beceem_parse_target_struct(PMINI_ADAPTER Adapter);
 
 int bcm_ioctl_fw_download(PMINI_ADAPTER Adapter, FIRMWARE_INFO *psFwInfo);
 
-int SearchVcid(PMINI_ADAPTER Adapter,unsigned short usVcid);
-
 void CopyMIBSExtendedSFParameters(PMINI_ADAPTER Adapter,
                CServiceFlowParamSI *psfLocalSet, UINT uiSearchRuleIndex);
 
index e4d5a67c8c6b1bf507754d79101e3a47f07813a3..88ec3b20742d2058326c42b151d156dc5a176758 100644 (file)
@@ -359,12 +359,13 @@ static VOID PruneQueue(PMINI_ADAPTER Adapter, INT iIndex)
 
                if(PacketToDrop)
                {
+                       struct netdev_queue *txq = netdev_get_tx_queue(Adapter->dev, iIndex);
                        if (netif_msg_tx_err(Adapter))
                                pr_info(PFX "%s: tx queue %d overlimit\n", 
                                        Adapter->dev->name, iIndex);
 
-                       netstats->tx_dropped++;
-                       atomic_inc(&Adapter->TxDroppedPacketCount);
+                       txq->tx_dropped++;
+
                        DEQUEUEPACKET(Adapter->PackInfo[iIndex].FirstTxQueue,
                                                Adapter->PackInfo[iIndex].LastTxQueue);
                        /// update current bytes and packets count
@@ -397,14 +398,15 @@ VOID flush_all_queues(PMINI_ADAPTER Adapter)
 {
        INT             iQIndex;
        UINT    uiTotalPacketLength;
-       struct sk_buff*                         PacketToDrop=NULL;
-       struct net_device_stats*        netstats=&Adapter->dev->stats;
+       struct sk_buff*                 PacketToDrop=NULL;
 
        BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "=====>");
 
 //     down(&Adapter->data_packet_queue_lock);
        for(iQIndex=LowPriority; iQIndex<HiPriority; iQIndex++)
        {
+               struct netdev_queue *txq = netdev_get_tx_queue(Adapter->dev, iQIndex);
+
                spin_lock_bh(&Adapter->PackInfo[iQIndex].SFQueueLock);
                while(Adapter->PackInfo[iQIndex].FirstTxQueue)
                {
@@ -412,8 +414,7 @@ VOID flush_all_queues(PMINI_ADAPTER Adapter)
                        if(PacketToDrop)
                        {
                                uiTotalPacketLength = PacketToDrop->len;
-                               netstats->tx_dropped++;
-                               atomic_inc(&Adapter->TxDroppedPacketCount);
+                               txq->tx_dropped++;
                        }
                        else
                                uiTotalPacketLength = 0;
index b924a6a4dd78ca4eb68515aa0fa45c267adc60e7..972e6ab6fae6cb93b00c68f6e3078c9072e6b070 100644 (file)
@@ -90,7 +90,7 @@ INT SetupNextSend(PMINI_ADAPTER Adapter,  struct sk_buff *Packet, USHORT Vcid)
        int             status=0;
        BOOLEAN bHeaderSupressionEnabled = FALSE;
        B_UINT16            uiClassifierRuleID;
-       int QueueIndex = NO_OF_QUEUES + 1;
+       u16     QueueIndex = skb_get_queue_mapping(Packet);
        LEADER Leader={0};
 
        if(Packet->len > MAX_DEVICE_DESC_SIZE)
@@ -101,14 +101,10 @@ INT SetupNextSend(PMINI_ADAPTER Adapter,  struct sk_buff *Packet, USHORT Vcid)
 
        /* Get the Classifier Rule ID */
        uiClassifierRuleID = *((UINT32*) (Packet->cb)+SKB_CB_CLASSIFICATION_OFFSET);
-       QueueIndex = SearchVcid( Adapter,Vcid);
-       if(QueueIndex < NO_OF_QUEUES)
-       {
-               bHeaderSupressionEnabled =
-                       Adapter->PackInfo[QueueIndex].bHeaderSuppressionEnabled;
-               bHeaderSupressionEnabled =
-                       bHeaderSupressionEnabled & Adapter->bPHSEnabled;
-       }
+
+       bHeaderSupressionEnabled = Adapter->PackInfo[QueueIndex].bHeaderSuppressionEnabled
+               & Adapter->bPHSEnabled;
+
        if(Adapter->device_removed)
                {
                status = STATUS_FAILURE;
@@ -162,9 +158,12 @@ INT SetupNextSend(PMINI_ADAPTER Adapter,  struct sk_buff *Packet, USHORT Vcid)
        }
        else
        {
+               struct netdev_queue *txq = netdev_get_tx_queue(Adapter->dev, QueueIndex);
                Adapter->PackInfo[QueueIndex].uiTotalTxBytes += Leader.PLength;
-               Adapter->dev->stats.tx_bytes += Leader.PLength;
-               ++Adapter->dev->stats.tx_packets;
+
+               txq->tx_bytes += Leader.PLength;
+               ++txq->tx_packets;
+
                Adapter->PackInfo[QueueIndex].uiCurrentTokenCount -= Leader.PLength << 3;
                Adapter->PackInfo[QueueIndex].uiSentBytes += (Packet->len);
                Adapter->PackInfo[QueueIndex].uiSentPackets++;
index 144590037b2428ce1d833736cff3fa6488332013..c13ea5c9a2aa0823e7e3d0e120ff76fa15a610d6 100644 (file)
@@ -82,12 +82,9 @@ INT  ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *pstHostMi
        }
 
 
-
        //copy other Host Statistics parameters
-       pstHostMibs->stHostInfo.GoodTransmits =
-                               atomic_read(&Adapter->TxTotalPacketCount);
-       pstHostMibs->stHostInfo.GoodReceives =
-                               atomic_read(&Adapter->GoodRxPktCount);
+       pstHostMibs->stHostInfo.GoodTransmits = Adapter->dev->stats.tx_packets;
+       pstHostMibs->stHostInfo.GoodReceives = Adapter->dev->stats.rx_packets;
        pstHostMibs->stHostInfo.CurrNumFreeDesc =
                        atomic_read(&Adapter->CurrNumFreeTxDesc);
        pstHostMibs->stHostInfo.BEBucketSize = Adapter->BEBucketSize;
index a21d219f428c47654ac27eae9514da36d6a1c0df..16e939fa15d64190dfd5835a4268d25baf332c2a 100644 (file)
@@ -108,8 +108,9 @@ static INT LED_Proportional_Blink(PMINI_ADAPTER Adapter, UCHAR GPIO_Num_tx,
        ulong timeout = 0;
 
        /*Read initial value of packets sent/received */
-       Initial_num_of_packts_tx = atomic_read(&Adapter->TxTotalPacketCount);
-       Initial_num_of_packts_rx = atomic_read(&Adapter->GoodRxPktCount);
+       Initial_num_of_packts_tx = Adapter->dev->stats.tx_packets;
+       Initial_num_of_packts_rx = Adapter->dev->stats.rx_packets;
+
        /*Scale the rate of transfer to no of blinks.*/
        num_of_time_tx= ScaleRateofTransfer((ULONG)rate_of_transfer_tx);
        num_of_time_rx= ScaleRateofTransfer((ULONG)rate_of_transfer_rx);
@@ -212,9 +213,10 @@ static INT LED_Proportional_Blink(PMINI_ADAPTER Adapter, UCHAR GPIO_Num_tx,
                 * Read the Tx & Rx packets transmission after 1 second and
                 * calculate rate of transfer
                 */
-               Final_num_of_packts_tx = atomic_read(&Adapter->TxTotalPacketCount);
+               Final_num_of_packts_tx = Adapter->dev->stats.tx_packets;
+               Final_num_of_packts_rx = Adapter->dev->stats.rx_packets;
+
                rate_of_transfer_tx = Final_num_of_packts_tx - Initial_num_of_packts_tx;
-               Final_num_of_packts_rx = atomic_read(&Adapter->GoodRxPktCount);
                rate_of_transfer_rx = Final_num_of_packts_rx - Initial_num_of_packts_rx;
 
                /*Read initial value of packets sent/received */