Commit de0561c4 authored by Paulius Zaleckas's avatar Paulius Zaleckas Committed by Jeff Garzik

6pack: use netstats in net_device structure

Use net_device_stats from net_device structure instead of local.
Kill sp_get_stats function, because by default it is used identical
internal_stats function from net/core/dev.c
Signed-off-by: default avatarPaulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent cd65284f
...@@ -99,9 +99,6 @@ struct sixpack { ...@@ -99,9 +99,6 @@ struct sixpack {
unsigned int rx_count; unsigned int rx_count;
unsigned int rx_count_cooked; unsigned int rx_count_cooked;
/* 6pack interface statistics. */
struct net_device_stats stats;
int mtu; /* Our mtu (to spot changes!) */ int mtu; /* Our mtu (to spot changes!) */
int buffsize; /* Max buffers sizes */ int buffsize; /* Max buffers sizes */
...@@ -237,7 +234,7 @@ static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len) ...@@ -237,7 +234,7 @@ static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len)
return; return;
out_drop: out_drop:
sp->stats.tx_dropped++; sp->dev->stats.tx_dropped++;
netif_start_queue(sp->dev); netif_start_queue(sp->dev);
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_DEBUG "%s: %s - dropped.\n", sp->dev->name, msg); printk(KERN_DEBUG "%s: %s - dropped.\n", sp->dev->name, msg);
...@@ -252,7 +249,7 @@ static int sp_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -252,7 +249,7 @@ static int sp_xmit(struct sk_buff *skb, struct net_device *dev)
spin_lock_bh(&sp->lock); spin_lock_bh(&sp->lock);
/* We were not busy, so we are now... :-) */ /* We were not busy, so we are now... :-) */
netif_stop_queue(dev); netif_stop_queue(dev);
sp->stats.tx_bytes += skb->len; dev->stats.tx_bytes += skb->len;
sp_encaps(sp, skb->data, skb->len); sp_encaps(sp, skb->data, skb->len);
spin_unlock_bh(&sp->lock); spin_unlock_bh(&sp->lock);
...@@ -298,12 +295,6 @@ static int sp_header(struct sk_buff *skb, struct net_device *dev, ...@@ -298,12 +295,6 @@ static int sp_header(struct sk_buff *skb, struct net_device *dev,
return 0; return 0;
} }
static struct net_device_stats *sp_get_stats(struct net_device *dev)
{
struct sixpack *sp = netdev_priv(dev);
return &sp->stats;
}
static int sp_set_mac_address(struct net_device *dev, void *addr) static int sp_set_mac_address(struct net_device *dev, void *addr)
{ {
struct sockaddr_ax25 *sa = addr; struct sockaddr_ax25 *sa = addr;
...@@ -338,7 +329,6 @@ static void sp_setup(struct net_device *dev) ...@@ -338,7 +329,6 @@ static void sp_setup(struct net_device *dev)
dev->destructor = free_netdev; dev->destructor = free_netdev;
dev->stop = sp_close; dev->stop = sp_close;
dev->get_stats = sp_get_stats;
dev->set_mac_address = sp_set_mac_address; dev->set_mac_address = sp_set_mac_address;
dev->hard_header_len = AX25_MAX_HEADER_LEN; dev->hard_header_len = AX25_MAX_HEADER_LEN;
dev->header_ops = &sp_header_ops; dev->header_ops = &sp_header_ops;
...@@ -370,7 +360,7 @@ static void sp_bump(struct sixpack *sp, char cmd) ...@@ -370,7 +360,7 @@ static void sp_bump(struct sixpack *sp, char cmd)
count = sp->rcount + 1; count = sp->rcount + 1;
sp->stats.rx_bytes += count; sp->dev->stats.rx_bytes += count;
if ((skb = dev_alloc_skb(count)) == NULL) if ((skb = dev_alloc_skb(count)) == NULL)
goto out_mem; goto out_mem;
...@@ -382,12 +372,12 @@ static void sp_bump(struct sixpack *sp, char cmd) ...@@ -382,12 +372,12 @@ static void sp_bump(struct sixpack *sp, char cmd)
skb->protocol = ax25_type_trans(skb, sp->dev); skb->protocol = ax25_type_trans(skb, sp->dev);
netif_rx(skb); netif_rx(skb);
sp->dev->last_rx = jiffies; sp->dev->last_rx = jiffies;
sp->stats.rx_packets++; sp->dev->stats.rx_packets++;
return; return;
out_mem: out_mem:
sp->stats.rx_dropped++; sp->dev->stats.rx_dropped++;
} }
...@@ -436,7 +426,7 @@ static void sixpack_write_wakeup(struct tty_struct *tty) ...@@ -436,7 +426,7 @@ static void sixpack_write_wakeup(struct tty_struct *tty)
if (sp->xleft <= 0) { if (sp->xleft <= 0) {
/* Now serial buffer is almost free & we can start /* Now serial buffer is almost free & we can start
* transmission of another packet */ * transmission of another packet */
sp->stats.tx_packets++; sp->dev->stats.tx_packets++;
clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
sp->tx_enable = 0; sp->tx_enable = 0;
netif_wake_queue(sp->dev); netif_wake_queue(sp->dev);
...@@ -484,7 +474,7 @@ static void sixpack_receive_buf(struct tty_struct *tty, ...@@ -484,7 +474,7 @@ static void sixpack_receive_buf(struct tty_struct *tty,
count--; count--;
if (fp && *fp++) { if (fp && *fp++) {
if (!test_and_set_bit(SIXPF_ERROR, &sp->flags)) if (!test_and_set_bit(SIXPF_ERROR, &sp->flags))
sp->stats.rx_errors++; sp->dev->stats.rx_errors++;
continue; continue;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment