@@ -368,7 +368,8 @@ static void uct_ib_mlx5dv_dci_qp_init_attr(uct_ib_qp_init_attr_t *qp_attr,
368368
369369ucs_status_t uct_dc_mlx5_iface_create_dci (uct_dc_mlx5_iface_t * iface ,
370370 uct_dci_index_t dci_index ,
371- uint8_t num_dci_channels )
371+ uint8_t num_dci_channels ,
372+ uct_dc_dci_t * * dci_p )
372373{
373374 uct_ib_iface_t * ib_iface = & iface -> super .super .super ;
374375 uct_ib_mlx5_qp_attr_t attr = {};
@@ -455,11 +456,6 @@ ucs_status_t uct_dc_mlx5_iface_create_dci(uct_dc_mlx5_iface_t *iface,
455456 goto err_qp ;
456457 }
457458
458- ucs_assertv_always (!uct_dc_mlx5_is_dci_valid (
459- uct_dc_mlx5_iface_dci (iface , dci_index )),
460- "iface=%p dci_index=%d" , iface , dci_index );
461- ucs_array_elem (& iface -> tx .dcis , dci_index ) = dci ;
462-
463459 if (uct_dc_mlx5_iface_is_policy_shared (iface )) {
464460 ucs_arbiter_group_init (& dci -> arb_group );
465461 } else {
@@ -477,6 +473,7 @@ ucs_status_t uct_dc_mlx5_iface_create_dci(uct_dc_mlx5_iface_t *iface,
477473
478474 uct_rc_txqp_available_set (& dci -> txqp , dci -> txwq .bb_max );
479475
476+ * dci_p = dci ;
480477 return UCS_OK ;
481478
482479err :
@@ -759,11 +756,10 @@ static void uct_dc_mlx5_iface_dci_pool_destroy(uct_dc_mlx5_dci_pool_t *dci_pool)
759756 ucs_array_cleanup_dynamic (& dci_pool -> stack );
760757}
761758
762- void uct_dc_mlx5_destroy_dci (uct_dc_mlx5_iface_t * iface , uint16_t dci_index )
759+ void uct_dc_mlx5_destroy_dci (uct_dc_mlx5_iface_t * iface , uct_dc_dci_t * dci )
763760{
764761 uct_ib_mlx5_md_t * md = ucs_derived_of (iface -> super .super .super .super .md ,
765762 uct_ib_mlx5_md_t );
766- uct_dc_dci_t * dci = uct_dc_mlx5_iface_dci (iface , dci_index );
767763
768764 uct_rc_txqp_cleanup (& iface -> super .super , & dci -> txqp );
769765 uct_ib_mlx5_destroy_qp (md , & dci -> txwq .super );
@@ -774,17 +770,16 @@ void uct_dc_mlx5_destroy_dci(uct_dc_mlx5_iface_t *iface, uint16_t dci_index)
774770 uct_ib_mlx5_qp_mmio_cleanup (& dci -> txwq .super , dci -> txwq .reg );
775771
776772 ucs_free (dci );
777- ucs_array_elem (& iface -> tx .dcis , dci_index ) = NULL ;
778773}
779774
780775static void uct_dc_mlx5_iface_dcis_destroy (uct_dc_mlx5_iface_t * iface )
781776{
782- uct_dc_dci_t * dci UCS_V_UNUSED ;
783777 uct_dci_index_t dci_index ;
784778 uint8_t pool_index ;
779+ uct_dc_dci_t * dci ;
785780
786781 uct_dc_iface_for_each_valid_dci (dci_index , dci , iface ) {
787- uct_dc_mlx5_destroy_dci (iface , dci_index );
782+ uct_dc_mlx5_destroy_dci (iface , dci );
788783 }
789784
790785 for (pool_index = 0 ; pool_index < iface -> tx .num_dci_pools ; pool_index ++ ) {
@@ -885,19 +880,13 @@ uct_dc_mlx5_iface_init_dcis_array(uct_dc_mlx5_iface_t *iface,
885880 return status ;
886881 }
887882
888- ucs_array_length (& iface -> tx .dcis ) = 0 ;
889-
890- status = uct_dc_mlx5_iface_create_dci (iface , 0 , 1 );
883+ status = uct_dc_mlx5_iface_create_dci (iface , 0 , 1 , & dci );
891884 if (status != UCS_OK ) {
892885 return status ;
893886 }
894887
895- dci = uct_dc_mlx5_iface_dci (iface , 0 );
896-
897888 iface -> tx .bb_max = dci -> txwq .bb_max ;
898- uct_dc_mlx5_destroy_dci (iface , 0 );
899-
900- ucs_array_length (& iface -> tx .dcis ) = 0 ;
889+ uct_dc_mlx5_destroy_dci (iface , dci );
901890
902891 return UCS_OK ;
903892}
@@ -1603,7 +1592,7 @@ static UCS_CLASS_INIT_FUNC(uct_dc_mlx5_iface_t, uct_md_h tl_md, uct_worker_h wor
16031592 self -> tx .ndci = uct_dc_mlx5_iface_is_hw_dcs (self ) ? 1 : config -> ndci ;
16041593
16051594 if (config -> dcis_initial_capacity == UCS_ULUNITS_AUTO ) {
1606- max_capacity = uct_dc_mlx5_iface_is_dci_rand (self ) ? SIZE_MAX : 1 ;
1595+ max_capacity = uct_dc_mlx5_iface_is_dci_rand (self ) ? SIZE_MAX : 0 ;
16071596 } else {
16081597 max_capacity = config -> dcis_initial_capacity ;
16091598 }
0 commit comments