Commit cd94f086 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

baycom: convert to internal net_device_stats

Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Acked-by: default avatarThomas Sailer <t.sailer@alumni.ethz.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b3672a73
...@@ -203,7 +203,6 @@ struct baycom_state { ...@@ -203,7 +203,6 @@ struct baycom_state {
unsigned char buf[TXBUFFER_SIZE]; unsigned char buf[TXBUFFER_SIZE];
} hdlctx; } hdlctx;
struct net_device_stats stats;
unsigned int ptt_keyed; unsigned int ptt_keyed;
struct sk_buff *skb; /* next transmit packet */ struct sk_buff *skb; /* next transmit packet */
...@@ -423,7 +422,7 @@ static void encode_hdlc(struct baycom_state *bc) ...@@ -423,7 +422,7 @@ static void encode_hdlc(struct baycom_state *bc)
bc->hdlctx.bufptr = bc->hdlctx.buf; bc->hdlctx.bufptr = bc->hdlctx.buf;
bc->hdlctx.bufcnt = wp - bc->hdlctx.buf; bc->hdlctx.bufcnt = wp - bc->hdlctx.buf;
dev_kfree_skb(skb); dev_kfree_skb(skb);
bc->stats.tx_packets++; bc->dev->stats.tx_packets++;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
...@@ -547,7 +546,7 @@ static void do_rxpacket(struct net_device *dev) ...@@ -547,7 +546,7 @@ static void do_rxpacket(struct net_device *dev)
pktlen = bc->hdlcrx.bufcnt-2+1; /* KISS kludge */ pktlen = bc->hdlcrx.bufcnt-2+1; /* KISS kludge */
if (!(skb = dev_alloc_skb(pktlen))) { if (!(skb = dev_alloc_skb(pktlen))) {
printk("%s: memory squeeze, dropping packet\n", dev->name); printk("%s: memory squeeze, dropping packet\n", dev->name);
bc->stats.rx_dropped++; dev->stats.rx_dropped++;
return; return;
} }
cp = skb_put(skb, pktlen); cp = skb_put(skb, pktlen);
...@@ -555,7 +554,7 @@ static void do_rxpacket(struct net_device *dev) ...@@ -555,7 +554,7 @@ static void do_rxpacket(struct net_device *dev)
memcpy(cp, bc->hdlcrx.buf, pktlen - 1); memcpy(cp, bc->hdlcrx.buf, pktlen - 1);
skb->protocol = ax25_type_trans(skb, dev); skb->protocol = ax25_type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
bc->stats.rx_packets++; dev->stats.rx_packets++;
} }
static int receive(struct net_device *dev, int cnt) static int receive(struct net_device *dev, int cnt)
...@@ -802,19 +801,6 @@ static int baycom_set_mac_address(struct net_device *dev, void *addr) ...@@ -802,19 +801,6 @@ static int baycom_set_mac_address(struct net_device *dev, void *addr)
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static struct net_device_stats *baycom_get_stats(struct net_device *dev)
{
struct baycom_state *bc = netdev_priv(dev);
/*
* Get the current statistics. This may be called with the
* card open or closed.
*/
return &bc->stats;
}
/* --------------------------------------------------------------------- */
static void epp_wakeup(void *handle) static void epp_wakeup(void *handle)
{ {
struct net_device *dev = (struct net_device *)handle; struct net_device *dev = (struct net_device *)handle;
...@@ -1065,10 +1051,10 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1065,10 +1051,10 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
hi.data.cs.ptt = !!(bc->stat & EPP_PTTBIT); hi.data.cs.ptt = !!(bc->stat & EPP_PTTBIT);
hi.data.cs.dcd = !(bc->stat & EPP_DCDBIT); hi.data.cs.dcd = !(bc->stat & EPP_DCDBIT);
hi.data.cs.ptt_keyed = bc->ptt_keyed; hi.data.cs.ptt_keyed = bc->ptt_keyed;
hi.data.cs.tx_packets = bc->stats.tx_packets; hi.data.cs.tx_packets = dev->stats.tx_packets;
hi.data.cs.tx_errors = bc->stats.tx_errors; hi.data.cs.tx_errors = dev->stats.tx_errors;
hi.data.cs.rx_packets = bc->stats.rx_packets; hi.data.cs.rx_packets = dev->stats.rx_packets;
hi.data.cs.rx_errors = bc->stats.rx_errors; hi.data.cs.rx_errors = dev->stats.rx_errors;
break; break;
case HDLCDRVCTL_OLDGETSTAT: case HDLCDRVCTL_OLDGETSTAT:
...@@ -1147,7 +1133,6 @@ static void baycom_probe(struct net_device *dev) ...@@ -1147,7 +1133,6 @@ static void baycom_probe(struct net_device *dev)
dev->stop = epp_close; dev->stop = epp_close;
dev->do_ioctl = baycom_ioctl; dev->do_ioctl = baycom_ioctl;
dev->hard_start_xmit = baycom_send_packet; dev->hard_start_xmit = baycom_send_packet;
dev->get_stats = baycom_get_stats;
/* Fill in the fields of the device structure */ /* Fill in the fields of the device structure */
bc->skb = NULL; bc->skb = NULL;
......
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