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

mkiss: convert to internal network device stats

Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ff908cf8
...@@ -59,8 +59,6 @@ struct mkiss { ...@@ -59,8 +59,6 @@ struct mkiss {
unsigned char *xhead; /* pointer to next byte to XMIT */ unsigned char *xhead; /* pointer to next byte to XMIT */
int xleft; /* bytes left in XMIT queue */ int xleft; /* bytes left in XMIT queue */
struct net_device_stats stats;
/* Detailed SLIP statistics. */ /* Detailed SLIP statistics. */
int mtu; /* Our mtu (to spot changes!) */ int mtu; /* Our mtu (to spot changes!) */
int buffsize; /* Max buffers sizes */ int buffsize; /* Max buffers sizes */
...@@ -253,7 +251,7 @@ static void ax_bump(struct mkiss *ax) ...@@ -253,7 +251,7 @@ static void ax_bump(struct mkiss *ax)
if (ax->rbuff[0] > 0x0f) { if (ax->rbuff[0] > 0x0f) {
if (ax->rbuff[0] & 0x80) { if (ax->rbuff[0] & 0x80) {
if (check_crc_16(ax->rbuff, ax->rcount) < 0) { if (check_crc_16(ax->rbuff, ax->rcount) < 0) {
ax->stats.rx_errors++; ax->dev->stats.rx_errors++;
spin_unlock_bh(&ax->buflock); spin_unlock_bh(&ax->buflock);
return; return;
...@@ -268,7 +266,7 @@ static void ax_bump(struct mkiss *ax) ...@@ -268,7 +266,7 @@ static void ax_bump(struct mkiss *ax)
*ax->rbuff &= ~0x80; *ax->rbuff &= ~0x80;
} else if (ax->rbuff[0] & 0x20) { } else if (ax->rbuff[0] & 0x20) {
if (check_crc_flex(ax->rbuff, ax->rcount) < 0) { if (check_crc_flex(ax->rbuff, ax->rcount) < 0) {
ax->stats.rx_errors++; ax->dev->stats.rx_errors++;
spin_unlock_bh(&ax->buflock); spin_unlock_bh(&ax->buflock);
return; return;
} }
...@@ -295,7 +293,7 @@ static void ax_bump(struct mkiss *ax) ...@@ -295,7 +293,7 @@ static void ax_bump(struct mkiss *ax)
if ((skb = dev_alloc_skb(count)) == NULL) { if ((skb = dev_alloc_skb(count)) == NULL) {
printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n", printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
ax->dev->name); ax->dev->name);
ax->stats.rx_dropped++; ax->dev->stats.rx_dropped++;
spin_unlock_bh(&ax->buflock); spin_unlock_bh(&ax->buflock);
return; return;
} }
...@@ -303,8 +301,8 @@ static void ax_bump(struct mkiss *ax) ...@@ -303,8 +301,8 @@ static void ax_bump(struct mkiss *ax)
memcpy(skb_put(skb,count), ax->rbuff, count); memcpy(skb_put(skb,count), ax->rbuff, count);
skb->protocol = ax25_type_trans(skb, ax->dev); skb->protocol = ax25_type_trans(skb, ax->dev);
netif_rx(skb); netif_rx(skb);
ax->stats.rx_packets++; ax->dev->stats.rx_packets++;
ax->stats.rx_bytes += count; ax->dev->stats.rx_bytes += count;
spin_unlock_bh(&ax->buflock); spin_unlock_bh(&ax->buflock);
} }
...@@ -344,7 +342,7 @@ static void kiss_unesc(struct mkiss *ax, unsigned char s) ...@@ -344,7 +342,7 @@ static void kiss_unesc(struct mkiss *ax, unsigned char s)
return; return;
} }
ax->stats.rx_over_errors++; ax->dev->stats.rx_over_errors++;
set_bit(AXF_ERROR, &ax->flags); set_bit(AXF_ERROR, &ax->flags);
} }
spin_unlock_bh(&ax->buflock); spin_unlock_bh(&ax->buflock);
...@@ -406,7 +404,7 @@ static void ax_changedmtu(struct mkiss *ax) ...@@ -406,7 +404,7 @@ static void ax_changedmtu(struct mkiss *ax)
memcpy(ax->xbuff, ax->xhead, ax->xleft); memcpy(ax->xbuff, ax->xhead, ax->xleft);
} else { } else {
ax->xleft = 0; ax->xleft = 0;
ax->stats.tx_dropped++; dev->stats.tx_dropped++;
} }
} }
...@@ -417,7 +415,7 @@ static void ax_changedmtu(struct mkiss *ax) ...@@ -417,7 +415,7 @@ static void ax_changedmtu(struct mkiss *ax)
memcpy(ax->rbuff, orbuff, ax->rcount); memcpy(ax->rbuff, orbuff, ax->rcount);
} else { } else {
ax->rcount = 0; ax->rcount = 0;
ax->stats.rx_over_errors++; dev->stats.rx_over_errors++;
set_bit(AXF_ERROR, &ax->flags); set_bit(AXF_ERROR, &ax->flags);
} }
} }
...@@ -444,7 +442,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len) ...@@ -444,7 +442,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
if (len > ax->mtu) { /* Sigh, shouldn't occur BUT ... */ if (len > ax->mtu) { /* Sigh, shouldn't occur BUT ... */
len = ax->mtu; len = ax->mtu;
printk(KERN_ERR "mkiss: %s: truncating oversized transmit packet!\n", ax->dev->name); printk(KERN_ERR "mkiss: %s: truncating oversized transmit packet!\n", ax->dev->name);
ax->stats.tx_dropped++; dev->stats.tx_dropped++;
netif_start_queue(dev); netif_start_queue(dev);
return; return;
} }
...@@ -518,8 +516,8 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len) ...@@ -518,8 +516,8 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags); set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags);
actual = ax->tty->ops->write(ax->tty, ax->xbuff, count); actual = ax->tty->ops->write(ax->tty, ax->xbuff, count);
ax->stats.tx_packets++; dev->stats.tx_packets++;
ax->stats.tx_bytes += actual; dev->stats.tx_bytes += actual;
ax->dev->trans_start = jiffies; ax->dev->trans_start = jiffies;
ax->xleft = count - actual; ax->xleft = count - actual;
...@@ -664,13 +662,6 @@ static int ax_close(struct net_device *dev) ...@@ -664,13 +662,6 @@ static int ax_close(struct net_device *dev)
return 0; return 0;
} }
static struct net_device_stats *ax_get_stats(struct net_device *dev)
{
struct mkiss *ax = netdev_priv(dev);
return &ax->stats;
}
static const struct header_ops ax_header_ops = { static const struct header_ops ax_header_ops = {
.create = ax_header, .create = ax_header,
.rebuild = ax_rebuild_header, .rebuild = ax_rebuild_header,
...@@ -683,7 +674,6 @@ static void ax_setup(struct net_device *dev) ...@@ -683,7 +674,6 @@ static void ax_setup(struct net_device *dev)
dev->hard_start_xmit = ax_xmit; dev->hard_start_xmit = ax_xmit;
dev->open = ax_open_dev; dev->open = ax_open_dev;
dev->stop = ax_close; dev->stop = ax_close;
dev->get_stats = ax_get_stats;
dev->set_mac_address = ax_set_mac_address; dev->set_mac_address = ax_set_mac_address;
dev->hard_header_len = 0; dev->hard_header_len = 0;
dev->addr_len = 0; dev->addr_len = 0;
...@@ -929,7 +919,7 @@ static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp, ...@@ -929,7 +919,7 @@ static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp,
while (count--) { while (count--) {
if (fp != NULL && *fp++) { if (fp != NULL && *fp++) {
if (!test_and_set_bit(AXF_ERROR, &ax->flags)) if (!test_and_set_bit(AXF_ERROR, &ax->flags))
ax->stats.rx_errors++; ax->dev->stats.rx_errors++;
cp++; cp++;
continue; continue;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册