aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hamradio/6pack.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-20 20:43:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-20 20:43:29 -0400
commitdb6d8c7a4027b48d797b369a53f8470aaeed7063 (patch)
treee140c104a89abc2154e1f41a7db8ebecbb6fa0b4 /drivers/net/hamradio/6pack.c
parent3a533374283aea50eab3976d8a6d30532175f009 (diff)
parentfb65a7c091529bfffb1262515252c0d0f6241c5c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (1232 commits) iucv: Fix bad merging. net_sched: Add size table for qdiscs net_sched: Add accessor function for packet length for qdiscs net_sched: Add qdisc_enqueue wrapper highmem: Export totalhigh_pages. ipv6 mcast: Omit redundant address family checks in ip6_mc_source(). net: Use standard structures for generic socket address structures. ipv6 netns: Make several "global" sysctl variables namespace aware. netns: Use net_eq() to compare net-namespaces for optimization. ipv6: remove unused macros from net/ipv6.h ipv6: remove unused parameter from ip6_ra_control tcp: fix kernel panic with listening_get_next tcp: Remove redundant checks when setting eff_sacks tcp: options clean up tcp: Fix MD5 signatures for non-linear skbs sctp: Update sctp global memory limit allocations. sctp: remove unnecessary byteshifting, calculate directly in big-endian sctp: Allow only 1 listening socket with SO_REUSEADDR sctp: Do not leak memory on multiple listen() calls sctp: Support ipv6only AF_INET6 sockets. ...
Diffstat (limited to 'drivers/net/hamradio/6pack.c')
-rw-r--r--drivers/net/hamradio/6pack.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index 19dd0a61749c..0f501d2ca935 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -99,9 +99,6 @@ struct sixpack {
99 unsigned int rx_count; 99 unsigned int rx_count;
100 unsigned int rx_count_cooked; 100 unsigned int rx_count_cooked;
101 101
102 /* 6pack interface statistics. */
103 struct net_device_stats stats;
104
105 int mtu; /* Our mtu (to spot changes!) */ 102 int mtu; /* Our mtu (to spot changes!) */
106 int buffsize; /* Max buffers sizes */ 103 int buffsize; /* Max buffers sizes */
107 104
@@ -237,7 +234,7 @@ static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len)
237 return; 234 return;
238 235
239out_drop: 236out_drop:
240 sp->stats.tx_dropped++; 237 sp->dev->stats.tx_dropped++;
241 netif_start_queue(sp->dev); 238 netif_start_queue(sp->dev);
242 if (net_ratelimit()) 239 if (net_ratelimit())
243 printk(KERN_DEBUG "%s: %s - dropped.\n", sp->dev->name, msg); 240 printk(KERN_DEBUG "%s: %s - dropped.\n", sp->dev->name, msg);
@@ -252,7 +249,7 @@ static int sp_xmit(struct sk_buff *skb, struct net_device *dev)
252 spin_lock_bh(&sp->lock); 249 spin_lock_bh(&sp->lock);
253 /* We were not busy, so we are now... :-) */ 250 /* We were not busy, so we are now... :-) */
254 netif_stop_queue(dev); 251 netif_stop_queue(dev);
255 sp->stats.tx_bytes += skb->len; 252 dev->stats.tx_bytes += skb->len;
256 sp_encaps(sp, skb->data, skb->len); 253 sp_encaps(sp, skb->data, skb->len);
257 spin_unlock_bh(&sp->lock); 254 spin_unlock_bh(&sp->lock);
258 255
@@ -298,18 +295,14 @@ static int sp_header(struct sk_buff *skb, struct net_device *dev,
298 return 0; 295 return 0;
299} 296}
300 297
301static struct net_device_stats *sp_get_stats(struct net_device *dev)
302{
303 struct sixpack *sp = netdev_priv(dev);
304 return &sp->stats;
305}
306
307static int sp_set_mac_address(struct net_device *dev, void *addr) 298static int sp_set_mac_address(struct net_device *dev, void *addr)
308{ 299{
309 struct sockaddr_ax25 *sa = addr; 300 struct sockaddr_ax25 *sa = addr;
310 301
311 netif_tx_lock_bh(dev); 302 netif_tx_lock_bh(dev);
303 netif_addr_lock(dev);
312 memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN); 304 memcpy(dev->dev_addr, &sa->sax25_call, AX25_ADDR_LEN);
305 netif_addr_unlock(dev);
313 netif_tx_unlock_bh(dev); 306 netif_tx_unlock_bh(dev);
314 307
315 return 0; 308 return 0;
@@ -338,7 +331,6 @@ static void sp_setup(struct net_device *dev)
338 dev->destructor = free_netdev; 331 dev->destructor = free_netdev;
339 dev->stop = sp_close; 332 dev->stop = sp_close;
340 333
341 dev->get_stats = sp_get_stats;
342 dev->set_mac_address = sp_set_mac_address; 334 dev->set_mac_address = sp_set_mac_address;
343 dev->hard_header_len = AX25_MAX_HEADER_LEN; 335 dev->hard_header_len = AX25_MAX_HEADER_LEN;
344 dev->header_ops = &sp_header_ops; 336 dev->header_ops = &sp_header_ops;
@@ -370,7 +362,7 @@ static void sp_bump(struct sixpack *sp, char cmd)
370 362
371 count = sp->rcount + 1; 363 count = sp->rcount + 1;
372 364
373 sp->stats.rx_bytes += count; 365 sp->dev->stats.rx_bytes += count;
374 366
375 if ((skb = dev_alloc_skb(count)) == NULL) 367 if ((skb = dev_alloc_skb(count)) == NULL)
376 goto out_mem; 368 goto out_mem;
@@ -382,12 +374,12 @@ static void sp_bump(struct sixpack *sp, char cmd)
382 skb->protocol = ax25_type_trans(skb, sp->dev); 374 skb->protocol = ax25_type_trans(skb, sp->dev);
383 netif_rx(skb); 375 netif_rx(skb);
384 sp->dev->last_rx = jiffies; 376 sp->dev->last_rx = jiffies;
385 sp->stats.rx_packets++; 377 sp->dev->stats.rx_packets++;
386 378
387 return; 379 return;
388 380
389out_mem: 381out_mem:
390 sp->stats.rx_dropped++; 382 sp->dev->stats.rx_dropped++;
391} 383}
392 384
393 385
@@ -436,7 +428,7 @@ static void sixpack_write_wakeup(struct tty_struct *tty)
436 if (sp->xleft <= 0) { 428 if (sp->xleft <= 0) {
437 /* Now serial buffer is almost free & we can start 429 /* Now serial buffer is almost free & we can start
438 * transmission of another packet */ 430 * transmission of another packet */
439 sp->stats.tx_packets++; 431 sp->dev->stats.tx_packets++;
440 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 432 clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
441 sp->tx_enable = 0; 433 sp->tx_enable = 0;
442 netif_wake_queue(sp->dev); 434 netif_wake_queue(sp->dev);
@@ -484,7 +476,7 @@ static void sixpack_receive_buf(struct tty_struct *tty,
484 count--; 476 count--;
485 if (fp && *fp++) { 477 if (fp && *fp++) {
486 if (!test_and_set_bit(SIXPF_ERROR, &sp->flags)) 478 if (!test_and_set_bit(SIXPF_ERROR, &sp->flags))
487 sp->stats.rx_errors++; 479 sp->dev->stats.rx_errors++;
488 continue; 480 continue;
489 } 481 }
490 } 482 }