@@ -448,6 +448,7 @@ static void mlx5_detach_dedicated_uar(struct ibv_context *context, struct mlx5_b
448448
449449struct ibv_td * mlx5_alloc_td (struct ibv_context * context , struct ibv_td_init_attr * init_attr )
450450{
451+ struct mlx5_context * ctx = to_mctx (context );
451452 struct mlx5_td * td ;
452453
453454 if (init_attr -> comp_mask ) {
@@ -461,7 +462,12 @@ struct ibv_td *mlx5_alloc_td(struct ibv_context *context, struct ibv_td_init_att
461462 return NULL ;
462463 }
463464
464- td -> bf = mlx5_attach_dedicated_uar (context , 0 );
465+ /* Check whether BlueFlame is supported on the device */
466+ if (ctx -> bf_reg_size )
467+ td -> bf = mlx5_attach_dedicated_uar (context , 0 );
468+ else
469+ td -> bf = ctx -> nc_uar ;
470+
465471 if (!td -> bf ) {
466472 free (td );
467473 return NULL ;
@@ -481,7 +487,8 @@ int mlx5_dealloc_td(struct ibv_td *ib_td)
481487 if (atomic_load (& td -> refcount ) > 1 )
482488 return EBUSY ;
483489
484- mlx5_detach_dedicated_uar (ib_td -> context , td -> bf );
490+ if (!td -> bf -> singleton )
491+ mlx5_detach_dedicated_uar (ib_td -> context , td -> bf );
485492 free (td );
486493
487494 return 0 ;
@@ -5615,8 +5622,7 @@ struct ibv_flow *
56155622_mlx5dv_create_flow (struct mlx5dv_flow_matcher * flow_matcher ,
56165623 struct mlx5dv_flow_match_parameters * match_value ,
56175624 size_t num_actions ,
5618- struct mlx5dv_flow_action_attr actions_attr [],
5619- struct mlx5_flow_action_attr_aux actions_attr_aux [])
5625+ struct mlx5dv_flow_action_attr actions_attr [])
56205626{
56215627 uint32_t flow_actions [CREATE_FLOW_MAX_FLOW_ACTIONS_SUPPORTED ];
56225628 struct verbs_flow_action * vaction ;
@@ -5626,6 +5632,7 @@ _mlx5dv_create_flow(struct mlx5dv_flow_matcher *flow_matcher,
56265632 bool have_dest_devx = false;
56275633 bool have_flow_tag = false;
56285634 bool have_counter = false;
5635+ bool have_bulk_counter = false;
56295636 bool have_default = false;
56305637 bool have_drop = false;
56315638 int ret ;
@@ -5695,20 +5702,13 @@ _mlx5dv_create_flow(struct mlx5dv_flow_matcher *flow_matcher,
56955702 have_flow_tag = true;
56965703 break ;
56975704 case MLX5DV_FLOW_ACTION_COUNTERS_DEVX :
5698- if (have_counter ) {
5705+ if (have_counter || have_bulk_counter ) {
56995706 errno = EOPNOTSUPP ;
57005707 goto err ;
57015708 }
57025709 fill_attr_in_objs_arr (cmd ,
57035710 MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX ,
57045711 & actions_attr [i ].obj -> handle , 1 );
5705-
5706- if (actions_attr_aux &&
5707- actions_attr_aux [i ].type == MLX5_FLOW_ACTION_COUNTER_OFFSET )
5708- fill_attr_in_ptr_array (cmd ,
5709- MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX_OFFSET ,
5710- & actions_attr_aux [i ].offset , 1 );
5711-
57125712 have_counter = true;
57135713 break ;
57145714 case MLX5DV_FLOW_ACTION_DEFAULT_MISS :
@@ -5733,6 +5733,19 @@ _mlx5dv_create_flow(struct mlx5dv_flow_matcher *flow_matcher,
57335733 MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP );
57345734 have_drop = true;
57355735 break ;
5736+ case MLX5DV_FLOW_ACTION_COUNTERS_DEVX_WITH_OFFSET :
5737+ if (have_counter || have_bulk_counter ) {
5738+ errno = EOPNOTSUPP ;
5739+ goto err ;
5740+ }
5741+ fill_attr_in_objs_arr (cmd ,
5742+ MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX ,
5743+ & actions_attr [i ].bulk_obj .obj -> handle , 1 );
5744+ fill_attr_in_ptr_array (cmd ,
5745+ MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX_OFFSET ,
5746+ & actions_attr [i ].bulk_obj .offset , 1 );
5747+ have_bulk_counter = true;
5748+ break ;
57365749 default :
57375750 errno = EOPNOTSUPP ;
57385751 goto err ;
@@ -5772,8 +5785,7 @@ mlx5dv_create_flow(struct mlx5dv_flow_matcher *flow_matcher,
57725785 return dvops -> create_flow (flow_matcher ,
57735786 match_value ,
57745787 num_actions ,
5775- actions_attr ,
5776- NULL );
5788+ actions_attr );
57775789}
57785790
57795791static struct mlx5dv_steering_anchor *
0 commit comments