MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mlx5_alloc_align

Function mlx5_alloc_align

dpdk/drivers/common/mlx5/mlx5_malloc.c:148–162  ·  view source on GitHub ↗

* Allocate memory with alignment. * * @param size * Memory size to be allocated. * @param align * Memory alignment. * @param zero * Clear the allocated memory or not. * * @return * Pointer of the allocated memory, NULL otherwise. */

Source from the content-addressed store, hash-verified

146 * Pointer of the allocated memory, NULL otherwise.
147 */
148static void *
149mlx5_alloc_align(size_t size, unsigned int align, unsigned int zero)
150{
151 void *buf;
152
153 buf = mlx5_os_malloc(align, size);
154 if (!buf) {
155 DRV_LOG(ERR, "Couldn't allocate buf size=%zu align=%u.",
156 size, align);
157 return NULL;
158 }
159 if (zero)
160 memset(buf, 0, size);
161 return buf;
162}
163
164void *
165mlx5_malloc(uint32_t flags, size_t size, unsigned int align, int socket)

Callers 1

mlx5_mallocFunction · 0.85

Calls 2

memsetFunction · 0.85
mlx5_os_mallocFunction · 0.50

Tested by

no test coverage detected