src/dpdk/drivers/net/mlx4/mlx4_mr.c
int
mlx4_mr_btree_init(struct mlx4_mr_btree *bt, int n, int socket)
{
	if (bt == NULL) {
		rte_errno = EINVAL;
		return -rte_errno;
	}
	memset(bt, 0, sizeof(*bt));
	bt->table = rte_calloc_socket("B-tree table",
				      n, sizeof(struct mlx4_mr_cache),
				      0, socket);
	if (bt->table == NULL) {
		rte_errno = ENOMEM;
		ERROR("failed to allocate memory for btree cache on socket %d",
		      socket);
		return -rte_errno;
	}
	bt->size = n;
	/* First entry must be NULL for binary search. */
	(*bt->table)[bt->len++] = (struct mlx4_mr_cache) {
		.lkey = UINT32_MAX,
	};
	DEBUG("initialized B-tree %p with table %p",
	      (void *)bt, (void *)bt->table);
	return 0;
}
/**
 * Initialize B-tree and allocate memory for lookup table.
 *
 * @param bt
 *   Pointer to B-tree structure.
 * @param n
 *   Number of entries to allocate.
 * @param socket
 *   NUMA socket on which memory must be allocated.
 *
 * @return
 *   0 on success, a negative errno value otherwise and rte_errno is set.
 */
Initialize B-tree and allocate memory for lookup table.
@param bt
Pointer to B-tree structure.
@param n
Number of entries to allocate.
@param socket
NUMA socket on which memory must be allocated.

@return
0 on success, a negative errno value otherwise and rte_errno is set.
Initialize B - tree and allocate memory for lookup table . @param bt Pointer to B - tree structure . @param n Number of entries to allocate . @param socket NUMA socket on which memory must be allocated . @return 0 on success a negative errno value otherwise and rte_errno is set .
int
mlx4_mr_btree_init(struct mlx4_mr_btree *bt, int n, int socket)
{
	if (bt == NULL) {
		rte_errno = EINVAL;
		return -rte_errno;
	}
	memset(bt, 0, sizeof(*bt));
	bt->table = rte_calloc_socket("B-tree table",
				      n, sizeof(struct mlx4_mr_cache),
				      0, socket);
	if (bt->table == NULL) {
		rte_errno = ENOMEM;
		ERROR("failed to allocate memory for btree cache on socket %d",
		      socket);
		return -rte_errno;
	}
	bt->size = n;
	(*bt->table)[bt->len++] = (struct mlx4_mr_cache) {
		.lkey = UINT32_MAX,
	};
	DEBUG("initialized B-tree %p with table %p",
	      (void *)bt, (void *)bt->table);
	return 0;
}
int mlx4_mr_btree_init ( struct mlx4_mr_btree * bt , int n , int socket ) { if ( bt == NULL ) { rte_errno = EINVAL ; return - rte_errno ; } memset ( bt , 0 , sizeof ( * bt ) ) ; bt -> table = rte_calloc_socket ( " " , n , sizeof ( struct mlx4_mr_cache ) , 0 , socket ) ; if ( bt -> table == NULL ) { rte_errno = ENOMEM ; ERROR ( " " , socket ) ; return - rte_errno ; } bt -> size = n ; ( * bt -> table ) [ bt -> len ++ ] = ( struct mlx4_mr_cache ) { . lkey = UINT32_MAX , } ; DEBUG ( " " , ( void * ) bt , ( void * ) bt -> table ) ; return 0 ; }
Initialize B-tree and allocate memory for lookup table.
Initialize B - tree and allocate memory for lookup table .
/* First entry must be NULL for binary search. */