提交 37423fff 编写于 作者: S Stephen Hemminger 提交者: David S. Miller

lanstreamer: convert to internal network stats

Use internal network_device_stats to keep track of statistics.
Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c86d8740
...@@ -207,7 +207,6 @@ static int streamer_xmit(struct sk_buff *skb, struct net_device *dev); ...@@ -207,7 +207,6 @@ static int streamer_xmit(struct sk_buff *skb, struct net_device *dev);
static int streamer_close(struct net_device *dev); static int streamer_close(struct net_device *dev);
static void streamer_set_rx_mode(struct net_device *dev); static void streamer_set_rx_mode(struct net_device *dev);
static irqreturn_t streamer_interrupt(int irq, void *dev_id); static irqreturn_t streamer_interrupt(int irq, void *dev_id);
static struct net_device_stats *streamer_get_stats(struct net_device *dev);
static int streamer_set_mac_address(struct net_device *dev, void *addr); static int streamer_set_mac_address(struct net_device *dev, void *addr);
static void streamer_arb_cmd(struct net_device *dev); static void streamer_arb_cmd(struct net_device *dev);
static int streamer_change_mtu(struct net_device *dev, int mtu); static int streamer_change_mtu(struct net_device *dev, int mtu);
...@@ -331,7 +330,6 @@ static int __devinit streamer_init_one(struct pci_dev *pdev, ...@@ -331,7 +330,6 @@ static int __devinit streamer_init_one(struct pci_dev *pdev,
dev->do_ioctl = NULL; dev->do_ioctl = NULL;
#endif #endif
dev->set_multicast_list = &streamer_set_rx_mode; dev->set_multicast_list = &streamer_set_rx_mode;
dev->get_stats = &streamer_get_stats;
dev->set_mac_address = &streamer_set_mac_address; dev->set_mac_address = &streamer_set_mac_address;
dev->irq = pdev->irq; dev->irq = pdev->irq;
dev->base_addr=pio_start; dev->base_addr=pio_start;
...@@ -937,7 +935,7 @@ static void streamer_rx(struct net_device *dev) ...@@ -937,7 +935,7 @@ static void streamer_rx(struct net_device *dev)
if (skb == NULL) if (skb == NULL)
{ {
printk(KERN_WARNING "%s: Not enough memory to copy packet to upper layers. \n", dev->name); printk(KERN_WARNING "%s: Not enough memory to copy packet to upper layers. \n", dev->name);
streamer_priv->streamer_stats.rx_dropped++; dev->stats.rx_dropped++;
} else { /* we allocated an skb OK */ } else { /* we allocated an skb OK */
if (buffer_cnt == 1) { if (buffer_cnt == 1) {
/* release the DMA mapping */ /* release the DMA mapping */
...@@ -1009,8 +1007,8 @@ static void streamer_rx(struct net_device *dev) ...@@ -1009,8 +1007,8 @@ static void streamer_rx(struct net_device *dev)
/* send up to the protocol */ /* send up to the protocol */
netif_rx(skb); netif_rx(skb);
} }
streamer_priv->streamer_stats.rx_packets++; dev->stats.rx_packets++;
streamer_priv->streamer_stats.rx_bytes += length; dev->stats.rx_bytes += length;
} /* if skb == null */ } /* if skb == null */
} /* end received without errors */ } /* end received without errors */
...@@ -1053,8 +1051,8 @@ static irqreturn_t streamer_interrupt(int irq, void *dev_id) ...@@ -1053,8 +1051,8 @@ static irqreturn_t streamer_interrupt(int irq, void *dev_id)
while(streamer_priv->streamer_tx_ring[(streamer_priv->tx_ring_last_status + 1) & (STREAMER_TX_RING_SIZE - 1)].status) { while(streamer_priv->streamer_tx_ring[(streamer_priv->tx_ring_last_status + 1) & (STREAMER_TX_RING_SIZE - 1)].status) {
streamer_priv->tx_ring_last_status = (streamer_priv->tx_ring_last_status + 1) & (STREAMER_TX_RING_SIZE - 1); streamer_priv->tx_ring_last_status = (streamer_priv->tx_ring_last_status + 1) & (STREAMER_TX_RING_SIZE - 1);
streamer_priv->free_tx_ring_entries++; streamer_priv->free_tx_ring_entries++;
streamer_priv->streamer_stats.tx_bytes += streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]->len; dev->stats.tx_bytes += streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]->len;
streamer_priv->streamer_stats.tx_packets++; dev->stats.tx_packets++;
dev_kfree_skb_irq(streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]); dev_kfree_skb_irq(streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]);
streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].buffer = 0xdeadbeef; streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].buffer = 0xdeadbeef;
streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].status = 0; streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].status = 0;
...@@ -1484,13 +1482,6 @@ static void streamer_srb_bh(struct net_device *dev) ...@@ -1484,13 +1482,6 @@ static void streamer_srb_bh(struct net_device *dev)
} /* switch srb[0] */ } /* switch srb[0] */
} }
static struct net_device_stats *streamer_get_stats(struct net_device *dev)
{
struct streamer_private *streamer_priv;
streamer_priv = netdev_priv(dev);
return (struct net_device_stats *) &streamer_priv->streamer_stats;
}
static int streamer_set_mac_address(struct net_device *dev, void *addr) static int streamer_set_mac_address(struct net_device *dev, void *addr)
{ {
struct sockaddr *saddr = addr; struct sockaddr *saddr = addr;
......
...@@ -299,7 +299,6 @@ struct streamer_private { ...@@ -299,7 +299,6 @@ struct streamer_private {
int tx_ring_free, tx_ring_last_status, rx_ring_last_received, int tx_ring_free, tx_ring_last_status, rx_ring_last_received,
free_tx_ring_entries; free_tx_ring_entries;
struct net_device_stats streamer_stats;
__u16 streamer_lan_status; __u16 streamer_lan_status;
__u8 streamer_ring_speed; __u8 streamer_ring_speed;
__u16 pkt_buf_sz; __u16 pkt_buf_sz;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册