Skip to content

Commit

Permalink
net: tulip: de2104x: Use net_device_stats from struct net_device
Browse files Browse the repository at this point in the history
Instead of using a private copy of struct net_device_stats in struct
de_private, use stats from struct net_device.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tobias Klauser authored and David S. Miller committed Apr 7, 2017
1 parent e807bcc commit ae9eb1a
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions drivers/net/ethernet/dec/tulip/de2104x.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,6 @@ struct de_private {

u32 msg_enable;

struct net_device_stats net_stats;

struct pci_dev *pdev;

u16 setup_frame[DE_SETUP_FRAME_WORDS];
Expand Down Expand Up @@ -388,14 +386,14 @@ static void de_rx_err_acct (struct de_private *de, unsigned rx_tail,
netif_warn(de, rx_err, de->dev,
"Oversized Ethernet frame spanned multiple buffers, status %08x!\n",
status);
de->net_stats.rx_length_errors++;
de->dev->stats.rx_length_errors++;
}
} else if (status & RxError) {
/* There was a fatal error. */
de->net_stats.rx_errors++; /* end of a packet.*/
if (status & 0x0890) de->net_stats.rx_length_errors++;
if (status & RxErrCRC) de->net_stats.rx_crc_errors++;
if (status & RxErrFIFO) de->net_stats.rx_fifo_errors++;
de->dev->stats.rx_errors++; /* end of a packet.*/
if (status & 0x0890) de->dev->stats.rx_length_errors++;
if (status & RxErrCRC) de->dev->stats.rx_crc_errors++;
if (status & RxErrFIFO) de->dev->stats.rx_fifo_errors++;
}
}

Expand Down Expand Up @@ -423,7 +421,7 @@ static void de_rx (struct de_private *de)
mapping = de->rx_skb[rx_tail].mapping;

if (unlikely(drop)) {
de->net_stats.rx_dropped++;
de->dev->stats.rx_dropped++;
goto rx_next;
}

Expand All @@ -441,7 +439,7 @@ static void de_rx (struct de_private *de)
buflen = copying_skb ? (len + RX_OFFSET) : de->rx_buf_sz;
copy_skb = netdev_alloc_skb(de->dev, buflen);
if (unlikely(!copy_skb)) {
de->net_stats.rx_dropped++;
de->dev->stats.rx_dropped++;
drop = 1;
rx_work = 100;
goto rx_next;
Expand Down Expand Up @@ -470,8 +468,8 @@ static void de_rx (struct de_private *de)

skb->protocol = eth_type_trans (skb, de->dev);

de->net_stats.rx_packets++;
de->net_stats.rx_bytes += skb->len;
de->dev->stats.rx_packets++;
de->dev->stats.rx_bytes += skb->len;
rc = netif_rx (skb);
if (rc == NET_RX_DROP)
drop = 1;
Expand Down Expand Up @@ -572,18 +570,18 @@ static void de_tx (struct de_private *de)
netif_dbg(de, tx_err, de->dev,
"tx err, status 0x%x\n",
status);
de->net_stats.tx_errors++;
de->dev->stats.tx_errors++;
if (status & TxOWC)
de->net_stats.tx_window_errors++;
de->dev->stats.tx_window_errors++;
if (status & TxMaxCol)
de->net_stats.tx_aborted_errors++;
de->dev->stats.tx_aborted_errors++;
if (status & TxLinkFail)
de->net_stats.tx_carrier_errors++;
de->dev->stats.tx_carrier_errors++;
if (status & TxFIFOUnder)
de->net_stats.tx_fifo_errors++;
de->dev->stats.tx_fifo_errors++;
} else {
de->net_stats.tx_packets++;
de->net_stats.tx_bytes += skb->len;
de->dev->stats.tx_packets++;
de->dev->stats.tx_bytes += skb->len;
netif_dbg(de, tx_done, de->dev,
"tx done, slot %d\n", tx_tail);
}
Expand Down Expand Up @@ -814,9 +812,9 @@ static void de_set_rx_mode (struct net_device *dev)
static inline void de_rx_missed(struct de_private *de, u32 rx_missed)
{
if (unlikely(rx_missed & RxMissedOver))
de->net_stats.rx_missed_errors += RxMissedMask;
de->dev->stats.rx_missed_errors += RxMissedMask;
else
de->net_stats.rx_missed_errors += (rx_missed & RxMissedMask);
de->dev->stats.rx_missed_errors += (rx_missed & RxMissedMask);
}

static void __de_get_stats(struct de_private *de)
Expand All @@ -836,7 +834,7 @@ static struct net_device_stats *de_get_stats(struct net_device *dev)
__de_get_stats(de);
spin_unlock_irq(&de->lock);

return &de->net_stats;
return &dev->stats;
}

static inline int de_is_running (struct de_private *de)
Expand Down Expand Up @@ -1348,7 +1346,7 @@ static void de_clean_rings (struct de_private *de)
struct sk_buff *skb = de->tx_skb[i].skb;
if ((skb) && (skb != DE_DUMMY_SKB)) {
if (skb != DE_SETUP_SKB) {
de->net_stats.tx_dropped++;
de->dev->stats.tx_dropped++;
pci_unmap_single(de->pdev,
de->tx_skb[i].mapping,
skb->len, PCI_DMA_TODEVICE);
Expand Down

0 comments on commit ae9eb1a

Please sign in to comment.