Skip to content
Open
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
1 change: 1 addition & 0 deletions kernel-headers/rdma/ib_user_ioctl_verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ enum ib_uverbs_access_flags {
IB_UVERBS_ACCESS_FLUSH_PERSISTENT = 1 << 9,

IB_UVERBS_ACCESS_RELAXED_ORDERING = IB_UVERBS_ACCESS_OPTIONAL_FIRST,
IB_UVERBS_ACCESS_UNORDERED = IB_UVERBS_ACCESS_OPTIONAL_FIRST << 1,
IB_UVERBS_ACCESS_OPTIONAL_RANGE =
((IB_UVERBS_ACCESS_OPTIONAL_LAST << 1) - 1) &
~(IB_UVERBS_ACCESS_OPTIONAL_FIRST - 1)
Expand Down
12 changes: 11 additions & 1 deletion libibverbs/examples/rc_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ static int validate_buf;
static int use_dm;
static int allow_cc_unprotected;
static int use_new_send;
static int use_unordered;

struct pingpong_context {
struct ibv_context *context;
Expand Down Expand Up @@ -445,6 +446,9 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size,
}
}

if (use_unordered)
access_flags |= IBV_ACCESS_UNORDERED;

ctx->buf = ibv_alloc_buf(ctx->pd, size, &ctx->ibv_buf);
if (!ctx->buf) {
fprintf(stderr, "Couldn't allocate work buf.\n");
Expand Down Expand Up @@ -832,6 +836,7 @@ static void usage(const char *argv0)
printf(" -N, --new_send use new post send WR API\n");
printf(" -U, --allow-cc-unprotected allow allocation of unprotected/shared\n"
" memory on CoCo guests\n");
printf(" -W, --weak-ordering use weak (unordered) memory access\n");
}

int main(int argc, char *argv[])
Expand Down Expand Up @@ -883,10 +888,11 @@ int main(int argc, char *argv[])
{ .name = "dm", .has_arg = 0, .val = 'j' },
{ .name = "new_send", .has_arg = 0, .val = 'N' },
{ .name = "allow-cc-unprotected", .has_arg = 0, .val = 'U' },
{ .name = "weak-ordering", .has_arg = 0, .val = 'W' },
{}
};

