Skip to contentSkip to conversation

RDS: IB: Limit the scope of has_fr/has_fmr variables

PATCH Superseded Avinash Repaka 3 participants 7 messages Sep 30, 2017 – Oct 4, 2017

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDS: IB: Limit the scope of has_fr/has_fmr variables

This patch fixes the scope of has_fr and has_fmr variables as they are needed only in rds_ib_add_one().

---
 net/rds/ib.c | 11 ++++++-----
 net/rds/ib.h |  2 --
 2 files changed, 6 insertions(+), 7 deletions(-)
net/rds/ib.c +6 -5
index a0954ac..36dd209 100644
@@ -126,6 +126,7 @@ void rds_ib_dev_put(struct rds_ib_device *rds_ibdev)
 static void rds_ib_add_one(struct ib_device *device)
 {
 	struct rds_ib_device *rds_ibdev;
+	bool has_fr, has_fmr;
 
 	/* Only handle IB (no iWARP) devices */
 	if (device->node_type != RDMA_NODE_IB_CA)
@@ -143,11 +144,11 @@ static void rds_ib_add_one(struct ib_device *device)
 	rds_ibdev->max_wrs = device->attrs.max_qp_wr;
 	rds_ibdev->max_sge = min(device->attrs.max_sge, RDS_IB_MAX_SGE);
 
-	rds_ibdev->has_fr = (device->attrs.device_cap_flags &
-				  IB_DEVICE_MEM_MGT_EXTENSIONS);
-	rds_ibdev->has_fmr = (device->alloc_fmr && device->dealloc_fmr &&
-			    device->map_phys_fmr && device->unmap_fmr);
-	rds_ibdev->use_fastreg = (rds_ibdev->has_fr && !rds_ibdev->has_fmr);
+	has_fr = (device->attrs.device_cap_flags &
+		  IB_DEVICE_MEM_MGT_EXTENSIONS);
+	has_fmr = (device->alloc_fmr && device->dealloc_fmr &&
+		   device->map_phys_fmr && device->unmap_fmr);
+	rds_ibdev->use_fastreg = (has_fr && !has_fmr);
 
 	rds_ibdev->fmr_max_remaps = device->attrs.max_map_per_fmr?: 32;
 	rds_ibdev->max_1m_mrs = device->attrs.max_mr ?
net/rds/ib.h +0 -2
index bf48224..6ea6a27 100644
@@ -215,8 +215,6 @@ struct rds_ib_device {
 	struct list_head	conn_list;
 	struct ib_device	*dev;
 	struct ib_pd		*pd;
-	bool                    has_fmr;
-	bool                    has_fr;
 	bool                    use_fastreg;
 
 	unsigned int		max_mrs;
Signature · 6 lines
2.4.11

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#2 lore raw
In reply to Avinash Repaka

From: Avinash Repaka <[email protected]>
Date: Fri, 29 Sep 2017 18:13:50 -0700

Quoted 4 lines

This patch fixes the scope of has_fr and has_fmr variables as they are needed only in rds_ib_add_one().

Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#3 lore raw

From: David Miller <davem-fT/PcQaiUtIeIZ0/[email protected]>
Date: Sun, 01 Oct 2017 22:54:19 -0700 (PDT)

Quoted 9 lines

From: Avinash Repaka <[email protected]>
Date: Fri, 29 Sep 2017 18:13:50 -0700

Quoted 4 lines

This patch fixes the scope of has_fr and has_fmr variables as they are needed only in rds_ib_add_one().

Applied.

Actually, reverted, this breaks the build.

net/rds/rdma_transport.c:38:10: fatal error: ib.h: No such file or directory
#include "ib.h"

Although I can't see how in the world this patch is causing such an error.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 13 lines · David Miller

From: David Miller <[email protected]>
Date: Sun, 01 Oct 2017 22:54:19 -0700 (PDT)

Quoted 9 lines

From: Avinash Repaka <[email protected]>
Date: Fri, 29 Sep 2017 18:13:50 -0700

Quoted 4 lines

This patch fixes the scope of has_fr and has_fmr variables as they are needed only in rds_ib_add_one().

Applied.

Quoted 8 lines

Actually, reverted, this breaks the build.

net/rds/rdma_transport.c:38:10: fatal error: ib.h: No such file or directory
#include "ib.h"

Although I can't see how in the world this patch is causing such an error.

Weird indeed. Will sort this out with Avinash. Thanks Dave.

Regards,
Santosh

#5 lore raw

Hi Dave,

Quoted 2 lines · Santosh Shilimkar
Quoted 1 line · David Miller

From: David Miller <[email protected]>

[...]

Quoted 11 lines
Quoted 9 lines

Actually, reverted, this breaks the build.

net/rds/rdma_transport.c:38:10: fatal error: ib.h: No such file or directory #include "ib.h"

Although I can't see how in the world this patch is causing such an error.

Weird indeed. Will sort this out with Avinash. Thanks Dave.

I tried few build combinations on net-next but couldn't reproduce the build failure. AFAIU, the build error can only happen if for some reason the ib.h file got deleted accidentally. I did delete ib.h file and saw below error

CC [M] net/rds/rdma_transport.o
net/rds/rdma_transport.c:38:16: error: ib.h: No such file or directory

Could it be the case for some reason the ib.h file got deleted or mangled while applying the $subject patch ?

Regards,
Santosh

maintainer
#6 lore raw

From: Santosh Shilimkar <[email protected]>
Date: Tue, 3 Oct 2017 17:42:39 -0700

Quoted 24 lines

Hi Dave,

Quoted 2 lines · Santosh Shilimkar
Quoted 1 line · David Miller

From: David Miller <davem-fT/PcQaiUtIeIZ0/[email protected]>

[...]

Quoted 12 lines
Quoted 10 lines

Actually, reverted, this breaks the build.

net/rds/rdma_transport.c:38:10: fatal error: ib.h: No such file or directory
  #include "ib.h"

Although I can't see how in the world this patch is causing such an error.

Weird indeed. Will sort this out with Avinash. Thanks Dave.

I tried few build combinations on net-next but couldn't reproduce the build failure. AFAIU, the build error can only happen if for some reason the ib.h file got deleted accidentally. I did delete ib.h file and saw below error

Quoted 5 lines

CC [M] net/rds/rdma_transport.o
net/rds/rdma_transport.c:38:16: error: ib.h: No such file or directory

Could it be the case for some reason the ib.h file got deleted or mangled while applying the $subject patch ?

Please post the patch again, I will try to sort it out.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html