Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rdma-mwe
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
rdma-mwe
Commits
d61042c5
Commit
d61042c5
authored
Feb 15, 2024
by
Titouan Soulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libcapulet: allow adding a custom prefix to WR id
parent
3987674e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
14 deletions
+13
-14
example/rdma_test.c
example/rdma_test.c
+7
-7
include/libcapulet/rdma_ib.h
include/libcapulet/rdma_ib.h
+2
-2
libcapulet/rdma_ib.c
libcapulet/rdma_ib.c
+4
-5
No files found.
example/rdma_test.c
View file @
d61042c5
...
...
@@ -203,13 +203,13 @@ int main(int argc, char *argv[]) {
return
-
1
;
}
bool_result
=
capulet_rdma_ib_post_recv
(
&
rdma_ctx
,
in_mr
,
allocated_size
);
bool_result
=
capulet_rdma_ib_post_recv
(
&
rdma_ctx
,
in_mr
,
allocated_size
,
0
);
if
(
!
bool_result
)
{
fprintf
(
stderr
,
"Posting Recv (in) failed
\n
"
);
return
-
1
;
}
bool_result
=
capulet_rdma_ib_post_recv
(
&
rdma_ctx
,
out_mr
,
allocated_size
);
bool_result
=
capulet_rdma_ib_post_recv
(
&
rdma_ctx
,
out_mr
,
allocated_size
,
0
);
if
(
!
bool_result
)
{
fprintf
(
stderr
,
"Posting Recv (out) failed
\n
"
);
return
-
1
;
...
...
@@ -233,13 +233,13 @@ int main(int argc, char *argv[]) {
return
-
1
;
}
bool_result
=
capulet_rdma_ib_post_send
(
&
rdma_ctx
,
IBV_WR_RDMA_READ
,
out_mr
,
allocated_size
,
&
out_info_packet
);
bool_result
=
capulet_rdma_ib_post_send
(
&
rdma_ctx
,
IBV_WR_RDMA_READ
,
out_mr
,
allocated_size
,
0
,
&
out_info_packet
);
if
(
!
bool_result
)
{
fprintf
(
stderr
,
"Sending Read failed
\n
"
);
return
-
1
;
}
bool_result
=
capulet_rdma_ib_post_send
(
&
rdma_ctx
,
IBV_WR_RDMA_WRITE
,
in_mr
,
allocated_size
,
&
in_info_packet
);
bool_result
=
capulet_rdma_ib_post_send
(
&
rdma_ctx
,
IBV_WR_RDMA_WRITE
,
in_mr
,
allocated_size
,
0
,
&
in_info_packet
);
if
(
!
bool_result
)
{
fprintf
(
stderr
,
"Sending Write failed
\n
"
);
return
-
1
;
...
...
@@ -276,7 +276,7 @@ int main(int argc, char *argv[]) {
}
else
if
(
mode
==
RDMA_TEST_STRESS
)
{
// Fill the Recv queue
for
(
int
i
=
0
;
i
<
16
;
i
++
)
{
capulet_rdma_ib_post_recv
(
&
rdma_ctx
,
in_mr
,
allocated_size
);
capulet_rdma_ib_post_recv
(
&
rdma_ctx
,
in_mr
,
allocated_size
,
0
);
}
// A small delay is needed to avoid sending anything before Recv requests
...
...
@@ -287,7 +287,7 @@ int main(int argc, char *argv[]) {
clock_gettime
(
CLOCK_MONOTONIC
,
&
timestamps
[
0
]);
// Wait for Send
capulet_rdma_ib_post_send
(
&
rdma_ctx
,
IBV_WR_SEND
,
out_mr
,
allocated_size
,
NULL
);
capulet_rdma_ib_post_send
(
&
rdma_ctx
,
IBV_WR_SEND
,
out_mr
,
allocated_size
,
0
,
NULL
);
do
{
poll_result
=
ibv_poll_cq
(
rdma_ctx
.
send_cq
,
1
,
&
poll_wc
);
}
while
(
poll_result
==
0
);
...
...
@@ -309,7 +309,7 @@ int main(int argc, char *argv[]) {
// The Recv queue should always be full for optimal performances: once
// an element is consumed, push back to it.
capulet_rdma_ib_post_recv
(
&
rdma_ctx
,
in_mr
,
allocated_size
);
capulet_rdma_ib_post_recv
(
&
rdma_ctx
,
in_mr
,
allocated_size
,
0
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
timestamps
[
1
]);
elapsed_time
=
(
timestamps
[
1
].
tv_sec
-
timestamps
[
0
].
tv_sec
)
*
1000000000
+
timestamps
[
1
].
tv_nsec
-
timestamps
[
0
].
tv_nsec
;
...
...
include/libcapulet/rdma_ib.h
View file @
d61042c5
...
...
@@ -21,8 +21,8 @@ bool capulet_rdma_ib_initialize_qp(struct CapuletRdmaIbContext *ctx, int access)
struct
ibv_mr
*
capulet_rdma_ib_create_mr
(
struct
CapuletRdmaIbContext
*
ib_ctx
,
size_t
size
,
int
flags
);
bool
capulet_rdma_ib_fill_base_udp
(
struct
CapuletRdmaIbContext
*
ctx
,
struct
CapuletNetUdpQpInfoPacket
*
own
);
bool
capulet_rdma_ib_set_peer_from_udp
(
struct
CapuletRdmaIbContext
*
ctx
,
struct
CapuletNetUdpContext
*
udp_ctx
);
bool
capulet_rdma_ib_post_recv
(
struct
CapuletRdmaIbContext
*
ctx
,
struct
ibv_mr
*
ibv_dev_mr
,
int
mr_size
);
bool
capulet_rdma_ib_post_send
(
struct
CapuletRdmaIbContext
*
ctx
,
enum
ibv_wr_opcode
opcode
,
struct
ibv_mr
*
local_mr
,
int
local_mr_size
,
struct
CapuletNetUdpMrInfoPacket
*
remote_mr
);
bool
capulet_rdma_ib_post_recv
(
struct
CapuletRdmaIbContext
*
ctx
,
struct
ibv_mr
*
ibv_dev_mr
,
int
mr_size
,
uint32_t
id_prefix
);
bool
capulet_rdma_ib_post_send
(
struct
CapuletRdmaIbContext
*
ctx
,
enum
ibv_wr_opcode
opcode
,
struct
ibv_mr
*
local_mr
,
int
local_mr_size
,
uint32_t
id_prefix
,
struct
CapuletNetUdpMrInfoPacket
*
remote_mr
);
void
capulet_rdma_ib_free_mr
(
struct
ibv_mr
*
mr
);
void
capulet_rdma_ib_free
(
struct
CapuletRdmaIbContext
*
ctx
);
libcapulet/rdma_ib.c
View file @
d61042c5
...
...
@@ -187,7 +187,7 @@ bool capulet_rdma_ib_set_peer_from_udp(struct CapuletRdmaIbContext *ctx, struct
return
true
;
}
bool
capulet_rdma_ib_post_recv
(
struct
CapuletRdmaIbContext
*
ctx
,
struct
ibv_mr
*
ibv_dev_mr
,
int
mr_size
)
{
bool
capulet_rdma_ib_post_recv
(
struct
CapuletRdmaIbContext
*
ctx
,
struct
ibv_mr
*
ibv_dev_mr
,
int
mr_size
,
uint32_t
id_prefix
)
{
struct
ibv_sge
ibv_dev_sge
;
struct
ibv_recv_wr
ibv_dev_rdma_wr
;
struct
ibv_recv_wr
*
ibv_dev_bad_wr
=
NULL
;
...
...
@@ -201,12 +201,11 @@ bool capulet_rdma_ib_post_recv(struct CapuletRdmaIbContext *ctx, struct ibv_mr *
ibv_dev_sge
.
length
=
mr_size
;
ibv_dev_sge
.
lkey
=
ibv_dev_mr
->
lkey
;
ibv_dev_rdma_wr
.
wr_id
=
(
uint64_t
)
lrand48
(
);
ibv_dev_rdma_wr
.
wr_id
=
(
((
uint64_t
)
id_prefix
)
<<
32
)
|
((
uint64_t
)
lrand48
()
);
ibv_dev_rdma_wr
.
sg_list
=
&
ibv_dev_sge
;
ibv_dev_rdma_wr
.
num_sge
=
1
;
result
=
ibv_post_recv
(
ctx
->
qp
,
&
ibv_dev_rdma_wr
,
&
ibv_dev_bad_wr
);
if
(
result
)
{
perror
(
"Could not post Recv request"
);
return
false
;
...
...
@@ -215,7 +214,7 @@ bool capulet_rdma_ib_post_recv(struct CapuletRdmaIbContext *ctx, struct ibv_mr *
return
ibv_dev_bad_wr
==
NULL
;
}
bool
capulet_rdma_ib_post_send
(
struct
CapuletRdmaIbContext
*
ctx
,
enum
ibv_wr_opcode
opcode
,
struct
ibv_mr
*
local_mr
,
int
local_mr_size
,
struct
CapuletNetUdpMrInfoPacket
*
remote_mr
)
{
bool
capulet_rdma_ib_post_send
(
struct
CapuletRdmaIbContext
*
ctx
,
enum
ibv_wr_opcode
opcode
,
struct
ibv_mr
*
local_mr
,
int
local_mr_size
,
uint32_t
id_prefix
,
struct
CapuletNetUdpMrInfoPacket
*
remote_mr
)
{
struct
ibv_send_wr
ibv_dev_rdma_wr
;
struct
ibv_sge
ibv_dev_sge
;
struct
ibv_send_wr
*
ibv_dev_bad_wr
=
NULL
;
...
...
@@ -229,7 +228,7 @@ bool capulet_rdma_ib_post_send(struct CapuletRdmaIbContext *ctx, enum ibv_wr_opc
ibv_dev_sge
.
length
=
local_mr_size
;
ibv_dev_sge
.
lkey
=
local_mr
->
lkey
;
ibv_dev_rdma_wr
.
wr_id
=
(
uint64_t
)
lrand48
(
);
ibv_dev_rdma_wr
.
wr_id
=
(
((
uint64_t
)
id_prefix
)
<<
32
)
|
((
uint64_t
)
lrand48
()
);
ibv_dev_rdma_wr
.
sg_list
=
&
ibv_dev_sge
;
ibv_dev_rdma_wr
.
num_sge
=
1
;
ibv_dev_rdma_wr
.
opcode
=
opcode
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment