Skip to content

Commit

Permalink
fabtests/prov/efa: Fix the rnr read cq error test for efa-direct
Browse files Browse the repository at this point in the history
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 <sjina@amazon.com>
  • Loading branch information
shijin-aws committed Feb 23, 2025
1 parent ec5917c commit 5163e6a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
1 change: 1 addition & 0 deletions fabtests/prov/efa/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ endif BUILD_EFA_RDMA_CHECKER
endif HAVE_VERBS_DEVEL

efa_rnr_srcs = \
prov/efa/src/efa_shared.h \
prov/efa/src/efa_rnr_shared.h \
prov/efa/src/efa_rnr_shared.c

Expand Down
19 changes: 19 additions & 0 deletions fabtests/prov/efa/src/efa_shared.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0-only */
/* SPDX-FileCopyrightText: Copyright Amazon.com, Inc. or its affiliates. All
* rights reserved. */

#ifndef _EFA_SHARED_H
#define _EFA_SHARED_H

#define EFA_FABRIC_NAME "efa"
#define EFA_DIRECT_FABRIC_NAME "efa-direct"

#define EFA_INFO_TYPE_IS_RDM(_info) \
(_info && _info->ep_attr && (_info->ep_attr->type == FI_EP_RDM) && \
!strcasecmp(_info->fabric_attr->name, EFA_FABRIC_NAME))

#define EFA_INFO_TYPE_IS_DIRECT(_info) \
(_info && _info->ep_attr && (_info->ep_attr->type == FI_EP_RDM) && \
!strcasecmp(_info->fabric_attr->name, EFA_DIRECT_FABRIC_NAME))

#endif /* _EFA_SHARED_H */
15 changes: 11 additions & 4 deletions fabtests/prov/efa/src/rdm_rnr_read_cq_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <getopt.h>

#include <shared.h>
#include "efa_shared.h"
#include "efa_rnr_shared.h"


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

for (i = 0; i < total_send; i++) {
do {
Expand Down

0 comments on commit 5163e6a

Please sign in to comment.