@@ -992,6 +992,7 @@ _mlx5r_dmabuf_umr_update_pas(struct mlx5_ib_mr *mr, unsigned int flags,
992
992
static int _mlx5r_umr_zap_mkey (struct mlx5_ib_mr * mr ,
993
993
unsigned int flags ,
994
994
unsigned int page_shift ,
995
+ size_t * nblocks ,
995
996
bool dd )
996
997
{
997
998
unsigned int old_page_shift = mr -> page_shift ;
@@ -1000,7 +1001,6 @@ static int _mlx5r_umr_zap_mkey(struct mlx5_ib_mr *mr,
1000
1001
size_t page_shift_nblocks ;
1001
1002
unsigned int max_log_size ;
1002
1003
int access_mode ;
1003
- size_t nblocks ;
1004
1004
int err ;
1005
1005
1006
1006
access_mode = dd ? MLX5_MKC_ACCESS_MODE_KSM : MLX5_MKC_ACCESS_MODE_MTT ;
@@ -1014,26 +1014,26 @@ static int _mlx5r_umr_zap_mkey(struct mlx5_ib_mr *mr,
1014
1014
* Block size must be aligned to MLX5_UMR_FLEX_ALIGNMENT since it may
1015
1015
* be used as offset into the XLT later on.
1016
1016
*/
1017
- nblocks = ib_umem_num_dma_blocks (mr -> umem , 1UL << max_page_shift );
1017
+ * nblocks = ib_umem_num_dma_blocks (mr -> umem , 1UL << max_page_shift );
1018
1018
if (dd )
1019
- nblocks = ALIGN (nblocks , MLX5_UMR_KSM_NUM_ENTRIES_ALIGNMENT );
1019
+ * nblocks = ALIGN (* nblocks , MLX5_UMR_KSM_NUM_ENTRIES_ALIGNMENT );
1020
1020
else
1021
- nblocks = ALIGN (nblocks , MLX5_UMR_MTT_NUM_ENTRIES_ALIGNMENT );
1021
+ * nblocks = ALIGN (* nblocks , MLX5_UMR_MTT_NUM_ENTRIES_ALIGNMENT );
1022
1022
page_shift_nblocks = ib_umem_num_dma_blocks (mr -> umem ,
1023
1023
1UL << page_shift );
1024
1024
/* If the number of blocks at max possible page shift is greater than
1025
1025
* the number of blocks at the new page size, we should just go over the
1026
1026
* whole mkey entries.
1027
1027
*/
1028
- if (nblocks >= page_shift_nblocks )
1029
- nblocks = 0 ;
1028
+ if (* nblocks >= page_shift_nblocks )
1029
+ * nblocks = 0 ;
1030
1030
1031
1031
/* Make the first nblocks entries non-present without changing
1032
1032
* page size yet.
1033
1033
*/
1034
- if (nblocks )
1034
+ if (* nblocks )
1035
1035
mr -> page_shift = max_page_shift ;
1036
- err = _mlx5r_dmabuf_umr_update_pas (mr , flags , 0 , nblocks , dd );
1036
+ err = _mlx5r_dmabuf_umr_update_pas (mr , flags , 0 , * nblocks , dd );
1037
1037
if (err ) {
1038
1038
mr -> page_shift = old_page_shift ;
1039
1039
return err ;
@@ -1042,15 +1042,15 @@ static int _mlx5r_umr_zap_mkey(struct mlx5_ib_mr *mr,
1042
1042
/* Change page size to the max page size now that the MR is completely
1043
1043
* non-present.
1044
1044
*/
1045
- if (nblocks ) {
1045
+ if (* nblocks ) {
1046
1046
err = mlx5r_umr_update_mr_page_shift (mr , max_page_shift , dd );
1047
1047
if (err ) {
1048
1048
mr -> page_shift = old_page_shift ;
1049
1049
return err ;
1050
1050
}
1051
1051
}
1052
1052
1053
- return nblocks ;
1053
+ return 0 ;
1054
1054
}
1055
1055
1056
1056
/**
@@ -1085,10 +1085,10 @@ int mlx5r_umr_dmabuf_update_pgsz(struct mlx5_ib_mr *mr, u32 xlt_flags,
1085
1085
size_t total_blocks ;
1086
1086
int err ;
1087
1087
1088
- zapped_blocks = _mlx5r_umr_zap_mkey (mr , xlt_flags , page_shift ,
1089
- mr -> data_direct );
1090
- if (zapped_blocks < 0 )
1091
- return zapped_blocks ;
1088
+ err = _mlx5r_umr_zap_mkey (mr , xlt_flags , page_shift , & zapped_blocks ,
1089
+ mr -> data_direct );
1090
+ if (err )
1091
+ return err ;
1092
1092
1093
1093
/* _mlx5r_umr_zap_mkey already enables the mkey */
1094
1094
xlt_flags &= ~MLX5_IB_UPD_XLT_ENABLE ;
0 commit comments