summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2015-04-02 13:05:47 +0200
committerDavid S. Miller <davem@davemloft.net>2015-04-06 16:44:24 -0400
commit60302ff631f0f3eac0ec592e128b776f0676b397 (patch)
tree2dabf60760cf7e12d0d40bce8e332f375de22ba5
parent91bc4822c3d61b9bb7ef66d3b77948a4f9177954 (diff)
downloadop-kernel-dev-60302ff631f0f3eac0ec592e128b776f0676b397.zip
op-kernel-dev-60302ff631f0f3eac0ec592e128b776f0676b397.tar.gz
virtio: document queue state logic
commit d631b94e7a15277858ec5f88d674d93080506999 virtio: change comment in transmit started clarifying the logic behind queue state management, but introduced an inaccuracy: TX_BUSY does not cause a BUG message. Clean this up some more, explaining the tradeoffs in detail. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/virtio_net.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index a829930..63c7810 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -939,11 +939,15 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
skb_orphan(skb);
nf_reset(skb);
- /* It is better to stop queue if running out of space
- * instead of forcing queuing layer to requeue the skb
- * by returning TX_BUSY (and cause a BUG message).
- * Since most packets only take 1 or 2 ring slots
- * this means 16 slots are typically wasted.
+ /* If running out of space, stop queue to avoid getting packets that we
+ * are then unable to transmit.
+ * An alternative would be to force queuing layer to requeue the skb by
+ * returning NETDEV_TX_BUSY. However, NETDEV_TX_BUSY should not be
+ * returned in a normal path of operation: it means that driver is not
+ * maintaining the TX queue stop/start state properly, and causes
+ * the stack to do a non-trivial amount of useless work.
+ * Since most packets only take 1 or 2 ring slots, stopping the queue
+ * early means 16 slots are typically wasted.
*/
if (sq->vq->num_free < 2+MAX_SKB_FRAGS) {
netif_stop_subqueue(dev, qnum);
OpenPOWER on IntegriCloud