aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hamradio
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2009-01-09 08:01:29 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-21 17:02:33 -0500
commitcd94f08658e15972d6ca8b53501efa48841f1b5b (patch)
tree3865590959c3cfdc43941c65e1f46af40a87715e /drivers/net/hamradio
parentb3672a7394d2db85bd8c0f445df485fc09a0cef7 (diff)
baycom: convert to internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Thomas Sailer <t.sailer@alumni.ethz.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hamradio')
-rw-r--r--drivers/net/hamradio/baycom_epp.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 81a65e3a1c05..c6e4ec3ade69 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -203,7 +203,6 @@ struct baycom_state {
203 unsigned char buf[TXBUFFER_SIZE]; 203 unsigned char buf[TXBUFFER_SIZE];
204 } hdlctx; 204 } hdlctx;
205 205
206 struct net_device_stats stats;
207 unsigned int ptt_keyed; 206 unsigned int ptt_keyed;
208 struct sk_buff *skb; /* next transmit packet */ 207 struct sk_buff *skb; /* next transmit packet */
209 208
@@ -423,7 +422,7 @@ static void encode_hdlc(struct baycom_state *bc)
423 bc->hdlctx.bufptr = bc->hdlctx.buf; 422 bc->hdlctx.bufptr = bc->hdlctx.buf;
424 bc->hdlctx.bufcnt = wp - bc->hdlctx.buf; 423 bc->hdlctx.bufcnt = wp - bc->hdlctx.buf;
425 dev_kfree_skb(skb); 424 dev_kfree_skb(skb);
426 bc->stats.tx_packets++; 425 bc->dev->stats.tx_packets++;
427} 426}
428 427
429/* ---------------------------------------------------------------------- */ 428/* ---------------------------------------------------------------------- */
@@ -547,7 +546,7 @@ static void do_rxpacket(struct net_device *dev)
547 pktlen = bc->hdlcrx.bufcnt-2+1; /* KISS kludge */ 546 pktlen = bc->hdlcrx.bufcnt-2+1; /* KISS kludge */
548 if (!(skb = dev_alloc_skb(pktlen))) { 547 if (!(skb = dev_alloc_skb(pktlen))) {
549 printk("%s: memory squeeze, dropping packet\n", dev->name); 548 printk("%s: memory squeeze, dropping packet\n", dev->name);
550 bc->stats.rx_dropped++; 549 dev->stats.rx_dropped++;
551 return; 550 return;
552 } 551 }
553 cp = skb_put(skb, pktlen); 552 cp = skb_put(skb, pktlen);
@@ -555,7 +554,7 @@ static void do_rxpacket(struct net_device *dev)
555 memcpy(cp, bc->hdlcrx.buf, pktlen - 1); 554 memcpy(cp, bc->hdlcrx.buf, pktlen - 1);
556 skb->protocol = ax25_type_trans(skb, dev); 555 skb->protocol = ax25_type_trans(skb, dev);
557 netif_rx(skb); 556 netif_rx(skb);
558 bc->stats.rx_packets++; 557 dev->stats.rx_packets++;
559} 558}
560 559
561static int receive(struct net_device *dev, int cnt) 560static 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 801
803/* --------------------------------------------------------------------- */ 802/* --------------------------------------------------------------------- */
804 803
805static struct net_device_stats *baycom_get_stats(struct net_device *dev)
806{
807 struct baycom_state *bc = netdev_priv(dev);
808
809 /*
810 * Get the current statistics. This may be called with the
811 * card open or closed.
812 */
813 return &bc->stats;
814}
815
816/* --------------------------------------------------------------------- */
817
818static void epp_wakeup(void *handle) 804static void epp_wakeup(void *handle)
819{ 805{
820 struct net_device *dev = (struct net_device *)handle; 806 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 hi.data.cs.ptt = !!(bc->stat & EPP_PTTBIT); 1051 hi.data.cs.ptt = !!(bc->stat & EPP_PTTBIT);
1066 hi.data.cs.dcd = !(bc->stat & EPP_DCDBIT); 1052 hi.data.cs.dcd = !(bc->stat & EPP_DCDBIT);
1067 hi.data.cs.ptt_keyed = bc->ptt_keyed; 1053 hi.data.cs.ptt_keyed = bc->ptt_keyed;
1068 hi.data.cs.tx_packets = bc->stats.tx_packets; 1054 hi.data.cs.tx_packets = dev->stats.tx_packets;
1069 hi.data.cs.tx_errors = bc->stats.tx_errors; 1055 hi.data.cs.tx_errors = dev->stats.tx_errors;
1070 hi.data.cs.rx_packets = bc->stats.rx_packets; 1056 hi.data.cs.rx_packets = dev->stats.rx_packets;
1071 hi.data.cs.rx_errors = bc->stats.rx_errors; 1057 hi.data.cs.rx_errors = dev->stats.rx_errors;
1072 break; 1058 break;
1073 1059
1074 case HDLCDRVCTL_OLDGETSTAT: 1060 case HDLCDRVCTL_OLDGETSTAT:
@@ -1147,7 +1133,6 @@ static void baycom_probe(struct net_device *dev)
1147 dev->stop = epp_close; 1133 dev->stop = epp_close;
1148 dev->do_ioctl = baycom_ioctl; 1134 dev->do_ioctl = baycom_ioctl;
1149 dev->hard_start_xmit = baycom_send_packet; 1135 dev->hard_start_xmit = baycom_send_packet;
1150 dev->get_stats = baycom_get_stats;
1151 1136
1152 /* Fill in the fields of the device structure */ 1137 /* Fill in the fields of the device structure */
1153 bc->skb = NULL; 1138 bc->skb = NULL;