Skip to content

Commit

Permalink
fabtests/efa: Close ibv device after use
Browse files Browse the repository at this point in the history
Signed-off-by: Sai Sunku <[email protected]>
  • Loading branch information
sunkuamzn authored and a-szegel committed Dec 29, 2023
1 parent 66dfbea commit 04ef302
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions fabtests/prov/efa/src/efa_exhaust_mr_reg_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ int ft_efa_open_ibv_device(struct ibv_context **ctx) {
return 0;
}

int ft_efa_close_ibv_device(struct ibv_context *ctx) {
return ibv_close_device(ctx);
}

int ft_efa_get_max_mr(struct ibv_context *ctx) {
int ret;
struct ibv_device_attr dev_attr = {0};
Expand Down
3 changes: 2 additions & 1 deletion fabtests/prov/efa/src/efa_exhaust_mr_reg_rdm_pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int main(int argc, char **argv)
size_t registered;
void **buffers = NULL;
struct ibv_mr **mr_reg_vec = NULL;
struct ibv_context *ibv_ctx;
struct ibv_context *ibv_ctx = NULL;
struct ibv_pd *pd;

opts = INIT_OPTS;
Expand Down Expand Up @@ -135,6 +135,7 @@ int main(int argc, char **argv)
if (err)
FT_PRINTERR("ibv mr dereg", -err);
ft_efa_destroy_ibv_pd(pd);
ft_efa_close_ibv_device(ibv_ctx);
}

free(buffers);
Expand Down

0 comments on commit 04ef302

Please sign in to comment.