If there is no memory available on the same numa node than the
device, it is preferable to fallback on another socket instead
of failing.

Fixes: 1e3a39f72d5d ("net/mlx5: allocate verbs object into shared memory")
Cc: sta...@dpdk.org

Signed-off-by: Olivier Matz <olivier.m...@6wind.com>
---
 drivers/net/mlx5/mlx5.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 1c95f3520..312f3d5be 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -143,6 +143,10 @@ mlx5_alloc_verbs_buf(size_t size, void *data)
        assert(data != NULL);
        ret = rte_malloc_socket(__func__, size, alignment,
                                priv->dev->device->numa_node);
+       if (ret == NULL)
+               ret = rte_malloc_socket(__func__, size, alignment,
+                                       SOCKET_ID_ANY);
+
        DEBUG("Extern alloc size: %lu, align: %lu: %p", size, alignment, ret);
        return ret;
 }
-- 
2.11.0

Reply via email to