c = getopt_long(argc, argv, "p:d:i:s:m:r:n:l:eg:oOPtcjNU",
c = getopt_long(argc, argv, "p:d:i:s:m:r:n:l:eg:oOPtcjNUW",
long_options, NULL);

if (c == -1)
Expand Down Expand Up @@ -974,6 +980,10 @@ int main(int argc, char *argv[])
allow_cc_unprotected = 1;
break;

case 'W':
use_unordered = 1;
break;

default:
usage(argv[0]);
return 1;
Expand Down
11 changes: 10 additions & 1 deletion libibverbs/examples/srq_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ enum {
static int page_size;
static int validate_buf;
static int use_odp;
static int use_unordered;

struct pingpong_context {
struct ibv_context *context;
Expand Down Expand Up @@ -395,6 +396,8 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size,
access_flags |= IBV_ACCESS_ON_DEMAND;
}

if (use_unordered)
access_flags |= IBV_ACCESS_UNORDERED;

if (use_event) {
ctx->channel = ibv_create_comp_channel(ctx->context);
Expand Down Expand Up @@ -638,6 +641,7 @@ static void usage(const char *argv0)
printf(" -g, --gid-idx=<gid index> local port gid index\n");
printf(" -o, --odp use on demand paging\n");
printf(" -c, --chk validate received buffer\n");
printf(" -W, --weak-ordering use weak (unordered) memory access\n");
}

int main(int argc, char *argv[])
Expand Down Expand Up @@ -687,10 +691,11 @@ int main(int argc, char *argv[])
{ .name = "odp", .has_arg = 0, .val = 'o' },
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
{ .name = "chk", .has_arg = 0, .val = 'c' },
{ .name = "weak-ordering", .has_arg = 0, .val = 'W' },
{}
};

c = getopt_long(argc, argv, "p:d:i:s:m:q:r:n:l:eog:c",
c = getopt_long(argc, argv, "p:d:i:s:m:q:r:n:l:eog:cW",
long_options, NULL);
if (c == -1)
break;
Expand Down Expand Up @@ -764,6 +769,10 @@ int main(int argc, char *argv[])
validate_buf = 1;
break;

case 'W':
use_unordered = 1;
break;

default:
usage(argv[0]);
return 1;
Expand Down
14 changes: 12 additions & 2 deletions libibverbs/examples/uc_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enum {

static int page_size;
static int validate_buf;
static int use_unordered;

struct pingpong_context {
struct ibv_context *context;
Expand Down Expand Up @@ -300,6 +301,7 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size,
int rx_depth, int port,
int use_event)
{
int access_flags = IBV_ACCESS_LOCAL_WRITE;
struct pingpong_context *ctx;

ctx = calloc(1, sizeof *ctx);
Expand Down Expand Up @@ -341,7 +343,9 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size,
goto clean_comp_channel;
}

ctx->mr = ibv_reg_mr(ctx->pd, ctx->buf, size, IBV_ACCESS_LOCAL_WRITE);
if (use_unordered)
access_flags |= IBV_ACCESS_UNORDERED;
ctx->mr = ibv_reg_mr(ctx->pd, ctx->buf, size, access_flags);
if (!ctx->mr) {
fprintf(stderr, "Couldn't register MR\n");
goto clean_pd;
Expand Down Expand Up @@ -526,6 +530,7 @@ static void usage(const char *argv0)
printf(" -e, --events sleep on CQ events (default poll)\n");
printf(" -g, --gid-idx=<gid index> local port gid index\n");
printf(" -c, --chk validate received buffer\n");
printf(" -W, --weak-ordering use weak (unordered) memory access\n");
}

int main(int argc, char *argv[])
Expand Down Expand Up @@ -569,10 +574,11 @@ int main(int argc, char *argv[])
{ .name = "events", .has_arg = 0, .val = 'e' },
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
{ .name = "chk", .has_arg = 0, .val = 'c' },
{ .name = "weak-ordering", .has_arg = 0, .val = 'W' },
{}
};

c = getopt_long(argc, argv, "p:d:i:s:m:r:n:l:eg:c",
c = getopt_long(argc, argv, "p:d:i:s:m:r:n:l:eg:cW",
long_options, NULL);
if (c == -1)
break;
Expand Down Expand Up @@ -634,6 +640,10 @@ int main(int argc, char *argv[])
validate_buf = 1;
break;

case 'W':
use_unordered = 1;
break;

default:
usage(argv[0]);
return 1;
Expand Down
14 changes: 12 additions & 2 deletions libibverbs/examples/ud_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ enum {

static int page_size;
static int validate_buf;
static int use_unordered;

struct pingpong_context {
struct ibv_context *context;
Expand Down Expand Up @@ -296,6 +297,7 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size,
int rx_depth, int port,
int use_event)
{
int access_flags = IBV_ACCESS_LOCAL_WRITE;
struct pingpong_context *ctx;

ctx = malloc(sizeof *ctx);
Expand Down Expand Up @@ -352,7 +354,9 @@ static struct pingpong_context *pp_init_ctx(struct ibv_device *ib_dev, int size,
goto clean_comp_channel;
}

ctx->mr = ibv_reg_mr(ctx->pd, ctx->buf, size + 40, IBV_ACCESS_LOCAL_WRITE);
if (use_unordered)
access_flags |= IBV_ACCESS_UNORDERED;
ctx->mr = ibv_reg_mr(ctx->pd, ctx->buf, size + 40, access_flags);
if (!ctx->mr) {
fprintf(stderr, "Couldn't register MR\n");
goto clean_pd;
Expand Down Expand Up @@ -549,6 +553,7 @@ static void usage(const char *argv0)
printf(" -e, --events sleep on CQ events (default poll)\n");
printf(" -g, --gid-idx=<gid index> local port gid index\n");
printf(" -c, --chk validate received buffer\n");
printf(" -W, --weak-ordering use weak (unordered) memory access\n");
}

int main(int argc, char *argv[])
Expand Down Expand Up @@ -590,10 +595,11 @@ int main(int argc, char *argv[])
{ .name = "events", .has_arg = 0, .val = 'e' },
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
{ .name = "chk", .has_arg = 0, .val = 'c' },
{ .name = "weak-ordering", .has_arg = 0, .val = 'W' },
{}
};

c = getopt_long(argc, argv, "p:d:i:s:r:n:l:eg:c", long_options,
c = getopt_long(argc, argv, "p:d:i:s:r:n:l:eg:cW", long_options,
NULL);
if (c == -1)
break;
Expand Down Expand Up @@ -647,6 +653,10 @@ int main(int argc, char *argv[])
validate_buf = 1;
break;

case 'W':
use_unordered = 1;
break;

default:
usage(argv[0]);
return 1;
Expand Down
11 changes: 10 additions & 1 deletion libibverbs/examples/xsrq_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#define TERMINATION_MSG "END"
static int page_size;
static int use_odp;
static int use_unordered;

struct pingpong_dest {
union ibv_gid gid;
Expand Down Expand Up @@ -233,6 +234,9 @@ static int pp_init_ctx(char *ib_devname)
access_flags |= IBV_ACCESS_ON_DEMAND;
}

if (use_unordered)
access_flags |= IBV_ACCESS_UNORDERED;

if (pp_get_port_info(ctx.context, ctx.ib_port, &port_attr)) {
fprintf(stderr, "Failed to get port info\n");
return 1;
Expand Down Expand Up @@ -869,6 +873,7 @@ static void usage(const char *argv0)
printf(" -e, --events sleep on CQ events (default poll)\n");
printf(" -o, --odp use on demand paging\n");
printf(" -g, --gid-idx=<gid index> local port gid index\n");
printf(" -W, --weak-ordering use weak (unordered) memory access\n");
}

int main(int argc, char *argv[])
Expand Down Expand Up @@ -896,10 +901,11 @@ int main(int argc, char *argv[])
{ .name = "events", .has_arg = 0, .val = 'e' },
{ .name = "odp", .has_arg = 0, .val = 'o' },
{ .name = "gid-idx", .has_arg = 1, .val = 'g' },
{ .name = "weak-ordering", .has_arg = 0, .val = 'W' },
{}
};

c = getopt_long(argc, argv, "p:d:i:s:m:n:l:eog:c:", long_options,
c = getopt_long(argc, argv, "p:d:i:s:m:n:l:eog:c:W", long_options,
NULL);
if (c == -1)
break;
Expand Down Expand Up @@ -950,6 +956,9 @@ int main(int argc, char *argv[])
case 'o':
use_odp = 1;
break;
case 'W':
use_unordered = 1;
break;
default:
usage(argv[0]);
return 1;
Expand Down
Loading