Commit 6ffa770e authored by Tobias Klauser's avatar Tobias Klauser Committed by David S. Miller

usbnet: kaweth: Use net_device_stats from struct net_device

Instead of using a private copy of struct net_device_stats in struct
kaweth_device, use stats from struct net_device. Also remove the now
unnecessary .ndo_get_stats function.

Cc: linux-usb@vger.kernel.org
Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 730826bf
...@@ -245,8 +245,6 @@ struct kaweth_device ...@@ -245,8 +245,6 @@ struct kaweth_device
__u16 packet_filter_bitmap; __u16 packet_filter_bitmap;
struct kaweth_ethernet_configuration configuration; struct kaweth_ethernet_configuration configuration;
struct net_device_stats stats;
}; };
/**************************************************************** /****************************************************************
...@@ -598,7 +596,7 @@ static void kaweth_usb_receive(struct urb *urb) ...@@ -598,7 +596,7 @@ static void kaweth_usb_receive(struct urb *urb)
struct sk_buff *skb; struct sk_buff *skb;
if (unlikely(status == -EPIPE)) { if (unlikely(status == -EPIPE)) {
kaweth->stats.rx_errors++; net->stats.rx_errors++;
kaweth->end = 1; kaweth->end = 1;
wake_up(&kaweth->term_wait); wake_up(&kaweth->term_wait);
dev_dbg(dev, "Status was -EPIPE.\n"); dev_dbg(dev, "Status was -EPIPE.\n");
...@@ -613,12 +611,12 @@ static void kaweth_usb_receive(struct urb *urb) ...@@ -613,12 +611,12 @@ static void kaweth_usb_receive(struct urb *urb)
} }
if (unlikely(status == -EPROTO || status == -ETIME || if (unlikely(status == -EPROTO || status == -ETIME ||
status == -EILSEQ)) { status == -EILSEQ)) {
kaweth->stats.rx_errors++; net->stats.rx_errors++;
dev_dbg(dev, "Status was -EPROTO, -ETIME, or -EILSEQ.\n"); dev_dbg(dev, "Status was -EPROTO, -ETIME, or -EILSEQ.\n");
return; return;
} }
if (unlikely(status == -EOVERFLOW)) { if (unlikely(status == -EOVERFLOW)) {
kaweth->stats.rx_errors++; net->stats.rx_errors++;
dev_dbg(dev, "Status was -EOVERFLOW.\n"); dev_dbg(dev, "Status was -EOVERFLOW.\n");
} }
spin_lock(&kaweth->device_lock); spin_lock(&kaweth->device_lock);
...@@ -663,8 +661,8 @@ static void kaweth_usb_receive(struct urb *urb) ...@@ -663,8 +661,8 @@ static void kaweth_usb_receive(struct urb *urb)
netif_rx(skb); netif_rx(skb);
kaweth->stats.rx_packets++; net->stats.rx_packets++;
kaweth->stats.rx_bytes += pkt_len; net->stats.rx_bytes += pkt_len;
} }
kaweth_resubmit_rx_urb(kaweth, GFP_ATOMIC); kaweth_resubmit_rx_urb(kaweth, GFP_ATOMIC);
...@@ -810,7 +808,7 @@ static netdev_tx_t kaweth_start_xmit(struct sk_buff *skb, ...@@ -810,7 +808,7 @@ static netdev_tx_t kaweth_start_xmit(struct sk_buff *skb,
dev_kfree_skb_irq(skb); dev_kfree_skb_irq(skb);
skb = copied_skb; skb = copied_skb;
if (!copied_skb) { if (!copied_skb) {
kaweth->stats.tx_errors++; net->stats.tx_errors++;
netif_start_queue(net); netif_start_queue(net);
spin_unlock_irq(&kaweth->device_lock); spin_unlock_irq(&kaweth->device_lock);
return NETDEV_TX_OK; return NETDEV_TX_OK;
...@@ -834,15 +832,15 @@ static netdev_tx_t kaweth_start_xmit(struct sk_buff *skb, ...@@ -834,15 +832,15 @@ static netdev_tx_t kaweth_start_xmit(struct sk_buff *skb,
{ {
dev_warn(&net->dev, "kaweth failed tx_urb %d\n", res); dev_warn(&net->dev, "kaweth failed tx_urb %d\n", res);
skip: skip:
kaweth->stats.tx_errors++; net->stats.tx_errors++;
netif_start_queue(net); netif_start_queue(net);
dev_kfree_skb_irq(skb); dev_kfree_skb_irq(skb);
} }
else else
{ {
kaweth->stats.tx_packets++; net->stats.tx_packets++;
kaweth->stats.tx_bytes += skb->len; net->stats.tx_bytes += skb->len;
} }
spin_unlock_irq(&kaweth->device_lock); spin_unlock_irq(&kaweth->device_lock);
...@@ -911,15 +909,6 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth) ...@@ -911,15 +909,6 @@ static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth)
} }
} }
/****************************************************************
* kaweth_netdev_stats
****************************************************************/
static struct net_device_stats *kaweth_netdev_stats(struct net_device *dev)
{
struct kaweth_device *kaweth = netdev_priv(dev);
return &kaweth->stats;
}
/**************************************************************** /****************************************************************
* kaweth_tx_timeout * kaweth_tx_timeout
****************************************************************/ ****************************************************************/
...@@ -928,7 +917,7 @@ static void kaweth_tx_timeout(struct net_device *net) ...@@ -928,7 +917,7 @@ static void kaweth_tx_timeout(struct net_device *net)
struct kaweth_device *kaweth = netdev_priv(net); struct kaweth_device *kaweth = netdev_priv(net);
dev_warn(&net->dev, "%s: Tx timed out. Resetting.\n", net->name); dev_warn(&net->dev, "%s: Tx timed out. Resetting.\n", net->name);
kaweth->stats.tx_errors++; net->stats.tx_errors++;
netif_trans_update(net); netif_trans_update(net);
usb_unlink_urb(kaweth->tx_urb); usb_unlink_urb(kaweth->tx_urb);
...@@ -981,7 +970,6 @@ static const struct net_device_ops kaweth_netdev_ops = { ...@@ -981,7 +970,6 @@ static const struct net_device_ops kaweth_netdev_ops = {
.ndo_start_xmit = kaweth_start_xmit, .ndo_start_xmit = kaweth_start_xmit,
.ndo_tx_timeout = kaweth_tx_timeout, .ndo_tx_timeout = kaweth_tx_timeout,
.ndo_set_rx_mode = kaweth_set_rx_mode, .ndo_set_rx_mode = kaweth_set_rx_mode,
.ndo_get_stats = kaweth_netdev_stats,
.ndo_set_mac_address = eth_mac_addr, .ndo_set_mac_address = eth_mac_addr,
.ndo_validate_addr = eth_validate_addr, .ndo_validate_addr = eth_validate_addr,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment