Skip to content

Commit

Permalink
DAOS=15439 cart: Support free-form provider specification for UCX. (#…
Browse files Browse the repository at this point in the history
…14988)

Signed-off-by: Joseph Moore <joseph.moore@intel.com>
  • Loading branch information
jgmoore-or authored Aug 23, 2024
1 parent 7a5a186 commit 2da75ff
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 109 deletions.
137 changes: 46 additions & 91 deletions src/cart/crt_hg.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,97 +14,52 @@
* List of supported CaRT providers. The table is terminated with the last entry
* having nad_str = NULL.
*/
struct crt_na_dict crt_na_dict[] = {
{
.nad_type = CRT_PROV_SM,
.nad_str = "sm",
.nad_contig_eps = false,
.nad_port_bind = false,
}, {
.nad_type = CRT_PROV_OFI_VERBS_RXM,
.nad_str = "ofi+verbs;ofi_rxm",
.nad_alt_str = "ofi+verbs",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_OFI_TCP,
.nad_str = "ofi+tcp",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_OFI_TCP_RXM,
.nad_str = "ofi+tcp;ofi_rxm",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_OFI_CXI,
.nad_str = "ofi+cxi",
.nad_contig_eps = true,
.nad_port_bind = false,
}, {
.nad_type = CRT_PROV_OFI_OPX,
.nad_str = "ofi+opx",
.nad_contig_eps = false,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_UCX_RC,
.nad_str = "ucx+rc_v",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_UCX_UD,
.nad_str = "ucx+ud_v",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_UCX_RC_UD,
.nad_str = "ucx+rc_v,ud_v",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_UCX_RC_O,
.nad_str = "ucx+rc",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_UCX_UD_O,
.nad_str = "ucx+ud",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_UCX_RC_UD_O,
.nad_str = "ucx+rc,ud",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_UCX_RC_X,
.nad_str = "ucx+rc_x",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_UCX_UD_X,
.nad_str = "ucx+ud_x",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_UCX_RC_UD_X,
.nad_str = "ucx+rc_x,ud_x",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_UCX_DC_X,
.nad_str = "ucx+dc_x",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_type = CRT_PROV_UCX_TCP,
.nad_str = "ucx+tcp",
.nad_contig_eps = true,
.nad_port_bind = true,
}, {
.nad_str = NULL,
}
};
struct crt_na_dict crt_na_dict[] = {{
.nad_type = CRT_PROV_SM,
.nad_str = "sm",
.nad_contig_eps = false,
.nad_port_bind = false,
},
{
.nad_type = CRT_PROV_OFI_VERBS_RXM,
.nad_str = "ofi+verbs;ofi_rxm",
.nad_alt_str = "ofi+verbs",
.nad_contig_eps = true,
.nad_port_bind = true,
},
{
.nad_type = CRT_PROV_OFI_TCP,
.nad_str = "ofi+tcp",
.nad_contig_eps = true,
.nad_port_bind = true,
},
{
.nad_type = CRT_PROV_OFI_TCP_RXM,
.nad_str = "ofi+tcp;ofi_rxm",
.nad_contig_eps = true,
.nad_port_bind = true,
},
{
.nad_type = CRT_PROV_OFI_CXI,
.nad_str = "ofi+cxi",
.nad_contig_eps = true,
.nad_port_bind = false,
},
{
.nad_type = CRT_PROV_OFI_OPX,
.nad_str = "ofi+opx",
.nad_contig_eps = false,
.nad_port_bind = true,
},
{
.nad_type = CRT_PROV_UCX,
.nad_str = "ucx+ud_x",
.nad_contig_eps = true,
.nad_port_bind = true,
},
{
.nad_str = NULL,
}};

int
crt_hg_parse_uri(const char *uri, crt_provider_t *prov, char *addr)
Expand Down
25 changes: 9 additions & 16 deletions src/cart/crt_hg.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#define CRT_HG_POST_INCR (512)
#define CRT_HG_MRECV_BUF (16)

#define CRT_UCX_STR "ucx"

