staging: et131x: Fix stats->rx_packets accounting
authorMark Einon <mark.einon@gmail.com>
Sun, 3 Jul 2011 17:08:22 +0000 (18:08 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Jul 2011 02:54:58 +0000 (19:54 -0700)
The net_device_stats->rx_packets counter is not getting updated.
This is due to checking a fMP_ADAPTER_LINK_DETECTION flag prior to
updating which is never set.

Solved by using netif_carrier_ok() to test for a link, and removing
the fMP_ADAPTER_LINK_DETECTION flag, which looks to be a broken
mechanism.

Signed-off-by: Mark Einon <mark.einon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/et131x/et1310_phy.c
drivers/staging/et131x/et1310_rx.c
drivers/staging/et131x/et131x_defs.h
drivers/staging/et131x/et131x_initpci.c
drivers/staging/et131x/et131x_netdev.c

index 2be262953beb0e641d9a50000d7070469e322e4f..67e90e5e300f1847d07d2ee922d6955218579ff1 100644 (file)
@@ -750,7 +750,6 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
                        spin_lock_irqsave(&etdev->Lock, flags);
 
                        etdev->MediaState = NETIF_STATUS_MEDIA_CONNECT;
-                       etdev->Flags &= ~fMP_ADAPTER_LINK_DETECTION;
 
                        spin_unlock_irqrestore(&etdev->Lock, flags);
 
@@ -780,8 +779,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev,
                         * Timer expires, we can report disconnected (handled
                         * in the LinkDetectionDPC).
                         */
-                       if (!(etdev->Flags & fMP_ADAPTER_LINK_DETECTION) ||
-                        (etdev->MediaState == NETIF_STATUS_MEDIA_DISCONNECT)) {
+                       if ((etdev->MediaState == NETIF_STATUS_MEDIA_DISCONNECT)) {
                                spin_lock_irqsave(&etdev->Lock, flags);
                                etdev->MediaState =
                                    NETIF_STATUS_MEDIA_DISCONNECT;
index 100ee9b4e43f82ec99b7838ef962e15f673ba936..6c0a64bdd593c0547cbcfd44f24ecb14d65847c0 100644 (file)
@@ -1126,10 +1126,9 @@ void et131x_handle_recv_interrupt(struct et131x_adapter *etdev)
                 * Free buffer ring.
                 */
                if (!etdev->PacketFilter ||
-                   !(etdev->Flags & fMP_ADAPTER_LINK_DETECTION) ||
-                   rfd->len == 0) {
+                   !netif_carrier_ok(etdev->netdev) ||
+                   rfd->len == 0)
                        continue;
-               }
 
                /* Increment the number of packets we received */
                etdev->stats.ipackets++;
index d81fc77a501fc1840253174f20316871ad71cf3d..3d5193fdb0036407bd5a742c688afc32e10b97b9 100644 (file)
@@ -95,7 +95,6 @@
 #define fMP_ADAPTER_HARDWARE_ERROR     0x04000000
 #define fMP_ADAPTER_REMOVE_IN_PROGRESS 0x08000000
 #define fMP_ADAPTER_HALT_IN_PROGRESS   0x10000000
-#define fMP_ADAPTER_LINK_DETECTION     0x20000000
 
 #define fMP_ADAPTER_FAIL_SEND_MASK     0x3ff00000
 #define fMP_ADAPTER_NOT_READY_MASK     0x3ff00000
index 1dd2e5e9309d4d6f3cb15bac4900c0f2bf5d8eb5..a9d25213d4592ac9fb3f7a6bc39c35dcb55c8bc0 100644 (file)
@@ -312,7 +312,6 @@ void et131x_link_detection_handler(unsigned long data)
                spin_lock_irqsave(&etdev->Lock, flags);
 
                etdev->MediaState = NETIF_STATUS_MEDIA_DISCONNECT;
-               etdev->Flags &= ~fMP_ADAPTER_LINK_DETECTION;
 
                spin_unlock_irqrestore(&etdev->Lock, flags);
 
index 2da582867eaddcc47e407893c65cff82babc61a6..c890d095730afa19a5b7a78307ac0cf372688027 100644 (file)
@@ -450,10 +450,6 @@ void et131x_tx_timeout(struct net_device *netdev)
        struct tcb *tcb;
        unsigned long flags;
 
-       /* Just skip this part if the adapter is doing link detection */
-       if (etdev->Flags & fMP_ADAPTER_LINK_DETECTION)
-               return;
-
        /* Any nonrecoverable hardware error?
         * Checks adapter->flags for any failure in phy reading
         */