Skip to content

Commit

Permalink
prov/util: Fix issue while displaying addresses with fi_info -a <addr…
Browse files Browse the repository at this point in the history
…_format>

This commit addresses issue #9443 for tcp provider.
A new api ofi_match_addr_format() has been introduced to match the
exact addressing format with user requested format while running
fi_info test with -a option.

Signed-off-by: Juee Himalbhai Desai <[email protected]>
  • Loading branch information
Juee14Desai authored and j-xiong committed Jun 7, 2024
1 parent 6aa6708 commit bd4da6e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/ofi_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,7 @@ const char *ofi_eq_strerror(struct fid_eq *eq_fid, int prov_errno,
const void *err_data, char *buf, size_t len);

int ofi_valid_addr_format(uint32_t prov_format, uint32_t user_format);
int ofi_match_addr_format(uint32_t if_format, uint32_t user_format);
int ofi_check_ep_type(const struct fi_provider *prov,
const struct fi_ep_attr *prov_attr,
const struct fi_ep_attr *user_attr);
Expand Down
14 changes: 14 additions & 0 deletions prov/util/src/util_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@
#define OFI_RMA_DIRECTION_CAPS (FI_READ | FI_WRITE | \
FI_REMOTE_READ | FI_REMOTE_WRITE)

int ofi_match_addr_format(uint32_t if_format, uint32_t user_format)
{
if (user_format == FI_FORMAT_UNSPEC || if_format == FI_FORMAT_UNSPEC)
return 1;

switch (user_format) {
case FI_SOCKADDR:
/* Provider supports INET and INET6 */
return if_format <= FI_SOCKADDR_IN6;
default:
return if_format == user_format;
}
}

int ofi_valid_addr_format(uint32_t prov_format, uint32_t user_format)
{
if (user_format == FI_FORMAT_UNSPEC || prov_format == FI_FORMAT_UNSPEC)
Expand Down
2 changes: 1 addition & 1 deletion prov/util/src/util_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ static void util_getinfo_ifs(const struct util_prov *prov,

if (hints && ((hints->caps & addr_entry->comm_caps) !=
(hints->caps & (FI_LOCAL_COMM | FI_REMOTE_COMM)) ||
!ofi_valid_addr_format(addr_format, hints->addr_format)))
!ofi_match_addr_format(addr_format, hints->addr_format)))
continue;

cur = fi_dupinfo(src_info);
Expand Down

0 comments on commit bd4da6e

Please sign in to comment.