#include <stdbool.h>
#include <string.h>
-#include "mlx5_common_utils.h"
+#include "mlx5_common_log.h"
+#include "mlx5_common_os.h"
#include "mlx5_malloc.h"
struct mlx5_sys_mem {
* Check if the address belongs to memory seg list.
*
* @param addr
- * Memory address to be ckeced.
+ * Memory address to be checked.
* @param msl
* Memory seg list.
*
* Check if the address belongs to rte memory.
*
* @param addr
- * Memory address to be ckeced.
+ * Memory address to be checked.
*
* @return
* True if it belongs, false otherwise.
mlx5_alloc_align(size_t size, unsigned int align, unsigned int zero)
{
void *buf;
- int ret;
-
- ret = posix_memalign(&buf, align, size);
- if (ret) {
- DRV_LOG(ERR,
- "Couldn't allocate buf size=%zu align=%u. Err=%d\n",
- size, align, ret);
+ buf = mlx5_os_malloc(align, size);
+ if (!buf) {
+ DRV_LOG(ERR, "Couldn't allocate buf size=%zu align=%u.",
+ size, align);
return NULL;
}
if (zero)
__atomic_add_fetch(&mlx5_sys_mem.free_sys, 1,
__ATOMIC_RELAXED);
#endif
- free(addr);
+ mlx5_os_free(addr);
} else {
#ifdef RTE_LIBRTE_MLX5_DEBUG
__atomic_add_fetch(&mlx5_sys_mem.free_rte, 1,