Skip to content

Commit

Permalink
virtio_net: skb_orphan() and nf_reset() in xmit path.
Browse files Browse the repository at this point in the history
The complex transmit free logic was introduced to avoid hangs on
removing the ip_conntrack module and also because drivers aren't
generally supposed to keep stale skbs for unbounded times.

After some debate, it was decided that while doing skb_orphan()
generally is a rat's nest, we can do it in this driver.  Following
patches take advantage of this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
Rusty Russell committed Sep 24, 2009
1 parent a724ead commit 2b5bbe3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,12 @@ static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
num = skb_to_sgvec(skb, sg+1, 0, skb->len) + 1;

err = vi->svq->vq_ops->add_buf(vi->svq, sg, num, 0, skb);
if (err >= 0 && !vi->free_in_tasklet)
if (err >= 0 && !vi->free_in_tasklet) {
/* Don't wait up for transmitted skbs to be freed. */
skb_orphan(skb);
nf_reset(skb);
mod_timer(&vi->xmit_free_timer, jiffies + (HZ/10));
}

return err;
}
Expand Down

0 comments on commit 2b5bbe3

Please sign in to comment.