diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2010-07-04 22:59:38 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-05 22:41:12 -0400 |
commit | 0a17ee90a16ddf6b410bc1a8a28a7e875dc08f8d (patch) | |
tree | a7891a621e99631b61a1d65d4f8ebc20fcff737f /drivers/net/ioc3-eth.c | |
parent | 4e922723589926214c789df05384483a9530d66d (diff) |
ioc3-eth: Use the instance of net_device_stats from net_device.
Since net_device has an instance of net_device_stats, we can remove the
instance of this from the adapter structure.
Based on original patch by Kulikov Vasiliy.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
drivers/net/ioc3-eth.c | 49 ++++++++++++++++++++++++-----------------------
1 files changed, 25 insertions(+), 24 deletions(-)
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ioc3-eth.c')
-rw-r--r-- | drivers/net/ioc3-eth.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index e3b5e9490601..0b3f6df5cff7 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c | |||
@@ -82,7 +82,6 @@ struct ioc3_private { | |||
82 | struct ioc3_etxd *txr; | 82 | struct ioc3_etxd *txr; |
83 | struct sk_buff *rx_skbs[512]; | 83 | struct sk_buff *rx_skbs[512]; |
84 | struct sk_buff *tx_skbs[128]; | 84 | struct sk_buff *tx_skbs[128]; |
85 | struct net_device_stats stats; | ||
86 | int rx_ci; /* RX consumer index */ | 85 | int rx_ci; /* RX consumer index */ |
87 | int rx_pi; /* RX producer index */ | 86 | int rx_pi; /* RX producer index */ |
88 | int tx_ci; /* TX consumer index */ | 87 | int tx_ci; /* TX consumer index */ |
@@ -504,8 +503,8 @@ static struct net_device_stats *ioc3_get_stats(struct net_device *dev) | |||
504 | struct ioc3_private *ip = netdev_priv(dev); | 503 | struct ioc3_private *ip = netdev_priv(dev); |
505 | struct ioc3 *ioc3 = ip->regs; | 504 | struct ioc3 *ioc3 = ip->regs; |
506 | 505 | ||
507 | ip->stats.collisions += (ioc3_r_etcdc() & ETCDC_COLLCNT_MASK); | 506 | dev->stats.collisions += (ioc3_r_etcdc() & ETCDC_COLLCNT_MASK); |
508 | return &ip->stats; | 507 | return &dev->stats; |
509 | } | 508 | } |
510 | 509 | ||
511 | static void ioc3_tcpudp_checksum(struct sk_buff *skb, uint32_t hwsum, int len) | 510 | static void ioc3_tcpudp_checksum(struct sk_buff *skb, uint32_t hwsum, int len) |
@@ -576,8 +575,9 @@ static void ioc3_tcpudp_checksum(struct sk_buff *skb, uint32_t hwsum, int len) | |||
576 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 575 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
577 | } | 576 | } |
578 | 577 | ||
579 | static inline void ioc3_rx(struct ioc3_private *ip) | 578 | static inline void ioc3_rx(struct net_device *dev) |
580 | { | 579 | { |
580 | struct ioc3_private *ip = netdev_priv(dev); | ||
581 | struct sk_buff *skb, *new_skb; | 581 | struct sk_buff *skb, *new_skb; |
582 | struct ioc3 *ioc3 = ip->regs; | 582 | struct ioc3 *ioc3 = ip->regs; |
583 | int rx_entry, n_entry, len; | 583 | int rx_entry, n_entry, len; |
@@ -598,13 +598,13 @@ static inline void ioc3_rx(struct ioc3_private *ip) | |||
598 | if (err & ERXBUF_GOODPKT) { | 598 | if (err & ERXBUF_GOODPKT) { |
599 | len = ((w0 >> ERXBUF_BYTECNT_SHIFT) & 0x7ff) - 4; | 599 | len = ((w0 >> ERXBUF_BYTECNT_SHIFT) & 0x7ff) - 4; |
600 | skb_trim(skb, len); | 600 | skb_trim(skb, len); |
601 | skb->protocol = eth_type_trans(skb, priv_netdev(ip)); | 601 | skb->protocol = eth_type_trans(skb, dev); |
602 | 602 | ||
603 | new_skb = ioc3_alloc_skb(RX_BUF_ALLOC_SIZE, GFP_ATOMIC); | 603 | new_skb = ioc3_alloc_skb(RX_BUF_ALLOC_SIZE, GFP_ATOMIC); |
604 | if (!new_skb) { | 604 | if (!new_skb) { |
605 | /* Ouch, drop packet and just recycle packet | 605 | /* Ouch, drop packet and just recycle packet |
606 | to keep the ring filled. */ | 606 | to keep the ring filled. */ |
607 | ip->stats.rx_dropped++; | 607 | dev->stats.rx_dropped++; |
608 | new_skb = skb; | 608 | new_skb = skb; |
609 | goto next; | 609 | goto next; |
610 | } | 610 | } |
@@ -622,19 +622,19 @@ static inline void ioc3_rx(struct ioc3_private *ip) | |||
622 | rxb = (struct ioc3_erxbuf *) new_skb->data; | 622 | rxb = (struct ioc3_erxbuf *) new_skb->data; |
623 | skb_reserve(new_skb, RX_OFFSET); | 623 | skb_reserve(new_skb, RX_OFFSET); |
624 | 624 | ||
625 | ip->stats.rx_packets++; /* Statistics */ | 625 | dev->stats.rx_packets++; /* Statistics */ |
626 | ip->stats.rx_bytes += len; | 626 | dev->stats.rx_bytes += len; |
627 | } else { | 627 | } else { |
628 | /* The frame is invalid and the skb never | 628 | /* The frame is invalid and the skb never |
629 | reached the network layer so we can just | 629 | reached the network layer so we can just |
630 | recycle it. */ | 630 | recycle it. */ |
631 | new_skb = skb; | 631 | new_skb = skb; |
632 | ip->stats.rx_errors++; | 632 | dev->stats.rx_errors++; |
633 | } | 633 | } |
634 | if (err & ERXBUF_CRCERR) /* Statistics */ | 634 | if (err & ERXBUF_CRCERR) /* Statistics */ |
635 | ip->stats.rx_crc_errors++; | 635 | dev->stats.rx_crc_errors++; |
636 | if (err & ERXBUF_FRAMERR) | 636 | if (err & ERXBUF_FRAMERR) |
637 | ip->stats.rx_frame_errors++; | 637 | dev->stats.rx_frame_errors++; |
638 | next: | 638 | next: |
639 | ip->rx_skbs[n_entry] = new_skb; | 639 | ip->rx_skbs[n_entry] = new_skb; |
640 | rxr[n_entry] = cpu_to_be64(ioc3_map(rxb, 1)); | 640 | rxr[n_entry] = cpu_to_be64(ioc3_map(rxb, 1)); |
@@ -652,8 +652,9 @@ next: | |||
652 | ip->rx_ci = rx_entry; | 652 | ip->rx_ci = rx_entry; |
653 | } | 653 | } |
654 | 654 | ||
655 | static inline void ioc3_tx(struct ioc3_private *ip) | 655 | static inline void ioc3_tx(struct net_device *dev) |
656 | { | 656 | { |
657 | struct ioc3_private *ip = netdev_priv(dev); | ||
657 | unsigned long packets, bytes; | 658 | unsigned long packets, bytes; |
658 | struct ioc3 *ioc3 = ip->regs; | 659 | struct ioc3 *ioc3 = ip->regs; |
659 | int tx_entry, o_entry; | 660 | int tx_entry, o_entry; |
@@ -681,12 +682,12 @@ static inline void ioc3_tx(struct ioc3_private *ip) | |||
681 | tx_entry = (etcir >> 7) & 127; | 682 | tx_entry = (etcir >> 7) & 127; |
682 | } | 683 | } |
683 | 684 | ||
684 | ip->stats.tx_packets += packets; | 685 | dev->stats.tx_packets += packets; |
685 | ip->stats.tx_bytes += bytes; | 686 | dev->stats.tx_bytes += bytes; |
686 | ip->txqlen -= packets; | 687 | ip->txqlen -= packets; |
687 | 688 | ||
688 | if (ip->txqlen < 128) | 689 | if (ip->txqlen < 128) |
689 | netif_wake_queue(priv_netdev(ip)); | 690 | netif_wake_queue(dev); |
690 | 691 | ||
691 | ip->tx_ci = o_entry; | 692 | ip->tx_ci = o_entry; |
692 | spin_unlock(&ip->ioc3_lock); | 693 | spin_unlock(&ip->ioc3_lock); |
@@ -699,9 +700,9 @@ static inline void ioc3_tx(struct ioc3_private *ip) | |||
699 | * with such error interrupts if something really goes wrong, so we might | 700 | * with such error interrupts if something really goes wrong, so we might |
700 | * also consider to take the interface down. | 701 | * also consider to take the interface down. |
701 | */ | 702 | */ |
702 | static void ioc3_error(struct ioc3_private *ip, u32 eisr) | 703 | static void ioc3_error(struct net_device *dev, u32 eisr) |
703 | { | 704 | { |
704 | struct net_device *dev = priv_netdev(ip); | 705 | struct ioc3_private *ip = netdev_priv(dev); |
705 | unsigned char *iface = dev->name; | 706 | unsigned char *iface = dev->name; |
706 | 707 | ||
707 | spin_lock(&ip->ioc3_lock); | 708 | spin_lock(&ip->ioc3_lock); |
@@ -747,11 +748,11 @@ static irqreturn_t ioc3_interrupt(int irq, void *_dev) | |||
747 | 748 | ||
748 | if (eisr & (EISR_RXOFLO | EISR_RXBUFOFLO | EISR_RXMEMERR | | 749 | if (eisr & (EISR_RXOFLO | EISR_RXBUFOFLO | EISR_RXMEMERR | |
749 | EISR_RXPARERR | EISR_TXBUFUFLO | EISR_TXMEMERR)) | 750 | EISR_RXPARERR | EISR_TXBUFUFLO | EISR_TXMEMERR)) |
750 | ioc3_error(ip, eisr); | 751 | ioc3_error(dev, eisr); |
751 | if (eisr & EISR_RXTIMERINT) | 752 | if (eisr & EISR_RXTIMERINT) |
752 | ioc3_rx(ip); | 753 | ioc3_rx(dev); |
753 | if (eisr & EISR_TXEXPLICIT) | 754 | if (eisr & EISR_TXEXPLICIT) |
754 | ioc3_tx(ip); | 755 | ioc3_tx(dev); |
755 | 756 | ||
756 | return IRQ_HANDLED; | 757 | return IRQ_HANDLED; |
757 | } | 758 | } |