netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 00/45] Another batch of network device conversions
@ 2009-01-09 23:00 Stephen Hemminger
  2009-01-09 23:00 ` [patch 01/45] atm: br2684 internal stats Stephen Hemminger
                   ` (45 more replies)
  0 siblings, 46 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:00 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

That's all for this week.
Compile tested on x86 only.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 01/45] atm: br2684 internal stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
@ 2009-01-09 23:00 ` Stephen Hemminger
  2009-01-09 23:00 ` [patch 02/45] br2684: convert to net_device_ops Stephen Hemminger
                   ` (44 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:00 UTC (permalink / raw)
  To: David Miller, Chas Williams; +Cc: netdev

[-- Attachment #1: br2684-stats.patch --]
[-- Type: text/plain, Size: 3952 bytes --]

Now that stats are in net_device, use them.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/net/atm/br2684.c	2009-01-08 17:22:18.000000000 -0800
+++ b/net/atm/br2684.c	2009-01-08 23:20:52.000000000 -0800
@@ -83,7 +83,6 @@ struct br2684_dev {
 	struct list_head br2684_devs;
 	int number;
 	struct list_head brvccs;	/* one device <=> one vcc (before xmas) */
-	struct net_device_stats stats;
 	int mac_was_set;
 	enum br2684_payload payload;
 };
@@ -148,9 +147,10 @@ static struct net_device *br2684_find_de
  * the way for multiple vcc's per itf.  Returns true if we can send,
  * otherwise false
  */
-static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
+static int br2684_xmit_vcc(struct sk_buff *skb, struct net_device *dev,
 			   struct br2684_vcc *brvcc)
 {
+	struct br2684_dev *brdev = BRPRIV(dev);
 	struct atm_vcc *atmvcc;
 	int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2;
 
@@ -211,8 +211,8 @@ static int br2684_xmit_vcc(struct sk_buf
 	}
 	atomic_add(skb->truesize, &sk_atm(atmvcc)->sk_wmem_alloc);
 	ATM_SKB(skb)->atm_options = atmvcc->atm_options;
-	brdev->stats.tx_packets++;
-	brdev->stats.tx_bytes += skb->len;
+	dev->stats.tx_packets++;
+	dev->stats.tx_bytes += skb->len;
 	atmvcc->send(atmvcc, skb);
 	return 1;
 }
@@ -233,14 +233,14 @@ static int br2684_start_xmit(struct sk_b
 	brvcc = pick_outgoing_vcc(skb, brdev);
 	if (brvcc == NULL) {
 		pr_debug("no vcc attached to dev %s\n", dev->name);
-		brdev->stats.tx_errors++;
-		brdev->stats.tx_carrier_errors++;
+		dev->stats.tx_errors++;
+		dev->stats.tx_carrier_errors++;
 		/* netif_stop_queue(dev); */
 		dev_kfree_skb(skb);
 		read_unlock(&devs_lock);
 		return 0;
 	}
-	if (!br2684_xmit_vcc(skb, brdev, brvcc)) {
+	if (!br2684_xmit_vcc(skb, dev, brvcc)) {
 		/*
 		 * We should probably use netif_*_queue() here, but that
 		 * involves added complication.  We need to walk before
@@ -248,19 +248,13 @@ static int br2684_start_xmit(struct sk_b
 		 *
 		 * Don't free here! this pointer might be no longer valid!
 		 */
-		brdev->stats.tx_errors++;
-		brdev->stats.tx_fifo_errors++;
+		dev->stats.tx_errors++;
+		dev->stats.tx_fifo_errors++;
 	}
 	read_unlock(&devs_lock);
 	return 0;
 }
 
-static struct net_device_stats *br2684_get_stats(struct net_device *dev)
-{
-	pr_debug("br2684_get_stats\n");
-	return &BRPRIV(dev)->stats;
-}
-
 /*
  * We remember when the MAC gets set, so we don't override it later with
  * the ESI of the ATM card of the first VC
@@ -430,17 +424,17 @@ static void br2684_push(struct atm_vcc *
 	/* sigh, interface is down? */
 	if (unlikely(!(net_dev->flags & IFF_UP)))
 		goto dropped;
-	brdev->stats.rx_packets++;
-	brdev->stats.rx_bytes += skb->len;
+	net_dev->stats.rx_packets++;
+	net_dev->stats.rx_bytes += skb->len;
 	memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
 	netif_rx(skb);
 	return;
 
 dropped:
-	brdev->stats.rx_dropped++;
+	net_dev->stats.rx_dropped++;
 	goto free_skb;
 error:
-	brdev->stats.rx_errors++;
+	net_dev->stats.rx_errors++;
 free_skb:
 	dev_kfree_skb(skb);
 	return;
@@ -531,8 +525,8 @@ static int br2684_regvcc(struct atm_vcc 
 
 		skb->next = skb->prev = NULL;
 		br2684_push(atmvcc, skb);
-		BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
-		BRPRIV(skb->dev)->stats.rx_packets--;
+		skb->dev->stats.rx_bytes -= skb->len;
+		skb->dev->stats.rx_packets--;
 
 		skb = next;
 	}
@@ -554,7 +548,6 @@ static void br2684_setup(struct net_devi
 	my_eth_mac_addr = netdev->set_mac_address;
 	netdev->set_mac_address = br2684_mac_addr;
 	netdev->hard_start_xmit = br2684_start_xmit;
-	netdev->get_stats = br2684_get_stats;
 
 	INIT_LIST_HEAD(&brdev->brvccs);
 }
@@ -568,7 +561,6 @@ static void br2684_setup_routed(struct n
 	my_eth_mac_addr = netdev->set_mac_address;
 	netdev->set_mac_address = br2684_mac_addr;
 	netdev->hard_start_xmit = br2684_start_xmit;
-	netdev->get_stats = br2684_get_stats;
 	netdev->addr_len = 0;
 	netdev->mtu = 1500;
 	netdev->type = ARPHRD_PPP;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 02/45] br2684: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
  2009-01-09 23:00 ` [patch 01/45] atm: br2684 internal stats Stephen Hemminger
