All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: David Miller <davem@davemloft.net>,
	Chas Williams <chas@cmf.nrl.navy.mil>
Cc: netdev@vger.kernel.org
Subject: [patch 04/45] lec: convert to internal network_device_stats
Date: Fri, 09 Jan 2009 15:01:01 -0800	[thread overview]
Message-ID: <20090109230137.002883258@linux-foundation.org> (raw)
In-Reply-To: 20090109230057.575650817@linux-foundation.org

[-- 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);



  parent reply	other threads:[~2009-01-09 23:18 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Stephen Hemminger [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090109230137.002883258@linux-foundation.org \
    --to=shemminger@linux-foundation.org \
    --cc=chas@cmf.nrl.navy.mil \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.