From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <olivier.matz@6wind.com>
Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com
 [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id D7F951B2CD;
 Thu, 18 Jan 2018 14:01:02 +0100 (CET)
Received: from glumotte.dev.6wind.com. (unknown [10.16.0.195])
 by proxy.6wind.com (Postfix) with ESMTP id A9910123B14;
 Thu, 18 Jan 2018 13:59:29 +0100 (CET)
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org, Adrien Mazarguil <adrien.mazarguil@6wind.com>,
 Nelio Laranjeiro <nelio.laranjeiro@6wind.com>,
 Yongseok Koh <yskoh@mellanox.com>
Cc: stable@dpdk.org
Date: Thu, 18 Jan 2018 14:00:43 +0100
Message-Id: <20180118130043.31773-2-olivier.matz@6wind.com>
X-Mailer: git-send-email 2.11.0
In-Reply-To: <20180118130043.31773-1-olivier.matz@6wind.com>
References: <20180118130043.31773-1-olivier.matz@6wind.com>
Subject: [dpdk-stable] [PATCH 2/2] net/mlx5: fix allocation when no memory
	on device NUMA node
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 18 Jan 2018 13:01:03 -0000

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: stable@dpdk.org

Signed-off-by: Olivier Matz <olivier.matz@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