aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan/x25_asy.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-03-20 15:36:12 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-22 01:37:57 -0400
commit6a8eba3bf4643fa4f0f62af29c47728d5296ed15 (patch)
tree11e4c6ad61d00870b22d8468ec94eaefe071d42e /drivers/net/wan/x25_asy.c
parent3dd205165e076eacf09575f0c90031e7c52bc5e1 (diff)
x25_asy: convert to internal net_device_stats
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wan/x25_asy.c')
-rw-r--r--drivers/net/wan/x25_asy.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index e6e2ce3e7bcf..d62844d7e934 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -142,7 +142,7 @@ static int x25_asy_change_mtu(struct net_device *dev, int newmtu)
142 memcpy(sl->xbuff, sl->xhead, sl->xleft); 142 memcpy(sl->xbuff, sl->xhead, sl->xleft);
143 } else { 143 } else {
144 sl->xleft = 0; 144 sl->xleft = 0;
145 sl->stats.tx_dropped++; 145 dev->stats.tx_dropped++;
146 } 146 }
147 } 147 }
148 sl->xhead = sl->xbuff; 148 sl->xhead = sl->xbuff;
@@ -153,7 +153,7 @@ static int x25_asy_change_mtu(struct net_device *dev, int newmtu)
153 memcpy(sl->rbuff, rbuff, sl->rcount); 153 memcpy(sl->rbuff, rbuff, sl->rcount);
154 } else { 154 } else {
155 sl->rcount = 0; 155 sl->rcount = 0;
156 sl->stats.rx_over_errors++; 156 dev->stats.rx_over_errors++;
157 set_bit(SLF_ERROR, &sl->flags); 157 set_bit(SLF_ERROR, &sl->flags);
158 } 158 }
159 } 159 }
@@ -188,18 +188,19 @@ static inline void x25_asy_unlock(struct x25_asy *sl)
188 188
189static void x25_asy_bump(struct x25_asy *sl) 189static void x25_asy_bump(struct x25_asy *sl)
190{ 190{
191 struct net_device *dev = sl->dev;
191 struct sk_buff *skb; 192 struct sk_buff *skb;
192 int count; 193 int count;
193 int err; 194 int err;
194 195
195 count = sl->rcount; 196 count = sl->rcount;
196 sl->stats.rx_bytes += count; 197 dev->stats.rx_bytes += count;
197 198
198 skb = dev_alloc_skb(count+1); 199 skb = dev_alloc_skb(count+1);
199 if (skb == NULL) { 200 if (skb == NULL) {
200 printk(KERN_WARNING "%s: memory squeeze, dropping packet.\n", 201 printk(KERN_WARNING "%s: memory squeeze, dropping packet.\n",
201 sl->dev->name); 202 sl->dev->name);
202 sl->stats.rx_dropped++; 203 dev->stats.rx_dropped++;
203 return; 204 return;
204 } 205 }
205 skb_push(skb, 1); /* LAPB internal control */ 206 skb_push(skb, 1); /* LAPB internal control */
@@ -211,7 +212,7 @@ static void x25_asy_bump(struct x25_asy *sl)
211 printk(KERN_DEBUG "x25_asy: data received err - %d\n", err); 212 printk(KERN_DEBUG "x25_asy: data received err - %d\n", err);
212 } else { 213 } else {
213 netif_rx(skb); 214 netif_rx(skb);
214 sl->stats.rx_packets++; 215 dev->stats.rx_packets++;
215 } 216 }
216} 217}
217 218
@@ -226,7 +227,7 @@ static void x25_asy_encaps(struct x25_asy *sl, unsigned char *icp, int len)
226 len = mtu; 227 len = mtu;
227 printk(KERN_DEBUG "%s: truncating oversized transmit packet!\n", 228 printk(KERN_DEBUG "%s: truncating oversized transmit packet!\n",
228 sl->dev->name); 229 sl->dev->name);
229 sl->stats.tx_dropped++; 230 sl->dev->stats.tx_dropped++;
230 x25_asy_unlock(sl); 231 x25_asy_unlock(sl);
231 return; 232 return;
232 } 233 }
@@ -266,7 +267,7 @@ static void x25_asy_write_wakeup(struct tty_struct *tty)
266 if (sl->xleft <= 0) { 267 if (sl->xleft <= 0) {
267 /* Now serial buffer is almost free & we can start 268 /* Now serial buffer is almost free & we can start
268 * transmission of another packet */ 269 * transmission of another packet */
269 sl->stats.tx_packets++; 270 sl->dev->stats.tx_packets++;
270 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 271 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
271 x25_asy_unlock(sl); 272 x25_asy_unlock(sl);
272 return; 273 return;
@@ -383,7 +384,7 @@ static void x25_asy_data_transmit(struct net_device *dev, struct sk_buff *skb)
383 /* We were not busy, so we are now... :-) */ 384 /* We were not busy, so we are now... :-) */
384 if (skb != NULL) { 385 if (skb != NULL) {
385 x25_asy_lock(sl); 386 x25_asy_lock(sl);
386 sl->stats.tx_bytes += skb->len; 387 dev->stats.tx_bytes += skb->len;
387 x25_asy_encaps(sl, skb->data, skb->len); 388 x25_asy_encaps(sl, skb->data, skb->len);
388 dev_kfree_skb(skb); 389 dev_kfree_skb(skb);
389 } 390 }
@@ -533,7 +534,7 @@ static void x25_asy_receive_buf(struct tty_struct *tty,
533 while (count--) { 534 while (count--) {
534 if (fp && *fp++) { 535 if (fp && *fp++) {
535 if (!test_and_set_bit(SLF_ERROR, &sl->flags)) 536 if (!test_and_set_bit(SLF_ERROR, &sl->flags))
536 sl->stats.rx_errors++; 537 sl->dev->stats.rx_errors++;
537 cp++; 538 cp++;
538 continue; 539 continue;
539 } 540 }
@@ -608,14 +609,6 @@ static void x25_asy_close_tty(struct tty_struct *tty)
608 x25_asy_free(sl); 609 x25_asy_free(sl);
609} 610}
610 611
611
612static struct net_device_stats *x25_asy_get_stats(struct net_device *dev)
613{
614 struct x25_asy *sl = netdev_priv(dev);
615 return &sl->stats;
616}
617
618
619 /************************************************************************ 612 /************************************************************************
620 * STANDARD X.25 ENCAPSULATION * 613 * STANDARD X.25 ENCAPSULATION *
621 ************************************************************************/ 614 ************************************************************************/
@@ -682,7 +675,7 @@ static void x25_asy_unesc(struct x25_asy *sl, unsigned char s)
682 sl->rbuff[sl->rcount++] = s; 675 sl->rbuff[sl->rcount++] = s;
683 return; 676 return;
684 } 677 }
685 sl->stats.rx_over_errors++; 678 sl->dev->stats.rx_over_errors++;
686 set_bit(SLF_ERROR, &sl->flags); 679 set_bit(SLF_ERROR, &sl->flags);
687 } 680 }
688} 681}
@@ -739,7 +732,6 @@ static void x25_asy_setup(struct net_device *dev)
739 dev->watchdog_timeo = HZ*20; 732 dev->watchdog_timeo = HZ*20;
740 dev->open = x25_asy_open_dev; 733 dev->open = x25_asy_open_dev;
741 dev->stop = x25_asy_close; 734 dev->stop = x25_asy_close;
742 dev->get_stats = x25_asy_get_stats;
743 dev->change_mtu = x25_asy_change_mtu; 735 dev->change_mtu = x25_asy_change_mtu;
744 dev->hard_header_len = 0; 736 dev->hard_header_len = 0;
745 dev->addr_len = 0; 737 dev->addr_len = 0;