Patchwork kaweth:BQL support

login
register
mail settings
Submitter Oliver Neukum
Date Nov. 9, 2012, 12:19 p.m.
Message ID <1352463587-23899-1-git-send-email-oliver@neukum.org>
Download mbox | patch
Permalink /patch/198031/
State Deferred
Delegated to: David Miller
Headers show

Comments

Oliver Neukum - Nov. 9, 2012, 12:19 p.m.
This adds the callbacks for the statistics necessary for BQL

Signed-off-by: Oliver Neukum <oneukum@suse.de>
---
 drivers/net/usb/kaweth.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
Eric Dumazet - Nov. 9, 2012, 1:15 p.m.
On Fri, 2012-11-09 at 13:19 +0100, Oliver Neukum wrote:
> This adds the callbacks for the statistics necessary for BQL
> 
> Signed-off-by: Oliver Neukum <oneukum@suse.de>
> ---
>  drivers/net/usb/kaweth.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
> index afb117c..f30e07f 100644
> --- a/drivers/net/usb/kaweth.c
> +++ b/drivers/net/usb/kaweth.c
> @@ -715,6 +715,7 @@ static int kaweth_open(struct net_device *net)
>  		usb_kill_urb(kaweth->rx_urb);
>  		goto err_out;
>  	}
> +	netdev_reset_queue(net);
>  	kaweth->opened = 1;
>  
>  	netif_start_queue(net);
> @@ -783,6 +784,7 @@ static void kaweth_usb_transmit_complete(struct urb *urb)
>  {
>  	struct kaweth_device *kaweth = urb->context;
>  	struct sk_buff *skb = kaweth->tx_skb;
> +	struct net_device *net = kaweth->net;
>  	int status = urb->status;
>  
>  	if (unlikely(status != 0))
> @@ -790,7 +792,8 @@ static void kaweth_usb_transmit_complete(struct urb *urb)
>  			dev_dbg(&urb->dev->dev, "%s: TX status %d.\n",
>  				kaweth->net->name, status);
>  
> -	netif_wake_queue(kaweth->net);
> +	netif_wake_queue(net);
> +	netdev_completed_queue(net, 1, skb->len - 2);
>  	dev_kfree_skb_irq(skb);
>  }
>  
> @@ -854,6 +857,7 @@ skip:
>  	{
>  		kaweth->stats.tx_packets++;
>  		kaweth->stats.tx_bytes += skb->len;
> +		netdev_sent_queue(net, skb->len - 2);
>  	}
>  
>  	spin_unlock_irq(&kaweth->device_lock);


I am curious to know if it changes anything on the behavior of this
network adapter ?

Because it seems queue is stopped anyway when a packet is in transmit.

(netif_stop_queue() in kaweth_start_xmit(), and netif_wake_queue() in
kaweth_usb_transmit_complete())

What I am missing ?

Thanks


--
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
Oliver Neukum - Nov. 12, 2012, 7:38 a.m.
On Friday 09 November 2012 05:15:44 Eric Dumazet wrote:
> I am curious to know if it changes anything on the behavior of this
> network adapter ?
> 
> Because it seems queue is stopped anyway when a packet is in transmit.

True, I'd need to also do more changes on the tx path.

Dave, for now please disregard the patch.

	Regards
		Oliver

--
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
David Miller - Nov. 12, 2012, 7:59 a.m.
From: Oliver Neukum <oliver@neukum.org>
Date: Mon, 12 Nov 2012 08:38:57 +0100

> On Friday 09 November 2012 05:15:44 Eric Dumazet wrote:
>> I am curious to know if it changes anything on the behavior of this
>> network adapter ?
>> 
>> Because it seems queue is stopped anyway when a packet is in transmit.
> 
> True, I'd need to also do more changes on the tx path.
> 
> Dave, for now please disregard the patch.

Ok.
--
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

Patch

diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index afb117c..f30e07f 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -715,6 +715,7 @@  static int kaweth_open(struct net_device *net)
 		usb_kill_urb(kaweth->rx_urb);
 		goto err_out;
 	}
+	netdev_reset_queue(net);
 	kaweth->opened = 1;
 
 	netif_start_queue(net);
@@ -783,6 +784,7 @@  static void kaweth_usb_transmit_complete(struct urb *urb)
 {
 	struct kaweth_device *kaweth = urb->context;
 	struct sk_buff *skb = kaweth->tx_skb;
+	struct net_device *net = kaweth->net;
 	int status = urb->status;
 
 	if (unlikely(status != 0))
@@ -790,7 +792,8 @@  static void kaweth_usb_transmit_complete(struct urb *urb)
 			dev_dbg(&urb->dev->dev, "%s: TX status %d.\n",
 				kaweth->net->name, status);
 
-	netif_wake_queue(kaweth->net);
+	netif_wake_queue(net);
+	netdev_completed_queue(net, 1, skb->len - 2);
 	dev_kfree_skb_irq(skb);
 }
 
@@ -854,6 +857,7 @@  skip:
 	{
 		kaweth->stats.tx_packets++;
 		kaweth->stats.tx_bytes += skb->len;
+		netdev_sent_queue(net, skb->len - 2);
 	}
 
 	spin_unlock_irq(&kaweth->device_lock);