@ 2009-01-09 23:00 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 03/45] clip: convert to internal network_device_stats Stephen Hemminger
                   ` (43 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:00 UTC (permalink / raw)
  To: David Miller, Chas Williams; +Cc: netdev

[-- Attachment #1: br2684-netdev-ops.patch --]
[-- Type: text/plain, Size: 1678 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/net/atm/br2684.c	2009-01-08 23:20:52.000000000 -0800
+++ b/net/atm/br2684.c	2009-01-08 23:29:33.000000000 -0800
@@ -259,10 +259,9 @@ static int br2684_start_xmit(struct sk_b
  * We remember when the MAC gets set, so we don't override it later with
  * the ESI of the ATM card of the first VC
  */
-static int (*my_eth_mac_addr) (struct net_device *, void *);
 static int br2684_mac_addr(struct net_device *dev, void *p)
 {
-	int err = my_eth_mac_addr(dev, p);
+	int err = eth_mac_addr(dev, p);
 	if (!err)
 		BRPRIV(dev)->mac_was_set = 1;
 	return err;
@@ -538,16 +537,20 @@ static int br2684_regvcc(struct atm_vcc 
 	return err;
 }
 
+static const struct net_device_ops br2684_netdev_ops = {
+	.ndo_start_xmit 	= br2684_start_xmit,
+	.ndo_set_mac_address	= br2684_mac_addr,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_validate_addr	= eth_validate_addr,
+};
+
 static void br2684_setup(struct net_device *netdev)
 {
 	struct br2684_dev *brdev = BRPRIV(netdev);
 
 	ether_setup(netdev);
-	brdev->net_dev = netdev;
 
-	my_eth_mac_addr = netdev->set_mac_address;
-	netdev->set_mac_address = br2684_mac_addr;
-	netdev->hard_start_xmit = br2684_start_xmit;
+	netdev->netdev_ops = &br2684_netdev_ops;
 
 	INIT_LIST_HEAD(&brdev->brvccs);
 }
@@ -558,9 +561,8 @@ static void br2684_setup_routed(struct n
 	brdev->net_dev = netdev;
 
 	netdev->hard_header_len = 0;
-	my_eth_mac_addr = netdev->set_mac_address;
-	netdev->set_mac_address = br2684_mac_addr;
-	netdev->hard_start_xmit = br2684_start_xmit;
+
+	netdev->netdev_ops = &br2684_netdev_ops;
 	netdev->addr_len = 0;
 	netdev->mtu = 1500;
 	netdev->type = ARPHRD_PPP;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 03/45] clip: convert to internal network_device_stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
  2009-01-09 23:00 ` [patch 01/45] atm: br2684 internal stats Stephen Hemminger
  2009-01-09 23:00 ` [patch 02/45] br2684: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 04/45] lec: " Stephen Hemminger
                   ` (42 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, Chas Williams; +Cc: netdev

[-- Attachment #1: clip_stats.patch --]
[-- Type: text/plain, Size: 3541 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


---
 include/net/atmclip.h |    1 -
 net/atm/clip.c        |   30 ++++++++++++------------------
 2 files changed, 12 insertions(+), 19 deletions(-)

--- a/include/net/atmclip.h	2009-01-08 23:29:07.000000000 -0800
+++ b/include/net/atmclip.h	2009-01-08 23:29:47.000000000 -0800
@@ -50,7 +50,6 @@ struct atmarp_entry {
 struct clip_priv {
 	int number;			/* for convenience ... */
 	spinlock_t xoff_lock;		/* ensures that pop is atomic (SMP) */
-	struct net_device_stats stats;
 	struct net_device *next;	/* next CLIP interface */
 };
 
--- a/net/atm/clip.c	2009-01-08 23:29:07.000000000 -0800
+++ b/net/atm/clip.c	2009-01-08 23:29:47.000000000 -0800
@@ -214,15 +214,15 @@ static void clip_push(struct atm_vcc *vc
 		skb->protocol = ((__be16 *) skb->data)[3];
 		skb_pull(skb, RFC1483LLC_LEN);
 		if (skb->protocol == htons(ETH_P_ARP)) {
-			PRIV(skb->dev)->stats.rx_packets++;
-			PRIV(skb->dev)->stats.rx_bytes += skb->len;
+			skb->dev->stats.rx_packets++;
+			skb->dev->stats.rx_bytes += skb->len;
 			clip_arp_rcv(skb);
 			return;
 		}
 	}
 	clip_vcc->last_use = jiffies;
-	PRIV(skb->dev)->stats.rx_packets++;
-	PRIV(skb->dev)->stats.rx_bytes += skb->len;
+	skb->dev->stats.rx_packets++;
+	skb->dev->stats.rx_bytes += skb->len;
 	memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
 	netif_rx(skb);
 }
@@ -372,7 +372,7 @@ static int clip_start_xmit(struct sk_buf
 	if (!skb->dst) {
 		printk(KERN_ERR "clip_start_xmit: skb->dst == NULL\n");
 		dev_kfree_skb(skb);
-		clip_priv->stats.tx_dropped++;
+		dev->stats.tx_dropped++;
 		return 0;
 	}
 	if (!skb->dst->neighbour) {
@@ -380,13 +380,13 @@ static int clip_start_xmit(struct sk_buf
 		skb->dst->neighbour = clip_find_neighbour(skb->dst, 1);
 		if (!skb->dst->neighbour) {
 			dev_kfree_skb(skb);	/* lost that one */
-			clip_priv->stats.tx_dropped++;
+			dev->stats.tx_dropped++;
 			return 0;
 		}
 #endif
 		printk(KERN_ERR "clip_start_xmit: NO NEIGHBOUR !\n");
 		dev_kfree_skb(skb);
-		clip_priv->stats.tx_dropped++;
+		dev->stats.tx_dropped++;
 		return 0;
 	}
 	entry = NEIGH2ENTRY(skb->dst->neighbour);
@@ -400,7 +400,7 @@ static int clip_start_xmit(struct sk_buf
 			skb_queue_tail(&entry->neigh->arp_queue, skb);
 		else {
 			dev_kfree_skb(skb);
-			clip_priv->stats.tx_dropped++;
+			dev->stats.tx_dropped++;
 		}
 		return 0;
 	}
@@ -423,8 +423,8 @@ static int clip_start_xmit(struct sk_buf
 		printk(KERN_WARNING "clip_start_xmit: XOFF->XOFF transition\n");
 		return 0;
 	}
-	clip_priv->stats.tx_packets++;
-	clip_priv->stats.tx_bytes += skb->len;
+	dev->stats.tx_packets++;
+	dev->stats.tx_bytes += skb->len;
 	vcc->send(vcc, skb);
 	if (atm_may_send(vcc, 0)) {
 		entry->vccs->xoff = 0;
@@ -443,11 +443,6 @@ static int clip_start_xmit(struct sk_buf
 	return 0;
 }
 
-static struct net_device_stats *clip_get_stats(struct net_device *dev)
-{
-	return &PRIV(dev)->stats;
-}
-
 static int clip_mkip(struct atm_vcc *vcc, int timeout)
 {
 	struct clip_vcc *clip_vcc;
@@ -501,8 +496,8 @@ static int clip_mkip(struct atm_vcc *vcc
 
 			skb_get(skb);
 			clip_push(vcc, skb);
-			PRIV(skb->dev)->stats.rx_packets--;
-			PRIV(skb->dev)->stats.rx_bytes -= len;
+			skb->dev->stats.rx_packets--;
+			skb->dev->stats.rx_bytes -= len;
 			kfree_skb(skb);
 		}
 
@@ -561,7 +556,6 @@ static void clip_setup(struct net_device
 {
 	dev->hard_start_xmit = clip_start_xmit;
 	/* sg_xmit ... */
-	dev->get_stats = clip_get_stats;
 	dev->type = ARPHRD_ATM;
 	dev->hard_header_len = RFC1483LLC_LEN;
 	dev->mtu = RFC1626_MTU;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 04/45] lec: convert to internal network_device_stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (2 preceding siblings ...)
  2009-01-09 23:01 ` [patch 03/45] clip: convert to internal network_device_stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 05/45] lec: convert to net_device_ops Stephen Hemminger
                   ` (41 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, Chas Williams; +Cc: netdev

[-- Attachment #1: lec-stats.patch --]
[-- Type: text/plain, Size: 4764 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


---
 net/atm/lec.c |   44 +++++++++++++++++---------------------------
 net/atm/lec.h |    1 -
 2 files changed, 17 insertions(+), 28 deletions(-)

--- a/net/atm/lec.h	2009-01-09 10:14:04.000000000 -0800
+++ b/net/atm/lec.h	2009-01-09 10:15:14.000000000 -0800
@@ -69,7 +69,6 @@ struct lane2_ops {
 #define LEC_ARP_TABLE_SIZE 16
 
 struct lec_priv {
-	struct net_device_stats stats;
 	unsigned short lecid;			/* Lecid of this client */
 	struct hlist_head lec_arp_empty_ones;
 						/* Used for storing VCC's that don't have a MAC address attached yet */
--- a/net/atm/lec.c	2009-01-09 10:14:04.000000000 -0800
+++ b/net/atm/lec.c	2009-01-09 10:15:14.000000000 -0800
@@ -62,7 +62,6 @@ static unsigned char bridge_ula_lec[] = 
 static int lec_open(struct net_device *dev);
 static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev);
 static int lec_close(struct net_device *dev);
-static struct net_device_stats *lec_get_stats(struct net_device *dev);
 static void lec_init(struct net_device *dev);
 static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
 					  const unsigned char *mac_addr);
@@ -218,28 +217,28 @@ static unsigned char *get_tr_dst(unsigne
 
 static int lec_open(struct net_device *dev)
 {
-	struct lec_priv *priv = netdev_priv(dev);
-
 	netif_start_queue(dev);
-	memset(&priv->stats, 0, sizeof(struct net_device_stats));
+	memset(&dev->stats, 0, sizeof(struct net_device_stats));
 
 	return 0;
 }
 
-static __inline__ void
-lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv)
+static void
+lec_send(struct atm_vcc *vcc, struct sk_buff *skb)
 {
+	struct net_device *dev = skb->dev;
+
 	ATM_SKB(skb)->vcc = vcc;
 	ATM_SKB(skb)->atm_options = vcc->atm_options;
 
 	atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
 	if (vcc->send(vcc, skb) < 0) {
-		priv->stats.tx_dropped++;
+		dev->stats.tx_dropped++;
 		return;
 	}
 
-	priv->stats.tx_packets++;
-	priv->stats.tx_bytes += skb->len;
+	dev->stats.tx_packets++;
+	dev->stats.tx_bytes += skb->len;
 }
 
 static void lec_tx_timeout(struct net_device *dev)
@@ -270,7 +269,7 @@ static int lec_start_xmit(struct sk_buff
 	pr_debug("lec_start_xmit called\n");
 	if (!priv->lecd) {
 		printk("%s:No lecd attached\n", dev->name);
-		priv->stats.tx_errors++;
+		dev->stats.tx_errors++;
 		netif_stop_queue(dev);
 		return -EUNATCH;
 	}
@@ -345,7 +344,7 @@ static int lec_start_xmit(struct sk_buff
 					       GFP_ATOMIC);
 			dev_kfree_skb(skb);
 			if (skb2 == NULL) {
-				priv->stats.tx_dropped++;
+				dev->stats.tx_dropped++;
 				return 0;
 			}
 			skb = skb2;
@@ -380,7 +379,7 @@ static int lec_start_xmit(struct sk_buff
 			    ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ",
 			     dev->name);
 			pr_debug("MAC address %pM\n", lec_h->h_dest);
-			priv->stats.tx_dropped++;
+			dev->stats.tx_dropped++;
 			dev_kfree_skb(skb);
 		}
 		goto out;
@@ -392,10 +391,10 @@ static int lec_start_xmit(struct sk_buff
 	while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) {
 		pr_debug("lec.c: emptying tx queue, ");
 		pr_debug("MAC address %pM\n", lec_h->h_dest);
-		lec_send(vcc, skb2, priv);
+		lec_send(vcc, skb2);
 	}
 
-	lec_send(vcc, skb, priv);
+	lec_send(vcc, skb);
 
 	if (!atm_may_send(vcc, 0)) {
 		struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc);
@@ -427,15 +426,6 @@ static int lec_close(struct net_device *
 	return 0;
 }
 
-/*
- * Get the current statistics.
- * This may be called with the card open or closed.
- */
-static struct net_device_stats *lec_get_stats(struct net_device *dev)
-{
-	return &((struct lec_priv *)netdev_priv(dev))->stats;
-}
-
 static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
 {
 	unsigned long flags;
@@ -810,8 +800,8 @@ static void lec_push(struct atm_vcc *vcc
 		else
 #endif
 			skb->protocol = eth_type_trans(skb, dev);
-		priv->stats.rx_packets++;
-		priv->stats.rx_bytes += skb->len;
+		dev->stats.rx_packets++;
+		dev->stats.rx_bytes += skb->len;
 		memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
 		netif_rx(skb);
 	}
@@ -1887,7 +1877,7 @@ restart:
 					lec_arp_hold(entry);
 					spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
 					while ((skb = skb_dequeue(&entry->tx_wait)) != NULL)
-						lec_send(vcc, skb, entry->priv);
+						lec_send(vcc, skb);
 					entry->last_used = jiffies;
 					entry->status = ESI_FORWARD_DIRECT;
 					lec_arp_put(entry);
@@ -2305,7 +2295,7 @@ restart:
 				lec_arp_hold(entry);
 				spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
 				while ((skb = skb_dequeue(&entry->tx_wait)) != NULL)
-					lec_send(vcc, skb, entry->priv);
+					lec_send(vcc, skb);
 				entry->last_used = jiffies;
 				entry->status = ESI_FORWARD_DIRECT;
 				lec_arp_put(entry);



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 05/45] lec: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (3 preceding siblings ...)
  2009-01-09 23:01 ` [patch 04/45] lec: " Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 06/45] netrom: convert to internal net_device_stats Stephen Hemminger
                   ` (40 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, Chas Williams; +Cc: netdev

[-- Attachment #1: lec-netdev.patch --]
[-- Type: text/plain, Size: 1033 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 net/atm/lec.c |   20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

--- a/net/atm/lec.c	2009-01-09 10:15:14.000000000 -0800
+++ b/net/atm/lec.c	2009-01-09 10:15:23.000000000 -0800
@@ -667,17 +667,19 @@ static void lec_set_multicast_list(struc
 	return;
 }
 
+static const struct net_device_ops lec_netdev_ops = {
+	.ndo_open		= lec_open,
+	.ndo_stop		= lec_close,
+	.ndo_start_xmit		= lec_start_xmit,
+	.ndo_change_mtu		= lec_change_mtu,
+	.ndo_tx_timeout		= lec_tx_timeout,
+	.ndo_set_multicast_list	= lec_set_multicast_list,
+};
+
+
 static void lec_init(struct net_device *dev)
 {
-	dev->change_mtu = lec_change_mtu;
-	dev->open = lec_open;
-	dev->stop = lec_close;
-	dev->hard_start_xmit = lec_start_xmit;
-	dev->tx_timeout = lec_tx_timeout;
-
-	dev->get_stats = lec_get_stats;
-	dev->set_multicast_list = lec_set_multicast_list;
-	dev->do_ioctl = NULL;
+	dev->netdev_ops = &lec_netdev_ops;
 	printk("%s: Initialized!\n", dev->name);
 }
 



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 06/45] netrom: convert to internal net_device_stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (4 preceding siblings ...)
  2009-01-09 23:01 ` [patch 05/45] lec: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-10 12:54   ` Ralf Baechle DL5RB
  2009-01-09 23:01 ` [patch 07/45] netrom: convert to net_device_ops Stephen Hemminger
                   ` (39 subsequent siblings)
  45 siblings, 1 reply; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, Ralf Baechle; +Cc: netdev, linux-hams

[-- Attachment #1: netrom-stats.patch --]
[-- Type: text/plain, Size: 2331 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 include/net/netrom.h   |    4 ----
 net/netrom/af_netrom.c |    2 +-
 net/netrom/nr_dev.c    |   14 ++------------
 3 files changed, 3 insertions(+), 17 deletions(-)

--- a/net/netrom/af_netrom.c	2009-01-09 13:37:29.000000000 -0800
+++ b/net/netrom/af_netrom.c	2009-01-09 13:37:46.000000000 -0800
@@ -1432,7 +1432,7 @@ static int __init nr_proto_init(void)
 		struct net_device *dev;
 
 		sprintf(name, "nr%d", i);
-		dev = alloc_netdev(sizeof(struct nr_private), name, nr_setup);
+		dev = alloc_netdev(0, name, nr_setup);
 		if (!dev) {
 			printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n");
 			goto fail;
--- a/include/net/netrom.h	2009-01-09 13:37:29.000000000 -0800
+++ b/include/net/netrom.h	2009-01-09 13:37:31.000000000 -0800
@@ -59,10 +59,6 @@ enum {
 #define NR_MAX_WINDOW_SIZE		127			/* Maximum Window Allowable - 127 */
 #define	NR_MAX_PACKET_SIZE		236			/* Maximum Packet Length - 236 */
 
-struct nr_private {
-	struct net_device_stats	stats;
-};
-
 struct nr_sock {
 	struct sock		sock;
 	ax25_address		user_addr, source_addr, dest_addr;
--- a/net/netrom/nr_dev.c	2009-01-09 13:37:29.000000000 -0800
+++ b/net/netrom/nr_dev.c	2009-01-09 13:52:57.000000000 -0800
@@ -42,7 +42,7 @@
 
 int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
 {
-	struct net_device_stats *stats = netdev_priv(dev);
+	struct net_device_stats *stats = &dev->stats;
 
 	if (!netif_running(dev)) {
 		stats->rx_dropped++;
@@ -171,8 +171,7 @@ static int nr_close(struct net_device *d
 
 static int nr_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct nr_private *nr = netdev_priv(dev);
-	struct net_device_stats *stats = &nr->stats;
+	struct net_device_stats *stats = &dev->stats;
 	unsigned int len = skb->len;
 
 	if (!nr_route_frame(skb, NULL)) {
@@ -187,13 +186,6 @@ static int nr_xmit(struct sk_buff *skb, 
 	return 0;
 }
 
-static struct net_device_stats *nr_get_stats(struct net_device *dev)
-{
-	struct nr_private *nr = netdev_priv(dev);
-
-	return &nr->stats;
-}
-
 static const struct header_ops nr_header_ops = {
 	.create	= nr_header,
 	.rebuild= nr_rebuild_header,
@@ -215,6 +207,4 @@ void nr_setup(struct net_device *dev)
 
 	/* New-style flags. */
 	dev->flags		= IFF_NOARP;
-
-	dev->get_stats 		= nr_get_stats;
 }



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 07/45] netrom: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (5 preceding siblings ...)
  2009-01-09 23:01 ` [patch 06/45] netrom: convert to internal net_device_stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-10 12:55   ` Ralf Baechle DL5RB
  2009-01-09 23:01 ` [patch 08/45] rose: convert to internal net_device_stats Stephen Hemminger
                   ` (38 subsequent siblings)
  45 siblings, 1 reply; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, Ralf Baechle; +Cc: netdev, linux-hams

[-- Attachment #1: netrom-netdev.patch --]
[-- Type: text/plain, Size: 1119 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 include/net/netrom.h   |    4 ----
 net/netrom/af_netrom.c |    4 ++--
 net/netrom/nr_dev.c    |   26 +++++++++-----------------
 3 files changed, 11 insertions(+), 23 deletions(-)

--- a/net/netrom/nr_dev.c	2009-01-09 13:35:18.000000000 -0800
+++ b/net/netrom/nr_dev.c	2009-01-09 13:36:18.000000000 -0800
@@ -191,19 +191,21 @@ static const struct header_ops nr_header
 	.rebuild= nr_rebuild_header,
 };
 
+static const struct net_device_ops nr_netdev_ops = {
+	.ndo_open		= nr_open,
+	.ndo_stop		= nr_close,
+	.ndo_start_xmit		= nr_xmit,
+	.ndo_set_mac_address    = nr_set_mac_address,
+};
 
 void nr_setup(struct net_device *dev)
 {
 	dev->mtu		= NR_MAX_PACKET_SIZE;
-	dev->hard_start_xmit	= nr_xmit;
-	dev->open		= nr_open;
-	dev->stop		= nr_close;
-
+	dev->netdev_ops		= &nr_netdev_ops;
 	dev->header_ops		= &nr_header_ops;
 	dev->hard_header_len	= NR_NETWORK_LEN + NR_TRANSPORT_LEN;
 	dev->addr_len		= AX25_ADDR_LEN;
 	dev->type		= ARPHRD_NETROM;
-	dev->set_mac_address    = nr_set_mac_address;
 
 	/* New-style flags. */
 	dev->flags		= IFF_NOARP;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 08/45] rose: convert to internal net_device_stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (6 preceding siblings ...)
  2009-01-09 23:01 ` [patch 07/45] netrom: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-10 12:55   ` Ralf Baechle DL5RB
  2009-01-09 23:01 ` [patch 09/45] rose: convert to network_device_ops Stephen Hemminger
                   ` (37 subsequent siblings)
  45 siblings, 1 reply; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, Ralf Baechle; +Cc: netdev, linux-hams

[-- Attachment #1: rose-stats.patch --]
[-- Type: text/plain, Size: 1756 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/net/rose/af_rose.c	2009-01-09 13:39:17.000000000 -0800
+++ b/net/rose/af_rose.c	2009-01-09 13:39:34.000000000 -0800
@@ -1587,8 +1587,7 @@ static int __init rose_proto_init(void)
 		char name[IFNAMSIZ];
 
 		sprintf(name, "rose%d", i);
-		dev = alloc_netdev(sizeof(struct net_device_stats),
-				   name, rose_setup);
+		dev = alloc_netdev(0, name, rose_setup);
 		if (!dev) {
 			printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n");
 			rc = -ENOMEM;
--- a/net/rose/rose_dev.c	2009-01-09 13:39:17.000000000 -0800
+++ b/net/rose/rose_dev.c	2009-01-09 13:52:51.000000000 -0800
@@ -57,7 +57,7 @@ static int rose_rebuild_header(struct sk
 {
 #ifdef CONFIG_INET
 	struct net_device *dev = skb->dev;
-	struct net_device_stats *stats = netdev_priv(dev);
+	struct net_device_stats *stats = &dev->stats;
 	unsigned char *bp = (unsigned char *)skb->data;
 	struct sk_buff *skbn;
 	unsigned int len;
@@ -133,7 +133,7 @@ static int rose_close(struct net_device 
 
 static int rose_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-	struct net_device_stats *stats = netdev_priv(dev);
+	struct net_device_stats *stats = &dev->stats;
 
 	if (!netif_running(dev)) {
 		printk(KERN_ERR "ROSE: rose_xmit - called when iface is down\n");
@@ -144,11 +144,6 @@ static int rose_xmit(struct sk_buff *skb
 	return 0;
 }
 
-static struct net_device_stats *rose_get_stats(struct net_device *dev)
-{
-	return netdev_priv(dev);
-}
-
 static const struct header_ops rose_header_ops = {
 	.create	= rose_header,
 	.rebuild= rose_rebuild_header,
@@ -169,5 +164,4 @@ void rose_setup(struct net_device *dev)
 
 	/* New-style flags. */
 	dev->flags		= IFF_NOARP;
-	dev->get_stats = rose_get_stats;
 }



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 09/45] rose: convert to network_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (7 preceding siblings ...)
  2009-01-09 23:01 ` [patch 08/45] rose: convert to internal net_device_stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-10 12:55   ` Ralf Baechle DL5RB
  2009-01-09 23:01 ` [patch 10/45] appletalk: remove unneeded stubs Stephen Hemminger
                   ` (36 subsequent siblings)
  45 siblings, 1 reply; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, Ralf Baechle; +Cc: netdev, linux-hams

[-- Attachment #1: rose-netdev.patch --]
[-- Type: text/plain, Size: 986 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/net/rose/rose_dev.c	2009-01-09 13:39:57.000000000 -0800
+++ b/net/rose/rose_dev.c	2009-01-09 13:40:29.000000000 -0800
@@ -149,18 +149,22 @@ static const struct header_ops rose_head
 	.rebuild= rose_rebuild_header,
 };
 
+static const struct net_device_ops rose_netdev_ops = {
+	.ndo_open		= rose_open,
+	.ndo_stop		= rose_close,
+	.ndo_start_xmit		= rose_xmit,
+	.ndo_set_mac_address    = rose_set_mac_address,
+};
+
 void rose_setup(struct net_device *dev)
 {
 	dev->mtu		= ROSE_MAX_PACKET_SIZE - 2;
-	dev->hard_start_xmit	= rose_xmit;
-	dev->open		= rose_open;
-	dev->stop		= rose_close;
+	dev->netdev_ops		= &rose_netdev_ops;
 
 	dev->header_ops		= &rose_header_ops;
 	dev->hard_header_len	= AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN;
 	dev->addr_len		= ROSE_ADDR_LEN;
 	dev->type		= ARPHRD_ROSE;
-	dev->set_mac_address    = rose_set_mac_address;
 
 	/* New-style flags. */
 	dev->flags		= IFF_NOARP;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 10/45] appletalk: remove unneeded stubs
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (8 preceding siblings ...)
  2009-01-09 23:01 ` [patch 09/45] rose: convert to network_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 11/45] arcnet: convert to internal stats Stephen Hemminger
                   ` (35 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, Arnaldo Carvalho de Melo; +Cc: netdev

[-- Attachment #1: atalk-dev.patch --]
[-- Type: text/plain, Size: 985 bytes --]

With net_device_ops if set_mac_address is null, then error
is -EOPNOTSUPPORTED.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


---
 net/appletalk/dev.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

--- a/net/appletalk/dev.c	2009-01-08 10:18:09.643260397 -0800
+++ b/net/appletalk/dev.c	2009-01-08 10:18:59.546256496 -0800
@@ -9,22 +9,20 @@
 #include <linux/if_arp.h>
 #include <linux/if_ltalk.h>
 
+#ifdef CONFIG_COMPAT_NET_DEV_OPS
 static int ltalk_change_mtu(struct net_device *dev, int mtu)
 {
 	return -EINVAL;
 }
-
-static int ltalk_mac_addr(struct net_device *dev, void *addr)
-{
-	return -EINVAL;
-}
+#endif
 
 static void ltalk_setup(struct net_device *dev)
 {
 	/* Fill in the fields of the device structure with localtalk-generic values. */
 
+#ifdef CONFIG_COMPAT_NET_DEV_OPS
 	dev->change_mtu		= ltalk_change_mtu;
-	dev->set_mac_address 	= ltalk_mac_addr;
+#endif
 
 	dev->type		= ARPHRD_LOCALTLK;
 	dev->hard_header_len 	= LTALK_HLEN;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 11/45] arcnet: convert to internal stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (9 preceding siblings ...)
  2009-01-09 23:01 ` [patch 10/45] appletalk: remove unneeded stubs Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 12/45] arcnet: convert to net_device_ops Stephen Hemminger
                   ` (34 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: arcnet-stats.patch --]
[-- Type: text/plain, Size: 12556 bytes --]

Use pre-existing network_device_stats inside network_device rather than own
private structure.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


---
 drivers/net/arcnet/arc-rawmode.c |    2 -
 drivers/net/arcnet/arcnet.c      |   38 +++++++++----------------------
 drivers/net/arcnet/capmode.c     |    2 -
 drivers/net/arcnet/rfc1051.c     |   12 ++++-----
 drivers/net/arcnet/rfc1201.c     |   47 +++++++++++++++++++--------------------
 include/linux/arcdevice.h        |    2 -
 6 files changed, 42 insertions(+), 61 deletions(-)

--- a/drivers/net/arcnet/arc-rawmode.c	2009-01-09 09:40:52.000000000 -0800
+++ b/drivers/net/arcnet/arc-rawmode.c	2009-01-09 09:41:04.000000000 -0800
@@ -102,7 +102,7 @@ static void rx(struct net_device *dev, i
 	skb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
 	if (skb == NULL) {
 		BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
-		lp->stats.rx_dropped++;
+		dev->stats.rx_dropped++;
 		return;
 	}
 	skb_put(skb, length + ARC_HDR_SIZE);
--- a/drivers/net/arcnet/arcnet.c	2009-01-09 09:40:52.000000000 -0800
+++ b/drivers/net/arcnet/arcnet.c	2009-01-09 09:41:04.000000000 -0800
@@ -105,7 +105,6 @@ static int arcnet_header(struct sk_buff 
 			 unsigned short type, const void *daddr,
 			 const void *saddr, unsigned len);
 static int arcnet_rebuild_header(struct sk_buff *skb);
-static struct net_device_stats *arcnet_get_stats(struct net_device *dev);
 static int go_tx(struct net_device *dev);
 
 static int debug = ARCNET_DEBUG;
@@ -347,7 +346,6 @@ static void arcdev_setup(struct net_devi
 	dev->stop = arcnet_close;
 	dev->hard_start_xmit = arcnet_send_packet;
 	dev->tx_timeout = arcnet_timeout;
-	dev->get_stats = arcnet_get_stats;
 }
 
 struct net_device *alloc_arcdev(char *name)
@@ -583,8 +581,8 @@ static int arcnet_rebuild_header(struct 
 	} else {
 		BUGMSG(D_NORMAL,
 		       "I don't understand ethernet protocol %Xh addresses!\n", type);
-		lp->stats.tx_errors++;
-		lp->stats.tx_aborted_errors++;
+		dev->stats.tx_errors++;
+		dev->stats.tx_aborted_errors++;
 	}
 
 	/* if we couldn't resolve the address... give up. */
@@ -645,7 +643,7 @@ static int arcnet_send_packet(struct sk_
 		    !proto->ack_tx) {
 			/* done right away and we don't want to acknowledge
 			   the package later - forget about it now */
-			lp->stats.tx_bytes += skb->len;
+			dev->stats.tx_bytes += skb->len;
 			freeskb = 1;
 		} else {
 			/* do it the 'split' way */
@@ -709,7 +707,7 @@ static int go_tx(struct net_device *dev)
 	/* start sending */
 	ACOMMAND(TXcmd | (lp->cur_tx << 3));
 
-	lp->stats.tx_packets++;
+	dev->stats.tx_packets++;
 	lp->lasttrans_dest = lp->lastload_dest;
 	lp->lastload_dest = 0;
 	lp->excnak_pending = 0;
@@ -732,11 +730,11 @@ static void arcnet_timeout(struct net_de
 		msg = " - missed IRQ?";
 	} else {
 		msg = "";
-		lp->stats.tx_aborted_errors++;
+		dev->stats.tx_aborted_errors++;
 		lp->timed_out = 1;
 		ACOMMAND(NOTXcmd | (lp->cur_tx << 3));
 	}
-	lp->stats.tx_errors++;
+	dev->stats.tx_errors++;
 
 	/* make sure we didn't miss a TX or a EXC NAK IRQ */
 	AINTMASK(0);
@@ -865,8 +863,8 @@ irqreturn_t arcnet_interrupt(int irq, vo
 						       "transmit was not acknowledged! "
 						       "(status=%Xh, dest=%02Xh)\n",
 						       status, lp->lasttrans_dest);
-						lp->stats.tx_errors++;
-						lp->stats.tx_carrier_errors++;
+						dev->stats.tx_errors++;
+						dev->stats.tx_carrier_errors++;
 					} else {
 						BUGMSG(D_DURING,
 						       "broadcast was not acknowledged; that's normal "
@@ -905,7 +903,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
 				if (txbuf != -1) {
 					if (lp->outgoing.proto->continue_tx(dev, txbuf)) {
 						/* that was the last segment */
-						lp->stats.tx_bytes += lp->outgoing.skb->len;
+						dev->stats.tx_bytes += lp->outgoing.skb->len;
 						if(!lp->outgoing.proto->ack_tx)
 						  {
 						    dev_kfree_skb_irq(lp->outgoing.skb);
@@ -930,7 +928,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
 		}
 		if (status & lp->intmask & RECONflag) {
 			ACOMMAND(CFLAGScmd | CONFIGclear);
-			lp->stats.tx_carrier_errors++;
+			dev->stats.tx_carrier_errors++;
 
 			BUGMSG(D_RECON, "Network reconfiguration detected (status=%Xh)\n",
 			       status);
@@ -1038,8 +1036,8 @@ static void arcnet_rx(struct net_device 
 	       "(%d+4 bytes)\n",
 	       bufnum, pkt.hard.source, pkt.hard.dest, length);
 
-	lp->stats.rx_packets++;
-	lp->stats.rx_bytes += length + ARC_HDR_SIZE;
+	dev->stats.rx_packets++;
+	dev->stats.rx_bytes += length + ARC_HDR_SIZE;
 
 	/* call the right receiver for the protocol */
 	if (arc_proto_map[soft->proto]->is_ip) {
@@ -1067,18 +1065,6 @@ static void arcnet_rx(struct net_device 
 }
 
 
-
-/* 
- * Get the current statistics.  This may be called with the card open or
- * closed.
- */
-static struct net_device_stats *arcnet_get_stats(struct net_device *dev)
-{
-	struct arcnet_local *lp = netdev_priv(dev);
-	return &lp->stats;
-}
-
-
 static void null_rx(struct net_device *dev, int bufnum,
 		    struct archdr *pkthdr, int length)
 {
--- a/drivers/net/arcnet/capmode.c	2009-01-09 09:40:52.000000000 -0800
+++ b/drivers/net/arcnet/capmode.c	2009-01-09 09:41:04.000000000 -0800
@@ -119,7 +119,7 @@ static void rx(struct net_device *dev, i
 	skb = alloc_skb(length + ARC_HDR_SIZE + sizeof(int), GFP_ATOMIC);
 	if (skb == NULL) {
 		BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
-		lp->stats.rx_dropped++;
+		dev->stats.rx_dropped++;
 		return;
 	}
 	skb_put(skb, length + ARC_HDR_SIZE + sizeof(int));
--- a/drivers/net/arcnet/rfc1051.c	2009-01-09 09:40:52.000000000 -0800
+++ b/drivers/net/arcnet/rfc1051.c	2009-01-09 09:44:53.000000000 -0800
@@ -88,7 +88,6 @@ MODULE_LICENSE("GPL");
  */
 static __be16 type_trans(struct sk_buff *skb, struct net_device *dev)
 {
-	struct arcnet_local *lp = netdev_priv(dev);
 	struct archdr *pkt = (struct archdr *) skb->data;
 	struct arc_rfc1051 *soft = &pkt->soft.rfc1051;
 	int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE;
@@ -112,8 +111,8 @@ static __be16 type_trans(struct sk_buff 
 		return htons(ETH_P_ARP);
 
 	default:
-		lp->stats.rx_errors++;
-		lp->stats.rx_crc_errors++;
+		dev->stats.rx_errors++;
+		dev->stats.rx_crc_errors++;
 		return 0;
 	}
 
@@ -140,7 +139,7 @@ static void rx(struct net_device *dev, i
 	skb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
 	if (skb == NULL) {
 		BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
-		lp->stats.rx_dropped++;
+		dev->stats.rx_dropped++;
 		return;
 	}
 	skb_put(skb, length + ARC_HDR_SIZE);
@@ -168,7 +167,6 @@ static void rx(struct net_device *dev, i
 static int build_header(struct sk_buff *skb, struct net_device *dev,
 			unsigned short type, uint8_t daddr)
 {
-	struct arcnet_local *lp = netdev_priv(dev);
 	int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE;
 	struct archdr *pkt = (struct archdr *) skb_push(skb, hdr_size);
 	struct arc_rfc1051 *soft = &pkt->soft.rfc1051;
@@ -184,8 +182,8 @@ static int build_header(struct sk_buff *
 	default:
 		BUGMSG(D_NORMAL, "RFC1051: I don't understand protocol %d (%Xh)\n",
 		       type, type);
-		lp->stats.tx_errors++;
-		lp->stats.tx_aborted_errors++;
+		dev->stats.tx_errors++;
+		dev->stats.tx_aborted_errors++;
 		return 0;
 	}
 
--- a/drivers/net/arcnet/rfc1201.c	2009-01-09 09:40:52.000000000 -0800
+++ b/drivers/net/arcnet/rfc1201.c	2009-01-09 09:41:04.000000000 -0800
@@ -92,7 +92,6 @@ static __be16 type_trans(struct sk_buff 
 {
 	struct archdr *pkt = (struct archdr *) skb->data;
 	struct arc_rfc1201 *soft = &pkt->soft.rfc1201;
-	struct arcnet_local *lp = netdev_priv(dev);
 	int hdr_size = ARC_HDR_SIZE + RFC1201_HDR_SIZE;
 
 	/* Pull off the arcnet header. */
@@ -121,8 +120,8 @@ static __be16 type_trans(struct sk_buff 
 	case ARC_P_NOVELL_EC:
 		return htons(ETH_P_802_3);
 	default:
-		lp->stats.rx_errors++;
-		lp->stats.rx_crc_errors++;
+		dev->stats.rx_errors++;
+		dev->stats.rx_crc_errors++;
 		return 0;
 	}
 
@@ -172,8 +171,8 @@ static void rx(struct net_device *dev, i
 			 in->sequence, soft->split_flag, soft->sequence);
 			lp->rfc1201.aborted_seq = soft->sequence;
 			dev_kfree_skb_irq(in->skb);
-			lp->stats.rx_errors++;
-			lp->stats.rx_missed_errors++;
+			dev->stats.rx_errors++;
+			dev->stats.rx_missed_errors++;
 			in->skb = NULL;
 		}
 		in->sequence = soft->sequence;
@@ -181,7 +180,7 @@ static void rx(struct net_device *dev, i
 		skb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
 		if (skb == NULL) {
 			BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
-			lp->stats.rx_dropped++;
+			dev->stats.rx_dropped++;
 			return;
 		}
 		skb_put(skb, length + ARC_HDR_SIZE);
@@ -213,7 +212,7 @@ static void rx(struct net_device *dev, i
 					BUGMSG(D_EXTRA,
 					       "ARP source address was 00h, set to %02Xh.\n",
 					       saddr);
-					lp->stats.rx_crc_errors++;
+					dev->stats.rx_crc_errors++;
 					*cptr = saddr;
 				} else {
 					BUGMSG(D_DURING, "ARP source address (%Xh) is fine.\n",
@@ -222,8 +221,8 @@ static void rx(struct net_device *dev, i
 			} else {
 				BUGMSG(D_NORMAL, "funny-shaped ARP packet. (%Xh, %Xh)\n",
 				       arp->ar_hln, arp->ar_pln);
-				lp->stats.rx_errors++;
-				lp->stats.rx_crc_errors++;
+				dev->stats.rx_errors++;
+				dev->stats.rx_crc_errors++;
 			}
 		}
 		BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx");
@@ -257,8 +256,8 @@ static void rx(struct net_device *dev, i
 			       soft->split_flag);
 			dev_kfree_skb_irq(in->skb);
 			in->skb = NULL;
-			lp->stats.rx_errors++;
-			lp->stats.rx_missed_errors++;
+			dev->stats.rx_errors++;
+			dev->stats.rx_missed_errors++;
 			in->lastpacket = in->numpackets = 0;
 		}
 		if (soft->split_flag & 1) {	/* first packet in split */
@@ -269,8 +268,8 @@ static void rx(struct net_device *dev, i
 				       "(splitflag=%d, seq=%d)\n",
 				       in->sequence, soft->split_flag,
 				       soft->sequence);
-				lp->stats.rx_errors++;
-				lp->stats.rx_missed_errors++;
+				dev->stats.rx_errors++;
+				dev->stats.rx_missed_errors++;
 				dev_kfree_skb_irq(in->skb);
 			}
 			in->sequence = soft->sequence;
@@ -281,8 +280,8 @@ static void rx(struct net_device *dev, i
 				BUGMSG(D_EXTRA, "incoming packet more than 16 segments; dropping. (splitflag=%d)\n",
 				       soft->split_flag);
 				lp->rfc1201.aborted_seq = soft->sequence;
-				lp->stats.rx_errors++;
-				lp->stats.rx_length_errors++;
+				dev->stats.rx_errors++;
+				dev->stats.rx_length_errors++;
 				return;
 			}
 			in->skb = skb = alloc_skb(508 * in->numpackets + ARC_HDR_SIZE,
@@ -290,7 +289,7 @@ static void rx(struct net_device *dev, i
 			if (skb == NULL) {
 				BUGMSG(D_NORMAL, "(split) memory squeeze, dropping packet.\n");
 				lp->rfc1201.aborted_seq = soft->sequence;
-				lp->stats.rx_dropped++;
+				dev->stats.rx_dropped++;
 				return;
 			}
 			skb->dev = dev;
@@ -314,8 +313,8 @@ static void rx(struct net_device *dev, i
 					       "first! (splitflag=%d, seq=%d, aborted=%d)\n",
 					soft->split_flag, soft->sequence,
 					       lp->rfc1201.aborted_seq);
-					lp->stats.rx_errors++;
-					lp->stats.rx_missed_errors++;
+					dev->stats.rx_errors++;
+					dev->stats.rx_missed_errors++;
 				}
 				return;
 			}
@@ -325,8 +324,8 @@ static void rx(struct net_device *dev, i
 				if (packetnum <= in->lastpacket - 1) {
 					BUGMSG(D_EXTRA, "duplicate splitpacket ignored! (splitflag=%d)\n",
 					       soft->split_flag);
-					lp->stats.rx_errors++;
-					lp->stats.rx_frame_errors++;
+					dev->stats.rx_errors++;
+					dev->stats.rx_frame_errors++;
 					return;
 				}
 				/* "bad" duplicate, kill reassembly */
@@ -336,8 +335,8 @@ static void rx(struct net_device *dev, i
 				lp->rfc1201.aborted_seq = soft->sequence;
 				dev_kfree_skb_irq(in->skb);
 				in->skb = NULL;
-				lp->stats.rx_errors++;
-				lp->stats.rx_missed_errors++;
+				dev->stats.rx_errors++;
+				dev->stats.rx_missed_errors++;
 				in->lastpacket = in->numpackets = 0;
 				return;
 			}
@@ -404,8 +403,8 @@ static int build_header(struct sk_buff *
 	default:
 		BUGMSG(D_NORMAL, "RFC1201: I don't understand protocol %d (%Xh)\n",
 		       type, type);
-		lp->stats.tx_errors++;
-		lp->stats.tx_aborted_errors++;
+		dev->stats.tx_errors++;
+		dev->stats.tx_aborted_errors++;
 		return 0;
 	}
 
--- a/include/linux/arcdevice.h	2009-01-09 09:40:52.000000000 -0800
+++ b/include/linux/arcdevice.h	2009-01-09 09:41:04.000000000 -0800
@@ -235,8 +235,6 @@ struct Outgoing {
 
 
 struct arcnet_local {
-	struct net_device_stats stats;
-
 	uint8_t config,		/* current value of CONFIG register */
 		timeout,	/* Extended timeout for COM20020 */
 		backplane,	/* Backplane flag for COM20020 */



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 12/45] arcnet: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (10 preceding siblings ...)
  2009-01-09 23:01 ` [patch 11/45] arcnet: convert to internal stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 13/45] com20020: convert to net_devic_ops Stephen Hemminger
                   ` (33 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: arcnet-netdev.patch --]
[-- Type: text/plain, Size: 4078 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


---
 drivers/net/arcnet/arcnet.c |   33 ++++++++++++++++-----------------
 include/linux/arcdevice.h   |    7 ++++++-
 2 files changed, 22 insertions(+), 18 deletions(-)

--- a/drivers/net/arcnet/arcnet.c	2009-01-09 09:41:04.000000000 -0800
+++ b/drivers/net/arcnet/arcnet.c	2009-01-09 09:54:39.000000000 -0800
@@ -95,12 +95,12 @@ EXPORT_SYMBOL(arcnet_unregister_proto);
 EXPORT_SYMBOL(arcnet_debug);
 EXPORT_SYMBOL(alloc_arcdev);
 EXPORT_SYMBOL(arcnet_interrupt);
+EXPORT_SYMBOL(arcnet_open);
+EXPORT_SYMBOL(arcnet_close);
+EXPORT_SYMBOL(arcnet_send_packet);
+EXPORT_SYMBOL(arcnet_timeout);
 
 /* Internal function prototypes */
-static int arcnet_open(struct net_device *dev);
-static int arcnet_close(struct net_device *dev);
-static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev);
-static void arcnet_timeout(struct net_device *dev);
 static int arcnet_header(struct sk_buff *skb, struct net_device *dev,
 			 unsigned short type, const void *daddr,
 			 const void *saddr, unsigned len);
@@ -321,11 +321,18 @@ static const struct header_ops arcnet_he
 	.rebuild = arcnet_rebuild_header,
 };
 
+static const struct net_device_ops arcnet_netdev_ops = {
+	.ndo_open	= arcnet_open,
+	.ndo_stop	= arcnet_close,
+	.ndo_start_xmit = arcnet_send_packet,
+	.ndo_tx_timeout = arcnet_timeout,
+};
 
 /* Setup a struct device for ARCnet. */
 static void arcdev_setup(struct net_device *dev)
 {
 	dev->type = ARPHRD_ARCNET;
+	dev->netdev_ops = &arcnet_netdev_ops;
 	dev->header_ops = &arcnet_header_ops;
 	dev->hard_header_len = sizeof(struct archdr);
 	dev->mtu = choose_mtu();
@@ -338,17 +345,9 @@ static void arcdev_setup(struct net_devi
 	/* New-style flags. */
 	dev->flags = IFF_BROADCAST;
 
-	/*
-	 * Put in this stuff here, so we don't have to export the symbols to
-	 * the chipset drivers.
-	 */
-	dev->open = arcnet_open;
-	dev->stop = arcnet_close;
-	dev->hard_start_xmit = arcnet_send_packet;
-	dev->tx_timeout = arcnet_timeout;
 }
 
-struct net_device *alloc_arcdev(char *name)
+struct net_device *alloc_arcdev(const char *name)
 {
 	struct net_device *dev;
 
@@ -370,7 +369,7 @@ struct net_device *alloc_arcdev(char *na
  * that "should" only need to be set once at boot, so that there is
  * non-reboot way to recover if something goes wrong.
  */
-static int arcnet_open(struct net_device *dev)
+int arcnet_open(struct net_device *dev)
 {
 	struct arcnet_local *lp = netdev_priv(dev);
 	int count, newmtu, error;
@@ -470,7 +469,7 @@ static int arcnet_open(struct net_device
 
 
 /* The inverse routine to arcnet_open - shuts down the card. */
-static int arcnet_close(struct net_device *dev)
+int arcnet_close(struct net_device *dev)
 {
 	struct arcnet_local *lp = netdev_priv(dev);
 
@@ -599,7 +598,7 @@ static int arcnet_rebuild_header(struct 
 
 
 /* Called by the kernel in order to transmit a packet. */
-static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
+int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
 {
 	struct arcnet_local *lp = netdev_priv(dev);
 	struct archdr *pkt;
@@ -718,7 +717,7 @@ static int go_tx(struct net_device *dev)
 
 
 /* Called by the kernel when transmit times out */
-static void arcnet_timeout(struct net_device *dev)
+void arcnet_timeout(struct net_device *dev)
 {
 	unsigned long flags;
 	struct arcnet_local *lp = netdev_priv(dev);
--- a/include/linux/arcdevice.h	2009-01-09 09:41:04.000000000 -0800
+++ b/include/linux/arcdevice.h	2009-01-09 09:48:14.000000000 -0800
@@ -333,7 +333,12 @@ void arcnet_dump_skb(struct net_device *
 
 void arcnet_unregister_proto(struct ArcProto *proto);
 irqreturn_t arcnet_interrupt(int irq, void *dev_id);
-struct net_device *alloc_arcdev(char *name);
+struct net_device *alloc_arcdev(const char *name);
+
+int arcnet_open(struct net_device *dev);
+int arcnet_close(struct net_device *dev);
+int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev);
+void arcnet_timeout(struct net_device *dev);
 
 #endif				/* __KERNEL__ */
 #endif				/* _LINUX_ARCDEVICE_H */



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 13/45] com20020: convert to net_devic_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (11 preceding siblings ...)
  2009-01-09 23:01 ` [patch 12/45] arcnet: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 14/45] 3c501: convert to net_device_ops Stephen Hemminger
                   ` (32 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: com2020-netdev.patch --]
[-- Type: text/plain, Size: 2338 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 drivers/net/arcnet/com20020-isa.c |    2 ++
 drivers/net/arcnet/com20020-pci.c |    3 +++
 drivers/net/arcnet/com20020.c     |   10 ++++++++--
 include/linux/com20020.h          |    1 +
 4 files changed, 14 insertions(+), 2 deletions(-)

--- a/drivers/net/arcnet/com20020-isa.c	2009-01-09 09:55:56.000000000 -0800
+++ b/drivers/net/arcnet/com20020-isa.c	2009-01-09 09:56:23.000000000 -0800
@@ -151,6 +151,8 @@ static int __init com20020_init(void)
 	if (node && node != 0xff)
 		dev->dev_addr[0] = node;
 
+	dev->netdev_ops = &com20020_netdev_ops;
+
 	lp = netdev_priv(dev);
 	lp->backplane = backplane;
 	lp->clockp = clockp & 7;
--- a/drivers/net/arcnet/com20020-pci.c	2009-01-09 09:55:56.000000000 -0800
+++ b/drivers/net/arcnet/com20020-pci.c	2009-01-09 09:56:23.000000000 -0800
@@ -72,6 +72,9 @@ static int __devinit com20020pci_probe(s
 	dev = alloc_arcdev(device);
 	if (!dev)
 		return -ENOMEM;
+
+	dev->netdev_ops = &com20020_netdev_ops;
+
 	lp = netdev_priv(dev);
 
 	pci_set_drvdata(pdev, dev);
--- a/drivers/net/arcnet/com20020.c	2009-01-09 09:55:56.000000000 -0800
+++ b/drivers/net/arcnet/com20020.c	2009-01-09 09:56:23.000000000 -0800
@@ -149,6 +149,14 @@ int com20020_check(struct net_device *de
 	return 0;
 }
 
+const struct net_device_ops com20020_netdev_ops = {
+	.ndo_open	= arcnet_open,
+	.ndo_stop	= arcnet_close,
+	.ndo_start_xmit = arcnet_send_packet,
+	.ndo_tx_timeout = arcnet_timeout,
+	.ndo_set_multicast_list = com20020_set_mc_list,
+};
+
 /* Set up the struct net_device associated with this card.  Called after
  * probing succeeds.
  */
@@ -170,8 +178,6 @@ int com20020_found(struct net_device *de
 	lp->hw.copy_from_card = com20020_copy_from_card;
 	lp->hw.close = com20020_close;
 
-	dev->set_multicast_list = com20020_set_mc_list;
-
 	if (!dev->dev_addr[0])
 		dev->dev_addr[0] = inb(ioaddr + BUS_ALIGN*8);	/* FIXME: do this some other way! */
 
--- a/include/linux/com20020.h	2009-01-09 09:55:56.000000000 -0800
+++ b/include/linux/com20020.h	2009-01-09 09:56:23.000000000 -0800
@@ -29,6 +29,7 @@
 
 int com20020_check(struct net_device *dev);
 int com20020_found(struct net_device *dev, int shared);
+const struct net_device_ops com20020_netdev_ops;
 
 /* The number of low I/O ports used by the card. */
 #define ARCNET_TOTAL_SIZE 8



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 14/45] 3c501: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (12 preceding siblings ...)
  2009-01-09 23:01 ` [patch 13/45] com20020: convert to net_devic_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 15/45] 3c505: " Stephen Hemminger
                   ` (31 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: 3c501.patch --]
[-- Type: text/plain, Size: 1062 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/3c501.c	2009-01-09 13:44:04.000000000 -0800
+++ b/drivers/net/3c501.c	2009-01-09 13:46:44.000000000 -0800
@@ -197,6 +197,17 @@ out:
 	return ERR_PTR(err);
 }
 
+static const struct net_device_ops el_netdev_ops = {
+	.ndo_open		= el_open,
+	.ndo_stop		= el1_close,
+	.ndo_start_xmit 	= el_start_xmit,
+	.ndo_tx_timeout		= el_timeout,
+	.ndo_set_multicast_list = set_multicast_list,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+};
+
 /**
  *	el1_probe1:
  *	@dev: The device structure to use
@@ -305,12 +316,8 @@ static int __init el1_probe1(struct net_
 	 *	The EL1-specific entries in the device structure.
 	 */
 
-	dev->open = &el_open;
-	dev->hard_start_xmit = &el_start_xmit;
-	dev->tx_timeout = &el_timeout;
+	dev->netdev_ops = &el_netdev_ops;
 	dev->watchdog_timeo = HZ;
-	dev->stop = &el1_close;
-	dev->set_multicast_list = &set_multicast_list;
 	dev->ethtool_ops = &netdev_ethtool_ops;
 	return 0;
 }



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 15/45] 3c505: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (13 preceding siblings ...)
  2009-01-09 23:01 ` [patch 14/45] 3c501: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 16/45] 3c507: " Stephen Hemminger
                   ` (30 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, philb; +Cc: netdev

[-- Attachment #1: 3c505.patch --]
[-- Type: text/plain, Size: 1456 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
 drivers/net/3c505.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

--- a/drivers/net/3c505.c	2009-01-08 13:40:02.000000000 -0800
+++ b/drivers/net/3c505.c	2009-01-09 10:02:54.000000000 -0800
@@ -1348,6 +1348,17 @@ static int __init elp_autodetect(struct 
 	return 0;		/* Because of this, the layer above will return -ENODEV */
 }
 
+static const struct net_device_ops elp_netdev_ops = {
+	.ndo_open		= elp_open,
+	.ndo_stop		= elp_close,
+	.ndo_get_stats 		= elp_get_stats,
+	.ndo_start_xmit		= elp_start_xmit,
+	.ndo_tx_timeout 	= elp_timeout,
+	.ndo_set_multicast_list = elp_set_mc_list,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+};
 
 /******************************************************
  *
@@ -1552,13 +1563,8 @@ static int __init elplus_setup(struct ne
 		printk(KERN_ERR "%s: adapter configuration failed\n", dev->name);
 	}
 
-	dev->open = elp_open;				/* local */
-	dev->stop = elp_close;				/* local */
-	dev->get_stats = elp_get_stats;			/* local */
-	dev->hard_start_xmit = elp_start_xmit;		/* local */
-	dev->tx_timeout = elp_timeout;			/* local */
+	dev->netdev_ops = &elp_netdev_ops;
 	dev->watchdog_timeo = 10*HZ;
-	dev->set_multicast_list = elp_set_mc_list;	/* local */
 	dev->ethtool_ops = &netdev_ethtool_ops;		/* local */
 
 	dev->mem_start = dev->mem_end = 0;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 16/45] 3c507: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (14 preceding siblings ...)
  2009-01-09 23:01 ` [patch 15/45] 3c505: " Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 17/45] 3c509: " Stephen Hemminger
                   ` (29 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: 3c507.patch --]
[-- Type: text/plain, Size: 1157 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
 drivers/net/3c507.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

--- a/drivers/net/3c507.c	2009-01-08 10:17:35.858507335 -0800
+++ b/drivers/net/3c507.c	2009-01-08 10:23:53.408662597 -0800
@@ -352,6 +352,16 @@ out:
 	return ERR_PTR(err);
 }
 
+static const struct net_device_ops netdev_ops = {
+ 	.ndo_open		= el16_open,
+ 	.ndo_stop		= el16_close,
+	.ndo_start_xmit 	= el16_send_packet,
+	.ndo_tx_timeout 	= el16_tx_timeout,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+};
+
 static int __init el16_probe1(struct net_device *dev, int ioaddr)
 {
 	static unsigned char init_ID_done, version_printed;
@@ -449,10 +459,7 @@ static int __init el16_probe1(struct net
 		goto out1;
 	}
 
- 	dev->open = el16_open;
- 	dev->stop = el16_close;
-	dev->hard_start_xmit = el16_send_packet;
-	dev->tx_timeout = el16_tx_timeout;
+	dev->netdev_ops = &netdev_ops;
 	dev->watchdog_timeo = TX_TIMEOUT;
 	dev->ethtool_ops = &netdev_ethtool_ops;
  	dev->flags &= ~IFF_MULTICAST;	/* Multicast doesn't work */



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 17/45] 3c509: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (15 preceding siblings ...)
  2009-01-09 23:01 ` [patch 16/45] 3c507: " Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 18/45] 3c515: " Stephen Hemminger
                   ` (28 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: 3c509.patch --]
[-- Type: text/plain, Size: 1454 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/3c509.c	2009-01-09 10:01:47.000000000 -0800
+++ b/drivers/net/3c509.c	2009-01-09 10:08:58.000000000 -0800
@@ -537,6 +537,21 @@ static struct mca_driver el3_mca_driver 
 static int mca_registered;
 #endif /* CONFIG_MCA */
 
+static const struct net_device_ops netdev_ops = {
+	.ndo_open 		= el3_open,
+	.ndo_stop	 	= el3_close,
+	.ndo_start_xmit 	= el3_start_xmit,
+	.ndo_get_stats 		= el3_get_stats,
+	.ndo_set_multicast_list = set_multicast_list,
+	.ndo_tx_timeout 	= el3_tx_timeout,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.ndo_poll_controller	= el3_poll_controller,
+#endif
+};
+
 static int __devinit el3_common_init(struct net_device *dev)
 {
 	struct el3_private *lp = netdev_priv(dev);
@@ -553,16 +568,8 @@ static int __devinit el3_common_init(str
 	}
 
 	/* The EL3-specific entries in the device structure. */
-	dev->open = &el3_open;
-	dev->hard_start_xmit = &el3_start_xmit;
-	dev->stop = &el3_close;
-	dev->get_stats = &el3_get_stats;
-	dev->set_multicast_list = &set_multicast_list;
-	dev->tx_timeout = el3_tx_timeout;
+	dev->netdev_ops = &netdev_ops;
 	dev->watchdog_timeo = TX_TIMEOUT;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	dev->poll_controller = el3_poll_controller;
-#endif
 	SET_ETHTOOL_OPS(dev, &ethtool_ops);
 
 	err = register_netdev(dev);



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 18/45] 3c515: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (16 preceding siblings ...)
  2009-01-09 23:01 ` [patch 17/45] 3c509: " Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 19/45] 3c523: " Stephen Hemminger
                   ` (27 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: 3c515.patch --]
[-- Type: text/plain, Size: 1326 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/3c515.c	2009-01-08 10:24:08.314256647 -0800
+++ b/drivers/net/3c515.c	2009-01-08 10:25:46.944777264 -0800
@@ -563,6 +563,20 @@ no_pnp:
 	return NULL;
 }
 
+
+static const struct net_device_ops netdev_ops = {
+	.ndo_open		= corkscrew_open,
+	.ndo_stop		= corkscrew_close,
+	.ndo_start_xmit		= corkscrew_start_xmit,
+	.ndo_tx_timeout		= corkscrew_timeout,
+	.ndo_get_stats		= corkscrew_get_stats,
+	.ndo_set_multicast_list = set_rx_mode,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+};
+
+
 static int corkscrew_setup(struct net_device *dev, int ioaddr,
 			    struct pnp_dev *idev, int card_number)
 {
@@ -681,13 +695,8 @@ static int corkscrew_setup(struct net_de
 	vp->full_bus_master_rx = (vp->capabilities & 0x20) ? 1 : 0;
 
 	/* The 3c51x-specific entries in the device structure. */
-	dev->open = &corkscrew_open;
-	dev->hard_start_xmit = &corkscrew_start_xmit;
-	dev->tx_timeout = &corkscrew_timeout;
+	dev->netdev_ops = &netdev_ops;
 	dev->watchdog_timeo = (400 * HZ) / 1000;
-	dev->stop = &corkscrew_close;
-	dev->get_stats = &corkscrew_get_stats;
-	dev->set_multicast_list = &set_rx_mode;
 	dev->ethtool_ops = &netdev_ethtool_ops;
 
 	return register_netdev(dev);



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 19/45] 3c523: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (17 preceding siblings ...)
  2009-01-09 23:01 ` [patch 18/45] 3c515: " Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 20/45] 3c527: " Stephen Hemminger
                   ` (26 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: 3c523.patch --]
[-- Type: text/plain, Size: 1449 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/3c523.c	2009-01-08 10:26:03.174260274 -0800
+++ b/drivers/net/3c523.c	2009-01-08 10:29:23.344995792 -0800
@@ -403,6 +403,20 @@ static int elmc_getinfo(char *buf, int s
 	return len;
 }				/* elmc_getinfo() */
 
+static const struct net_device_ops netdev_ops = {
+	.ndo_open 		= elmc_open,
+	.ndo_stop		= elmc_close,
+	.ndo_get_stats		= elmc_get_stats,
+	.ndo_start_xmit		= elmc_send_packet,
+	.ndo_tx_timeout		= elmc_timeout,
+#ifdef ELMC_MULTICAST
+	.ndo_set_multicast_list = set_multicast_list,
+#endif
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+};
+
 /*****************************************************************/
 
 static int __init do_elmc_probe(struct net_device *dev)
@@ -544,17 +558,8 @@ static int __init do_elmc_probe(struct n
 	printk(KERN_INFO "%s: hardware address %pM\n",
 	       dev->name, dev->dev_addr);
 
-	dev->open = &elmc_open;
-	dev->stop = &elmc_close;
-	dev->get_stats = &elmc_get_stats;
-	dev->hard_start_xmit = &elmc_send_packet;
-	dev->tx_timeout = &elmc_timeout;
+	dev->netdev_ops = &netdev_ops;
 	dev->watchdog_timeo = HZ;
-#ifdef ELMC_MULTICAST
-	dev->set_multicast_list = &set_multicast_list;
-#else
-	dev->set_multicast_list = NULL;
-#endif
 	dev->ethtool_ops = &netdev_ethtool_ops;
 
 	/* note that we haven't actually requested the IRQ from the kernel.



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 20/45] 3c527: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (18 preceding siblings ...)
  2009-01-09 23:01 ` [patch 19/45] 3c523: " Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 21/45] 3c59x: " Stephen Hemminger
                   ` (25 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: 3c527.patch --]
[-- Type: text/plain, Size: 1357 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/3c527.c	2009-01-08 10:27:52.851007199 -0800
+++ b/drivers/net/3c527.c	2009-01-08 10:29:08.786256455 -0800
@@ -288,6 +288,18 @@ struct net_device *__init mc32_probe(int
 	return ERR_PTR(-ENODEV);
 }
 
+static const struct net_device_ops netdev_ops = {
+	.ndo_open		= mc32_open,
+	.ndo_stop		= mc32_close,
+	.ndo_start_xmit		= mc32_send_packet,
+	.ndo_get_stats		= mc32_get_stats,
+	.ndo_set_multicast_list = mc32_set_multicast_list,
+	.ndo_tx_timeout		= mc32_timeout,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+};
+
 /**
  * mc32_probe1	-	Check a given slot for a board and test the card
  * @dev:  Device structure to fill in
@@ -518,12 +530,7 @@ static int __init mc32_probe1(struct net
 	printk("%s: Firmware Rev %d. %d RX buffers, %d TX buffers. Base of 0x%08X.\n",
 		dev->name, lp->exec_box->data[12], lp->rx_len, lp->tx_len, lp->base);
 
-	dev->open		= mc32_open;
-	dev->stop		= mc32_close;
-	dev->hard_start_xmit	= mc32_send_packet;
-	dev->get_stats		= mc32_get_stats;
-	dev->set_multicast_list = mc32_set_multicast_list;
-	dev->tx_timeout		= mc32_timeout;
+	dev->netdev_ops		= &netdev_ops;
 	dev->watchdog_timeo	= HZ*5;	/* Board does all the work */
 	dev->ethtool_ops	= &netdev_ethtool_ops;
 



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 21/45] 3c59x: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (19 preceding siblings ...)
  2009-01-09 23:01 ` [patch 20/45] 3c527: " Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 22/45] ibmtr: convert to internal network_device_stats Stephen Hemminger
                   ` (24 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, klassert; +Cc: netdev

[-- Attachment #1: 3c59x.patch --]
[-- Type: text/plain, Size: 2725 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/3c59x.c	2009-01-08 10:29:45.774507470 -0800
+++ b/drivers/net/3c59x.c	2009-01-08 10:34:17.010259034 -0800
@@ -992,6 +992,42 @@ out:
 	return rc;
 }
 
+static const struct net_device_ops boomrang_netdev_ops = {
+	.ndo_open		= vortex_open,
+	.ndo_stop		= vortex_close,
+	.ndo_start_xmit		= boomerang_start_xmit,
+	.ndo_tx_timeout		= vortex_tx_timeout,
+	.ndo_get_stats		= vortex_get_stats,
+#ifdef CONFIG_PCI
+	.ndo_do_ioctl 		= vortex_ioctl,
+#endif
+	.ndo_set_multicast_list = set_rx_mode,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.ndo_poll_controller	= poll_vortex,
+#endif
+};
+
+static const struct net_device_ops vortex_netdev_ops = {
+	.ndo_open		= vortex_open,
+	.ndo_stop		= vortex_close,
+	.ndo_start_xmit		= vortex_start_xmit,
+	.ndo_tx_timeout		= vortex_tx_timeout,
+	.ndo_get_stats		= vortex_get_stats,
+#ifdef CONFIG_PCI
+	.ndo_do_ioctl 		= vortex_ioctl,
+#endif
+	.ndo_set_multicast_list = set_rx_mode,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	.ndo_poll_controller	= poll_vortex,
+#endif
+};
+
 /*
  * Start up the PCI/EISA device which is described by *gendev.
  * Return 0 on success.
@@ -1366,18 +1402,16 @@ static int __devinit vortex_probe1(struc
 	}
 
 	/* The 3c59x-specific entries in the device structure. */
-	dev->open = vortex_open;
 	if (vp->full_bus_master_tx) {
-		dev->hard_start_xmit = boomerang_start_xmit;
+		dev->netdev_ops = &boomrang_netdev_ops;
 		/* Actually, it still should work with iommu. */
 		if (card_idx < MAX_UNITS &&
 		    ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) ||
 				hw_checksums[card_idx] == 1)) {
 			dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
 		}
-	} else {
-		dev->hard_start_xmit = vortex_start_xmit;
-	}
+	} else
+		dev->netdev_ops =  &vortex_netdev_ops;
 
 	if (print_info) {
 		printk(KERN_INFO "%s: scatter/gather %sabled. h/w checksums %sabled\n",
@@ -1386,18 +1420,9 @@ static int __devinit vortex_probe1(struc
 				(dev->features & NETIF_F_IP_CSUM) ? "en":"dis");
 	}
 
-	dev->stop = vortex_close;
-	dev->get_stats = vortex_get_stats;
-#ifdef CONFIG_PCI
-	dev->do_ioctl = vortex_ioctl;
-#endif
 	dev->ethtool_ops = &vortex_ethtool_ops;
-	dev->set_multicast_list = set_rx_mode;
-	dev->tx_timeout = vortex_tx_timeout;
 	dev->watchdog_timeo = (watchdog * HZ) / 1000;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	dev->poll_controller = poll_vortex;
-#endif
+
 	if (pdev) {
 		vp->pm_state_valid = 1;
  		pci_save_state(VORTEX_PCI(vp));



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 22/45] ibmtr: convert to internal network_device_stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (20 preceding siblings ...)
  2009-01-09 23:01 ` [patch 21/45] 3c59x: " Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 23/45] ibmtr: convert to net_device_ops Stephen Hemminger
                   ` (23 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: ibmtr-stats.patch --]
[-- Type: text/plain, Size: 3898 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 drivers/net/tokenring/ibmtr.c |   29 ++++++-----------------------
 include/linux/ibmtr.h         |    2 +-
 2 files changed, 7 insertions(+), 24 deletions(-)

--- a/drivers/net/tokenring/ibmtr.c	2009-01-09 13:53:36.000000000 -0800
+++ b/drivers/net/tokenring/ibmtr.c	2009-01-09 13:54:29.000000000 -0800
@@ -200,7 +200,6 @@ static void 	tr_rx(struct net_device *de
 static void	ibmtr_reset_timer(struct timer_list*tmr,struct net_device *dev);
 static void	tok_rerun(unsigned long dev_addr);
 static void	ibmtr_readlog(struct net_device *dev);
-static struct 	net_device_stats *tok_get_stats(struct net_device *dev);
 static int	ibmtr_change_mtu(struct net_device *dev, int mtu);
 static void	find_turbo_adapters(int *iolist);
 
@@ -825,7 +824,6 @@ static int __devinit trdev_init(struct n
 	dev->open = tok_open;
 	dev->stop = tok_close;
 	dev->hard_start_xmit = tok_send_packet;
-	dev->get_stats = tok_get_stats;
 	dev->set_multicast_list = tok_set_multicast_list;
 	dev->change_mtu = ibmtr_change_mtu;
 
@@ -1460,7 +1458,7 @@ static irqreturn_t tok_interrupt(int irq
 					"%02X\n",
 					(int)retcode, (int)readb(ti->ssb + 6));
 			else
-				ti->tr_stats.tx_packets++;
+				dev->stats.tx_packets++;
 			break;
 		case XMIT_XID_CMD:
 			DPRINTK("xmit xid ret_code: %02X\n",
@@ -1646,7 +1644,7 @@ static void tr_tx(struct net_device *dev
 		break;
 	}
 	writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
-	ti->tr_stats.tx_bytes += ti->current_skb->len;
+	dev->stats.tx_bytes += ti->current_skb->len;
 	dev_kfree_skb_irq(ti->current_skb);
 	ti->current_skb = NULL;
 	netif_wake_queue(dev);
@@ -1722,7 +1720,7 @@ static void tr_rx(struct net_device *dev
 	if (readb(llc + offsetof(struct trllc, llc)) != UI_CMD) {
 		SET_PAGE(ti->asb_page);
 		writeb(DATA_LOST, ti->asb + RETCODE_OFST);
-		ti->tr_stats.rx_dropped++;
+		dev->stats.rx_dropped++;
 		writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
 		return;
 	}
@@ -1757,7 +1755,7 @@ static void tr_rx(struct net_device *dev
 
 	if (!(skb = dev_alloc_skb(skb_size))) {
 		DPRINTK("out of memory. frame dropped.\n");
-		ti->tr_stats.rx_dropped++;
+		dev->stats.rx_dropped++;
 		SET_PAGE(ti->asb_page);
 		writeb(DATA_LOST, ti->asb + offsetof(struct asb_rec, ret_code));
 		writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
@@ -1813,8 +1811,8 @@ static void tr_rx(struct net_device *dev
 
 	writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
 
-	ti->tr_stats.rx_bytes += skb->len;
-	ti->tr_stats.rx_packets++;
+	dev->stats.rx_bytes += skb->len;
+	dev->stats.rx_packets++;
 
 	skb->protocol = tr_type_trans(skb, dev);
 	if (IPv4_p) {
@@ -1876,21 +1874,6 @@ static void ibmtr_readlog(struct net_dev
 
 /*****************************************************************************/
 
-/* tok_get_stats():  Basically a scaffold routine which will return
-   the address of the tr_statistics structure associated with
-   this device -- the tr.... structure is an ethnet look-alike
-   so at least for this iteration may suffice.   */
-
-static struct net_device_stats *tok_get_stats(struct net_device *dev)
-{
-
-	struct tok_info *toki;
-	toki = netdev_priv(dev);
-	return (struct net_device_stats *) &toki->tr_stats;
-}
-
-/*****************************************************************************/
-
 static int ibmtr_change_mtu(struct net_device *dev, int mtu)
 {
 	struct tok_info *ti = netdev_priv(dev);
--- a/include/linux/ibmtr.h	2009-01-09 13:53:36.000000000 -0800
+++ b/include/linux/ibmtr.h	2009-01-09 13:53:57.000000000 -0800
@@ -207,7 +207,7 @@ struct tok_info {
 	unsigned short exsap_station_id;
 	unsigned short global_int_enable;
 	struct sk_buff *current_skb;
-	struct net_device_stats tr_stats;
+
 	unsigned char auto_speedsave;
 	open_state			open_status, sap_status;
 	enum {MANUAL, AUTOMATIC}	open_mode;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 23/45] ibmtr: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (21 preceding siblings ...)
  2009-01-09 23:01 ` [patch 22/45] ibmtr: convert to internal network_device_stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 24/45] lanstreamer: convert to internal network stats Stephen Hemminger
                   ` (22 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: ibmtr-netdev.patch --]
[-- Type: text/plain, Size: 999 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/tokenring/ibmtr.c	2009-01-09 13:54:29.000000000 -0800
+++ b/drivers/net/tokenring/ibmtr.c	2009-01-09 13:55:28.000000000 -0800
@@ -815,17 +815,21 @@ static unsigned char __devinit get_sram_
 
 /*****************************************************************************/
 
+static const struct net_device_ops trdev_netdev_ops = {
+	.ndo_open		= tok_open,
+	.ndo_stop		= tok_close,
+	.ndo_start_xmit		= tok_send_packet,
+	.ndo_set_multicast_list = tok_set_multicast_list,
+	.ndo_change_mtu		= ibmtr_change_mtu,
+};
+
 static int __devinit trdev_init(struct net_device *dev)
 {
 	struct tok_info *ti = netdev_priv(dev);
 
 	SET_PAGE(ti->srb_page);
         ti->open_failure = NO    ;
-	dev->open = tok_open;
-	dev->stop = tok_close;
-	dev->hard_start_xmit = tok_send_packet;
-	dev->set_multicast_list = tok_set_multicast_list;
-	dev->change_mtu = ibmtr_change_mtu;
+ 	dev->netdev_ops = &trdev_netdev_ops;
 
 	return 0;
 }



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 24/45] lanstreamer: convert to internal network stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (22 preceding siblings ...)
  2009-01-09 23:01 ` [patch 23/45] ibmtr: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 25/45] lanstreamer: convert to net_device_ops Stephen Hemminger
                   ` (21 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: tr-lanstream-stats.patch --]
[-- Type: text/plain, Size: 3732 bytes --]

Use internal network_device_stats to keep track of statistics.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


---
 drivers/net/tokenring/lanstreamer.c |   17 +++++------------
 drivers/net/tokenring/lanstreamer.h |    1 -
 2 files changed, 5 insertions(+), 13 deletions(-)

--- a/drivers/net/tokenring/lanstreamer.c	2009-01-09 10:03:58.000000000 -0800
+++ b/drivers/net/tokenring/lanstreamer.c	2009-01-09 10:06:09.000000000 -0800
@@ -207,7 +207,6 @@ static int streamer_xmit(struct sk_buff 
 static int streamer_close(struct net_device *dev);
 static void streamer_set_rx_mode(struct net_device *dev);
 static irqreturn_t streamer_interrupt(int irq, void *dev_id);
-static struct net_device_stats *streamer_get_stats(struct net_device *dev);
 static int streamer_set_mac_address(struct net_device *dev, void *addr);
 static void streamer_arb_cmd(struct net_device *dev);
 static int streamer_change_mtu(struct net_device *dev, int mtu);
@@ -331,7 +330,6 @@ static int __devinit streamer_init_one(s
 	dev->do_ioctl = NULL;
 #endif
 	dev->set_multicast_list = &streamer_set_rx_mode;
-	dev->get_stats = &streamer_get_stats;
 	dev->set_mac_address = &streamer_set_mac_address;
 	dev->irq = pdev->irq;
 	dev->base_addr=pio_start;
@@ -937,7 +935,7 @@ static void streamer_rx(struct net_devic
 			if (skb == NULL) 
 			{
 				printk(KERN_WARNING "%s: Not enough memory to copy packet to upper layers. \n",	dev->name);
-				streamer_priv->streamer_stats.rx_dropped++;
+				dev->stats.rx_dropped++;
 			} else {	/* we allocated an skb OK */
 				if (buffer_cnt == 1) {
 					/* release the DMA mapping */
@@ -1009,8 +1007,8 @@ static void streamer_rx(struct net_devic
 					/* send up to the protocol */
 					netif_rx(skb);
 				}
-				streamer_priv->streamer_stats.rx_packets++;
-				streamer_priv->streamer_stats.rx_bytes += length;
+				dev->stats.rx_packets++;
+				dev->stats.rx_bytes += length;
 			}	/* if skb == null */
 		}		/* end received without errors */
 
@@ -1053,8 +1051,8 @@ static irqreturn_t streamer_interrupt(in
 				while(streamer_priv->streamer_tx_ring[(streamer_priv->tx_ring_last_status + 1) & (STREAMER_TX_RING_SIZE - 1)].status) {
 				streamer_priv->tx_ring_last_status = (streamer_priv->tx_ring_last_status + 1) & (STREAMER_TX_RING_SIZE - 1);
 				streamer_priv->free_tx_ring_entries++;
-				streamer_priv->streamer_stats.tx_bytes += streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]->len;
-				streamer_priv->streamer_stats.tx_packets++;
+				dev->stats.tx_bytes += streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]->len;
+				dev->stats.tx_packets++;
 				dev_kfree_skb_irq(streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]);
 				streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].buffer = 0xdeadbeef;
 				streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].status = 0;
@@ -1484,13 +1482,6 @@ static void streamer_srb_bh(struct net_d
 	}			/* switch srb[0] */
 }
 
-static struct net_device_stats *streamer_get_stats(struct net_device *dev)
-{
-	struct streamer_private *streamer_priv;
-	streamer_priv = netdev_priv(dev);
-	return (struct net_device_stats *) &streamer_priv->streamer_stats;
-}
-
 static int streamer_set_mac_address(struct net_device *dev, void *addr)
 {
 	struct sockaddr *saddr = addr;
--- a/drivers/net/tokenring/lanstreamer.h	2009-01-09 10:03:58.000000000 -0800
+++ b/drivers/net/tokenring/lanstreamer.h	2009-01-09 10:04:58.000000000 -0800
@@ -299,7 +299,6 @@ struct streamer_private {
 	int tx_ring_free, tx_ring_last_status, rx_ring_last_received,
 	    free_tx_ring_entries;
 
-	struct net_device_stats streamer_stats;
 	__u16 streamer_lan_status;
 	__u8 streamer_ring_speed;
 	__u16 pkt_buf_sz;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 25/45] lanstreamer: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (23 preceding siblings ...)
  2009-01-09 23:01 ` [patch 24/45] lanstreamer: convert to internal network stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 26/45] olympic: convert to internal network device stats Stephen Hemminger
                   ` (20 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: tr-lanstream.patch --]
[-- Type: text/plain, Size: 1408 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/tokenring/lanstreamer.c	2009-01-09 10:06:09.000000000 -0800
+++ b/drivers/net/tokenring/lanstreamer.c	2009-01-09 10:06:55.000000000 -0800
@@ -221,6 +221,18 @@ struct streamer_private *dev_streamer=NU
 #endif
 #endif
 
+static const struct net_device_ops streamer_netdev_ops = {
+	.ndo_open		= streamer_open,
+	.ndo_stop		= streamer_close,
+	.ndo_start_xmit		= streamer_xmit,
+	.ndo_change_mtu		= streamer_change_mtu,
+#if STREAMER_IOCTL
+	.ndo_do_ioctl		= streamer_ioctl,
+#endif
+	.ndo_set_multicast_list = streamer_set_rx_mode,
+	.ndo_set_mac_address	= streamer_set_mac_address,
+};
+
 static int __devinit streamer_init_one(struct pci_dev *pdev,
 				       const struct pci_device_id *ent)
 {
@@ -320,17 +332,7 @@ static int __devinit streamer_init_one(s
 	init_waitqueue_head(&streamer_priv->srb_wait);
 	init_waitqueue_head(&streamer_priv->trb_wait);
 
-	dev->open = &streamer_open;
-	dev->hard_start_xmit = &streamer_xmit;
-	dev->change_mtu = &streamer_change_mtu;
-	dev->stop = &streamer_close;
-#if STREAMER_IOCTL
-	dev->do_ioctl = &streamer_ioctl;
-#else
-	dev->do_ioctl = NULL;
-#endif
-	dev->set_multicast_list = &streamer_set_rx_mode;
-	dev->set_mac_address = &streamer_set_mac_address;
+	dev->netdev_ops = &streamer_netdev_ops;
 	dev->irq = pdev->irq;
 	dev->base_addr=pio_start;
 	SET_NETDEV_DEV(dev, &pdev->dev);



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 26/45] olympic: convert to internal network device stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (24 preceding siblings ...)
  2009-01-09 23:01 ` [patch 25/45] lanstreamer: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 27/45] olympic: convert to net_device_ops Stephen Hemminger
                   ` (19 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: olympic-stats.patch --]
[-- Type: text/plain, Size: 3961 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 drivers/net/tokenring/olympic.c |   21 ++++++---------------
 drivers/net/tokenring/olympic.h |    1 -
 2 files changed, 6 insertions(+), 16 deletions(-)

--- a/drivers/net/tokenring/olympic.c	2009-01-09 13:56:07.000000000 -0800
+++ b/drivers/net/tokenring/olympic.c	2009-01-09 13:59:50.000000000 -0800
@@ -187,7 +187,6 @@ static int olympic_close(struct net_devi
 static void olympic_set_rx_mode(struct net_device *dev);
 static void olympic_freemem(struct net_device *dev) ;  
 static irqreturn_t olympic_interrupt(int irq, void *dev_id);
-static struct net_device_stats * olympic_get_stats(struct net_device *dev);
 static int olympic_set_mac_address(struct net_device *dev, void *addr) ; 
 static void olympic_arb_cmd(struct net_device *dev);
 static int olympic_change_mtu(struct net_device *dev, int mtu);
@@ -259,7 +258,6 @@ static int __devinit olympic_probe(struc
 	dev->stop=&olympic_close;
 	dev->do_ioctl=NULL;
 	dev->set_multicast_list=&olympic_set_rx_mode;
-	dev->get_stats=&olympic_get_stats ;
 	dev->set_mac_address=&olympic_set_mac_address ;  
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
@@ -785,7 +783,7 @@ static void olympic_rx(struct net_device
 				} 
 				olympic_priv->rx_ring_last_received += i ; 
 				olympic_priv->rx_ring_last_received &= (OLYMPIC_RX_RING_SIZE -1) ; 
-				olympic_priv->olympic_stats.rx_errors++;	 
+				dev->stats.rx_errors++;
 			} else {	
 			
 				if (buffer_cnt == 1) {
@@ -796,7 +794,7 @@ static void olympic_rx(struct net_device
 
 				if (skb == NULL) {
 					printk(KERN_WARNING "%s: Not enough memory to copy packet to upper layers. \n",dev->name) ;
-					olympic_priv->olympic_stats.rx_dropped++ ; 
+					dev->stats.rx_dropped++;
 					/* Update counters even though we don't transfer the frame */
 					olympic_priv->rx_ring_last_received += i ; 
 					olympic_priv->rx_ring_last_received &= (OLYMPIC_RX_RING_SIZE -1) ;  
@@ -862,8 +860,8 @@ static void olympic_rx(struct net_device
 						skb->protocol = tr_type_trans(skb,dev);
 						netif_rx(skb) ; 
 					} 
-					olympic_priv->olympic_stats.rx_packets++ ; 
-					olympic_priv->olympic_stats.rx_bytes += length ; 
+					dev->stats.rx_packets++ ;
+					dev->stats.rx_bytes += length ;
 				} /* if skb == null */
 			} /* If status & 0x3b */
 
@@ -971,8 +969,8 @@ static irqreturn_t olympic_interrupt(int
 				olympic_priv->tx_ring_last_status++;
 				olympic_priv->tx_ring_last_status &= (OLYMPIC_TX_RING_SIZE-1);
 				olympic_priv->free_tx_ring_entries++;
-				olympic_priv->olympic_stats.tx_bytes += olympic_priv->tx_ring_skb[olympic_priv->tx_ring_last_status]->len;
-				olympic_priv->olympic_stats.tx_packets++ ; 
+				dev->stats.tx_bytes += olympic_priv->tx_ring_skb[olympic_priv->tx_ring_last_status]->len;
+				dev->stats.tx_packets++ ;
 				pci_unmap_single(olympic_priv->pdev, 
 					le32_to_cpu(olympic_priv->olympic_tx_ring[olympic_priv->tx_ring_last_status].buffer), 
 					olympic_priv->tx_ring_skb[olympic_priv->tx_ring_last_status]->len,PCI_DMA_TODEVICE);
@@ -1344,13 +1342,6 @@ static void olympic_srb_bh(struct net_de
 
 } 
 
-static struct net_device_stats * olympic_get_stats(struct net_device *dev)
-{
-	struct olympic_private *olympic_priv ;
-	olympic_priv=netdev_priv(dev);
-	return (struct net_device_stats *) &olympic_priv->olympic_stats; 
-}
-
 static int olympic_set_mac_address (struct net_device *dev, void *addr) 
 {
 	struct sockaddr *saddr = addr ; 
--- a/drivers/net/tokenring/olympic.h	2009-01-09 13:56:07.000000000 -0800
+++ b/drivers/net/tokenring/olympic.h	2009-01-09 13:59:37.000000000 -0800
@@ -275,7 +275,6 @@ struct olympic_private {
 	struct sk_buff *tx_ring_skb[OLYMPIC_TX_RING_SIZE], *rx_ring_skb[OLYMPIC_RX_RING_SIZE];	
 	int tx_ring_free, tx_ring_last_status, rx_ring_last_received,rx_status_last_received, free_tx_ring_entries;
 
-	struct net_device_stats olympic_stats ;
 	u16 olympic_lan_status ;
 	u8 olympic_ring_speed ;
 	u16 pkt_buf_sz ; 



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 27/45] olympic: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (25 preceding siblings ...)
  2009-01-09 23:01 ` [patch 26/45] olympic: convert to internal network device stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 28/45] tms380tr: " Stephen Hemminger
                   ` (18 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: olympic-netdev.patch --]
[-- Type: text/plain, Size: 1315 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/tokenring/olympic.c	2009-01-09 13:59:50.000000000 -0800
+++ b/drivers/net/tokenring/olympic.c	2009-01-09 14:00:26.000000000 -0800
@@ -194,6 +194,15 @@ static void olympic_srb_bh(struct net_de
 static void olympic_asb_bh(struct net_device *dev) ; 
 static int olympic_proc_info(char *buffer, char **start, off_t offset, int length, int *eof, void *data) ; 
 
+static const struct net_device_ops olympic_netdev_ops = {
+	.ndo_open		= olympic_open,
+	.ndo_stop		= olympic_close,
+	.ndo_start_xmit		= olympic_xmit,
+	.ndo_change_mtu		= olympic_change_mtu,
+	.ndo_set_multicast_list	= olympic_set_rx_mode,
+	.ndo_set_mac_address	= olympic_set_mac_address,
+};
+
 static int __devinit olympic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	struct net_device *dev ; 
@@ -252,13 +261,7 @@ static int __devinit olympic_probe(struc
 		goto op_free_iomap;
 	}				
 
-	dev->open=&olympic_open;
-	dev->hard_start_xmit=&olympic_xmit;
-	dev->change_mtu=&olympic_change_mtu;
-	dev->stop=&olympic_close;
-	dev->do_ioctl=NULL;
-	dev->set_multicast_list=&olympic_set_rx_mode;
-	dev->set_mac_address=&olympic_set_mac_address ;  
+	dev->netdev_ops = &olympic_netdev_ops;
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
 	pci_set_drvdata(pdev,dev) ; 



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 28/45] tms380tr: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (26 preceding siblings ...)
  2009-01-09 23:01 ` [patch 27/45] olympic: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 29/45] 3c559: " Stephen Hemminger
                   ` (17 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: tr-tms.patch --]
[-- Type: text/plain, Size: 3481 bytes --]

Conver this related group of drivers to new API

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 drivers/net/tokenring/abyss.c    |    9 +++++++--
 drivers/net/tokenring/tms380tr.c |   21 ++++++++++++---------
 drivers/net/tokenring/tms380tr.h |    1 +
 drivers/net/tokenring/tmspci.c   |    4 ++--
 4 files changed, 22 insertions(+), 13 deletions(-)

--- a/drivers/net/tokenring/tms380tr.c	2009-01-05 16:15:58.973576676 -0800
+++ b/drivers/net/tokenring/tms380tr.c	2009-01-05 16:16:16.242321317 -0800
@@ -2330,6 +2330,17 @@ void tmsdev_term(struct net_device *dev)
 		DMA_BIDIRECTIONAL);
 }
 
+const struct net_device_ops tms380tr_netdev_ops = {
+	.ndo_open		= tms380tr_open,
+	.ndo_stop		= tms380tr_close,
+	.ndo_start_xmit		= tms380tr_send_packet,
+	.ndo_tx_timeout		= tms380tr_timeout,
+	.ndo_get_stats		= tms380tr_get_stats,
+	.ndo_set_multicast_list = tms380tr_set_multicast_list,
+	.ndo_set_mac_address	= tms380tr_set_mac_address,
+};
+EXPORT_SYMBOL(tms380tr_netdev_ops);
+
 int tmsdev_init(struct net_device *dev, struct device *pdev)
 {
 	struct net_local *tms_local;
@@ -2353,16 +2364,8 @@ int tmsdev_init(struct net_device *dev, 
 		return -ENOMEM;
 	}
 	
-	/* These can be overridden by the card driver if needed */
-	dev->open		= tms380tr_open;
-	dev->stop		= tms380tr_close;
-	dev->do_ioctl		= NULL; 
-	dev->hard_start_xmit	= tms380tr_send_packet;
-	dev->tx_timeout		= tms380tr_timeout;
+	dev->netdev_ops		= &tms380tr_netdev_ops;
 	dev->watchdog_timeo	= HZ;
-	dev->get_stats		= tms380tr_get_stats;
-	dev->set_multicast_list = &tms380tr_set_multicast_list;
-	dev->set_mac_address	= tms380tr_set_mac_address;
 
 	return 0;
 }
--- a/drivers/net/tokenring/abyss.c	2009-01-05 16:15:58.957573984 -0800
+++ b/drivers/net/tokenring/abyss.c	2009-01-05 16:24:48.186569023 -0800
@@ -92,6 +92,8 @@ static void abyss_sifwritew(struct net_d
 	outw(val, dev->base_addr + reg);
 }
 
+static struct net_device_ops abyss_netdev_ops;
+
 static int __devinit abyss_attach(struct pci_dev *pdev, const struct pci_device_id *ent)
 {	
 	static int versionprinted;
@@ -157,8 +159,7 @@ static int __devinit abyss_attach(struct
 
 	memcpy(tp->ProductID, "Madge PCI 16/4 Mk2", PROD_ID_SIZE + 1);
 		
-	dev->open = abyss_open;
-	dev->stop = abyss_close;
+	dev->netdev_ops = &abyss_netdev_ops;
 
 	pci_set_drvdata(pdev, dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
@@ -450,6 +451,11 @@ static struct pci_driver abyss_driver = 
 
 static int __init abyss_init (void)
 {
+	abyss_netdev_ops = tms380tr_netdev_ops;
+
+	abyss_netdev_ops.ndo_open = abyss_open;
+	abyss_netdev_ops.ndo_stop = abyss_close;
+
 	return pci_register_driver(&abyss_driver);
 }
 
--- a/drivers/net/tokenring/tmspci.c	2009-01-05 16:15:58.939320188 -0800
+++ b/drivers/net/tokenring/tmspci.c	2009-01-05 16:16:16.242321317 -0800
@@ -157,8 +157,8 @@ static int __devinit tms_pci_attach(stru
 
 	tp->tmspriv = cardinfo;
 
-	dev->open = tms380tr_open;
-	dev->stop = tms380tr_close;
+	dev->netdev_ops = &tms380tr_netdev_ops;
+
 	pci_set_drvdata(pdev, dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
--- a/drivers/net/tokenring/tms380tr.h	2009-01-05 16:15:58.949569988 -0800
+++ b/drivers/net/tokenring/tms380tr.h	2009-01-05 16:16:16.242321317 -0800
@@ -14,6 +14,7 @@
 #include <linux/interrupt.h>
 
 /* module prototypes */
+extern const struct net_device_ops tms380tr_netdev_ops;
 int tms380tr_open(struct net_device *dev);
 int tms380tr_close(struct net_device *dev);
 irqreturn_t tms380tr_interrupt(int irq, void *dev_id);



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 29/45] 3c559: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (27 preceding siblings ...)
  2009-01-09 23:01 ` [patch 28/45] tms380tr: " Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 30/45] znet: " Stephen Hemminger
                   ` (16 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: tr-3com.patch --]
[-- Type: text/plain, Size: 1063 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/tokenring/3c359.c	2009-01-05 16:38:58.165576860 -0800
+++ b/drivers/net/tokenring/3c359.c	2009-01-05 16:39:28.730569233 -0800
@@ -274,6 +274,15 @@ static void  xl_ee_write(struct net_devi
 	
 	return ; 
 }
+
+static const struct net_device_ops xl_netdev_ops = {
+	.ndo_open		= xl_open,
+	.ndo_stop		= xl_close,
+	.ndo_start_xmit		= xl_xmit,
+	.ndo_change_mtu		= xl_change_mtu,
+	.ndo_set_multicast_list = xl_set_rx_mode,
+	.ndo_set_mac_address	= xl_set_mac_address,
+};
  
 static int __devinit xl_probe(struct pci_dev *pdev,
 			      const struct pci_device_id *ent) 
@@ -337,13 +346,7 @@ static int __devinit xl_probe(struct pci
 		return i ; 
 	}				
 
-	dev->open=&xl_open;
-	dev->hard_start_xmit=&xl_xmit;
-	dev->change_mtu=&xl_change_mtu;
-	dev->stop=&xl_close;
-	dev->do_ioctl=NULL;
-	dev->set_multicast_list=&xl_set_rx_mode;
-	dev->set_mac_address=&xl_set_mac_address ; 
+	dev->netdev_ops = &xl_netdev_ops;
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
 	pci_set_drvdata(pdev,dev) ; 



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 30/45] znet: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (28 preceding siblings ...)
  2009-01-09 23:01 ` [patch 29/45] 3c559: " Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 31/45] 6pack: " Stephen Hemminger
                   ` (15 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

[-- Attachment #1: znet.patch --]
[-- Type: text/plain, Size: 1337 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/znet.c	2009-01-08 08:30:16.000000000 -0800
+++ b/drivers/net/znet.c	2009-01-09 10:01:35.000000000 -0800
@@ -358,6 +358,17 @@ static void znet_set_multicast_list (str
 	 * multicast address configured isn't equal to IFF_ALLMULTI */
 }
 
+static const struct net_device_ops znet_netdev_ops = {
+	.ndo_open		= znet_open,
+	.ndo_stop		= znet_close,
+	.ndo_start_xmit		= znet_send_packet,
+	.ndo_set_multicast_list = znet_set_multicast_list,
+	.ndo_tx_timeout		= znet_tx_timeout,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+};
+
 /* The Z-Note probe is pretty easy.  The NETIDBLK exists in the safe-to-probe
    BIOS area.  We just scan for the signature, and pull the vital parameters
    out of the structure. */
@@ -440,11 +451,7 @@ static int __init znet_probe (void)
 	znet->tx_end = znet->tx_start + znet->tx_buf_len;
 
 	/* The ZNET-specific entries in the device structure. */
-	dev->open = &znet_open;
-	dev->hard_start_xmit = &znet_send_packet;
-	dev->stop = &znet_close;
-	dev->set_multicast_list = &znet_set_multicast_list;
-	dev->tx_timeout = znet_tx_timeout;
+	dev->netdev_ops = &znet_netdev_ops;
 	dev->watchdog_timeo = TX_TIMEOUT;
 	err = register_netdev(dev);
 	if (err)



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 31/45] 6pack: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (29 preceding siblings ...)
  2009-01-09 23:01 ` [patch 30/45] znet: " Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 32/45] baycom: convert to internal net_device_stats Stephen Hemminger
                   ` (14 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, ajk; +Cc: netdev, linux-hams

[-- Attachment #1: 6pack.patch --]
[-- Type: text/plain, Size: 1136 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/hamradio/6pack.c	2009-01-09 10:16:50.000000000 -0800
+++ b/drivers/net/hamradio/6pack.c	2009-01-09 10:17:52.000000000 -0800
@@ -322,23 +322,25 @@ static const struct header_ops sp_header
 	.rebuild	= sp_rebuild_header,
 };
 
+static const struct net_device_ops sp_netdev_ops = {
+	.ndo_open		= sp_open_dev,
+	.ndo_stop		= sp_close,
+	.ndo_start_xmit		= sp_xmit,
+	.ndo_set_mac_address    = sp_set_mac_address,
+};
+
 static void sp_setup(struct net_device *dev)
 {
 	/* Finish setting up the DEVICE info. */
-	dev->mtu		= SIXP_MTU;
-	dev->hard_start_xmit	= sp_xmit;
-	dev->open		= sp_open_dev;
+	dev->netdev_ops		= &sp_netdev_ops;
 	dev->destructor		= free_netdev;
-	dev->stop		= sp_close;
-
-	dev->set_mac_address    = sp_set_mac_address;
+	dev->mtu		= SIXP_MTU;
 	dev->hard_header_len	= AX25_MAX_HEADER_LEN;
 	dev->header_ops 	= &sp_header_ops;
 
 	dev->addr_len		= AX25_ADDR_LEN;
 	dev->type		= ARPHRD_AX25;
 	dev->tx_queue_len	= 10;
-	dev->tx_timeout		= NULL;
 
 	/* Only activated in AX.25 mode */
 	memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 32/45] baycom: convert to internal net_device_stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (30 preceding siblings ...)
  2009-01-09 23:01 ` [patch 31/45] 6pack: " Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-10  0:03   ` Thomas Sailer
  2009-01-09 23:01 ` [patch 33/45] baycom: convert to net_device_ops Stephen Hemminger
                   ` (13 subsequent siblings)
  45 siblings, 1 reply; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, t.sailer; +Cc: netdev, linux-hams

[-- Attachment #1: baycom-stats.patch --]
[-- Type: text/plain, Size: 2810 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/hamradio/baycom_epp.c	2009-01-09 10:16:50.000000000 -0800
+++ b/drivers/net/hamradio/baycom_epp.c	2009-01-09 10:22:45.000000000 -0800
@@ -203,7 +203,6 @@ struct baycom_state {
 		unsigned char buf[TXBUFFER_SIZE];
         } hdlctx;
 
-        struct net_device_stats stats;
 	unsigned int ptt_keyed;
 	struct sk_buff *skb;  /* next transmit packet  */
 
@@ -423,7 +422,7 @@ static void encode_hdlc(struct baycom_st
 	bc->hdlctx.bufptr = bc->hdlctx.buf;
 	bc->hdlctx.bufcnt = wp - bc->hdlctx.buf;
 	dev_kfree_skb(skb);
-	bc->stats.tx_packets++;
+	bc->dev->stats.tx_packets++;
 }
 
 /* ---------------------------------------------------------------------- */
@@ -547,7 +546,7 @@ static void do_rxpacket(struct net_devic
 	pktlen = bc->hdlcrx.bufcnt-2+1; /* KISS kludge */
 	if (!(skb = dev_alloc_skb(pktlen))) {
 		printk("%s: memory squeeze, dropping packet\n", dev->name);
-		bc->stats.rx_dropped++;
+		dev->stats.rx_dropped++;
 		return;
 	}
 	cp = skb_put(skb, pktlen);
@@ -555,7 +554,7 @@ static void do_rxpacket(struct net_devic
 	memcpy(cp, bc->hdlcrx.buf, pktlen - 1);
 	skb->protocol = ax25_type_trans(skb, dev);
 	netif_rx(skb);
-	bc->stats.rx_packets++;
+	dev->stats.rx_packets++;
 }
 
 static int receive(struct net_device *dev, int cnt)
@@ -802,19 +801,6 @@ static int baycom_set_mac_address(struct
 
 /* --------------------------------------------------------------------- */
 
-static struct net_device_stats *baycom_get_stats(struct net_device *dev)
-{
-	struct baycom_state *bc = netdev_priv(dev);
-
-	/* 
-	 * Get the current statistics.  This may be called with the
-	 * card open or closed. 
-	 */
-	return &bc->stats;
-}
-
-/* --------------------------------------------------------------------- */
-
 static void epp_wakeup(void *handle)
 {
         struct net_device *dev = (struct net_device *)handle;
@@ -1065,10 +1051,10 @@ static int baycom_ioctl(struct net_devic
 		hi.data.cs.ptt = !!(bc->stat & EPP_PTTBIT);
 		hi.data.cs.dcd = !(bc->stat & EPP_DCDBIT);
 		hi.data.cs.ptt_keyed = bc->ptt_keyed;
-		hi.data.cs.tx_packets = bc->stats.tx_packets;
-		hi.data.cs.tx_errors = bc->stats.tx_errors;
-		hi.data.cs.rx_packets = bc->stats.rx_packets;
-		hi.data.cs.rx_errors = bc->stats.rx_errors;
+		hi.data.cs.tx_packets = dev->stats.tx_packets;
+		hi.data.cs.tx_errors = dev->stats.tx_errors;
+		hi.data.cs.rx_packets = dev->stats.rx_packets;
+		hi.data.cs.rx_errors = dev->stats.rx_errors;
 		break;		
 
 	case HDLCDRVCTL_OLDGETSTAT:
@@ -1147,7 +1133,6 @@ static void baycom_probe(struct net_devi
 	dev->stop = epp_close;
 	dev->do_ioctl = baycom_ioctl;
 	dev->hard_start_xmit = baycom_send_packet;
-	dev->get_stats = baycom_get_stats;
 
 	/* Fill in the fields of the device structure */
 	bc->skb = NULL;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 33/45] baycom: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (31 preceding siblings ...)
  2009-01-09 23:01 ` [patch 32/45] baycom: convert to internal net_device_stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-10  0:03   ` Thomas Sailer
  2009-01-09 23:01 ` [patch 34/45] bpqether: convert to internal net_device_stats Stephen Hemminger
                   ` (12 subsequent siblings)
  45 siblings, 1 reply; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, t.sailer; +Cc: netdev, linux-hams

[-- Attachment #1: baycom-netdev.patch --]
[-- Type: text/plain, Size: 1314 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/hamradio/baycom_epp.c	2009-01-09 10:22:45.000000000 -0800
+++ b/drivers/net/hamradio/baycom_epp.c	2009-01-09 10:42:00.000000000 -0800
@@ -1102,6 +1102,14 @@ static int baycom_ioctl(struct net_devic
 
 /* --------------------------------------------------------------------- */
 
+static const struct net_device_ops baycom_netdev_ops = {
+	.ndo_open	     = epp_open,
+	.ndo_stop	     = epp_close,
+	.ndo_do_ioctl	     = baycom_ioctl,
+	.ndo_start_xmit      = baycom_send_packet,
+	.ndo_set_mac_address = baycom_set_mac_address,
+};
+
 /*
  * Check for a network adaptor of this type, and return '0' if one exists.
  * If dev->base_addr == 0, probe all likely locations.
@@ -1129,16 +1137,12 @@ static void baycom_probe(struct net_devi
 	/*
 	 * initialize the device struct
 	 */
-	dev->open = epp_open;
-	dev->stop = epp_close;
-	dev->do_ioctl = baycom_ioctl;
-	dev->hard_start_xmit = baycom_send_packet;
 
 	/* Fill in the fields of the device structure */
 	bc->skb = NULL;
 	
+	dev->netdev_ops = &baycom_netdev_ops;
 	dev->header_ops = &ax25_header_ops;
-	dev->set_mac_address = baycom_set_mac_address;
 	
 	dev->type = ARPHRD_AX25;           /* AF_AX25 device */
 	dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 34/45] bpqether: convert to internal net_device_stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (32 preceding siblings ...)
  2009-01-09 23:01 ` [patch 33/45] baycom: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 35/45] bpqether: convert to net_device_ops Stephen Hemminger
                   ` (11 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-hams

[-- Attachment #1: bpqether-stats.patch --]
[-- Type: text/plain, Size: 1873 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/hamradio/bpqether.c	2009-01-08 08:30:11.000000000 -0800
+++ b/drivers/net/hamradio/bpqether.c	2009-01-08 11:51:31.000000000 -0800
@@ -110,7 +110,6 @@ struct bpqdev {
 	struct list_head bpq_list;	/* list of bpq devices chain */
 	struct net_device *ethdev;	/* link to ethernet device */
 	struct net_device *axdev;	/* bpq device (bpq#) */
-	struct net_device_stats stats;	/* some statistics */
 	char   dest_addr[6];		/* ether destination address */
 	char   acpt_addr[6];		/* accept ether frames from this address only */
 };
@@ -222,8 +221,8 @@ static int bpq_rcv(struct sk_buff *skb, 
 	skb_pull(skb, 2);	/* Remove the length bytes */
 	skb_trim(skb, len);	/* Set the length of the data */
 
-	bpq->stats.rx_packets++;
-	bpq->stats.rx_bytes += len;
+	dev->stats.rx_packets++;
+	dev->stats.rx_bytes += len;
 
 	ptr = skb_push(skb, 1);
 	*ptr = 0;
@@ -292,7 +291,7 @@ static int bpq_xmit(struct sk_buff *skb,
 	bpq = netdev_priv(dev);
 
 	if ((dev = bpq_get_ether_dev(dev)) == NULL) {
-		bpq->stats.tx_dropped++;
+		dev->stats.tx_dropped++;
 		kfree_skb(skb);
 		return -ENODEV;
 	}
@@ -300,8 +299,8 @@ static int bpq_xmit(struct sk_buff *skb,
 	skb->protocol = ax25_type_trans(skb, dev);
 	skb_reset_network_header(skb);
 	dev_hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0);
-	bpq->stats.tx_packets++;
-	bpq->stats.tx_bytes+=skb->len;
+	dev->stats.tx_packets++;
+	dev->stats.tx_bytes+=skb->len;
   
 	dev_queue_xmit(skb);
 	netif_wake_queue(dev);
@@ -309,16 +308,6 @@ static int bpq_xmit(struct sk_buff *skb,
 }
 
 /*
- *	Statistics
- */
-static struct net_device_stats *bpq_get_stats(struct net_device *dev)
-{
-	struct bpqdev *bpq = netdev_priv(dev);
-
-	return &bpq->stats;
-}
-
-/*
  *	Set AX.25 callsign
  */
 static int bpq_set_mac_address(struct net_device *dev, void *addr)



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 35/45] bpqether: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (33 preceding siblings ...)
  2009-01-09 23:01 ` [patch 34/45] bpqether: convert to internal net_device_stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 36/45] dmascc: convert to internal network device stats Stephen Hemminger
                   ` (10 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-hams

[-- Attachment #1: bpqether-netdev.patch --]
[-- Type: text/plain, Size: 992 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/hamradio/bpqether.c	2009-01-09 14:00:32.000000000 -0800
+++ b/drivers/net/hamradio/bpqether.c	2009-01-09 14:00:32.000000000 -0800
@@ -466,16 +466,17 @@ static const struct file_operations bpq_
 
 /* ------------------------------------------------------------------------ */
 
+static const struct net_device_ops bpq_netdev_ops = {
+	.ndo_open	     = bpq_open,
+	.ndo_stop	     = bpq_close,
+	.ndo_start_xmit	     = bpq_xmit,
+	.ndo_set_mac_address = bpq_set_mac_address,
+	.ndo_do_ioctl	     = bpq_ioctl,
+};
 
 static void bpq_setup(struct net_device *dev)
 {
-
-	dev->hard_start_xmit = bpq_xmit;
-	dev->open	     = bpq_open;
-	dev->stop	     = bpq_close;
-	dev->set_mac_address = bpq_set_mac_address;
-	dev->get_stats	     = bpq_get_stats;
-	dev->do_ioctl	     = bpq_ioctl;
+	dev->netdev_ops	     = &bpq_netdev_ops;
 	dev->destructor	     = free_netdev;
 
 	memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 36/45] dmascc: convert to internal network device stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (34 preceding siblings ...)
  2009-01-09 23:01 ` [patch 35/45] bpqether: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 37/45] dmascc: convert to network_device_ops Stephen Hemminger
                   ` (9 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, klaus.kudielka; +Cc: netdev, linux-hams

[-- Attachment #1: dmascc-stats.patch --]
[-- Type: text/plain, Size: 3874 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/hamradio/dmascc.c	2009-01-09 10:16:50.000000000 -0800
+++ b/drivers/net/hamradio/dmascc.c	2009-01-09 11:07:16.000000000 -0800
@@ -195,7 +195,7 @@ struct scc_priv {
 	int chip;
 	struct net_device *dev;
 	struct scc_info *info;
-	struct net_device_stats stats;
+
 	int channel;
 	int card_base, scc_cmd, scc_data;
 	int tmr_cnt, tmr_ctrl, tmr_mode;
@@ -239,7 +239,6 @@ static int scc_open(struct net_device *d
 static int scc_close(struct net_device *dev);
 static int scc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
 static int scc_send_packet(struct sk_buff *skb, struct net_device *dev);
-static struct net_device_stats *scc_get_stats(struct net_device *dev);
 static int scc_set_mac_address(struct net_device *dev, void *sa);
 
 static inline void tx_on(struct scc_priv *priv);
@@ -961,14 +960,6 @@ static int scc_send_packet(struct sk_buf
 }
 
 
-static struct net_device_stats *scc_get_stats(struct net_device *dev)
-{
-	struct scc_priv *priv = dev->ml_priv;
-
-	return &priv->stats;
-}
-
-
 static int scc_set_mac_address(struct net_device *dev, void *sa)
 {
 	memcpy(dev->dev_addr, ((struct sockaddr *) sa)->sa_data,
@@ -1216,17 +1207,17 @@ static void special_condition(struct scc
 		}
 		if (priv->rx_over) {
 			/* We had an overrun */
-			priv->stats.rx_errors++;
+			priv->dev->stats.rx_errors++;
 			if (priv->rx_over == 2)
-				priv->stats.rx_length_errors++;
+				priv->dev->stats.rx_length_errors++;
 			else
-				priv->stats.rx_fifo_errors++;
+				priv->dev->stats.rx_fifo_errors++;
 			priv->rx_over = 0;
 		} else if (rc & CRC_ERR) {
 			/* Count invalid CRC only if packet length >= minimum */
 			if (cb >= 15) {
-				priv->stats.rx_errors++;
-				priv->stats.rx_crc_errors++;
+				priv->dev->stats.rx_errors++;
+				priv->dev->stats.rx_crc_errors++;
 			}
 		} else {
 			if (cb >= 15) {
@@ -1239,8 +1230,8 @@ static void special_condition(struct scc
 					priv->rx_count++;
 					schedule_work(&priv->rx_work);
 				} else {
-					priv->stats.rx_errors++;
-					priv->stats.rx_over_errors++;
+					priv->dev->stats.rx_errors++;
+					priv->dev->stats.rx_over_errors++;
 				}
 			}
 		}
@@ -1275,7 +1266,7 @@ static void rx_bh(struct work_struct *ug
 		skb = dev_alloc_skb(cb + 1);
 		if (skb == NULL) {
 			/* Drop packet */
-			priv->stats.rx_dropped++;
+			priv->dev->stats.rx_dropped++;
 		} else {
 			/* Fill buffer */
 			data = skb_put(skb, cb + 1);
@@ -1283,8 +1274,8 @@ static void rx_bh(struct work_struct *ug
 			memcpy(&data[1], priv->rx_buf[i], cb);
 			skb->protocol = ax25_type_trans(skb, priv->dev);
 			netif_rx(skb);
-			priv->stats.rx_packets++;
-			priv->stats.rx_bytes += cb;
+			priv->dev->stats.rx_packets++;
+			priv->dev->stats.rx_bytes += cb;
 		}
 		spin_lock_irqsave(&priv->ring_lock, flags);
 		/* Move tail */
@@ -1351,15 +1342,15 @@ static void es_isr(struct scc_priv *priv
 			write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN);
 		if (res) {
 			/* Update packet statistics */
-			priv->stats.tx_errors++;
-			priv->stats.tx_fifo_errors++;
+			priv->dev->stats.tx_errors++;
+			priv->dev->stats.tx_fifo_errors++;
 			/* Other underrun interrupts may already be waiting */
 			write_scc(priv, R0, RES_EXT_INT);
 			write_scc(priv, R0, RES_EXT_INT);
 		} else {
 			/* Update packet statistics */
-			priv->stats.tx_packets++;
-			priv->stats.tx_bytes += priv->tx_len[i];
+			priv->dev->stats.tx_packets++;
+			priv->dev->stats.tx_bytes += priv->tx_len[i];
 			/* Remove frame from FIFO */
 			priv->tx_tail = (i + 1) % NUM_TX_BUF;
 			priv->tx_count--;
@@ -1425,7 +1416,7 @@ static void tm_isr(struct scc_priv *priv
 		write_scc(priv, R15, DCDIE);
 		priv->rr0 = read_scc(priv, R0);
 		if (priv->rr0 & DCD) {
-			priv->stats.collisions++;
+			priv->dev->stats.collisions++;
 			rx_on(priv);
 			priv->state = RX_ON;
 		} else {



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 37/45] dmascc: convert to network_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (35 preceding siblings ...)
  2009-01-09 23:01 ` [patch 36/45] dmascc: convert to internal network device stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 38/45] hdlcdrv: convert to internal net_device_stats Stephen Hemminger
                   ` (8 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, klaus.kudielka; +Cc: netdev, linux-hams

[-- Attachment #1: dmascc-netdev.patch --]
[-- Type: text/plain, Size: 1035 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/hamradio/dmascc.c	2009-01-09 12:47:32.000000000 -0800
+++ b/drivers/net/hamradio/dmascc.c	2009-01-09 12:52:12.000000000 -0800
@@ -440,6 +440,13 @@ static void __init dev_setup(struct net_
 	memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
 }
 
+static const struct net_device_ops scc_netdev_ops = {
+	.ndo_open = scc_open,
+	.ndo_stop = scc_close,
+	.ndo_start_xmit = scc_send_packet,
+	.ndo_do_ioctl = scc_ioctl,
+};
+
 static int __init setup_adapter(int card_base, int type, int n)
 {
 	int i, irq, chip;
@@ -575,11 +582,7 @@ static int __init setup_adapter(int card
 		sprintf(dev->name, "dmascc%i", 2 * n + i);
 		dev->base_addr = card_base;
 		dev->irq = irq;
-		dev->open = scc_open;
-		dev->stop = scc_close;
-		dev->do_ioctl = scc_ioctl;
-		dev->hard_start_xmit = scc_send_packet;
-		dev->get_stats = scc_get_stats;
+		dev->netdev_ops = &scc_netdev_ops;
 		dev->header_ops = &ax25_header_ops;
 		dev->set_mac_address = scc_set_mac_address;
 	}



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 38/45] hdlcdrv: convert to internal net_device_stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (36 preceding siblings ...)
  2009-01-09 23:01 ` [patch 37/45] dmascc: convert to network_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-10  0:03   ` Thomas Sailer
  2009-01-09 23:01 ` [patch 39/45] hdlcdrv: convert to net_device_ops Stephen Hemminger
                   ` (7 subsequent siblings)
  45 siblings, 1 reply; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, t.sailer; +Cc: netdev, linux-hams

[-- Attachment #1: hdlcdrv-stats.patch --]
[-- Type: text/plain, Size: 2809 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
 drivers/net/hamradio/hdlcdrv.c |   27 +++++++--------------------
 include/linux/hdlcdrv.h        |    1 -
 2 files changed, 7 insertions(+), 21 deletions(-)

--- a/drivers/net/hamradio/hdlcdrv.c	2009-01-09 10:16:50.000000000 -0800
+++ b/drivers/net/hamradio/hdlcdrv.c	2009-01-09 12:52:18.000000000 -0800
@@ -154,7 +154,7 @@ static void hdlc_rx_flag(struct net_devi
 	pkt_len = s->hdlcrx.len - 2 + 1; /* KISS kludge */
 	if (!(skb = dev_alloc_skb(pkt_len))) {
 		printk("%s: memory squeeze, dropping packet\n", dev->name);
-		s->stats.rx_dropped++;
+		dev->stats.rx_dropped++;
 		return;
 	}
 	cp = skb_put(skb, pkt_len);
@@ -162,7 +162,7 @@ static void hdlc_rx_flag(struct net_devi
 	memcpy(cp, s->hdlcrx.buffer, pkt_len - 1);
 	skb->protocol = ax25_type_trans(skb, dev);
 	netif_rx(skb);
-	s->stats.rx_packets++;
+	dev->stats.rx_packets++;
 }
 
 void hdlcdrv_receiver(struct net_device *dev, struct hdlcdrv_state *s)
@@ -326,7 +326,7 @@ void hdlcdrv_transmitter(struct net_devi
 			s->hdlctx.len = pkt_len+2; /* the appended CRC */
 			s->hdlctx.tx_state = 2;
 			s->hdlctx.bitstream = 0;
-			s->stats.tx_packets++;
+			dev->stats.tx_packets++;
 			break;
 		case 2:
 			if (!s->hdlctx.len) {
@@ -427,19 +427,6 @@ static int hdlcdrv_set_mac_address(struc
 }
 
 /* --------------------------------------------------------------------- */
-
-static struct net_device_stats *hdlcdrv_get_stats(struct net_device *dev)
-{
-	struct hdlcdrv_state *sm = netdev_priv(dev);
-
-	/* 
-	 * Get the current statistics.  This may be called with the
-	 * card open or closed. 
-	 */
-	return &sm->stats;
-}
-
-/* --------------------------------------------------------------------- */
 /*
  * Open/initialize the board. This is called (in the current kernel)
  * sometime after booting when the 'ifconfig' program is run.
@@ -568,10 +555,10 @@ static int hdlcdrv_ioctl(struct net_devi
 		bi.data.cs.ptt = hdlcdrv_ptt(s);
 		bi.data.cs.dcd = s->hdlcrx.dcd;
 		bi.data.cs.ptt_keyed = s->ptt_keyed;
-		bi.data.cs.tx_packets = s->stats.tx_packets;
-		bi.data.cs.tx_errors = s->stats.tx_errors;
-		bi.data.cs.rx_packets = s->stats.rx_packets;
-		bi.data.cs.rx_errors = s->stats.rx_errors;
+		bi.data.cs.tx_packets = dev->stats.tx_packets;
+		bi.data.cs.tx_errors = dev->stats.tx_errors;
+		bi.data.cs.rx_packets = dev->stats.rx_packets;
+		bi.data.cs.rx_errors = dev->stats.rx_errors;
 		break;		
 
 	case HDLCDRVCTL_OLDGETSTAT:
--- a/include/linux/hdlcdrv.h	2009-01-09 10:16:50.000000000 -0800
+++ b/include/linux/hdlcdrv.h	2009-01-09 12:52:18.000000000 -0800
@@ -241,7 +241,6 @@ struct hdlcdrv_state {
 	struct hdlcdrv_bitbuffer bitbuf_hdlc;
 #endif /* HDLCDRV_DEBUG */
 
-	struct net_device_stats stats;
 	int ptt_keyed;
 
 	/* queued skb for transmission */



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 39/45] hdlcdrv: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (37 preceding siblings ...)
  2009-01-09 23:01 ` [patch 38/45] hdlcdrv: convert to internal net_device_stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-10  0:03   ` Thomas Sailer
  2009-01-09 23:01 ` [patch 40/45] yam: convert to internal net_device_stats Stephen Hemminger
                   ` (6 subsequent siblings)
  45 siblings, 1 reply; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, t.sailer; +Cc: netdev, linux-hams

[-- Attachment #1: hdlcdrv-netdev.patch --]
[-- Type: text/plain, Size: 1306 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/hamradio/hdlcdrv.c	2009-01-09 12:52:18.000000000 -0800
+++ b/drivers/net/hamradio/hdlcdrv.c	2009-01-09 12:52:27.000000000 -0800
@@ -617,6 +617,14 @@ static int hdlcdrv_ioctl(struct net_devi
 
 /* --------------------------------------------------------------------- */
 
+static const struct net_device_ops hdlcdrv_netdev = {
+	.ndo_open	= hdlcdrv_open,
+	.ndo_stop	= hdlcdrv_close,
+	.ndo_start_xmit = hdlcdrv_send_packet,
+	.ndo_do_ioctl	= hdlcdrv_ioctl,
+	.ndo_set_mac_address = hdlcdrv_set_mac_address,
+};
+
 /*
  * Initialize fields in hdlcdrv
  */
@@ -656,21 +664,13 @@ static void hdlcdrv_setup(struct net_dev
 	s->bitbuf_hdlc.shreg = 0x80;
 #endif /* HDLCDRV_DEBUG */
 
-	/*
-	 * initialize the device struct
-	 */
-	dev->open = hdlcdrv_open;
-	dev->stop = hdlcdrv_close;
-	dev->do_ioctl = hdlcdrv_ioctl;
-	dev->hard_start_xmit = hdlcdrv_send_packet;
-	dev->get_stats = hdlcdrv_get_stats;
 
 	/* Fill in the fields of the device structure */
 
 	s->skb = NULL;
 	
+	dev->netdev_ops = &hdlcdrv_netdev;
 	dev->header_ops = &ax25_header_ops;
-	dev->set_mac_address = hdlcdrv_set_mac_address;
 	
 	dev->type = ARPHRD_AX25;           /* AF_AX25 device */
 	dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 40/45] yam: convert to internal net_device_stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (38 preceding siblings ...)
  2009-01-09 23:01 ` [patch 39/45] hdlcdrv: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 41/45] yam: convert to net_device_ops Stephen Hemminger
                   ` (5 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, jpr; +Cc: netdev, linux-hams

[-- Attachment #1: yam-stats.patch --]
[-- Type: text/plain, Size: 3187 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/hamradio/yam.c	2009-01-09 10:16:50.000000000 -0800
+++ b/drivers/net/hamradio/yam.c	2009-01-09 12:54:25.000000000 -0800
@@ -115,10 +115,6 @@ struct yam_port {
 
 	struct net_device *dev;
 
-	/* Stats section */
-
-	struct net_device_stats stats;
-
 	int nb_rxint;
 	int nb_mdint;
 
@@ -507,7 +503,7 @@ static inline void yam_rx_flag(struct ne
 		} else {
 			if (!(skb = dev_alloc_skb(pkt_len))) {
 				printk(KERN_WARNING "%s: memory squeeze, dropping packet\n", dev->name);
-				++yp->stats.rx_dropped;
+				++dev->stats.rx_dropped;
 			} else {
 				unsigned char *cp;
 				cp = skb_put(skb, pkt_len);
@@ -515,7 +511,7 @@ static inline void yam_rx_flag(struct ne
 				memcpy(cp, yp->rx_buf, pkt_len - 1);
 				skb->protocol = ax25_type_trans(skb, dev);
 				netif_rx(skb);
-				++yp->stats.rx_packets;
+				++dev->stats.rx_packets;
 			}
 		}
 	}
@@ -677,7 +673,7 @@ static void yam_tx_byte(struct net_devic
 			yp->tx_count = 1;
 			yp->tx_state = TX_HEAD;
 		}
-		++yp->stats.tx_packets;
+		++dev->stats.tx_packets;
 		break;
 	case TX_TAIL:
 		if (--yp->tx_count <= 0) {
@@ -716,7 +712,7 @@ static irqreturn_t yam_interrupt(int irq
 			handled = 1;
 
 			if (lsr & LSR_OE)
-				++yp->stats.rx_fifo_errors;
+				++dev->stats.rx_fifo_errors;
 
 			yp->dcd = (msr & RX_DCD) ? 1 : 0;
 
@@ -778,11 +774,11 @@ static int yam_seq_show(struct seq_file 
 	seq_printf(seq, "  TxTail   %u\n", yp->txtail);
 	seq_printf(seq, "  SlotTime %u\n", yp->slot);
 	seq_printf(seq, "  Persist  %u\n", yp->pers);
-	seq_printf(seq, "  TxFrames %lu\n", yp->stats.tx_packets);
-	seq_printf(seq, "  RxFrames %lu\n", yp->stats.rx_packets);
+	seq_printf(seq, "  TxFrames %lu\n", dev->stats.tx_packets);
+	seq_printf(seq, "  RxFrames %lu\n", dev->stats.rx_packets);
 	seq_printf(seq, "  TxInt    %u\n", yp->nb_mdint);
 	seq_printf(seq, "  RxInt    %u\n", yp->nb_rxint);
-	seq_printf(seq, "  RxOver   %lu\n", yp->stats.rx_fifo_errors);
+	seq_printf(seq, "  RxOver   %lu\n", dev->stats.rx_fifo_errors);
 	seq_printf(seq, "\n");
 	return 0;
 }
@@ -812,26 +808,6 @@ static const struct file_operations yam_
 
 /* --------------------------------------------------------------------- */
 
-static struct net_device_stats *yam_get_stats(struct net_device *dev)
-{
-	struct yam_port *yp;
-
-	if (!dev)
-		return NULL;
-
-	yp = netdev_priv(dev);
-	if (yp->magic != YAM_MAGIC)
-		return NULL;
-
-	/* 
-	 * Get the current statistics.  This may be called with the
-	 * card open or closed. 
-	 */
-	return &yp->stats;
-}
-
-/* --------------------------------------------------------------------- */
-
 static int yam_open(struct net_device *dev)
 {
 	struct yam_port *yp = netdev_priv(dev);
@@ -878,9 +854,9 @@ static int yam_open(struct net_device *d
 	/* Reset overruns for all ports - FPGA programming makes overruns */
 	for (i = 0; i < NR_PORTS; i++) {
 		struct net_device *dev = yam_devs[i];
-		struct yam_port *yp = netdev_priv(dev);
+
 		inb(LSR(dev->base_addr));
-		yp->stats.rx_fifo_errors = 0;
+		dev->stats.rx_fifo_errors = 0;
 	}
 
 	printk(KERN_INFO "%s at iobase 0x%lx irq %u uart %s\n", dev->name, dev->base_addr, dev->irq,



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 41/45] yam: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (39 preceding siblings ...)
  2009-01-09 23:01 ` [patch 40/45] yam: convert to internal net_device_stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 42/45] scc: convert to internal net_device_ops Stephen Hemminger
                   ` (4 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, jpr; +Cc: netdev, linux-hams

[-- Attachment #1: yam-netdev.patch --]
[-- Type: text/plain, Size: 1218 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/hamradio/yam.c	2009-01-09 12:54:25.000000000 -0800
+++ b/drivers/net/hamradio/yam.c	2009-01-09 12:54:26.000000000 -0800
@@ -1044,6 +1044,14 @@ static int yam_set_mac_address(struct ne
 
 /* --------------------------------------------------------------------- */
 
+static const struct net_device_ops yam_netdev_ops = {
+	.ndo_open	     = yam_open,
+	.ndo_stop	     = yam_close,
+	.ndo_start_xmit      = yam_send_packet,
+	.ndo_do_ioctl 	     = yam_ioctl,
+	.ndo_set_mac_address = yam_set_mac_address,
+};
+
 static void yam_setup(struct net_device *dev)
 {
 	struct yam_port *yp = netdev_priv(dev);
@@ -1064,18 +1072,11 @@ static void yam_setup(struct net_device 
 	dev->base_addr = yp->iobase;
 	dev->irq = yp->irq;
 
-	dev->open = yam_open;
-	dev->stop = yam_close;
-	dev->do_ioctl = yam_ioctl;
-	dev->hard_start_xmit = yam_send_packet;
-	dev->get_stats = yam_get_stats;
-
 	skb_queue_head_init(&yp->send_queue);
 
+	dev->netdev_ops = &yam_netdev_ops;
 	dev->header_ops = &ax25_header_ops;
 
-	dev->set_mac_address = yam_set_mac_address;
-
 	dev->type = ARPHRD_AX25;
 	dev->hard_header_len = AX25_MAX_HEADER_LEN;
 	dev->mtu = AX25_MTU;



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 42/45] scc: convert to internal net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (40 preceding siblings ...)
  2009-01-09 23:01 ` [patch 41/45] yam: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 43/45] mkiss: convert to internal network device stats Stephen Hemminger
                   ` (3 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, klaus.kudielka; +Cc: netdev, linux-hams

[-- Attachment #1: scc-netdev.patch --]
[-- Type: text/plain, Size: 1324 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/hamradio/scc.c	2009-01-08 08:30:11.000000000 -0800
+++ b/drivers/net/hamradio/scc.c	2009-01-08 15:23:35.000000000 -0800
@@ -1542,23 +1542,24 @@ static int scc_net_alloc(const char *nam
 /* *			    Network driver methods		      * */
 /* ******************************************************************** */
 
+static const struct net_device_ops scc_netdev_ops = {
+	.ndo_open            = scc_net_open,
+	.ndo_stop	     = scc_net_close,
+	.ndo_start_xmit	     = scc_net_tx,
+	.ndo_set_mac_address = scc_net_set_mac_address,
+	.ndo_get_stats       = scc_net_get_stats,
+	.ndo_do_ioctl        = scc_net_ioctl,
+};
+
 /* ----> Initialize device <----- */
 
 static void scc_net_setup(struct net_device *dev)
 {
 	dev->tx_queue_len    = 16;	/* should be enough... */
 
-	dev->open            = scc_net_open;
-	dev->stop	     = scc_net_close;
-
-	dev->hard_start_xmit = scc_net_tx;
+	dev->netdev_ops	     = &scc_netdev_ops;
 	dev->header_ops      = &ax25_header_ops;
 
-	dev->set_mac_address = scc_net_set_mac_address;
-	dev->get_stats       = scc_net_get_stats;
-	dev->do_ioctl        = scc_net_ioctl;
-	dev->tx_timeout      = NULL;
-
 	memcpy(dev->broadcast, &ax25_bcast,  AX25_ADDR_LEN);
 	memcpy(dev->dev_addr,  &ax25_defaddr, AX25_ADDR_LEN);
  



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 43/45] mkiss: convert to internal network device stats
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (41 preceding siblings ...)
  2009-01-09 23:01 ` [patch 42/45] scc: convert to internal net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 44/45] dmascc: convert to net_device_ops Stephen Hemminger
                   ` (2 subsequent siblings)
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-hams

[-- Attachment #1: mkiss-stats.patch --]
[-- Type: text/plain, Size: 3960 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/hamradio/mkiss.c	2009-01-09 10:16:50.000000000 -0800
+++ b/drivers/net/hamradio/mkiss.c	2009-01-09 12:57:32.000000000 -0800
@@ -59,8 +59,6 @@ struct mkiss {
 	unsigned char		*xhead;	/* pointer to next byte to XMIT */
 	int			xleft;	/* bytes left in XMIT queue     */
 
-	struct net_device_stats	stats;
-
 	/* Detailed SLIP statistics. */
 	int		mtu;		/* Our mtu (to spot changes!)   */
 	int		buffsize;	/* Max buffers sizes            */
@@ -253,7 +251,7 @@ static void ax_bump(struct mkiss *ax)
 	if (ax->rbuff[0] > 0x0f) {
 		if (ax->rbuff[0] & 0x80) {
 			if (check_crc_16(ax->rbuff, ax->rcount) < 0) {
-				ax->stats.rx_errors++;
+				ax->dev->stats.rx_errors++;
 				spin_unlock_bh(&ax->buflock);
 
 				return;
@@ -268,7 +266,7 @@ static void ax_bump(struct mkiss *ax)
 			*ax->rbuff &= ~0x80;
 		} else if (ax->rbuff[0] & 0x20)  {
 			if (check_crc_flex(ax->rbuff, ax->rcount) < 0) {
-				ax->stats.rx_errors++;
+				ax->dev->stats.rx_errors++;
 				spin_unlock_bh(&ax->buflock);
 				return;
 			}
@@ -295,7 +293,7 @@ static void ax_bump(struct mkiss *ax)
 	if ((skb = dev_alloc_skb(count)) == NULL) {
 		printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
 		       ax->dev->name);
-		ax->stats.rx_dropped++;
+		ax->dev->stats.rx_dropped++;
 		spin_unlock_bh(&ax->buflock);
 		return;
 	}
@@ -303,8 +301,8 @@ static void ax_bump(struct mkiss *ax)
 	memcpy(skb_put(skb,count), ax->rbuff, count);
 	skb->protocol = ax25_type_trans(skb, ax->dev);
 	netif_rx(skb);
-	ax->stats.rx_packets++;
-	ax->stats.rx_bytes += count;
+	ax->dev->stats.rx_packets++;
+	ax->dev->stats.rx_bytes += count;
 	spin_unlock_bh(&ax->buflock);
 }
 
@@ -344,7 +342,7 @@ static void kiss_unesc(struct mkiss *ax,
 			return;
 		}
 
-		ax->stats.rx_over_errors++;
+		ax->dev->stats.rx_over_errors++;
 		set_bit(AXF_ERROR, &ax->flags);
 	}
 	spin_unlock_bh(&ax->buflock);
@@ -406,7 +404,7 @@ static void ax_changedmtu(struct mkiss *
 			memcpy(ax->xbuff, ax->xhead, ax->xleft);
 		} else  {
 			ax->xleft = 0;
-			ax->stats.tx_dropped++;
+			dev->stats.tx_dropped++;
 		}
 	}
 
@@ -417,7 +415,7 @@ static void ax_changedmtu(struct mkiss *
 			memcpy(ax->rbuff, orbuff, ax->rcount);
 		} else  {
 			ax->rcount = 0;
-			ax->stats.rx_over_errors++;
+			dev->stats.rx_over_errors++;
 			set_bit(AXF_ERROR, &ax->flags);
 		}
 	}
@@ -444,7 +442,7 @@ static void ax_encaps(struct net_device 
 	if (len > ax->mtu) {		/* Sigh, shouldn't occur BUT ... */
 		len = ax->mtu;
 		printk(KERN_ERR "mkiss: %s: truncating oversized transmit packet!\n", ax->dev->name);
-		ax->stats.tx_dropped++;
+		dev->stats.tx_dropped++;
 		netif_start_queue(dev);
 		return;
 	}
@@ -518,8 +516,8 @@ static void ax_encaps(struct net_device 
 
 	set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags);
 	actual = ax->tty->ops->write(ax->tty, ax->xbuff, count);
-	ax->stats.tx_packets++;
-	ax->stats.tx_bytes += actual;
+	dev->stats.tx_packets++;
+	dev->stats.tx_bytes += actual;
 
 	ax->dev->trans_start = jiffies;
 	ax->xleft = count - actual;
@@ -664,13 +662,6 @@ static int ax_close(struct net_device *d
 	return 0;
 }
 
-static struct net_device_stats *ax_get_stats(struct net_device *dev)
-{
-	struct mkiss *ax = netdev_priv(dev);
-
-	return &ax->stats;
-}
-
 static const struct header_ops ax_header_ops = {
 	.create    = ax_header,
 	.rebuild   = ax_rebuild_header,
@@ -683,7 +674,6 @@ static void ax_setup(struct net_device *
 	dev->hard_start_xmit = ax_xmit;
 	dev->open            = ax_open_dev;
 	dev->stop            = ax_close;
-	dev->get_stats	     = ax_get_stats;
 	dev->set_mac_address = ax_set_mac_address;
 	dev->hard_header_len = 0;
 	dev->addr_len        = 0;
@@ -929,7 +919,7 @@ static void mkiss_receive_buf(struct tty
 	while (count--) {
 		if (fp != NULL && *fp++) {
 			if (!test_and_set_bit(AXF_ERROR, &ax->flags))
-				ax->stats.rx_errors++;
+				ax->dev->stats.rx_errors++;
 			cp++;
 			continue;
 		}



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 44/45] dmascc: convert to net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (42 preceding siblings ...)
  2009-01-09 23:01 ` [patch 43/45] mkiss: convert to internal network device stats Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-09 23:01 ` [patch 45/45] dmascc: convert to internal net_device_ops Stephen Hemminger
  2009-01-10  1:32 ` [patch 00/45] Another batch of network device conversions David Miller
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-hams

[-- Attachment #1: mkiss-netdev.patch --]
[-- Type: text/plain, Size: 1057 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/hamradio/mkiss.c	2009-01-09 12:57:32.000000000 -0800
+++ b/drivers/net/hamradio/mkiss.c	2009-01-09 12:58:45.000000000 -0800
@@ -667,19 +667,23 @@ static const struct header_ops ax_header
 	.rebuild   = ax_rebuild_header,
 };
 
+static const struct net_device_ops ax_netdev_ops = {
+	.ndo_open            = ax_open_dev,
+	.ndo_stop            = ax_close,
+	.ndo_start_xmit	     = ax_xmit,
+	.ndo_set_mac_address = ax_set_mac_address,
+};
+
 static void ax_setup(struct net_device *dev)
 {
 	/* Finish setting up the DEVICE info. */
 	dev->mtu             = AX_MTU;
-	dev->hard_start_xmit = ax_xmit;
-	dev->open            = ax_open_dev;
-	dev->stop            = ax_close;
-	dev->set_mac_address = ax_set_mac_address;
 	dev->hard_header_len = 0;
 	dev->addr_len        = 0;
 	dev->type            = ARPHRD_AX25;
 	dev->tx_queue_len    = 10;
 	dev->header_ops      = &ax_header_ops;
+	dev->netdev_ops	     = &ax_netdev_ops;
 
 
 	memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);



^ permalink raw reply	[flat|nested] 56+ messages in thread

* [patch 45/45] dmascc: convert to internal net_device_ops
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (43 preceding siblings ...)
  2009-01-09 23:01 ` [patch 44/45] dmascc: convert to net_device_ops Stephen Hemminger
@ 2009-01-09 23:01 ` Stephen Hemminger
  2009-01-10  1:32 ` [patch 00/45] Another batch of network device conversions David Miller
  45 siblings, 0 replies; 56+ messages in thread
From: Stephen Hemminger @ 2009-01-09 23:01 UTC (permalink / raw)
  To: David Miller, klaus.kudielka; +Cc: netdev, linux-hams

[-- Attachment #1: 82596-netdev.patch --]
[-- Type: text/plain, Size: 1175 bytes --]

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/82596.c	2009-01-08 08:30:09.000000000 -0800
+++ b/drivers/net/82596.c	2009-01-09 14:05:18.000000000 -0800
@@ -1122,6 +1122,17 @@ static void print_eth(unsigned char *add
 static int io = 0x300;
 static int irq = 10;
 
+static const struct net_device_ops i596_netdev_ops = {
+	.ndo_open 		= i596_open,
+	.ndo_stop		= i596_close,
+	.ndo_start_xmit		= i596_start_xmit,
+	.ndo_set_multicast_list = set_multicast_list,
+	.ndo_tx_timeout		= i596_tx_timeout,
+	.ndo_change_mtu		= eth_change_mtu,
+	.ndo_set_mac_address 	= eth_mac_addr,
+	.ndo_validate_addr	= eth_validate_addr,
+};
+
 struct net_device * __init i82596_probe(int unit)
 {
 	struct net_device *dev;
@@ -1232,11 +1243,7 @@ found:
 	DEB(DEB_PROBE,printk(KERN_INFO "%s", version));
 
 	/* The 82596-specific entries in the device structure. */
-	dev->open = i596_open;
-	dev->stop = i596_close;
-	dev->hard_start_xmit = i596_start_xmit;
-	dev->set_multicast_list = set_multicast_list;
-	dev->tx_timeout = i596_tx_timeout;
+	dev->netdev_ops = &i596_netdev_ops;
 	dev->watchdog_timeo = TX_TIMEOUT;
 
 	dev->ml_priv = (void *)(dev->mem_start);



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [patch 32/45] baycom: convert to internal net_device_stats
  2009-01-09 23:01 ` [patch 32/45] baycom: convert to internal net_device_stats Stephen Hemminger
@ 2009-01-10  0:03   ` Thomas Sailer
  0 siblings, 0 replies; 56+ messages in thread
From: Thomas Sailer @ 2009-01-10  0:03 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev, linux-hams

On Fri, 2009-01-09 at 15:01 -0800, Stephen Hemminger wrote:
> plain text document attachment (baycom-stats.patch)
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Thomas Sailer <t.sailer@alumni.ethz.ch>

Thanks!




^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [patch 33/45] baycom: convert to net_device_ops
  2009-01-09 23:01 ` [patch 33/45] baycom: convert to net_device_ops Stephen Hemminger
@ 2009-01-10  0:03   ` Thomas Sailer
  0 siblings, 0 replies; 56+ messages in thread
From: Thomas Sailer @ 2009-01-10  0:03 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev, linux-hams

On Fri, 2009-01-09 at 15:01 -0800, Stephen Hemminger wrote:
> plain text document attachment (baycom-netdev.patch)
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Thomas Sailer <t.sailer@alumni.ethz.ch>

Thanks!



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [patch 39/45] hdlcdrv: convert to net_device_ops
  2009-01-09 23:01 ` [patch 39/45] hdlcdrv: convert to net_device_ops Stephen Hemminger
@ 2009-01-10  0:03   ` Thomas Sailer
  0 siblings, 0 replies; 56+ messages in thread
From: Thomas Sailer @ 2009-01-10  0:03 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev, linux-hams

On Fri, 2009-01-09 at 15:01 -0800, Stephen Hemminger wrote:
> plain text document attachment (hdlcdrv-netdev.patch)
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Thomas Sailer <t.sailer@alumni.ethz.ch>

Thanks!



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [patch 38/45] hdlcdrv: convert to internal net_device_stats
  2009-01-09 23:01 ` [patch 38/45] hdlcdrv: convert to internal net_device_stats Stephen Hemminger
@ 2009-01-10  0:03   ` Thomas Sailer
  0 siblings, 0 replies; 56+ messages in thread
From: Thomas Sailer @ 2009-01-10  0:03 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev, linux-hams

On Fri, 2009-01-09 at 15:01 -0800, Stephen Hemminger wrote:
> plain text document attachment (hdlcdrv-stats.patch)
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Thomas Sailer <t.sailer@alumni.ethz.ch>

Thanks!



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [patch 00/45] Another batch of network device conversions
  2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
                   ` (44 preceding siblings ...)
  2009-01-09 23:01 ` [patch 45/45] dmascc: convert to internal net_device_ops Stephen Hemminger
@ 2009-01-10  1:32 ` David Miller
  45 siblings, 0 replies; 56+ messages in thread
From: David Miller @ 2009-01-10  1:32 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Fri, 09 Jan 2009 15:00:57 -0800

> That's all for this week.
> Compile tested on x86 only.

All applied, I'll push out to kernel.org after some build
testing of my own.

Thanks!

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [patch 06/45] netrom: convert to internal net_device_stats
  2009-01-09 23:01 ` [patch 06/45] netrom: convert to internal net_device_stats Stephen Hemminger
@ 2009-01-10 12:54   ` Ralf Baechle DL5RB
  2009-01-11  8:15     ` David Miller
  0 siblings, 1 reply; 56+ messages in thread
From: Ralf Baechle DL5RB @ 2009-01-10 12:54 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev, linux-hams

On Fri, Jan 09, 2009 at 03:01:03PM -0800, Stephen Hemminger wrote:

> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Acked-by: Ralf Baechle <ralf@linux-mips.org>

  Ralf

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [patch 07/45] netrom: convert to net_device_ops
  2009-01-09 23:01 ` [patch 07/45] netrom: convert to net_device_ops Stephen Hemminger
@ 2009-01-10 12:55   ` Ralf Baechle DL5RB
  0 siblings, 0 replies; 56+ messages in thread
From: Ralf Baechle DL5RB @ 2009-01-10 12:55 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev, linux-hams

On Fri, Jan 09, 2009 at 03:01:04PM -0800, Stephen Hemminger wrote:
> From: Stephen Hemminger <shemminger@linux-foundation.org>
> Date: Fri, 09 Jan 2009 15:01:04 -0800
> To: David Miller <davem@davemloft.net>, Ralf Baechle <ralf@linux-mips.org>
> Cc: netdev@vger.kernel.org, linux-hams@vger.kernel.org
> Subject: [patch 07/45] netrom: convert to net_device_ops
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Acked-by: Ralf Baechle <ralf@linux-mips.org>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [patch 08/45] rose: convert to internal net_device_stats
  2009-01-09 23:01 ` [patch 08/45] rose: convert to internal net_device_stats Stephen Hemminger
@ 2009-01-10 12:55   ` Ralf Baechle DL5RB
  0 siblings, 0 replies; 56+ messages in thread
From: Ralf Baechle DL5RB @ 2009-01-10 12:55 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev, linux-hams

On Fri, Jan 09, 2009 at 03:01:05PM -0800, Stephen Hemminger wrote:
> From: Stephen Hemminger <shemminger@linux-foundation.org>
> Date: Fri, 09 Jan 2009 15:01:05 -0800
> To: David Miller <davem@davemloft.net>, Ralf Baechle <ralf@linux-mips.org>
> Cc: netdev@vger.kernel.org, linux-hams@vger.kernel.org
> Subject: [patch 08/45] rose: convert to internal net_device_stats
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Acked-by: Ralf Baechle <ralf@linux-mips.org>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [patch 09/45] rose: convert to network_device_ops
  2009-01-09 23:01 ` [patch 09/45] rose: convert to network_device_ops Stephen Hemminger
@ 2009-01-10 12:55   ` Ralf Baechle DL5RB
  0 siblings, 0 replies; 56+ messages in thread
From: Ralf Baechle DL5RB @ 2009-01-10 12:55 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev, linux-hams

On Fri, Jan 09, 2009 at 03:01:06PM -0800, Stephen Hemminger wrote:
> From: Stephen Hemminger <shemminger@linux-foundation.org>
> Date: Fri, 09 Jan 2009 15:01:06 -0800
> To: David Miller <davem@davemloft.net>, Ralf Baechle <ralf@linux-mips.org>
> Cc: netdev@vger.kernel.org, linux-hams@vger.kernel.org
> Subject: [patch 09/45] rose: convert to network_device_ops
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Acked-by: Ralf Baechle <ralf@linux-mips.org>

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [patch 06/45] netrom: convert to internal net_device_stats
  2009-01-10 12:54   ` Ralf Baechle DL5RB
@ 2009-01-11  8:15     ` David Miller
  0 siblings, 0 replies; 56+ messages in thread
From: David Miller @ 2009-01-11  8:15 UTC (permalink / raw)
  To: ralf; +Cc: shemminger, netdev, linux-hams

From: Ralf Baechle DL5RB <ralf@linux-mips.org>
Date: Sat, 10 Jan 2009 12:54:48 +0000

> On Fri, Jan 09, 2009 at 03:01:03PM -0800, Stephen Hemminger wrote:
> 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> Acked-by: Ralf Baechle <ralf@linux-mips.org>

I've added your ACKs for these 4 patches, thanks Ralf.

^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2009-01-11  8:15 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-09 23:00 [patch 00/45] Another batch of network device conversions Stephen Hemminger
2009-01-09 23:00 ` [patch 01/45] atm: br2684 internal stats Stephen Hemminger
2009-01-09 23:00 ` [patch 02/45] br2684: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 03/45] clip: convert to internal network_device_stats Stephen Hemminger
2009-01-09 23:01 ` [patch 04/45] lec: " Stephen Hemminger
2009-01-09 23:01 ` [patch 05/45] lec: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 06/45] netrom: convert to internal net_device_stats Stephen Hemminger
2009-01-10 12:54   ` Ralf Baechle DL5RB
2009-01-11  8:15     ` David Miller
2009-01-09 23:01 ` [patch 07/45] netrom: convert to net_device_ops Stephen Hemminger
2009-01-10 12:55   ` Ralf Baechle DL5RB
2009-01-09 23:01 ` [patch 08/45] rose: convert to internal net_device_stats Stephen Hemminger
2009-01-10 12:55   ` Ralf Baechle DL5RB
2009-01-09 23:01 ` [patch 09/45] rose: convert to network_device_ops Stephen Hemminger
2009-01-10 12:55   ` Ralf Baechle DL5RB
2009-01-09 23:01 ` [patch 10/45] appletalk: remove unneeded stubs Stephen Hemminger
2009-01-09 23:01 ` [patch 11/45] arcnet: convert to internal stats Stephen Hemminger
2009-01-09 23:01 ` [patch 12/45] arcnet: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 13/45] com20020: convert to net_devic_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 14/45] 3c501: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 15/45] 3c505: " Stephen Hemminger
2009-01-09 23:01 ` [patch 16/45] 3c507: " Stephen Hemminger
2009-01-09 23:01 ` [patch 17/45] 3c509: " Stephen Hemminger
2009-01-09 23:01 ` [patch 18/45] 3c515: " Stephen Hemminger
2009-01-09 23:01 ` [patch 19/45] 3c523: " Stephen Hemminger
2009-01-09 23:01 ` [patch 20/45] 3c527: " Stephen Hemminger
2009-01-09 23:01 ` [patch 21/45] 3c59x: " Stephen Hemminger
2009-01-09 23:01 ` [patch 22/45] ibmtr: convert to internal network_device_stats Stephen Hemminger
2009-01-09 23:01 ` [patch 23/45] ibmtr: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 24/45] lanstreamer: convert to internal network stats Stephen Hemminger
2009-01-09 23:01 ` [patch 25/45] lanstreamer: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 26/45] olympic: convert to internal network device stats Stephen Hemminger
2009-01-09 23:01 ` [patch 27/45] olympic: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 28/45] tms380tr: " Stephen Hemminger
2009-01-09 23:01 ` [patch 29/45] 3c559: " Stephen Hemminger
2009-01-09 23:01 ` [patch 30/45] znet: " Stephen Hemminger
2009-01-09 23:01 ` [patch 31/45] 6pack: " Stephen Hemminger
2009-01-09 23:01 ` [patch 32/45] baycom: convert to internal net_device_stats Stephen Hemminger
2009-01-10  0:03   ` Thomas Sailer
2009-01-09 23:01 ` [patch 33/45] baycom: convert to net_device_ops Stephen Hemminger
2009-01-10  0:03   ` Thomas Sailer
2009-01-09 23:01 ` [patch 34/45] bpqether: convert to internal net_device_stats Stephen Hemminger
2009-01-09 23:01 ` [patch 35/45] bpqether: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 36/45] dmascc: convert to internal network device stats Stephen Hemminger
2009-01-09 23:01 ` [patch 37/45] dmascc: convert to network_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 38/45] hdlcdrv: convert to internal net_device_stats Stephen Hemminger
2009-01-10  0:03   ` Thomas Sailer
2009-01-09 23:01 ` [patch 39/45] hdlcdrv: convert to net_device_ops Stephen Hemminger
2009-01-10  0:03   ` Thomas Sailer
2009-01-09 23:01 ` [patch 40/45] yam: convert to internal net_device_stats Stephen Hemminger
2009-01-09 23:01 ` [patch 41/45] yam: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 42/45] scc: convert to internal net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 43/45] mkiss: convert to internal network device stats Stephen Hemminger
2009-01-09 23:01 ` [patch 44/45] dmascc: convert to net_device_ops Stephen Hemminger
2009-01-09 23:01 ` [patch 45/45] dmascc: convert to internal net_device_ops Stephen Hemminger
2009-01-10  1:32 ` [patch 00/45] Another batch of network device conversions David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).