Subject: Re: [RFC] updated Patch to option HSO driver to the kernel

From: Paulius Zaleckas <[email-masked]>
Date: Tue, 22 Apr 2008 11:33:14 +0300

Incremental patch.
- use net_device_stats from dev->stats
--- linux-2.6-hso-my/drivers/net/usb/hso.c.orig	2008-04-21 18:45:43.000000000 +0300
+++ linux-2.6-hso-my/drivers/net/usb/hso.c	2008-04-22 11:16:01.000000000 +0300
@@ -152,7 +152,6 @@ struct hso_shared_int {
 
 struct hso_net {
 	struct hso_device *parent;
-	struct net_device_stats stats;
 	struct net_device *net;
 
 	struct usb_endpoint_descriptor *in_endp;
@@ -712,7 +711,7 @@ static int hso_net_open(struct net_devic
 		return -ENODEV;
 	}
 	/* reset read counter. */
-	odev->stats.rx_packets = 0;
+	odev->net->stats.rx_packets = 0;
 	odev->skb_tx_buf = NULL;
 
 	/* setup environment */
@@ -817,11 +816,11 @@ static int hso_net_start_xmit(struct sk_
 	if (result) {
 		dev_warn(&odev->parent->interface->dev,
 			"failed mux_bulk_tx_urb %d", result);
-		odev->stats.tx_errors++;
+		odev->net->stats.tx_errors++;
 		netif_start_queue(net);
 	} else {
-		odev->stats.tx_packets++;
-		odev->stats.tx_bytes += skb->len;
+		odev->net->stats.tx_packets++;
+		odev->net->stats.tx_bytes += skb->len;
 		/* And tell the kernel when the last transmit started. */
 		net->trans_start = jiffies;
 	}
@@ -846,7 +845,7 @@ static struct ethtool_ops ops = {
 
 static struct net_device_stats *hso_net_get_stats(struct net_device *net)
 {
-	return &((struct hso_net *)netdev_priv(net))->stats;
+	return &net->stats;
 }
 
 /* called when a packet did not ack after watchdogtimeout */
@@ -866,7 +865,7 @@ static void hso_net_tx_timeout(struct ne
 		usb_unlink_urb(odev->mux_bulk_tx_urb);
 
 	/* Update statistics */
-	odev->stats.tx_errors++;
+	odev->net->stats.tx_errors++;
 }
 
 /* make a real packet from the received USB buffer */
@@ -991,11 +990,11 @@ static void packetizeRx(struct hso_net *
 				odev->skb_rx_buf = NULL;
 
 				/* update out statistics */
-				odev->stats.rx_packets++;
+				odev->net->stats.rx_packets++;
 
 				/* Hmmm, wonder if we have received the IP len
 				 * or the ETH len. */
-				odev->stats.rx_bytes += odev->rx_buf_size;
+				odev->net->stats.rx_bytes += odev->rx_buf_size;
 
 				odev->rx_buf_size = 0;
 				odev->rx_buf_missing = sizeof(struct iphdr);