diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2017-04-07 04:17:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-04-07 10:03:33 -0400 |
commit | 0ffa9373a06c65e32a05d35656b2260857d1e5ce (patch) | |
tree | 5da6554578013281b2fa699cab698c11f0ce1225 | |
parent | b09a9537c9925cc89815620b0bba773154edcad7 (diff) |
net: sunbmac: Use net_device_stats from struct net_device
Instead of using a private copy of struct net_device_stats in struct
bigmac, use stats from struct net_device.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/sun/sunbmac.c | 18 | ||||
-rw-r--r-- | drivers/net/ethernet/sun/sunbmac.h | 1 |
2 files changed, 9 insertions, 10 deletions
diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c index c4caf486cbef..3189722110c2 100644 --- a/drivers/net/ethernet/sun/sunbmac.c +++ b/drivers/net/ethernet/sun/sunbmac.c | |||
@@ -169,7 +169,7 @@ static void bigmac_stop(struct bigmac *bp) | |||
169 | 169 | ||
170 | static void bigmac_get_counters(struct bigmac *bp, void __iomem *bregs) | 170 | static void bigmac_get_counters(struct bigmac *bp, void __iomem *bregs) |
171 | { | 171 | { |
172 | struct net_device_stats *stats = &bp->enet_stats; | 172 | struct net_device_stats *stats = &bp->dev->stats; |
173 | 173 | ||
174 | stats->rx_crc_errors += sbus_readl(bregs + BMAC_RCRCECTR); | 174 | stats->rx_crc_errors += sbus_readl(bregs + BMAC_RCRCECTR); |
175 | sbus_writel(0, bregs + BMAC_RCRCECTR); | 175 | sbus_writel(0, bregs + BMAC_RCRCECTR); |
@@ -774,8 +774,8 @@ static void bigmac_tx(struct bigmac *bp) | |||
774 | if (this->tx_flags & TXD_OWN) | 774 | if (this->tx_flags & TXD_OWN) |
775 | break; | 775 | break; |
776 | skb = bp->tx_skbs[elem]; | 776 | skb = bp->tx_skbs[elem]; |
777 | bp->enet_stats.tx_packets++; | 777 | dev->stats.tx_packets++; |
778 | bp->enet_stats.tx_bytes += skb->len; | 778 | dev->stats.tx_bytes += skb->len; |
779 | dma_unmap_single(&bp->bigmac_op->dev, | 779 | dma_unmap_single(&bp->bigmac_op->dev, |
780 | this->tx_addr, skb->len, | 780 | this->tx_addr, skb->len, |
781 | DMA_TO_DEVICE); | 781 | DMA_TO_DEVICE); |
@@ -811,12 +811,12 @@ static void bigmac_rx(struct bigmac *bp) | |||
811 | 811 | ||
812 | /* Check for errors. */ | 812 | /* Check for errors. */ |
813 | if (len < ETH_ZLEN) { | 813 | if (len < ETH_ZLEN) { |
814 | bp->enet_stats.rx_errors++; | 814 | bp->dev->stats.rx_errors++; |
815 | bp->enet_stats.rx_length_errors++; | 815 | bp->dev->stats.rx_length_errors++; |
816 | 816 | ||
817 | drop_it: | 817 | drop_it: |
818 | /* Return it to the BigMAC. */ | 818 | /* Return it to the BigMAC. */ |
819 | bp->enet_stats.rx_dropped++; | 819 | bp->dev->stats.rx_dropped++; |
820 | this->rx_flags = | 820 | this->rx_flags = |
821 | (RXD_OWN | ((RX_BUF_ALLOC_SIZE - 34) & RXD_LENGTH)); | 821 | (RXD_OWN | ((RX_BUF_ALLOC_SIZE - 34) & RXD_LENGTH)); |
822 | goto next; | 822 | goto next; |
@@ -875,8 +875,8 @@ static void bigmac_rx(struct bigmac *bp) | |||
875 | /* No checksums done by the BigMAC ;-( */ | 875 | /* No checksums done by the BigMAC ;-( */ |
876 | skb->protocol = eth_type_trans(skb, bp->dev); | 876 | skb->protocol = eth_type_trans(skb, bp->dev); |
877 | netif_rx(skb); | 877 | netif_rx(skb); |
878 | bp->enet_stats.rx_packets++; | 878 | bp->dev->stats.rx_packets++; |
879 | bp->enet_stats.rx_bytes += len; | 879 | bp->dev->stats.rx_bytes += len; |
880 | next: | 880 | next: |
881 | elem = NEXT_RX(elem); | 881 | elem = NEXT_RX(elem); |
882 | this = &rxbase[elem]; | 882 | this = &rxbase[elem]; |
@@ -987,7 +987,7 @@ static struct net_device_stats *bigmac_get_stats(struct net_device *dev) | |||
987 | struct bigmac *bp = netdev_priv(dev); | 987 | struct bigmac *bp = netdev_priv(dev); |
988 | 988 | ||
989 | bigmac_get_counters(bp, bp->bregs); | 989 | bigmac_get_counters(bp, bp->bregs); |
990 | return &bp->enet_stats; | 990 | return &dev->stats; |
991 | } | 991 | } |
992 | 992 | ||
993 | static void bigmac_set_multicast(struct net_device *dev) | 993 | static void bigmac_set_multicast(struct net_device *dev) |
diff --git a/drivers/net/ethernet/sun/sunbmac.h b/drivers/net/ethernet/sun/sunbmac.h index 532fc56830cf..ee56930475a8 100644 --- a/drivers/net/ethernet/sun/sunbmac.h +++ b/drivers/net/ethernet/sun/sunbmac.h | |||
@@ -311,7 +311,6 @@ struct bigmac { | |||
311 | enum bigmac_timer_state timer_state; | 311 | enum bigmac_timer_state timer_state; |
312 | unsigned int timer_ticks; | 312 | unsigned int timer_ticks; |
313 | 313 | ||
314 | struct net_device_stats enet_stats; | ||
315 | struct platform_device *qec_op; | 314 | struct platform_device *qec_op; |
316 | struct platform_device *bigmac_op; | 315 | struct platform_device *bigmac_op; |
317 | struct net_device *dev; | 316 | struct net_device *dev; |