struct crt_rpc_priv;
struct crt_common_hdr;
struct crt_corpc_hdr;
Expand All @@ -40,27 +42,17 @@ struct crt_corpc_hdr;
* Enumeration specifying providers supported by the library
*/
typedef enum {
CRT_PROV_SM = 0,
CRT_PROV_SM = 0,
CRT_PROV_OFI_SOCKETS,
CRT_PROV_OFI_VERBS_RXM,
CRT_PROV_OFI_GNI,
CRT_PROV_OFI_TCP,
CRT_PROV_OFI_TCP_RXM,
CRT_PROV_OFI_CXI,
CRT_PROV_OFI_OPX,
CRT_PROV_OFI_LAST = CRT_PROV_OFI_OPX,
CRT_PROV_UCX_RC,
CRT_PROV_UCX_UD,
CRT_PROV_UCX_RC_UD,
CRT_PROV_UCX_RC_O,
CRT_PROV_UCX_UD_O,
CRT_PROV_UCX_RC_UD_O,
CRT_PROV_UCX_RC_X,
CRT_PROV_UCX_UD_X,
CRT_PROV_UCX_RC_UD_X,
CRT_PROV_UCX_DC_X,
CRT_PROV_UCX_TCP,
CRT_PROV_UCX_LAST = CRT_PROV_UCX_TCP,
CRT_PROV_OFI_LAST = CRT_PROV_OFI_OPX,
CRT_PROV_UCX,
CRT_PROV_UCX_LAST = CRT_PROV_UCX,
/* Note: This entry should be the last valid one in enum */
CRT_PROV_COUNT,
CRT_PROV_UNKNOWN = -1,
Expand All @@ -75,8 +67,7 @@ crt_hg_parse_uri(const char *uri, crt_provider_t *prov, char *addr);
static inline bool
crt_provider_is_ucx(crt_provider_t prov)
{
return (prov >= CRT_PROV_UCX_RC) &&
(prov <= CRT_PROV_UCX_LAST);
return (prov >= CRT_PROV_UCX) && (prov <= CRT_PROV_UCX_LAST);
}

static inline bool
Expand All @@ -96,6 +87,8 @@ struct crt_na_dict {
bool nad_port_bind;
/** a flag to indicate if endpoints are contiguous */
bool nad_contig_eps;
/** a flag to indicate if nad_str is allocated on the heap */
bool nad_str_alloc;
};

extern struct crt_na_dict crt_na_dict[];
Expand Down
23 changes: 21 additions & 2 deletions src/cart/crt_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,13 @@ crt_provider_t
crt_str_to_provider(const char *str_provider)
{
crt_provider_t prov = CRT_PROV_UNKNOWN;
int i;
int i, len;
char *p = NULL;

if (str_provider == NULL)
return prov;

for (i = 0; crt_na_dict[i].nad_str != NULL; i++) {

if (!strncmp(str_provider, crt_na_dict[i].nad_str,
strlen(crt_na_dict[i].nad_str) + 1) ||
(crt_na_dict[i].nad_alt_str &&
Expand All @@ -459,6 +459,21 @@ crt_str_to_provider(const char *str_provider)
prov = crt_na_dict[i].nad_type;
break;
}
if (crt_na_dict[i].nad_type == CRT_PROV_UCX &&
!strncmp(str_provider, CRT_UCX_STR, strlen(CRT_UCX_STR))) {
len = strlen(str_provider);
if (len > strlen(CRT_UCX_STR) && strchr(str_provider, '+')) {
D_STRNDUP(p, str_provider, len);
if (!p) {
return prov;
} else {
crt_na_dict[i].nad_str = p;
crt_na_dict[i].nad_str_alloc = true;
}
}
prov = crt_na_dict[i].nad_type;
break;
}
}

return prov;
Expand Down Expand Up @@ -964,6 +979,10 @@ crt_finalize(void)
crt_na_config_fini(false, crt_gdata.cg_secondary_provs[i]);
}

for (i = 0; crt_na_dict[i].nad_str != NULL; i++)
if (crt_na_dict[i].nad_str_alloc)
D_FREE(crt_na_dict[i].nad_str);

D_FREE(crt_gdata.cg_secondary_provs);
D_FREE(crt_gdata.cg_prov_gdata_secondary);
} else {
Expand Down

0 comments on commit 2da75ff

Please sign in to comment.