vhost: return error message for mbuf allocation failure
authorIlya Maximets <i.maximets@ovn.org>
Wed, 16 Oct 2019 14:31:07 +0000 (16:31 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 25 Oct 2019 17:22:46 +0000 (19:22 +0200)
mbuf allocation failure is a hard failure that highlights some
significant issues with memory pool size or a mbuf leak.

We still have the message for subsequent chained mbufs, but not
for the first one.  It was removed while introducing extbuf
support for large buffers.  But it was useful for catching
mempool issues and needs to be returned back.

Fixes: c3ff0ac70acb ("vhost: improve performance by supporting large buffer")
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Reviewed-by: Flavio Leitner <fbl@sysclose.org>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
lib/librte_vhost/virtio_net.c

index 5b8cb9e63a815f2222dcab25493b1689087a697f..eae7825f04978e5ffed83a8adf14cada9b961e22 100644 (file)
@@ -1651,8 +1651,11 @@ virtio_dev_pktmbuf_alloc(struct virtio_net *dev, struct rte_mempool *mp,
 {
        struct rte_mbuf *pkt = rte_pktmbuf_alloc(mp);
 
-       if (unlikely(pkt == NULL))
+       if (unlikely(pkt == NULL)) {
+               RTE_LOG(ERR, VHOST_DATA,
+                       "Failed to allocate memory for mbuf.\n");
                return NULL;
+       }
 
        if (rte_pktmbuf_tailroom(pkt) >= data_len)
                return pkt;