[PATCH] ixgb: Fix multi-cast packet count in statistics
authorMalli Chilakala <mallikarjuna.chilakala@intel.com>
Fri, 29 Apr 2005 01:45:50 +0000 (18:45 -0700)
committerJeff Garzik <jgarzik@pobox.com>
Fri, 13 May 2005 00:54:41 +0000 (20:54 -0400)
Fix multi-cast packet count in statistics

Signed-off-by: Mallikarjuna R Chilakala <mallikarjuna.chilakala@intel.com>
Signed-off-by: Ganesh Venkatesan <ganesh.venkatesan@intel.com>
Signed-off-by: John Ronciak <john.ronciak@intel.com>
diff -up net-drivers-2.6/drivers/net/ixgb/ixgb_main.c net-drivers-2.6/drivers/net/ixgb.new/ixgb_main.c

drivers/net/ixgb/ixgb_main.c

index 7d26623d859278bd1ad6369648de9ed41a112493..1498b4e4246676db8edca70837d959add606c5b8 100644 (file)
@@ -1526,14 +1526,33 @@ ixgb_change_mtu(struct net_device *netdev, int new_mtu)
 void
 ixgb_update_stats(struct ixgb_adapter *adapter)
 {
+       struct net_device *netdev = adapter->netdev;
+
+       if((netdev->flags & IFF_PROMISC) || (netdev->flags & IFF_ALLMULTI) ||
+          (netdev->mc_count > IXGB_MAX_NUM_MULTICAST_ADDRESSES)) {
+               u64 multi = IXGB_READ_REG(&adapter->hw, MPRCL);
+               u32 bcast_l = IXGB_READ_REG(&adapter->hw, BPRCL);
+               u32 bcast_h = IXGB_READ_REG(&adapter->hw, BPRCH);
+               u64 bcast = ((u64)bcast_h << 32) | bcast_l; 
+
+               multi |= ((u64)IXGB_READ_REG(&adapter->hw, MPRCH) << 32);
+               /* fix up multicast stats by removing broadcasts */
+               multi -= bcast;
+               
+               adapter->stats.mprcl += (multi & 0xFFFFFFFF);
+               adapter->stats.mprch += (multi >> 32);
+               adapter->stats.bprcl += bcast_l; 
+               adapter->stats.bprch += bcast_h;
+       } else {
+               adapter->stats.mprcl += IXGB_READ_REG(&adapter->hw, MPRCL);
+               adapter->stats.mprch += IXGB_READ_REG(&adapter->hw, MPRCH);
+               adapter->stats.bprcl += IXGB_READ_REG(&adapter->hw, BPRCL);
+               adapter->stats.bprch += IXGB_READ_REG(&adapter->hw, BPRCH);
+       }
        adapter->stats.tprl += IXGB_READ_REG(&adapter->hw, TPRL);
        adapter->stats.tprh += IXGB_READ_REG(&adapter->hw, TPRH);
        adapter->stats.gprcl += IXGB_READ_REG(&adapter->hw, GPRCL);
        adapter->stats.gprch += IXGB_READ_REG(&adapter->hw, GPRCH);
-       adapter->stats.bprcl += IXGB_READ_REG(&adapter->hw, BPRCL);
-       adapter->stats.bprch += IXGB_READ_REG(&adapter->hw, BPRCH);
-       adapter->stats.mprcl += IXGB_READ_REG(&adapter->hw, MPRCL);
-       adapter->stats.mprch += IXGB_READ_REG(&adapter->hw, MPRCH);
        adapter->stats.uprcl += IXGB_READ_REG(&adapter->hw, UPRCL);
        adapter->stats.uprch += IXGB_READ_REG(&adapter->hw, UPRCH);
        adapter->stats.vprcl += IXGB_READ_REG(&adapter->hw, VPRCL);