aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2009-01-09 08:01:35 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-21 17:02:36 -0500
commit5a7616af604caf0d436a1ed0d4298bb25cd77d67 (patch)
tree4c2ba171c81ac53cbf0a05be0e13b1d63fead983
parent52db625079e8f231a3e53e89871bd5adb66e8464 (diff)
hdlcdrv: 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>
-rw-r--r--drivers/net/hamradio/hdlcdrv.c27
-rw-r--r--include/linux/hdlcdrv.h1
2 files changed, 7 insertions, 21 deletions
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index 8eba61a1d4ab..1215a49c38f1 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -154,7 +154,7 @@ static void hdlc_rx_flag(struct net_device *dev, struct hdlcdrv_state *s)
154 pkt_len = s->hdlcrx.len - 2 + 1; /* KISS kludge */ 154 pkt_len = s->hdlcrx.len - 2 + 1; /* KISS kludge */
155 if (!(skb = dev_alloc_skb(pkt_len))) { 155 if (!(skb = dev_alloc_skb(pkt_len))) {
156 printk("%s: memory squeeze, dropping packet\n", dev->name); 156 printk("%s: memory squeeze, dropping packet\n", dev->name);
157 s->stats.rx_dropped++; 157 dev->stats.rx_dropped++;
158 return; 158 return;
159 } 159 }
160 cp = skb_put(skb, pkt_len); 160 cp = skb_put(skb, pkt_len);
@@ -162,7 +162,7 @@ static void hdlc_rx_flag(struct net_device *dev, struct hdlcdrv_state *s)
162 memcpy(cp, s->hdlcrx.buffer, pkt_len - 1); 162 memcpy(cp, s->hdlcrx.buffer, pkt_len - 1);
163 skb->protocol = ax25_type_trans(skb, dev); 163 skb->protocol = ax25_type_trans(skb, dev);
164 netif_rx(skb); 164 netif_rx(skb);
165 s->stats.rx_packets++; 165 dev->stats.rx_packets++;
166} 166}
167 167
168void hdlcdrv_receiver(struct net_device *dev, struct hdlcdrv_state *s) 168void hdlcdrv_receiver(struct net_device *dev, struct hdlcdrv_state *s)
@@ -326,7 +326,7 @@ void hdlcdrv_transmitter(struct net_device *dev, struct hdlcdrv_state *s)
326 s->hdlctx.len = pkt_len+2; /* the appended CRC */ 326 s->hdlctx.len = pkt_len+2; /* the appended CRC */
327 s->hdlctx.tx_state = 2; 327 s->hdlctx.tx_state = 2;
328 s->hdlctx.bitstream = 0; 328 s->hdlctx.bitstream = 0;
329 s->stats.tx_packets++; 329 dev->stats.tx_packets++;
330 break; 330 break;
331 case 2: 331 case 2:
332 if (!s->hdlctx.len) { 332 if (!s->hdlctx.len) {
@@ -427,19 +427,6 @@ static int hdlcdrv_set_mac_address(struct net_device *dev, void *addr)
427} 427}
428 428
429/* --------------------------------------------------------------------- */ 429/* --------------------------------------------------------------------- */
430
431static struct net_device_stats *hdlcdrv_get_stats(struct net_device *dev)
432{
433 struct hdlcdrv_state *sm = netdev_priv(dev);
434
435 /*
436 * Get the current statistics. This may be called with the
437 * card open or closed.
438 */
439 return &sm->stats;
440}
441
442/* --------------------------------------------------------------------- */
443/* 430/*
444 * Open/initialize the board. This is called (in the current kernel) 431 * Open/initialize the board. This is called (in the current kernel)
445 * sometime after booting when the 'ifconfig' program is run. 432 * sometime after booting when the 'ifconfig' program is run.
@@ -568,10 +555,10 @@ static int hdlcdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
568 bi.data.cs.ptt = hdlcdrv_ptt(s); 555 bi.data.cs.ptt = hdlcdrv_ptt(s);
569 bi.data.cs.dcd = s->hdlcrx.dcd; 556 bi.data.cs.dcd = s->hdlcrx.dcd;
570 bi.data.cs.ptt_keyed = s->ptt_keyed; 557 bi.data.cs.ptt_keyed = s->ptt_keyed;
571 bi.data.cs.tx_packets = s->stats.tx_packets; 558 bi.data.cs.tx_packets = dev->stats.tx_packets;
572 bi.data.cs.tx_errors = s->stats.tx_errors; 559 bi.data.cs.tx_errors = dev->stats.tx_errors;
573 bi.data.cs.rx_packets = s->stats.rx_packets; 560 bi.data.cs.rx_packets = dev->stats.rx_packets;
574 bi.data.cs.rx_errors = s->stats.rx_errors; 561 bi.data.cs.rx_errors = dev->stats.rx_errors;
575 break; 562 break;
576 563
577 case HDLCDRVCTL_OLDGETSTAT: 564 case HDLCDRVCTL_OLDGETSTAT:
diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h
index bf6302f6b5f8..0821bac62b83 100644
--- a/include/linux/hdlcdrv.h
+++ b/include/linux/hdlcdrv.h
@@ -241,7 +241,6 @@ struct hdlcdrv_state {
241 struct hdlcdrv_bitbuffer bitbuf_hdlc; 241 struct hdlcdrv_bitbuffer bitbuf_hdlc;
242#endif /* HDLCDRV_DEBUG */ 242#endif /* HDLCDRV_DEBUG */
243 243
244 struct net_device_stats stats;
245 int ptt_keyed; 244 int ptt_keyed;
246 245
247 /* queued skb for transmission */ 246 /* queued skb for transmission */