All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: haris.iqbal@ionos.com, jinpu.wang@ionos.com, jgg@ziepe.ca,
	leon@kernel.org
Cc: linux-rdma@vger.kernel.org
Subject: [PATCH V2 1/8] RDMA/rtrs-srv: Refactor rtrs_srv_rdma_cm_handler
Date: Thu, 17 Nov 2022 18:19:38 +0800	[thread overview]
Message-ID: <20221117101945.6317-2-guoqing.jiang@linux.dev> (raw)
In-Reply-To: <20221117101945.6317-1-guoqing.jiang@linux.dev>

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: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
 drivers/infiniband/ulp/rtrs/rtrs-srv.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
index 22d7ba05e9fe..5fe3699cb8ff 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
@@ -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_path *s = NULL;
+	struct rtrs_con *c = NULL;
 
-	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:
+	if (ev->event == RDMA_CM_EVENT_CONNECT_REQUEST)
 		/*
 		 * In case of error cma.c will destroy cm_id,
 		 * see cma_process_remove()
 		 */
 		return rtrs_rdma_connect(cm_id, ev->param.conn.private_data,
 					  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:
 		/* Nothing here */
 		break;
-- 
2.31.1


  reply	other threads:[~2022-11-17 10:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17 10:19 [PATCH V2 0/8] Misc patches for rtrs Guoqing Jiang
2022-11-17 10:19 ` Guoqing Jiang [this message]
2022-11-17 10:19 ` [PATCH V2 2/8] RDMA/rtrs-srv: Refactor the handling of failure case in map_cont_bufs Guoqing Jiang
2022-11-17 10:19 ` [PATCH V2 3/8] RDMA/rtrs-srv: Correct the checking of ib_map_mr_sg Guoqing Jiang
2022-11-17 10:19 ` [PATCH V2 4/8] RDMA/rtrs-clt: " Guoqing Jiang
2022-11-17 10:19 ` [PATCH V2 5/8] RDMA/rtrs-srv: Remove outdated comments from create_con Guoqing Jiang
2022-11-17 10:19 ` [PATCH V2 6/8] RDMA/rtrs: Clean up rtrs_rdma_dev_pd_ops Guoqing Jiang
2022-11-17 10:19 ` [PATCH V2 7/8] RDMA/rtrs-srv: Fix several issues in rtrs_srv_destroy_path_files Guoqing Jiang
2022-11-17 10:19 ` [PATCH V2 8/8] RDMA/rtrs-srv: Remove kobject_del from rtrs_srv_destroy_once_sysfs_root_folders Guoqing Jiang
2022-11-17 11:49 ` [PATCH V2 0/8] Misc patches for rtrs Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221117101945.6317-2-guoqing.jiang@linux.dev \
    --to=guoqing.jiang@linux.dev \
    --cc=haris.iqbal@ionos.com \
    --cc=jgg@ziepe.ca \
    --cc=jinpu.wang@ionos.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.