staging: vt6656: Remove STAvUpdateTDStatCounter and apply directly to stats
authorMalcolm Priestley <tvboxspy@gmail.com>
Mon, 9 Dec 2013 22:23:19 +0000 (22:23 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Dec 2013 07:14:26 +0000 (23:14 -0800)
Apply directly to net_device_stats and wireless stats.

tx_bytes are relayed from s_vSaveTxPktInfo via scStatistic,
so collect them there.

All other statistics in STAvUpdateTDStatCounter are dead code
and don't reach user.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/int.c
drivers/staging/vt6656/iwctl.c
drivers/staging/vt6656/mib.c
drivers/staging/vt6656/mib.h
drivers/staging/vt6656/rxtx.c

index a2b4ba6..abbffa1 100644 (file)
@@ -86,10 +86,11 @@ void INTnsProcessData(struct vnt_private *pDevice)
 
        pINTData = (PSINTData) pDevice->intBuf.pDataBuf;
        if (pINTData->byTSR0 & TSR_VALID) {
-               STAvUpdateTDStatCounter(&(pDevice->scStatistic),
-                                       (u8)(pINTData->byPkt0 & 0x0F),
-                                       (u8)(pINTData->byPkt0>>4),
-                                       pINTData->byTSR0);
+               if (pINTData->byTSR0 & (TSR_TMO | TSR_RETRYTMO))
+                       pDevice->wstats.discard.retries++;
+               else
+                       pStats->tx_packets++;
+
                BSSvUpdateNodeTxCounter(pDevice,
                                        &(pDevice->scStatistic),
                                        pINTData->byTSR0,
@@ -97,10 +98,12 @@ void INTnsProcessData(struct vnt_private *pDevice)
                /*DBG_PRN_GRP01(("TSR0 %02x\n", pINTData->byTSR0));*/
        }
        if (pINTData->byTSR1 & TSR_VALID) {
-               STAvUpdateTDStatCounter(&(pDevice->scStatistic),
-                                       (u8)(pINTData->byPkt1 & 0x0F),
-                                       (u8)(pINTData->byPkt1>>4),
-                                       pINTData->byTSR1);
+               if (pINTData->byTSR1 & (TSR_TMO | TSR_RETRYTMO))
+                       pDevice->wstats.discard.retries++;
+               else
+                       pStats->tx_packets++;
+
+
                BSSvUpdateNodeTxCounter(pDevice,
                                        &(pDevice->scStatistic),
                                        pINTData->byTSR1,
@@ -108,10 +111,11 @@ void INTnsProcessData(struct vnt_private *pDevice)
                /*DBG_PRN_GRP01(("TSR1 %02x\n", pINTData->byTSR1));*/
        }
        if (pINTData->byTSR2 & TSR_VALID) {
-               STAvUpdateTDStatCounter(&(pDevice->scStatistic),
-                                       (u8)(pINTData->byPkt2 & 0x0F),
-                                       (u8)(pINTData->byPkt2>>4),
-                                       pINTData->byTSR2);
+               if (pINTData->byTSR2 & (TSR_TMO | TSR_RETRYTMO))
+                       pDevice->wstats.discard.retries++;
+               else
+                       pStats->tx_packets++;
+
                BSSvUpdateNodeTxCounter(pDevice,
                                        &(pDevice->scStatistic),
                                        pINTData->byTSR2,
@@ -119,10 +123,11 @@ void INTnsProcessData(struct vnt_private *pDevice)
                /*DBG_PRN_GRP01(("TSR2 %02x\n", pINTData->byTSR2));*/
        }
        if (pINTData->byTSR3 & TSR_VALID) {
-               STAvUpdateTDStatCounter(&(pDevice->scStatistic),
-                                       (u8)(pINTData->byPkt3 & 0x0F),
-                                       (u8)(pINTData->byPkt3>>4),
-                                       pINTData->byTSR3);
+               if (pINTData->byTSR3 & (TSR_TMO | TSR_RETRYTMO))
+                       pDevice->wstats.discard.retries++;
+               else
+                       pStats->tx_packets++;
+
                BSSvUpdateNodeTxCounter(pDevice,
                                        &(pDevice->scStatistic),
                                        pINTData->byTSR3,
@@ -193,10 +198,6 @@ void INTnsProcessData(struct vnt_private *pDevice)
        pDevice->intBuf.uDataLen = 0;
        pDevice->intBuf.bInUse = false;
 
-       pStats->tx_packets = pDevice->scStatistic.ullTsrOK;
-       pStats->tx_bytes = pDevice->scStatistic.ullTxDirectedBytes +
-               pDevice->scStatistic.ullTxMulticastBytes +
-               pDevice->scStatistic.ullTxBroadcastBytes;
-       pStats->tx_errors = pDevice->scStatistic.dwTsrErr;
-       pStats->tx_dropped = pDevice->scStatistic.dwTsrErr;
+       pStats->tx_errors = pDevice->wstats.discard.retries;
+       pStats->tx_dropped = pDevice->wstats.discard.retries;
 }
index 63917ab..183c5a2 100644 (file)
@@ -68,7 +68,6 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
        pDevice->wstats.discard.nwid = 0;
        pDevice->wstats.discard.code = 0;
        pDevice->wstats.discard.fragment = 0;
-       pDevice->wstats.discard.retries = pDevice->scStatistic.dwTsrErr;
        pDevice->wstats.discard.misc = 0;
        pDevice->wstats.miss.beacon = 0;
        return &pDevice->wstats;
index 12333cd..002f2b2 100644 (file)
@@ -334,95 +334,6 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
 }
 
 /*
- * Description: Update Tx Statistic Counter
- *
- * Parameters:
- *  In:
- *      pStatistic      - Pointer to Statistic Counter Data Structure
- *      byTSR0          - Tx Status
- *      byTSR1          - Tx Status
- *      pbyBuffer       - Tx Buffer
- *      cbFrameLength   - Tx Length
- *      uIdx            - Index of Tx DMA
- *  Out:
- *      none
- *
- * Return Value: none
- *
- */
-void
-STAvUpdateTDStatCounter (
-    PSStatCounter   pStatistic,
-    u8            byPktNum,
-    u8            byRate,
-    u8            byTSR
-    )
-{
-    u8    byRetyCnt;
-    // increase tx packet count
-    pStatistic->dwTsrTxPacket++;
-
-    byRetyCnt = (byTSR & 0xF0) >> 4;
-    if (byRetyCnt != 0) {
-        pStatistic->dwTsrRetry++;
-        pStatistic->dwTsrTotalRetry += byRetyCnt;
-        pStatistic->dwTxFail[byRate]+= byRetyCnt;
-        pStatistic->dwTxFail[MAX_RATE] += byRetyCnt;
-
-        if ( byRetyCnt == 0x1)
-            pStatistic->dwTsrOnceRetry++;
-        else
-            pStatistic->dwTsrMoreThanOnceRetry++;
-
-        if (byRetyCnt <= 8)
-            pStatistic->dwTxRetryCount[byRetyCnt-1]++;
-
-    }
-    if ( !(byTSR & (TSR_TMO | TSR_RETRYTMO))) {
-
-   if (byRetyCnt < 2)
-        pStatistic->TxNoRetryOkCount ++;
-   else
-        pStatistic->TxRetryOkCount ++;
-
-        pStatistic->ullTsrOK++;
-        pStatistic->CustomStat.ullTsrAllOK++;
-        // update counters in case that successful transmit
-        pStatistic->dwTxOk[byRate]++;
-        pStatistic->dwTxOk[MAX_RATE]++;
-
-        if ( pStatistic->abyTxPktInfo[byPktNum].byBroadMultiUni == TX_PKT_BROAD )  {
-            pStatistic->ullTxBroadcastFrames++;
-            pStatistic->ullTxBroadcastBytes += pStatistic->abyTxPktInfo[byPktNum].wLength;
-        } else if ( pStatistic->abyTxPktInfo[byPktNum].byBroadMultiUni == TX_PKT_MULTI ) {
-            pStatistic->ullTxMulticastFrames++;
-            pStatistic->ullTxMulticastBytes += pStatistic->abyTxPktInfo[byPktNum].wLength;
-        } else if ( pStatistic->abyTxPktInfo[byPktNum].byBroadMultiUni == TX_PKT_UNI ) {
-            pStatistic->ullTxDirectedFrames++;
-            pStatistic->ullTxDirectedBytes += pStatistic->abyTxPktInfo[byPktNum].wLength;
-        }
-    }
-    else {
-
-        pStatistic->TxFailCount ++;
-
-        pStatistic->dwTsrErr++;
-        if (byTSR & TSR_RETRYTMO)
-            pStatistic->dwTsrRetryTimeout++;
-        if (byTSR & TSR_TMO)
-            pStatistic->dwTsrTransmitTimeout++;
-    }
-
-    if ( pStatistic->abyTxPktInfo[byPktNum].byBroadMultiUni == TX_PKT_BROAD )  {
-        pStatistic->dwTsrBroadcast++;
-    } else if ( pStatistic->abyTxPktInfo[byPktNum].byBroadMultiUni == TX_PKT_MULTI ) {
-        pStatistic->dwTsrMulticast++;
-    } else if ( pStatistic->abyTxPktInfo[byPktNum].byBroadMultiUni == TX_PKT_UNI ) {
-        pStatistic->dwTsrDirected++;
-    }
-}
-
-/*
  * Description: Update 802.11 mib counter
  *
  * Parameters:
index 3537532..5616b9a 100644 (file)
@@ -360,9 +360,6 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
                             u8 byRxRate, u8 * pbyBuffer,
                             unsigned int cbFrameLength);
 
-void STAvUpdateTDStatCounter(PSStatCounter pStatistic, u8 byPktNum,
-                            u8 byRate, u8 byTSR);
-
 void
 STAvUpdate802_11Counter(
     PSDot11Counters         p802_11Counter,
index 2db03d6..06290be 100644 (file)
@@ -166,6 +166,7 @@ static struct vnt_usb_send_context
 static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum,
        u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl)
 {
+       struct net_device_stats *stats = &pDevice->stats;
        PSStatCounter pStatistic = &pDevice->scStatistic;
 
     if (is_broadcast_ether_addr(pbyDestAddr))
@@ -180,6 +181,8 @@ static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum,
     memcpy(pStatistic->abyTxPktInfo[byPktNum].abyDestAddr,
           pbyDestAddr,
           ETH_ALEN);
+
+       stats->tx_bytes += wPktLength;
 }
 
 static void s_vFillTxKey(struct vnt_private *pDevice,