#include "mlx5_common.h"
#include "mlx5_common_os.h"
#include "mlx5_common_utils.h"
+#include "mlx5_malloc.h"
int mlx5_common_logtype;
struct mlx5_devx_dbr_page *page;
/* Allocate space for door-bell page and management data. */
- page = rte_calloc_socket(__func__, 1, sizeof(struct mlx5_devx_dbr_page),
- RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY);
+ page = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO,
+ sizeof(struct mlx5_devx_dbr_page),
+ RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY);
if (!page) {
DRV_LOG(ERR, "cannot allocate dbr page");
return NULL;
MLX5_DBR_PAGE_SIZE, 0);
if (!page->umem) {
DRV_LOG(ERR, "cannot umem reg dbr page");
- rte_free(page);
+ mlx5_free(page);
return NULL;
}
return page;
LIST_REMOVE(page, next);
if (page->umem)
ret = -mlx5_glue->devx_umem_dereg(page->umem);
- rte_free(page);
+ mlx5_free(page);
} else {
/* Mark in bitmap that this door-bell is not in use. */
offset /= MLX5_DBR_SIZE;
#include "mlx5_common_mp.h"
#include "mlx5_common_mr.h"
#include "mlx5_common_utils.h"
+#include "mlx5_malloc.h"
struct mr_find_contig_memsegs_data {
uintptr_t addr;
* Initially cache_bh[] will be given practically enough space and once
* it is expanded, expansion wouldn't be needed again ever.
*/
- mem = rte_realloc(bt->table, n * sizeof(struct mr_cache_entry), 0);
+ mem = mlx5_realloc(bt->table, MLX5_MEM_RTE | MLX5_MEM_ZERO,
+ n * sizeof(struct mr_cache_entry), 0, SOCKET_ID_ANY);
if (mem == NULL) {
/* Not an error, B-tree search will be skipped. */
DRV_LOG(WARNING, "failed to expand MR B-tree (%p) table",
}
MLX5_ASSERT(!bt->table && !bt->size);
memset(bt, 0, sizeof(*bt));
- bt->table = rte_calloc_socket("B-tree table",
- n, sizeof(struct mr_cache_entry),
- 0, socket);
+ bt->table = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO,
+ sizeof(struct mr_cache_entry) * n,
+ 0, socket);
if (bt->table == NULL) {
rte_errno = ENOMEM;
DEBUG("failed to allocate memory for btree cache on socket %d",
return;
DEBUG("freeing B-tree %p with table %p",
(void *)bt, (void *)bt->table);
- rte_free(bt->table);
+ mlx5_free(bt->table);
memset(bt, 0, sizeof(*bt));
}
dereg_mr_cb(&mr->pmd_mr);
if (mr->ms_bmp != NULL)
rte_bitmap_free(mr->ms_bmp);
- rte_free(mr);
+ mlx5_free(mr);
}
void
(void *)addr, data.start, data.end, msl->page_sz, ms_n);
/* Size of memory for bitmap. */
bmp_size = rte_bitmap_get_memory_footprint(ms_n);
- mr = rte_zmalloc_socket(NULL,
- RTE_ALIGN_CEIL(sizeof(*mr),
- RTE_CACHE_LINE_SIZE) +
- bmp_size,
- RTE_CACHE_LINE_SIZE, msl->socket_id);
+ mr = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO,
+ RTE_ALIGN_CEIL(sizeof(*mr), RTE_CACHE_LINE_SIZE) +
+ bmp_size, RTE_CACHE_LINE_SIZE, msl->socket_id);
if (mr == NULL) {
DEBUG("Unable to allocate memory for a new MR of"
" address (%p).", (void *)addr);
{
struct mlx5_mr *mr = NULL;
- mr = rte_zmalloc_socket(NULL,
- RTE_ALIGN_CEIL(sizeof(*mr),
- RTE_CACHE_LINE_SIZE),
- RTE_CACHE_LINE_SIZE, socket_id);
+ mr = mlx5_malloc(MLX5_MEM_RTE | MLX5_MEM_ZERO,
+ RTE_ALIGN_CEIL(sizeof(*mr), RTE_CACHE_LINE_SIZE),
+ RTE_CACHE_LINE_SIZE, socket_id);
if (mr == NULL)
return NULL;
reg_mr_cb(pd, (void *)addr, len, &mr->pmd_mr);
DRV_LOG(WARNING,
"Fail to create MR for address (%p)",
(void *)addr);
- rte_free(mr);
+ mlx5_free(mr);
return NULL;
}
mr->msl = NULL; /* Mark it is external memory. */