Commit d7115727 authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Leon Romanovsky

RDMA/rtrs-srv: Refactor rtrs_srv_rdma_cm_handler

The RDMA_CM_EVENT_CONNECT_REQUEST is quite different to other types,
let's check it separately at the beginning of routine, then we can
avoid the indentation accordingly.
Acked-by: default avatarJack Wang <jinpu.wang@ionos.com>
Signed-off-by: default avatarGuoqing Jiang <guoqing.jiang@linux.dev>
Link: https://lore.kernel.org/r/20221117101945.6317-2-guoqing.jiang@linux.devSigned-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 8f7e2daa
...@@ -1950,22 +1950,21 @@ static int rtrs_srv_rdma_cm_handler(struct rdma_cm_id *cm_id, ...@@ -1950,22 +1950,21 @@ static int rtrs_srv_rdma_cm_handler(struct rdma_cm_id *cm_id,
{ {
struct rtrs_srv_path *srv_path = NULL; struct rtrs_srv_path *srv_path = NULL;
struct rtrs_path *s = NULL; struct rtrs_path *s = NULL;
struct rtrs_con *c = NULL;
if (ev->event != RDMA_CM_EVENT_CONNECT_REQUEST) { if (ev->event == RDMA_CM_EVENT_CONNECT_REQUEST)
struct rtrs_con *c = cm_id->context;
s = c->path;
srv_path = to_srv_path(s);
}
switch (ev->event) {
case RDMA_CM_EVENT_CONNECT_REQUEST:
/* /*
* In case of error cma.c will destroy cm_id, * In case of error cma.c will destroy cm_id,
* see cma_process_remove() * see cma_process_remove()
*/ */
return rtrs_rdma_connect(cm_id, ev->param.conn.private_data, return rtrs_rdma_connect(cm_id, ev->param.conn.private_data,
ev->param.conn.private_data_len); ev->param.conn.private_data_len);
c = cm_id->context;
s = c->path;
srv_path = to_srv_path(s);
switch (ev->event) {
case RDMA_CM_EVENT_ESTABLISHED: case RDMA_CM_EVENT_ESTABLISHED:
/* Nothing here */ /* Nothing here */
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment