net: use netdev stats in b44, sundance, via-rhine and via-velocity
Subsystems (2)
PATCH 1/1 net: use netdev stats in b44, sundance, via-rhine and via-velocity
Use struct net_device_stats provided in struct net_device instead of private ones.
Signed-off-by Eric Dumazet <[email protected]>
--- drivers/net/b44.c | 4 +- drivers/net/b44.h | 1 drivers/net/sundance.c | 53 ++++++++++++++++--------------- drivers/net/via-rhine.c | 58 +++++++++++++++++++---------------- drivers/net/via-velocity.c | 22 ++++++------- drivers/net/via-velocity.h | 1 6 files changed, 73 insertions(+), 66 deletions(-)
drivers/net/b44.c +2 -2
@@ -782,7 +782,7 @@ static int b44_rx(struct b44 *bp, int budget) drop_it:b44_recycle_rx (bp, cons, bp->rx_prod); drop_it_no_recycle: - bp->stats.rx_dropped++; + bp->dev->stats.rx_dropped++; goto next_pkt; }
@@ -1647,7 +1647,7 @@ static int b44_close(struct net_device *dev)static struct net_device_stats *b44_get_stats (struct net_device *dev) {struct b44 *bp =netdev_priv (dev); -struct net_device_stats *nstat = &bp->stats; +struct net_device_stats *nstat = &dev->stats;struct b44_hw_stats *hwstat = &bp->hw_stats;/* Convert HW stats into netdevice stats. */
drivers/net/b44.h +0 -1
@@ -384,7 +384,6 @@ struct b44 {struct timer_list timer; -struct net_device_stats stats;struct b44_hw_stats hw_stats;struct ssb_device *sdev;
drivers/net/sundance.c +28 -25
97 lines not on this page · raw message
drivers/net/via-rhine.c +32 -26
131 lines not on this page · raw message
drivers/net/via-velocity.c +11 -11
@@ -1385,7 +1385,7 @@ static void velocity_free_td_ring(struct velocity_info *vptr)static int velocity_rx_srv (struct velocity_info *vptr,int status) { -struct net_device_stats *stats = &vptr->stats; +struct net_device_stats *stats = &vptr->dev->stats;int rd_curr = vptr->rx.curr;int works =0 ;
@@ -1519,7 +1519,7 @@ static inline void velocity_iph_realign(struct velocity_info *vptr,static int velocity_receive_frame (struct velocity_info *vptr,int idx) {void (*pci_action)(struct pci_dev *,dma_addr_t ,size_t ,int ); -struct net_device_stats *stats = &vptr->stats; +struct net_device_stats *stats = &vptr->dev->stats;struct velocity_rd_info *rd_info = &(vptr->rx.info[idx]);struct rx_desc *rd = &(vptr->rx.ring[idx]);int pkt_len =le16_to_cpu (rd->rdesc0.len) &0x3fff ;
@@ -1532,7 +1532,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx) }if (rd->rdesc0.RSR &RSR_MAR ) - vptr->stats.multicast++; + stats->multicast++; skb = rd_info->skb;
@@ -1634,7 +1634,7 @@ static int velocity_tx_srv(struct velocity_info *vptr, u32 status)int idx;int works =0 ;struct velocity_td_info *tdinfo; -struct net_device_stats *stats = &vptr->stats; +struct net_device_stats *stats = &vptr->dev->stats;for (qnum =0 ; qnum < vptr->tx.numq; qnum++) { for (idx = vptr->tx.tail[qnum]; vptr->tx.used[qnum] > 0;
@@ -2324,22 +2324,22 @@ static struct net_device_stats *velocity_get_stats(struct net_device *dev)/* If the hardware is down, don't touch MII */ if (!netif_running (dev)) -return &vptr->stats; +return &dev->stats;spin_lock_irq (&vptr->lock);velocity_update_hw_mibs (vptr);spin_unlock_irq (&vptr->lock); - vptr->stats.rx_packets = vptr->mib_counter[HW_MIB_ifRxAllPkts]; - vptr->stats.rx_errors = vptr->mib_counter[HW_MIB_ifRxErrorPkts]; - vptr->stats.rx_length_errors = vptr->mib_counter[HW_MIB_ifInRangeLengthErrors]; + dev->stats.rx_packets = vptr->mib_counter[HW_MIB_ifRxAllPkts]; + dev->stats.rx_errors = vptr->mib_counter[HW_MIB_ifRxErrorPkts]; + dev->stats.rx_length_errors = vptr->mib_counter[HW_MIB_ifInRangeLengthErrors];// unsigned long rx_dropped; /* no space in linux buffers */ - vptr->stats.collisions = vptr->mib_counter[HW_MIB_ifTxEtherCollisions]; + dev->stats.collisions = vptr->mib_counter[HW_MIB_ifTxEtherCollisions];/* detailed rx_errors: */ // unsigned long rx_length_errors; // unsigned long rx_over_errors; /* receiver ring buff overflow */ - vptr->stats.rx_crc_errors = vptr->mib_counter[HW_MIB_ifRxPktCRCE]; + dev->stats.rx_crc_errors = vptr->mib_counter[HW_MIB_ifRxPktCRCE];// unsigned long rx_frame_errors; /* recv'd frame alignment error */ // unsigned long rx_fifo_errors; /* recv'r fifo overrun */ // unsigned long rx_missed_errors; /* receiver missed packet */
@@ -2347,7 +2347,7 @@ static struct net_device_stats *velocity_get_stats(struct net_device *dev)/* detailed tx_errors */ // unsigned long tx_fifo_errors; -return &vptr->stats; +return &dev->stats; }
drivers/net/via-velocity.h +0 -1
@@ -1503,7 +1503,6 @@ struct velocity_info {struct pci_dev *pdev;struct net_device *dev; -struct net_device_stats stats;struct vlan_group *vlgrp;u8 ip_addr[4 ];
From: Eric Dumazet <[email protected]>
Date: Wed, 27 May 2009 22:34:50 +0200
Quoted 4 lines
Use struct
net_device_statsprovided in structnet_deviceinstead of private ones.Signed-off-by Eric Dumazet <[email protected]>
Applied to net-next-2.6