Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Tom Herbert <therbert@google.com>, netdev@vger.kernel.org
Subject: Re: [RFC] sky2: add bql support
Date: Tue, 29 Nov 2011 07:38:56 +0100	[thread overview]
Message-ID: <1322548736.2970.61.camel@edumazet-laptop> (raw)
In-Reply-To: <20111128201907.6d31d4c3@nehalam.linuxnetplumber.net>

Le lundi 28 novembre 2011 à 20:19 -0800, Stephen Hemminger a écrit :
> Just for testing, here is how to add BQL support to sky2
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


> @@ -2022,6 +2024,8 @@ static void sky2_tx_complete(struct sky2
>  			sky2->tx_stats.bytes += skb->len;
>  			u64_stats_update_end(&sky2->tx_stats.syncp);
>  
> +			netdev_completed_queue(dev, 1, skb->len);
> +
>  			re->skb = NULL;
>  			dev_kfree_skb_any(skb);
>  

I believe you should batch these calls as much as possible.

This would also reduce the burden on
u64_stats_update_begin/u64_stats_update_end

diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 29adc78..1277c95 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -2003,6 +2003,7 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
 {
 	struct net_device *dev = sky2->netdev;
 	unsigned idx;
+	unsigned long pkts = 0, bytes = 0;
 
 	BUG_ON(done >= sky2->tx_ring_size);
 
@@ -2017,10 +2018,8 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
 			netif_printk(sky2, tx_done, KERN_DEBUG, dev,
 				     "tx done %u\n", idx);
 
-			u64_stats_update_begin(&sky2->tx_stats.syncp);
-			++sky2->tx_stats.packets;
-			sky2->tx_stats.bytes += skb->len;
-			u64_stats_update_end(&sky2->tx_stats.syncp);
+			pkts++;
+			bytes += skb->len;
 
 			re->skb = NULL;
 			dev_kfree_skb_any(skb);
@@ -2031,6 +2030,11 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
 
 	sky2->tx_cons = idx;
 	smp_mb();
+	u64_stats_update_begin(&sky2->tx_stats.syncp);
+	sky2->tx_stats.packets += pkts;
+	sky2->tx_stats.bytes += bytes;
+	u64_stats_update_end(&sky2->tx_stats.syncp);
+	netdev_completed_queue(dev, pkts, bytes);
 }
 
 static void sky2_tx_reset(struct sky2_hw *hw, unsigned port)

  reply	other threads:[~2011-11-29  6:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29  4:19 [RFC] sky2: add bql support Stephen Hemminger
2011-11-29  6:38 ` Eric Dumazet [this message]
2011-11-29 17:47 ` David Miller
2011-11-30  1:15 ` [PATCH] " Stephen Hemminger
2011-11-30  1:55   ` 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=1322548736.2970.61.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    --cc=therbert@google.com \
    /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