@@ -494,6 +494,11 @@ unsigned uct_ib_iface_address_pack_flags(uct_ib_iface_t *iface);
494494size_t uct_ib_iface_address_size (uct_ib_iface_t * iface );
495495
496496
497+ int uct_ib_iface_is_connected (uct_ib_iface_t * ib_iface ,
498+ const uct_ib_address_t * ib_addr ,
499+ unsigned path_index , struct ibv_ah * peer_ah );
500+
501+
497502/**
498503 * Pack IB address.
499504 *
@@ -660,16 +665,23 @@ uint16_t uct_ib_iface_resolve_remote_flid(uct_ib_iface_t *iface,
660665 uct_ib_iface_is_roce(_iface) ? "RoCE" : "IB"
661666
662667
663- #define UCT_IB_IFACE_VERBS_COMPLETION_ERR (_type , _iface , _i , _wc ) \
664- ucs_fatal("%s completion[%d] with error on %s/%p: %s, vendor_err 0x%x wr_id 0x%lx", \
665- _type, _i, uct_ib_device_name(uct_ib_iface_device(_iface)), _iface, \
666- uct_ib_wc_status_str(_wc[_i].status), _wc[_i].vendor_err, \
667- _wc[_i].wr_id);
668+ #define UCT_IB_IFACE_VERBS_COMPLETION_MSG (_type , _iface , _i , _wc ) \
669+ "%s completion[%d] with error on %s/%p: %s," \
670+ " vendor_err 0x%x wr_id 0x%lx", \
671+ _type, _i, uct_ib_device_name(uct_ib_iface_device(_iface)), \
672+ _iface, uct_ib_wc_status_str(_wc[_i].status), _wc[_i].vendor_err, \
673+ _wc[_i].wr_id
674+
675+ #define UCT_IB_IFACE_VERBS_COMPLETION_LOG (_log_lvl , _type , _iface , _i , _wc ) \
676+ ucs_log(_log_lvl, UCT_IB_IFACE_VERBS_COMPLETION_MSG(_type, _iface, _i, _wc))
677+
678+ #define UCT_IB_IFACE_VERBS_COMPLETION_FATAL (_type , _iface , _i , _wc ) \
679+ ucs_fatal(UCT_IB_IFACE_VERBS_COMPLETION_MSG(_type, _iface, _i, _wc))
668680
669681#define UCT_IB_IFACE_VERBS_FOREACH_RXWQE (_iface , _i , _hdr , _wc , _wc_count ) \
670682 for (_i = 0; _i < _wc_count && ({ \
671683 if (ucs_unlikely(_wc[_i].status != IBV_WC_SUCCESS)) { \
672- UCT_IB_IFACE_VERBS_COMPLETION_ERR ("receive", _iface, _i, _wc); \
684+ UCT_IB_IFACE_VERBS_COMPLETION_FATAL ("receive", _iface, _i, _wc); \
673685 } \
674686 _hdr = (typeof(_hdr))uct_ib_iface_recv_desc_hdr(_iface, \
675687 (uct_ib_iface_recv_desc_t *)(uintptr_t)_wc[_i].wr_id); \
@@ -765,4 +777,26 @@ uct_ib_fill_cq_attr(struct ibv_cq_init_attr_ex *cq_attr,
765777}
766778#endif /* HAVE_DECL_IBV_CREATE_CQ_EX */
767779
780+ static UCS_F_ALWAYS_INLINE ucs_status_t
781+ uct_ib_wc_to_ucs_status (enum ibv_wc_status status )
782+ {
783+ switch (status )
784+ {
785+ case IBV_WC_SUCCESS :
786+ return UCS_OK ;
787+ case IBV_WC_REM_ACCESS_ERR :
788+ case IBV_WC_REM_OP_ERR :
789+ case IBV_WC_REM_INV_RD_REQ_ERR :
790+ return UCS_ERR_CONNECTION_RESET ;
791+ case IBV_WC_RETRY_EXC_ERR :
792+ case IBV_WC_RNR_RETRY_EXC_ERR :
793+ case IBV_WC_REM_ABORT_ERR :
794+ return UCS_ERR_ENDPOINT_TIMEOUT ;
795+ case IBV_WC_WR_FLUSH_ERR :
796+ return UCS_ERR_CANCELED ;
797+ default :
798+ return UCS_ERR_IO_ERROR ;
799+ }
800+ }
801+
768802#endif
0 commit comments