Skip to content

Commit

Permalink
staging: et131x: Use net_device_stats from struct net_device
Browse files Browse the repository at this point in the history
Instead of using an own copy of struct net_device_stats in struct
et131x_adapter, use stats from struct net_device.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
tklauser authored and gregkh committed Jul 9, 2014
1 parent 11306d1 commit 1f765d9
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions drivers/staging/et131x/et131x.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,6 @@ struct et131x_adapter {

/* Stats */
struct ce_stats stats;

struct net_device_stats net_stats;
};

static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status)
Expand Down Expand Up @@ -2618,7 +2616,7 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter)
return NULL;
}

adapter->net_stats.rx_bytes += rfd->len;
adapter->netdev->stats.rx_bytes += rfd->len;

memcpy(skb_put(skb, rfd->len), fbr->virt[buff_index], rfd->len);

Expand Down Expand Up @@ -2666,7 +2664,7 @@ static void et131x_handle_recv_interrupt(struct et131x_adapter *adapter)
continue;

/* Increment the number of packets we received */
adapter->net_stats.rx_packets++;
adapter->netdev->stats.rx_packets++;

/* Set the status on the packet, either resources or success */
if (rx_ring->num_ready_recv < RFD_LOW_WATER_MARK)
Expand Down Expand Up @@ -3037,7 +3035,7 @@ static int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
dev_kfree_skb_any(skb);
skb = NULL;

adapter->net_stats.tx_dropped++;
adapter->netdev->stats.tx_dropped++;
} else {
status = send_packet(skb, adapter);
if (status != 0 && status != -ENOMEM) {
Expand All @@ -3046,7 +3044,7 @@ static int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
*/
dev_kfree_skb_any(skb);
skb = NULL;
adapter->net_stats.tx_dropped++;
adapter->netdev->stats.tx_dropped++;
}
}
}
Expand All @@ -3065,7 +3063,7 @@ static inline void free_send_packet(struct et131x_adapter *adapter,
{
unsigned long flags;
struct tx_desc *desc = NULL;
struct net_device_stats *stats = &adapter->net_stats;
struct net_device_stats *stats = &adapter->netdev->stats;
struct tx_ring *tx_ring = &adapter->tx_ring;
u64 dma_addr;

Expand Down Expand Up @@ -3110,7 +3108,7 @@ static inline void free_send_packet(struct et131x_adapter *adapter,
/* Add the TCB to the Ready Q */
spin_lock_irqsave(&adapter->tcb_ready_qlock, flags);

adapter->net_stats.tx_packets++;
stats->tx_packets++;

if (tx_ring->tcb_qtail)
tx_ring->tcb_qtail->next = tcb;
Expand Down Expand Up @@ -4134,7 +4132,7 @@ static void et131x_isr_handler(struct work_struct *work)
static struct net_device_stats *et131x_stats(struct net_device *netdev)
{
struct et131x_adapter *adapter = netdev_priv(netdev);
struct net_device_stats *stats = &adapter->net_stats;
struct net_device_stats *stats = &adapter->netdev->stats;
struct ce_stats *devstat = &adapter->stats;

stats->rx_errors = devstat->rx_length_errs +
Expand Down Expand Up @@ -4426,7 +4424,7 @@ static void et131x_tx_timeout(struct net_device *netdev)
tcb->index,
tcb->flags);

adapter->net_stats.tx_errors++;
adapter->netdev->stats.tx_errors++;

/* perform reset of tx/rx */
et131x_disable_txrx(netdev);
Expand Down

0 comments on commit 1f765d9

Please sign in to comment.