Skip to content

Commit 2e7f794

Browse files
committed
usnic: convert to use fi_recvmsg / FI_MORE
Minor optimization to post 16 receive buffers at a time (vs. 1).
1 parent 047ecce commit 2e7f794

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

opal/mca/btl/usnic/btl_usnic_module.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,6 +1609,7 @@ static int init_one_channel(opal_btl_usnic_module_t *module,
16091609
channel->fastsend_wqe_thresh = sd_num - 10;
16101610

16111611
channel->credits = sd_num;
1612+
channel->rx_post_cnt = 0;
16121613

16131614
/* We did math up in component_init() to know that there should be
16141615
enough CQs available. So if create_cq() fails, then either the

opal/mca/btl/usnic/btl_usnic_module.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ typedef struct opal_btl_usnic_channel_t {
6969
int chan_sd_num;
7070

7171
int credits; /* RFXXX until libfab credits fixed */
72+
uint32_t rx_post_cnt;
7273

7374
/* fastsend enabled if num_credits_available >= fastsend_wqe_thresh */
7475
unsigned fastsend_wqe_thresh;

opal/mca/btl/usnic/btl_usnic_recv.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,27 @@ void opal_btl_usnic_recv_call(opal_btl_usnic_module_t *module,
2323
static inline int
2424
opal_btl_usnic_post_recv_list(opal_btl_usnic_channel_t *channel)
2525
{
26+
struct iovec iov;
27+
struct fi_msg msg;
28+
uint64_t flag;
2629
opal_btl_usnic_recv_segment_t *rseg;
2730
int rc;
2831

32+
msg.msg_iov = &iov;
33+
msg.iov_count = 1;
2934
for (rseg = channel->repost_recv_head; NULL != rseg; rseg = rseg->rs_next) {
30-
rc = fi_recv(channel->ep, rseg->rs_protocol_header,
31-
rseg->rs_len, NULL, FI_ADDR_UNSPEC, rseg);
35+
msg.context = rseg;
36+
iov.iov_base = rseg->rs_protocol_header;
37+
iov.iov_len = rseg->rs_len;
38+
39+
++channel->rx_post_cnt;
40+
if (OPAL_UNLIKELY((channel->rx_post_cnt & 15) == 0)) {
41+
flag = 0;
42+
} else {
43+
flag = FI_MORE;
44+
}
45+
46+
rc = fi_recvmsg(channel->ep, &msg, flag);
3247
if (0 != rc) {
3348
return rc;
3449
}

0 commit comments

Comments
 (0)