@@ -624,9 +624,9 @@ struct ibv_cq *uct_ib_create_cq(struct ibv_context *context, int cqe,
624624 struct ibv_comp_channel * channel ,
625625 int comp_vector , int ignore_overrun )
626626{
627- struct ibv_cq * cq ;
628627#if HAVE_DECL_IBV_CREATE_CQ_ATTR_IGNORE_OVERRUN
629628 struct ibv_cq_init_attr_ex cq_attr = {};
629+ struct ibv_cq_ex * cq_ex ;
630630
631631 cq_attr .cqe = cqe ;
632632 cq_attr .channel = channel ;
@@ -636,11 +636,16 @@ struct ibv_cq *uct_ib_create_cq(struct ibv_context *context, int cqe,
636636 cq_attr .flags = IBV_CREATE_CQ_ATTR_IGNORE_OVERRUN ;
637637 }
638638
639- cq = ibv_cq_ex_to_cq (ibv_create_cq_ex (context , & cq_attr ));
640- #else
641- cq = ibv_create_cq (context , cqe , NULL , channel , comp_vector );
639+ cq_ex = ibv_create_cq_ex (context , & cq_attr );
640+ if (cq_ex ) {
641+ return ibv_cq_ex_to_cq (cq_ex );
642+ } else if (errno != ENOSYS ) {
643+ return NULL ;
644+ }
645+
646+ /* if ibv_create_cq_ex returned ENOSYS, fallback to ibv_create_cq */
642647#endif
643- return cq ;
648+ return ibv_create_cq ( context , cqe , NULL , channel , comp_vector ) ;
644649}
645650
646651static ucs_status_t uct_ib_iface_create_cq (uct_ib_iface_t * iface , int cq_length ,
0 commit comments