Skip to content

Commit 82d8293

Browse files
tklauserdavem330
authored andcommitted
usbnet: pegasus: Use net_device_stats from struct net_device
Instead of using a private copy of struct net_device_stats in struct pegasus, use stats from struct net_device. Also remove the now unnecessary .ndo_get_stats function. Cc: Petko Manolov <[email protected]> Cc: [email protected] Signed-off-by: Tobias Klauser <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6ffa770 commit 82d8293

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

drivers/net/usb/pegasus.c

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -501,13 +501,13 @@ static void read_bulk_callback(struct urb *urb)
501501
if (rx_status & 0x1e) {
502502
netif_dbg(pegasus, rx_err, net,
503503
"RX packet error %x\n", rx_status);
504-
pegasus->stats.rx_errors++;
504+
net->stats.rx_errors++;
505505
if (rx_status & 0x06) /* long or runt */
506-
pegasus->stats.rx_length_errors++;
506+
net->stats.rx_length_errors++;
507507
if (rx_status & 0x08)
508-
pegasus->stats.rx_crc_errors++;
508+
net->stats.rx_crc_errors++;
509509
if (rx_status & 0x10) /* extra bits */
510-
pegasus->stats.rx_frame_errors++;
510+
net->stats.rx_frame_errors++;
511511
goto goon;
512512
}
513513
if (pegasus->chip == 0x8513) {
@@ -535,8 +535,8 @@ static void read_bulk_callback(struct urb *urb)
535535
skb_put(pegasus->rx_skb, pkt_len);
536536
pegasus->rx_skb->protocol = eth_type_trans(pegasus->rx_skb, net);
537537
netif_rx(pegasus->rx_skb);
538-
pegasus->stats.rx_packets++;
539-
pegasus->stats.rx_bytes += pkt_len;
538+
net->stats.rx_packets++;
539+
net->stats.rx_bytes += pkt_len;
540540

541541
if (pegasus->flags & PEGASUS_UNPLUG)
542542
return;
@@ -670,13 +670,13 @@ static void intr_callback(struct urb *urb)
670670
/* byte 0 == tx_status1, reg 2B */
671671
if (d[0] & (TX_UNDERRUN|EXCESSIVE_COL
672672
|LATE_COL|JABBER_TIMEOUT)) {
673-
pegasus->stats.tx_errors++;
673+
net->stats.tx_errors++;
674674
if (d[0] & TX_UNDERRUN)
675-
pegasus->stats.tx_fifo_errors++;
675+
net->stats.tx_fifo_errors++;
676676
if (d[0] & (EXCESSIVE_COL | JABBER_TIMEOUT))
677-
pegasus->stats.tx_aborted_errors++;
677+
net->stats.tx_aborted_errors++;
678678
if (d[0] & LATE_COL)
679-
pegasus->stats.tx_window_errors++;
679+
net->stats.tx_window_errors++;
680680
}
681681

682682
/* d[5].LINK_STATUS lies on some adapters.
@@ -685,7 +685,7 @@ static void intr_callback(struct urb *urb)
685685
*/
686686

687687
/* bytes 3-4 == rx_lostpkt, reg 2E/2F */
688-
pegasus->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4];
688+
net->stats.rx_missed_errors += ((d[3] & 0x7f) << 8) | d[4];
689689
}
690690

691691
res = usb_submit_urb(urb, GFP_ATOMIC);
@@ -701,7 +701,7 @@ static void pegasus_tx_timeout(struct net_device *net)
701701
pegasus_t *pegasus = netdev_priv(net);
702702
netif_warn(pegasus, timer, net, "tx timeout\n");
703703
usb_unlink_urb(pegasus->tx_urb);
704-
pegasus->stats.tx_errors++;
704+
net->stats.tx_errors++;
705705
}
706706

707707
static netdev_tx_t pegasus_start_xmit(struct sk_buff *skb,
@@ -731,23 +731,18 @@ static netdev_tx_t pegasus_start_xmit(struct sk_buff *skb,
731731
netif_device_detach(pegasus->net);
732732
break;
733733
default:
734-
pegasus->stats.tx_errors++;
734+
net->stats.tx_errors++;
735735
netif_start_queue(net);
736736
}
737737
} else {
738-
pegasus->stats.tx_packets++;
739-
pegasus->stats.tx_bytes += skb->len;
738+
net->stats.tx_packets++;
739+
net->stats.tx_bytes += skb->len;
740740
}
741741
dev_kfree_skb(skb);
742742

743743
return NETDEV_TX_OK;
744744
}
745745

746-
static struct net_device_stats *pegasus_netdev_stats(struct net_device *dev)
747-
{
748-
return &((pegasus_t *) netdev_priv(dev))->stats;
749-
}
750-
751746
static inline void disable_net_traffic(pegasus_t *pegasus)
752747
{
753748
__le16 tmp = cpu_to_le16(0);
@@ -1294,7 +1289,6 @@ static const struct net_device_ops pegasus_netdev_ops = {
12941289
.ndo_do_ioctl = pegasus_ioctl,
12951290
.ndo_start_xmit = pegasus_start_xmit,
12961291
.ndo_set_rx_mode = pegasus_set_multicast,
1297-
.ndo_get_stats = pegasus_netdev_stats,
12981292
.ndo_tx_timeout = pegasus_tx_timeout,
12991293
.ndo_set_mac_address = eth_mac_addr,
13001294
.ndo_validate_addr = eth_validate_addr,

drivers/net/usb/pegasus.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ typedef struct pegasus {
8383
struct usb_device *usb;
8484
struct usb_interface *intf;
8585
struct net_device *net;
86-
struct net_device_stats stats;
8786
struct mii_if_info mii;
8887
unsigned flags;
8988
unsigned features;

0 commit comments

Comments
 (0)