diff mbox

[RFC,net-next] tun: implement BQL

Message ID 20121112132241.12bb94e4@nehalam.linuxnetplumber.net
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

stephen hemminger Nov. 12, 2012, 9:22 p.m. UTC
Add multiqueue BQL to tap device. Tested with VPN, doesn't have a big impact,
most likely because there is little queueing occuring at TAP device except
under case of forwarding.

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

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

Comments

David Miller Nov. 13, 2012, 10:19 p.m. UTC | #1
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Mon, 12 Nov 2012 13:22:41 -0800

> Add multiqueue BQL to tap device. Tested with VPN, doesn't have a big impact,
> most likely because there is little queueing occuring at TAP device except
> under case of forwarding.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

I think unless we can show it making an impact in a normal
usage scenerio, we should leave it alone for now.
--
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
stephen hemminger Nov. 13, 2012, 10:39 p.m. UTC | #2
On Tue, 13 Nov 2012 17:19:39 -0500 (EST)
David Miller <davem@davemloft.net> wrote:

> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Mon, 12 Nov 2012 13:22:41 -0800
> 
> > Add multiqueue BQL to tap device. Tested with VPN, doesn't have a big impact,
> > most likely because there is little queueing occuring at TAP device except
> > under case of forwarding.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> I think unless we can show it making an impact in a normal
> usage scenerio, we should leave it alone for now.

Agreed, that is why I submitted as RFC.
--
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

--- a/drivers/net/tun.c	2012-11-12 07:58:45.527037947 -0800
+++ b/drivers/net/tun.c	2012-11-12 11:20:26.017512742 -0800
@@ -412,6 +412,7 @@  static void __tun_detach(struct tun_file
 		tun_flow_delete_by_queue(tun, tun->numqueues + 1);
 		/* Drop read queue */
 		skb_queue_purge(&tfile->sk.sk_receive_queue);
+		netdev_tx_reset_queue(netdev_get_tx_queue(dev, index));
 		tun_set_real_num_queues(tun);
 
 		if (tun->numqueues == 0 && !(tun->flags & TUN_PERSIST))
@@ -455,6 +456,7 @@  static void tun_detach_all(struct net_de
 						  lockdep_rtnl_is_held());
 		/* Drop read queue */
 		skb_queue_purge(&tfile->sk.sk_receive_queue);
+		netdev_tx_reset_queue(netdev_get_tx_queue(dev, i));
 		sock_put(&tfile->sk);
 	}
 }
@@ -712,6 +714,8 @@  static netdev_tx_t tun_net_xmit(struct s
 	 * for indefinite time. */
 	if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
 		goto drop;
+
+	netdev_tx_sent_queue(netdev_get_tx_queue(dev, txq), skb->len);
 	skb_orphan(skb);
 
 	/* Enqueue packet */
@@ -1324,6 +1328,10 @@  static ssize_t tun_do_read(struct tun_st
 		netif_wake_subqueue(tun->dev, tfile->queue_index);
 
 		ret = tun_put_user(tun, tfile, skb, iv, len);
+
+		netdev_tx_completed_queue(netdev_get_tx_queue(tun->dev,
+							      tfile->queue_index),
+					  1, skb->len);
 		kfree_skb(skb);
 		break;
 	}