Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# COPYRIGHT (c) 2016 Obsidian Research Corporation. See COPYING file
# Run cmake as:
# mkdir build
# cd build
# cmake -GNinja ..
# ninja
#
Expand Down Expand Up @@ -37,6 +38,8 @@ set(BUILD_INCLUDE ${CMAKE_BINARY_DIR}/include)
set(BUILD_BIN ${CMAKE_BINARY_DIR}/bin)
# Libraries
set(BUILD_LIB ${CMAKE_BINARY_DIR}/lib)
# Common code
set(COMMON_CODE utils)

# Location to place provider .driver files
set(CONFIG_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/libibverbs.d")
Expand Down Expand Up @@ -137,6 +140,10 @@ RDMA_AddOptCFlag(CMAKE_SHARED_LINKER_FLAGS SUPPORTS_NO_UNDEFINED "-Wl,--no-undef
# Verify that GNU --version-script and asm(".symver") works
find_package(LDSymVer REQUIRED)

#-------------------------
# Common code
include_directories(${COMMON_CODE})

#-------------------------
# Find libraries
# pthread
Expand Down
8 changes: 2 additions & 6 deletions ibacm/linux/osd.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,15 @@
#include <sys/time.h>
#include <netinet/in.h>

#include "../../utils/math.h"

#define ACM_CONF_DIR IBACM_CONFIG_PATH
#define ACM_ADDR_FILE "ibacm_addr.cfg"
#define ACM_OPTS_FILE "ibacm_opts.cfg"

#define LIB_DESTRUCTOR __attribute__((destructor))
#define CDECL_FUNC

#define container_of(ptr, type, field) \
((type *) ((void *) ptr - offsetof(type, field)))

#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)

#if __BYTE_ORDER == __LITTLE_ENDIAN
#define htonll(x) bswap_64(x)
#else
Expand Down
8 changes: 1 addition & 7 deletions libibverbs/examples/rc_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,7 @@

#include "pingpong.h"

#ifndef max
#define max(x, y) (((x) > (y)) ? (x) : (y))
#endif

#ifndef min
#define min(x, y) (((x) < (y)) ? (x) : (y))
#endif
#include "../../utils/math.h"

enum {
PINGPONG_RECV_WRID = 1,
Expand Down
13 changes: 7 additions & 6 deletions libmlx5/src/buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,16 +259,17 @@ static int alloc_huge_buf(struct mlx5_context *mctx, struct mlx5_buf *buf,
size_t size, int page_size)
{
int found = 0;
LIST_HEAD(slist);
int nchunk;
struct mlx5_hugetlb_mem *hmem;
struct list_node *tmp, *cur;
int ret;

buf->length = align(size, MLX5_Q_CHUNK_SIZE);
nchunk = buf->length / MLX5_Q_CHUNK_SIZE;

mlx5_spin_lock(&mctx->hugetlb_lock);
list_for_each_entry(hmem, &mctx->hugetlb_list, list) {
list_for_each_node_safe(cur, tmp, &mctx->hugetlb_list) {
hmem = list_node(cur, struct mlx5_hugetlb_mem, entry);
if (bitmap_avail(&hmem->bitmap)) {
buf->base = bitmap_alloc_range(&hmem->bitmap, nchunk, 1);
if (buf->base != -1) {
Expand Down Expand Up @@ -297,9 +298,9 @@ static int alloc_huge_buf(struct mlx5_context *mctx, struct mlx5_buf *buf,

mlx5_spin_lock(&mctx->hugetlb_lock);
if (bitmap_avail(&hmem->bitmap))
list_add(&hmem->list, &mctx->hugetlb_list);
list_add_node(&hmem->entry, &mctx->hugetlb_list);
else
list_add_tail(&hmem->list, &mctx->hugetlb_list);
list_add_node_tail(&hmem->entry, &mctx->hugetlb_list);
mlx5_spin_unlock(&mctx->hugetlb_lock);
}

Expand All @@ -318,7 +319,7 @@ static int alloc_huge_buf(struct mlx5_context *mctx, struct mlx5_buf *buf,
mlx5_spin_lock(&mctx->hugetlb_lock);
bitmap_free_range(&hmem->bitmap, buf->base, nchunk);
if (bitmap_empty(&hmem->bitmap)) {
list_del(&hmem->list);
list_del_node(&hmem->entry);
mlx5_spin_unlock(&mctx->hugetlb_lock);
free_huge_mem(hmem);
} else
Expand All @@ -335,7 +336,7 @@ static void free_huge_buf(struct mlx5_context *ctx, struct mlx5_buf *buf)
mlx5_spin_lock(&ctx->hugetlb_lock);
bitmap_free_range(&buf->hmem->bitmap, buf->base, nchunk);
if (bitmap_empty(&buf->hmem->bitmap)) {
list_del(&buf->hmem->list);
list_del_node(&buf->hmem->entry);
mlx5_spin_unlock(&ctx->hugetlb_lock);
free_huge_mem(buf->hmem);
} else
Expand Down
Loading