aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/rionet.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-03 20:41:50 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:16 -0400
commit09f75cd7bf13720738e6a196cc0107ce9a5bd5a0 (patch)
tree4c85b0b395abe7f88c87162fc22570e5de255cb1 /drivers/net/rionet.c
parentff8ac60948ba819b89e9c87083e8050fc2f89999 (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/rionet.c')
-rw-r--r--drivers/net/rionet.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index 25a9dd821aa2..d43dcf3ed5a9 100644
--- a/drivers/net/rionet.c
+++ b/drivers/net/rionet.c
@@ -53,7 +53,6 @@ struct rionet_private {
53 struct rio_mport *mport; 53 struct rio_mport *mport;
54 struct sk_buff *rx_skb[RIONET_RX_RING_SIZE]; 54 struct sk_buff *rx_skb[RIONET_RX_RING_SIZE];
55 struct sk_buff *tx_skb[RIONET_TX_RING_SIZE]; 55 struct sk_buff *tx_skb[RIONET_TX_RING_SIZE];
56 struct net_device_stats stats;
57 int rx_slot; 56 int rx_slot;
58 int tx_slot; 57 int tx_slot;
59 int tx_cnt; 58 int tx_cnt;
@@ -91,12 +90,6 @@ static struct rio_dev *rionet_active[RIO_MAX_ROUTE_ENTRIES];
91#define RIONET_MAC_MATCH(x) (*(u32 *)x == 0x00010001) 90#define RIONET_MAC_MATCH(x) (*(u32 *)x == 0x00010001)
92#define RIONET_GET_DESTID(x) (*(u16 *)(x + 4)) 91#define RIONET_GET_DESTID(x) (*(u16 *)(x + 4))
93 92
94static struct net_device_stats *rionet_stats(struct net_device *ndev)
95{
96 struct rionet_private *rnet = ndev->priv;
97 return &rnet->stats;
98}
99
100static int rionet_rx_clean(struct net_device *ndev) 93static int rionet_rx_clean(struct net_device *ndev)
101{ 94{
102 int i; 95 int i;
@@ -120,15 +113,15 @@ static int rionet_rx_clean(struct net_device *ndev)
120 error = netif_rx(rnet->rx_skb[i]); 113 error = netif_rx(rnet->rx_skb[i]);
121 114
122 if (error == NET_RX_DROP) { 115 if (error == NET_RX_DROP) {
123 rnet->stats.rx_dropped++; 116 ndev->stats.rx_dropped++;
124 } else if (error == NET_RX_BAD) { 117 } else if (error == NET_RX_BAD) {
125 if (netif_msg_rx_err(rnet)) 118 if (netif_msg_rx_err(rnet))
126 printk(KERN_WARNING "%s: bad rx packet\n", 119 printk(KERN_WARNING "%s: bad rx packet\n",
127 DRV_NAME); 120 DRV_NAME);
128 rnet->stats.rx_errors++; 121 ndev->stats.rx_errors++;
129 } else { 122 } else {
130 rnet->stats.rx_packets++; 123 ndev->stats.rx_packets++;
131 rnet->stats.rx_bytes += RIO_MAX_MSG_SIZE; 124 ndev->stats.rx_bytes += RIO_MAX_MSG_SIZE;
132 } 125 }
133 126
134 } while ((i = (i + 1) % RIONET_RX_RING_SIZE) != rnet->rx_slot); 127 } while ((i = (i + 1) % RIONET_RX_RING_SIZE) != rnet->rx_slot);
@@ -163,8 +156,8 @@ static int rionet_queue_tx_msg(struct sk_buff *skb, struct net_device *ndev,
163 rio_add_outb_message(rnet->mport, rdev, 0, skb->data, skb->len); 156 rio_add_outb_message(rnet->mport, rdev, 0, skb->data, skb->len);
164 rnet->tx_skb[rnet->tx_slot] = skb; 157 rnet->tx_skb[rnet->tx_slot] = skb;
165 158
166 rnet->stats.tx_packets++; 159 ndev->stats.tx_packets++;
167 rnet->stats.tx_bytes += skb->len; 160 ndev->stats.tx_bytes += skb->len;
168 161
169 if (++rnet->tx_cnt == RIONET_TX_RING_SIZE) 162 if (++rnet->tx_cnt == RIONET_TX_RING_SIZE)
170 netif_stop_queue(ndev); 163 netif_stop_queue(ndev);
@@ -466,7 +459,6 @@ static int rionet_setup_netdev(struct rio_mport *mport)
466 ndev->open = &rionet_open; 459 ndev->open = &rionet_open;
467 ndev->hard_start_xmit = &rionet_start_xmit; 460 ndev->hard_start_xmit = &rionet_start_xmit;
468 ndev->stop = &rionet_close; 461 ndev->stop = &rionet_close;
469 ndev->get_stats = &rionet_stats;
470 ndev->mtu = RIO_MAX_MSG_SIZE - 14; 462 ndev->mtu = RIO_MAX_MSG_SIZE - 14;
471 ndev->features = NETIF_F_LLTX; 463 ndev->features = NETIF_F_LLTX;
472 SET_ETHTOOL_OPS(ndev, &rionet_ethtool_ops); 464 SET_ETHTOOL_OPS(ndev, &rionet_ethtool_ops);