Patchwork [PATCHv2,net-next,3/8] tun: report orphan frags errors to zero copy callback

login
register
mail settings
Submitter Michael S. Tsirkin
Date Oct. 31, 2012, 10:31 a.m.
Message ID <753585407bf5ab8b757921d4d7182a08668f7713.1351679008.git.mst@redhat.com>
Download mbox | patch
Permalink /patch/195822/
State Changes Requested
Headers show

Comments

Michael S. Tsirkin - Oct. 31, 2012, 10:31 a.m.
When tun transmits a zero copy skb, it orphans the frags
which might need to allocate extra memory, in atomic context.
If that fails, notify ubufs callback before freeing the skb
as a hint that device should disable zerocopy mode.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 drivers/net/tun.c | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 3157519..613f826 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -433,6 +433,7 @@  static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
 
 drop:
 	dev->stats.tx_dropped++;
+	skb_tx_error(skb, -ENOMEM);
 	kfree_skb(skb);
 	return NETDEV_TX_OK;
 }