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.

Cc: Flavio Leitner <f...@sysclose.org>

Fixes: 5005bcda7123 ("vhost: add support for large buffers")
Signed-off-by: Ilya Maximets <i.maxim...@ovn.org>
---
 lib/librte_vhost/virtio_net.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 66f0c7206..f8af4e0b3 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -1354,8 +1354,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;
-- 
2.17.1

Reply via email to