diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-01-06 07:56:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-06 19:49:02 -0500 |
commit | 92dc8cc317844e5681f5d8990896720ed2b21cc8 (patch) | |
tree | 0ada7a2c950ae2ccded562fec8561205fb25470f /drivers/ieee1394 | |
parent | 464f4daae75c87ed281b421caa019f67f459b85f (diff) |
ieee1394: use internal network device stats
Use the network_device_stats field in network_device.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/eth1394.c | 38 | ||||
-rw-r--r-- | drivers/ieee1394/eth1394.h | 1 |
2 files changed, 16 insertions, 23 deletions
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 471c249cff46..930d47f053cf 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
@@ -245,12 +245,6 @@ static int ether1394_stop(struct net_device *dev) | |||
245 | return 0; | 245 | return 0; |
246 | } | 246 | } |
247 | 247 | ||
248 | /* Return statistics to the caller */ | ||
249 | static struct net_device_stats *ether1394_stats(struct net_device *dev) | ||
250 | { | ||
251 | return &(((struct eth1394_priv *)netdev_priv(dev))->stats); | ||
252 | } | ||
253 | |||
254 | /* FIXME: What to do if we timeout? I think a host reset is probably in order, | 248 | /* FIXME: What to do if we timeout? I think a host reset is probably in order, |
255 | * so that's what we do. Should we increment the stat counters too? */ | 249 | * so that's what we do. Should we increment the stat counters too? */ |
256 | static void ether1394_tx_timeout(struct net_device *dev) | 250 | static void ether1394_tx_timeout(struct net_device *dev) |
@@ -520,7 +514,6 @@ static const struct net_device_ops ether1394_netdev_ops = { | |||
520 | .ndo_open = ether1394_open, | 514 | .ndo_open = ether1394_open, |
521 | .ndo_stop = ether1394_stop, | 515 | .ndo_stop = ether1394_stop, |
522 | .ndo_start_xmit = ether1394_tx, | 516 | .ndo_start_xmit = ether1394_tx, |
523 | .ndo_get_stats = ether1394_stats, | ||
524 | .ndo_tx_timeout = ether1394_tx_timeout, | 517 | .ndo_tx_timeout = ether1394_tx_timeout, |
525 | .ndo_change_mtu = ether1394_change_mtu, | 518 | .ndo_change_mtu = ether1394_change_mtu, |
526 | }; | 519 | }; |
@@ -1079,7 +1072,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid, | |||
1079 | HPSB_PRINT(KERN_ERR, "ether1394 rx: sender nodeid " | 1072 | HPSB_PRINT(KERN_ERR, "ether1394 rx: sender nodeid " |
1080 | "lookup failure: " NODE_BUS_FMT, | 1073 | "lookup failure: " NODE_BUS_FMT, |
1081 | NODE_BUS_ARGS(priv->host, srcid)); | 1074 | NODE_BUS_ARGS(priv->host, srcid)); |
1082 | priv->stats.rx_dropped++; | 1075 | dev->stats.rx_dropped++; |
1083 | return -1; | 1076 | return -1; |
1084 | } | 1077 | } |
1085 | ud = node->ud; | 1078 | ud = node->ud; |
@@ -1102,7 +1095,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid, | |||
1102 | skb = dev_alloc_skb(len + dev->hard_header_len + 15); | 1095 | skb = dev_alloc_skb(len + dev->hard_header_len + 15); |
1103 | if (unlikely(!skb)) { | 1096 | if (unlikely(!skb)) { |
1104 | ETH1394_PRINT_G(KERN_ERR, "Out of memory\n"); | 1097 | ETH1394_PRINT_G(KERN_ERR, "Out of memory\n"); |
1105 | priv->stats.rx_dropped++; | 1098 | dev->stats.rx_dropped++; |
1106 | return -1; | 1099 | return -1; |
1107 | } | 1100 | } |
1108 | skb_reserve(skb, (dev->hard_header_len + 15) & ~15); | 1101 | skb_reserve(skb, (dev->hard_header_len + 15) & ~15); |
@@ -1221,15 +1214,15 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid, | |||
1221 | spin_lock_irqsave(&priv->lock, flags); | 1214 | spin_lock_irqsave(&priv->lock, flags); |
1222 | 1215 | ||
1223 | if (!skb->protocol) { | 1216 | if (!skb->protocol) { |
1224 | priv->stats.rx_errors++; | 1217 | dev->stats.rx_errors++; |
1225 | priv->stats.rx_dropped++; | 1218 | dev->stats.rx_dropped++; |
1226 | dev_kfree_skb_any(skb); | 1219 | dev_kfree_skb_any(skb); |
1227 | } else if (netif_rx(skb) == NET_RX_DROP) { | 1220 | } else if (netif_rx(skb) == NET_RX_DROP) { |
1228 | priv->stats.rx_errors++; | 1221 | dev->stats.rx_errors++; |
1229 | priv->stats.rx_dropped++; | 1222 | dev->stats.rx_dropped++; |
1230 | } else { | 1223 | } else { |
1231 | priv->stats.rx_packets++; | 1224 | dev->stats.rx_packets++; |
1232 | priv->stats.rx_bytes += skb->len; | 1225 | dev->stats.rx_bytes += skb->len; |
1233 | } | 1226 | } |
1234 | 1227 | ||
1235 | spin_unlock_irqrestore(&priv->lock, flags); | 1228 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -1511,17 +1504,18 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len) | |||
1511 | static void ether1394_dg_complete(struct packet_task *ptask, int fail) | 1504 | static void ether1394_dg_complete(struct packet_task *ptask, int fail) |
1512 | { | 1505 | { |
1513 | struct sk_buff *skb = ptask->skb; | 1506 | struct sk_buff *skb = ptask->skb; |
1514 | struct eth1394_priv *priv = netdev_priv(skb->dev); | 1507 | struct net_device *dev = skb->dev; |
1508 | struct eth1394_priv *priv = netdev_priv(dev); | ||
1515 | unsigned long flags; | 1509 | unsigned long flags; |
1516 | 1510 | ||
1517 | /* Statistics */ | 1511 | /* Statistics */ |
1518 | spin_lock_irqsave(&priv->lock, flags); | 1512 | spin_lock_irqsave(&priv->lock, flags); |
1519 | if (fail) { | 1513 | if (fail) { |
1520 | priv->stats.tx_dropped++; | 1514 | dev->stats.tx_dropped++; |
1521 | priv->stats.tx_errors++; | 1515 | dev->stats.tx_errors++; |
1522 | } else { | 1516 | } else { |
1523 | priv->stats.tx_bytes += skb->len; | 1517 | dev->stats.tx_bytes += skb->len; |
1524 | priv->stats.tx_packets++; | 1518 | dev->stats.tx_packets++; |
1525 | } | 1519 | } |
1526 | spin_unlock_irqrestore(&priv->lock, flags); | 1520 | spin_unlock_irqrestore(&priv->lock, flags); |
1527 | 1521 | ||
@@ -1698,8 +1692,8 @@ fail: | |||
1698 | dev_kfree_skb(skb); | 1692 | dev_kfree_skb(skb); |
1699 | 1693 | ||
1700 | spin_lock_irqsave(&priv->lock, flags); | 1694 | spin_lock_irqsave(&priv->lock, flags); |
1701 | priv->stats.tx_dropped++; | 1695 | dev->stats.tx_dropped++; |
1702 | priv->stats.tx_errors++; | 1696 | dev->stats.tx_errors++; |
1703 | spin_unlock_irqrestore(&priv->lock, flags); | 1697 | spin_unlock_irqrestore(&priv->lock, flags); |
1704 | 1698 | ||
1705 | /* | 1699 | /* |
diff --git a/drivers/ieee1394/eth1394.h b/drivers/ieee1394/eth1394.h index 4f3e2dd46f00..c5bd29ab6056 100644 --- a/drivers/ieee1394/eth1394.h +++ b/drivers/ieee1394/eth1394.h | |||
@@ -54,7 +54,6 @@ enum eth1394_bc_states { ETHER1394_BC_ERROR, | |||
54 | 54 | ||
55 | /* Private structure for our ethernet driver */ | 55 | /* Private structure for our ethernet driver */ |
56 | struct eth1394_priv { | 56 | struct eth1394_priv { |
57 | struct net_device_stats stats; /* Device stats */ | ||
58 | struct hpsb_host *host; /* The card for this dev */ | 57 | struct hpsb_host *host; /* The card for this dev */ |
59 | u16 bc_maxpayload; /* Max broadcast payload */ | 58 | u16 bc_maxpayload; /* Max broadcast payload */ |
60 | u8 bc_sspd; /* Max broadcast speed */ | 59 | u8 bc_sspd; /* Max broadcast speed */ |