Bug 220380 - [ofed] Cannot bind to the same port after rdma_destroy_id and rdma_create_id
Summary: [ofed] Cannot bind to the same port after rdma_destroy_id and rdma_create_id
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Some People
Assignee: Navdeep Parhar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-30 08:39 UTC by Bartosz Sobczak
Modified: 2023-08-31 23:47 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bartosz Sobczak 2017-06-30 08:39:49 UTC
In case when the addr and port is bound, but the rdma_destroy_id is called instead of connection establishment, there is no possibility of binding to this port anymore.

Reproduce procedure:
1. cm_id = rdma_create_id( cma_event_handler, cb, ...);
2. rdma_bind_addr(cm_id, (struct sockaddr *)addr);
3. rdma_listen(cm_id, backlog);
4. rdma_destroy_id(cm_id);
5. cm_id = rdma_create_id( cma_event_handler, cb, ...);
6. rdma_bind_addr(cm_id, (struct sockaddr *)addr);  //bind unsuccessfull

It seems the issue comes from the fact, that in cma_release_port from sys/ofed/drivers/infiniband/core/cma.c a sock_release call has been moved to iw_destroy_cm_id from iwcm.c file. It does work for normal operation, but the function is never reached when no connection is established. (compare rdma_destroy_id function in cma.c)
Comment 1 Hans Petter Selasky freebsd_committer freebsd_triage 2017-07-01 16:19:50 UTC
Navdeep can you have a look at this issue.

iw_destroy_cm_id() is your creation??

--HPS
Comment 2 Rafal Michna 2023-08-31 23:47:19 UTC
This seems to work fine now on 12.4 RELEASE, 13.2 RELEASE and 14.0 CURRENT
Checked with both Intel and Mellanox cards