Skip to contentSkip to conversation

tun: implement BQL

RFC In review Stephen Hemminger 2 participants 3 messages Nov 12, 2012 – Nov 13, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 tun: implement BQL

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.

drivers/net/tun.c +8 -0
@@ -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;
 	}
maintainer
#1 lore raw

From: Stephen Hemminger <[email protected]>
Date: Mon, 12 Nov 2012 13:22:41 -0800

Quoted 5 lines

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.

I think unless we can show it making an impact in a normal usage scenerio, we should leave it alone for now.

#2 lore raw
Quoted 11 lines · On Tue, 13 Nov 2012 17:19:39 -0500 (EST) David Miller <[email protected]>…

From: Stephen Hemminger <[email protected]>
Date: Mon, 12 Nov 2012 13:22:41 -0800

Quoted 5 lines

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.

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.