Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/uct/tcp/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@ typedef enum uct_tcp_ep_am_id {
} uct_tcp_ep_am_id_t;


/**
* TCP Reachability mode.
*/
typedef enum {
UCT_TCP_REACHABILITY_MODE_ROUTE = 0,
UCT_TCP_REACHABILITY_MODE_ALL = 1,
UCT_TCP_REACHABILITY_MODE_LAST
} uct_tcp_iface_reachability_mode_t;


/**
* TCP PUT request header
*/
Expand Down Expand Up @@ -422,6 +432,7 @@ typedef struct uct_tcp_iface {
ucs_time_t intvl; /* The time between individual keepalive
* probes (TCP_KEEPINTVL socket option). */
} keepalive;
unsigned reachability_mode; /* Mode used for performing reachability check */
} config;

struct {
Expand Down Expand Up @@ -459,6 +470,7 @@ typedef struct uct_tcp_iface_config {
ucs_time_t intvl;
} keepalive;
ucs_ternary_auto_value_t ep_bind_src_addr;
unsigned reachability_mode;
} uct_tcp_iface_config_t;


Expand Down
20 changes: 18 additions & 2 deletions src/uct/tcp/tcp_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@

#define UCT_TCP_IFACE_NETDEV_DIR "/sys/class/net"

const char *uct_tcp_reachability_modes[] = {
[UCT_TCP_REACHABILITY_MODE_ROUTE] = "route",
[UCT_TCP_REACHABILITY_MODE_ALL] = "all",
[UCT_TCP_REACHABILITY_MODE_LAST] = NULL
};

extern ucs_class_t UCS_CLASS_DECL_NAME(uct_tcp_iface_t);

static ucs_config_field_t uct_tcp_iface_config_table[] = {
Expand Down Expand Up @@ -118,6 +124,12 @@ static ucs_config_field_t uct_tcp_iface_config_table[] = {
ucs_offsetof(uct_tcp_iface_config_t, ep_bind_src_addr),
UCS_CONFIG_TYPE_TERNARY},

{"REACHABILITY_MODE", "route",
"The mode used for performing the reachability check\n"
" - route - all routable addresses are assumed as reachable\n"
" - all - all addresses are assumed as reachable, without any check",
ucs_offsetof(uct_tcp_iface_config_t, reachability_mode), UCS_CONFIG_TYPE_ENUM(uct_tcp_reachability_modes)},

{NULL}
};

Expand Down Expand Up @@ -241,12 +253,15 @@ uct_tcp_iface_is_reachable_v2(const uct_iface_h tl_iface,
}
}

if ((params->field_mask & UCT_IFACE_IS_REACHABLE_FIELD_SCOPE) &&
(params->scope == UCT_IFACE_REACHABILITY_SCOPE_DEVICE)) {
if (((params->field_mask & UCT_IFACE_IS_REACHABLE_FIELD_SCOPE) &&
(params->scope == UCT_IFACE_REACHABILITY_SCOPE_DEVICE)) ||
(iface->config.reachability_mode == UCT_TCP_REACHABILITY_MODE_ALL)) {
return uct_iface_scope_is_reachable(tl_iface, params);
}

/* Check if the remote address is routable */
ucs_assert(iface->config.reachability_mode ==
UCT_TCP_REACHABILITY_MODE_ROUTE);
status = ucs_ifname_to_index(iface->if_name, &ndev_index);
if (status != UCS_OK) {
uct_iface_fill_info_str_buf(
Expand Down Expand Up @@ -763,6 +778,7 @@ static UCS_CLASS_INIT_FUNC(uct_tcp_iface_t, uct_md_h md, uct_worker_h worker,
self->config.keepalive.cnt = config->keepalive.cnt;
self->config.keepalive.intvl = config->keepalive.intvl;
self->config.ep_bind_src_addr = config->ep_bind_src_addr;
self->config.reachability_mode = config->reachability_mode;
self->port_range.first = config->port_range.first;
self->port_range.last = config->port_range.last;

Expand Down
Loading