| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#ifndef UCT_UGNI_EP_H |
| 7 |
#define UCT_UGNI_EP_H |
| 8 |
|
| 9 |
#include "ugni_def.h" |
| 10 |
#include "ugni_types.h" |
| 11 |
#include <uct/api/uct.h> |
| 12 |
#include <uct/base/uct_iface.h> |
| 13 |
#include <ucs/type/class.h> |
| 14 |
#include <ucs/datastruct/sglib_wrapper.h> |
| 15 |
|
| 16 |
static inline int32_t uct_ugni_ep_compare(uct_ugni_ep_t *ep1, uct_ugni_ep_t *ep2) |
| 17 |
{ |
| 18 |
return ep1->hash_key - ep2->hash_key; |
| 19 |
} |
| 20 |
|
| 21 |
static inline unsigned uct_ugni_ep_hash(uct_ugni_ep_t *ep) |
| 22 |
{ |
| 23 |
return ep->hash_key; |
| 24 |
} |
| 25 |
|
| 26 |
SGLIB_DEFINE_LIST_PROTOTYPES(uct_ugni_ep_t, uct_ugni_ep_compare, next); |
| 27 |
SGLIB_DEFINE_HASHED_CONTAINER_PROTOTYPES(uct_ugni_ep_t, UCT_UGNI_HASH_SIZE, uct_ugni_ep_hash); |
| 28 |
|
| 29 |
UCS_CLASS_DECLARE(uct_ugni_ep_t, const uct_ep_params_t *); |
| 30 |
UCS_CLASS_DECLARE_NEW_FUNC(uct_ugni_ep_t, uct_ep_t, const uct_ep_params_t *); |
| 31 |
UCS_CLASS_DECLARE_DELETE_FUNC(uct_ugni_ep_t, uct_ep_t); |
| 32 |
|
| 33 |
uct_ugni_ep_t *uct_ugni_iface_lookup_ep(uct_ugni_iface_t *iface, uintptr_t hash_key); |
| 34 |
ucs_status_t ugni_connect_ep(uct_ugni_ep_t *ep, |
| 35 |
uct_ugni_iface_t *iface, |
| 36 |
const uct_sockaddr_ugni_t *iface_addr, |
| 37 |
const uct_devaddr_ugni_t *dev_addr); |
| 38 |
ucs_status_t uct_ugni_ep_pending_add(uct_ep_h tl_ep, uct_pending_req_t *n, |
| 39 |
unsigned flags); |
| 40 |
void uct_ugni_ep_pending_purge(uct_ep_h tl_ep, uct_pending_purge_callback_t cb, |
| 41 |
void *arg); |
| 42 |
ucs_arbiter_cb_result_t uct_ugni_ep_process_pending(ucs_arbiter_t *arbiter, |
| 43 |
ucs_arbiter_group_t *group, |
| 44 |
ucs_arbiter_elem_t *elem, |
| 45 |
void *arg); |
| 46 |
ucs_arbiter_cb_result_t uct_ugni_ep_arbiter_purge_cb(ucs_arbiter_t *arbiter, |
| 47 |
ucs_arbiter_group_t *group, |
| 48 |
ucs_arbiter_elem_t *elem, |
| 49 |
void *arg); |
| 50 |
ucs_status_t uct_ugni_ep_flush(uct_ep_h tl_ep, unsigned flags, |
| 51 |
uct_completion_t *comp); |
| 52 |
|
| 53 |
static inline int uct_ugni_ep_can_send(uct_ugni_ep_t *ep) |
| 54 |
{ |
| 55 |
return (ucs_arbiter_group_is_empty(&ep->arb_group) || ep->arb_sched) ? 1 : 0; |
| 56 |
} |
| 57 |
|
| 58 |
static inline int uct_ugni_ep_can_flush(uct_ugni_ep_t *ep) |
| 59 |
{ |
| 60 |
return (ep->flush_group->flush_comp.count == 1 && uct_ugni_ep_can_send(ep)) ? 1 : 0; |
| 61 |
} |
| 62 |
|
| 63 |
static inline void uct_ugni_check_flush(uct_ugni_flush_group_t *flush_group) |
| 64 |
{ |
| 65 |
uct_invoke_completion(&flush_group->flush_comp, UCS_OK); |
| 66 |
} |
| 67 |
|
| 68 |
#endif |