Skip to content

Commit 5163e6a

Browse files
committed
fabtests/prov/efa: Fix the rnr read cq error test for efa-direct
efa-direct doesn't prepost any rx buffer internally, it posts whatever application posts, the total_send needs to be adjusted to match this behavior difference. Signed-off-by: Shi Jin <[email protected]>
1 parent ec5917c commit 5163e6a

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

fabtests/prov/efa/Makefile.include

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ endif BUILD_EFA_RDMA_CHECKER
4242
endif HAVE_VERBS_DEVEL
4343

4444
efa_rnr_srcs = \
45+
prov/efa/src/efa_shared.h \
4546
prov/efa/src/efa_rnr_shared.h \
4647
prov/efa/src/efa_rnr_shared.c
4748

fabtests/prov/efa/src/efa_shared.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0-only */
2+
/* SPDX-FileCopyrightText: Copyright Amazon.com, Inc. or its affiliates. All
3+
* rights reserved. */
4+
5+
#ifndef _EFA_SHARED_H
6+
#define _EFA_SHARED_H
7+
8+
#define EFA_FABRIC_NAME "efa"
9+
#define EFA_DIRECT_FABRIC_NAME "efa-direct"
10+
11+
#define EFA_INFO_TYPE_IS_RDM(_info) \
12+
(_info && _info->ep_attr && (_info->ep_attr->type == FI_EP_RDM) && \
13+
!strcasecmp(_info->fabric_attr->name, EFA_FABRIC_NAME))
14+
15+
#define EFA_INFO_TYPE_IS_DIRECT(_info) \
16+
(_info && _info->ep_attr && (_info->ep_attr->type == FI_EP_RDM) && \
17+
!strcasecmp(_info->fabric_attr->name, EFA_DIRECT_FABRIC_NAME))
18+
19+
#endif /* _EFA_SHARED_H */

fabtests/prov/efa/src/rdm_rnr_read_cq_error.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <getopt.h>
3737

3838
#include <shared.h>
39+
#include "efa_shared.h"
3940
#include "efa_rnr_shared.h"
4041

4142

@@ -48,11 +49,17 @@ static int rnr_read_cq_error(void)
4849
rnr_flag = 0;
4950
/*
5051
* In order for the sender to get RNR error, we need to first consume
51-
* all pre-posted receive buffer (in efa provider, fi->rx_attr->size
52-
* receiving buffer are pre-posted) on the receiver side, the subsequent
53-
* sends (expected_rnr_error) will then get RNR errors.
52+
* all pre-posted receive buffer.
53+
* For efa-rdm, it pre-posted fi->rx_attr->size receive buffers during 1st cq read
54+
* For efa-direct, it posted whatever application posts. ft_enable_ep_recv already
55+
* posts 1.
5456
*/
55-
total_send = fi->rx_attr->size + expected_rnr_error;
57+
if (EFA_INFO_TYPE_IS_RDM(fi)) {
58+
total_send = fi->rx_attr->size + expected_rnr_error;
59+
} else {
60+
assert(EFA_INFO_TYPE_IS_DIRECT(fi));
61+
total_send = expected_rnr_error + 1;
62+
}
5663

5764
for (i = 0; i < total_send; i++) {
5865
do {

0 commit comments

Comments
 (0)