Skip to content

Commit e9d614b

Browse files
committed
Perftest: Fix resources clean up.
Destroy the mkey and the data encryption key before the deallocation of the PD. Signed-off-by: Hassan Khadour <[email protected]>
1 parent ed18d32 commit e9d614b

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/perftest_resources.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,20 @@ int destroy_ctx(struct pingpong_context *ctx,
13431343
free(ctx->ctrl_wr);
13441344
}
13451345

1346+
#ifdef HAVE_AES_XTS
1347+
if(user_param->aes_xts){
1348+
for(i = 0; i < user_param->data_enc_keys_number; i++) {
1349+
if (mlx5dv_dek_destroy(ctx->dek[i]))
1350+
fprintf(stderr, "Failed to destroy data encryption key.\n");
1351+
}
1352+
1353+
for(i = 0; i < user_param->num_of_qps; i++) {
1354+
if (mlx5dv_destroy_mkey(ctx->mkey[i]))
1355+
fprintf(stderr, "Failed to destroy MKey.\n");
1356+
}
1357+
}
1358+
#endif
1359+
13461360
if (ibv_dealloc_pd(ctx->pd)) {
13471361
fprintf(stderr, "Failed to deallocate PD - %s\n", strerror(errno));
13481362
test_result = 1;
@@ -1408,17 +1422,8 @@ int destroy_ctx(struct pingpong_context *ctx,
14081422
#endif
14091423
#endif
14101424
#ifdef HAVE_AES_XTS
1411-
if(user_param->aes_xts){
1412-
for(i = 0; i < user_param->data_enc_keys_number; i++){
1413-
free(ctx->dek[i]);
1414-
}
1415-
1425+
if(user_param->aes_xts) {
14161426
free(ctx->dek);
1417-
1418-
for(i = 0; i < user_param->num_of_qps; i++){
1419-
free(ctx->mkey[i]);
1420-
}
1421-
14221427
free(ctx->mkey);
14231428
}
14241429
#endif

0 commit comments

Comments
 (0)