Linux-RDMA Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] RDMA/rtrs: server: use already dereferenced rtrs_sess structure
@ 2020-05-22  8:28 haris.phnx
  2020-05-22 10:01 ` Danil Kipnis
  2020-05-23  0:25 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: haris.phnx @ 2020-05-22  8:28 UTC (permalink / raw)
  To: linux-block, linux-rdma, danil.kipnis, jinpu.wang
  Cc: axboe, dledford, jgg, Md Haris Iqbal

From: Md Haris Iqbal <haris.phnx@gmail.com>

The rtrs_sess structure has already been extracted above from the
rtrs_srv_sess structure. Use that to avoid redundant dereferencing.

Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality")
Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com>
---
 drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
index 1fc6ece036ff..5ef8988ee75b 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
@@ -1822,13 +1822,13 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_id,
 		/*
 		 * Sanity checks
 		 */
-		if (con_num != sess->s.con_num || cid >= sess->s.con_num) {
+		if (con_num != s->con_num || cid >= s->con_num) {
 			rtrs_err(s, "Incorrect request: %d, %d\n",
 				  cid, con_num);
 			mutex_unlock(&srv->paths_mutex);
 			goto reject_w_econnreset;
 		}
-		if (sess->s.con[cid]) {
+		if (s->con[cid]) {
 			rtrs_err(s, "Connection already exists: %d\n",
 				  cid);
 			mutex_unlock(&srv->paths_mutex);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/rtrs: server: use already dereferenced rtrs_sess structure
  2020-05-22  8:28 [PATCH] RDMA/rtrs: server: use already dereferenced rtrs_sess structure haris.phnx
@ 2020-05-22 10:01 ` Danil Kipnis
  2020-05-23  0:25 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Danil Kipnis @ 2020-05-22 10:01 UTC (permalink / raw)
  To: haris iqbal
  Cc: linux-block, linux-rdma, Jinpu Wang, Jens Axboe, Doug Ledford,
	Jason Gunthorpe

On Fri, May 22, 2020 at 10:28 AM <haris.phnx@gmail.com> wrote:
>
> From: Md Haris Iqbal <haris.phnx@gmail.com>
>
> The rtrs_sess structure has already been extracted above from the
> rtrs_srv_sess structure. Use that to avoid redundant dereferencing.
>
> Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality")
> Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com>
> ---
>  drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> index 1fc6ece036ff..5ef8988ee75b 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> @@ -1822,13 +1822,13 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_id,
>                 /*
>                  * Sanity checks
>                  */
> -               if (con_num != sess->s.con_num || cid >= sess->s.con_num) {
> +               if (con_num != s->con_num || cid >= s->con_num) {
>                         rtrs_err(s, "Incorrect request: %d, %d\n",
>                                   cid, con_num);
>                         mutex_unlock(&srv->paths_mutex);
>                         goto reject_w_econnreset;
>                 }
> -               if (sess->s.con[cid]) {
> +               if (s->con[cid]) {
>                         rtrs_err(s, "Connection already exists: %d\n",
>                                   cid);
>                         mutex_unlock(&srv->paths_mutex);
> --
> 2.25.1
>

Acked-by: Danil Kipnis <danil.kipnis@cloud.ionos.com>

Thanks Haris.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/rtrs: server: use already dereferenced rtrs_sess structure
  2020-05-22  8:28 [PATCH] RDMA/rtrs: server: use already dereferenced rtrs_sess structure haris.phnx
  2020-05-22 10:01 ` Danil Kipnis
@ 2020-05-23  0:25 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-05-23  0:25 UTC (permalink / raw)
  To: haris.phnx
  Cc: linux-block, linux-rdma, danil.kipnis, jinpu.wang, axboe, dledford

On Fri, May 22, 2020 at 08:28:33AM +0000, haris.phnx@gmail.com wrote:
> From: Md Haris Iqbal <haris.phnx@gmail.com>
> 
> The rtrs_sess structure has already been extracted above from the
> rtrs_srv_sess structure. Use that to avoid redundant dereferencing.
> 
> Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality")
> Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com>
> Acked-by: Danil Kipnis <danil.kipnis@cloud.ionos.com>
> ---
>  drivers/infiniband/ulp/rtrs/rtrs-srv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied to for-next, thanks

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22  8:28 [PATCH] RDMA/rtrs: server: use already dereferenced rtrs_sess structure haris.phnx
2020-05-22 10:01 ` Danil Kipnis
2020-05-23  0:25 ` Jason Gunthorpe

Linux-RDMA Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rdma/0 linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ https://lore.kernel.org/linux-rdma \
		linux-rdma@vger.kernel.org
	public-inbox-index linux-rdma

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rdma


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git