staging: vt6656: s_uCalculateLinkQual use netstats rx values
authorMalcolm Priestley <tvboxspy@gmail.com>
Mon, 9 Dec 2013 22:28:24 +0000 (22:28 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Dec 2013 07:14:26 +0000 (23:14 -0800)
Use netstats rx_packets and rx_frame_errors.

Add frame errors to RXbBulkInProcessData

The current scStatistic.RxFcsErrCnt only records
USB errors not frame errors.

The scStatistic.RxOkCnt only recorded successful USB
transfers not actual successfully received packets.

So a more accurate reading is to use netstats rx_packets and
rx_frame_errors.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/bssdb.c
drivers/staging/vt6656/dpc.c

index 4c32b12f5e6637bb790e2e4c11a5da7c07fd8c41..a0655a9e9fe5f3301518ff024548f253cd09208b 100644 (file)
@@ -1393,13 +1393,12 @@ static void s_uCalculateLinkQual(struct vnt_private *pDevice)
 
        TxCnt = stats->tx_packets + pDevice->wstats.discard.retries;
 
-       RxCnt = pDevice->scStatistic.RxFcsErrCnt +
-             pDevice->scStatistic.RxOkCnt;
+       RxCnt = stats->rx_packets + stats->rx_frame_errors;
 
        TxOkRatio = (TxCnt < 6) ? 4000:((stats->tx_packets * 4000) / TxCnt);
 
        RxOkRatio = (RxCnt < 6) ? 2000 :
-                               ((pDevice->scStatistic.RxOkCnt * 2000) / RxCnt);
+                               ((stats->rx_packets * 2000) / RxCnt);
 
        /* decide link quality */
        if (pDevice->bLinkPass != true) {
index 2bed31b741c082425462e7699198e81503570409..84901c1e3b59a79aef595509bbdec444185a4549 100644 (file)
@@ -291,12 +291,14 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, struct vnt_rcb *pRCB,
 
        if (BytesToIndicate != FrameSize) {
                DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"------- WRONG Length 1\n");
+               pStats->rx_frame_errors++;
                return false;
        }
 
     if ((BytesToIndicate > 2372) || (BytesToIndicate <= 40)) {
         // Frame Size error drop this packet.
        DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- WRONG Length 2\n");
+       pStats->rx_frame_errors++;
         return false;
     }
 
@@ -314,6 +316,7 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, struct vnt_rcb *pRCB,
          (BytesToIndicate < (*pwPLCP_Length)) ) {
 
         DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Wrong PLCP Length %x\n", (int) *pwPLCP_Length);
+       pStats->rx_frame_errors++;
         return false;
     }
     for ( ii=RATE_1M;ii<MAX_RATE;ii++) {