netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
	Sandeep Gopalpet <Sandeep.Kumar@freescale.com>
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: [RFC] gianfar: multi queue stuff not complete
Date: Thu, 19 Nov 2009 09:28:15 +0100	[thread overview]
Message-ID: <4B05019F.4090208@gmail.com> (raw)

I noticed gianfar got multiqueue support recently, but it still
updates dev->stats.{tx_bytes|tx_packets|tx_dropped} without proper locking
(several cpus could update stats at same time while xmitting on different tx queues)

It should use txq->{tx_bytes|tx_packets|tx_dropped} to avoid wrong tx stats


I cooked following preliminar patch but its only for discussion, because I
dont know yet how to transform dev->stats.tx_dropped++; in gfar_error(),
and also because I cannot compile this driver on my dev machine.

(if a driver uses txq->tx... counters, it must not use any dev->stats.{tx_bytes|tx_packets|tx_dropped}
that are overwritten by dev_txq_stats_fold(). Or we could change dev_txq_stats_fold() logic
to get a mask of what fields a drivers updates in txq-> or dev->stats


diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 16def13..8fe38aa 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1937,7 +1937,8 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	}
 
 	/* Update transmit stats */
-	dev->stats.tx_bytes += skb->len;
+	txq->tx_bytes += skb->len;
+	txq->tx_packets++;
 
 	txbdp = txbdp_start = tx_queue->cur_tx;
 
@@ -2295,8 +2296,6 @@ static int gfar_clean_tx_ring(struct gfar_priv_tx_q *tx_queue)
 	tx_queue->skb_dirtytx = skb_dirtytx;
 	tx_queue->dirty_tx = bdp;
 
-	dev->stats.tx_packets += howmany;
-
 	return howmany;
 }
 

             reply	other threads:[~2009-11-19  8:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-19  8:28 Eric Dumazet [this message]
2009-11-19  8:52 ` [RFC] gianfar: multi queue stuff not complete Kumar Gopalpet-B05799
2009-11-19  9:13   ` Eric Dumazet
2009-11-19  9:14     ` Kumar Gopalpet-B05799

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=4B05019F.4090208@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=Sandeep.Kumar@freescale.com \
    --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 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).