netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] sky2: add bql support
@ 2011-11-29  4:19 Stephen Hemminger
  2011-11-29  6:38 ` Eric Dumazet
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stephen Hemminger @ 2011-11-29  4:19 UTC (permalink / raw)
  To: Tom Herbert; +Cc: netdev

Just for testing, here is how to add BQL support to sky2

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

--- a/drivers/net/ethernet/marvell/sky2.c	2011-11-23 12:00:14.953964611 -0800
+++ b/drivers/net/ethernet/marvell/sky2.c	2011-11-23 12:17:40.269120465 -0800
@@ -1110,6 +1110,7 @@ static void tx_init(struct sky2_port *sk
 	sky2->tx_prod = sky2->tx_cons = 0;
 	sky2->tx_tcpsum = 0;
 	sky2->tx_last_mss = 0;
+	netdev_reset_queue(sky2->netdev);
 
 	le = get_tx_le(sky2, &sky2->tx_prod);
 	le->addr = 0;
@@ -1971,6 +1972,7 @@ static netdev_tx_t sky2_xmit_frame(struc
 	if (tx_avail(sky2) <= MAX_SKB_TX_LE)
 		netif_stop_queue(dev);
 
+	netdev_sent_queue(dev, 1, skb->len);
 	sky2_put_idx(hw, txqaddr[sky2->port], sky2->tx_prod);
 
 	return NETDEV_TX_OK;
@@ -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);
 

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

* Re: [RFC] sky2: add bql support
  2011-11-29  4:19 [RFC] sky2: add bql support Stephen Hemminger
@ 2011-11-29  6:38 ` Eric Dumazet
  2011-11-29 17:47 ` David Miller
  2011-11-30  1:15 ` [PATCH] " Stephen Hemminger
  2 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2011-11-29  6:38 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Tom Herbert, netdev

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)

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

* Re: [RFC] sky2: add bql support
  2011-11-29  4:19 [RFC] sky2: add bql support Stephen Hemminger
  2011-11-29  6:38 ` Eric Dumazet
@ 2011-11-29 17:47 ` David Miller
  2011-11-30  1:15 ` [PATCH] " Stephen Hemminger
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2011-11-29 17:47 UTC (permalink / raw)
  To: shemminger; +Cc: therbert, netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Mon, 28 Nov 2011 20:19:07 -0800

> Just for testing, here is how to add BQL support to sky2
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Let me know when you have a final version of this, thanks.

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

* [PATCH] sky2: add bql support
  2011-11-29  4:19 [RFC] sky2: add bql support Stephen Hemminger
  2011-11-29  6:38 ` Eric Dumazet
  2011-11-29 17:47 ` David Miller
@ 2011-11-30  1:15 ` Stephen Hemminger
  2011-11-30  1:55   ` David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2011-11-30  1:15 UTC (permalink / raw)
  To: David Miller; +Cc: Tom Herbert, netdev

This adds support for byte queue limits and aggregates statistics
update (suggestion from Eric).

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

--- a/drivers/net/ethernet/marvell/sky2.c	2011-11-28 19:37:50.739557687 -0800
+++ b/drivers/net/ethernet/marvell/sky2.c	2011-11-29 16:44:52.786657199 -0800
@@ -1110,6 +1110,7 @@ static void tx_init(struct sky2_port *sk
 	sky2->tx_prod = sky2->tx_cons = 0;
 	sky2->tx_tcpsum = 0;
 	sky2->tx_last_mss = 0;
+	netdev_reset_queue(sky2->netdev);
 
 	le = get_tx_le(sky2, &sky2->tx_prod);
 	le->addr = 0;
@@ -1971,6 +1972,7 @@ static netdev_tx_t sky2_xmit_frame(struc
 	if (tx_avail(sky2) <= MAX_SKB_TX_LE)
 		netif_stop_queue(dev);
 
+	netdev_sent_queue(dev, skb->len);
 	sky2_put_idx(hw, txqaddr[sky2->port], sky2->tx_prod);
 
 	return NETDEV_TX_OK;
@@ -2002,7 +2004,8 @@ mapping_error:
 static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
 {
 	struct net_device *dev = sky2->netdev;
-	unsigned idx;
+	u16 idx;
+	unsigned int bytes_compl = 0, pkts_compl = 0;
 
 	BUG_ON(done >= sky2->tx_ring_size);
 
@@ -2017,10 +2020,8 @@ static void sky2_tx_complete(struct sky2
 			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_compl++;
+			bytes_compl += skb->len;
 
 			re->skb = NULL;
 			dev_kfree_skb_any(skb);
@@ -2031,6 +2032,13 @@ static void sky2_tx_complete(struct sky2
 
 	sky2->tx_cons = idx;
 	smp_mb();
+
+	netdev_completed_queue(dev, pkts_compl, bytes_compl);
+
+	u64_stats_update_begin(&sky2->tx_stats.syncp);
+	sky2->tx_stats.packets += pkts_compl;
+	sky2->tx_stats.bytes += bytes_compl;
+	u64_stats_update_end(&sky2->tx_stats.syncp);
 }
 
 static void sky2_tx_reset(struct sky2_hw *hw, unsigned port)

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

* Re: [PATCH] sky2: add bql support
  2011-11-30  1:15 ` [PATCH] " Stephen Hemminger
@ 2011-11-30  1:55   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2011-11-30  1:55 UTC (permalink / raw)
  To: shemminger; +Cc: therbert, netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Tue, 29 Nov 2011 17:15:33 -0800

> This adds support for byte queue limits and aggregates statistics
> update (suggestion from Eric).
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied.

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

end of thread, other threads:[~2011-11-30  1:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-29  4:19 [RFC] sky2: add bql support Stephen Hemminger
2011-11-29  6:38 ` Eric Dumazet
2011-11-29 17:47 ` David Miller
2011-11-30  1:15 ` [PATCH] " Stephen Hemminger
2011-11-30  1:55   ` 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).