diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-10-03 20:41:50 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:51:16 -0400 |
commit | 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch) | |
tree | 4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/sb1000.c | |
parent | ff8ac60948ba819b89e9c87083e8050fc2f89999 (diff) |
[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code
We now have struct net_device_stats embedded in struct net_device,
and the default ->get_stats() hook does the obvious thing for us.
Run through drivers/net/* and remove the driver-local storage of
statistics, and driver-local ->get_stats() hook where applicable.
This was just the low-hanging fruit in drivers/net; plenty more drivers
remain to be updated.
[ Resolved conflicts with napi_struct changes and fix sunqe build
regression... -DaveM ]
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sb1000.c')
-rw-r--r-- | drivers/net/sb1000.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/net/sb1000.c b/drivers/net/sb1000.c index aeaa75f549e6..487f9d2ac5b4 100644 --- a/drivers/net/sb1000.c +++ b/drivers/net/sb1000.c | |||
@@ -76,7 +76,6 @@ struct sb1000_private { | |||
76 | unsigned char rx_session_id[NPIDS]; | 76 | unsigned char rx_session_id[NPIDS]; |
77 | unsigned char rx_frame_id[NPIDS]; | 77 | unsigned char rx_frame_id[NPIDS]; |
78 | unsigned char rx_pkt_type[NPIDS]; | 78 | unsigned char rx_pkt_type[NPIDS]; |
79 | struct net_device_stats stats; | ||
80 | }; | 79 | }; |
81 | 80 | ||
82 | /* prototypes for Linux interface */ | 81 | /* prototypes for Linux interface */ |
@@ -85,7 +84,6 @@ static int sb1000_open(struct net_device *dev); | |||
85 | static int sb1000_dev_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd); | 84 | static int sb1000_dev_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd); |
86 | static int sb1000_start_xmit(struct sk_buff *skb, struct net_device *dev); | 85 | static int sb1000_start_xmit(struct sk_buff *skb, struct net_device *dev); |
87 | static irqreturn_t sb1000_interrupt(int irq, void *dev_id); | 86 | static irqreturn_t sb1000_interrupt(int irq, void *dev_id); |
88 | static struct net_device_stats *sb1000_stats(struct net_device *dev); | ||
89 | static int sb1000_close(struct net_device *dev); | 87 | static int sb1000_close(struct net_device *dev); |
90 | 88 | ||
91 | 89 | ||
@@ -199,7 +197,6 @@ sb1000_probe_one(struct pnp_dev *pdev, const struct pnp_device_id *id) | |||
199 | dev->do_ioctl = sb1000_dev_ioctl; | 197 | dev->do_ioctl = sb1000_dev_ioctl; |
200 | dev->hard_start_xmit = sb1000_start_xmit; | 198 | dev->hard_start_xmit = sb1000_start_xmit; |
201 | dev->stop = sb1000_close; | 199 | dev->stop = sb1000_close; |
202 | dev->get_stats = sb1000_stats; | ||
203 | 200 | ||
204 | /* hardware address is 0:0:serial_number */ | 201 | /* hardware address is 0:0:serial_number */ |
205 | dev->dev_addr[2] = serial_number >> 24 & 0xff; | 202 | dev->dev_addr[2] = serial_number >> 24 & 0xff; |
@@ -739,7 +736,7 @@ sb1000_rx(struct net_device *dev) | |||
739 | unsigned int skbsize; | 736 | unsigned int skbsize; |
740 | struct sk_buff *skb; | 737 | struct sk_buff *skb; |
741 | struct sb1000_private *lp = netdev_priv(dev); | 738 | struct sb1000_private *lp = netdev_priv(dev); |
742 | struct net_device_stats *stats = &lp->stats; | 739 | struct net_device_stats *stats = &dev->stats; |
743 | 740 | ||
744 | /* SB1000 frame constants */ | 741 | /* SB1000 frame constants */ |
745 | const int FrameSize = FRAMESIZE; | 742 | const int FrameSize = FRAMESIZE; |
@@ -1002,11 +999,11 @@ static int sb1000_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
1002 | 999 | ||
1003 | switch (cmd) { | 1000 | switch (cmd) { |
1004 | case SIOCGCMSTATS: /* get statistics */ | 1001 | case SIOCGCMSTATS: /* get statistics */ |
1005 | stats[0] = lp->stats.rx_bytes; | 1002 | stats[0] = dev->stats.rx_bytes; |
1006 | stats[1] = lp->rx_frames; | 1003 | stats[1] = lp->rx_frames; |
1007 | stats[2] = lp->stats.rx_packets; | 1004 | stats[2] = dev->stats.rx_packets; |
1008 | stats[3] = lp->stats.rx_errors; | 1005 | stats[3] = dev->stats.rx_errors; |
1009 | stats[4] = lp->stats.rx_dropped; | 1006 | stats[4] = dev->stats.rx_dropped; |
1010 | if(copy_to_user(ifr->ifr_data, stats, sizeof(stats))) | 1007 | if(copy_to_user(ifr->ifr_data, stats, sizeof(stats))) |
1011 | return -EFAULT; | 1008 | return -EFAULT; |
1012 | status = 0; | 1009 | status = 0; |
@@ -1132,12 +1129,6 @@ static irqreturn_t sb1000_interrupt(int irq, void *dev_id) | |||
1132 | return IRQ_HANDLED; | 1129 | return IRQ_HANDLED; |
1133 | } | 1130 | } |
1134 | 1131 | ||
1135 | static struct net_device_stats *sb1000_stats(struct net_device *dev) | ||
1136 | { | ||
1137 | struct sb1000_private *lp = netdev_priv(dev); | ||
1138 | return &lp->stats; | ||
1139 | } | ||
1140 | |||
1141 | static int sb1000_close(struct net_device *dev) | 1132 | static int sb1000_close(struct net_device *dev) |
1142 | { | 1133 | { |
1143 | int i; | 1134 | int i; |