nvmf: use cm_id context to store conn pointer
Instead of searching the global list of connections to find a matching cm_id, we can just store the pointer back to the spdk_nvmf_conn in the rdma_cm_id context field. Change-Id: I39ea16be6a633a1136d65743747b63b600f20e63 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
f086365392
commit
90c28166c0
@ -128,21 +128,6 @@ free_conn(struct spdk_nvmf_conn *conn)
|
||||
conn->is_valid = 0;
|
||||
}
|
||||
|
||||
struct spdk_nvmf_conn *
|
||||
spdk_find_nvmf_conn_by_cm_id(struct rdma_cm_id *cm_id)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < g_max_conns; i++) {
|
||||
if ((g_conns_array[i].is_valid == 1) &&
|
||||
(g_conns_array[i].cm_id == cm_id)) {
|
||||
return &g_conns_array[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct spdk_nvmf_conn *
|
||||
spdk_find_nvmf_conn_by_cntlid(int cntlid)
|
||||
{
|
||||
|
@ -102,7 +102,4 @@ spdk_nvmf_allocate_conn(void);
|
||||
|
||||
int spdk_nvmf_startup_conn(struct spdk_nvmf_conn *conn);
|
||||
|
||||
struct spdk_nvmf_conn *
|
||||
spdk_find_nvmf_conn_by_cm_id(struct rdma_cm_id *cm_id);
|
||||
|
||||
#endif /* NVMF_CONN_H */
|
||||
|
@ -475,6 +475,7 @@ nvmf_rdma_cm_connect(struct rdma_cm_event *event)
|
||||
* and also to ibv_device (cm_id->verbs->device)
|
||||
*/
|
||||
conn->cm_id = conn_id;
|
||||
conn_id->context = conn;
|
||||
|
||||
/* check for private data */
|
||||
if (event->param.conn.private_data_len < sizeof(union spdk_nvmf_rdma_private_data)) {
|
||||
@ -655,7 +656,7 @@ nvmf_rdma_cm_disconnect(struct rdma_cm_event *event)
|
||||
}
|
||||
conn_id = event->id;
|
||||
|
||||
conn = spdk_find_nvmf_conn_by_cm_id(conn_id);
|
||||
conn = conn_id->context;
|
||||
if (conn == NULL) {
|
||||
SPDK_ERRLOG("disconnect request: no active connection\n");
|
||||
goto err0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user