Skip to content

Instantly share code, notes, and snippets.

@twainy
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twainy/a86c3f9bfac3bbf6adac to your computer and use it in GitHub Desktop.
Save twainy/a86c3f9bfac3bbf6adac to your computer and use it in GitHub Desktop.
net eth1: Unexpected TX queue failure: -28 って何だろう、という話 ref: http://qiita.com/twainy@github/items/7ca23e658f37e9cecfe2
#define ENOSPC 28 /* No space left on device */
$ dmesg | tail -1
[16276010.045007] net eth1: Unexpected TX queue failure: -28
ifconfig ${interface} txqueuelen ${size}
ifconfig eth1 txqueuelen 10000
ifconfig eth0 txqueuelen 5000
static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct virtnet_info *vi = netdev_priv(dev);
int capacity;
/* Free up any pending old buffers before queueing new ones. */
free_old_xmit_skbs(vi);
/* Try to transmit */
capacity = xmit_skb(vi, skb);
/* This can happen with OOM and indirect buffers. */
if (unlikely(capacity < 0)) {
if (likely(capacity == -ENOMEM)) {
if (net_ratelimit())
dev_warn(&dev->dev,
"TX queue failure: out of memory\n");
} else {
dev->stats.tx_fifo_errors++;
if (net_ratelimit())
dev_warn(&dev->dev,
"Unexpected TX queue failure: %d\n",
capacity);
}
dev->stats.tx_dropped++;
kfree_skb(skb);
return NETDEV_TX_OK;
}
.......................
}
static int xmit_skb(struct virtnet_info *vi, struct sk_buff *skb)
{
......................
return virtqueue_add_buf(vi->svq, vi->tx_sg, hdr->num_sg,
0, skb, GFP_ATOMIC);
}
int virtqueue_add_buf(struct virtqueue *_vq,
struct scatterlist sg[],
unsigned int out,
unsigned int in,
void *data,
gfp_t gfp)
{
struct vring_virtqueue *vq = to_vvq(_vq);
unsigned int i, avail, uninitialized_var(prev);
int head;
....................
if (vq->num_free < out + in) {
pr_debug("Can't add buf len %i - avail = %i\n",
out + in, vq->num_free);
/* FIXME: for historical reasons, we force a notify here if
* there are outgoing parts to the buffer. Presumably the
* host should service the ring ASAP. */
if (out)
vq->notify(&vq->vq);
END_USE(vq);
return -ENOSPC;
}
....................
}
/* Number of free buffers */
unsigned int num_free;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment