diff mbox

[RFC] sky2: add bql support

Message ID 1322548736.2970.61.camel@edumazet-laptop
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Nov. 29, 2011, 6:38 a.m. UTC
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



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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)